mirror of
https://github.com/jiangteng2019/satellite-track.git
synced 2025-06-17 07:18:18 +00:00
13937 lines
3.5 MiB
13937 lines
3.5 MiB
var Qpe=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var fCt=Qpe((Lh,Bh)=>{(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))i(o);new MutationObserver(o=>{for(const r of o)if(r.type==="childList")for(const s of r.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&i(s)}).observe(document,{childList:!0,subtree:!0});function n(o){const r={};return o.integrity&&(r.integrity=o.integrity),o.referrerpolicy&&(r.referrerPolicy=o.referrerpolicy),o.crossorigin==="use-credentials"?r.credentials="include":o.crossorigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function i(o){if(o.ep)return;o.ep=!0;const r=n(o);fetch(o.href,r)}})();function V2(e,t){const n=Object.create(null),i=e.split(",");for(let o=0;o<i.length;o++)n[i[o]]=!0;return t?o=>!!n[o.toLowerCase()]:o=>!!n[o]}function hT(e){if(dn(e)){const t={};for(let n=0;n<e.length;n++){const i=e[n],o=Do(i)?nme(i):hT(i);if(o)for(const r in o)t[r]=o[r]}return t}else{if(Do(e))return e;if(Ao(e))return e}}const Zpe=/;(?![^(]*\))/g,eme=/:([^]+)/,tme=/\/\*.*?\*\//gs;function nme(e){const t={};return e.replace(tme,"").split(Zpe).forEach(n=>{if(n){const i=n.split(eme);i.length>1&&(t[i[0].trim()]=i[1].trim())}}),t}function go(e){let t="";if(Do(e))t=e;else if(dn(e))for(let n=0;n<e.length;n++){const i=go(e[n]);i&&(t+=i+" ")}else if(Ao(e))for(const n in e)e[n]&&(t+=n+" ");return t.trim()}const ime="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",ome=V2(ime);function aY(e){return!!e||e===""}function rme(e,t){if(e.length!==t.length)return!1;let n=!0;for(let i=0;n&&i<e.length;i++)n=C1(e[i],t[i]);return n}function C1(e,t){if(e===t)return!0;let n=N4(e),i=N4(t);if(n||i)return n&&i?e.getTime()===t.getTime():!1;if(n=cE(e),i=cE(t),n||i)return e===t;if(n=dn(e),i=dn(t),n||i)return n&&i?rme(e,t):!1;if(n=Ao(e),i=Ao(t),n||i){if(!n||!i)return!1;const o=Object.keys(e).length,r=Object.keys(t).length;if(o!==r)return!1;for(const s in e){const a=e.hasOwnProperty(s),c=t.hasOwnProperty(s);if(a&&!c||!a&&c||!C1(e[s],t[s]))return!1}}return String(e)===String(t)}function cY(e,t){return e.findIndex(n=>C1(n,t))}const Kg=e=>Do(e)?e:e==null?"":dn(e)||Ao(e)&&(e.toString===fY||!$n(e.toString))?JSON.stringify(e,lY,2):String(e),lY=(e,t)=>t&&t.__v_isRef?lY(e,t.value):TA(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((n,[i,o])=>(n[`${i} =>`]=o,n),{})}:E1(t)?{[`Set(${t.size})`]:[...t.values()]}:Ao(t)&&!dn(t)&&!dY(t)?String(t):t,Qo={},AA=[],mc=()=>{},sme=()=>!1,ame=/^on[^a-z]/,b1=e=>ame.test(e),k2=e=>e.startsWith("onUpdate:"),fa=Object.assign,G2=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},cme=Object.prototype.hasOwnProperty,Bi=(e,t)=>cme.call(e,t),dn=Array.isArray,TA=e=>sx(e)==="[object Map]",E1=e=>sx(e)==="[object Set]",N4=e=>sx(e)==="[object Date]",$n=e=>typeof e=="function",Do=e=>typeof e=="string",cE=e=>typeof e=="symbol",Ao=e=>e!==null&&typeof e=="object",uY=e=>Ao(e)&&$n(e.then)&&$n(e.catch),fY=Object.prototype.toString,sx=e=>fY.call(e),lme=e=>sx(e).slice(8,-1),dY=e=>sx(e)==="[object Object]",W2=e=>Do(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,dD=V2(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),x1=e=>{const t=Object.create(null);return n=>t[n]||(t[n]=e(n))},ume=/-(\w)/g,df=x1(e=>e.replace(ume,(t,n)=>n?n.toUpperCase():"")),fme=/\B([A-Z])/g,pT=x1(e=>e.replace(fme,"-$1").toLowerCase()),w1=x1(e=>e.charAt(0).toUpperCase()+e.slice(1)),pL=x1(e=>e?`on${w1(e)}`:""),lE=(e,t)=>!Object.is(e,t),hD=(e,t)=>{for(let n=0;n<e.length;n++)e[n](t)},cI=(e,t,n)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,value:n})},q2=e=>{const t=parseFloat(e);return isNaN(t)?e:t};let M4;const dme=()=>M4||(M4=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});let Xc;class hY{constructor(t=!1){this.detached=t,this.active=!0,this.effects=[],this.cleanups=[],this.parent=Xc,!t&&Xc&&(this.index=(Xc.scopes||(Xc.scopes=[])).push(this)-1)}run(t){if(this.active){const n=Xc;try{return Xc=this,t()}finally{Xc=n}}}on(){Xc=this}off(){Xc=this.parent}stop(t){if(this.active){let n,i;for(n=0,i=this.effects.length;n<i;n++)this.effects[n].stop();for(n=0,i=this.cleanups.length;n<i;n++)this.cleanups[n]();if(this.scopes)for(n=0,i=this.scopes.length;n<i;n++)this.scopes[n].stop(!0);if(!this.detached&&this.parent&&!t){const o=this.parent.scopes.pop();o&&o!==this&&(this.parent.scopes[this.index]=o,o.index=this.index)}this.parent=void 0,this.active=!1}}}function hme(e){return new hY(e)}function pme(e,t=Xc){t&&t.active&&t.effects.push(e)}function mme(){return Xc}function pY(e){Xc&&Xc.cleanups.push(e)}const j2=e=>{const t=new Set(e);return t.w=0,t.n=0,t},mY=e=>(e.w&Ym)>0,_Y=e=>(e.n&Ym)>0,_me=({deps:e})=>{if(e.length)for(let t=0;t<e.length;t++)e[t].w|=Ym},gme=e=>{const{deps:t}=e;if(t.length){let n=0;for(let i=0;i<t.length;i++){const o=t[i];mY(o)&&!_Y(o)?o.delete(e):t[n++]=o,o.w&=~Ym,o.n&=~Ym}t.length=n}},aM=new WeakMap;let db=0,Ym=1;const cM=30;let Xu;const zg=Symbol(""),lM=Symbol("");class Y2{constructor(t,n=null,i){this.fn=t,this.scheduler=n,this.active=!0,this.deps=[],this.parent=void 0,pme(this,i)}run(){if(!this.active)return this.fn();let t=Xu,n=Om;for(;t;){if(t===this)return;t=t.parent}try{return this.parent=Xu,Xu=this,Om=!0,Ym=1<<++db,db<=cM?_me(this):F4(this),this.fn()}finally{db<=cM&&gme(this),Ym=1<<--db,Xu=this.parent,Om=n,this.parent=void 0,this.deferStop&&this.stop()}}stop(){Xu===this?this.deferStop=!0:this.active&&(F4(this),this.onStop&&this.onStop(),this.active=!1)}}function F4(e){const{deps:t}=e;if(t.length){for(let n=0;n<t.length;n++)t[n].delete(e);t.length=0}}let Om=!0;const gY=[];function mT(){gY.push(Om),Om=!1}function _T(){const e=gY.pop();Om=e===void 0?!0:e}function hl(e,t,n){if(Om&&Xu){let i=aM.get(e);i||aM.set(e,i=new Map);let o=i.get(n);o||i.set(n,o=j2()),yY(o)}}function yY(e,t){let n=!1;db<=cM?_Y(e)||(e.n|=Ym,n=!mY(e)):n=!e.has(Xu),n&&(e.add(Xu),Xu.deps.push(e))}function Yh(e,t,n,i,o,r){const s=aM.get(e);if(!s)return;let a=[];if(t==="clear")a=[...s.values()];else if(n==="length"&&dn(e)){const c=q2(i);s.forEach((u,f)=>{(f==="length"||f>=c)&&a.push(u)})}else switch(n!==void 0&&a.push(s.get(n)),t){case"add":dn(e)?W2(n)&&a.push(s.get("length")):(a.push(s.get(zg)),TA(e)&&a.push(s.get(lM)));break;case"delete":dn(e)||(a.push(s.get(zg)),TA(e)&&a.push(s.get(lM)));break;case"set":TA(e)&&a.push(s.get(zg));break}if(a.length===1)a[0]&&uM(a[0]);else{const c=[];for(const u of a)u&&c.push(...u);uM(j2(c))}}function uM(e,t){const n=dn(e)?e:[...e];for(const i of n)i.computed&&z4(i);for(const i of n)i.computed||z4(i)}function z4(e,t){(e!==Xu||e.allowRecurse)&&(e.scheduler?e.scheduler():e.run())}const yme=V2("__proto__,__v_isRef,__isVue"),AY=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(cE)),Ame=$2(),Tme=$2(!1,!0),Cme=$2(!0),U4=bme();function bme(){const e={};return["includes","indexOf","lastIndexOf"].forEach(t=>{e[t]=function(...n){const i=ji(this);for(let r=0,s=this.length;r<s;r++)hl(i,"get",r+"");const o=i[t](...n);return o===-1||o===!1?i[t](...n.map(ji)):o}}),["push","pop","shift","unshift","splice"].forEach(t=>{e[t]=function(...n){mT();const i=ji(this)[t].apply(this,n);return _T(),i}}),e}function $2(e=!1,t=!1){return function(i,o,r){if(o==="__v_isReactive")return!e;if(o==="__v_isReadonly")return e;if(o==="__v_isShallow")return t;if(o==="__v_raw"&&r===(e?t?zme:xY:t?EY:bY).get(i))return i;const s=dn(i);if(!e&&s&&Bi(U4,o))return Reflect.get(U4,o,r);const a=Reflect.get(i,o,r);return(cE(o)?AY.has(o):yme(o))||(e||hl(i,"get",o),t)?a:Ir(a)?s&&W2(o)?a:a.value:Ao(a)?e?SY(a):ax(a):a}}const Eme=TY(),xme=TY(!0);function TY(e=!1){return function(n,i,o,r){let s=n[i];if(kA(s)&&Ir(s)&&!Ir(o))return!1;if(!e&&(!lI(o)&&!kA(o)&&(s=ji(s),o=ji(o)),!dn(n)&&Ir(s)&&!Ir(o)))return s.value=o,!0;const a=dn(n)&&W2(i)?Number(i)<n.length:Bi(n,i),c=Reflect.set(n,i,o,r);return n===ji(r)&&(a?lE(o,s)&&Yh(n,"set",i,o):Yh(n,"add",i,o)),c}}function wme(e,t){const n=Bi(e,t);e[t];const i=Reflect.deleteProperty(e,t);return i&&n&&Yh(e,"delete",t,void 0),i}function Sme(e,t){const n=Reflect.has(e,t);return(!cE(t)||!AY.has(t))&&hl(e,"has",t),n}function vme(e){return hl(e,"iterate",dn(e)?"length":zg),Reflect.ownKeys(e)}const CY={get:Ame,set:Eme,deleteProperty:wme,has:Sme,ownKeys:vme},Dme={get:Cme,set(e,t){return!0},deleteProperty(e,t){return!0}},Ime=fa({},CY,{get:Tme,set:xme}),X2=e=>e,S1=e=>Reflect.getPrototypeOf(e);function $w(e,t,n=!1,i=!1){e=e.__v_raw;const o=ji(e),r=ji(t);n||(t!==r&&hl(o,"get",t),hl(o,"get",r));const{has:s}=S1(o),a=i?X2:n?Z2:uE;if(s.call(o,t))return a(e.get(t));if(s.call(o,r))return a(e.get(r));e!==o&&e.get(t)}function Xw(e,t=!1){const n=this.__v_raw,i=ji(n),o=ji(e);return t||(e!==o&&hl(i,"has",e),hl(i,"has",o)),e===o?n.has(e):n.has(e)||n.has(o)}function Kw(e,t=!1){return e=e.__v_raw,!t&&hl(ji(e),"iterate",zg),Reflect.get(e,"size",e)}function H4(e){e=ji(e);const t=ji(this);return S1(t).has.call(t,e)||(t.add(e),Yh(t,"add",e,e)),this}function V4(e,t){t=ji(t);const n=ji(this),{has:i,get:o}=S1(n);let r=i.call(n,e);r||(e=ji(e),r=i.call(n,e));const s=o.call(n,e);return n.set(e,t),r?lE(t,s)&&Yh(n,"set",e,t):Yh(n,"add",e,t),this}function k4(e){const t=ji(this),{has:n,get:i}=S1(t);let o=n.call(t,e);o||(e=ji(e),o=n.call(t,e)),i&&i.call(t,e);const r=t.delete(e);return o&&Yh(t,"delete",e,void 0),r}function G4(){const e=ji(this),t=e.size!==0,n=e.clear();return t&&Yh(e,"clear",void 0,void 0),n}function Jw(e,t){return function(i,o){const r=this,s=r.__v_raw,a=ji(s),c=t?X2:e?Z2:uE;return!e&&hl(a,"iterate",zg),s.forEach((u,f)=>i.call(o,c(u),c(f),r))}}function Qw(e,t,n){return function(...i){const o=this.__v_raw,r=ji(o),s=TA(r),a=e==="entries"||e===Symbol.iterator&&s,c=e==="keys"&&s,u=o[e](...i),f=n?X2:t?Z2:uE;return!t&&hl(r,"iterate",c?lM:zg),{next(){const{value:h,done:_}=u.next();return _?{value:h,done:_}:{value:a?[f(h[0]),f(h[1])]:f(h),done:_}},[Symbol.iterator](){return this}}}}function Up(e){return function(...t){return e==="delete"?!1:this}}function Pme(){const e={get(r){return $w(this,r)},get size(){return Kw(this)},has:Xw,add:H4,set:V4,delete:k4,clear:G4,forEach:Jw(!1,!1)},t={get(r){return $w(this,r,!1,!0)},get size(){return Kw(this)},has:Xw,add:H4,set:V4,delete:k4,clear:G4,forEach:Jw(!1,!0)},n={get(r){return $w(this,r,!0)},get size(){return Kw(this,!0)},has(r){return Xw.call(this,r,!0)},add:Up("add"),set:Up("set"),delete:Up("delete"),clear:Up("clear"),forEach:Jw(!0,!1)},i={get(r){return $w(this,r,!0,!0)},get size(){return Kw(this,!0)},has(r){return Xw.call(this,r,!0)},add:Up("add"),set:Up("set"),delete:Up("delete"),clear:Up("clear"),forEach:Jw(!0,!0)};return["keys","values","entries",Symbol.iterator].forEach(r=>{e[r]=Qw(r,!1,!1),n[r]=Qw(r,!0,!1),t[r]=Qw(r,!1,!0),i[r]=Qw(r,!0,!0)}),[e,n,t,i]}const[Ome,Lme,Bme,Rme]=Pme();function K2(e,t){const n=t?e?Rme:Bme:e?Lme:Ome;return(i,o,r)=>o==="__v_isReactive"?!e:o==="__v_isReadonly"?e:o==="__v_raw"?i:Reflect.get(Bi(n,o)&&o in i?n:i,o,r)}const Nme={get:K2(!1,!1)},Mme={get:K2(!1,!0)},Fme={get:K2(!0,!1)},bY=new WeakMap,EY=new WeakMap,xY=new WeakMap,zme=new WeakMap;function Ume(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function Hme(e){return e.__v_skip||!Object.isExtensible(e)?0:Ume(lme(e))}function ax(e){return kA(e)?e:J2(e,!1,CY,Nme,bY)}function wY(e){return J2(e,!1,Ime,Mme,EY)}function SY(e){return J2(e,!0,Dme,Fme,xY)}function J2(e,t,n,i,o){if(!Ao(e)||e.__v_raw&&!(t&&e.__v_isReactive))return e;const r=o.get(e);if(r)return r;const s=Hme(e);if(s===0)return e;const a=new Proxy(e,s===2?i:n);return o.set(e,a),a}function CA(e){return kA(e)?CA(e.__v_raw):!!(e&&e.__v_isReactive)}function kA(e){return!!(e&&e.__v_isReadonly)}function lI(e){return!!(e&&e.__v_isShallow)}function vY(e){return CA(e)||kA(e)}function ji(e){const t=e&&e.__v_raw;return t?ji(t):e}function Q2(e){return cI(e,"__v_skip",!0),e}const uE=e=>Ao(e)?ax(e):e,Z2=e=>Ao(e)?SY(e):e;function DY(e){Om&&Xu&&(e=ji(e),yY(e.dep||(e.dep=j2())))}function IY(e,t){e=ji(e),e.dep&&uM(e.dep)}function Ir(e){return!!(e&&e.__v_isRef===!0)}function xo(e){return PY(e,!1)}function Vme(e){return PY(e,!0)}function PY(e,t){return Ir(e)?e:new kme(e,t)}class kme{constructor(t,n){this.__v_isShallow=n,this.dep=void 0,this.__v_isRef=!0,this._rawValue=n?t:ji(t),this._value=n?t:uE(t)}get value(){return DY(this),this._value}set value(t){const n=this.__v_isShallow||lI(t)||kA(t);t=n?t:ji(t),lE(t,this._rawValue)&&(this._rawValue=t,this._value=n?t:uE(t),IY(this))}}function xt(e){return Ir(e)?e.value:e}const Gme={get:(e,t,n)=>xt(Reflect.get(e,t,n)),set:(e,t,n,i)=>{const o=e[t];return Ir(o)&&!Ir(n)?(o.value=n,!0):Reflect.set(e,t,n,i)}};function OY(e){return CA(e)?e:new Proxy(e,Gme)}function Wme(e){const t=dn(e)?new Array(e.length):{};for(const n in e)t[n]=LY(e,n);return t}class qme{constructor(t,n,i){this._object=t,this._key=n,this._defaultValue=i,this.__v_isRef=!0}get value(){const t=this._object[this._key];return t===void 0?this._defaultValue:t}set value(t){this._object[this._key]=t}}function LY(e,t,n){const i=e[t];return Ir(i)?i:new qme(e,t,n)}var BY;class jme{constructor(t,n,i,o){this._setter=n,this.dep=void 0,this.__v_isRef=!0,this[BY]=!1,this._dirty=!0,this.effect=new Y2(t,()=>{this._dirty||(this._dirty=!0,IY(this))}),this.effect.computed=this,this.effect.active=this._cacheable=!o,this.__v_isReadonly=i}get value(){const t=ji(this);return DY(t),(t._dirty||!t._cacheable)&&(t._dirty=!1,t._value=t.effect.run()),t._value}set value(t){this._setter(t)}}BY="__v_isReadonly";function RY(e,t,n=!1){let i,o;const r=$n(e);return r?(i=e,o=mc):(i=e.get,o=e.set),new jme(i,o,r||!o,n)}function Yme(e,...t){}function Lm(e,t,n,i){let o;try{o=i?e(...i):e()}catch(r){v1(r,t,n)}return o}function au(e,t,n,i){if($n(e)){const r=Lm(e,t,n,i);return r&&uY(r)&&r.catch(s=>{v1(s,t,n)}),r}const o=[];for(let r=0;r<e.length;r++)o.push(au(e[r],t,n,i));return o}function v1(e,t,n,i=!0){const o=t?t.vnode:null;if(t){let r=t.parent;const s=t.proxy,a=n;for(;r;){const u=r.ec;if(u){for(let f=0;f<u.length;f++)if(u[f](e,s,a)===!1)return}r=r.parent}const c=t.appContext.config.errorHandler;if(c){Lm(c,null,10,[e,s,a]);return}}$me(e,n,o,i)}function $me(e,t,n,i=!0){console.error(e)}let fE=!1,fM=!1;const Ba=[];let rd=0;const bA=[];let gh=null,bg=0;const NY=Promise.resolve();let e3=null;function $m(e){const t=e3||NY;return e?t.then(this?e.bind(this):e):t}function Xme(e){let t=rd+1,n=Ba.length;for(;t<n;){const i=t+n>>>1;dE(Ba[i])<e?t=i+1:n=i}return t}function t3(e){(!Ba.length||!Ba.includes(e,fE&&e.allowRecurse?rd+1:rd))&&(e.id==null?Ba.push(e):Ba.splice(Xme(e.id),0,e),MY())}function MY(){!fE&&!fM&&(fM=!0,e3=NY.then(zY))}function Kme(e){const t=Ba.indexOf(e);t>rd&&Ba.splice(t,1)}function Jme(e){dn(e)?bA.push(...e):(!gh||!gh.includes(e,e.allowRecurse?bg+1:bg))&&bA.push(e),MY()}function W4(e,t=fE?rd+1:0){for(;t<Ba.length;t++){const n=Ba[t];n&&n.pre&&(Ba.splice(t,1),t--,n())}}function FY(e){if(bA.length){const t=[...new Set(bA)];if(bA.length=0,gh){gh.push(...t);return}for(gh=t,gh.sort((n,i)=>dE(n)-dE(i)),bg=0;bg<gh.length;bg++)gh[bg]();gh=null,bg=0}}const dE=e=>e.id==null?1/0:e.id,Qme=(e,t)=>{const n=dE(e)-dE(t);if(n===0){if(e.pre&&!t.pre)return-1;if(t.pre&&!e.pre)return 1}return n};function zY(e){fM=!1,fE=!0,Ba.sort(Qme);const t=mc;try{for(rd=0;rd<Ba.length;rd++){const n=Ba[rd];n&&n.active!==!1&&Lm(n,null,14)}}finally{rd=0,Ba.length=0,FY(),fE=!1,e3=null,(Ba.length||bA.length)&&zY()}}function Zme(e,t,...n){if(e.isUnmounted)return;const i=e.vnode.props||Qo;let o=n;const r=t.startsWith("update:"),s=r&&t.slice(7);if(s&&s in i){const f=`${s==="modelValue"?"model":s}Modifiers`,{number:h,trim:_}=i[f]||Qo;_&&(o=n.map(g=>Do(g)?g.trim():g)),h&&(o=n.map(q2))}let a,c=i[a=pL(t)]||i[a=pL(df(t))];!c&&r&&(c=i[a=pL(pT(t))]),c&&au(c,e,6,o);const u=i[a+"Once"];if(u){if(!e.emitted)e.emitted={};else if(e.emitted[a])return;e.emitted[a]=!0,au(u,e,6,o)}}function UY(e,t,n=!1){const i=t.emitsCache,o=i.get(e);if(o!==void 0)return o;const r=e.emits;let s={},a=!1;if(!$n(e)){const c=u=>{const f=UY(u,t,!0);f&&(a=!0,fa(s,f))};!n&&t.mixins.length&&t.mixins.forEach(c),e.extends&&c(e.extends),e.mixins&&e.mixins.forEach(c)}return!r&&!a?(Ao(e)&&i.set(e,null),null):(dn(r)?r.forEach(c=>s[c]=null):fa(s,r),Ao(e)&&i.set(e,s),s)}function D1(e,t){return!e||!b1(t)?!1:(t=t.slice(2).replace(/Once$/,""),Bi(e,t[0].toLowerCase()+t.slice(1))||Bi(e,pT(t))||Bi(e,t))}let ua=null,HY=null;function uI(e){const t=ua;return ua=e,HY=e&&e.type.__scopeId||null,t}function za(e,t=ua,n){if(!t||e._n)return e;const i=(...o)=>{i._d&&tk(-1);const r=uI(t);let s;try{s=e(...o)}finally{uI(r),i._d&&tk(1)}return s};return i._n=!0,i._c=!0,i._d=!0,i}function mL(e){const{type:t,vnode:n,proxy:i,withProxy:o,props:r,propsOptions:[s],slots:a,attrs:c,emit:u,render:f,renderCache:h,data:_,setupState:g,ctx:p,inheritAttrs:y}=e;let T,b;const x=uI(e);try{if(n.shapeFlag&4){const D=o||i;T=ed(f.call(D,D,h,r,g,_,p)),b=c}else{const D=t;T=ed(D.length>1?D(r,{attrs:c,slots:a,emit:u}):D(r,null)),b=t.props?c:e_e(c)}}catch(D){Fb.length=0,v1(D,e,1),T=nr(cu)}let v=T;if(b&&y!==!1){const D=Object.keys(b),{shapeFlag:L}=v;D.length&&L&7&&(s&&D.some(k2)&&(b=t_e(b,s)),v=Xm(v,b))}return n.dirs&&(v=Xm(v),v.dirs=v.dirs?v.dirs.concat(n.dirs):n.dirs),n.transition&&(v.transition=n.transition),T=v,uI(x),T}const e_e=e=>{let t;for(const n in e)(n==="class"||n==="style"||b1(n))&&((t||(t={}))[n]=e[n]);return t},t_e=(e,t)=>{const n={};for(const i in e)(!k2(i)||!(i.slice(9)in t))&&(n[i]=e[i]);return n};function n_e(e,t,n){const{props:i,children:o,component:r}=e,{props:s,children:a,patchFlag:c}=t,u=r.emitsOptions;if(t.dirs||t.transition)return!0;if(n&&c>=0){if(c&1024)return!0;if(c&16)return i?q4(i,s,u):!!s;if(c&8){const f=t.dynamicProps;for(let h=0;h<f.length;h++){const _=f[h];if(s[_]!==i[_]&&!D1(u,_))return!0}}}else return(o||a)&&(!a||!a.$stable)?!0:i===s?!1:i?s?q4(i,s,u):!0:!!s;return!1}function q4(e,t,n){const i=Object.keys(t);if(i.length!==Object.keys(e).length)return!0;for(let o=0;o<i.length;o++){const r=i[o];if(t[r]!==e[r]&&!D1(n,r))return!0}return!1}function i_e({vnode:e,parent:t},n){for(;t&&t.subTree===e;)(e=t.vnode).el=n,t=t.parent}const o_e=e=>e.__isSuspense;function r_e(e,t){t&&t.pendingBranch?dn(e)?t.effects.push(...e):t.effects.push(e):Jme(e)}function Bm(e,t){if(Gs){let n=Gs.provides;const i=Gs.parent&&Gs.parent.provides;i===n&&(n=Gs.provides=Object.create(i)),n[e]=t}}function Qr(e,t,n=!1){const i=Gs||ua;if(i){const o=i.parent==null?i.vnode.appContext&&i.vnode.appContext.provides:i.parent.provides;if(o&&e in o)return o[e];if(arguments.length>1)return n&&$n(t)?t.call(i.proxy):t}}const Zw={};function ws(e,t,n){return VY(e,t,n)}function VY(e,t,{immediate:n,deep:i,flush:o,onTrack:r,onTrigger:s}=Qo){const a=Gs;let c,u=!1,f=!1;if(Ir(e)?(c=()=>e.value,u=lI(e)):CA(e)?(c=()=>e,i=!0):dn(e)?(f=!0,u=e.some(v=>CA(v)||lI(v)),c=()=>e.map(v=>{if(Ir(v))return v.value;if(CA(v))return Og(v);if($n(v))return Lm(v,a,2)})):$n(e)?t?c=()=>Lm(e,a,2):c=()=>{if(!(a&&a.isUnmounted))return h&&h(),au(e,a,3,[_])}:c=mc,t&&i){const v=c;c=()=>Og(v())}let h,_=v=>{h=b.onStop=()=>{Lm(v,a,4)}},g;if(mE)if(_=mc,t?n&&au(t,a,3,[c(),f?[]:void 0,_]):c(),o==="sync"){const v=Z_e();g=v.__watcherHandles||(v.__watcherHandles=[])}else return mc;let p=f?new Array(e.length).fill(Zw):Zw;const y=()=>{if(b.active)if(t){const v=b.run();(i||u||(f?v.some((D,L)=>lE(D,p[L])):lE(v,p)))&&(h&&h(),au(t,a,3,[v,p===Zw?void 0:f&&p[0]===Zw?[]:p,_]),p=v)}else b.run()};y.allowRecurse=!!t;let T;o==="sync"?T=y:o==="post"?T=()=>Rc(y,a&&a.suspense):(y.pre=!0,a&&(y.id=a.uid),T=()=>t3(y));const b=new Y2(c,T);t?n?y():p=b.run():o==="post"?Rc(b.run.bind(b),a&&a.suspense):b.run();const x=()=>{b.stop(),a&&a.scope&&G2(a.scope.effects,b)};return g&&g.push(x),x}function s_e(e,t,n){const i=this.proxy,o=Do(e)?e.includes(".")?kY(i,e):()=>i[e]:e.bind(i,i);let r;$n(t)?r=t:(r=t.handler,n=t);const s=Gs;WA(this);const a=VY(o,r.bind(i),n);return s?WA(s):Ug(),a}function kY(e,t){const n=t.split(".");return()=>{let i=e;for(let o=0;o<n.length&&i;o++)i=i[n[o]];return i}}function Og(e,t){if(!Ao(e)||e.__v_skip||(t=t||new Set,t.has(e)))return e;if(t.add(e),Ir(e))Og(e.value,t);else if(dn(e))for(let n=0;n<e.length;n++)Og(e[n],t);else if(E1(e)||TA(e))e.forEach(n=>{Og(n,t)});else if(dY(e))for(const n in e)Og(e[n],t);return e}function a_e(){const e={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return Dd(()=>{e.isMounted=!0}),cx(()=>{e.isUnmounting=!0}),e}const Ml=[Function,Array],c_e={name:"BaseTransition",props:{mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:Ml,onEnter:Ml,onAfterEnter:Ml,onEnterCancelled:Ml,onBeforeLeave:Ml,onLeave:Ml,onAfterLeave:Ml,onLeaveCancelled:Ml,onBeforeAppear:Ml,onAppear:Ml,onAfterAppear:Ml,onAppearCancelled:Ml},setup(e,{slots:t}){const n=Id(),i=a_e();let o;return()=>{const r=t.default&&qY(t.default(),!0);if(!r||!r.length)return;let s=r[0];if(r.length>1){for(const y of r)if(y.type!==cu){s=y;break}}const a=ji(e),{mode:c}=a;if(i.isLeaving)return _L(s);const u=j4(s);if(!u)return _L(s);const f=dM(u,a,i,n);hM(u,f);const h=n.subTree,_=h&&j4(h);let g=!1;const{getTransitionKey:p}=u.type;if(p){const y=p();o===void 0?o=y:y!==o&&(o=y,g=!0)}if(_&&_.type!==cu&&(!Eg(u,_)||g)){const y=dM(_,a,i,n);if(hM(_,y),c==="out-in")return i.isLeaving=!0,y.afterLeave=()=>{i.isLeaving=!1,n.update.active!==!1&&n.update()},_L(s);c==="in-out"&&u.type!==cu&&(y.delayLeave=(T,b,x)=>{const v=WY(i,_);v[String(_.key)]=_,T._leaveCb=()=>{b(),T._leaveCb=void 0,delete f.delayedLeave},f.delayedLeave=x})}return s}}},GY=c_e;function WY(e,t){const{leavingVNodes:n}=e;let i=n.get(t.type);return i||(i=Object.create(null),n.set(t.type,i)),i}function dM(e,t,n,i){const{appear:o,mode:r,persisted:s=!1,onBeforeEnter:a,onEnter:c,onAfterEnter:u,onEnterCancelled:f,onBeforeLeave:h,onLeave:_,onAfterLeave:g,onLeaveCancelled:p,onBeforeAppear:y,onAppear:T,onAfterAppear:b,onAppearCancelled:x}=t,v=String(e.key),D=WY(n,e),L=(M,H)=>{M&&au(M,i,9,H)},B=(M,H)=>{const G=H[1];L(M,H),dn(M)?M.every(I=>I.length<=1)&&G():M.length<=1&&G()},V={mode:r,persisted:s,beforeEnter(M){let H=a;if(!n.isMounted)if(o)H=y||a;else return;M._leaveCb&&M._leaveCb(!0);const G=D[v];G&&Eg(e,G)&&G.el._leaveCb&&G.el._leaveCb(),L(H,[M])},enter(M){let H=c,G=u,I=f;if(!n.isMounted)if(o)H=T||c,G=b||u,I=x||f;else return;let O=!1;const m=M._enterCb=P=>{O||(O=!0,P?L(I,[M]):L(G,[M]),V.delayedLeave&&V.delayedLeave(),M._enterCb=void 0)};H?B(H,[M,m]):m()},leave(M,H){const G=String(e.key);if(M._enterCb&&M._enterCb(!0),n.isUnmounting)return H();L(h,[M]);let I=!1;const O=M._leaveCb=m=>{I||(I=!0,H(),m?L(p,[M]):L(g,[M]),M._leaveCb=void 0,D[G]===e&&delete D[G])};D[G]=e,_?B(_,[M,O]):O()},clone(M){return dM(M,t,n,i)}};return V}function _L(e){if(I1(e))return e=Xm(e),e.children=null,e}function j4(e){return I1(e)?e.children?e.children[0]:void 0:e}function hM(e,t){e.shapeFlag&6&&e.component?hM(e.component.subTree,t):e.shapeFlag&128?(e.ssContent.transition=t.clone(e.ssContent),e.ssFallback.transition=t.clone(e.ssFallback)):e.transition=t}function qY(e,t=!1,n){let i=[],o=0;for(let r=0;r<e.length;r++){let s=e[r];const a=n==null?s.key:String(n)+String(s.key!=null?s.key:r);s.type===aa?(s.patchFlag&128&&o++,i=i.concat(qY(s.children,t,a))):(t||s.type!==cu)&&i.push(a!=null?Xm(s,{key:a}):s)}if(o>1)for(let r=0;r<i.length;r++)i[r].patchFlag=-2;return i}function ms(e){return $n(e)?{setup:e,name:e.name}:e}const Rb=e=>!!e.type.__asyncLoader,I1=e=>e.type.__isKeepAlive;function l_e(e,t){jY(e,"a",t)}function u_e(e,t){jY(e,"da",t)}function jY(e,t,n=Gs){const i=e.__wdc||(e.__wdc=()=>{let o=n;for(;o;){if(o.isDeactivated)return;o=o.parent}return e()});if(P1(t,i,n),n){let o=n.parent;for(;o&&o.parent;)I1(o.parent.vnode)&&f_e(i,t,n,o),o=o.parent}}function f_e(e,t,n,i){const o=P1(t,e,i,!0);n3(()=>{G2(i[t],o)},n)}function P1(e,t,n=Gs,i=!1){if(n){const o=n[e]||(n[e]=[]),r=t.__weh||(t.__weh=(...s)=>{if(n.isUnmounted)return;mT(),WA(n);const a=au(t,n,e,s);return Ug(),_T(),a});return i?o.unshift(r):o.push(r),r}}const rp=e=>(t,n=Gs)=>(!mE||e==="sp")&&P1(e,(...i)=>t(...i),n),d_e=rp("bm"),Dd=rp("m"),h_e=rp("bu"),p_e=rp("u"),cx=rp("bum"),n3=rp("um"),m_e=rp("sp"),__e=rp("rtg"),g_e=rp("rtc");function y_e(e,t=Gs){P1("ec",e,t)}function Jg(e,t){const n=ua;if(n===null)return e;const i=R1(n)||n.proxy,o=e.dirs||(e.dirs=[]);for(let r=0;r<t.length;r++){let[s,a,c,u=Qo]=t[r];s&&($n(s)&&(s={mounted:s,updated:s}),s.deep&&Og(a),o.push({dir:s,instance:i,value:a,oldValue:void 0,arg:c,modifiers:u}))}return e}function k_(e,t,n,i){const o=e.dirs,r=t&&t.dirs;for(let s=0;s<o.length;s++){const a=o[s];r&&(a.oldValue=r[s].value);let c=a.dir[i];c&&(mT(),au(c,n,8,[e.el,a,e,t]),_T())}}const i3="components";function eS(e,t){return $Y(i3,e,!0,t)||e}const YY=Symbol();function O1(e){return Do(e)?$Y(i3,e,!1)||e:e||YY}function $Y(e,t,n=!0,i=!1){const o=ua||Gs;if(o){const r=o.type;if(e===i3){const a=X_e(r,!1);if(a&&(a===t||a===df(t)||a===w1(df(t))))return r}const s=Y4(o[e]||r[e],t)||Y4(o.appContext[e],t);return!s&&i?r:s}}function Y4(e,t){return e&&(e[t]||e[df(t)]||e[w1(df(t))])}function A_e(e,t,n,i){let o;const r=n&&n[i];if(dn(e)||Do(e)){o=new Array(e.length);for(let s=0,a=e.length;s<a;s++)o[s]=t(e[s],s,void 0,r&&r[s])}else if(typeof e=="number"){o=new Array(e);for(let s=0;s<e;s++)o[s]=t(s+1,s,void 0,r&&r[s])}else if(Ao(e))if(e[Symbol.iterator])o=Array.from(e,(s,a)=>t(s,a,void 0,r&&r[a]));else{const s=Object.keys(e);o=new Array(s.length);for(let a=0,c=s.length;a<c;a++){const u=s[a];o[a]=t(e[u],u,a,r&&r[a])}}else o=[];return n&&(n[i]=o),o}function pc(e,t,n={},i,o){if(ua.isCE||ua.parent&&Rb(ua.parent)&&ua.parent.isCE)return t!=="default"&&(n.name=t),nr("slot",n,i&&i());let r=e[t];r&&r._c&&(r._d=!1),_i();const s=r&&XY(r(n)),a=Fc(aa,{key:n.key||s&&s.key||`_${t}`},s||(i?i():[]),s&&e._===1?64:-2);return!o&&a.scopeId&&(a.slotScopeIds=[a.scopeId+"-s"]),r&&r._c&&(r._d=!0),a}function XY(e){return e.some(t=>GA(t)?!(t.type===cu||t.type===aa&&!XY(t.children)):!0)?e:null}const pM=e=>e?s$(e)?R1(e)||e.proxy:pM(e.parent):null,Nb=fa(Object.create(null),{$:e=>e,$el:e=>e.vnode.el,$data:e=>e.data,$props:e=>e.props,$attrs:e=>e.attrs,$slots:e=>e.slots,$refs:e=>e.refs,$parent:e=>pM(e.parent),$root:e=>pM(e.root),$emit:e=>e.emit,$options:e=>o3(e),$forceUpdate:e=>e.f||(e.f=()=>t3(e.update)),$nextTick:e=>e.n||(e.n=$m.bind(e.proxy)),$watch:e=>s_e.bind(e)}),gL=(e,t)=>e!==Qo&&!e.__isScriptSetup&&Bi(e,t),T_e={get({_:e},t){const{ctx:n,setupState:i,data:o,props:r,accessCache:s,type:a,appContext:c}=e;let u;if(t[0]!=="$"){const g=s[t];if(g!==void 0)switch(g){case 1:return i[t];case 2:return o[t];case 4:return n[t];case 3:return r[t]}else{if(gL(i,t))return s[t]=1,i[t];if(o!==Qo&&Bi(o,t))return s[t]=2,o[t];if((u=e.propsOptions[0])&&Bi(u,t))return s[t]=3,r[t];if(n!==Qo&&Bi(n,t))return s[t]=4,n[t];mM&&(s[t]=0)}}const f=Nb[t];let h,_;if(f)return t==="$attrs"&&hl(e,"get",t),f(e);if((h=a.__cssModules)&&(h=h[t]))return h;if(n!==Qo&&Bi(n,t))return s[t]=4,n[t];if(_=c.config.globalProperties,Bi(_,t))return _[t]},set({_:e},t,n){const{data:i,setupState:o,ctx:r}=e;return gL(o,t)?(o[t]=n,!0):i!==Qo&&Bi(i,t)?(i[t]=n,!0):Bi(e.props,t)||t[0]==="$"&&t.slice(1)in e?!1:(r[t]=n,!0)},has({_:{data:e,setupState:t,accessCache:n,ctx:i,appContext:o,propsOptions:r}},s){let a;return!!n[s]||e!==Qo&&Bi(e,s)||gL(t,s)||(a=r[0])&&Bi(a,s)||Bi(i,s)||Bi(Nb,s)||Bi(o.config.globalProperties,s)},defineProperty(e,t,n){return n.get!=null?e._.accessCache[t]=0:Bi(n,"value")&&this.set(e,t,n.value,null),Reflect.defineProperty(e,t,n)}};let mM=!0;function C_e(e){const t=o3(e),n=e.proxy,i=e.ctx;mM=!1,t.beforeCreate&&$4(t.beforeCreate,e,"bc");const{data:o,computed:r,methods:s,watch:a,provide:c,inject:u,created:f,beforeMount:h,mounted:_,beforeUpdate:g,updated:p,activated:y,deactivated:T,beforeDestroy:b,beforeUnmount:x,destroyed:v,unmounted:D,render:L,renderTracked:B,renderTriggered:V,errorCaptured:M,serverPrefetch:H,expose:G,inheritAttrs:I,components:O,directives:m,filters:P}=t;if(u&&b_e(u,i,null,e.appContext.config.unwrapInjectedRef),s)for(const W in s){const q=s[W];$n(q)&&(i[W]=q.bind(n))}if(o){const W=o.call(n,n);Ao(W)&&(e.data=ax(W))}if(mM=!0,r)for(const W in r){const q=r[W],Y=$n(q)?q.bind(n,n):$n(q.get)?q.get.bind(n,n):mc,j=!$n(q)&&$n(q.set)?q.set.bind(n):mc,ee=yn({get:Y,set:j});Object.defineProperty(i,W,{enumerable:!0,configurable:!0,get:()=>ee.value,set:K=>ee.value=K})}if(a)for(const W in a)KY(a[W],i,n,W);if(c){const W=$n(c)?c.call(n):c;Reflect.ownKeys(W).forEach(q=>{Bm(q,W[q])})}f&&$4(f,e,"c");function U(W,q){dn(q)?q.forEach(Y=>W(Y.bind(n))):q&&W(q.bind(n))}if(U(d_e,h),U(Dd,_),U(h_e,g),U(p_e,p),U(l_e,y),U(u_e,T),U(y_e,M),U(g_e,B),U(__e,V),U(cx,x),U(n3,D),U(m_e,H),dn(G))if(G.length){const W=e.exposed||(e.exposed={});G.forEach(q=>{Object.defineProperty(W,q,{get:()=>n[q],set:Y=>n[q]=Y})})}else e.exposed||(e.exposed={});L&&e.render===mc&&(e.render=L),I!=null&&(e.inheritAttrs=I),O&&(e.components=O),m&&(e.directives=m)}function b_e(e,t,n=mc,i=!1){dn(e)&&(e=_M(e));for(const o in e){const r=e[o];let s;Ao(r)?"default"in r?s=Qr(r.from||o,r.default,!0):s=Qr(r.from||o):s=Qr(r),Ir(s)&&i?Object.defineProperty(t,o,{enumerable:!0,configurable:!0,get:()=>s.value,set:a=>s.value=a}):t[o]=s}}function $4(e,t,n){au(dn(e)?e.map(i=>i.bind(t.proxy)):e.bind(t.proxy),t,n)}function KY(e,t,n,i){const o=i.includes(".")?kY(n,i):()=>n[i];if(Do(e)){const r=t[e];$n(r)&&ws(o,r)}else if($n(e))ws(o,e.bind(n));else if(Ao(e))if(dn(e))e.forEach(r=>KY(r,t,n,i));else{const r=$n(e.handler)?e.handler.bind(n):t[e.handler];$n(r)&&ws(o,r,e)}}function o3(e){const t=e.type,{mixins:n,extends:i}=t,{mixins:o,optionsCache:r,config:{optionMergeStrategies:s}}=e.appContext,a=r.get(t);let c;return a?c=a:!o.length&&!n&&!i?c=t:(c={},o.length&&o.forEach(u=>fI(c,u,s,!0)),fI(c,t,s)),Ao(t)&&r.set(t,c),c}function fI(e,t,n,i=!1){const{mixins:o,extends:r}=t;r&&fI(e,r,n,!0),o&&o.forEach(s=>fI(e,s,n,!0));for(const s in t)if(!(i&&s==="expose")){const a=E_e[s]||n&&n[s];e[s]=a?a(e[s],t[s]):t[s]}return e}const E_e={data:X4,props:yg,emits:yg,methods:yg,computed:yg,beforeCreate:ac,created:ac,beforeMount:ac,mounted:ac,beforeUpdate:ac,updated:ac,beforeDestroy:ac,beforeUnmount:ac,destroyed:ac,unmounted:ac,activated:ac,deactivated:ac,errorCaptured:ac,serverPrefetch:ac,components:yg,directives:yg,watch:w_e,provide:X4,inject:x_e};function X4(e,t){return t?e?function(){return fa($n(e)?e.call(this,this):e,$n(t)?t.call(this,this):t)}:t:e}function x_e(e,t){return yg(_M(e),_M(t))}function _M(e){if(dn(e)){const t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function ac(e,t){return e?[...new Set([].concat(e,t))]:t}function yg(e,t){return e?fa(fa(Object.create(null),e),t):t}function w_e(e,t){if(!e)return t;if(!t)return e;const n=fa(Object.create(null),e);for(const i in t)n[i]=ac(e[i],t[i]);return n}function S_e(e,t,n,i=!1){const o={},r={};cI(r,B1,1),e.propsDefaults=Object.create(null),JY(e,t,o,r);for(const s in e.propsOptions[0])s in o||(o[s]=void 0);n?e.props=i?o:wY(o):e.type.props?e.props=o:e.props=r,e.attrs=r}function v_e(e,t,n,i){const{props:o,attrs:r,vnode:{patchFlag:s}}=e,a=ji(o),[c]=e.propsOptions;let u=!1;if((i||s>0)&&!(s&16)){if(s&8){const f=e.vnode.dynamicProps;for(let h=0;h<f.length;h++){let _=f[h];if(D1(e.emitsOptions,_))continue;const g=t[_];if(c)if(Bi(r,_))g!==r[_]&&(r[_]=g,u=!0);else{const p=df(_);o[p]=gM(c,a,p,g,e,!1)}else g!==r[_]&&(r[_]=g,u=!0)}}}else{JY(e,t,o,r)&&(u=!0);let f;for(const h in a)(!t||!Bi(t,h)&&((f=pT(h))===h||!Bi(t,f)))&&(c?n&&(n[h]!==void 0||n[f]!==void 0)&&(o[h]=gM(c,a,h,void 0,e,!0)):delete o[h]);if(r!==a)for(const h in r)(!t||!Bi(t,h))&&(delete r[h],u=!0)}u&&Yh(e,"set","$attrs")}function JY(e,t,n,i){const[o,r]=e.propsOptions;let s=!1,a;if(t)for(let c in t){if(dD(c))continue;const u=t[c];let f;o&&Bi(o,f=df(c))?!r||!r.includes(f)?n[f]=u:(a||(a={}))[f]=u:D1(e.emitsOptions,c)||(!(c in i)||u!==i[c])&&(i[c]=u,s=!0)}if(r){const c=ji(n),u=a||Qo;for(let f=0;f<r.length;f++){const h=r[f];n[h]=gM(o,c,h,u[h],e,!Bi(u,h))}}return s}function gM(e,t,n,i,o,r){const s=e[n];if(s!=null){const a=Bi(s,"default");if(a&&i===void 0){const c=s.default;if(s.type!==Function&&$n(c)){const{propsDefaults:u}=o;n in u?i=u[n]:(WA(o),i=u[n]=c.call(null,t),Ug())}else i=c}s[0]&&(r&&!a?i=!1:s[1]&&(i===""||i===pT(n))&&(i=!0))}return i}function QY(e,t,n=!1){const i=t.propsCache,o=i.get(e);if(o)return o;const r=e.props,s={},a=[];let c=!1;if(!$n(e)){const f=h=>{c=!0;const[_,g]=QY(h,t,!0);fa(s,_),g&&a.push(...g)};!n&&t.mixins.length&&t.mixins.forEach(f),e.extends&&f(e.extends),e.mixins&&e.mixins.forEach(f)}if(!r&&!c)return Ao(e)&&i.set(e,AA),AA;if(dn(r))for(let f=0;f<r.length;f++){const h=df(r[f]);K4(h)&&(s[h]=Qo)}else if(r)for(const f in r){const h=df(f);if(K4(h)){const _=r[f],g=s[h]=dn(_)||$n(_)?{type:_}:Object.assign({},_);if(g){const p=Z4(Boolean,g.type),y=Z4(String,g.type);g[0]=p>-1,g[1]=y<0||p<y,(p>-1||Bi(g,"default"))&&a.push(h)}}}const u=[s,a];return Ao(e)&&i.set(e,u),u}function K4(e){return e[0]!=="$"}function J4(e){const t=e&&e.toString().match(/^\s*function (\w+)/);return t?t[1]:e===null?"null":""}function Q4(e,t){return J4(e)===J4(t)}function Z4(e,t){return dn(t)?t.findIndex(n=>Q4(n,e)):$n(t)&&Q4(t,e)?0:-1}const ZY=e=>e[0]==="_"||e==="$stable",r3=e=>dn(e)?e.map(ed):[ed(e)],D_e=(e,t,n)=>{if(t._n)return t;const i=za((...o)=>r3(t(...o)),n);return i._c=!1,i},e$=(e,t,n)=>{const i=e._ctx;for(const o in e){if(ZY(o))continue;const r=e[o];if($n(r))t[o]=D_e(o,r,i);else if(r!=null){const s=r3(r);t[o]=()=>s}}},t$=(e,t)=>{const n=r3(t);e.slots.default=()=>n},I_e=(e,t)=>{if(e.vnode.shapeFlag&32){const n=t._;n?(e.slots=ji(t),cI(t,"_",n)):e$(t,e.slots={})}else e.slots={},t&&t$(e,t);cI(e.slots,B1,1)},P_e=(e,t,n)=>{const{vnode:i,slots:o}=e;let r=!0,s=Qo;if(i.shapeFlag&32){const a=t._;a?n&&a===1?r=!1:(fa(o,t),!n&&a===1&&delete o._):(r=!t.$stable,e$(t,o)),s=t}else t&&(t$(e,t),s={default:1});if(r)for(const a in o)!ZY(a)&&!(a in s)&&delete o[a]};function n$(){return{app:null,config:{isNativeTag:sme,performance:!1,globalProperties:{},optionMergeStrategies:{},errorHandler:void 0,warnHandler:void 0,compilerOptions:{}},mixins:[],components:{},directives:{},provides:Object.create(null),optionsCache:new WeakMap,propsCache:new WeakMap,emitsCache:new WeakMap}}let O_e=0;function L_e(e,t){return function(i,o=null){$n(i)||(i=Object.assign({},i)),o!=null&&!Ao(o)&&(o=null);const r=n$(),s=new Set;let a=!1;const c=r.app={_uid:O_e++,_component:i,_props:o,_container:null,_context:r,_instance:null,version:ege,get config(){return r.config},set config(u){},use(u,...f){return s.has(u)||(u&&$n(u.install)?(s.add(u),u.install(c,...f)):$n(u)&&(s.add(u),u(c,...f))),c},mixin(u){return r.mixins.includes(u)||r.mixins.push(u),c},component(u,f){return f?(r.components[u]=f,c):r.components[u]},directive(u,f){return f?(r.directives[u]=f,c):r.directives[u]},mount(u,f,h){if(!a){const _=nr(i,o);return _.appContext=r,f&&t?t(_,u):e(_,u,h),a=!0,c._container=u,u.__vue_app__=c,R1(_.component)||_.component.proxy}},unmount(){a&&(e(null,c._container),delete c._container.__vue_app__)},provide(u,f){return r.provides[u]=f,c}};return c}}function yM(e,t,n,i,o=!1){if(dn(e)){e.forEach((_,g)=>yM(_,t&&(dn(t)?t[g]:t),n,i,o));return}if(Rb(i)&&!o)return;const r=i.shapeFlag&4?R1(i.component)||i.component.proxy:i.el,s=o?null:r,{i:a,r:c}=e,u=t&&t.r,f=a.refs===Qo?a.refs={}:a.refs,h=a.setupState;if(u!=null&&u!==c&&(Do(u)?(f[u]=null,Bi(h,u)&&(h[u]=null)):Ir(u)&&(u.value=null)),$n(c))Lm(c,a,12,[s,f]);else{const _=Do(c),g=Ir(c);if(_||g){const p=()=>{if(e.f){const y=_?Bi(h,c)?h[c]:f[c]:c.value;o?dn(y)&&G2(y,r):dn(y)?y.includes(r)||y.push(r):_?(f[c]=[r],Bi(h,c)&&(h[c]=f[c])):(c.value=[r],e.k&&(f[e.k]=c.value))}else _?(f[c]=s,Bi(h,c)&&(h[c]=s)):g&&(c.value=s,e.k&&(f[e.k]=s))};s?(p.id=-1,Rc(p,n)):p()}}}const Rc=r_e;function B_e(e){return R_e(e)}function R_e(e,t){const n=dme();n.__VUE__=!0;const{insert:i,remove:o,patchProp:r,createElement:s,createText:a,createComment:c,setText:u,setElementText:f,parentNode:h,nextSibling:_,setScopeId:g=mc,insertStaticContent:p}=e,y=(ne,ae,ye,Ce=null,Be=null,Le=null,Ve=!1,Ie=null,He=!!ae.dynamicChildren)=>{if(ne===ae)return;ne&&!Eg(ne,ae)&&(Ce=de(ne),K(ne,Be,Le,!0),ne=null),ae.patchFlag===-2&&(He=!1,ae.dynamicChildren=null);const{type:Me,ref:qe,shapeFlag:Ne}=ae;switch(Me){case L1:T(ne,ae,ye,Ce);break;case cu:b(ne,ae,ye,Ce);break;case yL:ne==null&&x(ae,ye,Ce,Ve);break;case aa:O(ne,ae,ye,Ce,Be,Le,Ve,Ie,He);break;default:Ne&1?L(ne,ae,ye,Ce,Be,Le,Ve,Ie,He):Ne&6?m(ne,ae,ye,Ce,Be,Le,Ve,Ie,He):(Ne&64||Ne&128)&&Me.process(ne,ae,ye,Ce,Be,Le,Ve,Ie,He,le)}qe!=null&&Be&&yM(qe,ne&&ne.ref,Le,ae||ne,!ae)},T=(ne,ae,ye,Ce)=>{if(ne==null)i(ae.el=a(ae.children),ye,Ce);else{const Be=ae.el=ne.el;ae.children!==ne.children&&u(Be,ae.children)}},b=(ne,ae,ye,Ce)=>{ne==null?i(ae.el=c(ae.children||""),ye,Ce):ae.el=ne.el},x=(ne,ae,ye,Ce)=>{[ne.el,ne.anchor]=p(ne.children,ae,ye,Ce,ne.el,ne.anchor)},v=({el:ne,anchor:ae},ye,Ce)=>{let Be;for(;ne&&ne!==ae;)Be=_(ne),i(ne,ye,Ce),ne=Be;i(ae,ye,Ce)},D=({el:ne,anchor:ae})=>{let ye;for(;ne&&ne!==ae;)ye=_(ne),o(ne),ne=ye;o(ae)},L=(ne,ae,ye,Ce,Be,Le,Ve,Ie,He)=>{Ve=Ve||ae.type==="svg",ne==null?B(ae,ye,Ce,Be,Le,Ve,Ie,He):H(ne,ae,Be,Le,Ve,Ie,He)},B=(ne,ae,ye,Ce,Be,Le,Ve,Ie)=>{let He,Me;const{type:qe,props:Ne,shapeFlag:ke,transition:Qe,dirs:Ge}=ne;if(He=ne.el=s(ne.type,Le,Ne&&Ne.is,Ne),ke&8?f(He,ne.children):ke&16&&M(ne.children,He,null,Ce,Be,Le&&qe!=="foreignObject",Ve,Ie),Ge&&k_(ne,null,Ce,"created"),Ne){for(const Lt in Ne)Lt!=="value"&&!dD(Lt)&&r(He,Lt,null,Ne[Lt],Le,ne.children,Ce,Be,J);"value"in Ne&&r(He,"value",null,Ne.value),(Me=Ne.onVnodeBeforeMount)&&qf(Me,Ce,ne)}V(He,ne,ne.scopeId,Ve,Ce),Ge&&k_(ne,null,Ce,"beforeMount");const Pt=(!Be||Be&&!Be.pendingBranch)&&Qe&&!Qe.persisted;Pt&&Qe.beforeEnter(He),i(He,ae,ye),((Me=Ne&&Ne.onVnodeMounted)||Pt||Ge)&&Rc(()=>{Me&&qf(Me,Ce,ne),Pt&&Qe.enter(He),Ge&&k_(ne,null,Ce,"mounted")},Be)},V=(ne,ae,ye,Ce,Be)=>{if(ye&&g(ne,ye),Ce)for(let Le=0;Le<Ce.length;Le++)g(ne,Ce[Le]);if(Be){let Le=Be.subTree;if(ae===Le){const Ve=Be.vnode;V(ne,Ve,Ve.scopeId,Ve.slotScopeIds,Be.parent)}}},M=(ne,ae,ye,Ce,Be,Le,Ve,Ie,He=0)=>{for(let Me=He;Me<ne.length;Me++){const qe=ne[Me]=Ie?mm(ne[Me]):ed(ne[Me]);y(null,qe,ae,ye,Ce,Be,Le,Ve,Ie)}},H=(ne,ae,ye,Ce,Be,Le,Ve)=>{const Ie=ae.el=ne.el;let{patchFlag:He,dynamicChildren:Me,dirs:qe}=ae;He|=ne.patchFlag&16;const Ne=ne.props||Qo,ke=ae.props||Qo;let Qe;ye&&G_(ye,!1),(Qe=ke.onVnodeBeforeUpdate)&&qf(Qe,ye,ae,ne),qe&&k_(ae,ne,ye,"beforeUpdate"),ye&&G_(ye,!0);const Ge=Be&&ae.type!=="foreignObject";if(Me?G(ne.dynamicChildren,Me,Ie,ye,Ce,Ge,Le):Ve||q(ne,ae,Ie,null,ye,Ce,Ge,Le,!1),He>0){if(He&16)I(Ie,ae,Ne,ke,ye,Ce,Be);else if(He&2&&Ne.class!==ke.class&&r(Ie,"class",null,ke.class,Be),He&4&&r(Ie,"style",Ne.style,ke.style,Be),He&8){const Pt=ae.dynamicProps;for(let Lt=0;Lt<Pt.length;Lt++){const qt=Pt[Lt],zn=Ne[qt],Gn=ke[qt];(Gn!==zn||qt==="value")&&r(Ie,qt,zn,Gn,Be,ne.children,ye,Ce,J)}}He&1&&ne.children!==ae.children&&f(Ie,ae.children)}else!Ve&&Me==null&&I(Ie,ae,Ne,ke,ye,Ce,Be);((Qe=ke.onVnodeUpdated)||qe)&&Rc(()=>{Qe&&qf(Qe,ye,ae,ne),qe&&k_(ae,ne,ye,"updated")},Ce)},G=(ne,ae,ye,Ce,Be,Le,Ve)=>{for(let Ie=0;Ie<ae.length;Ie++){const He=ne[Ie],Me=ae[Ie],qe=He.el&&(He.type===aa||!Eg(He,Me)||He.shapeFlag&70)?h(He.el):ye;y(He,Me,qe,null,Ce,Be,Le,Ve,!0)}},I=(ne,ae,ye,Ce,Be,Le,Ve)=>{if(ye!==Ce){if(ye!==Qo)for(const Ie in ye)!dD(Ie)&&!(Ie in Ce)&&r(ne,Ie,ye[Ie],null,Ve,ae.children,Be,Le,J);for(const Ie in Ce){if(dD(Ie))continue;const He=Ce[Ie],Me=ye[Ie];He!==Me&&Ie!=="value"&&r(ne,Ie,Me,He,Ve,ae.children,Be,Le,J)}"value"in Ce&&r(ne,"value",ye.value,Ce.value)}},O=(ne,ae,ye,Ce,Be,Le,Ve,Ie,He)=>{const Me=ae.el=ne?ne.el:a(""),qe=ae.anchor=ne?ne.anchor:a("");let{patchFlag:Ne,dynamicChildren:ke,slotScopeIds:Qe}=ae;Qe&&(Ie=Ie?Ie.concat(Qe):Qe),ne==null?(i(Me,ye,Ce),i(qe,ye,Ce),M(ae.children,ye,qe,Be,Le,Ve,Ie,He)):Ne>0&&Ne&64&&ke&&ne.dynamicChildren?(G(ne.dynamicChildren,ke,ye,Be,Le,Ve,Ie),(ae.key!=null||Be&&ae===Be.subTree)&&s3(ne,ae,!0)):q(ne,ae,ye,qe,Be,Le,Ve,Ie,He)},m=(ne,ae,ye,Ce,Be,Le,Ve,Ie,He)=>{ae.slotScopeIds=Ie,ne==null?ae.shapeFlag&512?Be.ctx.activate(ae,ye,Ce,Ve,He):P(ae,ye,Ce,Be,Le,Ve,He):R(ne,ae,He)},P=(ne,ae,ye,Ce,Be,Le,Ve)=>{const Ie=ne.component=q_e(ne,Ce,Be);if(I1(ne)&&(Ie.ctx.renderer=le),j_e(Ie),Ie.asyncDep){if(Be&&Be.registerDep(Ie,U),!ne.el){const He=Ie.subTree=nr(cu);b(null,He,ae,ye)}return}U(Ie,ne,ae,ye,Be,Le,Ve)},R=(ne,ae,ye)=>{const Ce=ae.component=ne.component;if(n_e(ne,ae,ye))if(Ce.asyncDep&&!Ce.asyncResolved){W(Ce,ae,ye);return}else Ce.next=ae,Kme(Ce.update),Ce.update();else ae.el=ne.el,Ce.vnode=ae},U=(ne,ae,ye,Ce,Be,Le,Ve)=>{const Ie=()=>{if(ne.isMounted){let{next:qe,bu:Ne,u:ke,parent:Qe,vnode:Ge}=ne,Pt=qe,Lt;G_(ne,!1),qe?(qe.el=Ge.el,W(ne,qe,Ve)):qe=Ge,Ne&&hD(Ne),(Lt=qe.props&&qe.props.onVnodeBeforeUpdate)&&qf(Lt,Qe,qe,Ge),G_(ne,!0);const qt=mL(ne),zn=ne.subTree;ne.subTree=qt,y(zn,qt,h(zn.el),de(zn),ne,Be,Le),qe.el=qt.el,Pt===null&&i_e(ne,qt.el),ke&&Rc(ke,Be),(Lt=qe.props&&qe.props.onVnodeUpdated)&&Rc(()=>qf(Lt,Qe,qe,Ge),Be)}else{let qe;const{el:Ne,props:ke}=ae,{bm:Qe,m:Ge,parent:Pt}=ne,Lt=Rb(ae);if(G_(ne,!1),Qe&&hD(Qe),!Lt&&(qe=ke&&ke.onVnodeBeforeMount)&&qf(qe,Pt,ae),G_(ne,!0),Ne&&pe){const qt=()=>{ne.subTree=mL(ne),pe(Ne,ne.subTree,ne,Be,null)};Lt?ae.type.__asyncLoader().then(()=>!ne.isUnmounted&&qt()):qt()}else{const qt=ne.subTree=mL(ne);y(null,qt,ye,Ce,ne,Be,Le),ae.el=qt.el}if(Ge&&Rc(Ge,Be),!Lt&&(qe=ke&&ke.onVnodeMounted)){const qt=ae;Rc(()=>qf(qe,Pt,qt),Be)}(ae.shapeFlag&256||Pt&&Rb(Pt.vnode)&&Pt.vnode.shapeFlag&256)&&ne.a&&Rc(ne.a,Be),ne.isMounted=!0,ae=ye=Ce=null}},He=ne.effect=new Y2(Ie,()=>t3(Me),ne.scope),Me=ne.update=()=>He.run();Me.id=ne.uid,G_(ne,!0),Me()},W=(ne,ae,ye)=>{ae.component=ne;const Ce=ne.vnode.props;ne.vnode=ae,ne.next=null,v_e(ne,ae.props,Ce,ye),P_e(ne,ae.children,ye),mT(),W4(),_T()},q=(ne,ae,ye,Ce,Be,Le,Ve,Ie,He=!1)=>{const Me=ne&&ne.children,qe=ne?ne.shapeFlag:0,Ne=ae.children,{patchFlag:ke,shapeFlag:Qe}=ae;if(ke>0){if(ke&128){j(Me,Ne,ye,Ce,Be,Le,Ve,Ie,He);return}else if(ke&256){Y(Me,Ne,ye,Ce,Be,Le,Ve,Ie,He);return}}Qe&8?(qe&16&&J(Me,Be,Le),Ne!==Me&&f(ye,Ne)):qe&16?Qe&16?j(Me,Ne,ye,Ce,Be,Le,Ve,Ie,He):J(Me,Be,Le,!0):(qe&8&&f(ye,""),Qe&16&&M(Ne,ye,Ce,Be,Le,Ve,Ie,He))},Y=(ne,ae,ye,Ce,Be,Le,Ve,Ie,He)=>{ne=ne||AA,ae=ae||AA;const Me=ne.length,qe=ae.length,Ne=Math.min(Me,qe);let ke;for(ke=0;ke<Ne;ke++){const Qe=ae[ke]=He?mm(ae[ke]):ed(ae[ke]);y(ne[ke],Qe,ye,null,Be,Le,Ve,Ie,He)}Me>qe?J(ne,Be,Le,!0,!1,Ne):M(ae,ye,Ce,Be,Le,Ve,Ie,He,Ne)},j=(ne,ae,ye,Ce,Be,Le,Ve,Ie,He)=>{let Me=0;const qe=ae.length;let Ne=ne.length-1,ke=qe-1;for(;Me<=Ne&&Me<=ke;){const Qe=ne[Me],Ge=ae[Me]=He?mm(ae[Me]):ed(ae[Me]);if(Eg(Qe,Ge))y(Qe,Ge,ye,null,Be,Le,Ve,Ie,He);else break;Me++}for(;Me<=Ne&&Me<=ke;){const Qe=ne[Ne],Ge=ae[ke]=He?mm(ae[ke]):ed(ae[ke]);if(Eg(Qe,Ge))y(Qe,Ge,ye,null,Be,Le,Ve,Ie,He);else break;Ne--,ke--}if(Me>Ne){if(Me<=ke){const Qe=ke+1,Ge=Qe<qe?ae[Qe].el:Ce;for(;Me<=ke;)y(null,ae[Me]=He?mm(ae[Me]):ed(ae[Me]),ye,Ge,Be,Le,Ve,Ie,He),Me++}}else if(Me>ke)for(;Me<=Ne;)K(ne[Me],Be,Le,!0),Me++;else{const Qe=Me,Ge=Me,Pt=new Map;for(Me=Ge;Me<=ke;Me++){const In=ae[Me]=He?mm(ae[Me]):ed(ae[Me]);In.key!=null&&Pt.set(In.key,Me)}let Lt,qt=0;const zn=ke-Ge+1;let Gn=!1,Dn=0;const hn=new Array(zn);for(Me=0;Me<zn;Me++)hn[Me]=0;for(Me=Qe;Me<=Ne;Me++){const In=ne[Me];if(qt>=zn){K(In,Be,Le,!0);continue}let Rn;if(In.key!=null)Rn=Pt.get(In.key);else for(Lt=Ge;Lt<=ke;Lt++)if(hn[Lt-Ge]===0&&Eg(In,ae[Lt])){Rn=Lt;break}Rn===void 0?K(In,Be,Le,!0):(hn[Rn-Ge]=Me+1,Rn>=Dn?Dn=Rn:Gn=!0,y(In,ae[Rn],ye,null,Be,Le,Ve,Ie,He),qt++)}const jt=Gn?N_e(hn):AA;for(Lt=jt.length-1,Me=zn-1;Me>=0;Me--){const In=Ge+Me,Rn=ae[In],Jt=In+1<qe?ae[In+1].el:Ce;hn[Me]===0?y(null,Rn,ye,Jt,Be,Le,Ve,Ie,He):Gn&&(Lt<0||Me!==jt[Lt]?ee(Rn,ye,Jt,2):Lt--)}}},ee=(ne,ae,ye,Ce,Be=null)=>{const{el:Le,type:Ve,transition:Ie,children:He,shapeFlag:Me}=ne;if(Me&6){ee(ne.component.subTree,ae,ye,Ce);return}if(Me&128){ne.suspense.move(ae,ye,Ce);return}if(Me&64){Ve.move(ne,ae,ye,le);return}if(Ve===aa){i(Le,ae,ye);for(let Ne=0;Ne<He.length;Ne++)ee(He[Ne],ae,ye,Ce);i(ne.anchor,ae,ye);return}if(Ve===yL){v(ne,ae,ye);return}if(Ce!==2&&Me&1&&Ie)if(Ce===0)Ie.beforeEnter(Le),i(Le,ae,ye),Rc(()=>Ie.enter(Le),Be);else{const{leave:Ne,delayLeave:ke,afterLeave:Qe}=Ie,Ge=()=>i(Le,ae,ye),Pt=()=>{Ne(Le,()=>{Ge(),Qe&&Qe()})};ke?ke(Le,Ge,Pt):Pt()}else i(Le,ae,ye)},K=(ne,ae,ye,Ce=!1,Be=!1)=>{const{type:Le,props:Ve,ref:Ie,children:He,dynamicChildren:Me,shapeFlag:qe,patchFlag:Ne,dirs:ke}=ne;if(Ie!=null&&yM(Ie,null,ye,ne,!0),qe&256){ae.ctx.deactivate(ne);return}const Qe=qe&1&&ke,Ge=!Rb(ne);let Pt;if(Ge&&(Pt=Ve&&Ve.onVnodeBeforeUnmount)&&qf(Pt,ae,ne),qe&6)Z(ne.component,ye,Ce);else{if(qe&128){ne.suspense.unmount(ye,Ce);return}Qe&&k_(ne,null,ae,"beforeUnmount"),qe&64?ne.type.remove(ne,ae,ye,Be,le,Ce):Me&&(Le!==aa||Ne>0&&Ne&64)?J(Me,ae,ye,!1,!0):(Le===aa&&Ne&384||!Be&&qe&16)&&J(He,ae,ye),Ce&&se(ne)}(Ge&&(Pt=Ve&&Ve.onVnodeUnmounted)||Qe)&&Rc(()=>{Pt&&qf(Pt,ae,ne),Qe&&k_(ne,null,ae,"unmounted")},ye)},se=ne=>{const{type:ae,el:ye,anchor:Ce,transition:Be}=ne;if(ae===aa){Q(ye,Ce);return}if(ae===yL){D(ne);return}const Le=()=>{o(ye),Be&&!Be.persisted&&Be.afterLeave&&Be.afterLeave()};if(ne.shapeFlag&1&&Be&&!Be.persisted){const{leave:Ve,delayLeave:Ie}=Be,He=()=>Ve(ye,Le);Ie?Ie(ne.el,Le,He):He()}else Le()},Q=(ne,ae)=>{let ye;for(;ne!==ae;)ye=_(ne),o(ne),ne=ye;o(ae)},Z=(ne,ae,ye)=>{const{bum:Ce,scope:Be,update:Le,subTree:Ve,um:Ie}=ne;Ce&&hD(Ce),Be.stop(),Le&&(Le.active=!1,K(Ve,ne,ae,ye)),Ie&&Rc(Ie,ae),Rc(()=>{ne.isUnmounted=!0},ae),ae&&ae.pendingBranch&&!ae.isUnmounted&&ne.asyncDep&&!ne.asyncResolved&&ne.suspenseId===ae.pendingId&&(ae.deps--,ae.deps===0&&ae.resolve())},J=(ne,ae,ye,Ce=!1,Be=!1,Le=0)=>{for(let Ve=Le;Ve<ne.length;Ve++)K(ne[Ve],ae,ye,Ce,Be)},de=ne=>ne.shapeFlag&6?de(ne.component.subTree):ne.shapeFlag&128?ne.suspense.next():_(ne.anchor||ne.el),_e=(ne,ae,ye)=>{ne==null?ae._vnode&&K(ae._vnode,null,null,!0):y(ae._vnode||null,ne,ae,null,null,null,ye),W4(),FY(),ae._vnode=ne},le={p:y,um:K,m:ee,r:se,mt:P,mc:M,pc:q,pbc:G,n:de,o:e};let Te,pe;return t&&([Te,pe]=t(le)),{render:_e,hydrate:Te,createApp:L_e(_e,Te)}}function G_({effect:e,update:t},n){e.allowRecurse=t.allowRecurse=n}function s3(e,t,n=!1){const i=e.children,o=t.children;if(dn(i)&&dn(o))for(let r=0;r<i.length;r++){const s=i[r];let a=o[r];a.shapeFlag&1&&!a.dynamicChildren&&((a.patchFlag<=0||a.patchFlag===32)&&(a=o[r]=mm(o[r]),a.el=s.el),n||s3(s,a)),a.type===L1&&(a.el=s.el)}}function N_e(e){const t=e.slice(),n=[0];let i,o,r,s,a;const c=e.length;for(i=0;i<c;i++){const u=e[i];if(u!==0){if(o=n[n.length-1],e[o]<u){t[i]=o,n.push(i);continue}for(r=0,s=n.length-1;r<s;)a=r+s>>1,e[n[a]]<u?r=a+1:s=a;u<e[n[r]]&&(r>0&&(t[i]=n[r-1]),n[r]=i)}}for(r=n.length,s=n[r-1];r-- >0;)n[r]=s,s=t[s];return n}const M_e=e=>e.__isTeleport,Mb=e=>e&&(e.disabled||e.disabled===""),ek=e=>typeof SVGElement<"u"&&e instanceof SVGElement,AM=(e,t)=>{const n=e&&e.to;return Do(n)?t?t(n):null:n},F_e={__isTeleport:!0,process(e,t,n,i,o,r,s,a,c,u){const{mc:f,pc:h,pbc:_,o:{insert:g,querySelector:p,createText:y,createComment:T}}=u,b=Mb(t.props);let{shapeFlag:x,children:v,dynamicChildren:D}=t;if(e==null){const L=t.el=y(""),B=t.anchor=y("");g(L,n,i),g(B,n,i);const V=t.target=AM(t.props,p),M=t.targetAnchor=y("");V&&(g(M,V),s=s||ek(V));const H=(G,I)=>{x&16&&f(v,G,I,o,r,s,a,c)};b?H(n,B):V&&H(V,M)}else{t.el=e.el;const L=t.anchor=e.anchor,B=t.target=e.target,V=t.targetAnchor=e.targetAnchor,M=Mb(e.props),H=M?n:B,G=M?L:V;if(s=s||ek(B),D?(_(e.dynamicChildren,D,H,o,r,s,a),s3(e,t,!0)):c||h(e,t,H,G,o,r,s,a,!1),b)M||tS(t,n,L,u,1);else if((t.props&&t.props.to)!==(e.props&&e.props.to)){const I=t.target=AM(t.props,p);I&&tS(t,I,null,u,0)}else M&&tS(t,B,V,u,1)}i$(t)},remove(e,t,n,i,{um:o,o:{remove:r}},s){const{shapeFlag:a,children:c,anchor:u,targetAnchor:f,target:h,props:_}=e;if(h&&r(f),(s||!Mb(_))&&(r(u),a&16))for(let g=0;g<c.length;g++){const p=c[g];o(p,t,n,!0,!!p.dynamicChildren)}},move:tS,hydrate:z_e};function tS(e,t,n,{o:{insert:i},m:o},r=2){r===0&&i(e.targetAnchor,t,n);const{el:s,anchor:a,shapeFlag:c,children:u,props:f}=e,h=r===2;if(h&&i(s,t,n),(!h||Mb(f))&&c&16)for(let _=0;_<u.length;_++)o(u[_],t,n,2);h&&i(a,t,n)}function z_e(e,t,n,i,o,r,{o:{nextSibling:s,parentNode:a,querySelector:c}},u){const f=t.target=AM(t.props,c);if(f){const h=f._lpa||f.firstChild;if(t.shapeFlag&16)if(Mb(t.props))t.anchor=u(s(e),t,a(e),n,i,o,r),t.targetAnchor=h;else{t.anchor=s(e);let _=h;for(;_;)if(_=s(_),_&&_.nodeType===8&&_.data==="teleport anchor"){t.targetAnchor=_,f._lpa=t.targetAnchor&&s(t.targetAnchor);break}u(h,t,f,n,i,o,r)}i$(t)}return t.anchor&&s(t.anchor)}const U_e=F_e;function i$(e){const t=e.ctx;if(t&&t.ut){let n=e.children[0].el;for(;n!==e.targetAnchor;)n.nodeType===1&&n.setAttribute("data-v-owner",t.uid),n=n.nextSibling;t.ut()}}const aa=Symbol(void 0),L1=Symbol(void 0),cu=Symbol(void 0),yL=Symbol(void 0),Fb=[];let Ju=null;function _i(e=!1){Fb.push(Ju=e?null:[])}function H_e(){Fb.pop(),Ju=Fb[Fb.length-1]||null}let hE=1;function tk(e){hE+=e}function o$(e){return e.dynamicChildren=hE>0?Ju||AA:null,H_e(),hE>0&&Ju&&Ju.push(e),e}function tr(e,t,n,i,o,r){return o$(Xs(e,t,n,i,o,r,!0))}function Fc(e,t,n,i,o){return o$(nr(e,t,n,i,o,!0))}function GA(e){return e?e.__v_isVNode===!0:!1}function Eg(e,t){return e.type===t.type&&e.key===t.key}const B1="__vInternal",r$=({key:e})=>e??null,pD=({ref:e,ref_key:t,ref_for:n})=>e!=null?Do(e)||Ir(e)||$n(e)?{i:ua,r:e,k:t,f:!!n}:e:null;function Xs(e,t=null,n=null,i=0,o=null,r=e===aa?0:1,s=!1,a=!1){const c={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&r$(t),ref:t&&pD(t),scopeId:HY,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetAnchor:null,staticCount:0,shapeFlag:r,patchFlag:i,dynamicProps:o,dynamicChildren:null,appContext:null,ctx:ua};return a?(a3(c,n),r&128&&e.normalize(c)):n&&(c.shapeFlag|=Do(n)?8:16),hE>0&&!s&&Ju&&(c.patchFlag>0||r&6)&&c.patchFlag!==32&&Ju.push(c),c}const nr=V_e;function V_e(e,t=null,n=null,i=0,o=null,r=!1){if((!e||e===YY)&&(e=cu),GA(e)){const a=Xm(e,t,!0);return n&&a3(a,n),hE>0&&!r&&Ju&&(a.shapeFlag&6?Ju[Ju.indexOf(e)]=a:Ju.push(a)),a.patchFlag|=-2,a}if(K_e(e)&&(e=e.__vccOpts),t){t=k_e(t);let{class:a,style:c}=t;a&&!Do(a)&&(t.class=go(a)),Ao(c)&&(vY(c)&&!dn(c)&&(c=fa({},c)),t.style=hT(c))}const s=Do(e)?1:o_e(e)?128:M_e(e)?64:Ao(e)?4:$n(e)?2:0;return Xs(e,t,n,i,o,s,r,!0)}function k_e(e){return e?vY(e)||B1 in e?fa({},e):e:null}function Xm(e,t,n=!1){const{props:i,ref:o,patchFlag:r,children:s}=e,a=t?c3(i||{},t):i;return{__v_isVNode:!0,__v_skip:!0,type:e.type,props:a,key:a&&r$(a),ref:t&&t.ref?n&&o?dn(o)?o.concat(pD(t)):[o,pD(t)]:pD(t):o,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:s,target:e.target,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==aa?r===-1?16:r|16:r,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:e.transition,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&Xm(e.ssContent),ssFallback:e.ssFallback&&Xm(e.ssFallback),el:e.el,anchor:e.anchor,ctx:e.ctx}}function pE(e=" ",t=0){return nr(L1,null,e,t)}function lc(e="",t=!1){return t?(_i(),Fc(cu,null,e)):nr(cu,null,e)}function ed(e){return e==null||typeof e=="boolean"?nr(cu):dn(e)?nr(aa,null,e.slice()):typeof e=="object"?mm(e):nr(L1,null,String(e))}function mm(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:Xm(e)}function a3(e,t){let n=0;const{shapeFlag:i}=e;if(t==null)t=null;else if(dn(t))n=16;else if(typeof t=="object")if(i&65){const o=t.default;o&&(o._c&&(o._d=!1),a3(e,o()),o._c&&(o._d=!0));return}else{n=32;const o=t._;!o&&!(B1 in t)?t._ctx=ua:o===3&&ua&&(ua.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else $n(t)?(t={default:t,_ctx:ua},n=32):(t=String(t),i&64?(n=16,t=[pE(t)]):n=8);e.children=t,e.shapeFlag|=n}function c3(...e){const t={};for(let n=0;n<e.length;n++){const i=e[n];for(const o in i)if(o==="class")t.class!==i.class&&(t.class=go([t.class,i.class]));else if(o==="style")t.style=hT([t.style,i.style]);else if(b1(o)){const r=t[o],s=i[o];s&&r!==s&&!(dn(r)&&r.includes(s))&&(t[o]=r?[].concat(r,s):s)}else o!==""&&(t[o]=i[o])}return t}function qf(e,t,n,i=null){au(e,t,7,[n,i])}const G_e=n$();let W_e=0;function q_e(e,t,n){const i=e.type,o=(t?t.appContext:e.appContext)||G_e,r={uid:W_e++,vnode:e,type:i,parent:t,appContext:o,root:null,next:null,subTree:null,effect:null,update:null,scope:new hY(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:t?t.provides:Object.create(o.provides),accessCache:null,renderCache:[],components:null,directives:null,propsOptions:QY(i,o),emitsOptions:UY(i,o),emit:null,emitted:null,propsDefaults:Qo,inheritAttrs:i.inheritAttrs,ctx:Qo,data:Qo,props:Qo,attrs:Qo,slots:Qo,refs:Qo,setupState:Qo,setupContext:null,suspense:n,suspenseId:n?n.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null};return r.ctx={_:r},r.root=t?t.root:r,r.emit=Zme.bind(null,r),e.ce&&e.ce(r),r}let Gs=null;const Id=()=>Gs||ua,WA=e=>{Gs=e,e.scope.on()},Ug=()=>{Gs&&Gs.scope.off(),Gs=null};function s$(e){return e.vnode.shapeFlag&4}let mE=!1;function j_e(e,t=!1){mE=t;const{props:n,children:i}=e.vnode,o=s$(e);S_e(e,n,o,t),I_e(e,i);const r=o?Y_e(e,t):void 0;return mE=!1,r}function Y_e(e,t){const n=e.type;e.accessCache=Object.create(null),e.proxy=Q2(new Proxy(e.ctx,T_e));const{setup:i}=n;if(i){const o=e.setupContext=i.length>1?c$(e):null;WA(e),mT();const r=Lm(i,e,0,[e.props,o]);if(_T(),Ug(),uY(r)){if(r.then(Ug,Ug),t)return r.then(s=>{nk(e,s,t)}).catch(s=>{v1(s,e,0)});e.asyncDep=r}else nk(e,r,t)}else a$(e,t)}function nk(e,t,n){$n(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:Ao(t)&&(e.setupState=OY(t)),a$(e,n)}let ik;function a$(e,t,n){const i=e.type;if(!e.render){if(!t&&ik&&!i.render){const o=i.template||o3(e).template;if(o){const{isCustomElement:r,compilerOptions:s}=e.appContext.config,{delimiters:a,compilerOptions:c}=i,u=fa(fa({isCustomElement:r,delimiters:a},s),c);i.render=ik(o,u)}}e.render=i.render||mc}WA(e),mT(),C_e(e),_T(),Ug()}function $_e(e){return new Proxy(e.attrs,{get(t,n){return hl(e,"get","$attrs"),t[n]}})}function c$(e){const t=i=>{e.exposed=i||{}};let n;return{get attrs(){return n||(n=$_e(e))},slots:e.slots,emit:e.emit,expose:t}}function R1(e){if(e.exposed)return e.exposeProxy||(e.exposeProxy=new Proxy(OY(Q2(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in Nb)return Nb[n](e)},has(t,n){return n in t||n in Nb}}))}function X_e(e,t=!0){return $n(e)?e.displayName||e.name:e.name||t&&e.__name}function K_e(e){return $n(e)&&"__vccOpts"in e}const yn=(e,t)=>RY(e,t,mE);function l$(){return J_e().slots}function J_e(){const e=Id();return e.setupContext||(e.setupContext=c$(e))}function N1(e,t,n){const i=arguments.length;return i===2?Ao(t)&&!dn(t)?GA(t)?nr(e,null,[t]):nr(e,t):nr(e,null,t):(i>3?n=Array.prototype.slice.call(arguments,2):i===3&&GA(n)&&(n=[n]),nr(e,t,n))}const Q_e=Symbol(""),Z_e=()=>Qr(Q_e),ege="3.2.45",tge="http://www.w3.org/2000/svg",xg=typeof document<"u"?document:null,ok=xg&&xg.createElement("template"),nge={insert:(e,t,n)=>{t.insertBefore(e,n||null)},remove:e=>{const t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,n,i)=>{const o=t?xg.createElementNS(tge,e):xg.createElement(e,n?{is:n}:void 0);return e==="select"&&i&&i.multiple!=null&&o.setAttribute("multiple",i.multiple),o},createText:e=>xg.createTextNode(e),createComment:e=>xg.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>xg.querySelector(e),setScopeId(e,t){e.setAttribute(t,"")},insertStaticContent(e,t,n,i,o,r){const s=n?n.previousSibling:t.lastChild;if(o&&(o===r||o.nextSibling))for(;t.insertBefore(o.cloneNode(!0),n),!(o===r||!(o=o.nextSibling)););else{ok.innerHTML=i?`<svg>${e}</svg>`:e;const a=ok.content;if(i){const c=a.firstChild;for(;c.firstChild;)a.appendChild(c.firstChild);a.removeChild(c)}t.insertBefore(a,n)}return[s?s.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}};function ige(e,t,n){const i=e._vtc;i&&(t=(t?[t,...i]:[...i]).join(" ")),t==null?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}function oge(e,t,n){const i=e.style,o=Do(n);if(n&&!o){for(const r in n)TM(i,r,n[r]);if(t&&!Do(t))for(const r in t)n[r]==null&&TM(i,r,"")}else{const r=i.display;o?t!==n&&(i.cssText=n):t&&e.removeAttribute("style"),"_vod"in e&&(i.display=r)}}const rk=/\s*!important$/;function TM(e,t,n){if(dn(n))n.forEach(i=>TM(e,t,i));else if(n==null&&(n=""),t.startsWith("--"))e.setProperty(t,n);else{const i=rge(e,t);rk.test(n)?e.setProperty(pT(i),n.replace(rk,""),"important"):e[i]=n}}const sk=["Webkit","Moz","ms"],AL={};function rge(e,t){const n=AL[t];if(n)return n;let i=df(t);if(i!=="filter"&&i in e)return AL[t]=i;i=w1(i);for(let o=0;o<sk.length;o++){const r=sk[o]+i;if(r in e)return AL[t]=r}return t}const ak="http://www.w3.org/1999/xlink";function sge(e,t,n,i,o){if(i&&t.startsWith("xlink:"))n==null?e.removeAttributeNS(ak,t.slice(6,t.length)):e.setAttributeNS(ak,t,n);else{const r=ome(t);n==null||r&&!aY(n)?e.removeAttribute(t):e.setAttribute(t,r?"":n)}}function age(e,t,n,i,o,r,s){if(t==="innerHTML"||t==="textContent"){i&&s(i,o,r),e[t]=n??"";return}if(t==="value"&&e.tagName!=="PROGRESS"&&!e.tagName.includes("-")){e._value=n;const c=n??"";(e.value!==c||e.tagName==="OPTION")&&(e.value=c),n==null&&e.removeAttribute(t);return}let a=!1;if(n===""||n==null){const c=typeof e[t];c==="boolean"?n=aY(n):n==null&&c==="string"?(n="",a=!0):c==="number"&&(n=0,a=!0)}try{e[t]=n}catch{}a&&e.removeAttribute(t)}function u$(e,t,n,i){e.addEventListener(t,n,i)}function cge(e,t,n,i){e.removeEventListener(t,n,i)}function lge(e,t,n,i,o=null){const r=e._vei||(e._vei={}),s=r[t];if(i&&s)s.value=i;else{const[a,c]=uge(t);if(i){const u=r[t]=hge(i,o);u$(e,a,u,c)}else s&&(cge(e,a,s,c),r[t]=void 0)}}const ck=/(?:Once|Passive|Capture)$/;function uge(e){let t;if(ck.test(e)){t={};let i;for(;i=e.match(ck);)e=e.slice(0,e.length-i[0].length),t[i[0].toLowerCase()]=!0}return[e[2]===":"?e.slice(3):pT(e.slice(2)),t]}let TL=0;const fge=Promise.resolve(),dge=()=>TL||(fge.then(()=>TL=0),TL=Date.now());function hge(e,t){const n=i=>{if(!i._vts)i._vts=Date.now();else if(i._vts<=n.attached)return;au(pge(i,n.value),t,5,[i])};return n.value=e,n.attached=dge(),n}function pge(e,t){if(dn(t)){const n=e.stopImmediatePropagation;return e.stopImmediatePropagation=()=>{n.call(e),e._stopped=!0},t.map(i=>o=>!o._stopped&&i&&i(o))}else return t}const lk=/^on[a-z]/,mge=(e,t,n,i,o=!1,r,s,a,c)=>{t==="class"?ige(e,i,o):t==="style"?oge(e,n,i):b1(t)?k2(t)||lge(e,t,n,i,s):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):_ge(e,t,i,o))?age(e,t,i,r,s,a,c):(t==="true-value"?e._trueValue=i:t==="false-value"&&(e._falseValue=i),sge(e,t,i,o))};function _ge(e,t,n,i){return i?!!(t==="innerHTML"||t==="textContent"||t in e&&lk.test(t)&&$n(n)):t==="spellcheck"||t==="draggable"||t==="translate"||t==="form"||t==="list"&&e.tagName==="INPUT"||t==="type"&&e.tagName==="TEXTAREA"||lk.test(t)&&Do(n)?!1:t in e}const Hp="transition",lC="animation",lx=(e,{slots:t})=>N1(GY,gge(e),t);lx.displayName="Transition";const f$={name:String,type:String,css:{type:Boolean,default:!0},duration:[String,Number,Object],enterFromClass:String,enterActiveClass:String,enterToClass:String,appearFromClass:String,appearActiveClass:String,appearToClass:String,leaveFromClass:String,leaveActiveClass:String,leaveToClass:String};lx.props=fa({},GY.props,f$);const W_=(e,t=[])=>{dn(e)?e.forEach(n=>n(...t)):e&&e(...t)},uk=e=>e?dn(e)?e.some(t=>t.length>1):e.length>1:!1;function gge(e){const t={};for(const O in e)O in f$||(t[O]=e[O]);if(e.css===!1)return t;const{name:n="v",type:i,duration:o,enterFromClass:r=`${n}-enter-from`,enterActiveClass:s=`${n}-enter-active`,enterToClass:a=`${n}-enter-to`,appearFromClass:c=r,appearActiveClass:u=s,appearToClass:f=a,leaveFromClass:h=`${n}-leave-from`,leaveActiveClass:_=`${n}-leave-active`,leaveToClass:g=`${n}-leave-to`}=e,p=yge(o),y=p&&p[0],T=p&&p[1],{onBeforeEnter:b,onEnter:x,onEnterCancelled:v,onLeave:D,onLeaveCancelled:L,onBeforeAppear:B=b,onAppear:V=x,onAppearCancelled:M=v}=t,H=(O,m,P)=>{q_(O,m?f:a),q_(O,m?u:s),P&&P()},G=(O,m)=>{O._isLeaving=!1,q_(O,h),q_(O,g),q_(O,_),m&&m()},I=O=>(m,P)=>{const R=O?V:x,U=()=>H(m,O,P);W_(R,[m,U]),fk(()=>{q_(m,O?c:r),Vp(m,O?f:a),uk(R)||dk(m,i,y,U)})};return fa(t,{onBeforeEnter(O){W_(b,[O]),Vp(O,r),Vp(O,s)},onBeforeAppear(O){W_(B,[O]),Vp(O,c),Vp(O,u)},onEnter:I(!1),onAppear:I(!0),onLeave(O,m){O._isLeaving=!0;const P=()=>G(O,m);Vp(O,h),Cge(),Vp(O,_),fk(()=>{O._isLeaving&&(q_(O,h),Vp(O,g),uk(D)||dk(O,i,T,P))}),W_(D,[O,P])},onEnterCancelled(O){H(O,!1),W_(v,[O])},onAppearCancelled(O){H(O,!0),W_(M,[O])},onLeaveCancelled(O){G(O),W_(L,[O])}})}function yge(e){if(e==null)return null;if(Ao(e))return[CL(e.enter),CL(e.leave)];{const t=CL(e);return[t,t]}}function CL(e){return q2(e)}function Vp(e,t){t.split(/\s+/).forEach(n=>n&&e.classList.add(n)),(e._vtc||(e._vtc=new Set)).add(t)}function q_(e,t){t.split(/\s+/).forEach(i=>i&&e.classList.remove(i));const{_vtc:n}=e;n&&(n.delete(t),n.size||(e._vtc=void 0))}function fk(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}let Age=0;function dk(e,t,n,i){const o=e._endId=++Age,r=()=>{o===e._endId&&i()};if(n)return setTimeout(r,n);const{type:s,timeout:a,propCount:c}=Tge(e,t);if(!s)return i();const u=s+"end";let f=0;const h=()=>{e.removeEventListener(u,_),r()},_=g=>{g.target===e&&++f>=c&&h()};setTimeout(()=>{f<c&&h()},a+1),e.addEventListener(u,_)}function Tge(e,t){const n=window.getComputedStyle(e),i=p=>(n[p]||"").split(", "),o=i(`${Hp}Delay`),r=i(`${Hp}Duration`),s=hk(o,r),a=i(`${lC}Delay`),c=i(`${lC}Duration`),u=hk(a,c);let f=null,h=0,_=0;t===Hp?s>0&&(f=Hp,h=s,_=r.length):t===lC?u>0&&(f=lC,h=u,_=c.length):(h=Math.max(s,u),f=h>0?s>u?Hp:lC:null,_=f?f===Hp?r.length:c.length:0);const g=f===Hp&&/\b(transform|all)(,|$)/.test(i(`${Hp}Property`).toString());return{type:f,timeout:h,propCount:_,hasTransform:g}}function hk(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map((n,i)=>pk(n)+pk(e[i])))}function pk(e){return Number(e.slice(0,-1).replace(",","."))*1e3}function Cge(){return document.body.offsetHeight}const mk=e=>{const t=e.props["onUpdate:modelValue"]||!1;return dn(t)?n=>hD(t,n):t},dI={deep:!0,created(e,t,n){e._assign=mk(n),u$(e,"change",()=>{const i=e._modelValue,o=bge(e),r=e.checked,s=e._assign;if(dn(i)){const a=cY(i,o),c=a!==-1;if(r&&!c)s(i.concat(o));else if(!r&&c){const u=[...i];u.splice(a,1),s(u)}}else if(E1(i)){const a=new Set(i);r?a.add(o):a.delete(o),s(a)}else s(d$(e,r))})},mounted:_k,beforeUpdate(e,t,n){e._assign=mk(n),_k(e,t,n)}};function _k(e,{value:t,oldValue:n},i){e._modelValue=t,dn(t)?e.checked=cY(t,i.props.value)>-1:E1(t)?e.checked=t.has(i.props.value):t!==n&&(e.checked=C1(t,d$(e,!0)))}function bge(e){return"_value"in e?e._value:e.value}function d$(e,t){const n=t?"_trueValue":"_falseValue";return n in e?e[n]:t}const Ege=["ctrl","shift","alt","meta"],xge={stop:e=>e.stopPropagation(),prevent:e=>e.preventDefault(),self:e=>e.target!==e.currentTarget,ctrl:e=>!e.ctrlKey,shift:e=>!e.shiftKey,alt:e=>!e.altKey,meta:e=>!e.metaKey,left:e=>"button"in e&&e.button!==0,middle:e=>"button"in e&&e.button!==1,right:e=>"button"in e&&e.button!==2,exact:(e,t)=>Ege.some(n=>e[`${n}Key`]&&!t.includes(n))},h$=(e,t)=>(n,...i)=>{for(let o=0;o<t.length;o++){const r=xge[t[o]];if(r&&r(n,t))return}return e(n,...i)},l3={beforeMount(e,{value:t},{transition:n}){e._vod=e.style.display==="none"?"":e.style.display,n&&t?n.beforeEnter(e):uC(e,t)},mounted(e,{value:t},{transition:n}){n&&t&&n.enter(e)},updated(e,{value:t,oldValue:n},{transition:i}){!t!=!n&&(i?t?(i.beforeEnter(e),uC(e,!0),i.enter(e)):i.leave(e,()=>{uC(e,!1)}):uC(e,t))},beforeUnmount(e,{value:t}){uC(e,t)}};function uC(e,t){e.style.display=t?e._vod:"none"}const wge=fa({patchProp:mge},nge);let gk;function p$(){return gk||(gk=B_e(wge))}const yk=(...e)=>{p$().render(...e)},Sge=(...e)=>{const t=p$().createApp(...e),{mount:n}=t;return t.mount=i=>{const o=vge(i);if(!o)return;const r=t._component;!$n(r)&&!r.render&&!r.template&&(r.template=o.innerHTML),o.innerHTML="";const s=n(o,!1,o instanceof SVGElement);return o instanceof Element&&(o.removeAttribute("v-cloak"),o.setAttribute("data-v-app","")),s},t};function vge(e){return Do(e)?document.querySelector(e):e}var Dge=!1;/*!
|
||
* pinia v2.0.28
|
||
* (c) 2022 Eduardo San Martin Morote
|
||
* @license MIT
|
||
*/const Ige=Symbol();var Ak;(function(e){e.direct="direct",e.patchObject="patch object",e.patchFunction="patch function"})(Ak||(Ak={}));function Pge(){const e=hme(!0),t=e.run(()=>xo({}));let n=[],i=[];const o=Q2({install(r){o._a=r,r.provide(Ige,o),r.config.globalProperties.$pinia=o,i.forEach(s=>n.push(s)),i=[]},use(r){return!this._a&&!Dge?i.push(r):n.push(r),this},_p:n,_a:null,_e:e,_s:new Map,state:t});return o}/*!
|
||
* vue-router v4.1.6
|
||
* (c) 2022 Eduardo San Martin Morote
|
||
* @license MIT
|
||
*/const $0=typeof window<"u";function Oge(e){return e.__esModule||e[Symbol.toStringTag]==="Module"}const Eo=Object.assign;function bL(e,t){const n={};for(const i in t){const o=t[i];n[i]=hf(o)?o.map(e):e(o)}return n}const zb=()=>{},hf=Array.isArray,Lge=/\/$/,Bge=e=>e.replace(Lge,"");function EL(e,t,n="/"){let i,o={},r="",s="";const a=t.indexOf("#");let c=t.indexOf("?");return a<c&&a>=0&&(c=-1),c>-1&&(i=t.slice(0,c),r=t.slice(c+1,a>-1?a:t.length),o=e(r)),a>-1&&(i=i||t.slice(0,a),s=t.slice(a,t.length)),i=Fge(i??t,n),{fullPath:i+(r&&"?")+r+s,path:i,query:o,hash:s}}function Rge(e,t){const n=t.query?e(t.query):"";return t.path+(n&&"?")+n+(t.hash||"")}function Tk(e,t){return!t||!e.toLowerCase().startsWith(t.toLowerCase())?e:e.slice(t.length)||"/"}function Nge(e,t,n){const i=t.matched.length-1,o=n.matched.length-1;return i>-1&&i===o&&qA(t.matched[i],n.matched[o])&&m$(t.params,n.params)&&e(t.query)===e(n.query)&&t.hash===n.hash}function qA(e,t){return(e.aliasOf||e)===(t.aliasOf||t)}function m$(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(!Mge(e[n],t[n]))return!1;return!0}function Mge(e,t){return hf(e)?Ck(e,t):hf(t)?Ck(t,e):e===t}function Ck(e,t){return hf(t)?e.length===t.length&&e.every((n,i)=>n===t[i]):e.length===1&&e[0]===t}function Fge(e,t){if(e.startsWith("/"))return e;if(!e)return t;const n=t.split("/"),i=e.split("/");let o=n.length-1,r,s;for(r=0;r<i.length;r++)if(s=i[r],s!==".")if(s==="..")o>1&&o--;else break;return n.slice(0,o).join("/")+"/"+i.slice(r-(r===i.length?1:0)).join("/")}var _E;(function(e){e.pop="pop",e.push="push"})(_E||(_E={}));var Ub;(function(e){e.back="back",e.forward="forward",e.unknown=""})(Ub||(Ub={}));function zge(e){if(!e)if($0){const t=document.querySelector("base");e=t&&t.getAttribute("href")||"/",e=e.replace(/^\w+:\/\/[^\/]+/,"")}else e="/";return e[0]!=="/"&&e[0]!=="#"&&(e="/"+e),Bge(e)}const Uge=/^[^#]+#/;function Hge(e,t){return e.replace(Uge,"#")+t}function Vge(e,t){const n=document.documentElement.getBoundingClientRect(),i=e.getBoundingClientRect();return{behavior:t.behavior,left:i.left-n.left-(t.left||0),top:i.top-n.top-(t.top||0)}}const M1=()=>({left:window.pageXOffset,top:window.pageYOffset});function kge(e){let t;if("el"in e){const n=e.el,i=typeof n=="string"&&n.startsWith("#"),o=typeof n=="string"?i?document.getElementById(n.slice(1)):document.querySelector(n):n;if(!o)return;t=Vge(o,e)}else t=e;"scrollBehavior"in document.documentElement.style?window.scrollTo(t):window.scrollTo(t.left!=null?t.left:window.pageXOffset,t.top!=null?t.top:window.pageYOffset)}function bk(e,t){return(history.state?history.state.position-t:-1)+e}const CM=new Map;function Gge(e,t){CM.set(e,t)}function Wge(e){const t=CM.get(e);return CM.delete(e),t}let qge=()=>location.protocol+"//"+location.host;function _$(e,t){const{pathname:n,search:i,hash:o}=t,r=e.indexOf("#");if(r>-1){let a=o.includes(e.slice(r))?e.slice(r).length:1,c=o.slice(a);return c[0]!=="/"&&(c="/"+c),Tk(c,"")}return Tk(n,e)+i+o}function jge(e,t,n,i){let o=[],r=[],s=null;const a=({state:_})=>{const g=_$(e,location),p=n.value,y=t.value;let T=0;if(_){if(n.value=g,t.value=_,s&&s===p){s=null;return}T=y?_.position-y.position:0}else i(g);o.forEach(b=>{b(n.value,p,{delta:T,type:_E.pop,direction:T?T>0?Ub.forward:Ub.back:Ub.unknown})})};function c(){s=n.value}function u(_){o.push(_);const g=()=>{const p=o.indexOf(_);p>-1&&o.splice(p,1)};return r.push(g),g}function f(){const{history:_}=window;_.state&&_.replaceState(Eo({},_.state,{scroll:M1()}),"")}function h(){for(const _ of r)_();r=[],window.removeEventListener("popstate",a),window.removeEventListener("beforeunload",f)}return window.addEventListener("popstate",a),window.addEventListener("beforeunload",f),{pauseListeners:c,listen:u,destroy:h}}function Ek(e,t,n,i=!1,o=!1){return{back:e,current:t,forward:n,replaced:i,position:window.history.length,scroll:o?M1():null}}function Yge(e){const{history:t,location:n}=window,i={value:_$(e,n)},o={value:t.state};o.value||r(i.value,{back:null,current:i.value,forward:null,position:t.length-1,replaced:!0,scroll:null},!0);function r(c,u,f){const h=e.indexOf("#"),_=h>-1?(n.host&&document.querySelector("base")?e:e.slice(h))+c:qge()+e+c;try{t[f?"replaceState":"pushState"](u,"",_),o.value=u}catch(g){console.error(g),n[f?"replace":"assign"](_)}}function s(c,u){const f=Eo({},t.state,Ek(o.value.back,c,o.value.forward,!0),u,{position:o.value.position});r(c,f,!0),i.value=c}function a(c,u){const f=Eo({},o.value,t.state,{forward:c,scroll:M1()});r(f.current,f,!0);const h=Eo({},Ek(i.value,c,null),{position:f.position+1},u);r(c,h,!1),i.value=c}return{location:i,state:o,push:a,replace:s}}function $ge(e){e=zge(e);const t=Yge(e),n=jge(e,t.state,t.location,t.replace);function i(r,s=!0){s||n.pauseListeners(),history.go(r)}const o=Eo({location:"",base:e,go:i,createHref:Hge.bind(null,e)},t,n);return Object.defineProperty(o,"location",{enumerable:!0,get:()=>t.location.value}),Object.defineProperty(o,"state",{enumerable:!0,get:()=>t.state.value}),o}function Xge(e){return typeof e=="string"||e&&typeof e=="object"}function g$(e){return typeof e=="string"||typeof e=="symbol"}const kp={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0},y$=Symbol("");var xk;(function(e){e[e.aborted=4]="aborted",e[e.cancelled=8]="cancelled",e[e.duplicated=16]="duplicated"})(xk||(xk={}));function jA(e,t){return Eo(new Error,{type:e,[y$]:!0},t)}function ah(e,t){return e instanceof Error&&y$ in e&&(t==null||!!(e.type&t))}const wk="[^/]+?",Kge={sensitive:!1,strict:!1,start:!0,end:!0},Jge=/[.+*?^${}()[\]/\\]/g;function Qge(e,t){const n=Eo({},Kge,t),i=[];let o=n.start?"^":"";const r=[];for(const u of e){const f=u.length?[]:[90];n.strict&&!u.length&&(o+="/");for(let h=0;h<u.length;h++){const _=u[h];let g=40+(n.sensitive?.25:0);if(_.type===0)h||(o+="/"),o+=_.value.replace(Jge,"\\$&"),g+=40;else if(_.type===1){const{value:p,repeatable:y,optional:T,regexp:b}=_;r.push({name:p,repeatable:y,optional:T});const x=b||wk;if(x!==wk){g+=10;try{new RegExp(`(${x})`)}catch(D){throw new Error(`Invalid custom RegExp for param "${p}" (${x}): `+D.message)}}let v=y?`((?:${x})(?:/(?:${x}))*)`:`(${x})`;h||(v=T&&u.length<2?`(?:/${v})`:"/"+v),T&&(v+="?"),o+=v,g+=20,T&&(g+=-8),y&&(g+=-20),x===".*"&&(g+=-50)}f.push(g)}i.push(f)}if(n.strict&&n.end){const u=i.length-1;i[u][i[u].length-1]+=.7000000000000001}n.strict||(o+="/?"),n.end?o+="$":n.strict&&(o+="(?:/|$)");const s=new RegExp(o,n.sensitive?"":"i");function a(u){const f=u.match(s),h={};if(!f)return null;for(let _=1;_<f.length;_++){const g=f[_]||"",p=r[_-1];h[p.name]=g&&p.repeatable?g.split("/"):g}return h}function c(u){let f="",h=!1;for(const _ of e){(!h||!f.endsWith("/"))&&(f+="/"),h=!1;for(const g of _)if(g.type===0)f+=g.value;else if(g.type===1){const{value:p,repeatable:y,optional:T}=g,b=p in u?u[p]:"";if(hf(b)&&!y)throw new Error(`Provided param "${p}" is an array but it is not repeatable (* or + modifiers)`);const x=hf(b)?b.join("/"):b;if(!x)if(T)_.length<2&&(f.endsWith("/")?f=f.slice(0,-1):h=!0);else throw new Error(`Missing required param "${p}"`);f+=x}}return f||"/"}return{re:s,score:i,keys:r,parse:a,stringify:c}}function Zge(e,t){let n=0;for(;n<e.length&&n<t.length;){const i=t[n]-e[n];if(i)return i;n++}return e.length<t.length?e.length===1&&e[0]===40+40?-1:1:e.length>t.length?t.length===1&&t[0]===40+40?1:-1:0}function eye(e,t){let n=0;const i=e.score,o=t.score;for(;n<i.length&&n<o.length;){const r=Zge(i[n],o[n]);if(r)return r;n++}if(Math.abs(o.length-i.length)===1){if(Sk(i))return 1;if(Sk(o))return-1}return o.length-i.length}function Sk(e){const t=e[e.length-1];return e.length>0&&t[t.length-1]<0}const tye={type:0,value:""},nye=/[a-zA-Z0-9_]/;function iye(e){if(!e)return[[]];if(e==="/")return[[tye]];if(!e.startsWith("/"))throw new Error(`Invalid path "${e}"`);function t(g){throw new Error(`ERR (${n})/"${u}": ${g}`)}let n=0,i=n;const o=[];let r;function s(){r&&o.push(r),r=[]}let a=0,c,u="",f="";function h(){u&&(n===0?r.push({type:0,value:u}):n===1||n===2||n===3?(r.length>1&&(c==="*"||c==="+")&&t(`A repeatable param (${u}) must be alone in its segment. eg: '/:ids+.`),r.push({type:1,value:u,regexp:f,repeatable:c==="*"||c==="+",optional:c==="*"||c==="?"})):t("Invalid state to consume buffer"),u="")}function _(){u+=c}for(;a<e.length;){if(c=e[a++],c==="\\"&&n!==2){i=n,n=4;continue}switch(n){case 0:c==="/"?(u&&h(),s()):c===":"?(h(),n=1):_();break;case 4:_(),n=i;break;case 1:c==="("?n=2:nye.test(c)?_():(h(),n=0,c!=="*"&&c!=="?"&&c!=="+"&&a--);break;case 2:c===")"?f[f.length-1]=="\\"?f=f.slice(0,-1)+c:n=3:f+=c;break;case 3:h(),n=0,c!=="*"&&c!=="?"&&c!=="+"&&a--,f="";break;default:t("Unknown state");break}}return n===2&&t(`Unfinished custom RegExp for param "${u}"`),h(),s(),o}function oye(e,t,n){const i=Qge(iye(e.path),n),o=Eo(i,{record:e,parent:t,children:[],alias:[]});return t&&!o.record.aliasOf==!t.record.aliasOf&&t.children.push(o),o}function rye(e,t){const n=[],i=new Map;t=Ik({strict:!1,end:!0,sensitive:!1},t);function o(f){return i.get(f)}function r(f,h,_){const g=!_,p=sye(f);p.aliasOf=_&&_.record;const y=Ik(t,f),T=[p];if("alias"in f){const v=typeof f.alias=="string"?[f.alias]:f.alias;for(const D of v)T.push(Eo({},p,{components:_?_.record.components:p.components,path:D,aliasOf:_?_.record:p}))}let b,x;for(const v of T){const{path:D}=v;if(h&&D[0]!=="/"){const L=h.record.path,B=L[L.length-1]==="/"?"":"/";v.path=h.record.path+(D&&B+D)}if(b=oye(v,h,y),_?_.alias.push(b):(x=x||b,x!==b&&x.alias.push(b),g&&f.name&&!Dk(b)&&s(f.name)),p.children){const L=p.children;for(let B=0;B<L.length;B++)r(L[B],b,_&&_.children[B])}_=_||b,(b.record.components&&Object.keys(b.record.components).length||b.record.name||b.record.redirect)&&c(b)}return x?()=>{s(x)}:zb}function s(f){if(g$(f)){const h=i.get(f);h&&(i.delete(f),n.splice(n.indexOf(h),1),h.children.forEach(s),h.alias.forEach(s))}else{const h=n.indexOf(f);h>-1&&(n.splice(h,1),f.record.name&&i.delete(f.record.name),f.children.forEach(s),f.alias.forEach(s))}}function a(){return n}function c(f){let h=0;for(;h<n.length&&eye(f,n[h])>=0&&(f.record.path!==n[h].record.path||!A$(f,n[h]));)h++;n.splice(h,0,f),f.record.name&&!Dk(f)&&i.set(f.record.name,f)}function u(f,h){let _,g={},p,y;if("name"in f&&f.name){if(_=i.get(f.name),!_)throw jA(1,{location:f});y=_.record.name,g=Eo(vk(h.params,_.keys.filter(x=>!x.optional).map(x=>x.name)),f.params&&vk(f.params,_.keys.map(x=>x.name))),p=_.stringify(g)}else if("path"in f)p=f.path,_=n.find(x=>x.re.test(p)),_&&(g=_.parse(p),y=_.record.name);else{if(_=h.name?i.get(h.name):n.find(x=>x.re.test(h.path)),!_)throw jA(1,{location:f,currentLocation:h});y=_.record.name,g=Eo({},h.params,f.params),p=_.stringify(g)}const T=[];let b=_;for(;b;)T.unshift(b.record),b=b.parent;return{name:y,path:p,params:g,matched:T,meta:cye(T)}}return e.forEach(f=>r(f)),{addRoute:r,resolve:u,removeRoute:s,getRoutes:a,getRecordMatcher:o}}function vk(e,t){const n={};for(const i of t)i in e&&(n[i]=e[i]);return n}function sye(e){return{path:e.path,redirect:e.redirect,name:e.name,meta:e.meta||{},aliasOf:void 0,beforeEnter:e.beforeEnter,props:aye(e),children:e.children||[],instances:{},leaveGuards:new Set,updateGuards:new Set,enterCallbacks:{},components:"components"in e?e.components||null:e.component&&{default:e.component}}}function aye(e){const t={},n=e.props||!1;if("component"in e)t.default=n;else for(const i in e.components)t[i]=typeof n=="boolean"?n:n[i];return t}function Dk(e){for(;e;){if(e.record.aliasOf)return!0;e=e.parent}return!1}function cye(e){return e.reduce((t,n)=>Eo(t,n.meta),{})}function Ik(e,t){const n={};for(const i in e)n[i]=i in t?t[i]:e[i];return n}function A$(e,t){return t.children.some(n=>n===e||A$(e,n))}const T$=/#/g,lye=/&/g,uye=/\//g,fye=/=/g,dye=/\?/g,C$=/\+/g,hye=/%5B/g,pye=/%5D/g,b$=/%5E/g,mye=/%60/g,E$=/%7B/g,_ye=/%7C/g,x$=/%7D/g,gye=/%20/g;function u3(e){return encodeURI(""+e).replace(_ye,"|").replace(hye,"[").replace(pye,"]")}function yye(e){return u3(e).replace(E$,"{").replace(x$,"}").replace(b$,"^")}function bM(e){return u3(e).replace(C$,"%2B").replace(gye,"+").replace(T$,"%23").replace(lye,"%26").replace(mye,"`").replace(E$,"{").replace(x$,"}").replace(b$,"^")}function Aye(e){return bM(e).replace(fye,"%3D")}function Tye(e){return u3(e).replace(T$,"%23").replace(dye,"%3F")}function Cye(e){return e==null?"":Tye(e).replace(uye,"%2F")}function hI(e){try{return decodeURIComponent(""+e)}catch{}return""+e}function bye(e){const t={};if(e===""||e==="?")return t;const i=(e[0]==="?"?e.slice(1):e).split("&");for(let o=0;o<i.length;++o){const r=i[o].replace(C$," "),s=r.indexOf("="),a=hI(s<0?r:r.slice(0,s)),c=s<0?null:hI(r.slice(s+1));if(a in t){let u=t[a];hf(u)||(u=t[a]=[u]),u.push(c)}else t[a]=c}return t}function Pk(e){let t="";for(let n in e){const i=e[n];if(n=Aye(n),i==null){i!==void 0&&(t+=(t.length?"&":"")+n);continue}(hf(i)?i.map(r=>r&&bM(r)):[i&&bM(i)]).forEach(r=>{r!==void 0&&(t+=(t.length?"&":"")+n,r!=null&&(t+="="+r))})}return t}function Eye(e){const t={};for(const n in e){const i=e[n];i!==void 0&&(t[n]=hf(i)?i.map(o=>o==null?null:""+o):i==null?i:""+i)}return t}const xye=Symbol(""),Ok=Symbol(""),f3=Symbol(""),w$=Symbol(""),EM=Symbol("");function fC(){let e=[];function t(i){return e.push(i),()=>{const o=e.indexOf(i);o>-1&&e.splice(o,1)}}function n(){e=[]}return{add:t,list:()=>e,reset:n}}function _m(e,t,n,i,o){const r=i&&(i.enterCallbacks[o]=i.enterCallbacks[o]||[]);return()=>new Promise((s,a)=>{const c=h=>{h===!1?a(jA(4,{from:n,to:t})):h instanceof Error?a(h):Xge(h)?a(jA(2,{from:t,to:h})):(r&&i.enterCallbacks[o]===r&&typeof h=="function"&&r.push(h),s())},u=e.call(i&&i.instances[o],t,n,c);let f=Promise.resolve(u);e.length<3&&(f=f.then(c)),f.catch(h=>a(h))})}function xL(e,t,n,i){const o=[];for(const r of e)for(const s in r.components){let a=r.components[s];if(!(t!=="beforeRouteEnter"&&!r.instances[s]))if(wye(a)){const u=(a.__vccOpts||a)[t];u&&o.push(_m(u,n,i,r,s))}else{let c=a();o.push(()=>c.then(u=>{if(!u)return Promise.reject(new Error(`Couldn't resolve component "${s}" at "${r.path}"`));const f=Oge(u)?u.default:u;r.components[s]=f;const _=(f.__vccOpts||f)[t];return _&&_m(_,n,i,r,s)()}))}}return o}function wye(e){return typeof e=="object"||"displayName"in e||"props"in e||"__vccOpts"in e}function Lk(e){const t=Qr(f3),n=Qr(w$),i=yn(()=>t.resolve(xt(e.to))),o=yn(()=>{const{matched:c}=i.value,{length:u}=c,f=c[u-1],h=n.matched;if(!f||!h.length)return-1;const _=h.findIndex(qA.bind(null,f));if(_>-1)return _;const g=Bk(c[u-2]);return u>1&&Bk(f)===g&&h[h.length-1].path!==g?h.findIndex(qA.bind(null,c[u-2])):_}),r=yn(()=>o.value>-1&&Iye(n.params,i.value.params)),s=yn(()=>o.value>-1&&o.value===n.matched.length-1&&m$(n.params,i.value.params));function a(c={}){return Dye(c)?t[xt(e.replace)?"replace":"push"](xt(e.to)).catch(zb):Promise.resolve()}return{route:i,href:yn(()=>i.value.href),isActive:r,isExactActive:s,navigate:a}}const Sye=ms({name:"RouterLink",compatConfig:{MODE:3},props:{to:{type:[String,Object],required:!0},replace:Boolean,activeClass:String,exactActiveClass:String,custom:Boolean,ariaCurrentValue:{type:String,default:"page"}},useLink:Lk,setup(e,{slots:t}){const n=ax(Lk(e)),{options:i}=Qr(f3),o=yn(()=>({[Rk(e.activeClass,i.linkActiveClass,"router-link-active")]:n.isActive,[Rk(e.exactActiveClass,i.linkExactActiveClass,"router-link-exact-active")]:n.isExactActive}));return()=>{const r=t.default&&t.default(n);return e.custom?r:N1("a",{"aria-current":n.isExactActive?e.ariaCurrentValue:null,href:n.href,onClick:n.navigate,class:o.value},r)}}}),vye=Sye;function Dye(e){if(!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)&&!e.defaultPrevented&&!(e.button!==void 0&&e.button!==0)){if(e.currentTarget&&e.currentTarget.getAttribute){const t=e.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(t))return}return e.preventDefault&&e.preventDefault(),!0}}function Iye(e,t){for(const n in t){const i=t[n],o=e[n];if(typeof i=="string"){if(i!==o)return!1}else if(!hf(o)||o.length!==i.length||i.some((r,s)=>r!==o[s]))return!1}return!0}function Bk(e){return e?e.aliasOf?e.aliasOf.path:e.path:""}const Rk=(e,t,n)=>e??t??n,Pye=ms({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(e,{attrs:t,slots:n}){const i=Qr(EM),o=yn(()=>e.route||i.value),r=Qr(Ok,0),s=yn(()=>{let u=xt(r);const{matched:f}=o.value;let h;for(;(h=f[u])&&!h.components;)u++;return u}),a=yn(()=>o.value.matched[s.value]);Bm(Ok,yn(()=>s.value+1)),Bm(xye,a),Bm(EM,o);const c=xo();return ws(()=>[c.value,a.value,e.name],([u,f,h],[_,g,p])=>{f&&(f.instances[h]=u,g&&g!==f&&u&&u===_&&(f.leaveGuards.size||(f.leaveGuards=g.leaveGuards),f.updateGuards.size||(f.updateGuards=g.updateGuards))),u&&f&&(!g||!qA(f,g)||!_)&&(f.enterCallbacks[h]||[]).forEach(y=>y(u))},{flush:"post"}),()=>{const u=o.value,f=e.name,h=a.value,_=h&&h.components[f];if(!_)return Nk(n.default,{Component:_,route:u});const g=h.props[f],p=g?g===!0?u.params:typeof g=="function"?g(u):g:null,T=N1(_,Eo({},p,t,{onVnodeUnmounted:b=>{b.component.isUnmounted&&(h.instances[f]=null)},ref:c}));return Nk(n.default,{Component:T,route:u})||T}}});function Nk(e,t){if(!e)return null;const n=e(t);return n.length===1?n[0]:n}const S$=Pye;function Oye(e){const t=rye(e.routes,e),n=e.parseQuery||bye,i=e.stringifyQuery||Pk,o=e.history,r=fC(),s=fC(),a=fC(),c=Vme(kp);let u=kp;$0&&e.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const f=bL.bind(null,Z=>""+Z),h=bL.bind(null,Cye),_=bL.bind(null,hI);function g(Z,J){let de,_e;return g$(Z)?(de=t.getRecordMatcher(Z),_e=J):_e=Z,t.addRoute(_e,de)}function p(Z){const J=t.getRecordMatcher(Z);J&&t.removeRoute(J)}function y(){return t.getRoutes().map(Z=>Z.record)}function T(Z){return!!t.getRecordMatcher(Z)}function b(Z,J){if(J=Eo({},J||c.value),typeof Z=="string"){const ne=EL(n,Z,J.path),ae=t.resolve({path:ne.path},J),ye=o.createHref(ne.fullPath);return Eo(ne,ae,{params:_(ae.params),hash:hI(ne.hash),redirectedFrom:void 0,href:ye})}let de;if("path"in Z)de=Eo({},Z,{path:EL(n,Z.path,J.path).path});else{const ne=Eo({},Z.params);for(const ae in ne)ne[ae]==null&&delete ne[ae];de=Eo({},Z,{params:h(Z.params)}),J.params=h(J.params)}const _e=t.resolve(de,J),le=Z.hash||"";_e.params=f(_(_e.params));const Te=Rge(i,Eo({},Z,{hash:yye(le),path:_e.path})),pe=o.createHref(Te);return Eo({fullPath:Te,hash:le,query:i===Pk?Eye(Z.query):Z.query||{}},_e,{redirectedFrom:void 0,href:pe})}function x(Z){return typeof Z=="string"?EL(n,Z,c.value.path):Eo({},Z)}function v(Z,J){if(u!==Z)return jA(8,{from:J,to:Z})}function D(Z){return V(Z)}function L(Z){return D(Eo(x(Z),{replace:!0}))}function B(Z){const J=Z.matched[Z.matched.length-1];if(J&&J.redirect){const{redirect:de}=J;let _e=typeof de=="function"?de(Z):de;return typeof _e=="string"&&(_e=_e.includes("?")||_e.includes("#")?_e=x(_e):{path:_e},_e.params={}),Eo({query:Z.query,hash:Z.hash,params:"path"in _e?{}:Z.params},_e)}}function V(Z,J){const de=u=b(Z),_e=c.value,le=Z.state,Te=Z.force,pe=Z.replace===!0,ne=B(de);if(ne)return V(Eo(x(ne),{state:typeof ne=="object"?Eo({},le,ne.state):le,force:Te,replace:pe}),J||de);const ae=de;ae.redirectedFrom=J;let ye;return!Te&&Nge(i,_e,de)&&(ye=jA(16,{to:ae,from:_e}),j(_e,_e,!0,!1)),(ye?Promise.resolve(ye):H(ae,_e)).catch(Ce=>ah(Ce)?ah(Ce,2)?Ce:Y(Ce):W(Ce,ae,_e)).then(Ce=>{if(Ce){if(ah(Ce,2))return V(Eo({replace:pe},x(Ce.to),{state:typeof Ce.to=="object"?Eo({},le,Ce.to.state):le,force:Te}),J||ae)}else Ce=I(ae,_e,!0,pe,le);return G(ae,_e,Ce),Ce})}function M(Z,J){const de=v(Z,J);return de?Promise.reject(de):Promise.resolve()}function H(Z,J){let de;const[_e,le,Te]=Lye(Z,J);de=xL(_e.reverse(),"beforeRouteLeave",Z,J);for(const ne of _e)ne.leaveGuards.forEach(ae=>{de.push(_m(ae,Z,J))});const pe=M.bind(null,Z,J);return de.push(pe),d0(de).then(()=>{de=[];for(const ne of r.list())de.push(_m(ne,Z,J));return de.push(pe),d0(de)}).then(()=>{de=xL(le,"beforeRouteUpdate",Z,J);for(const ne of le)ne.updateGuards.forEach(ae=>{de.push(_m(ae,Z,J))});return de.push(pe),d0(de)}).then(()=>{de=[];for(const ne of Z.matched)if(ne.beforeEnter&&!J.matched.includes(ne))if(hf(ne.beforeEnter))for(const ae of ne.beforeEnter)de.push(_m(ae,Z,J));else de.push(_m(ne.beforeEnter,Z,J));return de.push(pe),d0(de)}).then(()=>(Z.matched.forEach(ne=>ne.enterCallbacks={}),de=xL(Te,"beforeRouteEnter",Z,J),de.push(pe),d0(de))).then(()=>{de=[];for(const ne of s.list())de.push(_m(ne,Z,J));return de.push(pe),d0(de)}).catch(ne=>ah(ne,8)?ne:Promise.reject(ne))}function G(Z,J,de){for(const _e of a.list())_e(Z,J,de)}function I(Z,J,de,_e,le){const Te=v(Z,J);if(Te)return Te;const pe=J===kp,ne=$0?history.state:{};de&&(_e||pe?o.replace(Z.fullPath,Eo({scroll:pe&&ne&&ne.scroll},le)):o.push(Z.fullPath,le)),c.value=Z,j(Z,J,de,pe),Y()}let O;function m(){O||(O=o.listen((Z,J,de)=>{if(!Q.listening)return;const _e=b(Z),le=B(_e);if(le){V(Eo(le,{replace:!0}),_e).catch(zb);return}u=_e;const Te=c.value;$0&&Gge(bk(Te.fullPath,de.delta),M1()),H(_e,Te).catch(pe=>ah(pe,12)?pe:ah(pe,2)?(V(pe.to,_e).then(ne=>{ah(ne,20)&&!de.delta&&de.type===_E.pop&&o.go(-1,!1)}).catch(zb),Promise.reject()):(de.delta&&o.go(-de.delta,!1),W(pe,_e,Te))).then(pe=>{pe=pe||I(_e,Te,!1),pe&&(de.delta&&!ah(pe,8)?o.go(-de.delta,!1):de.type===_E.pop&&ah(pe,20)&&o.go(-1,!1)),G(_e,Te,pe)}).catch(zb)}))}let P=fC(),R=fC(),U;function W(Z,J,de){Y(Z);const _e=R.list();return _e.length?_e.forEach(le=>le(Z,J,de)):console.error(Z),Promise.reject(Z)}function q(){return U&&c.value!==kp?Promise.resolve():new Promise((Z,J)=>{P.add([Z,J])})}function Y(Z){return U||(U=!Z,m(),P.list().forEach(([J,de])=>Z?de(Z):J()),P.reset()),Z}function j(Z,J,de,_e){const{scrollBehavior:le}=e;if(!$0||!le)return Promise.resolve();const Te=!de&&Wge(bk(Z.fullPath,0))||(_e||!de)&&history.state&&history.state.scroll||null;return $m().then(()=>le(Z,J,Te)).then(pe=>pe&&kge(pe)).catch(pe=>W(pe,Z,J))}const ee=Z=>o.go(Z);let K;const se=new Set,Q={currentRoute:c,listening:!0,addRoute:g,removeRoute:p,hasRoute:T,getRoutes:y,resolve:b,options:e,push:D,replace:L,go:ee,back:()=>ee(-1),forward:()=>ee(1),beforeEach:r.add,beforeResolve:s.add,afterEach:a.add,onError:R.add,isReady:q,install(Z){const J=this;Z.component("RouterLink",vye),Z.component("RouterView",S$),Z.config.globalProperties.$router=J,Object.defineProperty(Z.config.globalProperties,"$route",{enumerable:!0,get:()=>xt(c)}),$0&&!K&&c.value===kp&&(K=!0,D(o.location).catch(le=>{}));const de={};for(const le in kp)de[le]=yn(()=>c.value[le]);Z.provide(f3,J),Z.provide(w$,ax(de)),Z.provide(EM,c);const _e=Z.unmount;se.add(Z),Z.unmount=function(){se.delete(Z),se.size<1&&(u=kp,O&&O(),O=null,c.value=kp,K=!1,U=!1),_e()}}};return Q}function d0(e){return e.reduce((t,n)=>t.then(()=>n()),Promise.resolve())}function Lye(e,t){const n=[],i=[],o=[],r=Math.max(t.matched.length,e.matched.length);for(let s=0;s<r;s++){const a=t.matched[s];a&&(e.matched.find(u=>qA(u,a))?i.push(a):n.push(a));const c=e.matched[s];c&&(t.matched.find(u=>qA(u,c))||o.push(c))}return[n,i,o]}const Bye=(e,t)=>{const n=e.__vccOpts||e;for(const[i,o]of t)n[i]=o;return n},Rye={__name:"App",setup(e){return(t,n)=>(_i(),Fc(xt(S$)))}},Nye=Bye(Rye,[["__scopeId","data-v-0969e94e"]]);var Mye=typeof global=="object"&&global&&global.Object===Object&&global;const v$=Mye;var Fye=typeof self=="object"&&self&&self.Object===Object&&self,zye=v$||Fye||Function("return this")();const sp=zye;var Uye=sp.Symbol;const gd=Uye;var D$=Object.prototype,Hye=D$.hasOwnProperty,Vye=D$.toString,dC=gd?gd.toStringTag:void 0;function kye(e){var t=Hye.call(e,dC),n=e[dC];try{e[dC]=void 0;var i=!0}catch{}var o=Vye.call(e);return i&&(t?e[dC]=n:delete e[dC]),o}var Gye=Object.prototype,Wye=Gye.toString;function qye(e){return Wye.call(e)}var jye="[object Null]",Yye="[object Undefined]",Mk=gd?gd.toStringTag:void 0;function gT(e){return e==null?e===void 0?Yye:jye:Mk&&Mk in Object(e)?kye(e):qye(e)}function YA(e){return e!=null&&typeof e=="object"}var $ye="[object Symbol]";function d3(e){return typeof e=="symbol"||YA(e)&&gT(e)==$ye}function Xye(e,t){for(var n=-1,i=e==null?0:e.length,o=Array(i);++n<i;)o[n]=t(e[n],n,e);return o}var Kye=Array.isArray;const $h=Kye;var Jye=1/0,Fk=gd?gd.prototype:void 0,zk=Fk?Fk.toString:void 0;function I$(e){if(typeof e=="string")return e;if($h(e))return Xye(e,I$)+"";if(d3(e))return zk?zk.call(e):"";var t=e+"";return t=="0"&&1/e==-Jye?"-0":t}function pI(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}function Qye(e){return e}var Zye="[object AsyncFunction]",e0e="[object Function]",t0e="[object GeneratorFunction]",n0e="[object Proxy]";function P$(e){if(!pI(e))return!1;var t=gT(e);return t==e0e||t==t0e||t==Zye||t==n0e}var i0e=sp["__core-js_shared__"];const wL=i0e;var Uk=function(){var e=/[^.]+$/.exec(wL&&wL.keys&&wL.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function o0e(e){return!!Uk&&Uk in e}var r0e=Function.prototype,s0e=r0e.toString;function Ty(e){if(e!=null){try{return s0e.call(e)}catch{}try{return e+""}catch{}}return""}var a0e=/[\\^$.*+?()[\]{}|]/g,c0e=/^\[object .+?Constructor\]$/,l0e=Function.prototype,u0e=Object.prototype,f0e=l0e.toString,d0e=u0e.hasOwnProperty,h0e=RegExp("^"+f0e.call(d0e).replace(a0e,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function p0e(e){if(!pI(e)||o0e(e))return!1;var t=P$(e)?h0e:c0e;return t.test(Ty(e))}function m0e(e,t){return e==null?void 0:e[t]}function Cy(e,t){var n=m0e(e,t);return p0e(n)?n:void 0}var _0e=Cy(sp,"WeakMap");const xM=_0e;function g0e(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}var y0e=800,A0e=16,T0e=Date.now;function C0e(e){var t=0,n=0;return function(){var i=T0e(),o=A0e-(i-n);if(n=i,o>0){if(++t>=y0e)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function b0e(e){return function(){return e}}var E0e=function(){try{var e=Cy(Object,"defineProperty");return e({},"",{}),e}catch{}}();const mI=E0e;var x0e=mI?function(e,t){return mI(e,"toString",{configurable:!0,enumerable:!1,value:b0e(t),writable:!0})}:Qye;const w0e=x0e;var S0e=C0e(w0e);const v0e=S0e;var D0e=9007199254740991,I0e=/^(?:0|[1-9]\d*)$/;function h3(e,t){var n=typeof e;return t=t??D0e,!!t&&(n=="number"||n!="symbol"&&I0e.test(e))&&e>-1&&e%1==0&&e<t}function P0e(e,t,n){t=="__proto__"&&mI?mI(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function p3(e,t){return e===t||e!==e&&t!==t}var O0e=Object.prototype,L0e=O0e.hasOwnProperty;function B0e(e,t,n){var i=e[t];(!(L0e.call(e,t)&&p3(i,n))||n===void 0&&!(t in e))&&P0e(e,t,n)}var Hk=Math.max;function R0e(e,t,n){return t=Hk(t===void 0?e.length-1:t,0),function(){for(var i=arguments,o=-1,r=Hk(i.length-t,0),s=Array(r);++o<r;)s[o]=i[t+o];o=-1;for(var a=Array(t+1);++o<t;)a[o]=i[o];return a[t]=n(s),g0e(e,this,a)}}var N0e=9007199254740991;function m3(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=N0e}function M0e(e){return e!=null&&m3(e.length)&&!P$(e)}var F0e=Object.prototype;function z0e(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||F0e;return e===n}function U0e(e,t){for(var n=-1,i=Array(e);++n<e;)i[n]=t(n);return i}var H0e="[object Arguments]";function Vk(e){return YA(e)&&gT(e)==H0e}var O$=Object.prototype,V0e=O$.hasOwnProperty,k0e=O$.propertyIsEnumerable,G0e=Vk(function(){return arguments}())?Vk:function(e){return YA(e)&&V0e.call(e,"callee")&&!k0e.call(e,"callee")};const _3=G0e;function W0e(){return!1}var L$=typeof Lh=="object"&&Lh&&!Lh.nodeType&&Lh,kk=L$&&typeof Bh=="object"&&Bh&&!Bh.nodeType&&Bh,q0e=kk&&kk.exports===L$,Gk=q0e?sp.Buffer:void 0,j0e=Gk?Gk.isBuffer:void 0,Y0e=j0e||W0e;const wM=Y0e;var $0e="[object Arguments]",X0e="[object Array]",K0e="[object Boolean]",J0e="[object Date]",Q0e="[object Error]",Z0e="[object Function]",eAe="[object Map]",tAe="[object Number]",nAe="[object Object]",iAe="[object RegExp]",oAe="[object Set]",rAe="[object String]",sAe="[object WeakMap]",aAe="[object ArrayBuffer]",cAe="[object DataView]",lAe="[object Float32Array]",uAe="[object Float64Array]",fAe="[object Int8Array]",dAe="[object Int16Array]",hAe="[object Int32Array]",pAe="[object Uint8Array]",mAe="[object Uint8ClampedArray]",_Ae="[object Uint16Array]",gAe="[object Uint32Array]",Ko={};Ko[lAe]=Ko[uAe]=Ko[fAe]=Ko[dAe]=Ko[hAe]=Ko[pAe]=Ko[mAe]=Ko[_Ae]=Ko[gAe]=!0;Ko[$0e]=Ko[X0e]=Ko[aAe]=Ko[K0e]=Ko[cAe]=Ko[J0e]=Ko[Q0e]=Ko[Z0e]=Ko[eAe]=Ko[tAe]=Ko[nAe]=Ko[iAe]=Ko[oAe]=Ko[rAe]=Ko[sAe]=!1;function yAe(e){return YA(e)&&m3(e.length)&&!!Ko[gT(e)]}function AAe(e){return function(t){return e(t)}}var B$=typeof Lh=="object"&&Lh&&!Lh.nodeType&&Lh,Hb=B$&&typeof Bh=="object"&&Bh&&!Bh.nodeType&&Bh,TAe=Hb&&Hb.exports===B$,SL=TAe&&v$.process,CAe=function(){try{var e=Hb&&Hb.require&&Hb.require("util").types;return e||SL&&SL.binding&&SL.binding("util")}catch{}}();const Wk=CAe;var qk=Wk&&Wk.isTypedArray,bAe=qk?AAe(qk):yAe;const R$=bAe;var EAe=Object.prototype,xAe=EAe.hasOwnProperty;function wAe(e,t){var n=$h(e),i=!n&&_3(e),o=!n&&!i&&wM(e),r=!n&&!i&&!o&&R$(e),s=n||i||o||r,a=s?U0e(e.length,String):[],c=a.length;for(var u in e)(t||xAe.call(e,u))&&!(s&&(u=="length"||o&&(u=="offset"||u=="parent")||r&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||h3(u,c)))&&a.push(u);return a}function SAe(e,t){return function(n){return e(t(n))}}var vAe=SAe(Object.keys,Object);const DAe=vAe;var IAe=Object.prototype,PAe=IAe.hasOwnProperty;function OAe(e){if(!z0e(e))return DAe(e);var t=[];for(var n in Object(e))PAe.call(e,n)&&n!="constructor"&&t.push(n);return t}function LAe(e){return M0e(e)?wAe(e):OAe(e)}var BAe=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,RAe=/^\w*$/;function NAe(e,t){if($h(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||d3(e)?!0:RAe.test(e)||!BAe.test(e)||t!=null&&e in Object(t)}var MAe=Cy(Object,"create");const gE=MAe;function FAe(){this.__data__=gE?gE(null):{},this.size=0}function zAe(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var UAe="__lodash_hash_undefined__",HAe=Object.prototype,VAe=HAe.hasOwnProperty;function kAe(e){var t=this.__data__;if(gE){var n=t[e];return n===UAe?void 0:n}return VAe.call(t,e)?t[e]:void 0}var GAe=Object.prototype,WAe=GAe.hasOwnProperty;function qAe(e){var t=this.__data__;return gE?t[e]!==void 0:WAe.call(t,e)}var jAe="__lodash_hash_undefined__";function YAe(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=gE&&t===void 0?jAe:t,this}function Qg(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}Qg.prototype.clear=FAe;Qg.prototype.delete=zAe;Qg.prototype.get=kAe;Qg.prototype.has=qAe;Qg.prototype.set=YAe;function $Ae(){this.__data__=[],this.size=0}function F1(e,t){for(var n=e.length;n--;)if(p3(e[n][0],t))return n;return-1}var XAe=Array.prototype,KAe=XAe.splice;function JAe(e){var t=this.__data__,n=F1(t,e);if(n<0)return!1;var i=t.length-1;return n==i?t.pop():KAe.call(t,n,1),--this.size,!0}function QAe(e){var t=this.__data__,n=F1(t,e);return n<0?void 0:t[n][1]}function ZAe(e){return F1(this.__data__,e)>-1}function eTe(e,t){var n=this.__data__,i=F1(n,e);return i<0?(++this.size,n.push([e,t])):n[i][1]=t,this}function ap(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}ap.prototype.clear=$Ae;ap.prototype.delete=JAe;ap.prototype.get=QAe;ap.prototype.has=ZAe;ap.prototype.set=eTe;var tTe=Cy(sp,"Map");const yE=tTe;function nTe(){this.size=0,this.__data__={hash:new Qg,map:new(yE||ap),string:new Qg}}function iTe(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function z1(e,t){var n=e.__data__;return iTe(t)?n[typeof t=="string"?"string":"hash"]:n.map}function oTe(e){var t=z1(this,e).delete(e);return this.size-=t?1:0,t}function rTe(e){return z1(this,e).get(e)}function sTe(e){return z1(this,e).has(e)}function aTe(e,t){var n=z1(this,e),i=n.size;return n.set(e,t),this.size+=n.size==i?0:1,this}function cp(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}cp.prototype.clear=nTe;cp.prototype.delete=oTe;cp.prototype.get=rTe;cp.prototype.has=sTe;cp.prototype.set=aTe;var cTe="Expected a function";function g3(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(cTe);var n=function(){var i=arguments,o=t?t.apply(this,i):i[0],r=n.cache;if(r.has(o))return r.get(o);var s=e.apply(this,i);return n.cache=r.set(o,s)||r,s};return n.cache=new(g3.Cache||cp),n}g3.Cache=cp;var lTe=500;function uTe(e){var t=g3(e,function(i){return n.size===lTe&&n.clear(),i}),n=t.cache;return t}var fTe=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,dTe=/\\(\\)?/g,hTe=uTe(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(fTe,function(n,i,o,r){t.push(o?r.replace(dTe,"$1"):i||n)}),t});const pTe=hTe;function mTe(e){return e==null?"":I$(e)}function U1(e,t){return $h(e)?e:NAe(e,t)?[e]:pTe(mTe(e))}var _Te=1/0;function y3(e){if(typeof e=="string"||d3(e))return e;var t=e+"";return t=="0"&&1/e==-_Te?"-0":t}function N$(e,t){t=U1(t,e);for(var n=0,i=t.length;e!=null&&n<i;)e=e[y3(t[n++])];return n&&n==i?e:void 0}function gTe(e,t,n){var i=e==null?void 0:N$(e,t);return i===void 0?n:i}function M$(e,t){for(var n=-1,i=t.length,o=e.length;++n<i;)e[o+n]=t[n];return e}var jk=gd?gd.isConcatSpreadable:void 0;function yTe(e){return $h(e)||_3(e)||!!(jk&&e&&e[jk])}function F$(e,t,n,i,o){var r=-1,s=e.length;for(n||(n=yTe),o||(o=[]);++r<s;){var a=e[r];t>0&&n(a)?t>1?F$(a,t-1,n,i,o):M$(o,a):i||(o[o.length]=a)}return o}function ATe(e){var t=e==null?0:e.length;return t?F$(e,1):[]}function TTe(e){return v0e(R0e(e,void 0,ATe),e+"")}function CTe(){this.__data__=new ap,this.size=0}function bTe(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function ETe(e){return this.__data__.get(e)}function xTe(e){return this.__data__.has(e)}var wTe=200;function STe(e,t){var n=this.__data__;if(n instanceof ap){var i=n.__data__;if(!yE||i.length<wTe-1)return i.push([e,t]),this.size=++n.size,this;n=this.__data__=new cp(i)}return n.set(e,t),this.size=n.size,this}function Rm(e){var t=this.__data__=new ap(e);this.size=t.size}Rm.prototype.clear=CTe;Rm.prototype.delete=bTe;Rm.prototype.get=ETe;Rm.prototype.has=xTe;Rm.prototype.set=STe;function vTe(e,t){for(var n=-1,i=e==null?0:e.length,o=0,r=[];++n<i;){var s=e[n];t(s,n,e)&&(r[o++]=s)}return r}function DTe(){return[]}var ITe=Object.prototype,PTe=ITe.propertyIsEnumerable,Yk=Object.getOwnPropertySymbols,OTe=Yk?function(e){return e==null?[]:(e=Object(e),vTe(Yk(e),function(t){return PTe.call(e,t)}))}:DTe;const LTe=OTe;function BTe(e,t,n){var i=t(e);return $h(e)?i:M$(i,n(e))}function $k(e){return BTe(e,LAe,LTe)}var RTe=Cy(sp,"DataView");const SM=RTe;var NTe=Cy(sp,"Promise");const vM=NTe;var MTe=Cy(sp,"Set");const DM=MTe;var Xk="[object Map]",FTe="[object Object]",Kk="[object Promise]",Jk="[object Set]",Qk="[object WeakMap]",Zk="[object DataView]",zTe=Ty(SM),UTe=Ty(yE),HTe=Ty(vM),VTe=Ty(DM),kTe=Ty(xM),Ag=gT;(SM&&Ag(new SM(new ArrayBuffer(1)))!=Zk||yE&&Ag(new yE)!=Xk||vM&&Ag(vM.resolve())!=Kk||DM&&Ag(new DM)!=Jk||xM&&Ag(new xM)!=Qk)&&(Ag=function(e){var t=gT(e),n=t==FTe?e.constructor:void 0,i=n?Ty(n):"";if(i)switch(i){case zTe:return Zk;case UTe:return Xk;case HTe:return Kk;case VTe:return Jk;case kTe:return Qk}return t});const eG=Ag;var GTe=sp.Uint8Array;const tG=GTe;var WTe="__lodash_hash_undefined__";function qTe(e){return this.__data__.set(e,WTe),this}function jTe(e){return this.__data__.has(e)}function _I(e){var t=-1,n=e==null?0:e.length;for(this.__data__=new cp;++t<n;)this.add(e[t])}_I.prototype.add=_I.prototype.push=qTe;_I.prototype.has=jTe;function YTe(e,t){for(var n=-1,i=e==null?0:e.length;++n<i;)if(t(e[n],n,e))return!0;return!1}function $Te(e,t){return e.has(t)}var XTe=1,KTe=2;function z$(e,t,n,i,o,r){var s=n&XTe,a=e.length,c=t.length;if(a!=c&&!(s&&c>a))return!1;var u=r.get(e),f=r.get(t);if(u&&f)return u==t&&f==e;var h=-1,_=!0,g=n&KTe?new _I:void 0;for(r.set(e,t),r.set(t,e);++h<a;){var p=e[h],y=t[h];if(i)var T=s?i(y,p,h,t,e,r):i(p,y,h,e,t,r);if(T!==void 0){if(T)continue;_=!1;break}if(g){if(!YTe(t,function(b,x){if(!$Te(g,x)&&(p===b||o(p,b,n,i,r)))return g.push(x)})){_=!1;break}}else if(!(p===y||o(p,y,n,i,r))){_=!1;break}}return r.delete(e),r.delete(t),_}function JTe(e){var t=-1,n=Array(e.size);return e.forEach(function(i,o){n[++t]=[o,i]}),n}function QTe(e){var t=-1,n=Array(e.size);return e.forEach(function(i){n[++t]=i}),n}var ZTe=1,eCe=2,tCe="[object Boolean]",nCe="[object Date]",iCe="[object Error]",oCe="[object Map]",rCe="[object Number]",sCe="[object RegExp]",aCe="[object Set]",cCe="[object String]",lCe="[object Symbol]",uCe="[object ArrayBuffer]",fCe="[object DataView]",nG=gd?gd.prototype:void 0,vL=nG?nG.valueOf:void 0;function dCe(e,t,n,i,o,r,s){switch(n){case fCe:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case uCe:return!(e.byteLength!=t.byteLength||!r(new tG(e),new tG(t)));case tCe:case nCe:case rCe:return p3(+e,+t);case iCe:return e.name==t.name&&e.message==t.message;case sCe:case cCe:return e==t+"";case oCe:var a=JTe;case aCe:var c=i&ZTe;if(a||(a=QTe),e.size!=t.size&&!c)return!1;var u=s.get(e);if(u)return u==t;i|=eCe,s.set(e,t);var f=z$(a(e),a(t),i,o,r,s);return s.delete(e),f;case lCe:if(vL)return vL.call(e)==vL.call(t)}return!1}var hCe=1,pCe=Object.prototype,mCe=pCe.hasOwnProperty;function _Ce(e,t,n,i,o,r){var s=n&hCe,a=$k(e),c=a.length,u=$k(t),f=u.length;if(c!=f&&!s)return!1;for(var h=c;h--;){var _=a[h];if(!(s?_ in t:mCe.call(t,_)))return!1}var g=r.get(e),p=r.get(t);if(g&&p)return g==t&&p==e;var y=!0;r.set(e,t),r.set(t,e);for(var T=s;++h<c;){_=a[h];var b=e[_],x=t[_];if(i)var v=s?i(x,b,_,t,e,r):i(b,x,_,e,t,r);if(!(v===void 0?b===x||o(b,x,n,i,r):v)){y=!1;break}T||(T=_=="constructor")}if(y&&!T){var D=e.constructor,L=t.constructor;D!=L&&"constructor"in e&&"constructor"in t&&!(typeof D=="function"&&D instanceof D&&typeof L=="function"&&L instanceof L)&&(y=!1)}return r.delete(e),r.delete(t),y}var gCe=1,iG="[object Arguments]",oG="[object Array]",nS="[object Object]",yCe=Object.prototype,rG=yCe.hasOwnProperty;function ACe(e,t,n,i,o,r){var s=$h(e),a=$h(t),c=s?oG:eG(e),u=a?oG:eG(t);c=c==iG?nS:c,u=u==iG?nS:u;var f=c==nS,h=u==nS,_=c==u;if(_&&wM(e)){if(!wM(t))return!1;s=!0,f=!1}if(_&&!f)return r||(r=new Rm),s||R$(e)?z$(e,t,n,i,o,r):dCe(e,t,c,n,i,o,r);if(!(n&gCe)){var g=f&&rG.call(e,"__wrapped__"),p=h&&rG.call(t,"__wrapped__");if(g||p){var y=g?e.value():e,T=p?t.value():t;return r||(r=new Rm),o(y,T,n,i,r)}}return _?(r||(r=new Rm),_Ce(e,t,n,i,o,r)):!1}function U$(e,t,n,i,o){return e===t?!0:e==null||t==null||!YA(e)&&!YA(t)?e!==e&&t!==t:ACe(e,t,n,i,U$,o)}function TCe(e,t){return e!=null&&t in Object(e)}function CCe(e,t,n){t=U1(t,e);for(var i=-1,o=t.length,r=!1;++i<o;){var s=y3(t[i]);if(!(r=e!=null&&n(e,s)))break;e=e[s]}return r||++i!=o?r:(o=e==null?0:e.length,!!o&&m3(o)&&h3(s,o)&&($h(e)||_3(e)))}function bCe(e,t){return e!=null&&CCe(e,t,TCe)}function ECe(e){for(var t=-1,n=e==null?0:e.length,i={};++t<n;){var o=e[t];i[o[0]]=o[1]}return i}function xCe(e,t){return U$(e,t)}function wCe(e){return e==null}function SCe(e,t,n,i){if(!pI(e))return e;t=U1(t,e);for(var o=-1,r=t.length,s=r-1,a=e;a!=null&&++o<r;){var c=y3(t[o]),u=n;if(c==="__proto__"||c==="constructor"||c==="prototype")return e;if(o!=s){var f=a[c];u=i?i(f,c,a):void 0,u===void 0&&(u=pI(f)?f:h3(t[o+1])?[]:{})}B0e(a,c,u),a=a[c]}return e}function vCe(e,t,n){for(var i=-1,o=t.length,r={};++i<o;){var s=t[i],a=N$(e,s);n(a,s)&&SCe(r,U1(s,e),a)}return r}function DCe(e,t){return vCe(e,t,function(n,i){return bCe(e,i)})}var ICe=TTe(function(e,t){return e==null?{}:DCe(e,t)});const PCe=ICe;var sG;const pf=typeof window<"u",gI=e=>typeof e=="boolean",$A=e=>typeof e=="number",OCe=e=>typeof e=="string",LCe=()=>{};pf&&((sG=window==null?void 0:window.navigator)!=null&&sG.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent);function H$(e){return typeof e=="function"?e():xt(e)}function BCe(e){return e}function A3(e){return mme()?(pY(e),!0):!1}function RCe(e,t=!0){Id()?Dd(e):t?e():$m(e)}function IM(e,t,n={}){const{immediate:i=!0}=n,o=xo(!1);let r=null;function s(){r&&(clearTimeout(r),r=null)}function a(){o.value=!1,s()}function c(...u){s(),o.value=!0,r=setTimeout(()=>{o.value=!1,r=null,e(...u)},H$(t))}return i&&(o.value=!0,pf&&c()),A3(a),{isPending:o,start:c,stop:a}}function V$(e){var t;const n=H$(e);return(t=n==null?void 0:n.$el)!=null?t:n}const k$=pf?window:void 0;function NCe(...e){let t,n,i,o;if(OCe(e[0])||Array.isArray(e[0])?([n,i,o]=e,t=k$):[t,n,i,o]=e,!t)return LCe;Array.isArray(n)||(n=[n]),Array.isArray(i)||(i=[i]);const r=[],s=()=>{r.forEach(f=>f()),r.length=0},a=(f,h,_)=>(f.addEventListener(h,_,o),()=>f.removeEventListener(h,_,o)),c=ws(()=>V$(t),f=>{s(),f&&r.push(...n.flatMap(h=>i.map(_=>a(f,h,_))))},{immediate:!0,flush:"post"}),u=()=>{c(),s()};return A3(u),u}function MCe(e,t=!1){const n=xo(),i=()=>n.value=Boolean(e());return i(),RCe(i,t),n}const PM=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},OM="__vueuse_ssr_handlers__";PM[OM]=PM[OM]||{};PM[OM];var aG=Object.getOwnPropertySymbols,FCe=Object.prototype.hasOwnProperty,zCe=Object.prototype.propertyIsEnumerable,UCe=(e,t)=>{var n={};for(var i in e)FCe.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(e!=null&&aG)for(var i of aG(e))t.indexOf(i)<0&&zCe.call(e,i)&&(n[i]=e[i]);return n};function HCe(e,t,n={}){const i=n,{window:o=k$}=i,r=UCe(i,["window"]);let s;const a=MCe(()=>o&&"ResizeObserver"in o),c=()=>{s&&(s.disconnect(),s=void 0)},u=ws(()=>V$(e),h=>{c(),a.value&&o&&h&&(s=new ResizeObserver(t),s.observe(h,r))},{immediate:!0,flush:"post"}),f=()=>{c(),u()};return A3(f),{isSupported:a,stop:f}}var cG;(function(e){e.UP="UP",e.RIGHT="RIGHT",e.DOWN="DOWN",e.LEFT="LEFT",e.NONE="NONE"})(cG||(cG={}));var VCe=Object.defineProperty,lG=Object.getOwnPropertySymbols,kCe=Object.prototype.hasOwnProperty,GCe=Object.prototype.propertyIsEnumerable,uG=(e,t,n)=>t in e?VCe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,WCe=(e,t)=>{for(var n in t||(t={}))kCe.call(t,n)&&uG(e,n,t[n]);if(lG)for(var n of lG(t))GCe.call(t,n)&&uG(e,n,t[n]);return e};const qCe={easeInSine:[.12,0,.39,0],easeOutSine:[.61,1,.88,1],easeInOutSine:[.37,0,.63,1],easeInQuad:[.11,0,.5,0],easeOutQuad:[.5,1,.89,1],easeInOutQuad:[.45,0,.55,1],easeInCubic:[.32,0,.67,0],easeOutCubic:[.33,1,.68,1],easeInOutCubic:[.65,0,.35,1],easeInQuart:[.5,0,.75,0],easeOutQuart:[.25,1,.5,1],easeInOutQuart:[.76,0,.24,1],easeInQuint:[.64,0,.78,0],easeOutQuint:[.22,1,.36,1],easeInOutQuint:[.83,0,.17,1],easeInExpo:[.7,0,.84,0],easeOutExpo:[.16,1,.3,1],easeInOutExpo:[.87,0,.13,1],easeInCirc:[.55,0,1,.45],easeOutCirc:[0,.55,.45,1],easeInOutCirc:[.85,0,.15,1],easeInBack:[.36,0,.66,-.56],easeOutBack:[.34,1.56,.64,1],easeInOutBack:[.68,-.6,.32,1.6]};WCe({linear:BCe},qCe);const yI=e=>e===void 0,jCe=e=>typeof Element>"u"?!1:e instanceof Element,YCe=e=>Do(e)?!Number.isNaN(Number(e)):!1,fG=e=>Object.keys(e);class $Ce extends Error{constructor(t){super(t),this.name="ElementPlusError"}}function XCe(e,t){throw new $Ce(`[${e}] ${t}`)}const G$=(e="")=>e.split(" ").filter(t=>!!t.trim()),dG=(e,t)=>{if(!e||!t)return!1;if(t.includes(" "))throw new Error("className should not contain space.");return e.classList.contains(t)},KCe=(e,t)=>{!e||!t.trim()||e.classList.add(...G$(t))},JCe=(e,t)=>{!e||!t.trim()||e.classList.remove(...G$(t))},QCe=(e,t)=>{var n;if(!pf||!e||!t)return"";let i=df(t);i==="float"&&(i="cssFloat");try{const o=e.style[i];if(o)return o;const r=(n=document.defaultView)==null?void 0:n.getComputedStyle(e,"");return r?r[i]:""}catch{return e.style[i]}};function T3(e,t="px"){if(!e)return"";if($A(e)||YCe(e))return`${e}${t}`;if(Do(e))return e}let iS;const ZCe=e=>{var t;if(!pf)return 0;if(iS!==void 0)return iS;const n=document.createElement("div");n.className=`${e}-scrollbar__wrap`,n.style.visibility="hidden",n.style.width="100px",n.style.position="absolute",n.style.top="-9999px",document.body.appendChild(n);const i=n.offsetWidth;n.style.overflow="scroll";const o=document.createElement("div");o.style.width="100%",n.appendChild(o);const r=o.offsetWidth;return(t=n.parentNode)==null||t.removeChild(n),iS=i-r,iS};/*! Element Plus Icons Vue v2.0.10 */var ux=(e,t)=>{let n=e.__vccOpts||e;for(let[i,o]of t)n[i]=o;return n},ebe={name:"CircleCloseFilled"},tbe={viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg"},nbe=Xs("path",{fill:"currentColor",d:"M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896zm0 393.664L407.936 353.6a38.4 38.4 0 1 0-54.336 54.336L457.664 512 353.6 616.064a38.4 38.4 0 1 0 54.336 54.336L512 566.336 616.064 670.4a38.4 38.4 0 1 0 54.336-54.336L566.336 512 670.4 407.936a38.4 38.4 0 1 0-54.336-54.336L512 457.664z"},null,-1),ibe=[nbe];function obe(e,t,n,i,o,r){return _i(),tr("svg",tbe,ibe)}var W$=ux(ebe,[["render",obe],["__file","circle-close-filled.vue"]]),rbe={name:"Close"},sbe={viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg"},abe=Xs("path",{fill:"currentColor",d:"M764.288 214.592 512 466.88 259.712 214.592a31.936 31.936 0 0 0-45.12 45.12L466.752 512 214.528 764.224a31.936 31.936 0 1 0 45.12 45.184L512 557.184l252.288 252.288a31.936 31.936 0 0 0 45.12-45.12L557.12 512.064l252.288-252.352a31.936 31.936 0 1 0-45.12-45.184z"},null,-1),cbe=[abe];function lbe(e,t,n,i,o,r){return _i(),tr("svg",sbe,cbe)}var q$=ux(rbe,[["render",lbe],["__file","close.vue"]]),ube={name:"InfoFilled"},fbe={viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg"},dbe=Xs("path",{fill:"currentColor",d:"M512 64a448 448 0 1 1 0 896.064A448 448 0 0 1 512 64zm67.2 275.072c33.28 0 60.288-23.104 60.288-57.344s-27.072-57.344-60.288-57.344c-33.28 0-60.16 23.104-60.16 57.344s26.88 57.344 60.16 57.344zM590.912 699.2c0-6.848 2.368-24.64 1.024-34.752l-52.608 60.544c-10.88 11.456-24.512 19.392-30.912 17.28a12.992 12.992 0 0 1-8.256-14.72l87.68-276.992c7.168-35.136-12.544-67.2-54.336-71.296-44.096 0-108.992 44.736-148.48 101.504 0 6.784-1.28 23.68.064 33.792l52.544-60.608c10.88-11.328 23.552-19.328 29.952-17.152a12.8 12.8 0 0 1 7.808 16.128L388.48 728.576c-10.048 32.256 8.96 63.872 55.04 71.04 67.84 0 107.904-43.648 147.456-100.416z"},null,-1),hbe=[dbe];function pbe(e,t,n,i,o,r){return _i(),tr("svg",fbe,hbe)}var j$=ux(ube,[["render",pbe],["__file","info-filled.vue"]]),mbe={name:"SuccessFilled"},_be={viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg"},gbe=Xs("path",{fill:"currentColor",d:"M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896zm-55.808 536.384-99.52-99.584a38.4 38.4 0 1 0-54.336 54.336l126.72 126.72a38.272 38.272 0 0 0 54.336 0l262.4-262.464a38.4 38.4 0 1 0-54.272-54.336L456.192 600.384z"},null,-1),ybe=[gbe];function Abe(e,t,n,i,o,r){return _i(),tr("svg",_be,ybe)}var Y$=ux(mbe,[["render",Abe],["__file","success-filled.vue"]]),Tbe={name:"WarningFilled"},Cbe={viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg"},bbe=Xs("path",{fill:"currentColor",d:"M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896zm0 192a58.432 58.432 0 0 0-58.24 63.744l23.36 256.384a35.072 35.072 0 0 0 69.76 0l23.296-256.384A58.432 58.432 0 0 0 512 256zm0 512a51.2 51.2 0 1 0 0-102.4 51.2 51.2 0 0 0 0 102.4z"},null,-1),Ebe=[bbe];function xbe(e,t,n,i,o,r){return _i(),tr("svg",Cbe,Ebe)}var $$=ux(Tbe,[["render",xbe],["__file","warning-filled.vue"]]);const X$="__epPropKey",nu=e=>e,wbe=e=>Ao(e)&&!!e[X$],K$=(e,t)=>{if(!Ao(e)||wbe(e))return e;const{values:n,required:i,default:o,type:r,validator:s}=e,c={type:r,required:!!i,validator:n||s?u=>{let f=!1,h=[];if(n&&(h=Array.from(n),Bi(e,"default")&&h.push(o),f||(f=h.includes(u))),s&&(f||(f=s(u))),!f&&h.length>0){const _=[...new Set(h)].map(g=>JSON.stringify(g)).join(", ");Yme(`Invalid prop: validation failed${t?` for prop "${t}"`:""}. Expected one of [${_}], got value ${JSON.stringify(u)}.`)}return f}:void 0,[X$]:!0};return Bi(e,"default")&&(c.default=o),c},Pd=e=>ECe(Object.entries(e).map(([t,n])=>[t,K$(n,t)])),J$=nu([String,Object,Function]),Sbe={Close:q$,SuccessFilled:Y$,InfoFilled:j$,WarningFilled:$$,CircleCloseFilled:W$},hG={success:Y$,warning:$$,error:W$,info:j$},fx=(e,t)=>{if(e.install=n=>{for(const i of[e,...Object.values(t??{})])n.component(i.name,i)},t)for(const[n,i]of Object.entries(t))e[n]=i;return e},vbe=(e,t)=>(e.install=n=>{e._context=n._context,n.config.globalProperties[t]=e},e),Q$=e=>(e.install=mc,e),C3={tab:"Tab",enter:"Enter",space:"Space",left:"ArrowLeft",up:"ArrowUp",right:"ArrowRight",down:"ArrowDown",esc:"Escape",delete:"Delete",backspace:"Backspace",numpadEnter:"NumpadEnter",pageUp:"PageUp",pageDown:"PageDown",home:"Home",end:"End"},yT="update:modelValue",Dbe=["","default","small","large"];var mD=(e=>(e[e.TEXT=1]="TEXT",e[e.CLASS=2]="CLASS",e[e.STYLE=4]="STYLE",e[e.PROPS=8]="PROPS",e[e.FULL_PROPS=16]="FULL_PROPS",e[e.HYDRATE_EVENTS=32]="HYDRATE_EVENTS",e[e.STABLE_FRAGMENT=64]="STABLE_FRAGMENT",e[e.KEYED_FRAGMENT=128]="KEYED_FRAGMENT",e[e.UNKEYED_FRAGMENT=256]="UNKEYED_FRAGMENT",e[e.NEED_PATCH=512]="NEED_PATCH",e[e.DYNAMIC_SLOTS=1024]="DYNAMIC_SLOTS",e[e.HOISTED=-1]="HOISTED",e[e.BAIL=-2]="BAIL",e))(mD||{});const Ibe=e=>e,AT=Symbol("checkboxGroupContextKey"),Z$=Symbol(),b3=Symbol("formContextKey"),eX=Symbol("formItemContextKey"),Pbe=Symbol("rowContextKey"),tX=e=>{const t=Id();return yn(()=>{var n,i;return(i=((n=t.proxy)==null?void 0:n.$props)[e])!=null?i:void 0})},AI=xo();function by(e,t=void 0){const n=Id()?Qr(Z$,AI):AI;return e?yn(()=>{var i,o;return(o=(i=n.value)==null?void 0:i[e])!=null?o:t}):n}const Obe=(e,t,n=!1)=>{var i;const o=!!Id(),r=o?by():void 0,s=(i=t==null?void 0:t.provide)!=null?i:o?Bm:void 0;if(!s)return;const a=yn(()=>{const c=xt(e);return r!=null&&r.value?Lbe(r.value,c):c});return s(Z$,a),(n||!AI.value)&&(AI.value=a.value),a},Lbe=(e,t)=>{var n;const i=[...new Set([...fG(e),...fG(t)])],o={};for(const r of i)o[r]=(n=t[r])!=null?n:e[r];return o},E3=K$({type:String,values:Dbe,required:!1}),pG=(e,t={})=>{const n=xo(void 0),i=t.prop?n:tX("size"),o=t.global?n:by("size"),r=t.form?{size:void 0}:Qr(b3,void 0),s=t.formItem?{size:void 0}:Qr(eX,void 0);return yn(()=>i.value||xt(e)||(s==null?void 0:s.size)||(r==null?void 0:r.size)||o.value||"")},Bbe=e=>{const t=tX("disabled"),n=Qr(b3,void 0);return yn(()=>t.value||xt(e)||(n==null?void 0:n.disabled)||!1)},mG=({from:e,replacement:t,scope:n,version:i,ref:o,type:r="API"},s)=>{ws(()=>xt(s),a=>{},{immediate:!0})},x3="el",Rbe="is-",j_=(e,t,n,i,o)=>{let r=`${e}-${t}`;return n&&(r+=`-${n}`),i&&(r+=`__${i}`),o&&(r+=`--${o}`),r},Od=e=>{const t=by("namespace",x3);return{namespace:t,b:(p="")=>j_(t.value,e,p,"",""),e:p=>p?j_(t.value,e,"",p,""):"",m:p=>p?j_(t.value,e,"","",p):"",be:(p,y)=>p&&y?j_(t.value,e,p,y,""):"",em:(p,y)=>p&&y?j_(t.value,e,"",p,y):"",bm:(p,y)=>p&&y?j_(t.value,e,p,"",y):"",bem:(p,y,T)=>p&&y&&T?j_(t.value,e,p,y,T):"",is:(p,...y)=>{const T=y.length>=1?y[0]:!0;return p&&T?`${Rbe}${p}`:""},cssVar:p=>{const y={};for(const T in p)p[T]&&(y[`--${t.value}-${T}`]=p[T]);return y},cssVarName:p=>`--${t.value}-${p}`,cssVarBlock:p=>{const y={};for(const T in p)p[T]&&(y[`--${t.value}-${e}-${T}`]=p[T]);return y},cssVarBlockName:p=>`--${t.value}-${e}-${p}`}},_G={prefix:Math.floor(Math.random()*1e4),current:0},Nbe=Symbol("elIdInjection"),Mbe=()=>Id()?Qr(Nbe,_G):_G,LM=e=>{const t=Mbe(),n=by("namespace",x3);return yn(()=>xt(e)||`${n.value}-id-${t.prefix}-${t.current++}`)},w3=()=>{const e=Qr(b3,void 0),t=Qr(eX,void 0);return{form:e,formItem:t}},nX=(e,{formItemContext:t,disableIdGeneration:n,disableIdManagement:i})=>{n||(n=xo(!1)),i||(i=xo(!1));const o=xo();let r;const s=yn(()=>{var a;return!!(!e.label&&t&&t.inputIds&&((a=t.inputIds)==null?void 0:a.length)<=1)});return Dd(()=>{r=ws([LY(e,"id"),n],([a,c])=>{const u=a??(c?void 0:LM().value);u!==o.value&&(t!=null&&t.removeInputId&&(o.value&&t.removeInputId(o.value),!(i!=null&&i.value)&&!c&&u&&t.addInputId(u)),o.value=u)},{immediate:!0})}),n3(()=>{r&&r(),t!=null&&t.removeInputId&&o.value&&t.removeInputId(o.value)}),{isLabeledByFormItem:s,inputId:o}};var Fbe={name:"en",el:{colorpicker:{confirm:"OK",clear:"Clear",defaultLabel:"color picker",description:"current color is {color}. press enter to select a new color."},datepicker:{now:"Now",today:"Today",cancel:"Cancel",clear:"Clear",confirm:"OK",dateTablePrompt:"Use the arrow keys and enter to select the day of the month",monthTablePrompt:"Use the arrow keys and enter to select the month",yearTablePrompt:"Use the arrow keys and enter to select the year",selectedDate:"Selected date",selectDate:"Select date",selectTime:"Select time",startDate:"Start Date",startTime:"Start Time",endDate:"End Date",endTime:"End Time",prevYear:"Previous Year",nextYear:"Next Year",prevMonth:"Previous Month",nextMonth:"Next Month",year:"",month1:"January",month2:"February",month3:"March",month4:"April",month5:"May",month6:"June",month7:"July",month8:"August",month9:"September",month10:"October",month11:"November",month12:"December",week:"week",weeks:{sun:"Sun",mon:"Mon",tue:"Tue",wed:"Wed",thu:"Thu",fri:"Fri",sat:"Sat"},weeksFull:{sun:"Sunday",mon:"Monday",tue:"Tuesday",wed:"Wednesday",thu:"Thursday",fri:"Friday",sat:"Saturday"},months:{jan:"Jan",feb:"Feb",mar:"Mar",apr:"Apr",may:"May",jun:"Jun",jul:"Jul",aug:"Aug",sep:"Sep",oct:"Oct",nov:"Nov",dec:"Dec"}},inputNumber:{decrease:"decrease number",increase:"increase number"},select:{loading:"Loading",noMatch:"No matching data",noData:"No data",placeholder:"Select"},dropdown:{toggleDropdown:"Toggle Dropdown"},cascader:{noMatch:"No matching data",loading:"Loading",placeholder:"Select",noData:"No data"},pagination:{goto:"Go to",pagesize:"/page",total:"Total {total}",pageClassifier:"",deprecationWarning:"Deprecated usages detected, please refer to the el-pagination documentation for more details"},dialog:{close:"Close this dialog"},drawer:{close:"Close this dialog"},messagebox:{title:"Message",confirm:"OK",cancel:"Cancel",error:"Illegal input",close:"Close this dialog"},upload:{deleteTip:"press delete to remove",delete:"Delete",preview:"Preview",continue:"Continue"},slider:{defaultLabel:"slider between {min} and {max}",defaultRangeStartLabel:"pick start value",defaultRangeEndLabel:"pick end value"},table:{emptyText:"No Data",confirmFilter:"Confirm",resetFilter:"Reset",clearFilter:"All",sumText:"Sum"},tree:{emptyText:"No Data"},transfer:{noMatch:"No matching data",noData:"No data",titles:["List 1","List 2"],filterPlaceholder:"Enter keyword",noCheckedFormat:"{total} items",hasCheckedFormat:"{checked}/{total} checked"},image:{error:"FAILED"},pageHeader:{title:"Back"},popconfirm:{confirmButtonText:"Yes",cancelButtonText:"No"}}};const zbe=e=>(t,n)=>Ube(t,n,xt(e)),Ube=(e,t,n)=>gTe(n,e,e).replace(/\{(\w+)\}/g,(i,o)=>{var r;return`${(r=t==null?void 0:t[o])!=null?r:`{${o}}`}`}),Hbe=e=>{const t=yn(()=>xt(e).name),n=Ir(e)?e:xo(e);return{lang:t,locale:n,t:zbe(e)}},Vbe=()=>{const e=by("locale");return Hbe(yn(()=>e.value||Fbe))},kbe=e=>{Ir(e)||XCe("[useLockscreen]","You need to pass a ref param to this function");const t=Od("popup"),n=RY(()=>t.bm("parent","hidden"));if(!pf||dG(document.body,n.value))return;let i=0,o=!1,r="0";const s=()=>{setTimeout(()=>{JCe(document.body,n.value),o&&(document.body.style.width=r)},200)};ws(e,a=>{if(!a){s();return}o=!dG(document.body,n.value),o&&(r=document.body.style.width),i=ZCe(t.namespace.value);const c=document.documentElement.clientHeight<document.body.scrollHeight,u=QCe(document.body,"overflowY");i>0&&(c||u==="scroll")&&o&&(document.body.style.width=`calc(100% - ${i}px)`),KCe(document.body,n.value)}),pY(()=>s())},Gbe=e=>{if(!e)return{onClick:mc,onMousedown:mc,onMouseup:mc};let t=!1,n=!1;return{onClick:s=>{t&&n&&e(s),t=n=!1},onMousedown:s=>{t=s.target===s.currentTarget},onMouseup:s=>{n=s.target===s.currentTarget}}};let X0=[];const gG=e=>{const t=e;t.key===C3.esc&&X0.forEach(n=>n(t))},Wbe=e=>{Dd(()=>{X0.length===0&&document.addEventListener("keydown",gG),pf&&X0.push(e)}),cx(()=>{X0=X0.filter(t=>t!==e),X0.length===0&&pf&&document.removeEventListener("keydown",gG)})},yG=xo(0),iX=()=>{const e=by("zIndex",2e3),t=yn(()=>e.value+yG.value);return{initialZIndex:e,currentZIndex:t,nextZIndex:()=>(yG.value++,t.value)}};var lp=(e,t)=>{const n=e.__vccOpts||e;for(const[i,o]of t)n[i]=o;return n};const qbe=Pd({size:{type:nu([Number,String])},color:{type:String}}),jbe=ms({name:"ElIcon",inheritAttrs:!1}),Ybe=ms({...jbe,props:qbe,setup(e){const t=e,n=Od("icon"),i=yn(()=>{const{size:o,color:r}=t;return!o&&!r?{}:{fontSize:yI(o)?void 0:T3(o),"--color":r}});return(o,r)=>(_i(),tr("i",c3({class:xt(n).b(),style:xt(i)},o.$attrs),[pc(o.$slots,"default")],16))}});var $be=lp(Ybe,[["__file","/home/runner/work/element-plus/element-plus/packages/components/icon/src/icon.vue"]]);const BM=fx($be),DL="focus-trap.focus-after-trapped",IL="focus-trap.focus-after-released",Xbe="focus-trap.focusout-prevented",AG={cancelable:!0,bubbles:!1},Kbe={cancelable:!0,bubbles:!1},TG="focusAfterTrapped",CG="focusAfterReleased",Jbe=Symbol("elFocusTrap"),S3=xo(),H1=xo(0),v3=xo(0);let oS=0;const oX=e=>{const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:i=>{const o=i.tagName==="INPUT"&&i.type==="hidden";return i.disabled||i.hidden||o?NodeFilter.FILTER_SKIP:i.tabIndex>=0||i===document.activeElement?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t},bG=(e,t)=>{for(const n of e)if(!Qbe(n,t))return n},Qbe=(e,t)=>{if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1},Zbe=e=>{const t=oX(e),n=bG(t,e),i=bG(t.reverse(),e);return[n,i]},eEe=e=>e instanceof HTMLInputElement&&"select"in e,um=(e,t)=>{if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),v3.value=window.performance.now(),e!==n&&eEe(e)&&t&&e.select()}};function EG(e,t){const n=[...e],i=e.indexOf(t);return i!==-1&&n.splice(i,1),n}const tEe=()=>{let e=[];return{push:i=>{const o=e[0];o&&i!==o&&o.pause(),e=EG(e,i),e.unshift(i)},remove:i=>{var o,r;e=EG(e,i),(r=(o=e[0])==null?void 0:o.resume)==null||r.call(o)}}},nEe=(e,t=!1)=>{const n=document.activeElement;for(const i of e)if(um(i,t),document.activeElement!==n)return},xG=tEe(),iEe=()=>H1.value>v3.value,rS=()=>{S3.value="pointer",H1.value=window.performance.now()},wG=()=>{S3.value="keyboard",H1.value=window.performance.now()},oEe=()=>(Dd(()=>{oS===0&&(document.addEventListener("mousedown",rS),document.addEventListener("touchstart",rS),document.addEventListener("keydown",wG)),oS++}),cx(()=>{oS--,oS<=0&&(document.removeEventListener("mousedown",rS),document.removeEventListener("touchstart",rS),document.removeEventListener("keydown",wG))}),{focusReason:S3,lastUserFocusTimestamp:H1,lastAutomatedFocusTimestamp:v3}),sS=e=>new CustomEvent(Xbe,{...Kbe,detail:e}),rEe=ms({name:"ElFocusTrap",inheritAttrs:!1,props:{loop:Boolean,trapped:Boolean,focusTrapEl:Object,focusStartEl:{type:[Object,String],default:"first"}},emits:[TG,CG,"focusin","focusout","focusout-prevented","release-requested"],setup(e,{emit:t}){const n=xo();let i,o;const{focusReason:r}=oEe();Wbe(p=>{e.trapped&&!s.paused&&t("release-requested",p)});const s={paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}},a=p=>{if(!e.loop&&!e.trapped||s.paused)return;const{key:y,altKey:T,ctrlKey:b,metaKey:x,currentTarget:v,shiftKey:D}=p,{loop:L}=e,B=y===C3.tab&&!T&&!b&&!x,V=document.activeElement;if(B&&V){const M=v,[H,G]=Zbe(M);if(H&&G){if(!D&&V===G){const O=sS({focusReason:r.value});t("focusout-prevented",O),O.defaultPrevented||(p.preventDefault(),L&&um(H,!0))}else if(D&&[H,M].includes(V)){const O=sS({focusReason:r.value});t("focusout-prevented",O),O.defaultPrevented||(p.preventDefault(),L&&um(G,!0))}}else if(V===M){const O=sS({focusReason:r.value});t("focusout-prevented",O),O.defaultPrevented||p.preventDefault()}}};Bm(Jbe,{focusTrapRef:n,onKeydown:a}),ws(()=>e.focusTrapEl,p=>{p&&(n.value=p)},{immediate:!0}),ws([n],([p],[y])=>{p&&(p.addEventListener("keydown",a),p.addEventListener("focusin",f),p.addEventListener("focusout",h)),y&&(y.removeEventListener("keydown",a),y.removeEventListener("focusin",f),y.removeEventListener("focusout",h))});const c=p=>{t(TG,p)},u=p=>t(CG,p),f=p=>{const y=xt(n);if(!y)return;const T=p.target,b=p.relatedTarget,x=T&&y.contains(T);e.trapped||b&&y.contains(b)||(i=b),x&&t("focusin",p),!s.paused&&e.trapped&&(x?o=T:um(o,!0))},h=p=>{const y=xt(n);if(!(s.paused||!y))if(e.trapped){const T=p.relatedTarget;!wCe(T)&&!y.contains(T)&&setTimeout(()=>{if(!s.paused&&e.trapped){const b=sS({focusReason:r.value});t("focusout-prevented",b),b.defaultPrevented||um(o,!0)}},0)}else{const T=p.target;T&&y.contains(T)||t("focusout",p)}};async function _(){await $m();const p=xt(n);if(p){xG.push(s);const y=p.contains(document.activeElement)?i:document.activeElement;if(i=y,!p.contains(y)){const b=new Event(DL,AG);p.addEventListener(DL,c),p.dispatchEvent(b),b.defaultPrevented||$m(()=>{let x=e.focusStartEl;Do(x)||(um(x),document.activeElement!==x&&(x="first")),x==="first"&&nEe(oX(p),!0),(document.activeElement===y||x==="container")&&um(p)})}}}function g(){const p=xt(n);if(p){p.removeEventListener(DL,c);const y=new CustomEvent(IL,{...AG,detail:{focusReason:r.value}});p.addEventListener(IL,u),p.dispatchEvent(y),!y.defaultPrevented&&(r.value=="keyboard"||!iEe())&&um(i??document.body),p.removeEventListener(IL,c),xG.remove(s)}}return Dd(()=>{e.trapped&&_(),ws(()=>e.trapped,p=>{p?_():g()})}),cx(()=>{e.trapped&&g()}),{onKeydown:a}}});function sEe(e,t,n,i,o,r){return pc(e.$slots,"default",{handleKeydown:e.onKeydown})}var aEe=lp(rEe,[["render",sEe],["__file","/home/runner/work/element-plus/element-plus/packages/components/focus-trap/src/focus-trap.vue"]]);const cEe=Pd({value:{type:[String,Number],default:""},max:{type:Number,default:99},isDot:Boolean,hidden:Boolean,type:{type:String,values:["primary","success","warning","info","danger"],default:"danger"}}),lEe=["textContent"],uEe=ms({name:"ElBadge"}),fEe=ms({...uEe,props:cEe,setup(e,{expose:t}){const n=e,i=Od("badge"),o=yn(()=>n.isDot?"":$A(n.value)&&$A(n.max)?n.max<n.value?`${n.max}+`:`${n.value}`:`${n.value}`);return t({content:o}),(r,s)=>(_i(),tr("div",{class:go(xt(i).b())},[pc(r.$slots,"default"),nr(lx,{name:`${xt(i).namespace.value}-zoom-in-center`,persisted:""},{default:za(()=>[Jg(Xs("sup",{class:go([xt(i).e("content"),xt(i).em("content",r.type),xt(i).is("fixed",!!r.$slots.default),xt(i).is("dot",r.isDot)]),textContent:Kg(xt(o))},null,10,lEe),[[l3,!r.hidden&&(xt(o)||r.isDot)]])]),_:1},8,["name"])],2))}});var dEe=lp(fEe,[["__file","/home/runner/work/element-plus/element-plus/packages/components/badge/src/badge.vue"]]);const hEe=fx(dEe);var Ku=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};const rX={modelValue:{type:[Number,String,Boolean],default:void 0},label:{type:[String,Boolean,Number,Object]},indeterminate:Boolean,disabled:Boolean,checked:Boolean,name:{type:String,default:void 0},trueLabel:{type:[String,Number],default:void 0},falseLabel:{type:[String,Number],default:void 0},id:{type:String,default:void 0},controls:{type:String,default:void 0},border:Boolean,size:E3,tabindex:[String,Number],validateEvent:{type:Boolean,default:!0}},sX={[yT]:e=>Do(e)||$A(e)||gI(e),change:e=>Do(e)||$A(e)||gI(e)},pEe=({model:e,isChecked:t})=>{const n=Qr(AT,void 0),i=yn(()=>{var r,s;const a=(r=n==null?void 0:n.max)==null?void 0:r.value,c=(s=n==null?void 0:n.min)==null?void 0:s.value;return!yI(a)&&e.value.length>=a&&!t.value||!yI(c)&&e.value.length<=c&&t.value});return{isDisabled:Bbe(yn(()=>(n==null?void 0:n.disabled.value)||i.value)),isLimitDisabled:i}},mEe=(e,{model:t,isLimitExceeded:n,hasOwnLabel:i,isDisabled:o,isLabeledByFormItem:r})=>{const s=Qr(AT,void 0),{formItem:a}=w3(),{emit:c}=Id();function u(p){var y,T;return p===e.trueLabel||p===!0?(y=e.trueLabel)!=null?y:!0:(T=e.falseLabel)!=null?T:!1}function f(p,y){c("change",u(p),y)}function h(p){if(n.value)return;const y=p.target;c("change",u(y.checked),p)}async function _(p){n.value||!i.value&&!o.value&&r.value&&(p.composedPath().some(b=>b.tagName==="LABEL")||(t.value=u([!1,e.falseLabel].includes(t.value)),await $m(),f(t.value,p)))}const g=yn(()=>(s==null?void 0:s.validateEvent)||e.validateEvent);return ws(()=>e.modelValue,()=>{g.value&&(a==null||a.validate("change").catch(p=>void 0))}),{handleChange:h,onClickRoot:_}},_Ee=e=>{const t=xo(!1),{emit:n}=Id(),i=Qr(AT,void 0),o=yn(()=>yI(i)===!1),r=xo(!1);return{model:yn({get(){var a,c;return o.value?(a=i==null?void 0:i.modelValue)==null?void 0:a.value:(c=e.modelValue)!=null?c:t.value},set(a){var c,u;o.value&&dn(a)?(r.value=((c=i==null?void 0:i.max)==null?void 0:c.value)!==void 0&&a.length>(i==null?void 0:i.max.value),r.value===!1&&((u=i==null?void 0:i.changeEvent)==null||u.call(i,a))):(n(yT,a),t.value=a)}}),isGroup:o,isLimitExceeded:r}},gEe=(e,t,{model:n})=>{const i=Qr(AT,void 0),o=xo(!1),r=yn(()=>{const u=n.value;return gI(u)?u:dn(u)?Ao(e.label)?u.map(ji).some(f=>xCe(f,e.label)):u.map(ji).includes(e.label):u!=null?u===e.trueLabel:!!u}),s=pG(yn(()=>{var u;return(u=i==null?void 0:i.size)==null?void 0:u.value}),{prop:!0}),a=pG(yn(()=>{var u;return(u=i==null?void 0:i.size)==null?void 0:u.value})),c=yn(()=>!!(t.default||e.label));return{checkboxButtonSize:s,isChecked:r,isFocused:o,checkboxSize:a,hasOwnLabel:c}},yEe=(e,{model:t})=>{function n(){dn(t.value)&&!t.value.includes(e.label)?t.value.push(e.label):t.value=e.trueLabel||!0}e.checked&&n()},aX=(e,t)=>{const{formItem:n}=w3(),{model:i,isGroup:o,isLimitExceeded:r}=_Ee(e),{isFocused:s,isChecked:a,checkboxButtonSize:c,checkboxSize:u,hasOwnLabel:f}=gEe(e,t,{model:i}),{isDisabled:h}=pEe({model:i,isChecked:a}),{inputId:_,isLabeledByFormItem:g}=nX(e,{formItemContext:n,disableIdGeneration:f,disableIdManagement:o}),{handleChange:p,onClickRoot:y}=mEe(e,{model:i,isLimitExceeded:r,hasOwnLabel:f,isDisabled:h,isLabeledByFormItem:g});return yEe(e,{model:i}),{inputId:_,isLabeledByFormItem:g,isChecked:a,isDisabled:h,isFocused:s,checkboxButtonSize:c,checkboxSize:u,hasOwnLabel:f,model:i,handleChange:p,onClickRoot:y}},AEe=["tabindex","role","aria-checked"],TEe=["id","aria-hidden","name","tabindex","disabled","true-value","false-value"],CEe=["id","aria-hidden","disabled","value","name","tabindex"],bEe=ms({name:"ElCheckbox"}),EEe=ms({...bEe,props:rX,emits:sX,setup(e){const t=e,n=l$(),{inputId:i,isLabeledByFormItem:o,isChecked:r,isDisabled:s,isFocused:a,checkboxSize:c,hasOwnLabel:u,model:f,handleChange:h,onClickRoot:_}=aX(t,n),g=Od("checkbox"),p=yn(()=>[g.b(),g.m(c.value),g.is("disabled",s.value),g.is("bordered",t.border),g.is("checked",r.value)]),y=yn(()=>[g.e("input"),g.is("disabled",s.value),g.is("checked",r.value),g.is("indeterminate",t.indeterminate),g.is("focus",a.value)]);return(T,b)=>(_i(),Fc(O1(!xt(u)&&xt(o)?"span":"label"),{class:go(xt(p)),"aria-controls":T.indeterminate?T.controls:null,onClick:xt(_)},{default:za(()=>[Xs("span",{class:go(xt(y)),tabindex:T.indeterminate?0:void 0,role:T.indeterminate?"checkbox":void 0,"aria-checked":T.indeterminate?"mixed":void 0},[T.trueLabel||T.falseLabel?Jg((_i(),tr("input",{key:0,id:xt(i),"onUpdate:modelValue":b[0]||(b[0]=x=>Ir(f)?f.value=x:null),class:go(xt(g).e("original")),type:"checkbox","aria-hidden":T.indeterminate?"true":"false",name:T.name,tabindex:T.tabindex,disabled:xt(s),"true-value":T.trueLabel,"false-value":T.falseLabel,onChange:b[1]||(b[1]=(...x)=>xt(h)&&xt(h)(...x)),onFocus:b[2]||(b[2]=x=>a.value=!0),onBlur:b[3]||(b[3]=x=>a.value=!1)},null,42,TEe)),[[dI,xt(f)]]):Jg((_i(),tr("input",{key:1,id:xt(i),"onUpdate:modelValue":b[4]||(b[4]=x=>Ir(f)?f.value=x:null),class:go(xt(g).e("original")),type:"checkbox","aria-hidden":T.indeterminate?"true":"false",disabled:xt(s),value:T.label,name:T.name,tabindex:T.tabindex,onChange:b[5]||(b[5]=(...x)=>xt(h)&&xt(h)(...x)),onFocus:b[6]||(b[6]=x=>a.value=!0),onBlur:b[7]||(b[7]=x=>a.value=!1)},null,42,CEe)),[[dI,xt(f)]]),Xs("span",{class:go(xt(g).e("inner"))},null,2)],10,AEe),xt(u)?(_i(),tr("span",{key:0,class:go(xt(g).e("label"))},[pc(T.$slots,"default"),T.$slots.default?lc("v-if",!0):(_i(),tr(aa,{key:0},[pE(Kg(T.label),1)],64))],2)):lc("v-if",!0)]),_:3},8,["class","aria-controls","onClick"]))}});var xEe=lp(EEe,[["__file","/home/runner/work/element-plus/element-plus/packages/components/checkbox/src/checkbox.vue"]]);const wEe=["name","tabindex","disabled","true-value","false-value"],SEe=["name","tabindex","disabled","value"],vEe=ms({name:"ElCheckboxButton"}),DEe=ms({...vEe,props:rX,emits:sX,setup(e){const t=e,n=l$(),{isFocused:i,isChecked:o,isDisabled:r,checkboxButtonSize:s,model:a,handleChange:c}=aX(t,n),u=Qr(AT,void 0),f=Od("checkbox"),h=yn(()=>{var g,p,y,T;const b=(p=(g=u==null?void 0:u.fill)==null?void 0:g.value)!=null?p:"";return{backgroundColor:b,borderColor:b,color:(T=(y=u==null?void 0:u.textColor)==null?void 0:y.value)!=null?T:"",boxShadow:b?`-1px 0 0 0 ${b}`:void 0}}),_=yn(()=>[f.b("button"),f.bm("button",s.value),f.is("disabled",r.value),f.is("checked",o.value),f.is("focus",i.value)]);return(g,p)=>(_i(),tr("label",{class:go(xt(_))},[g.trueLabel||g.falseLabel?Jg((_i(),tr("input",{key:0,"onUpdate:modelValue":p[0]||(p[0]=y=>Ir(a)?a.value=y:null),class:go(xt(f).be("button","original")),type:"checkbox",name:g.name,tabindex:g.tabindex,disabled:xt(r),"true-value":g.trueLabel,"false-value":g.falseLabel,onChange:p[1]||(p[1]=(...y)=>xt(c)&&xt(c)(...y)),onFocus:p[2]||(p[2]=y=>i.value=!0),onBlur:p[3]||(p[3]=y=>i.value=!1)},null,42,wEe)),[[dI,xt(a)]]):Jg((_i(),tr("input",{key:1,"onUpdate:modelValue":p[4]||(p[4]=y=>Ir(a)?a.value=y:null),class:go(xt(f).be("button","original")),type:"checkbox",name:g.name,tabindex:g.tabindex,disabled:xt(r),value:g.label,onChange:p[5]||(p[5]=(...y)=>xt(c)&&xt(c)(...y)),onFocus:p[6]||(p[6]=y=>i.value=!0),onBlur:p[7]||(p[7]=y=>i.value=!1)},null,42,SEe)),[[dI,xt(a)]]),g.$slots.default||g.label?(_i(),tr("span",{key:2,class:go(xt(f).be("button","inner")),style:hT(xt(o)?xt(h):void 0)},[pc(g.$slots,"default",{},()=>[pE(Kg(g.label),1)])],6)):lc("v-if",!0)],2))}});var cX=lp(DEe,[["__file","/home/runner/work/element-plus/element-plus/packages/components/checkbox/src/checkbox-button.vue"]]);const IEe=Pd({modelValue:{type:nu(Array),default:()=>[]},disabled:Boolean,min:Number,max:Number,size:E3,label:String,fill:String,textColor:String,tag:{type:String,default:"div"},validateEvent:{type:Boolean,default:!0}}),PEe={[yT]:e=>dn(e),change:e=>dn(e)},OEe=ms({name:"ElCheckboxGroup"}),LEe=ms({...OEe,props:IEe,emits:PEe,setup(e,{emit:t}){const n=e,i=Od("checkbox"),{formItem:o}=w3(),{inputId:r,isLabeledByFormItem:s}=nX(n,{formItemContext:o}),a=async u=>{t(yT,u),await $m(),t("change",u)},c=yn({get(){return n.modelValue},set(u){a(u)}});return Bm(AT,{...PCe(Wme(n),["size","min","max","disabled","validateEvent","fill","textColor"]),modelValue:c,changeEvent:a}),ws(()=>n.modelValue,()=>{n.validateEvent&&(o==null||o.validate("change").catch(u=>void 0))}),(u,f)=>{var h;return _i(),Fc(O1(u.tag),{id:xt(r),class:go(xt(i).b("group")),role:"group","aria-label":xt(s)?void 0:u.label||"checkbox-group","aria-labelledby":xt(s)?(h=xt(o))==null?void 0:h.labelId:void 0},{default:za(()=>[pc(u.$slots,"default")]),_:3},8,["id","class","aria-label","aria-labelledby"])}}});var lX=lp(LEe,[["__file","/home/runner/work/element-plus/element-plus/packages/components/checkbox/src/checkbox-group.vue"]]);const BEe=fx(xEe,{CheckboxButton:cX,CheckboxGroup:lX});Q$(cX);const REe=Q$(lX),RM={},NEe=Pd({a11y:{type:Boolean,default:!0},locale:{type:nu(Object)},size:E3,button:{type:nu(Object)},experimentalFeatures:{type:nu(Object)},keyboardNavigation:{type:Boolean,default:!0},message:{type:nu(Object)},zIndex:Number,namespace:{type:String,default:"el"}});ms({name:"ElConfigProvider",props:NEe,setup(e,{slots:t}){ws(()=>e.message,i=>{Object.assign(RM,i??{})},{immediate:!0,deep:!0});const n=Obe(e);return()=>pc(t,"default",{config:n==null?void 0:n.value})}});const MEe=Pd({mask:{type:Boolean,default:!0},customMaskEvent:{type:Boolean,default:!1},overlayClass:{type:nu([String,Array,Object])},zIndex:{type:nu([String,Number])}}),FEe={click:e=>e instanceof MouseEvent};var zEe=ms({name:"ElOverlay",props:MEe,emits:FEe,setup(e,{slots:t,emit:n}){const i=Od("overlay"),o=c=>{n("click",c)},{onClick:r,onMousedown:s,onMouseup:a}=Gbe(e.customMaskEvent?void 0:o);return()=>e.mask?nr("div",{class:[i.b(),e.overlayClass],style:{zIndex:e.zIndex},onClick:r,onMousedown:s,onMouseup:a},[pc(t,"default")],mD.STYLE|mD.CLASS|mD.PROPS,["onClick","onMouseup","onMousedown"]):N1("div",{class:e.overlayClass,style:{zIndex:e.zIndex,position:"fixed",top:"0px",right:"0px",bottom:"0px",left:"0px"}},[pc(t,"default")])}});const UEe=zEe,HEe=Pd({center:{type:Boolean,default:!1},alignCenter:{type:Boolean,default:!1},closeIcon:{type:J$},customClass:{type:String,default:""},draggable:{type:Boolean,default:!1},fullscreen:{type:Boolean,default:!1},showClose:{type:Boolean,default:!0},title:{type:String,default:""}}),VEe=Pd({...HEe,appendToBody:{type:Boolean,default:!1},beforeClose:{type:nu(Function)},destroyOnClose:{type:Boolean,default:!1},closeOnClickModal:{type:Boolean,default:!0},closeOnPressEscape:{type:Boolean,default:!0},lockScroll:{type:Boolean,default:!0},modal:{type:Boolean,default:!0},openDelay:{type:Number,default:0},closeDelay:{type:Number,default:0},top:{type:String},modelValue:{type:Boolean,default:!1},modalClass:String,width:{type:[String,Number]},zIndex:{type:Number},trapFocus:{type:Boolean,default:!1}}),kEe={open:()=>!0,opened:()=>!0,close:()=>!0,closed:()=>!0,[yT]:e=>gI(e),openAutoFocus:()=>!0,closeAutoFocus:()=>!0},GEe=(e,t)=>{const i=Id().emit,{nextZIndex:o}=iX();let r="";const s=LM(),a=LM(),c=xo(!1),u=xo(!1),f=xo(!1),h=xo(e.zIndex||o());let _,g;const p=by("namespace",x3),y=yn(()=>{const P={},R=`--${p.value}-dialog`;return e.fullscreen||(e.top&&(P[`${R}-margin-top`]=e.top),e.width&&(P[`${R}-width`]=T3(e.width))),P}),T=yn(()=>e.alignCenter?{display:"flex"}:{});function b(){i("opened")}function x(){i("closed"),i(yT,!1),e.destroyOnClose&&(f.value=!1)}function v(){i("close")}function D(){g==null||g(),_==null||_(),e.openDelay&&e.openDelay>0?{stop:_}=IM(()=>M(),e.openDelay):M()}function L(){_==null||_(),g==null||g(),e.closeDelay&&e.closeDelay>0?{stop:g}=IM(()=>H(),e.closeDelay):H()}function B(){function P(R){R||(u.value=!0,c.value=!1)}e.beforeClose?e.beforeClose(P):L()}function V(){e.closeOnClickModal&&B()}function M(){pf&&(c.value=!0)}function H(){c.value=!1}function G(){i("openAutoFocus")}function I(){i("closeAutoFocus")}function O(P){var R;((R=P.detail)==null?void 0:R.focusReason)==="pointer"&&P.preventDefault()}e.lockScroll&&kbe(c);function m(){e.closeOnPressEscape&&B()}return ws(()=>e.modelValue,P=>{P?(u.value=!1,D(),f.value=!0,h.value=e.zIndex?h.value++:o(),$m(()=>{i("open"),t.value&&(t.value.scrollTop=0)})):c.value&&L()}),ws(()=>e.fullscreen,P=>{t.value&&(P?(r=t.value.style.transform,t.value.style.transform=""):t.value.style.transform=r)}),Dd(()=>{e.modelValue&&(c.value=!0,f.value=!0,D())}),{afterEnter:b,afterLeave:x,beforeLeave:v,handleClose:B,onModalClick:V,close:L,doClose:H,onOpenAutoFocus:G,onCloseAutoFocus:I,onCloseRequested:m,onFocusoutPrevented:O,titleId:s,bodyId:a,closed:u,style:y,overlayDialogStyle:T,rendered:f,visible:c,zIndex:h}},WEe=Pd({...VEe,direction:{type:String,default:"rtl",values:["ltr","rtl","ttb","btt"]},size:{type:[String,Number],default:"30%"},withHeader:{type:Boolean,default:!0},modalFade:{type:Boolean,default:!0}}),qEe=kEe,jEe=ms({name:"ElDrawer",components:{ElOverlay:UEe,ElFocusTrap:aEe,ElIcon:BM,Close:q$},inheritAttrs:!1,props:WEe,emits:qEe,setup(e,{slots:t}){mG({scope:"el-drawer",from:"the title slot",replacement:"the header slot",version:"3.0.0",ref:"https://element-plus.org/en-US/component/drawer.html#slots"},yn(()=>!!t.title)),mG({scope:"el-drawer",from:"custom-class",replacement:"class",version:"2.3.0",ref:"https://element-plus.org/en-US/component/drawer.html#attributes",type:"Attribute"},yn(()=>!!e.customClass));const n=xo(),i=xo(),o=Od("drawer"),{t:r}=Vbe(),s=yn(()=>e.direction==="rtl"||e.direction==="ltr"),a=yn(()=>T3(e.size));return{...GEe(e,n),drawerRef:n,focusStartRef:i,isHorizontal:s,drawerSize:a,ns:o,t:r}}}),YEe=["aria-label","aria-labelledby","aria-describedby"],$Ee=["id"],XEe=["aria-label"],KEe=["id"];function JEe(e,t,n,i,o,r){const s=eS("close"),a=eS("el-icon"),c=eS("el-focus-trap"),u=eS("el-overlay");return _i(),Fc(U_e,{to:"body",disabled:!e.appendToBody},[nr(lx,{name:e.ns.b("fade"),onAfterEnter:e.afterEnter,onAfterLeave:e.afterLeave,onBeforeLeave:e.beforeLeave,persisted:""},{default:za(()=>[Jg(nr(u,{mask:e.modal,"overlay-class":e.modalClass,"z-index":e.zIndex,onClick:e.onModalClick},{default:za(()=>[nr(c,{loop:"",trapped:e.visible,"focus-trap-el":e.drawerRef,"focus-start-el":e.focusStartRef,onReleaseRequested:e.onCloseRequested},{default:za(()=>[Xs("div",c3({ref:"drawerRef","aria-modal":"true","aria-label":e.title||void 0,"aria-labelledby":e.title?void 0:e.titleId,"aria-describedby":e.bodyId},e.$attrs,{class:[e.ns.b(),e.direction,e.visible&&"open",e.customClass],style:e.isHorizontal?"width: "+e.drawerSize:"height: "+e.drawerSize,role:"dialog",onClick:t[1]||(t[1]=h$(()=>{},["stop"]))}),[Xs("span",{ref:"focusStartRef",class:go(e.ns.e("sr-focus")),tabindex:"-1"},null,2),e.withHeader?(_i(),tr("header",{key:0,class:go(e.ns.e("header"))},[e.$slots.title?pc(e.$slots,"title",{key:1},()=>[lc(" DEPRECATED SLOT ")]):pc(e.$slots,"header",{key:0,close:e.handleClose,titleId:e.titleId,titleClass:e.ns.e("title")},()=>[e.$slots.title?lc("v-if",!0):(_i(),tr("span",{key:0,id:e.titleId,role:"heading",class:go(e.ns.e("title"))},Kg(e.title),11,$Ee))]),e.showClose?(_i(),tr("button",{key:2,"aria-label":e.t("el.drawer.close"),class:go(e.ns.e("close-btn")),type:"button",onClick:t[0]||(t[0]=(...f)=>e.handleClose&&e.handleClose(...f))},[nr(a,{class:go(e.ns.e("close"))},{default:za(()=>[nr(s)]),_:1},8,["class"])],10,XEe)):lc("v-if",!0)],2)):lc("v-if",!0),e.rendered?(_i(),tr("div",{key:1,id:e.bodyId,class:go(e.ns.e("body"))},[pc(e.$slots,"default")],10,KEe)):lc("v-if",!0),e.$slots.footer?(_i(),tr("div",{key:2,class:go(e.ns.e("footer"))},[pc(e.$slots,"footer")],2)):lc("v-if",!0)],16,YEe)]),_:3},8,["trapped","focus-trap-el","focus-start-el","onReleaseRequested"])]),_:3},8,["mask","overlay-class","z-index","onClick"]),[[l3,e.visible]])]),_:3},8,["name","onAfterEnter","onAfterLeave","onBeforeLeave"])],8,["disabled"])}var QEe=lp(jEe,[["render",JEe],["__file","/home/runner/work/element-plus/element-plus/packages/components/drawer/src/drawer.vue"]]);const ZEe=fx(QEe),exe=["start","center","end","space-around","space-between","space-evenly"],txe=["top","middle","bottom"],nxe=Pd({tag:{type:String,default:"div"},gutter:{type:Number,default:0},justify:{type:String,values:exe,default:"start"},align:{type:String,values:txe,default:"top"}}),ixe=ms({name:"ElRow"}),oxe=ms({...ixe,props:nxe,setup(e){const t=e,n=Od("row"),i=yn(()=>t.gutter);Bm(Pbe,{gutter:i});const o=yn(()=>{const s={};return t.gutter&&(s.marginRight=s.marginLeft=`-${t.gutter/2}px`),s}),r=yn(()=>[n.b(),n.is(`justify-${t.justify}`,t.justify!=="start"),n.is(`align-${t.align}`,t.align!=="top")]);return(s,a)=>(_i(),Fc(O1(s.tag),{class:go(xt(r)),style:hT(xt(o))},{default:za(()=>[pc(s.$slots,"default")]),_:3},8,["class","style"]))}});var rxe=lp(oxe,[["__file","/home/runner/work/element-plus/element-plus/packages/components/row/src/row.vue"]]);const sxe=fx(rxe),uX=["success","info","warning","error"],Oc=Ibe({customClass:"",center:!1,dangerouslyUseHTMLString:!1,duration:3e3,icon:void 0,id:"",message:"",onClose:void 0,showClose:!1,type:"info",offset:16,zIndex:0,grouping:!1,repeatNum:1,appendTo:pf?document.body:void 0}),axe=Pd({customClass:{type:String,default:Oc.customClass},center:{type:Boolean,default:Oc.center},dangerouslyUseHTMLString:{type:Boolean,default:Oc.dangerouslyUseHTMLString},duration:{type:Number,default:Oc.duration},icon:{type:J$,default:Oc.icon},id:{type:String,default:Oc.id},message:{type:nu([String,Object,Function]),default:Oc.message},onClose:{type:nu(Function),required:!1},showClose:{type:Boolean,default:Oc.showClose},type:{type:String,values:uX,default:Oc.type},offset:{type:Number,default:Oc.offset},zIndex:{type:Number,default:Oc.zIndex},grouping:{type:Boolean,default:Oc.grouping},repeatNum:{type:Number,default:Oc.repeatNum}}),cxe={destroy:()=>!0},ad=wY([]),lxe=e=>{const t=ad.findIndex(o=>o.id===e),n=ad[t];let i;return t>0&&(i=ad[t-1]),{current:n,prev:i}},uxe=e=>{const{prev:t}=lxe(e);return t?t.vm.exposed.bottom.value:0},fxe=["id"],dxe=["innerHTML"],hxe=ms({name:"ElMessage"}),pxe=ms({...hxe,props:axe,emits:cxe,setup(e,{expose:t}){const n=e,{Close:i}=Sbe,o=Od("message"),r=xo(),s=xo(!1),a=xo(0);let c;const u=yn(()=>n.type?n.type==="error"?"danger":n.type:"info"),f=yn(()=>{const D=n.type;return{[o.bm("icon",D)]:D&&hG[D]}}),h=yn(()=>n.icon||hG[n.type]||""),_=yn(()=>uxe(n.id)),g=yn(()=>n.offset+_.value),p=yn(()=>a.value+g.value),y=yn(()=>({top:`${g.value}px`,zIndex:n.zIndex}));function T(){n.duration!==0&&({stop:c}=IM(()=>{x()},n.duration))}function b(){c==null||c()}function x(){s.value=!1}function v({code:D}){D===C3.esc&&x()}return Dd(()=>{T(),s.value=!0}),ws(()=>n.repeatNum,()=>{b(),T()}),NCe(document,"keydown",v),HCe(r,()=>{a.value=r.value.getBoundingClientRect().height}),t({visible:s,bottom:p,close:x}),(D,L)=>(_i(),Fc(lx,{name:xt(o).b("fade"),onBeforeLeave:D.onClose,onAfterLeave:L[0]||(L[0]=B=>D.$emit("destroy")),persisted:""},{default:za(()=>[Jg(Xs("div",{id:D.id,ref_key:"messageRef",ref:r,class:go([xt(o).b(),{[xt(o).m(D.type)]:D.type&&!D.icon},xt(o).is("center",D.center),xt(o).is("closable",D.showClose),D.customClass]),style:hT(xt(y)),role:"alert",onMouseenter:b,onMouseleave:T},[D.repeatNum>1?(_i(),Fc(xt(hEe),{key:0,value:D.repeatNum,type:xt(u),class:go(xt(o).e("badge"))},null,8,["value","type","class"])):lc("v-if",!0),xt(h)?(_i(),Fc(xt(BM),{key:1,class:go([xt(o).e("icon"),xt(f)])},{default:za(()=>[(_i(),Fc(O1(xt(h))))]),_:1},8,["class"])):lc("v-if",!0),pc(D.$slots,"default",{},()=>[D.dangerouslyUseHTMLString?(_i(),tr(aa,{key:1},[lc(" Caution here, message could've been compromised, never use user's input as message "),Xs("p",{class:go(xt(o).e("content")),innerHTML:D.message},null,10,dxe)],2112)):(_i(),tr("p",{key:0,class:go(xt(o).e("content"))},Kg(D.message),3))]),D.showClose?(_i(),Fc(xt(BM),{key:2,class:go(xt(o).e("closeBtn")),onClick:h$(x,["stop"])},{default:za(()=>[nr(xt(i))]),_:1},8,["class","onClick"])):lc("v-if",!0)],46,fxe),[[l3,s.value]])]),_:3},8,["name","onBeforeLeave"]))}});var mxe=lp(pxe,[["__file","/home/runner/work/element-plus/element-plus/packages/components/message/src/message.vue"]]);let _xe=1;const fX=e=>{const t=!e||Do(e)||GA(e)||$n(e)?{message:e}:e,n={...Oc,...t};if(!n.appendTo)n.appendTo=document.body;else if(Do(n.appendTo)){let i=document.querySelector(n.appendTo);jCe(i)||(i=document.body),n.appendTo=i}return n},gxe=e=>{const t=ad.indexOf(e);if(t===-1)return;ad.splice(t,1);const{handler:n}=e;n.close()},yxe=({appendTo:e,...t},n)=>{const{nextZIndex:i}=iX(),o=`message_${_xe++}`,r=t.onClose,s=document.createElement("div"),a={...t,zIndex:i()+t.zIndex,id:o,onClose:()=>{r==null||r(),gxe(h)},onDestroy:()=>{yk(null,s)}},c=nr(mxe,a,$n(a.message)||GA(a.message)?{default:$n(a.message)?a.message:()=>a.message}:null);c.appContext=n||XA._context,yk(c,s),e.appendChild(s.firstElementChild);const u=c.component,h={id:o,vnode:c,vm:u,handler:{close:()=>{u.exposed.visible.value=!1}},props:c.component.props};return h},XA=(e={},t)=>{if(!pf)return{close:()=>{}};if($A(RM.max)&&ad.length>=RM.max)return{close:()=>{}};const n=fX(e);if(n.grouping&&ad.length){const o=ad.find(({vnode:r})=>{var s;return((s=r.props)==null?void 0:s.message)===n.message});if(o)return o.props.repeatNum+=1,o.props.type=n.type,o.handler}const i=yxe(n,t);return ad.push(i),i.handler};uX.forEach(e=>{XA[e]=(t={},n)=>{const i=fX(t);return XA({...i,type:e},n)}});function Axe(e){for(const t of ad)(!e||e===t.props.type)&&t.handler.close()}XA.closeAll=Axe;XA._context=null;const SG=vbe(XA,"$message"),Txe="/satellite-track/assets/menu-a8f9cd83.svg";function l(e){return e!=null}function w(e){this.name="DeveloperError",this.message=e;let t;try{throw new Error}catch(n){t=n.stack}this.stack=t}l(Object.create)&&(w.prototype=Object.create(Error.prototype),w.prototype.constructor=w);w.prototype.toString=function(){let e=`${this.name}: ${this.message}`;return l(this.stack)&&(e+=`
|
||
${this.stack.toString()}`),e};w.throwInstantiationError=function(){throw new w("This function defines an interface and should not be called directly.")};const fs={};fs.typeOf={};function Cxe(e){return`${e} is required, actual value was undefined`}function TT(e,t,n){return`Expected ${n} to be typeof ${t}, actual typeof was ${e}`}fs.defined=function(e,t){if(!l(t))throw new w(Cxe(e))};fs.typeOf.func=function(e,t){if(typeof t!="function")throw new w(TT(typeof t,"function",e))};fs.typeOf.string=function(e,t){if(typeof t!="string")throw new w(TT(typeof t,"string",e))};fs.typeOf.number=function(e,t){if(typeof t!="number")throw new w(TT(typeof t,"number",e))};fs.typeOf.number.lessThan=function(e,t,n){if(fs.typeOf.number(e,t),t>=n)throw new w(`Expected ${e} to be less than ${n}, actual value was ${t}`)};fs.typeOf.number.lessThanOrEquals=function(e,t,n){if(fs.typeOf.number(e,t),t>n)throw new w(`Expected ${e} to be less than or equal to ${n}, actual value was ${t}`)};fs.typeOf.number.greaterThan=function(e,t,n){if(fs.typeOf.number(e,t),t<=n)throw new w(`Expected ${e} to be greater than ${n}, actual value was ${t}`)};fs.typeOf.number.greaterThanOrEquals=function(e,t,n){if(fs.typeOf.number(e,t),t<n)throw new w(`Expected ${e} to be greater than or equal to ${n}, actual value was ${t}`)};fs.typeOf.object=function(e,t){if(typeof t!="object")throw new w(TT(typeof t,"object",e))};fs.typeOf.bool=function(e,t){if(typeof t!="boolean")throw new w(TT(typeof t,"boolean",e))};fs.typeOf.bigint=function(e,t){if(typeof t!="bigint")throw new w(TT(typeof t,"bigint",e))};fs.typeOf.number.equals=function(e,t,n,i){if(fs.typeOf.number(e,n),fs.typeOf.number(t,i),n!==i)throw new w(`${e} must be equal to ${t}, the actual values are ${n} and ${i}`)};const E=fs;function A(e,t){return e??t}A.EMPTY_OBJECT=Object.freeze({});var up=function(e){e==null&&(e=new Date().getTime()),this.N=624,this.M=397,this.MATRIX_A=2567483615,this.UPPER_MASK=2147483648,this.LOWER_MASK=2147483647,this.mt=new Array(this.N),this.mti=this.N+1,e.constructor==Array?this.init_by_array(e,e.length):this.init_seed(e)};up.prototype.init_seed=function(e){for(this.mt[0]=e>>>0,this.mti=1;this.mti<this.N;this.mti++){var e=this.mt[this.mti-1]^this.mt[this.mti-1]>>>30;this.mt[this.mti]=(((e&4294901760)>>>16)*1812433253<<16)+(e&65535)*1812433253+this.mti,this.mt[this.mti]>>>=0}};up.prototype.init_by_array=function(e,t){var n,i,o;for(this.init_seed(19650218),n=1,i=0,o=this.N>t?this.N:t;o;o--){var r=this.mt[n-1]^this.mt[n-1]>>>30;this.mt[n]=(this.mt[n]^(((r&4294901760)>>>16)*1664525<<16)+(r&65535)*1664525)+e[i]+i,this.mt[n]>>>=0,n++,i++,n>=this.N&&(this.mt[0]=this.mt[this.N-1],n=1),i>=t&&(i=0)}for(o=this.N-1;o;o--){var r=this.mt[n-1]^this.mt[n-1]>>>30;this.mt[n]=(this.mt[n]^(((r&4294901760)>>>16)*1566083941<<16)+(r&65535)*1566083941)-n,this.mt[n]>>>=0,n++,n>=this.N&&(this.mt[0]=this.mt[this.N-1],n=1)}this.mt[0]=2147483648};up.prototype.random_int=function(){var e,t=new Array(0,this.MATRIX_A);if(this.mti>=this.N){var n;for(this.mti==this.N+1&&this.init_seed(5489),n=0;n<this.N-this.M;n++)e=this.mt[n]&this.UPPER_MASK|this.mt[n+1]&this.LOWER_MASK,this.mt[n]=this.mt[n+this.M]^e>>>1^t[e&1];for(;n<this.N-1;n++)e=this.mt[n]&this.UPPER_MASK|this.mt[n+1]&this.LOWER_MASK,this.mt[n]=this.mt[n+(this.M-this.N)]^e>>>1^t[e&1];e=this.mt[this.N-1]&this.UPPER_MASK|this.mt[0]&this.LOWER_MASK,this.mt[this.N-1]=this.mt[this.M-1]^e>>>1^t[e&1],this.mti=0}return e=this.mt[this.mti++],e^=e>>>11,e^=e<<7&2636928640,e^=e<<15&4022730752,e^=e>>>18,e>>>0};up.prototype.random_int31=function(){return this.random_int()>>>1};up.prototype.random_incl=function(){return this.random_int()*(1/4294967295)};up.prototype.random=function(){return this.random_int()*(1/4294967296)};up.prototype.random_excl=function(){return(this.random_int()+.5)*(1/4294967296)};up.prototype.random_long=function(){var e=this.random_int()>>>5,t=this.random_int()>>>6;return(e*67108864+t)*(1/9007199254740992)};var V1=up;const ct={};ct.EPSILON1=.1;ct.EPSILON2=.01;ct.EPSILON3=.001;ct.EPSILON4=1e-4;ct.EPSILON5=1e-5;ct.EPSILON6=1e-6;ct.EPSILON7=1e-7;ct.EPSILON8=1e-8;ct.EPSILON9=1e-9;ct.EPSILON10=1e-10;ct.EPSILON11=1e-11;ct.EPSILON12=1e-12;ct.EPSILON13=1e-13;ct.EPSILON14=1e-14;ct.EPSILON15=1e-15;ct.EPSILON16=1e-16;ct.EPSILON17=1e-17;ct.EPSILON18=1e-18;ct.EPSILON19=1e-19;ct.EPSILON20=1e-20;ct.EPSILON21=1e-21;ct.GRAVITATIONALPARAMETER=3986004418e5;ct.SOLAR_RADIUS=6955e5;ct.LUNAR_RADIUS=1737400;ct.SIXTY_FOUR_KILOBYTES=64*1024;ct.FOUR_GIGABYTES=4*1024*1024*1024;ct.sign=A(Math.sign,function(t){return t=+t,t===0||t!==t?t:t>0?1:-1});ct.signNotZero=function(e){return e<0?-1:1};ct.toSNorm=function(e,t){return t=A(t,255),Math.round((ct.clamp(e,-1,1)*.5+.5)*t)};ct.fromSNorm=function(e,t){return t=A(t,255),ct.clamp(e,0,t)/t*2-1};ct.normalize=function(e,t,n){return n=Math.max(n-t,0),n===0?0:ct.clamp((e-t)/n,0,1)};ct.sinh=A(Math.sinh,function(t){return(Math.exp(t)-Math.exp(-t))/2});ct.cosh=A(Math.cosh,function(t){return(Math.exp(t)+Math.exp(-t))/2});ct.lerp=function(e,t,n){return(1-n)*e+n*t};ct.PI=Math.PI;ct.ONE_OVER_PI=1/Math.PI;ct.PI_OVER_TWO=Math.PI/2;ct.PI_OVER_THREE=Math.PI/3;ct.PI_OVER_FOUR=Math.PI/4;ct.PI_OVER_SIX=Math.PI/6;ct.THREE_PI_OVER_TWO=3*Math.PI/2;ct.TWO_PI=2*Math.PI;ct.ONE_OVER_TWO_PI=1/(2*Math.PI);ct.RADIANS_PER_DEGREE=Math.PI/180;ct.DEGREES_PER_RADIAN=180/Math.PI;ct.RADIANS_PER_ARCSECOND=ct.RADIANS_PER_DEGREE/3600;ct.toRadians=function(e){if(!l(e))throw new w("degrees is required.");return e*ct.RADIANS_PER_DEGREE};ct.toDegrees=function(e){if(!l(e))throw new w("radians is required.");return e*ct.DEGREES_PER_RADIAN};ct.convertLongitudeRange=function(e){if(!l(e))throw new w("angle is required.");const t=ct.TWO_PI,n=e-Math.floor(e/t)*t;return n<-Math.PI?n+t:n>=Math.PI?n-t:n};ct.clampToLatitudeRange=function(e){if(!l(e))throw new w("angle is required.");return ct.clamp(e,-1*ct.PI_OVER_TWO,ct.PI_OVER_TWO)};ct.negativePiToPi=function(e){if(!l(e))throw new w("angle is required.");return e>=-ct.PI&&e<=ct.PI?e:ct.zeroToTwoPi(e+ct.PI)-ct.PI};ct.zeroToTwoPi=function(e){if(!l(e))throw new w("angle is required.");if(e>=0&&e<=ct.TWO_PI)return e;const t=ct.mod(e,ct.TWO_PI);return Math.abs(t)<ct.EPSILON14&&Math.abs(e)>ct.EPSILON14?ct.TWO_PI:t};ct.mod=function(e,t){if(!l(e))throw new w("m is required.");if(!l(t))throw new w("n is required.");if(t===0)throw new w("divisor cannot be 0.");return ct.sign(e)===ct.sign(t)&&Math.abs(e)<Math.abs(t)?e:(e%t+t)%t};ct.equalsEpsilon=function(e,t,n,i){if(!l(e))throw new w("left is required.");if(!l(t))throw new w("right is required.");n=A(n,0),i=A(i,n);const o=Math.abs(e-t);return o<=i||o<=n*Math.max(Math.abs(e),Math.abs(t))};ct.lessThan=function(e,t,n){if(!l(e))throw new w("first is required.");if(!l(t))throw new w("second is required.");if(!l(n))throw new w("absoluteEpsilon is required.");return e-t<-n};ct.lessThanOrEquals=function(e,t,n){if(!l(e))throw new w("first is required.");if(!l(t))throw new w("second is required.");if(!l(n))throw new w("absoluteEpsilon is required.");return e-t<n};ct.greaterThan=function(e,t,n){if(!l(e))throw new w("first is required.");if(!l(t))throw new w("second is required.");if(!l(n))throw new w("absoluteEpsilon is required.");return e-t>n};ct.greaterThanOrEquals=function(e,t,n){if(!l(e))throw new w("first is required.");if(!l(t))throw new w("second is required.");if(!l(n))throw new w("absoluteEpsilon is required.");return e-t>-n};const aS=[1];ct.factorial=function(e){if(typeof e!="number"||e<0)throw new w("A number greater than or equal to 0 is required.");const t=aS.length;if(e>=t){let n=aS[t-1];for(let i=t;i<=e;i++){const o=n*i;aS.push(o),n=o}}return aS[e]};ct.incrementWrap=function(e,t,n){if(n=A(n,0),!l(e))throw new w("n is required.");if(t<=n)throw new w("maximumValue must be greater than minimumValue.");return++e,e>t&&(e=n),e};ct.isPowerOfTwo=function(e){if(typeof e!="number"||e<0||e>4294967295)throw new w("A number between 0 and (2^32)-1 is required.");return e!==0&&(e&e-1)===0};ct.nextPowerOfTwo=function(e){if(typeof e!="number"||e<0||e>2147483648)throw new w("A number between 0 and 2^31 is required.");return--e,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,++e,e};ct.previousPowerOfTwo=function(e){if(typeof e!="number"||e<0||e>4294967295)throw new w("A number between 0 and (2^32)-1 is required.");return e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,e|=e>>32,e=(e>>>0)-(e>>>1),e};ct.clamp=function(e,t,n){return E.typeOf.number("value",e),E.typeOf.number("min",t),E.typeOf.number("max",n),e<t?t:e>n?n:e};let dX=new V1;ct.setRandomNumberSeed=function(e){if(!l(e))throw new w("seed is required.");dX=new V1(e)};ct.nextRandomNumber=function(){return dX.random()};ct.randomBetween=function(e,t){return ct.nextRandomNumber()*(t-e)+e};ct.acosClamped=function(e){if(!l(e))throw new w("value is required.");return Math.acos(ct.clamp(e,-1,1))};ct.asinClamped=function(e){if(!l(e))throw new w("value is required.");return Math.asin(ct.clamp(e,-1,1))};ct.chordLength=function(e,t){if(!l(e))throw new w("angle is required.");if(!l(t))throw new w("radius is required.");return 2*t*Math.sin(e*.5)};ct.logBase=function(e,t){if(!l(e))throw new w("number is required.");if(!l(t))throw new w("base is required.");return Math.log(e)/Math.log(t)};ct.cbrt=A(Math.cbrt,function(t){const n=Math.pow(Math.abs(t),.3333333333333333);return t<0?-n:n});ct.log2=A(Math.log2,function(t){return Math.log(t)*Math.LOG2E});ct.fog=function(e,t){const n=e*t;return 1-Math.exp(-(n*n))};ct.fastApproximateAtan=function(e){return E.typeOf.number("x",e),e*(-.1784*Math.abs(e)-.0663*e*e+1.0301)};ct.fastApproximateAtan2=function(e,t){E.typeOf.number("x",e),E.typeOf.number("y",t);let n,i=Math.abs(e);n=Math.abs(t);const o=Math.max(i,n);n=Math.min(i,n);const r=n/o;if(isNaN(r))throw new w("either x or y must be nonzero");return i=ct.fastApproximateAtan(r),i=Math.abs(t)>Math.abs(e)?ct.PI_OVER_TWO-i:i,i=e<0?ct.PI-i:i,i=t<0?-i:i,i};const F=ct;function d(e,t,n){this.x=A(e,0),this.y=A(t,0),this.z=A(n,0)}d.fromSpherical=function(e,t){E.typeOf.object("spherical",e),l(t)||(t=new d);const n=e.clock,i=e.cone,o=A(e.magnitude,1),r=o*Math.sin(i);return t.x=r*Math.cos(n),t.y=r*Math.sin(n),t.z=o*Math.cos(i),t};d.fromElements=function(e,t,n,i){return l(i)?(i.x=e,i.y=t,i.z=n,i):new d(e,t,n)};d.clone=function(e,t){if(l(e))return l(t)?(t.x=e.x,t.y=e.y,t.z=e.z,t):new d(e.x,e.y,e.z)};d.fromCartesian4=d.clone;d.packedLength=3;d.pack=function(e,t,n){return E.typeOf.object("value",e),E.defined("array",t),n=A(n,0),t[n++]=e.x,t[n++]=e.y,t[n]=e.z,t};d.unpack=function(e,t,n){return E.defined("array",e),t=A(t,0),l(n)||(n=new d),n.x=e[t++],n.y=e[t++],n.z=e[t],n};d.packArray=function(e,t){E.defined("array",e);const n=e.length,i=n*3;if(!l(t))t=new Array(i);else{if(!Array.isArray(t)&&t.length!==i)throw new w("If result is a typed array, it must have exactly array.length * 3 elements");t.length!==i&&(t.length=i)}for(let o=0;o<n;++o)d.pack(e[o],t,o*3);return t};d.unpackArray=function(e,t){if(E.defined("array",e),E.typeOf.number.greaterThanOrEquals("array.length",e.length,3),e.length%3!==0)throw new w("array length must be a multiple of 3.");const n=e.length;l(t)?t.length=n/3:t=new Array(n/3);for(let i=0;i<n;i+=3){const o=i/3;t[o]=d.unpack(e,i,t[o])}return t};d.fromArray=d.unpack;d.maximumComponent=function(e){return E.typeOf.object("cartesian",e),Math.max(e.x,e.y,e.z)};d.minimumComponent=function(e){return E.typeOf.object("cartesian",e),Math.min(e.x,e.y,e.z)};d.minimumByComponent=function(e,t,n){return E.typeOf.object("first",e),E.typeOf.object("second",t),E.typeOf.object("result",n),n.x=Math.min(e.x,t.x),n.y=Math.min(e.y,t.y),n.z=Math.min(e.z,t.z),n};d.maximumByComponent=function(e,t,n){return E.typeOf.object("first",e),E.typeOf.object("second",t),E.typeOf.object("result",n),n.x=Math.max(e.x,t.x),n.y=Math.max(e.y,t.y),n.z=Math.max(e.z,t.z),n};d.clamp=function(e,t,n,i){E.typeOf.object("value",e),E.typeOf.object("min",t),E.typeOf.object("max",n),E.typeOf.object("result",i);const o=F.clamp(e.x,t.x,n.x),r=F.clamp(e.y,t.y,n.y),s=F.clamp(e.z,t.z,n.z);return i.x=o,i.y=r,i.z=s,i};d.magnitudeSquared=function(e){return E.typeOf.object("cartesian",e),e.x*e.x+e.y*e.y+e.z*e.z};d.magnitude=function(e){return Math.sqrt(d.magnitudeSquared(e))};const TI=new d;d.distance=function(e,t){return E.typeOf.object("left",e),E.typeOf.object("right",t),d.subtract(e,t,TI),d.magnitude(TI)};d.distanceSquared=function(e,t){return E.typeOf.object("left",e),E.typeOf.object("right",t),d.subtract(e,t,TI),d.magnitudeSquared(TI)};d.normalize=function(e,t){E.typeOf.object("cartesian",e),E.typeOf.object("result",t);const n=d.magnitude(e);if(t.x=e.x/n,t.y=e.y/n,t.z=e.z/n,isNaN(t.x)||isNaN(t.y)||isNaN(t.z))throw new w("normalized result is not a number");return t};d.dot=function(e,t){return E.typeOf.object("left",e),E.typeOf.object("right",t),e.x*t.x+e.y*t.y+e.z*t.z};d.multiplyComponents=function(e,t,n){return E.typeOf.object("left",e),E.typeOf.object("right",t),E.typeOf.object("result",n),n.x=e.x*t.x,n.y=e.y*t.y,n.z=e.z*t.z,n};d.divideComponents=function(e,t,n){return E.typeOf.object("left",e),E.typeOf.object("right",t),E.typeOf.object("result",n),n.x=e.x/t.x,n.y=e.y/t.y,n.z=e.z/t.z,n};d.add=function(e,t,n){return E.typeOf.object("left",e),E.typeOf.object("right",t),E.typeOf.object("result",n),n.x=e.x+t.x,n.y=e.y+t.y,n.z=e.z+t.z,n};d.subtract=function(e,t,n){return E.typeOf.object("left",e),E.typeOf.object("right",t),E.typeOf.object("result",n),n.x=e.x-t.x,n.y=e.y-t.y,n.z=e.z-t.z,n};d.multiplyByScalar=function(e,t,n){return E.typeOf.object("cartesian",e),E.typeOf.number("scalar",t),E.typeOf.object("result",n),n.x=e.x*t,n.y=e.y*t,n.z=e.z*t,n};d.divideByScalar=function(e,t,n){return E.typeOf.object("cartesian",e),E.typeOf.number("scalar",t),E.typeOf.object("result",n),n.x=e.x/t,n.y=e.y/t,n.z=e.z/t,n};d.negate=function(e,t){return E.typeOf.object("cartesian",e),E.typeOf.object("result",t),t.x=-e.x,t.y=-e.y,t.z=-e.z,t};d.abs=function(e,t){return E.typeOf.object("cartesian",e),E.typeOf.object("result",t),t.x=Math.abs(e.x),t.y=Math.abs(e.y),t.z=Math.abs(e.z),t};const vG=new d;d.lerp=function(e,t,n,i){return E.typeOf.object("start",e),E.typeOf.object("end",t),E.typeOf.number("t",n),E.typeOf.object("result",i),d.multiplyByScalar(t,n,vG),i=d.multiplyByScalar(e,1-n,i),d.add(vG,i,i)};const cS=new d,PL=new d;d.angleBetween=function(e,t){E.typeOf.object("left",e),E.typeOf.object("right",t),d.normalize(e,cS),d.normalize(t,PL);const n=d.dot(cS,PL),i=d.magnitude(d.cross(cS,PL,cS));return Math.atan2(i,n)};const bxe=new d;d.mostOrthogonalAxis=function(e,t){E.typeOf.object("cartesian",e),E.typeOf.object("result",t);const n=d.normalize(e,bxe);return d.abs(n,n),n.x<=n.y?n.x<=n.z?t=d.clone(d.UNIT_X,t):t=d.clone(d.UNIT_Z,t):n.y<=n.z?t=d.clone(d.UNIT_Y,t):t=d.clone(d.UNIT_Z,t),t};d.projectVector=function(e,t,n){E.defined("a",e),E.defined("b",t),E.defined("result",n);const i=d.dot(e,t)/d.dot(t,t);return d.multiplyByScalar(t,i,n)};d.equals=function(e,t){return e===t||l(e)&&l(t)&&e.x===t.x&&e.y===t.y&&e.z===t.z};d.equalsArray=function(e,t,n){return e.x===t[n]&&e.y===t[n+1]&&e.z===t[n+2]};d.equalsEpsilon=function(e,t,n,i){return e===t||l(e)&&l(t)&&F.equalsEpsilon(e.x,t.x,n,i)&&F.equalsEpsilon(e.y,t.y,n,i)&&F.equalsEpsilon(e.z,t.z,n,i)};d.cross=function(e,t,n){E.typeOf.object("left",e),E.typeOf.object("right",t),E.typeOf.object("result",n);const i=e.x,o=e.y,r=e.z,s=t.x,a=t.y,c=t.z,u=o*c-r*a,f=r*s-i*c,h=i*a-o*s;return n.x=u,n.y=f,n.z=h,n};d.midpoint=function(e,t,n){return E.typeOf.object("left",e),E.typeOf.object("right",t),E.typeOf.object("result",n),n.x=(e.x+t.x)*.5,n.y=(e.y+t.y)*.5,n.z=(e.z+t.z)*.5,n};d.fromDegrees=function(e,t,n,i,o){return E.typeOf.number("longitude",e),E.typeOf.number("latitude",t),e=F.toRadians(e),t=F.toRadians(t),d.fromRadians(e,t,n,i,o)};let Fl=new d,h0=new d;const Exe=new d(6378137*6378137,6378137*6378137,6356752314245179e-9*6356752314245179e-9);d.fromRadians=function(e,t,n,i,o){E.typeOf.number("longitude",e),E.typeOf.number("latitude",t),n=A(n,0);const r=l(i)?i.radiiSquared:Exe,s=Math.cos(t);Fl.x=s*Math.cos(e),Fl.y=s*Math.sin(e),Fl.z=Math.sin(t),Fl=d.normalize(Fl,Fl),d.multiplyComponents(r,Fl,h0);const a=Math.sqrt(d.dot(Fl,h0));return h0=d.divideByScalar(h0,a,h0),Fl=d.multiplyByScalar(Fl,n,Fl),l(o)||(o=new d),d.add(h0,Fl,o)};d.fromDegreesArray=function(e,t,n){if(E.defined("coordinates",e),e.length<2||e.length%2!==0)throw new w("the number of coordinates must be a multiple of 2 and at least 2");const i=e.length;l(n)?n.length=i/2:n=new Array(i/2);for(let o=0;o<i;o+=2){const r=e[o],s=e[o+1],a=o/2;n[a]=d.fromDegrees(r,s,0,t,n[a])}return n};d.fromRadiansArray=function(e,t,n){if(E.defined("coordinates",e),e.length<2||e.length%2!==0)throw new w("the number of coordinates must be a multiple of 2 and at least 2");const i=e.length;l(n)?n.length=i/2:n=new Array(i/2);for(let o=0;o<i;o+=2){const r=e[o],s=e[o+1],a=o/2;n[a]=d.fromRadians(r,s,0,t,n[a])}return n};d.fromDegreesArrayHeights=function(e,t,n){if(E.defined("coordinates",e),e.length<3||e.length%3!==0)throw new w("the number of coordinates must be a multiple of 3 and at least 3");const i=e.length;l(n)?n.length=i/3:n=new Array(i/3);for(let o=0;o<i;o+=3){const r=e[o],s=e[o+1],a=e[o+2],c=o/3;n[c]=d.fromDegrees(r,s,a,t,n[c])}return n};d.fromRadiansArrayHeights=function(e,t,n){if(E.defined("coordinates",e),e.length<3||e.length%3!==0)throw new w("the number of coordinates must be a multiple of 3 and at least 3");const i=e.length;l(n)?n.length=i/3:n=new Array(i/3);for(let o=0;o<i;o+=3){const r=e[o],s=e[o+1],a=e[o+2],c=o/3;n[c]=d.fromRadians(r,s,a,t,n[c])}return n};d.ZERO=Object.freeze(new d(0,0,0));d.ONE=Object.freeze(new d(1,1,1));d.UNIT_X=Object.freeze(new d(1,0,0));d.UNIT_Y=Object.freeze(new d(0,1,0));d.UNIT_Z=Object.freeze(new d(0,0,1));d.prototype.clone=function(e){return d.clone(this,e)};d.prototype.equals=function(e){return d.equals(this,e)};d.prototype.equalsEpsilon=function(e,t,n){return d.equalsEpsilon(this,e,t,n)};d.prototype.toString=function(){return`(${this.x}, ${this.y}, ${this.z})`};function ue(e,t,n,i){this.x=A(e,0),this.y=A(t,0),this.z=A(n,0),this.w=A(i,0)}ue.fromElements=function(e,t,n,i,o){return l(o)?(o.x=e,o.y=t,o.z=n,o.w=i,o):new ue(e,t,n,i)};ue.fromColor=function(e,t){return E.typeOf.object("color",e),l(t)?(t.x=e.red,t.y=e.green,t.z=e.blue,t.w=e.alpha,t):new ue(e.red,e.green,e.blue,e.alpha)};ue.clone=function(e,t){if(l(e))return l(t)?(t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t):new ue(e.x,e.y,e.z,e.w)};ue.packedLength=4;ue.pack=function(e,t,n){return E.typeOf.object("value",e),E.defined("array",t),n=A(n,0),t[n++]=e.x,t[n++]=e.y,t[n++]=e.z,t[n]=e.w,t};ue.unpack=function(e,t,n){return E.defined("array",e),t=A(t,0),l(n)||(n=new ue),n.x=e[t++],n.y=e[t++],n.z=e[t++],n.w=e[t],n};ue.packArray=function(e,t){E.defined("array",e);const n=e.length,i=n*4;if(!l(t))t=new Array(i);else{if(!Array.isArray(t)&&t.length!==i)throw new w("If result is a typed array, it must have exactly array.length * 4 elements");t.length!==i&&(t.length=i)}for(let o=0;o<n;++o)ue.pack(e[o],t,o*4);return t};ue.unpackArray=function(e,t){if(E.defined("array",e),E.typeOf.number.greaterThanOrEquals("array.length",e.length,4),e.length%4!==0)throw new w("array length must be a multiple of 4.");const n=e.length;l(t)?t.length=n/4:t=new Array(n/4);for(let i=0;i<n;i+=4){const o=i/4;t[o]=ue.unpack(e,i,t[o])}return t};ue.fromArray=ue.unpack;ue.maximumComponent=function(e){return E.typeOf.object("cartesian",e),Math.max(e.x,e.y,e.z,e.w)};ue.minimumComponent=function(e){return E.typeOf.object("cartesian",e),Math.min(e.x,e.y,e.z,e.w)};ue.minimumByComponent=function(e,t,n){return E.typeOf.object("first",e),E.typeOf.object("second",t),E.typeOf.object("result",n),n.x=Math.min(e.x,t.x),n.y=Math.min(e.y,t.y),n.z=Math.min(e.z,t.z),n.w=Math.min(e.w,t.w),n};ue.maximumByComponent=function(e,t,n){return E.typeOf.object("first",e),E.typeOf.object("second",t),E.typeOf.object("result",n),n.x=Math.max(e.x,t.x),n.y=Math.max(e.y,t.y),n.z=Math.max(e.z,t.z),n.w=Math.max(e.w,t.w),n};ue.clamp=function(e,t,n,i){E.typeOf.object("value",e),E.typeOf.object("min",t),E.typeOf.object("max",n),E.typeOf.object("result",i);const o=F.clamp(e.x,t.x,n.x),r=F.clamp(e.y,t.y,n.y),s=F.clamp(e.z,t.z,n.z),a=F.clamp(e.w,t.w,n.w);return i.x=o,i.y=r,i.z=s,i.w=a,i};ue.magnitudeSquared=function(e){return E.typeOf.object("cartesian",e),e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w};ue.magnitude=function(e){return Math.sqrt(ue.magnitudeSquared(e))};const CI=new ue;ue.distance=function(e,t){return E.typeOf.object("left",e),E.typeOf.object("right",t),ue.subtract(e,t,CI),ue.magnitude(CI)};ue.distanceSquared=function(e,t){return E.typeOf.object("left",e),E.typeOf.object("right",t),ue.subtract(e,t,CI),ue.magnitudeSquared(CI)};ue.normalize=function(e,t){E.typeOf.object("cartesian",e),E.typeOf.object("result",t);const n=ue.magnitude(e);if(t.x=e.x/n,t.y=e.y/n,t.z=e.z/n,t.w=e.w/n,isNaN(t.x)||isNaN(t.y)||isNaN(t.z)||isNaN(t.w))throw new w("normalized result is not a number");return t};ue.dot=function(e,t){return E.typeOf.object("left",e),E.typeOf.object("right",t),e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w};ue.multiplyComponents=function(e,t,n){return E.typeOf.object("left",e),E.typeOf.object("right",t),E.typeOf.object("result",n),n.x=e.x*t.x,n.y=e.y*t.y,n.z=e.z*t.z,n.w=e.w*t.w,n};ue.divideComponents=function(e,t,n){return E.typeOf.object("left",e),E.typeOf.object("right",t),E.typeOf.object("result",n),n.x=e.x/t.x,n.y=e.y/t.y,n.z=e.z/t.z,n.w=e.w/t.w,n};ue.add=function(e,t,n){return E.typeOf.object("left",e),E.typeOf.object("right",t),E.typeOf.object("result",n),n.x=e.x+t.x,n.y=e.y+t.y,n.z=e.z+t.z,n.w=e.w+t.w,n};ue.subtract=function(e,t,n){return E.typeOf.object("left",e),E.typeOf.object("right",t),E.typeOf.object("result",n),n.x=e.x-t.x,n.y=e.y-t.y,n.z=e.z-t.z,n.w=e.w-t.w,n};ue.multiplyByScalar=function(e,t,n){return E.typeOf.object("cartesian",e),E.typeOf.number("scalar",t),E.typeOf.object("result",n),n.x=e.x*t,n.y=e.y*t,n.z=e.z*t,n.w=e.w*t,n};ue.divideByScalar=function(e,t,n){return E.typeOf.object("cartesian",e),E.typeOf.number("scalar",t),E.typeOf.object("result",n),n.x=e.x/t,n.y=e.y/t,n.z=e.z/t,n.w=e.w/t,n};ue.negate=function(e,t){return E.typeOf.object("cartesian",e),E.typeOf.object("result",t),t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=-e.w,t};ue.abs=function(e,t){return E.typeOf.object("cartesian",e),E.typeOf.object("result",t),t.x=Math.abs(e.x),t.y=Math.abs(e.y),t.z=Math.abs(e.z),t.w=Math.abs(e.w),t};const DG=new ue;ue.lerp=function(e,t,n,i){return E.typeOf.object("start",e),E.typeOf.object("end",t),E.typeOf.number("t",n),E.typeOf.object("result",i),ue.multiplyByScalar(t,n,DG),i=ue.multiplyByScalar(e,1-n,i),ue.add(DG,i,i)};const xxe=new ue;ue.mostOrthogonalAxis=function(e,t){E.typeOf.object("cartesian",e),E.typeOf.object("result",t);const n=ue.normalize(e,xxe);return ue.abs(n,n),n.x<=n.y?n.x<=n.z?n.x<=n.w?t=ue.clone(ue.UNIT_X,t):t=ue.clone(ue.UNIT_W,t):n.z<=n.w?t=ue.clone(ue.UNIT_Z,t):t=ue.clone(ue.UNIT_W,t):n.y<=n.z?n.y<=n.w?t=ue.clone(ue.UNIT_Y,t):t=ue.clone(ue.UNIT_W,t):n.z<=n.w?t=ue.clone(ue.UNIT_Z,t):t=ue.clone(ue.UNIT_W,t),t};ue.equals=function(e,t){return e===t||l(e)&&l(t)&&e.x===t.x&&e.y===t.y&&e.z===t.z&&e.w===t.w};ue.equalsArray=function(e,t,n){return e.x===t[n]&&e.y===t[n+1]&&e.z===t[n+2]&&e.w===t[n+3]};ue.equalsEpsilon=function(e,t,n,i){return e===t||l(e)&&l(t)&&F.equalsEpsilon(e.x,t.x,n,i)&&F.equalsEpsilon(e.y,t.y,n,i)&&F.equalsEpsilon(e.z,t.z,n,i)&&F.equalsEpsilon(e.w,t.w,n,i)};ue.ZERO=Object.freeze(new ue(0,0,0,0));ue.ONE=Object.freeze(new ue(1,1,1,1));ue.UNIT_X=Object.freeze(new ue(1,0,0,0));ue.UNIT_Y=Object.freeze(new ue(0,1,0,0));ue.UNIT_Z=Object.freeze(new ue(0,0,1,0));ue.UNIT_W=Object.freeze(new ue(0,0,0,1));ue.prototype.clone=function(e){return ue.clone(this,e)};ue.prototype.equals=function(e){return ue.equals(this,e)};ue.prototype.equalsEpsilon=function(e,t,n){return ue.equalsEpsilon(this,e,t,n)};ue.prototype.toString=function(){return`(${this.x}, ${this.y}, ${this.z}, ${this.w})`};const D3=new Float32Array(1),Da=new Uint8Array(D3.buffer),wxe=new Uint32Array([287454020]),Sxe=new Uint8Array(wxe.buffer),hX=Sxe[0]===68;ue.packFloat=function(e,t){return E.typeOf.number("value",e),l(t)||(t=new ue),D3[0]=e,hX?(t.x=Da[0],t.y=Da[1],t.z=Da[2],t.w=Da[3]):(t.x=Da[3],t.y=Da[2],t.z=Da[1],t.w=Da[0]),t};ue.unpackFloat=function(e){return E.typeOf.object("packedFloat",e),hX?(Da[0]=e.x,Da[1]=e.y,Da[2]=e.z,Da[3]=e.w):(Da[0]=e.w,Da[1]=e.z,Da[2]=e.y,Da[3]=e.x),D3[0]};function te(e,t,n,i,o,r,s,a,c){this[0]=A(e,0),this[1]=A(i,0),this[2]=A(s,0),this[3]=A(t,0),this[4]=A(o,0),this[5]=A(a,0),this[6]=A(n,0),this[7]=A(r,0),this[8]=A(c,0)}te.packedLength=9;te.pack=function(e,t,n){return E.typeOf.object("value",e),E.defined("array",t),n=A(n,0),t[n++]=e[0],t[n++]=e[1],t[n++]=e[2],t[n++]=e[3],t[n++]=e[4],t[n++]=e[5],t[n++]=e[6],t[n++]=e[7],t[n++]=e[8],t};te.unpack=function(e,t,n){return E.defined("array",e),t=A(t,0),l(n)||(n=new te),n[0]=e[t++],n[1]=e[t++],n[2]=e[t++],n[3]=e[t++],n[4]=e[t++],n[5]=e[t++],n[6]=e[t++],n[7]=e[t++],n[8]=e[t++],n};te.packArray=function(e,t){E.defined("array",e);const n=e.length,i=n*9;if(!l(t))t=new Array(i);else{if(!Array.isArray(t)&&t.length!==i)throw new w("If result is a typed array, it must have exactly array.length * 9 elements");t.length!==i&&(t.length=i)}for(let o=0;o<n;++o)te.pack(e[o],t,o*9);return t};te.unpackArray=function(e,t){if(E.defined("array",e),E.typeOf.number.greaterThanOrEquals("array.length",e.length,9),e.length%9!==0)throw new w("array length must be a multiple of 9.");const n=e.length;l(t)?t.length=n/9:t=new Array(n/9);for(let i=0;i<n;i+=9){const o=i/9;t[o]=te.unpack(e,i,t[o])}return t};te.clone=function(e,t){if(l(e))return l(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t):new te(e[0],e[3],e[6],e[1],e[4],e[7],e[2],e[5],e[8])};te.fromArray=te.unpack;te.fromColumnMajorArray=function(e,t){return E.defined("values",e),te.clone(e,t)};te.fromRowMajorArray=function(e,t){return E.defined("values",e),l(t)?(t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],t):new te(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])};te.fromQuaternion=function(e,t){E.typeOf.object("quaternion",e);const n=e.x*e.x,i=e.x*e.y,o=e.x*e.z,r=e.x*e.w,s=e.y*e.y,a=e.y*e.z,c=e.y*e.w,u=e.z*e.z,f=e.z*e.w,h=e.w*e.w,_=n-s-u+h,g=2*(i-f),p=2*(o+c),y=2*(i+f),T=-n+s-u+h,b=2*(a-r),x=2*(o-c),v=2*(a+r),D=-n-s+u+h;return l(t)?(t[0]=_,t[1]=y,t[2]=x,t[3]=g,t[4]=T,t[5]=v,t[6]=p,t[7]=b,t[8]=D,t):new te(_,g,p,y,T,b,x,v,D)};te.fromHeadingPitchRoll=function(e,t){E.typeOf.object("headingPitchRoll",e);const n=Math.cos(-e.pitch),i=Math.cos(-e.heading),o=Math.cos(e.roll),r=Math.sin(-e.pitch),s=Math.sin(-e.heading),a=Math.sin(e.roll),c=n*i,u=-o*s+a*r*i,f=a*s+o*r*i,h=n*s,_=o*i+a*r*s,g=-a*i+o*r*s,p=-r,y=a*n,T=o*n;return l(t)?(t[0]=c,t[1]=h,t[2]=p,t[3]=u,t[4]=_,t[5]=y,t[6]=f,t[7]=g,t[8]=T,t):new te(c,u,f,h,_,g,p,y,T)};te.fromScale=function(e,t){return E.typeOf.object("scale",e),l(t)?(t[0]=e.x,t[1]=0,t[2]=0,t[3]=0,t[4]=e.y,t[5]=0,t[6]=0,t[7]=0,t[8]=e.z,t):new te(e.x,0,0,0,e.y,0,0,0,e.z)};te.fromUniformScale=function(e,t){return E.typeOf.number("scale",e),l(t)?(t[0]=e,t[1]=0,t[2]=0,t[3]=0,t[4]=e,t[5]=0,t[6]=0,t[7]=0,t[8]=e,t):new te(e,0,0,0,e,0,0,0,e)};te.fromCrossProduct=function(e,t){return E.typeOf.object("vector",e),l(t)?(t[0]=0,t[1]=e.z,t[2]=-e.y,t[3]=-e.z,t[4]=0,t[5]=e.x,t[6]=e.y,t[7]=-e.x,t[8]=0,t):new te(0,-e.z,e.y,e.z,0,-e.x,-e.y,e.x,0)};te.fromRotationX=function(e,t){E.typeOf.number("angle",e);const n=Math.cos(e),i=Math.sin(e);return l(t)?(t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=n,t[5]=i,t[6]=0,t[7]=-i,t[8]=n,t):new te(1,0,0,0,n,-i,0,i,n)};te.fromRotationY=function(e,t){E.typeOf.number("angle",e);const n=Math.cos(e),i=Math.sin(e);return l(t)?(t[0]=n,t[1]=0,t[2]=-i,t[3]=0,t[4]=1,t[5]=0,t[6]=i,t[7]=0,t[8]=n,t):new te(n,0,i,0,1,0,-i,0,n)};te.fromRotationZ=function(e,t){E.typeOf.number("angle",e);const n=Math.cos(e),i=Math.sin(e);return l(t)?(t[0]=n,t[1]=i,t[2]=0,t[3]=-i,t[4]=n,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t):new te(n,-i,0,i,n,0,0,0,1)};te.toArray=function(e,t){return E.typeOf.object("matrix",e),l(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t):[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8]]};te.getElementIndex=function(e,t){return E.typeOf.number.greaterThanOrEquals("row",t,0),E.typeOf.number.lessThanOrEquals("row",t,2),E.typeOf.number.greaterThanOrEquals("column",e,0),E.typeOf.number.lessThanOrEquals("column",e,2),e*3+t};te.getColumn=function(e,t,n){E.typeOf.object("matrix",e),E.typeOf.number.greaterThanOrEquals("index",t,0),E.typeOf.number.lessThanOrEquals("index",t,2),E.typeOf.object("result",n);const i=t*3,o=e[i],r=e[i+1],s=e[i+2];return n.x=o,n.y=r,n.z=s,n};te.setColumn=function(e,t,n,i){E.typeOf.object("matrix",e),E.typeOf.number.greaterThanOrEquals("index",t,0),E.typeOf.number.lessThanOrEquals("index",t,2),E.typeOf.object("cartesian",n),E.typeOf.object("result",i),i=te.clone(e,i);const o=t*3;return i[o]=n.x,i[o+1]=n.y,i[o+2]=n.z,i};te.getRow=function(e,t,n){E.typeOf.object("matrix",e),E.typeOf.number.greaterThanOrEquals("index",t,0),E.typeOf.number.lessThanOrEquals("index",t,2),E.typeOf.object("result",n);const i=e[t],o=e[t+3],r=e[t+6];return n.x=i,n.y=o,n.z=r,n};te.setRow=function(e,t,n,i){return E.typeOf.object("matrix",e),E.typeOf.number.greaterThanOrEquals("index",t,0),E.typeOf.number.lessThanOrEquals("index",t,2),E.typeOf.object("cartesian",n),E.typeOf.object("result",i),i=te.clone(e,i),i[t]=n.x,i[t+3]=n.y,i[t+6]=n.z,i};const vxe=new d;te.setScale=function(e,t,n){E.typeOf.object("matrix",e),E.typeOf.object("scale",t),E.typeOf.object("result",n);const i=te.getScale(e,vxe),o=t.x/i.x,r=t.y/i.y,s=t.z/i.z;return n[0]=e[0]*o,n[1]=e[1]*o,n[2]=e[2]*o,n[3]=e[3]*r,n[4]=e[4]*r,n[5]=e[5]*r,n[6]=e[6]*s,n[7]=e[7]*s,n[8]=e[8]*s,n};const Dxe=new d;te.setUniformScale=function(e,t,n){E.typeOf.object("matrix",e),E.typeOf.number("scale",t),E.typeOf.object("result",n);const i=te.getScale(e,Dxe),o=t/i.x,r=t/i.y,s=t/i.z;return n[0]=e[0]*o,n[1]=e[1]*o,n[2]=e[2]*o,n[3]=e[3]*r,n[4]=e[4]*r,n[5]=e[5]*r,n[6]=e[6]*s,n[7]=e[7]*s,n[8]=e[8]*s,n};const OL=new d;te.getScale=function(e,t){return E.typeOf.object("matrix",e),E.typeOf.object("result",t),t.x=d.magnitude(d.fromElements(e[0],e[1],e[2],OL)),t.y=d.magnitude(d.fromElements(e[3],e[4],e[5],OL)),t.z=d.magnitude(d.fromElements(e[6],e[7],e[8],OL)),t};const IG=new d;te.getMaximumScale=function(e){return te.getScale(e,IG),d.maximumComponent(IG)};const Ixe=new d;te.setRotation=function(e,t,n){E.typeOf.object("matrix",e),E.typeOf.object("result",n);const i=te.getScale(e,Ixe);return n[0]=t[0]*i.x,n[1]=t[1]*i.x,n[2]=t[2]*i.x,n[3]=t[3]*i.y,n[4]=t[4]*i.y,n[5]=t[5]*i.y,n[6]=t[6]*i.z,n[7]=t[7]*i.z,n[8]=t[8]*i.z,n};const Pxe=new d;te.getRotation=function(e,t){E.typeOf.object("matrix",e),E.typeOf.object("result",t);const n=te.getScale(e,Pxe);return t[0]=e[0]/n.x,t[1]=e[1]/n.x,t[2]=e[2]/n.x,t[3]=e[3]/n.y,t[4]=e[4]/n.y,t[5]=e[5]/n.y,t[6]=e[6]/n.z,t[7]=e[7]/n.z,t[8]=e[8]/n.z,t};te.multiply=function(e,t,n){E.typeOf.object("left",e),E.typeOf.object("right",t),E.typeOf.object("result",n);const i=e[0]*t[0]+e[3]*t[1]+e[6]*t[2],o=e[1]*t[0]+e[4]*t[1]+e[7]*t[2],r=e[2]*t[0]+e[5]*t[1]+e[8]*t[2],s=e[0]*t[3]+e[3]*t[4]+e[6]*t[5],a=e[1]*t[3]+e[4]*t[4]+e[7]*t[5],c=e[2]*t[3]+e[5]*t[4]+e[8]*t[5],u=e[0]*t[6]+e[3]*t[7]+e[6]*t[8],f=e[1]*t[6]+e[4]*t[7]+e[7]*t[8],h=e[2]*t[6]+e[5]*t[7]+e[8]*t[8];return n[0]=i,n[1]=o,n[2]=r,n[3]=s,n[4]=a,n[5]=c,n[6]=u,n[7]=f,n[8]=h,n};te.add=function(e,t,n){return E.typeOf.object("left",e),E.typeOf.object("right",t),E.typeOf.object("result",n),n[0]=e[0]+t[0],n[1]=e[1]+t[1],n[2]=e[2]+t[2],n[3]=e[3]+t[3],n[4]=e[4]+t[4],n[5]=e[5]+t[5],n[6]=e[6]+t[6],n[7]=e[7]+t[7],n[8]=e[8]+t[8],n};te.subtract=function(e,t,n){return E.typeOf.object("left",e),E.typeOf.object("right",t),E.typeOf.object("result",n),n[0]=e[0]-t[0],n[1]=e[1]-t[1],n[2]=e[2]-t[2],n[3]=e[3]-t[3],n[4]=e[4]-t[4],n[5]=e[5]-t[5],n[6]=e[6]-t[6],n[7]=e[7]-t[7],n[8]=e[8]-t[8],n};te.multiplyByVector=function(e,t,n){E.typeOf.object("matrix",e),E.typeOf.object("cartesian",t),E.typeOf.object("result",n);const i=t.x,o=t.y,r=t.z,s=e[0]*i+e[3]*o+e[6]*r,a=e[1]*i+e[4]*o+e[7]*r,c=e[2]*i+e[5]*o+e[8]*r;return n.x=s,n.y=a,n.z=c,n};te.multiplyByScalar=function(e,t,n){return E.typeOf.object("matrix",e),E.typeOf.number("scalar",t),E.typeOf.object("result",n),n[0]=e[0]*t,n[1]=e[1]*t,n[2]=e[2]*t,n[3]=e[3]*t,n[4]=e[4]*t,n[5]=e[5]*t,n[6]=e[6]*t,n[7]=e[7]*t,n[8]=e[8]*t,n};te.multiplyByScale=function(e,t,n){return E.typeOf.object("matrix",e),E.typeOf.object("scale",t),E.typeOf.object("result",n),n[0]=e[0]*t.x,n[1]=e[1]*t.x,n[2]=e[2]*t.x,n[3]=e[3]*t.y,n[4]=e[4]*t.y,n[5]=e[5]*t.y,n[6]=e[6]*t.z,n[7]=e[7]*t.z,n[8]=e[8]*t.z,n};te.multiplyByUniformScale=function(e,t,n){return E.typeOf.object("matrix",e),E.typeOf.number("scale",t),E.typeOf.object("result",n),n[0]=e[0]*t,n[1]=e[1]*t,n[2]=e[2]*t,n[3]=e[3]*t,n[4]=e[4]*t,n[5]=e[5]*t,n[6]=e[6]*t,n[7]=e[7]*t,n[8]=e[8]*t,n};te.negate=function(e,t){return E.typeOf.object("matrix",e),E.typeOf.object("result",t),t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t[4]=-e[4],t[5]=-e[5],t[6]=-e[6],t[7]=-e[7],t[8]=-e[8],t};te.transpose=function(e,t){E.typeOf.object("matrix",e),E.typeOf.object("result",t);const n=e[0],i=e[3],o=e[6],r=e[1],s=e[4],a=e[7],c=e[2],u=e[5],f=e[8];return t[0]=n,t[1]=i,t[2]=o,t[3]=r,t[4]=s,t[5]=a,t[6]=c,t[7]=u,t[8]=f,t};function Oxe(e){let t=0;for(let n=0;n<9;++n){const i=e[n];t+=i*i}return Math.sqrt(t)}const NM=[1,0,0],MM=[2,2,1];function Lxe(e){let t=0;for(let n=0;n<3;++n){const i=e[te.getElementIndex(MM[n],NM[n])];t+=2*i*i}return Math.sqrt(t)}function Bxe(e,t){const n=F.EPSILON15;let i=0,o=1;for(let u=0;u<3;++u){const f=Math.abs(e[te.getElementIndex(MM[u],NM[u])]);f>i&&(o=u,i=f)}let r=1,s=0;const a=NM[o],c=MM[o];if(Math.abs(e[te.getElementIndex(c,a)])>n){const u=e[te.getElementIndex(c,c)],f=e[te.getElementIndex(a,a)],h=e[te.getElementIndex(c,a)],_=(u-f)/2/h;let g;_<0?g=-1/(-_+Math.sqrt(1+_*_)):g=1/(_+Math.sqrt(1+_*_)),r=1/Math.sqrt(1+g*g),s=g*r}return t=te.clone(te.IDENTITY,t),t[te.getElementIndex(a,a)]=t[te.getElementIndex(c,c)]=r,t[te.getElementIndex(c,a)]=s,t[te.getElementIndex(a,c)]=-s,t}const lS=new te,PG=new te;te.computeEigenDecomposition=function(e,t){E.typeOf.object("matrix",e);const n=F.EPSILON20,i=10;let o=0,r=0;l(t)||(t={});const s=t.unitary=te.clone(te.IDENTITY,t.unitary),a=t.diagonal=te.clone(e,t.diagonal),c=n*Oxe(a);for(;r<i&&Lxe(a)>c;)Bxe(a,lS),te.transpose(lS,PG),te.multiply(a,lS,a),te.multiply(PG,a,a),te.multiply(s,lS,s),++o>2&&(++r,o=0);return t};te.abs=function(e,t){return E.typeOf.object("matrix",e),E.typeOf.object("result",t),t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t[2]=Math.abs(e[2]),t[3]=Math.abs(e[3]),t[4]=Math.abs(e[4]),t[5]=Math.abs(e[5]),t[6]=Math.abs(e[6]),t[7]=Math.abs(e[7]),t[8]=Math.abs(e[8]),t};te.determinant=function(e){E.typeOf.object("matrix",e);const t=e[0],n=e[3],i=e[6],o=e[1],r=e[4],s=e[7],a=e[2],c=e[5],u=e[8];return t*(r*u-c*s)+o*(c*i-n*u)+a*(n*s-r*i)};te.inverse=function(e,t){E.typeOf.object("matrix",e),E.typeOf.object("result",t);const n=e[0],i=e[1],o=e[2],r=e[3],s=e[4],a=e[5],c=e[6],u=e[7],f=e[8],h=te.determinant(e);if(Math.abs(h)<=F.EPSILON15)throw new w("matrix is not invertible");t[0]=s*f-u*a,t[1]=u*o-i*f,t[2]=i*a-s*o,t[3]=c*a-r*f,t[4]=n*f-c*o,t[5]=r*o-n*a,t[6]=r*u-c*s,t[7]=c*i-n*u,t[8]=n*s-r*i;const _=1/h;return te.multiplyByScalar(t,_,t)};const Rxe=new te;te.inverseTranspose=function(e,t){return E.typeOf.object("matrix",e),E.typeOf.object("result",t),te.inverse(te.transpose(e,Rxe),t)};te.equals=function(e,t){return e===t||l(e)&&l(t)&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]};te.equalsEpsilon=function(e,t,n){return n=A(n,0),e===t||l(e)&&l(t)&&Math.abs(e[0]-t[0])<=n&&Math.abs(e[1]-t[1])<=n&&Math.abs(e[2]-t[2])<=n&&Math.abs(e[3]-t[3])<=n&&Math.abs(e[4]-t[4])<=n&&Math.abs(e[5]-t[5])<=n&&Math.abs(e[6]-t[6])<=n&&Math.abs(e[7]-t[7])<=n&&Math.abs(e[8]-t[8])<=n};te.IDENTITY=Object.freeze(new te(1,0,0,0,1,0,0,0,1));te.ZERO=Object.freeze(new te(0,0,0,0,0,0,0,0,0));te.COLUMN0ROW0=0;te.COLUMN0ROW1=1;te.COLUMN0ROW2=2;te.COLUMN1ROW0=3;te.COLUMN1ROW1=4;te.COLUMN1ROW2=5;te.COLUMN2ROW0=6;te.COLUMN2ROW1=7;te.COLUMN2ROW2=8;Object.defineProperties(te.prototype,{length:{get:function(){return te.packedLength}}});te.prototype.clone=function(e){return te.clone(this,e)};te.prototype.equals=function(e){return te.equals(this,e)};te.equalsArray=function(e,t,n){return e[0]===t[n]&&e[1]===t[n+1]&&e[2]===t[n+2]&&e[3]===t[n+3]&&e[4]===t[n+4]&&e[5]===t[n+5]&&e[6]===t[n+6]&&e[7]===t[n+7]&&e[8]===t[n+8]};te.prototype.equalsEpsilon=function(e,t){return te.equalsEpsilon(this,e,t)};te.prototype.toString=function(){return`(${this[0]}, ${this[3]}, ${this[6]})
|
||
(${this[1]}, ${this[4]}, ${this[7]})
|
||
(${this[2]}, ${this[5]}, ${this[8]})`};function Fe(e){this.name="RuntimeError",this.message=e;let t;try{throw new Error}catch(n){t=n.stack}this.stack=t}l(Object.create)&&(Fe.prototype=Object.create(Error.prototype),Fe.prototype.constructor=Fe);Fe.prototype.toString=function(){let e=`${this.name}: ${this.message}`;return l(this.stack)&&(e+=`
|
||
${this.stack.toString()}`),e};function N(e,t,n,i,o,r,s,a,c,u,f,h,_,g,p,y){this[0]=A(e,0),this[1]=A(o,0),this[2]=A(c,0),this[3]=A(_,0),this[4]=A(t,0),this[5]=A(r,0),this[6]=A(u,0),this[7]=A(g,0),this[8]=A(n,0),this[9]=A(s,0),this[10]=A(f,0),this[11]=A(p,0),this[12]=A(i,0),this[13]=A(a,0),this[14]=A(h,0),this[15]=A(y,0)}N.packedLength=16;N.pack=function(e,t,n){return E.typeOf.object("value",e),E.defined("array",t),n=A(n,0),t[n++]=e[0],t[n++]=e[1],t[n++]=e[2],t[n++]=e[3],t[n++]=e[4],t[n++]=e[5],t[n++]=e[6],t[n++]=e[7],t[n++]=e[8],t[n++]=e[9],t[n++]=e[10],t[n++]=e[11],t[n++]=e[12],t[n++]=e[13],t[n++]=e[14],t[n]=e[15],t};N.unpack=function(e,t,n){return E.defined("array",e),t=A(t,0),l(n)||(n=new N),n[0]=e[t++],n[1]=e[t++],n[2]=e[t++],n[3]=e[t++],n[4]=e[t++],n[5]=e[t++],n[6]=e[t++],n[7]=e[t++],n[8]=e[t++],n[9]=e[t++],n[10]=e[t++],n[11]=e[t++],n[12]=e[t++],n[13]=e[t++],n[14]=e[t++],n[15]=e[t],n};N.packArray=function(e,t){E.defined("array",e);const n=e.length,i=n*16;if(!l(t))t=new Array(i);else{if(!Array.isArray(t)&&t.length!==i)throw new w("If result is a typed array, it must have exactly array.length * 16 elements");t.length!==i&&(t.length=i)}for(let o=0;o<n;++o)N.pack(e[o],t,o*16);return t};N.unpackArray=function(e,t){if(E.defined("array",e),E.typeOf.number.greaterThanOrEquals("array.length",e.length,16),e.length%16!==0)throw new w("array length must be a multiple of 16.");const n=e.length;l(t)?t.length=n/16:t=new Array(n/16);for(let i=0;i<n;i+=16){const o=i/16;t[o]=N.unpack(e,i,t[o])}return t};N.clone=function(e,t){if(l(e))return l(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t):new N(e[0],e[4],e[8],e[12],e[1],e[5],e[9],e[13],e[2],e[6],e[10],e[14],e[3],e[7],e[11],e[15])};N.fromArray=N.unpack;N.fromColumnMajorArray=function(e,t){return E.defined("values",e),N.clone(e,t)};N.fromRowMajorArray=function(e,t){return E.defined("values",e),l(t)?(t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15],t):new N(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])};N.fromRotationTranslation=function(e,t,n){return E.typeOf.object("rotation",e),t=A(t,d.ZERO),l(n)?(n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=0,n[4]=e[3],n[5]=e[4],n[6]=e[5],n[7]=0,n[8]=e[6],n[9]=e[7],n[10]=e[8],n[11]=0,n[12]=t.x,n[13]=t.y,n[14]=t.z,n[15]=1,n):new N(e[0],e[3],e[6],t.x,e[1],e[4],e[7],t.y,e[2],e[5],e[8],t.z,0,0,0,1)};N.fromTranslationQuaternionRotationScale=function(e,t,n,i){E.typeOf.object("translation",e),E.typeOf.object("rotation",t),E.typeOf.object("scale",n),l(i)||(i=new N);const o=n.x,r=n.y,s=n.z,a=t.x*t.x,c=t.x*t.y,u=t.x*t.z,f=t.x*t.w,h=t.y*t.y,_=t.y*t.z,g=t.y*t.w,p=t.z*t.z,y=t.z*t.w,T=t.w*t.w,b=a-h-p+T,x=2*(c-y),v=2*(u+g),D=2*(c+y),L=-a+h-p+T,B=2*(_-f),V=2*(u-g),M=2*(_+f),H=-a-h+p+T;return i[0]=b*o,i[1]=D*o,i[2]=V*o,i[3]=0,i[4]=x*r,i[5]=L*r,i[6]=M*r,i[7]=0,i[8]=v*s,i[9]=B*s,i[10]=H*s,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,i};N.fromTranslationRotationScale=function(e,t){return E.typeOf.object("translationRotationScale",e),N.fromTranslationQuaternionRotationScale(e.translation,e.rotation,e.scale,t)};N.fromTranslation=function(e,t){return E.typeOf.object("translation",e),N.fromRotationTranslation(te.IDENTITY,e,t)};N.fromScale=function(e,t){return E.typeOf.object("scale",e),l(t)?(t[0]=e.x,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e.y,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e.z,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t):new N(e.x,0,0,0,0,e.y,0,0,0,0,e.z,0,0,0,0,1)};N.fromUniformScale=function(e,t){return E.typeOf.number("scale",e),l(t)?(t[0]=e,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t):new N(e,0,0,0,0,e,0,0,0,0,e,0,0,0,0,1)};N.fromRotation=function(e,t){return E.typeOf.object("rotation",e),l(t)||(t=new N),t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=0,t[4]=e[3],t[5]=e[4],t[6]=e[5],t[7]=0,t[8]=e[6],t[9]=e[7],t[10]=e[8],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t};const p0=new d,m0=new d,hC=new d;N.fromCamera=function(e,t){E.typeOf.object("camera",e);const n=e.position,i=e.direction,o=e.up;E.typeOf.object("camera.position",n),E.typeOf.object("camera.direction",i),E.typeOf.object("camera.up",o),d.normalize(i,p0),d.normalize(d.cross(p0,o,m0),m0),d.normalize(d.cross(m0,p0,hC),hC);const r=m0.x,s=m0.y,a=m0.z,c=p0.x,u=p0.y,f=p0.z,h=hC.x,_=hC.y,g=hC.z,p=n.x,y=n.y,T=n.z,b=r*-p+s*-y+a*-T,x=h*-p+_*-y+g*-T,v=c*p+u*y+f*T;return l(t)?(t[0]=r,t[1]=h,t[2]=-c,t[3]=0,t[4]=s,t[5]=_,t[6]=-u,t[7]=0,t[8]=a,t[9]=g,t[10]=-f,t[11]=0,t[12]=b,t[13]=x,t[14]=v,t[15]=1,t):new N(r,s,a,b,h,_,g,x,-c,-u,-f,v,0,0,0,1)};N.computePerspectiveFieldOfView=function(e,t,n,i,o){E.typeOf.number.greaterThan("fovY",e,0),E.typeOf.number.lessThan("fovY",e,Math.PI),E.typeOf.number.greaterThan("near",n,0),E.typeOf.number.greaterThan("far",i,0),E.typeOf.object("result",o);const s=1/Math.tan(e*.5),a=s/t,c=(i+n)/(n-i),u=2*i*n/(n-i);return o[0]=a,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=s,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=c,o[11]=-1,o[12]=0,o[13]=0,o[14]=u,o[15]=0,o};N.computeOrthographicOffCenter=function(e,t,n,i,o,r,s){E.typeOf.number("left",e),E.typeOf.number("right",t),E.typeOf.number("bottom",n),E.typeOf.number("top",i),E.typeOf.number("near",o),E.typeOf.number("far",r),E.typeOf.object("result",s);let a=1/(t-e),c=1/(i-n),u=1/(r-o);const f=-(t+e)*a,h=-(i+n)*c,_=-(r+o)*u;return a*=2,c*=2,u*=-2,s[0]=a,s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[5]=c,s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[10]=u,s[11]=0,s[12]=f,s[13]=h,s[14]=_,s[15]=1,s};N.computePerspectiveOffCenter=function(e,t,n,i,o,r,s){E.typeOf.number("left",e),E.typeOf.number("right",t),E.typeOf.number("bottom",n),E.typeOf.number("top",i),E.typeOf.number("near",o),E.typeOf.number("far",r),E.typeOf.object("result",s);const a=2*o/(t-e),c=2*o/(i-n),u=(t+e)/(t-e),f=(i+n)/(i-n),h=-(r+o)/(r-o),_=-1,g=-2*r*o/(r-o);return s[0]=a,s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[5]=c,s[6]=0,s[7]=0,s[8]=u,s[9]=f,s[10]=h,s[11]=_,s[12]=0,s[13]=0,s[14]=g,s[15]=0,s};N.computeInfinitePerspectiveOffCenter=function(e,t,n,i,o,r){E.typeOf.number("left",e),E.typeOf.number("right",t),E.typeOf.number("bottom",n),E.typeOf.number("top",i),E.typeOf.number("near",o),E.typeOf.object("result",r);const s=2*o/(t-e),a=2*o/(i-n),c=(t+e)/(t-e),u=(i+n)/(i-n),f=-1,h=-1,_=-2*o;return r[0]=s,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=a,r[6]=0,r[7]=0,r[8]=c,r[9]=u,r[10]=f,r[11]=h,r[12]=0,r[13]=0,r[14]=_,r[15]=0,r};N.computeViewportTransformation=function(e,t,n,i){l(i)||(i=new N),e=A(e,A.EMPTY_OBJECT);const o=A(e.x,0),r=A(e.y,0),s=A(e.width,0),a=A(e.height,0);t=A(t,0),n=A(n,1);const c=s*.5,u=a*.5,f=(n-t)*.5,h=c,_=u,g=f,p=o+c,y=r+u,T=t+f,b=1;return i[0]=h,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=_,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=g,i[11]=0,i[12]=p,i[13]=y,i[14]=T,i[15]=b,i};N.computeView=function(e,t,n,i,o){return E.typeOf.object("position",e),E.typeOf.object("direction",t),E.typeOf.object("up",n),E.typeOf.object("right",i),E.typeOf.object("result",o),o[0]=i.x,o[1]=n.x,o[2]=-t.x,o[3]=0,o[4]=i.y,o[5]=n.y,o[6]=-t.y,o[7]=0,o[8]=i.z,o[9]=n.z,o[10]=-t.z,o[11]=0,o[12]=-d.dot(i,e),o[13]=-d.dot(n,e),o[14]=d.dot(t,e),o[15]=1,o};N.toArray=function(e,t){return E.typeOf.object("matrix",e),l(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t):[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15]]};N.getElementIndex=function(e,t){return E.typeOf.number.greaterThanOrEquals("row",t,0),E.typeOf.number.lessThanOrEquals("row",t,3),E.typeOf.number.greaterThanOrEquals("column",e,0),E.typeOf.number.lessThanOrEquals("column",e,3),e*4+t};N.getColumn=function(e,t,n){E.typeOf.object("matrix",e),E.typeOf.number.greaterThanOrEquals("index",t,0),E.typeOf.number.lessThanOrEquals("index",t,3),E.typeOf.object("result",n);const i=t*4,o=e[i],r=e[i+1],s=e[i+2],a=e[i+3];return n.x=o,n.y=r,n.z=s,n.w=a,n};N.setColumn=function(e,t,n,i){E.typeOf.object("matrix",e),E.typeOf.number.greaterThanOrEquals("index",t,0),E.typeOf.number.lessThanOrEquals("index",t,3),E.typeOf.object("cartesian",n),E.typeOf.object("result",i),i=N.clone(e,i);const o=t*4;return i[o]=n.x,i[o+1]=n.y,i[o+2]=n.z,i[o+3]=n.w,i};N.getRow=function(e,t,n){E.typeOf.object("matrix",e),E.typeOf.number.greaterThanOrEquals("index",t,0),E.typeOf.number.lessThanOrEquals("index",t,3),E.typeOf.object("result",n);const i=e[t],o=e[t+4],r=e[t+8],s=e[t+12];return n.x=i,n.y=o,n.z=r,n.w=s,n};N.setRow=function(e,t,n,i){return E.typeOf.object("matrix",e),E.typeOf.number.greaterThanOrEquals("index",t,0),E.typeOf.number.lessThanOrEquals("index",t,3),E.typeOf.object("cartesian",n),E.typeOf.object("result",i),i=N.clone(e,i),i[t]=n.x,i[t+4]=n.y,i[t+8]=n.z,i[t+12]=n.w,i};N.setTranslation=function(e,t,n){return E.typeOf.object("matrix",e),E.typeOf.object("translation",t),E.typeOf.object("result",n),n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=e[3],n[4]=e[4],n[5]=e[5],n[6]=e[6],n[7]=e[7],n[8]=e[8],n[9]=e[9],n[10]=e[10],n[11]=e[11],n[12]=t.x,n[13]=t.y,n[14]=t.z,n[15]=e[15],n};const Nxe=new d;N.setScale=function(e,t,n){E.typeOf.object("matrix",e),E.typeOf.object("scale",t),E.typeOf.object("result",n);const i=N.getScale(e,Nxe),o=t.x/i.x,r=t.y/i.y,s=t.z/i.z;return n[0]=e[0]*o,n[1]=e[1]*o,n[2]=e[2]*o,n[3]=e[3],n[4]=e[4]*r,n[5]=e[5]*r,n[6]=e[6]*r,n[7]=e[7],n[8]=e[8]*s,n[9]=e[9]*s,n[10]=e[10]*s,n[11]=e[11],n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15],n};const Mxe=new d;N.setUniformScale=function(e,t,n){E.typeOf.object("matrix",e),E.typeOf.number("scale",t),E.typeOf.object("result",n);const i=N.getScale(e,Mxe),o=t/i.x,r=t/i.y,s=t/i.z;return n[0]=e[0]*o,n[1]=e[1]*o,n[2]=e[2]*o,n[3]=e[3],n[4]=e[4]*r,n[5]=e[5]*r,n[6]=e[6]*r,n[7]=e[7],n[8]=e[8]*s,n[9]=e[9]*s,n[10]=e[10]*s,n[11]=e[11],n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15],n};const LL=new d;N.getScale=function(e,t){return E.typeOf.object("matrix",e),E.typeOf.object("result",t),t.x=d.magnitude(d.fromElements(e[0],e[1],e[2],LL)),t.y=d.magnitude(d.fromElements(e[4],e[5],e[6],LL)),t.z=d.magnitude(d.fromElements(e[8],e[9],e[10],LL)),t};const OG=new d;N.getMaximumScale=function(e){return N.getScale(e,OG),d.maximumComponent(OG)};const Fxe=new d;N.setRotation=function(e,t,n){E.typeOf.object("matrix",e),E.typeOf.object("result",n);const i=N.getScale(e,Fxe);return n[0]=t[0]*i.x,n[1]=t[1]*i.x,n[2]=t[2]*i.x,n[3]=e[3],n[4]=t[3]*i.y,n[5]=t[4]*i.y,n[6]=t[5]*i.y,n[7]=e[7],n[8]=t[6]*i.z,n[9]=t[7]*i.z,n[10]=t[8]*i.z,n[11]=e[11],n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15],n};const zxe=new d;N.getRotation=function(e,t){E.typeOf.object("matrix",e),E.typeOf.object("result",t);const n=N.getScale(e,zxe);return t[0]=e[0]/n.x,t[1]=e[1]/n.x,t[2]=e[2]/n.x,t[3]=e[4]/n.y,t[4]=e[5]/n.y,t[5]=e[6]/n.y,t[6]=e[8]/n.z,t[7]=e[9]/n.z,t[8]=e[10]/n.z,t};N.multiply=function(e,t,n){E.typeOf.object("left",e),E.typeOf.object("right",t),E.typeOf.object("result",n);const i=e[0],o=e[1],r=e[2],s=e[3],a=e[4],c=e[5],u=e[6],f=e[7],h=e[8],_=e[9],g=e[10],p=e[11],y=e[12],T=e[13],b=e[14],x=e[15],v=t[0],D=t[1],L=t[2],B=t[3],V=t[4],M=t[5],H=t[6],G=t[7],I=t[8],O=t[9],m=t[10],P=t[11],R=t[12],U=t[13],W=t[14],q=t[15],Y=i*v+a*D+h*L+y*B,j=o*v+c*D+_*L+T*B,ee=r*v+u*D+g*L+b*B,K=s*v+f*D+p*L+x*B,se=i*V+a*M+h*H+y*G,Q=o*V+c*M+_*H+T*G,Z=r*V+u*M+g*H+b*G,J=s*V+f*M+p*H+x*G,de=i*I+a*O+h*m+y*P,_e=o*I+c*O+_*m+T*P,le=r*I+u*O+g*m+b*P,Te=s*I+f*O+p*m+x*P,pe=i*R+a*U+h*W+y*q,ne=o*R+c*U+_*W+T*q,ae=r*R+u*U+g*W+b*q,ye=s*R+f*U+p*W+x*q;return n[0]=Y,n[1]=j,n[2]=ee,n[3]=K,n[4]=se,n[5]=Q,n[6]=Z,n[7]=J,n[8]=de,n[9]=_e,n[10]=le,n[11]=Te,n[12]=pe,n[13]=ne,n[14]=ae,n[15]=ye,n};N.add=function(e,t,n){return E.typeOf.object("left",e),E.typeOf.object("right",t),E.typeOf.object("result",n),n[0]=e[0]+t[0],n[1]=e[1]+t[1],n[2]=e[2]+t[2],n[3]=e[3]+t[3],n[4]=e[4]+t[4],n[5]=e[5]+t[5],n[6]=e[6]+t[6],n[7]=e[7]+t[7],n[8]=e[8]+t[8],n[9]=e[9]+t[9],n[10]=e[10]+t[10],n[11]=e[11]+t[11],n[12]=e[12]+t[12],n[13]=e[13]+t[13],n[14]=e[14]+t[14],n[15]=e[15]+t[15],n};N.subtract=function(e,t,n){return E.typeOf.object("left",e),E.typeOf.object("right",t),E.typeOf.object("result",n),n[0]=e[0]-t[0],n[1]=e[1]-t[1],n[2]=e[2]-t[2],n[3]=e[3]-t[3],n[4]=e[4]-t[4],n[5]=e[5]-t[5],n[6]=e[6]-t[6],n[7]=e[7]-t[7],n[8]=e[8]-t[8],n[9]=e[9]-t[9],n[10]=e[10]-t[10],n[11]=e[11]-t[11],n[12]=e[12]-t[12],n[13]=e[13]-t[13],n[14]=e[14]-t[14],n[15]=e[15]-t[15],n};N.multiplyTransformation=function(e,t,n){E.typeOf.object("left",e),E.typeOf.object("right",t),E.typeOf.object("result",n);const i=e[0],o=e[1],r=e[2],s=e[4],a=e[5],c=e[6],u=e[8],f=e[9],h=e[10],_=e[12],g=e[13],p=e[14],y=t[0],T=t[1],b=t[2],x=t[4],v=t[5],D=t[6],L=t[8],B=t[9],V=t[10],M=t[12],H=t[13],G=t[14],I=i*y+s*T+u*b,O=o*y+a*T+f*b,m=r*y+c*T+h*b,P=i*x+s*v+u*D,R=o*x+a*v+f*D,U=r*x+c*v+h*D,W=i*L+s*B+u*V,q=o*L+a*B+f*V,Y=r*L+c*B+h*V,j=i*M+s*H+u*G+_,ee=o*M+a*H+f*G+g,K=r*M+c*H+h*G+p;return n[0]=I,n[1]=O,n[2]=m,n[3]=0,n[4]=P,n[5]=R,n[6]=U,n[7]=0,n[8]=W,n[9]=q,n[10]=Y,n[11]=0,n[12]=j,n[13]=ee,n[14]=K,n[15]=1,n};N.multiplyByMatrix3=function(e,t,n){E.typeOf.object("matrix",e),E.typeOf.object("rotation",t),E.typeOf.object("result",n);const i=e[0],o=e[1],r=e[2],s=e[4],a=e[5],c=e[6],u=e[8],f=e[9],h=e[10],_=t[0],g=t[1],p=t[2],y=t[3],T=t[4],b=t[5],x=t[6],v=t[7],D=t[8],L=i*_+s*g+u*p,B=o*_+a*g+f*p,V=r*_+c*g+h*p,M=i*y+s*T+u*b,H=o*y+a*T+f*b,G=r*y+c*T+h*b,I=i*x+s*v+u*D,O=o*x+a*v+f*D,m=r*x+c*v+h*D;return n[0]=L,n[1]=B,n[2]=V,n[3]=0,n[4]=M,n[5]=H,n[6]=G,n[7]=0,n[8]=I,n[9]=O,n[10]=m,n[11]=0,n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15],n};N.multiplyByTranslation=function(e,t,n){E.typeOf.object("matrix",e),E.typeOf.object("translation",t),E.typeOf.object("result",n);const i=t.x,o=t.y,r=t.z,s=i*e[0]+o*e[4]+r*e[8]+e[12],a=i*e[1]+o*e[5]+r*e[9]+e[13],c=i*e[2]+o*e[6]+r*e[10]+e[14];return n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=e[3],n[4]=e[4],n[5]=e[5],n[6]=e[6],n[7]=e[7],n[8]=e[8],n[9]=e[9],n[10]=e[10],n[11]=e[11],n[12]=s,n[13]=a,n[14]=c,n[15]=e[15],n};N.multiplyByScale=function(e,t,n){E.typeOf.object("matrix",e),E.typeOf.object("scale",t),E.typeOf.object("result",n);const i=t.x,o=t.y,r=t.z;return i===1&&o===1&&r===1?N.clone(e,n):(n[0]=i*e[0],n[1]=i*e[1],n[2]=i*e[2],n[3]=e[3],n[4]=o*e[4],n[5]=o*e[5],n[6]=o*e[6],n[7]=e[7],n[8]=r*e[8],n[9]=r*e[9],n[10]=r*e[10],n[11]=e[11],n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15],n)};N.multiplyByUniformScale=function(e,t,n){return E.typeOf.object("matrix",e),E.typeOf.number("scale",t),E.typeOf.object("result",n),n[0]=e[0]*t,n[1]=e[1]*t,n[2]=e[2]*t,n[3]=e[3],n[4]=e[4]*t,n[5]=e[5]*t,n[6]=e[6]*t,n[7]=e[7],n[8]=e[8]*t,n[9]=e[9]*t,n[10]=e[10]*t,n[11]=e[11],n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15],n};N.multiplyByVector=function(e,t,n){E.typeOf.object("matrix",e),E.typeOf.object("cartesian",t),E.typeOf.object("result",n);const i=t.x,o=t.y,r=t.z,s=t.w,a=e[0]*i+e[4]*o+e[8]*r+e[12]*s,c=e[1]*i+e[5]*o+e[9]*r+e[13]*s,u=e[2]*i+e[6]*o+e[10]*r+e[14]*s,f=e[3]*i+e[7]*o+e[11]*r+e[15]*s;return n.x=a,n.y=c,n.z=u,n.w=f,n};N.multiplyByPointAsVector=function(e,t,n){E.typeOf.object("matrix",e),E.typeOf.object("cartesian",t),E.typeOf.object("result",n);const i=t.x,o=t.y,r=t.z,s=e[0]*i+e[4]*o+e[8]*r,a=e[1]*i+e[5]*o+e[9]*r,c=e[2]*i+e[6]*o+e[10]*r;return n.x=s,n.y=a,n.z=c,n};N.multiplyByPoint=function(e,t,n){E.typeOf.object("matrix",e),E.typeOf.object("cartesian",t),E.typeOf.object("result",n);const i=t.x,o=t.y,r=t.z,s=e[0]*i+e[4]*o+e[8]*r+e[12],a=e[1]*i+e[5]*o+e[9]*r+e[13],c=e[2]*i+e[6]*o+e[10]*r+e[14];return n.x=s,n.y=a,n.z=c,n};N.multiplyByScalar=function(e,t,n){return E.typeOf.object("matrix",e),E.typeOf.number("scalar",t),E.typeOf.object("result",n),n[0]=e[0]*t,n[1]=e[1]*t,n[2]=e[2]*t,n[3]=e[3]*t,n[4]=e[4]*t,n[5]=e[5]*t,n[6]=e[6]*t,n[7]=e[7]*t,n[8]=e[8]*t,n[9]=e[9]*t,n[10]=e[10]*t,n[11]=e[11]*t,n[12]=e[12]*t,n[13]=e[13]*t,n[14]=e[14]*t,n[15]=e[15]*t,n};N.negate=function(e,t){return E.typeOf.object("matrix",e),E.typeOf.object("result",t),t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t[4]=-e[4],t[5]=-e[5],t[6]=-e[6],t[7]=-e[7],t[8]=-e[8],t[9]=-e[9],t[10]=-e[10],t[11]=-e[11],t[12]=-e[12],t[13]=-e[13],t[14]=-e[14],t[15]=-e[15],t};N.transpose=function(e,t){E.typeOf.object("matrix",e),E.typeOf.object("result",t);const n=e[1],i=e[2],o=e[3],r=e[6],s=e[7],a=e[11];return t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=n,t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=i,t[9]=r,t[10]=e[10],t[11]=e[14],t[12]=o,t[13]=s,t[14]=a,t[15]=e[15],t};N.abs=function(e,t){return E.typeOf.object("matrix",e),E.typeOf.object("result",t),t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t[2]=Math.abs(e[2]),t[3]=Math.abs(e[3]),t[4]=Math.abs(e[4]),t[5]=Math.abs(e[5]),t[6]=Math.abs(e[6]),t[7]=Math.abs(e[7]),t[8]=Math.abs(e[8]),t[9]=Math.abs(e[9]),t[10]=Math.abs(e[10]),t[11]=Math.abs(e[11]),t[12]=Math.abs(e[12]),t[13]=Math.abs(e[13]),t[14]=Math.abs(e[14]),t[15]=Math.abs(e[15]),t};N.equals=function(e,t){return e===t||l(e)&&l(t)&&e[12]===t[12]&&e[13]===t[13]&&e[14]===t[14]&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[8]===t[8]&&e[9]===t[9]&&e[10]===t[10]&&e[3]===t[3]&&e[7]===t[7]&&e[11]===t[11]&&e[15]===t[15]};N.equalsEpsilon=function(e,t,n){return n=A(n,0),e===t||l(e)&&l(t)&&Math.abs(e[0]-t[0])<=n&&Math.abs(e[1]-t[1])<=n&&Math.abs(e[2]-t[2])<=n&&Math.abs(e[3]-t[3])<=n&&Math.abs(e[4]-t[4])<=n&&Math.abs(e[5]-t[5])<=n&&Math.abs(e[6]-t[6])<=n&&Math.abs(e[7]-t[7])<=n&&Math.abs(e[8]-t[8])<=n&&Math.abs(e[9]-t[9])<=n&&Math.abs(e[10]-t[10])<=n&&Math.abs(e[11]-t[11])<=n&&Math.abs(e[12]-t[12])<=n&&Math.abs(e[13]-t[13])<=n&&Math.abs(e[14]-t[14])<=n&&Math.abs(e[15]-t[15])<=n};N.getTranslation=function(e,t){return E.typeOf.object("matrix",e),E.typeOf.object("result",t),t.x=e[12],t.y=e[13],t.z=e[14],t};N.getMatrix3=function(e,t){return E.typeOf.object("matrix",e),E.typeOf.object("result",t),t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[4],t[4]=e[5],t[5]=e[6],t[6]=e[8],t[7]=e[9],t[8]=e[10],t};const Uxe=new te,Hxe=new te,Vxe=new ue,kxe=new ue(0,0,0,1);N.inverse=function(e,t){E.typeOf.object("matrix",e),E.typeOf.object("result",t);const n=e[0],i=e[4],o=e[8],r=e[12],s=e[1],a=e[5],c=e[9],u=e[13],f=e[2],h=e[6],_=e[10],g=e[14],p=e[3],y=e[7],T=e[11],b=e[15];let x=_*b,v=g*T,D=h*b,L=g*y,B=h*T,V=_*y,M=f*b,H=g*p,G=f*T,I=_*p,O=f*y,m=h*p;const P=x*a+L*c+B*u-(v*a+D*c+V*u),R=v*s+M*c+I*u-(x*s+H*c+G*u),U=D*s+H*a+O*u-(L*s+M*a+m*u),W=V*s+G*a+m*c-(B*s+I*a+O*c),q=v*i+D*o+V*r-(x*i+L*o+B*r),Y=x*n+H*o+G*r-(v*n+M*o+I*r),j=L*n+M*i+m*r-(D*n+H*i+O*r),ee=B*n+I*i+O*o-(V*n+G*i+m*o);x=o*u,v=r*c,D=i*u,L=r*a,B=i*c,V=o*a,M=n*u,H=r*s,G=n*c,I=o*s,O=n*a,m=i*s;const K=x*y+L*T+B*b-(v*y+D*T+V*b),se=v*p+M*T+I*b-(x*p+H*T+G*b),Q=D*p+H*y+O*b-(L*p+M*y+m*b),Z=V*p+G*y+m*T-(B*p+I*y+O*T),J=D*_+V*g+v*h-(B*g+x*h+L*_),de=G*g+x*f+H*_-(M*_+I*g+v*f),_e=M*h+m*g+L*f-(O*g+D*f+H*h),le=O*_+B*f+I*h-(G*h+m*_+V*f);let Te=n*P+i*R+o*U+r*W;if(Math.abs(Te)<F.EPSILON21){if(te.equalsEpsilon(N.getMatrix3(e,Uxe),Hxe,F.EPSILON7)&&ue.equals(N.getRow(e,3,Vxe),kxe))return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=0,t[11]=0,t[12]=-e[12],t[13]=-e[13],t[14]=-e[14],t[15]=1,t;throw new Fe("matrix is not invertible because its determinate is zero.")}return Te=1/Te,t[0]=P*Te,t[1]=R*Te,t[2]=U*Te,t[3]=W*Te,t[4]=q*Te,t[5]=Y*Te,t[6]=j*Te,t[7]=ee*Te,t[8]=K*Te,t[9]=se*Te,t[10]=Q*Te,t[11]=Z*Te,t[12]=J*Te,t[13]=de*Te,t[14]=_e*Te,t[15]=le*Te,t};N.inverseTransformation=function(e,t){E.typeOf.object("matrix",e),E.typeOf.object("result",t);const n=e[0],i=e[1],o=e[2],r=e[4],s=e[5],a=e[6],c=e[8],u=e[9],f=e[10],h=e[12],_=e[13],g=e[14],p=-n*h-i*_-o*g,y=-r*h-s*_-a*g,T=-c*h-u*_-f*g;return t[0]=n,t[1]=r,t[2]=c,t[3]=0,t[4]=i,t[5]=s,t[6]=u,t[7]=0,t[8]=o,t[9]=a,t[10]=f,t[11]=0,t[12]=p,t[13]=y,t[14]=T,t[15]=1,t};const Gxe=new N;N.inverseTranspose=function(e,t){return E.typeOf.object("matrix",e),E.typeOf.object("result",t),N.inverse(N.transpose(e,Gxe),t)};N.IDENTITY=Object.freeze(new N(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1));N.ZERO=Object.freeze(new N(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0));N.COLUMN0ROW0=0;N.COLUMN0ROW1=1;N.COLUMN0ROW2=2;N.COLUMN0ROW3=3;N.COLUMN1ROW0=4;N.COLUMN1ROW1=5;N.COLUMN1ROW2=6;N.COLUMN1ROW3=7;N.COLUMN2ROW0=8;N.COLUMN2ROW1=9;N.COLUMN2ROW2=10;N.COLUMN2ROW3=11;N.COLUMN3ROW0=12;N.COLUMN3ROW1=13;N.COLUMN3ROW2=14;N.COLUMN3ROW3=15;Object.defineProperties(N.prototype,{length:{get:function(){return N.packedLength}}});N.prototype.clone=function(e){return N.clone(this,e)};N.prototype.equals=function(e){return N.equals(this,e)};N.equalsArray=function(e,t,n){return e[0]===t[n]&&e[1]===t[n+1]&&e[2]===t[n+2]&&e[3]===t[n+3]&&e[4]===t[n+4]&&e[5]===t[n+5]&&e[6]===t[n+6]&&e[7]===t[n+7]&&e[8]===t[n+8]&&e[9]===t[n+9]&&e[10]===t[n+10]&&e[11]===t[n+11]&&e[12]===t[n+12]&&e[13]===t[n+13]&&e[14]===t[n+14]&&e[15]===t[n+15]};N.prototype.equalsEpsilon=function(e,t){return N.equalsEpsilon(this,e,t)};N.prototype.toString=function(){return`(${this[0]}, ${this[4]}, ${this[8]}, ${this[12]})
|
||
(${this[1]}, ${this[5]}, ${this[9]}, ${this[13]})
|
||
(${this[2]}, ${this[6]}, ${this[10]}, ${this[14]})
|
||
(${this[3]}, ${this[7]}, ${this[11]}, ${this[15]})`};const Wxe={DEPTH_BUFFER_BIT:256,STENCIL_BUFFER_BIT:1024,COLOR_BUFFER_BIT:16384,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,ZERO:0,ONE:1,SRC_COLOR:768,ONE_MINUS_SRC_COLOR:769,SRC_ALPHA:770,ONE_MINUS_SRC_ALPHA:771,DST_ALPHA:772,ONE_MINUS_DST_ALPHA:773,DST_COLOR:774,ONE_MINUS_DST_COLOR:775,SRC_ALPHA_SATURATE:776,FUNC_ADD:32774,BLEND_EQUATION:32777,BLEND_EQUATION_RGB:32777,BLEND_EQUATION_ALPHA:34877,FUNC_SUBTRACT:32778,FUNC_REVERSE_SUBTRACT:32779,BLEND_DST_RGB:32968,BLEND_SRC_RGB:32969,BLEND_DST_ALPHA:32970,BLEND_SRC_ALPHA:32971,CONSTANT_COLOR:32769,ONE_MINUS_CONSTANT_COLOR:32770,CONSTANT_ALPHA:32771,ONE_MINUS_CONSTANT_ALPHA:32772,BLEND_COLOR:32773,ARRAY_BUFFER:34962,ELEMENT_ARRAY_BUFFER:34963,ARRAY_BUFFER_BINDING:34964,ELEMENT_ARRAY_BUFFER_BINDING:34965,STREAM_DRAW:35040,STATIC_DRAW:35044,DYNAMIC_DRAW:35048,BUFFER_SIZE:34660,BUFFER_USAGE:34661,CURRENT_VERTEX_ATTRIB:34342,FRONT:1028,BACK:1029,FRONT_AND_BACK:1032,CULL_FACE:2884,BLEND:3042,DITHER:3024,STENCIL_TEST:2960,DEPTH_TEST:2929,SCISSOR_TEST:3089,POLYGON_OFFSET_FILL:32823,SAMPLE_ALPHA_TO_COVERAGE:32926,SAMPLE_COVERAGE:32928,NO_ERROR:0,INVALID_ENUM:1280,INVALID_VALUE:1281,INVALID_OPERATION:1282,OUT_OF_MEMORY:1285,CW:2304,CCW:2305,LINE_WIDTH:2849,ALIASED_POINT_SIZE_RANGE:33901,ALIASED_LINE_WIDTH_RANGE:33902,CULL_FACE_MODE:2885,FRONT_FACE:2886,DEPTH_RANGE:2928,DEPTH_WRITEMASK:2930,DEPTH_CLEAR_VALUE:2931,DEPTH_FUNC:2932,STENCIL_CLEAR_VALUE:2961,STENCIL_FUNC:2962,STENCIL_FAIL:2964,STENCIL_PASS_DEPTH_FAIL:2965,STENCIL_PASS_DEPTH_PASS:2966,STENCIL_REF:2967,STENCIL_VALUE_MASK:2963,STENCIL_WRITEMASK:2968,STENCIL_BACK_FUNC:34816,STENCIL_BACK_FAIL:34817,STENCIL_BACK_PASS_DEPTH_FAIL:34818,STENCIL_BACK_PASS_DEPTH_PASS:34819,STENCIL_BACK_REF:36003,STENCIL_BACK_VALUE_MASK:36004,STENCIL_BACK_WRITEMASK:36005,VIEWPORT:2978,SCISSOR_BOX:3088,COLOR_CLEAR_VALUE:3106,COLOR_WRITEMASK:3107,UNPACK_ALIGNMENT:3317,PACK_ALIGNMENT:3333,MAX_TEXTURE_SIZE:3379,MAX_VIEWPORT_DIMS:3386,SUBPIXEL_BITS:3408,RED_BITS:3410,GREEN_BITS:3411,BLUE_BITS:3412,ALPHA_BITS:3413,DEPTH_BITS:3414,STENCIL_BITS:3415,POLYGON_OFFSET_UNITS:10752,POLYGON_OFFSET_FACTOR:32824,TEXTURE_BINDING_2D:32873,SAMPLE_BUFFERS:32936,SAMPLES:32937,SAMPLE_COVERAGE_VALUE:32938,SAMPLE_COVERAGE_INVERT:32939,COMPRESSED_TEXTURE_FORMATS:34467,DONT_CARE:4352,FASTEST:4353,NICEST:4354,GENERATE_MIPMAP_HINT:33170,BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,DEPTH_COMPONENT:6402,ALPHA:6406,RGB:6407,RGBA:6408,LUMINANCE:6409,LUMINANCE_ALPHA:6410,UNSIGNED_SHORT_4_4_4_4:32819,UNSIGNED_SHORT_5_5_5_1:32820,UNSIGNED_SHORT_5_6_5:33635,FRAGMENT_SHADER:35632,VERTEX_SHADER:35633,MAX_VERTEX_ATTRIBS:34921,MAX_VERTEX_UNIFORM_VECTORS:36347,MAX_VARYING_VECTORS:36348,MAX_COMBINED_TEXTURE_IMAGE_UNITS:35661,MAX_VERTEX_TEXTURE_IMAGE_UNITS:35660,MAX_TEXTURE_IMAGE_UNITS:34930,MAX_FRAGMENT_UNIFORM_VECTORS:36349,SHADER_TYPE:35663,DELETE_STATUS:35712,LINK_STATUS:35714,VALIDATE_STATUS:35715,ATTACHED_SHADERS:35717,ACTIVE_UNIFORMS:35718,ACTIVE_ATTRIBUTES:35721,SHADING_LANGUAGE_VERSION:35724,CURRENT_PROGRAM:35725,NEVER:512,LESS:513,EQUAL:514,LEQUAL:515,GREATER:516,NOTEQUAL:517,GEQUAL:518,ALWAYS:519,KEEP:7680,REPLACE:7681,INCR:7682,DECR:7683,INVERT:5386,INCR_WRAP:34055,DECR_WRAP:34056,VENDOR:7936,RENDERER:7937,VERSION:7938,NEAREST:9728,LINEAR:9729,NEAREST_MIPMAP_NEAREST:9984,LINEAR_MIPMAP_NEAREST:9985,NEAREST_MIPMAP_LINEAR:9986,LINEAR_MIPMAP_LINEAR:9987,TEXTURE_MAG_FILTER:10240,TEXTURE_MIN_FILTER:10241,TEXTURE_WRAP_S:10242,TEXTURE_WRAP_T:10243,TEXTURE_2D:3553,TEXTURE:5890,TEXTURE_CUBE_MAP:34067,TEXTURE_BINDING_CUBE_MAP:34068,TEXTURE_CUBE_MAP_POSITIVE_X:34069,TEXTURE_CUBE_MAP_NEGATIVE_X:34070,TEXTURE_CUBE_MAP_POSITIVE_Y:34071,TEXTURE_CUBE_MAP_NEGATIVE_Y:34072,TEXTURE_CUBE_MAP_POSITIVE_Z:34073,TEXTURE_CUBE_MAP_NEGATIVE_Z:34074,MAX_CUBE_MAP_TEXTURE_SIZE:34076,TEXTURE0:33984,TEXTURE1:33985,TEXTURE2:33986,TEXTURE3:33987,TEXTURE4:33988,TEXTURE5:33989,TEXTURE6:33990,TEXTURE7:33991,TEXTURE8:33992,TEXTURE9:33993,TEXTURE10:33994,TEXTURE11:33995,TEXTURE12:33996,TEXTURE13:33997,TEXTURE14:33998,TEXTURE15:33999,TEXTURE16:34e3,TEXTURE17:34001,TEXTURE18:34002,TEXTURE19:34003,TEXTURE20:34004,TEXTURE21:34005,TEXTURE22:34006,TEXTURE23:34007,TEXTURE24:34008,TEXTURE25:34009,TEXTURE26:34010,TEXTURE27:34011,TEXTURE28:34012,TEXTURE29:34013,TEXTURE30:34014,TEXTURE31:34015,ACTIVE_TEXTURE:34016,REPEAT:10497,CLAMP_TO_EDGE:33071,MIRRORED_REPEAT:33648,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,INT_VEC2:35667,INT_VEC3:35668,INT_VEC4:35669,BOOL:35670,BOOL_VEC2:35671,BOOL_VEC3:35672,BOOL_VEC4:35673,FLOAT_MAT2:35674,FLOAT_MAT3:35675,FLOAT_MAT4:35676,SAMPLER_2D:35678,SAMPLER_CUBE:35680,VERTEX_ATTRIB_ARRAY_ENABLED:34338,VERTEX_ATTRIB_ARRAY_SIZE:34339,VERTEX_ATTRIB_ARRAY_STRIDE:34340,VERTEX_ATTRIB_ARRAY_TYPE:34341,VERTEX_ATTRIB_ARRAY_NORMALIZED:34922,VERTEX_ATTRIB_ARRAY_POINTER:34373,VERTEX_ATTRIB_ARRAY_BUFFER_BINDING:34975,IMPLEMENTATION_COLOR_READ_TYPE:35738,IMPLEMENTATION_COLOR_READ_FORMAT:35739,COMPILE_STATUS:35713,LOW_FLOAT:36336,MEDIUM_FLOAT:36337,HIGH_FLOAT:36338,LOW_INT:36339,MEDIUM_INT:36340,HIGH_INT:36341,FRAMEBUFFER:36160,RENDERBUFFER:36161,RGBA4:32854,RGB5_A1:32855,RGB565:36194,DEPTH_COMPONENT16:33189,STENCIL_INDEX:6401,STENCIL_INDEX8:36168,DEPTH_STENCIL:34041,RENDERBUFFER_WIDTH:36162,RENDERBUFFER_HEIGHT:36163,RENDERBUFFER_INTERNAL_FORMAT:36164,RENDERBUFFER_RED_SIZE:36176,RENDERBUFFER_GREEN_SIZE:36177,RENDERBUFFER_BLUE_SIZE:36178,RENDERBUFFER_ALPHA_SIZE:36179,RENDERBUFFER_DEPTH_SIZE:36180,RENDERBUFFER_STENCIL_SIZE:36181,FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:36048,FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:36049,FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL:36050,FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE:36051,COLOR_ATTACHMENT0:36064,DEPTH_ATTACHMENT:36096,STENCIL_ATTACHMENT:36128,DEPTH_STENCIL_ATTACHMENT:33306,NONE:0,FRAMEBUFFER_COMPLETE:36053,FRAMEBUFFER_INCOMPLETE_ATTACHMENT:36054,FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:36055,FRAMEBUFFER_INCOMPLETE_DIMENSIONS:36057,FRAMEBUFFER_UNSUPPORTED:36061,FRAMEBUFFER_BINDING:36006,RENDERBUFFER_BINDING:36007,MAX_RENDERBUFFER_SIZE:34024,INVALID_FRAMEBUFFER_OPERATION:1286,UNPACK_FLIP_Y_WEBGL:37440,UNPACK_PREMULTIPLY_ALPHA_WEBGL:37441,CONTEXT_LOST_WEBGL:37442,UNPACK_COLORSPACE_CONVERSION_WEBGL:37443,BROWSER_DEFAULT_WEBGL:37444,COMPRESSED_RGB_S3TC_DXT1_EXT:33776,COMPRESSED_RGBA_S3TC_DXT1_EXT:33777,COMPRESSED_RGBA_S3TC_DXT3_EXT:33778,COMPRESSED_RGBA_S3TC_DXT5_EXT:33779,COMPRESSED_RGB_PVRTC_4BPPV1_IMG:35840,COMPRESSED_RGB_PVRTC_2BPPV1_IMG:35841,COMPRESSED_RGBA_PVRTC_4BPPV1_IMG:35842,COMPRESSED_RGBA_PVRTC_2BPPV1_IMG:35843,COMPRESSED_RGBA_ASTC_4x4_WEBGL:37808,COMPRESSED_RGB_ETC1_WEBGL:36196,COMPRESSED_RGBA_BPTC_UNORM:36492,HALF_FLOAT_OES:36193,DOUBLE:5130,READ_BUFFER:3074,UNPACK_ROW_LENGTH:3314,UNPACK_SKIP_ROWS:3315,UNPACK_SKIP_PIXELS:3316,PACK_ROW_LENGTH:3330,PACK_SKIP_ROWS:3331,PACK_SKIP_PIXELS:3332,COLOR:6144,DEPTH:6145,STENCIL:6146,RED:6403,RGB8:32849,RGBA8:32856,RGB10_A2:32857,TEXTURE_BINDING_3D:32874,UNPACK_SKIP_IMAGES:32877,UNPACK_IMAGE_HEIGHT:32878,TEXTURE_3D:32879,TEXTURE_WRAP_R:32882,MAX_3D_TEXTURE_SIZE:32883,UNSIGNED_INT_2_10_10_10_REV:33640,MAX_ELEMENTS_VERTICES:33e3,MAX_ELEMENTS_INDICES:33001,TEXTURE_MIN_LOD:33082,TEXTURE_MAX_LOD:33083,TEXTURE_BASE_LEVEL:33084,TEXTURE_MAX_LEVEL:33085,MIN:32775,MAX:32776,DEPTH_COMPONENT24:33190,MAX_TEXTURE_LOD_BIAS:34045,TEXTURE_COMPARE_MODE:34892,TEXTURE_COMPARE_FUNC:34893,CURRENT_QUERY:34917,QUERY_RESULT:34918,QUERY_RESULT_AVAILABLE:34919,STREAM_READ:35041,STREAM_COPY:35042,STATIC_READ:35045,STATIC_COPY:35046,DYNAMIC_READ:35049,DYNAMIC_COPY:35050,MAX_DRAW_BUFFERS:34852,DRAW_BUFFER0:34853,DRAW_BUFFER1:34854,DRAW_BUFFER2:34855,DRAW_BUFFER3:34856,DRAW_BUFFER4:34857,DRAW_BUFFER5:34858,DRAW_BUFFER6:34859,DRAW_BUFFER7:34860,DRAW_BUFFER8:34861,DRAW_BUFFER9:34862,DRAW_BUFFER10:34863,DRAW_BUFFER11:34864,DRAW_BUFFER12:34865,DRAW_BUFFER13:34866,DRAW_BUFFER14:34867,DRAW_BUFFER15:34868,MAX_FRAGMENT_UNIFORM_COMPONENTS:35657,MAX_VERTEX_UNIFORM_COMPONENTS:35658,SAMPLER_3D:35679,SAMPLER_2D_SHADOW:35682,FRAGMENT_SHADER_DERIVATIVE_HINT:35723,PIXEL_PACK_BUFFER:35051,PIXEL_UNPACK_BUFFER:35052,PIXEL_PACK_BUFFER_BINDING:35053,PIXEL_UNPACK_BUFFER_BINDING:35055,FLOAT_MAT2x3:35685,FLOAT_MAT2x4:35686,FLOAT_MAT3x2:35687,FLOAT_MAT3x4:35688,FLOAT_MAT4x2:35689,FLOAT_MAT4x3:35690,SRGB:35904,SRGB8:35905,SRGB8_ALPHA8:35907,COMPARE_REF_TO_TEXTURE:34894,RGBA32F:34836,RGB32F:34837,RGBA16F:34842,RGB16F:34843,VERTEX_ATTRIB_ARRAY_INTEGER:35069,MAX_ARRAY_TEXTURE_LAYERS:35071,MIN_PROGRAM_TEXEL_OFFSET:35076,MAX_PROGRAM_TEXEL_OFFSET:35077,MAX_VARYING_COMPONENTS:35659,TEXTURE_2D_ARRAY:35866,TEXTURE_BINDING_2D_ARRAY:35869,R11F_G11F_B10F:35898,UNSIGNED_INT_10F_11F_11F_REV:35899,RGB9_E5:35901,UNSIGNED_INT_5_9_9_9_REV:35902,TRANSFORM_FEEDBACK_BUFFER_MODE:35967,MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS:35968,TRANSFORM_FEEDBACK_VARYINGS:35971,TRANSFORM_FEEDBACK_BUFFER_START:35972,TRANSFORM_FEEDBACK_BUFFER_SIZE:35973,TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN:35976,RASTERIZER_DISCARD:35977,MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS:35978,MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS:35979,INTERLEAVED_ATTRIBS:35980,SEPARATE_ATTRIBS:35981,TRANSFORM_FEEDBACK_BUFFER:35982,TRANSFORM_FEEDBACK_BUFFER_BINDING:35983,RGBA32UI:36208,RGB32UI:36209,RGBA16UI:36214,RGB16UI:36215,RGBA8UI:36220,RGB8UI:36221,RGBA32I:36226,RGB32I:36227,RGBA16I:36232,RGB16I:36233,RGBA8I:36238,RGB8I:36239,RED_INTEGER:36244,RGB_INTEGER:36248,RGBA_INTEGER:36249,SAMPLER_2D_ARRAY:36289,SAMPLER_2D_ARRAY_SHADOW:36292,SAMPLER_CUBE_SHADOW:36293,UNSIGNED_INT_VEC2:36294,UNSIGNED_INT_VEC3:36295,UNSIGNED_INT_VEC4:36296,INT_SAMPLER_2D:36298,INT_SAMPLER_3D:36299,INT_SAMPLER_CUBE:36300,INT_SAMPLER_2D_ARRAY:36303,UNSIGNED_INT_SAMPLER_2D:36306,UNSIGNED_INT_SAMPLER_3D:36307,UNSIGNED_INT_SAMPLER_CUBE:36308,UNSIGNED_INT_SAMPLER_2D_ARRAY:36311,DEPTH_COMPONENT32F:36012,DEPTH32F_STENCIL8:36013,FLOAT_32_UNSIGNED_INT_24_8_REV:36269,FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING:33296,FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE:33297,FRAMEBUFFER_ATTACHMENT_RED_SIZE:33298,FRAMEBUFFER_ATTACHMENT_GREEN_SIZE:33299,FRAMEBUFFER_ATTACHMENT_BLUE_SIZE:33300,FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE:33301,FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE:33302,FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE:33303,FRAMEBUFFER_DEFAULT:33304,UNSIGNED_INT_24_8:34042,DEPTH24_STENCIL8:35056,UNSIGNED_NORMALIZED:35863,DRAW_FRAMEBUFFER_BINDING:36006,READ_FRAMEBUFFER:36008,DRAW_FRAMEBUFFER:36009,READ_FRAMEBUFFER_BINDING:36010,RENDERBUFFER_SAMPLES:36011,FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER:36052,MAX_COLOR_ATTACHMENTS:36063,COLOR_ATTACHMENT1:36065,COLOR_ATTACHMENT2:36066,COLOR_ATTACHMENT3:36067,COLOR_ATTACHMENT4:36068,COLOR_ATTACHMENT5:36069,COLOR_ATTACHMENT6:36070,COLOR_ATTACHMENT7:36071,COLOR_ATTACHMENT8:36072,COLOR_ATTACHMENT9:36073,COLOR_ATTACHMENT10:36074,COLOR_ATTACHMENT11:36075,COLOR_ATTACHMENT12:36076,COLOR_ATTACHMENT13:36077,COLOR_ATTACHMENT14:36078,COLOR_ATTACHMENT15:36079,FRAMEBUFFER_INCOMPLETE_MULTISAMPLE:36182,MAX_SAMPLES:36183,HALF_FLOAT:5131,RG:33319,RG_INTEGER:33320,R8:33321,RG8:33323,R16F:33325,R32F:33326,RG16F:33327,RG32F:33328,R8I:33329,R8UI:33330,R16I:33331,R16UI:33332,R32I:33333,R32UI:33334,RG8I:33335,RG8UI:33336,RG16I:33337,RG16UI:33338,RG32I:33339,RG32UI:33340,VERTEX_ARRAY_BINDING:34229,R8_SNORM:36756,RG8_SNORM:36757,RGB8_SNORM:36758,RGBA8_SNORM:36759,SIGNED_NORMALIZED:36764,COPY_READ_BUFFER:36662,COPY_WRITE_BUFFER:36663,COPY_READ_BUFFER_BINDING:36662,COPY_WRITE_BUFFER_BINDING:36663,UNIFORM_BUFFER:35345,UNIFORM_BUFFER_BINDING:35368,UNIFORM_BUFFER_START:35369,UNIFORM_BUFFER_SIZE:35370,MAX_VERTEX_UNIFORM_BLOCKS:35371,MAX_FRAGMENT_UNIFORM_BLOCKS:35373,MAX_COMBINED_UNIFORM_BLOCKS:35374,MAX_UNIFORM_BUFFER_BINDINGS:35375,MAX_UNIFORM_BLOCK_SIZE:35376,MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS:35377,MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS:35379,UNIFORM_BUFFER_OFFSET_ALIGNMENT:35380,ACTIVE_UNIFORM_BLOCKS:35382,UNIFORM_TYPE:35383,UNIFORM_SIZE:35384,UNIFORM_BLOCK_INDEX:35386,UNIFORM_OFFSET:35387,UNIFORM_ARRAY_STRIDE:35388,UNIFORM_MATRIX_STRIDE:35389,UNIFORM_IS_ROW_MAJOR:35390,UNIFORM_BLOCK_BINDING:35391,UNIFORM_BLOCK_DATA_SIZE:35392,UNIFORM_BLOCK_ACTIVE_UNIFORMS:35394,UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES:35395,UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER:35396,UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER:35398,INVALID_INDEX:4294967295,MAX_VERTEX_OUTPUT_COMPONENTS:37154,MAX_FRAGMENT_INPUT_COMPONENTS:37157,MAX_SERVER_WAIT_TIMEOUT:37137,OBJECT_TYPE:37138,SYNC_CONDITION:37139,SYNC_STATUS:37140,SYNC_FLAGS:37141,SYNC_FENCE:37142,SYNC_GPU_COMMANDS_COMPLETE:37143,UNSIGNALED:37144,SIGNALED:37145,ALREADY_SIGNALED:37146,TIMEOUT_EXPIRED:37147,CONDITION_SATISFIED:37148,WAIT_FAILED:37149,SYNC_FLUSH_COMMANDS_BIT:1,VERTEX_ATTRIB_ARRAY_DIVISOR:35070,ANY_SAMPLES_PASSED:35887,ANY_SAMPLES_PASSED_CONSERVATIVE:36202,SAMPLER_BINDING:35097,RGB10_A2UI:36975,INT_2_10_10_10_REV:36255,TRANSFORM_FEEDBACK:36386,TRANSFORM_FEEDBACK_PAUSED:36387,TRANSFORM_FEEDBACK_ACTIVE:36388,TRANSFORM_FEEDBACK_BINDING:36389,COMPRESSED_R11_EAC:37488,COMPRESSED_SIGNED_R11_EAC:37489,COMPRESSED_RG11_EAC:37490,COMPRESSED_SIGNED_RG11_EAC:37491,COMPRESSED_RGB8_ETC2:37492,COMPRESSED_SRGB8_ETC2:37493,COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:37494,COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:37495,COMPRESSED_RGBA8_ETC2_EAC:37496,COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:37497,TEXTURE_IMMUTABLE_FORMAT:37167,MAX_ELEMENT_INDEX:36203,TEXTURE_IMMUTABLE_LEVELS:33503,MAX_TEXTURE_MAX_ANISOTROPY_EXT:34047},fe=Object.freeze(Wxe),qxe=new d;function zt(e){this._size=e.size,this._datatype=e.datatype,this.getValue=e.getValue}const Qs={};Qs[fe.FLOAT]="float";Qs[fe.FLOAT_VEC2]="vec2";Qs[fe.FLOAT_VEC3]="vec3";Qs[fe.FLOAT_VEC4]="vec4";Qs[fe.INT]="int";Qs[fe.INT_VEC2]="ivec2";Qs[fe.INT_VEC3]="ivec3";Qs[fe.INT_VEC4]="ivec4";Qs[fe.BOOL]="bool";Qs[fe.BOOL_VEC2]="bvec2";Qs[fe.BOOL_VEC3]="bvec3";Qs[fe.BOOL_VEC4]="bvec4";Qs[fe.FLOAT_MAT2]="mat2";Qs[fe.FLOAT_MAT3]="mat3";Qs[fe.FLOAT_MAT4]="mat4";Qs[fe.SAMPLER_2D]="sampler2D";Qs[fe.SAMPLER_CUBE]="samplerCube";zt.prototype.getDeclaration=function(e){let t=`uniform ${Qs[this._datatype]} ${e}`;const n=this._size;return n===1?t+=";":t+=`[${n.toString()}];`,t};const jxe={czm_viewport:new zt({size:1,datatype:fe.FLOAT_VEC4,getValue:function(e){return e.viewportCartesian4}}),czm_viewportOrthographic:new zt({size:1,datatype:fe.FLOAT_MAT4,getValue:function(e){return e.viewportOrthographic}}),czm_viewportTransformation:new zt({size:1,datatype:fe.FLOAT_MAT4,getValue:function(e){return e.viewportTransformation}}),czm_globeDepthTexture:new zt({size:1,datatype:fe.SAMPLER_2D,getValue:function(e){return e.globeDepthTexture}}),czm_model:new zt({size:1,datatype:fe.FLOAT_MAT4,getValue:function(e){return e.model}}),czm_inverseModel:new zt({size:1,datatype:fe.FLOAT_MAT4,getValue:function(e){return e.inverseModel}}),czm_view:new zt({size:1,datatype:fe.FLOAT_MAT4,getValue:function(e){return e.view}}),czm_view3D:new zt({size:1,datatype:fe.FLOAT_MAT4,getValue:function(e){return e.view3D}}),czm_viewRotation:new zt({size:1,datatype:fe.FLOAT_MAT3,getValue:function(e){return e.viewRotation}}),czm_viewRotation3D:new zt({size:1,datatype:fe.FLOAT_MAT3,getValue:function(e){return e.viewRotation3D}}),czm_inverseView:new zt({size:1,datatype:fe.FLOAT_MAT4,getValue:function(e){return e.inverseView}}),czm_inverseView3D:new zt({size:1,datatype:fe.FLOAT_MAT4,getValue:function(e){return e.inverseView3D}}),czm_inverseViewRotation:new zt({size:1,datatype:fe.FLOAT_MAT3,getValue:function(e){return e.inverseViewRotation}}),czm_inverseViewRotation3D:new zt({size:1,datatype:fe.FLOAT_MAT3,getValue:function(e){return e.inverseViewRotation3D}}),czm_projection:new zt({size:1,datatype:fe.FLOAT_MAT4,getValue:function(e){return e.projection}}),czm_inverseProjection:new zt({size:1,datatype:fe.FLOAT_MAT4,getValue:function(e){return e.inverseProjection}}),czm_infiniteProjection:new zt({size:1,datatype:fe.FLOAT_MAT4,getValue:function(e){return e.infiniteProjection}}),czm_modelView:new zt({size:1,datatype:fe.FLOAT_MAT4,getValue:function(e){return e.modelView}}),czm_modelView3D:new zt({size:1,datatype:fe.FLOAT_MAT4,getValue:function(e){return e.modelView3D}}),czm_modelViewRelativeToEye:new zt({size:1,datatype:fe.FLOAT_MAT4,getValue:function(e){return e.modelViewRelativeToEye}}),czm_inverseModelView:new zt({size:1,datatype:fe.FLOAT_MAT4,getValue:function(e){return e.inverseModelView}}),czm_inverseModelView3D:new zt({size:1,datatype:fe.FLOAT_MAT4,getValue:function(e){return e.inverseModelView3D}}),czm_viewProjection:new zt({size:1,datatype:fe.FLOAT_MAT4,getValue:function(e){return e.viewProjection}}),czm_inverseViewProjection:new zt({size:1,datatype:fe.FLOAT_MAT4,getValue:function(e){return e.inverseViewProjection}}),czm_modelViewProjection:new zt({size:1,datatype:fe.FLOAT_MAT4,getValue:function(e){return e.modelViewProjection}}),czm_inverseModelViewProjection:new zt({size:1,datatype:fe.FLOAT_MAT4,getValue:function(e){return e.inverseModelViewProjection}}),czm_modelViewProjectionRelativeToEye:new zt({size:1,datatype:fe.FLOAT_MAT4,getValue:function(e){return e.modelViewProjectionRelativeToEye}}),czm_modelViewInfiniteProjection:new zt({size:1,datatype:fe.FLOAT_MAT4,getValue:function(e){return e.modelViewInfiniteProjection}}),czm_orthographicIn3D:new zt({size:1,datatype:fe.FLOAT,getValue:function(e){return e.orthographicIn3D?1:0}}),czm_normal:new zt({size:1,datatype:fe.FLOAT_MAT3,getValue:function(e){return e.normal}}),czm_normal3D:new zt({size:1,datatype:fe.FLOAT_MAT3,getValue:function(e){return e.normal3D}}),czm_inverseNormal:new zt({size:1,datatype:fe.FLOAT_MAT3,getValue:function(e){return e.inverseNormal}}),czm_inverseNormal3D:new zt({size:1,datatype:fe.FLOAT_MAT3,getValue:function(e){return e.inverseNormal3D}}),czm_eyeHeight:new zt({size:1,datatype:fe.FLOAT,getValue:function(e){return e.eyeHeight}}),czm_eyeHeight2D:new zt({size:1,datatype:fe.FLOAT_VEC2,getValue:function(e){return e.eyeHeight2D}}),czm_entireFrustum:new zt({size:1,datatype:fe.FLOAT_VEC2,getValue:function(e){return e.entireFrustum}}),czm_currentFrustum:new zt({size:1,datatype:fe.FLOAT_VEC2,getValue:function(e){return e.currentFrustum}}),czm_frustumPlanes:new zt({size:1,datatype:fe.FLOAT_VEC4,getValue:function(e){return e.frustumPlanes}}),czm_farDepthFromNearPlusOne:new zt({size:1,datatype:fe.FLOAT,getValue:function(e){return e.farDepthFromNearPlusOne}}),czm_log2FarDepthFromNearPlusOne:new zt({size:1,datatype:fe.FLOAT,getValue:function(e){return e.log2FarDepthFromNearPlusOne}}),czm_oneOverLog2FarDepthFromNearPlusOne:new zt({size:1,datatype:fe.FLOAT,getValue:function(e){return e.oneOverLog2FarDepthFromNearPlusOne}}),czm_sunPositionWC:new zt({size:1,datatype:fe.FLOAT_VEC3,getValue:function(e){return e.sunPositionWC}}),czm_sunPositionColumbusView:new zt({size:1,datatype:fe.FLOAT_VEC3,getValue:function(e){return e.sunPositionColumbusView}}),czm_sunDirectionEC:new zt({size:1,datatype:fe.FLOAT_VEC3,getValue:function(e){return e.sunDirectionEC}}),czm_sunDirectionWC:new zt({size:1,datatype:fe.FLOAT_VEC3,getValue:function(e){return e.sunDirectionWC}}),czm_moonDirectionEC:new zt({size:1,datatype:fe.FLOAT_VEC3,getValue:function(e){return e.moonDirectionEC}}),czm_lightDirectionEC:new zt({size:1,datatype:fe.FLOAT_VEC3,getValue:function(e){return e.lightDirectionEC}}),czm_lightDirectionWC:new zt({size:1,datatype:fe.FLOAT_VEC3,getValue:function(e){return e.lightDirectionWC}}),czm_lightColor:new zt({size:1,datatype:fe.FLOAT_VEC3,getValue:function(e){return e.lightColor}}),czm_lightColorHdr:new zt({size:1,datatype:fe.FLOAT_VEC3,getValue:function(e){return e.lightColorHdr}}),czm_encodedCameraPositionMCHigh:new zt({size:1,datatype:fe.FLOAT_VEC3,getValue:function(e){return e.encodedCameraPositionMCHigh}}),czm_encodedCameraPositionMCLow:new zt({size:1,datatype:fe.FLOAT_VEC3,getValue:function(e){return e.encodedCameraPositionMCLow}}),czm_viewerPositionWC:new zt({size:1,datatype:fe.FLOAT_VEC3,getValue:function(e){return N.getTranslation(e.inverseView,qxe)}}),czm_frameNumber:new zt({size:1,datatype:fe.FLOAT,getValue:function(e){return e.frameState.frameNumber}}),czm_morphTime:new zt({size:1,datatype:fe.FLOAT,getValue:function(e){return e.frameState.morphTime}}),czm_sceneMode:new zt({size:1,datatype:fe.FLOAT,getValue:function(e){return e.frameState.mode}}),czm_pass:new zt({size:1,datatype:fe.FLOAT,getValue:function(e){return e.pass}}),czm_backgroundColor:new zt({size:1,datatype:fe.FLOAT_VEC4,getValue:function(e){return e.backgroundColor}}),czm_brdfLut:new zt({size:1,datatype:fe.SAMPLER_2D,getValue:function(e){return e.brdfLut}}),czm_environmentMap:new zt({size:1,datatype:fe.SAMPLER_CUBE,getValue:function(e){return e.environmentMap}}),czm_specularEnvironmentMaps:new zt({size:1,datatype:fe.SAMPLER_2D,getValue:function(e){return e.specularEnvironmentMaps}}),czm_specularEnvironmentMapSize:new zt({size:1,datatype:fe.FLOAT_VEC2,getValue:function(e){return e.specularEnvironmentMapsDimensions}}),czm_specularEnvironmentMapsMaximumLOD:new zt({size:1,datatype:fe.FLOAT,getValue:function(e){return e.specularEnvironmentMapsMaximumLOD}}),czm_sphericalHarmonicCoefficients:new zt({size:9,datatype:fe.FLOAT_VEC3,getValue:function(e){return e.sphericalHarmonicCoefficients}}),czm_temeToPseudoFixed:new zt({size:1,datatype:fe.FLOAT_MAT3,getValue:function(e){return e.temeToPseudoFixedMatrix}}),czm_pixelRatio:new zt({size:1,datatype:fe.FLOAT,getValue:function(e){return e.pixelRatio}}),czm_fogDensity:new zt({size:1,datatype:fe.FLOAT,getValue:function(e){return e.fogDensity}}),czm_splitPosition:new zt({size:1,datatype:fe.FLOAT,getValue:function(e){return e.splitPosition}}),czm_geometricToleranceOverMeter:new zt({size:1,datatype:fe.FLOAT,getValue:function(e){return e.geometricToleranceOverMeter}}),czm_minimumDisableDepthTestDistance:new zt({size:1,datatype:fe.FLOAT,getValue:function(e){return e.minimumDisableDepthTestDistance}}),czm_invertClassificationColor:new zt({size:1,datatype:fe.FLOAT_VEC4,getValue:function(e){return e.invertClassificationColor}}),czm_gamma:new zt({size:1,datatype:fe.FLOAT,getValue:function(e){return e.gamma}}),czm_ellipsoidRadii:new zt({size:1,datatype:fe.FLOAT_VEC3,getValue:function(e){return e.ellipsoid.radii}}),czm_ellipsoidInverseRadii:new zt({size:1,datatype:fe.FLOAT_VEC3,getValue:function(e){return e.ellipsoid.oneOverRadii}})},_D=jxe;function ma(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}function Yxe(){return!0}function Je(e,t){t=A(t,"This object was destroyed, i.e., destroy() was called.");function n(){throw new w(t)}for(const i in e)typeof e[i]=="function"&&(e[i]=n);e.isDestroyed=Yxe}const xs={UNSIGNED_BYTE:fe.UNSIGNED_BYTE,UNSIGNED_SHORT:fe.UNSIGNED_SHORT,UNSIGNED_INT:fe.UNSIGNED_INT};xs.getSizeInBytes=function(e){switch(e){case xs.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case xs.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case xs.UNSIGNED_INT:return Uint32Array.BYTES_PER_ELEMENT}throw new w("indexDatatype is required and must be a valid IndexDatatype constant.")};xs.fromSizeInBytes=function(e){switch(e){case 2:return xs.UNSIGNED_SHORT;case 4:return xs.UNSIGNED_INT;case 1:return xs.UNSIGNED_BYTE;default:throw new w("Size in bytes cannot be mapped to an IndexDatatype")}};xs.validate=function(e){return l(e)&&(e===xs.UNSIGNED_BYTE||e===xs.UNSIGNED_SHORT||e===xs.UNSIGNED_INT)};xs.createTypedArray=function(e,t){if(!l(e))throw new w("numberOfVertices is required.");return e>=F.SIXTY_FOUR_KILOBYTES?new Uint32Array(t):new Uint16Array(t)};xs.createTypedArrayFromArrayBuffer=function(e,t,n,i){if(!l(e))throw new w("numberOfVertices is required.");if(!l(t))throw new w("sourceArray is required.");if(!l(n))throw new w("byteOffset is required.");return e>=F.SIXTY_FOUR_KILOBYTES?new Uint32Array(t,n,i):new Uint16Array(t,n,i)};xs.fromTypedArray=function(e){if(e instanceof Uint8Array)return xs.UNSIGNED_BYTE;if(e instanceof Uint16Array)return xs.UNSIGNED_SHORT;if(e instanceof Uint32Array)return xs.UNSIGNED_INT;throw new w("array must be a Uint8Array, Uint16Array, or Uint32Array.")};const At=Object.freeze(xs),gD={STREAM_DRAW:fe.STREAM_DRAW,STATIC_DRAW:fe.STATIC_DRAW,DYNAMIC_DRAW:fe.DYNAMIC_DRAW,validate:function(e){return e===gD.STREAM_DRAW||e===gD.STATIC_DRAW||e===gD.DYNAMIC_DRAW}},mt=Object.freeze(gD);function Mt(e){if(e=A(e,A.EMPTY_OBJECT),E.defined("options.context",e.context),!l(e.typedArray)&&!l(e.sizeInBytes))throw new w("Either options.sizeInBytes or options.typedArray is required.");if(l(e.typedArray)&&l(e.sizeInBytes))throw new w("Cannot pass in both options.sizeInBytes and options.typedArray.");if(l(e.typedArray)&&(E.typeOf.object("options.typedArray",e.typedArray),E.typeOf.number("options.typedArray.byteLength",e.typedArray.byteLength)),!mt.validate(e.usage))throw new w("usage is invalid.");const t=e.context._gl,n=e.bufferTarget,i=e.typedArray;let o=e.sizeInBytes;const r=e.usage,s=l(i);s&&(o=i.byteLength),E.typeOf.number.greaterThan("sizeInBytes",o,0);const a=t.createBuffer();t.bindBuffer(n,a),t.bufferData(n,s?i:o,r),t.bindBuffer(n,null),this._id=ma(),this._gl=t,this._webgl2=e.context._webgl2,this._bufferTarget=n,this._sizeInBytes=o,this._usage=r,this._buffer=a,this.vertexArrayDestroyable=!0}Mt.createVertexBuffer=function(e){return E.defined("options.context",e.context),new Mt({context:e.context,bufferTarget:fe.ARRAY_BUFFER,typedArray:e.typedArray,sizeInBytes:e.sizeInBytes,usage:e.usage})};Mt.createIndexBuffer=function(e){if(E.defined("options.context",e.context),!At.validate(e.indexDatatype))throw new w("Invalid indexDatatype.");if(e.indexDatatype===At.UNSIGNED_INT&&!e.context.elementIndexUint)throw new w("IndexDatatype.UNSIGNED_INT requires OES_element_index_uint, which is not supported on this system. Check context.elementIndexUint.");const t=e.context,n=e.indexDatatype,i=At.getSizeInBytes(n),o=new Mt({context:t,bufferTarget:fe.ELEMENT_ARRAY_BUFFER,typedArray:e.typedArray,sizeInBytes:e.sizeInBytes,usage:e.usage}),r=o.sizeInBytes/i;return Object.defineProperties(o,{indexDatatype:{get:function(){return n}},bytesPerIndex:{get:function(){return i}},numberOfIndices:{get:function(){return r}}}),o};Object.defineProperties(Mt.prototype,{sizeInBytes:{get:function(){return this._sizeInBytes}},usage:{get:function(){return this._usage}}});Mt.prototype._getBuffer=function(){return this._buffer};Mt.prototype.copyFromArrayView=function(e,t){t=A(t,0),E.defined("arrayView",e),E.typeOf.number.lessThanOrEquals("offsetInBytes + arrayView.byteLength",t+e.byteLength,this._sizeInBytes);const n=this._gl,i=this._bufferTarget;n.bindBuffer(i,this._buffer),n.bufferSubData(i,t,e),n.bindBuffer(i,null)};Mt.prototype.copyFromBuffer=function(e,t,n,i){if(!this._webgl2)throw new w("A WebGL 2 context is required.");if(!l(e))throw new w("readBuffer must be defined.");if(!l(i)||i<=0)throw new w("sizeInBytes must be defined and be greater than zero.");if(!l(t)||t<0||t+i>e._sizeInBytes)throw new w("readOffset must be greater than or equal to zero and readOffset + sizeInBytes must be less than of equal to readBuffer.sizeInBytes.");if(!l(n)||n<0||n+i>this._sizeInBytes)throw new w("writeOffset must be greater than or equal to zero and writeOffset + sizeInBytes must be less than of equal to this.sizeInBytes.");if(this._buffer===e._buffer&&(n>=t&&n<t+i||t>n&&t<n+i))throw new w("When readBuffer is equal to this, the ranges [readOffset + sizeInBytes) and [writeOffset, writeOffset + sizeInBytes) must not overlap.");if(this._bufferTarget===fe.ELEMENT_ARRAY_BUFFER&&e._bufferTarget!==fe.ELEMENT_ARRAY_BUFFER||this._bufferTarget!==fe.ELEMENT_ARRAY_BUFFER&&e._bufferTarget===fe.ELEMENT_ARRAY_BUFFER)throw new w("Can not copy an index buffer into another buffer type.");const o=fe.COPY_READ_BUFFER,r=fe.COPY_WRITE_BUFFER,s=this._gl;s.bindBuffer(r,this._buffer),s.bindBuffer(o,e._buffer),s.copyBufferSubData(o,r,t,n,i),s.bindBuffer(r,null),s.bindBuffer(o,null)};Mt.prototype.getBufferData=function(e,t,n,i){if(t=A(t,0),n=A(n,0),!this._webgl2)throw new w("A WebGL 2 context is required.");if(!l(e))throw new w("arrayView is required.");let o,r,s=e.byteLength;if(l(i)?(o=i,l(s)?r=1:(s=e.length,r=e.BYTES_PER_ELEMENT)):l(s)?(o=s-n,r=1):(s=e.length,o=s-n,r=e.BYTES_PER_ELEMENT),n<0||n>s)throw new w("destinationOffset must be greater than zero and less than the arrayView length.");if(n+o>s)throw new w("destinationOffset + length must be less than or equal to the arrayViewLength.");if(t<0||t>this._sizeInBytes)throw new w("sourceOffset must be greater than zero and less than the buffers size.");if(t+o*r>this._sizeInBytes)throw new w("sourceOffset + length must be less than the buffers size.");const a=this._gl,c=fe.COPY_READ_BUFFER;a.bindBuffer(c,this._buffer),a.getBufferSubData(c,t,e,n,i),a.bindBuffer(c,null)};Mt.prototype.isDestroyed=function(){return!1};Mt.prototype.destroy=function(){return this._gl.deleteBuffer(this._buffer),Je(this)};let Gp;const wr={requestFullscreen:void 0,exitFullscreen:void 0,fullscreenEnabled:void 0,fullscreenElement:void 0,fullscreenchange:void 0,fullscreenerror:void 0},Nc={};Object.defineProperties(Nc,{element:{get:function(){if(Nc.supportsFullscreen())return document[wr.fullscreenElement]}},changeEventName:{get:function(){if(Nc.supportsFullscreen())return wr.fullscreenchange}},errorEventName:{get:function(){if(Nc.supportsFullscreen())return wr.fullscreenerror}},enabled:{get:function(){if(Nc.supportsFullscreen())return document[wr.fullscreenEnabled]}},fullscreen:{get:function(){if(Nc.supportsFullscreen())return Nc.element!==null}}});Nc.supportsFullscreen=function(){if(l(Gp))return Gp;Gp=!1;const e=document.body;if(typeof e.requestFullscreen=="function")return wr.requestFullscreen="requestFullscreen",wr.exitFullscreen="exitFullscreen",wr.fullscreenEnabled="fullscreenEnabled",wr.fullscreenElement="fullscreenElement",wr.fullscreenchange="fullscreenchange",wr.fullscreenerror="fullscreenerror",Gp=!0,Gp;const t=["webkit","moz","o","ms","khtml"];let n;for(let i=0,o=t.length;i<o;++i){const r=t[i];n=`${r}RequestFullscreen`,typeof e[n]=="function"?(wr.requestFullscreen=n,Gp=!0):(n=`${r}RequestFullScreen`,typeof e[n]=="function"&&(wr.requestFullscreen=n,Gp=!0)),n=`${r}ExitFullscreen`,typeof document[n]=="function"?wr.exitFullscreen=n:(n=`${r}CancelFullScreen`,typeof document[n]=="function"&&(wr.exitFullscreen=n)),n=`${r}FullscreenEnabled`,document[n]!==void 0?wr.fullscreenEnabled=n:(n=`${r}FullScreenEnabled`,document[n]!==void 0&&(wr.fullscreenEnabled=n)),n=`${r}FullscreenElement`,document[n]!==void 0?wr.fullscreenElement=n:(n=`${r}FullScreenElement`,document[n]!==void 0&&(wr.fullscreenElement=n)),n=`${r}fullscreenchange`,document[`on${n}`]!==void 0&&(r==="ms"&&(n="MSFullscreenChange"),wr.fullscreenchange=n),n=`${r}fullscreenerror`,document[`on${n}`]!==void 0&&(r==="ms"&&(n="MSFullscreenError"),wr.fullscreenerror=n)}return Gp};Nc.requestFullscreen=function(e,t){Nc.supportsFullscreen()&&e[wr.requestFullscreen]({vrDisplay:t})};Nc.exitFullscreen=function(){Nc.supportsFullscreen()&&document[wr.exitFullscreen]()};Nc._names=wr;const zs=Nc;let Ua;typeof navigator<"u"?Ua=navigator:Ua={};function Zg(e){const t=e.split(".");for(let n=0,i=t.length;n<i;++n)t[n]=parseInt(t[n],10);return t}let uS,pX;function I3(){if(!l(uS)&&(uS=!1,!k1())){const e=/ Chrome\/([\.0-9]+)/.exec(Ua.userAgent);e!==null&&(uS=!0,pX=Zg(e[1]))}return uS}function $xe(){return I3()&&pX}let fS,mX;function _X(){if(!l(fS)&&(fS=!1,!I3()&&!k1()&&/ Safari\/[\.0-9]+/.test(Ua.userAgent))){const e=/ Version\/([\.0-9]+)/.exec(Ua.userAgent);e!==null&&(fS=!0,mX=Zg(e[1]))}return fS}function Xxe(){return _X()&&mX}let dS,FM;function gX(){if(!l(dS)){dS=!1;const e=/ AppleWebKit\/([\.0-9]+)(\+?)/.exec(Ua.userAgent);e!==null&&(dS=!0,FM=Zg(e[1]),FM.isNightly=!!e[2])}return dS}function Kxe(){return gX()&&FM}let pC,zM;function yX(){if(!l(pC)){pC=!1;let e;Ua.appName==="Microsoft Internet Explorer"?(e=/MSIE ([0-9]{1,}[\.0-9]{0,})/.exec(Ua.userAgent),e!==null&&(pC=!0,zM=Zg(e[1]))):Ua.appName==="Netscape"&&(e=/Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/.exec(Ua.userAgent),e!==null&&(pC=!0,zM=Zg(e[1])))}return pC}function Jxe(){return yX()&&zM}let hS,AX;function k1(){if(!l(hS)){hS=!1;const e=/ Edg\/([\.0-9]+)/.exec(Ua.userAgent);e!==null&&(hS=!0,AX=Zg(e[1]))}return hS}function Qxe(){return k1()&&AX}let pS,TX;function P3(){if(!l(pS)){pS=!1;const e=/Firefox\/([\.0-9]+)/.exec(Ua.userAgent);e!==null&&(pS=!0,TX=Zg(e[1]))}return pS}let BL;function Zxe(){return l(BL)||(BL=/Windows/i.test(Ua.appVersion)),BL}let RL;function ewe(){return l(RL)||(RL=navigator.platform==="iPhone"||navigator.platform==="iPod"||navigator.platform==="iPad"),RL}function twe(){return P3()&&TX}let NL;function nwe(){return l(NL)||(NL=!P3()&&typeof PointerEvent<"u"&&(!l(Ua.pointerEnabled)||Ua.pointerEnabled)),NL}let CX,mS;function bX(){if(!l(mS)){const e=document.createElement("canvas");e.setAttribute("style","image-rendering: -moz-crisp-edges;image-rendering: pixelated;");const t=e.style.imageRendering;mS=l(t)&&t!=="",mS&&(CX=t)}return mS}function iwe(){return bX()?CX:void 0}function va(){if(!va.initialized)throw new w("You must call FeatureDetection.supportsWebP.initialize and wait for the promise to resolve before calling FeatureDetection.supportsWebP");return va._result}va._promise=void 0;va._result=void 0;va.initialize=function(){return l(va._promise)||(va._promise=new Promise(e=>{const t=new Image;t.onload=function(){va._result=t.width>0&&t.height>0,e(va._result)},t.onerror=function(){va._result=!1,e(va._result)},t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA"})),va._promise};Object.defineProperties(va,{initialized:{get:function(){return l(va._result)}}});const K0=[];typeof ArrayBuffer<"u"&&(K0.push(Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array),typeof Uint8ClampedArray<"u"&&K0.push(Uint8ClampedArray),typeof Uint8ClampedArray<"u"&&K0.push(Uint8ClampedArray),typeof BigInt64Array<"u"&&K0.push(BigInt64Array),typeof BigUint64Array<"u"&&K0.push(BigUint64Array));const yd={isChrome:I3,chromeVersion:$xe,isSafari:_X,safariVersion:Xxe,isWebkit:gX,webkitVersion:Kxe,isInternetExplorer:yX,internetExplorerVersion:Jxe,isEdge:k1,edgeVersion:Qxe,isFirefox:P3,firefoxVersion:twe,isWindows:Zxe,isIPadOrIOS:ewe,hardwareConcurrency:A(Ua.hardwareConcurrency,3),supportsPointerEvents:nwe,supportsImageRenderingPixelated:bX,supportsWebP:va,imageRenderingValue:iwe,typedArrayTypes:K0};yd.supportsBasis=function(e){return yd.supportsWebAssembly()&&e.context.supportsBasis};yd.supportsFullscreen=function(){return zs.supportsFullscreen()};yd.supportsTypedArrays=function(){return typeof ArrayBuffer<"u"};yd.supportsBigInt64Array=function(){return typeof BigInt64Array<"u"};yd.supportsBigUint64Array=function(){return typeof BigUint64Array<"u"};yd.supportsBigInt=function(){return typeof BigInt<"u"};yd.supportsWebWorkers=function(){return typeof Worker<"u"};yd.supportsWebAssembly=function(){return typeof WebAssembly<"u"};const Mn=yd;function ML(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n*6<1?e+(t-e)*6*n:n*2<1?t:n*3<2?e+(t-e)*(2/3-n)*6:e}function k(e,t,n,i){this.red=A(e,1),this.green=A(t,1),this.blue=A(n,1),this.alpha=A(i,1)}k.fromCartesian4=function(e,t){return E.typeOf.object("cartesian",e),l(t)?(t.red=e.x,t.green=e.y,t.blue=e.z,t.alpha=e.w,t):new k(e.x,e.y,e.z,e.w)};k.fromBytes=function(e,t,n,i,o){return e=k.byteToFloat(A(e,255)),t=k.byteToFloat(A(t,255)),n=k.byteToFloat(A(n,255)),i=k.byteToFloat(A(i,255)),l(o)?(o.red=e,o.green=t,o.blue=n,o.alpha=i,o):new k(e,t,n,i)};k.fromAlpha=function(e,t,n){return E.typeOf.object("color",e),E.typeOf.number("alpha",t),l(n)?(n.red=e.red,n.green=e.green,n.blue=e.blue,n.alpha=t,n):new k(e.red,e.green,e.blue,t)};let FL,O3,Sh;Mn.supportsTypedArrays()&&(FL=new ArrayBuffer(4),O3=new Uint32Array(FL),Sh=new Uint8Array(FL));k.fromRgba=function(e,t){return O3[0]=e,k.fromBytes(Sh[0],Sh[1],Sh[2],Sh[3],t)};k.fromHsl=function(e,t,n,i,o){e=A(e,0)%1,t=A(t,0),n=A(n,0),i=A(i,1);let r=n,s=n,a=n;if(t!==0){let c;n<.5?c=n*(1+t):c=n+t-n*t;const u=2*n-c;r=ML(u,c,e+1/3),s=ML(u,c,e),a=ML(u,c,e-1/3)}return l(o)?(o.red=r,o.green=s,o.blue=a,o.alpha=i,o):new k(r,s,a,i)};k.fromRandom=function(e,t){e=A(e,A.EMPTY_OBJECT);let n=e.red;if(!l(n)){const s=A(e.minimumRed,0),a=A(e.maximumRed,1);E.typeOf.number.lessThanOrEquals("minimumRed",s,a),n=s+F.nextRandomNumber()*(a-s)}let i=e.green;if(!l(i)){const s=A(e.minimumGreen,0),a=A(e.maximumGreen,1);E.typeOf.number.lessThanOrEquals("minimumGreen",s,a),i=s+F.nextRandomNumber()*(a-s)}let o=e.blue;if(!l(o)){const s=A(e.minimumBlue,0),a=A(e.maximumBlue,1);E.typeOf.number.lessThanOrEquals("minimumBlue",s,a),o=s+F.nextRandomNumber()*(a-s)}let r=e.alpha;if(!l(r)){const s=A(e.minimumAlpha,0),a=A(e.maximumAlpha,1);E.typeOf.number.lessThanOrEquals("minumumAlpha",s,a),r=s+F.nextRandomNumber()*(a-s)}return l(t)?(t.red=n,t.green=i,t.blue=o,t.alpha=r,t):new k(n,i,o,r)};const owe=/^#([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])?$/i,rwe=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})?$/i,swe=/^rgba?\(\s*([0-9.]+%?)\s*,\s*([0-9.]+%?)\s*,\s*([0-9.]+%?)(?:\s*,\s*([0-9.]+))?\s*\)$/i,awe=/^hsla?\(\s*([0-9.]+)\s*,\s*([0-9.]+%)\s*,\s*([0-9.]+%)(?:\s*,\s*([0-9.]+))?\s*\)$/i;k.fromCssColorString=function(e,t){E.typeOf.string("color",e),l(t)||(t=new k),e=e.replace(/\s/g,"");const n=k[e.toUpperCase()];if(l(n))return k.clone(n,t),t;let i=owe.exec(e);return i!==null?(t.red=parseInt(i[1],16)/15,t.green=parseInt(i[2],16)/15,t.blue=parseInt(i[3],16)/15,t.alpha=parseInt(A(i[4],"f"),16)/15,t):(i=rwe.exec(e),i!==null?(t.red=parseInt(i[1],16)/255,t.green=parseInt(i[2],16)/255,t.blue=parseInt(i[3],16)/255,t.alpha=parseInt(A(i[4],"ff"),16)/255,t):(i=swe.exec(e),i!==null?(t.red=parseFloat(i[1])/(i[1].substr(-1)==="%"?100:255),t.green=parseFloat(i[2])/(i[2].substr(-1)==="%"?100:255),t.blue=parseFloat(i[3])/(i[3].substr(-1)==="%"?100:255),t.alpha=parseFloat(A(i[4],"1.0")),t):(i=awe.exec(e),i!==null?k.fromHsl(parseFloat(i[1])/360,parseFloat(i[2])/100,parseFloat(i[3])/100,parseFloat(A(i[4],"1.0")),t):(t=void 0,t))))};k.packedLength=4;k.pack=function(e,t,n){return E.typeOf.object("value",e),E.defined("array",t),n=A(n,0),t[n++]=e.red,t[n++]=e.green,t[n++]=e.blue,t[n]=e.alpha,t};k.unpack=function(e,t,n){return E.defined("array",e),t=A(t,0),l(n)||(n=new k),n.red=e[t++],n.green=e[t++],n.blue=e[t++],n.alpha=e[t],n};k.byteToFloat=function(e){return e/255};k.floatToByte=function(e){return e===1?255:e*256|0};k.clone=function(e,t){if(l(e))return l(t)?(t.red=e.red,t.green=e.green,t.blue=e.blue,t.alpha=e.alpha,t):new k(e.red,e.green,e.blue,e.alpha)};k.equals=function(e,t){return e===t||l(e)&&l(t)&&e.red===t.red&&e.green===t.green&&e.blue===t.blue&&e.alpha===t.alpha};k.equalsArray=function(e,t,n){return e.red===t[n]&&e.green===t[n+1]&&e.blue===t[n+2]&&e.alpha===t[n+3]};k.prototype.clone=function(e){return k.clone(this,e)};k.prototype.equals=function(e){return k.equals(this,e)};k.prototype.equalsEpsilon=function(e,t){return this===e||l(e)&&Math.abs(this.red-e.red)<=t&&Math.abs(this.green-e.green)<=t&&Math.abs(this.blue-e.blue)<=t&&Math.abs(this.alpha-e.alpha)<=t};k.prototype.toString=function(){return`(${this.red}, ${this.green}, ${this.blue}, ${this.alpha})`};k.prototype.toCssColorString=function(){const e=k.floatToByte(this.red),t=k.floatToByte(this.green),n=k.floatToByte(this.blue);return this.alpha===1?`rgb(${e},${t},${n})`:`rgba(${e},${t},${n},${this.alpha})`};k.prototype.toCssHexString=function(){let e=k.floatToByte(this.red).toString(16);e.length<2&&(e=`0${e}`);let t=k.floatToByte(this.green).toString(16);t.length<2&&(t=`0${t}`);let n=k.floatToByte(this.blue).toString(16);if(n.length<2&&(n=`0${n}`),this.alpha<1){let i=k.floatToByte(this.alpha).toString(16);return i.length<2&&(i=`0${i}`),`#${e}${t}${n}${i}`}return`#${e}${t}${n}`};k.prototype.toBytes=function(e){const t=k.floatToByte(this.red),n=k.floatToByte(this.green),i=k.floatToByte(this.blue),o=k.floatToByte(this.alpha);return l(e)?(e[0]=t,e[1]=n,e[2]=i,e[3]=o,e):[t,n,i,o]};k.prototype.toRgba=function(){return Sh[0]=k.floatToByte(this.red),Sh[1]=k.floatToByte(this.green),Sh[2]=k.floatToByte(this.blue),Sh[3]=k.floatToByte(this.alpha),O3[0]};k.prototype.brighten=function(e,t){return E.typeOf.number("magnitude",e),E.typeOf.number.greaterThanOrEquals("magnitude",e,0),E.typeOf.object("result",t),e=1-e,t.red=1-(1-this.red)*e,t.green=1-(1-this.green)*e,t.blue=1-(1-this.blue)*e,t.alpha=this.alpha,t};k.prototype.darken=function(e,t){return E.typeOf.number("magnitude",e),E.typeOf.number.greaterThanOrEquals("magnitude",e,0),E.typeOf.object("result",t),e=1-e,t.red=this.red*e,t.green=this.green*e,t.blue=this.blue*e,t.alpha=this.alpha,t};k.prototype.withAlpha=function(e,t){return k.fromAlpha(this,e,t)};k.add=function(e,t,n){return E.typeOf.object("left",e),E.typeOf.object("right",t),E.typeOf.object("result",n),n.red=e.red+t.red,n.green=e.green+t.green,n.blue=e.blue+t.blue,n.alpha=e.alpha+t.alpha,n};k.subtract=function(e,t,n){return E.typeOf.object("left",e),E.typeOf.object("right",t),E.typeOf.object("result",n),n.red=e.red-t.red,n.green=e.green-t.green,n.blue=e.blue-t.blue,n.alpha=e.alpha-t.alpha,n};k.multiply=function(e,t,n){return E.typeOf.object("left",e),E.typeOf.object("right",t),E.typeOf.object("result",n),n.red=e.red*t.red,n.green=e.green*t.green,n.blue=e.blue*t.blue,n.alpha=e.alpha*t.alpha,n};k.divide=function(e,t,n){return E.typeOf.object("left",e),E.typeOf.object("right",t),E.typeOf.object("result",n),n.red=e.red/t.red,n.green=e.green/t.green,n.blue=e.blue/t.blue,n.alpha=e.alpha/t.alpha,n};k.mod=function(e,t,n){return E.typeOf.object("left",e),E.typeOf.object("right",t),E.typeOf.object("result",n),n.red=e.red%t.red,n.green=e.green%t.green,n.blue=e.blue%t.blue,n.alpha=e.alpha%t.alpha,n};k.lerp=function(e,t,n,i){return E.typeOf.object("start",e),E.typeOf.object("end",t),E.typeOf.number("t",n),E.typeOf.object("result",i),i.red=F.lerp(e.red,t.red,n),i.green=F.lerp(e.green,t.green,n),i.blue=F.lerp(e.blue,t.blue,n),i.alpha=F.lerp(e.alpha,t.alpha,n),i};k.multiplyByScalar=function(e,t,n){return E.typeOf.object("color",e),E.typeOf.number("scalar",t),E.typeOf.object("result",n),n.red=e.red*t,n.green=e.green*t,n.blue=e.blue*t,n.alpha=e.alpha*t,n};k.divideByScalar=function(e,t,n){return E.typeOf.object("color",e),E.typeOf.number("scalar",t),E.typeOf.object("result",n),n.red=e.red/t,n.green=e.green/t,n.blue=e.blue/t,n.alpha=e.alpha/t,n};k.ALICEBLUE=Object.freeze(k.fromCssColorString("#F0F8FF"));k.ANTIQUEWHITE=Object.freeze(k.fromCssColorString("#FAEBD7"));k.AQUA=Object.freeze(k.fromCssColorString("#00FFFF"));k.AQUAMARINE=Object.freeze(k.fromCssColorString("#7FFFD4"));k.AZURE=Object.freeze(k.fromCssColorString("#F0FFFF"));k.BEIGE=Object.freeze(k.fromCssColorString("#F5F5DC"));k.BISQUE=Object.freeze(k.fromCssColorString("#FFE4C4"));k.BLACK=Object.freeze(k.fromCssColorString("#000000"));k.BLANCHEDALMOND=Object.freeze(k.fromCssColorString("#FFEBCD"));k.BLUE=Object.freeze(k.fromCssColorString("#0000FF"));k.BLUEVIOLET=Object.freeze(k.fromCssColorString("#8A2BE2"));k.BROWN=Object.freeze(k.fromCssColorString("#A52A2A"));k.BURLYWOOD=Object.freeze(k.fromCssColorString("#DEB887"));k.CADETBLUE=Object.freeze(k.fromCssColorString("#5F9EA0"));k.CHARTREUSE=Object.freeze(k.fromCssColorString("#7FFF00"));k.CHOCOLATE=Object.freeze(k.fromCssColorString("#D2691E"));k.CORAL=Object.freeze(k.fromCssColorString("#FF7F50"));k.CORNFLOWERBLUE=Object.freeze(k.fromCssColorString("#6495ED"));k.CORNSILK=Object.freeze(k.fromCssColorString("#FFF8DC"));k.CRIMSON=Object.freeze(k.fromCssColorString("#DC143C"));k.CYAN=Object.freeze(k.fromCssColorString("#00FFFF"));k.DARKBLUE=Object.freeze(k.fromCssColorString("#00008B"));k.DARKCYAN=Object.freeze(k.fromCssColorString("#008B8B"));k.DARKGOLDENROD=Object.freeze(k.fromCssColorString("#B8860B"));k.DARKGRAY=Object.freeze(k.fromCssColorString("#A9A9A9"));k.DARKGREEN=Object.freeze(k.fromCssColorString("#006400"));k.DARKGREY=k.DARKGRAY;k.DARKKHAKI=Object.freeze(k.fromCssColorString("#BDB76B"));k.DARKMAGENTA=Object.freeze(k.fromCssColorString("#8B008B"));k.DARKOLIVEGREEN=Object.freeze(k.fromCssColorString("#556B2F"));k.DARKORANGE=Object.freeze(k.fromCssColorString("#FF8C00"));k.DARKORCHID=Object.freeze(k.fromCssColorString("#9932CC"));k.DARKRED=Object.freeze(k.fromCssColorString("#8B0000"));k.DARKSALMON=Object.freeze(k.fromCssColorString("#E9967A"));k.DARKSEAGREEN=Object.freeze(k.fromCssColorString("#8FBC8F"));k.DARKSLATEBLUE=Object.freeze(k.fromCssColorString("#483D8B"));k.DARKSLATEGRAY=Object.freeze(k.fromCssColorString("#2F4F4F"));k.DARKSLATEGREY=k.DARKSLATEGRAY;k.DARKTURQUOISE=Object.freeze(k.fromCssColorString("#00CED1"));k.DARKVIOLET=Object.freeze(k.fromCssColorString("#9400D3"));k.DEEPPINK=Object.freeze(k.fromCssColorString("#FF1493"));k.DEEPSKYBLUE=Object.freeze(k.fromCssColorString("#00BFFF"));k.DIMGRAY=Object.freeze(k.fromCssColorString("#696969"));k.DIMGREY=k.DIMGRAY;k.DODGERBLUE=Object.freeze(k.fromCssColorString("#1E90FF"));k.FIREBRICK=Object.freeze(k.fromCssColorString("#B22222"));k.FLORALWHITE=Object.freeze(k.fromCssColorString("#FFFAF0"));k.FORESTGREEN=Object.freeze(k.fromCssColorString("#228B22"));k.FUCHSIA=Object.freeze(k.fromCssColorString("#FF00FF"));k.GAINSBORO=Object.freeze(k.fromCssColorString("#DCDCDC"));k.GHOSTWHITE=Object.freeze(k.fromCssColorString("#F8F8FF"));k.GOLD=Object.freeze(k.fromCssColorString("#FFD700"));k.GOLDENROD=Object.freeze(k.fromCssColorString("#DAA520"));k.GRAY=Object.freeze(k.fromCssColorString("#808080"));k.GREEN=Object.freeze(k.fromCssColorString("#008000"));k.GREENYELLOW=Object.freeze(k.fromCssColorString("#ADFF2F"));k.GREY=k.GRAY;k.HONEYDEW=Object.freeze(k.fromCssColorString("#F0FFF0"));k.HOTPINK=Object.freeze(k.fromCssColorString("#FF69B4"));k.INDIANRED=Object.freeze(k.fromCssColorString("#CD5C5C"));k.INDIGO=Object.freeze(k.fromCssColorString("#4B0082"));k.IVORY=Object.freeze(k.fromCssColorString("#FFFFF0"));k.KHAKI=Object.freeze(k.fromCssColorString("#F0E68C"));k.LAVENDER=Object.freeze(k.fromCssColorString("#E6E6FA"));k.LAVENDAR_BLUSH=Object.freeze(k.fromCssColorString("#FFF0F5"));k.LAWNGREEN=Object.freeze(k.fromCssColorString("#7CFC00"));k.LEMONCHIFFON=Object.freeze(k.fromCssColorString("#FFFACD"));k.LIGHTBLUE=Object.freeze(k.fromCssColorString("#ADD8E6"));k.LIGHTCORAL=Object.freeze(k.fromCssColorString("#F08080"));k.LIGHTCYAN=Object.freeze(k.fromCssColorString("#E0FFFF"));k.LIGHTGOLDENRODYELLOW=Object.freeze(k.fromCssColorString("#FAFAD2"));k.LIGHTGRAY=Object.freeze(k.fromCssColorString("#D3D3D3"));k.LIGHTGREEN=Object.freeze(k.fromCssColorString("#90EE90"));k.LIGHTGREY=k.LIGHTGRAY;k.LIGHTPINK=Object.freeze(k.fromCssColorString("#FFB6C1"));k.LIGHTSEAGREEN=Object.freeze(k.fromCssColorString("#20B2AA"));k.LIGHTSKYBLUE=Object.freeze(k.fromCssColorString("#87CEFA"));k.LIGHTSLATEGRAY=Object.freeze(k.fromCssColorString("#778899"));k.LIGHTSLATEGREY=k.LIGHTSLATEGRAY;k.LIGHTSTEELBLUE=Object.freeze(k.fromCssColorString("#B0C4DE"));k.LIGHTYELLOW=Object.freeze(k.fromCssColorString("#FFFFE0"));k.LIME=Object.freeze(k.fromCssColorString("#00FF00"));k.LIMEGREEN=Object.freeze(k.fromCssColorString("#32CD32"));k.LINEN=Object.freeze(k.fromCssColorString("#FAF0E6"));k.MAGENTA=Object.freeze(k.fromCssColorString("#FF00FF"));k.MAROON=Object.freeze(k.fromCssColorString("#800000"));k.MEDIUMAQUAMARINE=Object.freeze(k.fromCssColorString("#66CDAA"));k.MEDIUMBLUE=Object.freeze(k.fromCssColorString("#0000CD"));k.MEDIUMORCHID=Object.freeze(k.fromCssColorString("#BA55D3"));k.MEDIUMPURPLE=Object.freeze(k.fromCssColorString("#9370DB"));k.MEDIUMSEAGREEN=Object.freeze(k.fromCssColorString("#3CB371"));k.MEDIUMSLATEBLUE=Object.freeze(k.fromCssColorString("#7B68EE"));k.MEDIUMSPRINGGREEN=Object.freeze(k.fromCssColorString("#00FA9A"));k.MEDIUMTURQUOISE=Object.freeze(k.fromCssColorString("#48D1CC"));k.MEDIUMVIOLETRED=Object.freeze(k.fromCssColorString("#C71585"));k.MIDNIGHTBLUE=Object.freeze(k.fromCssColorString("#191970"));k.MINTCREAM=Object.freeze(k.fromCssColorString("#F5FFFA"));k.MISTYROSE=Object.freeze(k.fromCssColorString("#FFE4E1"));k.MOCCASIN=Object.freeze(k.fromCssColorString("#FFE4B5"));k.NAVAJOWHITE=Object.freeze(k.fromCssColorString("#FFDEAD"));k.NAVY=Object.freeze(k.fromCssColorString("#000080"));k.OLDLACE=Object.freeze(k.fromCssColorString("#FDF5E6"));k.OLIVE=Object.freeze(k.fromCssColorString("#808000"));k.OLIVEDRAB=Object.freeze(k.fromCssColorString("#6B8E23"));k.ORANGE=Object.freeze(k.fromCssColorString("#FFA500"));k.ORANGERED=Object.freeze(k.fromCssColorString("#FF4500"));k.ORCHID=Object.freeze(k.fromCssColorString("#DA70D6"));k.PALEGOLDENROD=Object.freeze(k.fromCssColorString("#EEE8AA"));k.PALEGREEN=Object.freeze(k.fromCssColorString("#98FB98"));k.PALETURQUOISE=Object.freeze(k.fromCssColorString("#AFEEEE"));k.PALEVIOLETRED=Object.freeze(k.fromCssColorString("#DB7093"));k.PAPAYAWHIP=Object.freeze(k.fromCssColorString("#FFEFD5"));k.PEACHPUFF=Object.freeze(k.fromCssColorString("#FFDAB9"));k.PERU=Object.freeze(k.fromCssColorString("#CD853F"));k.PINK=Object.freeze(k.fromCssColorString("#FFC0CB"));k.PLUM=Object.freeze(k.fromCssColorString("#DDA0DD"));k.POWDERBLUE=Object.freeze(k.fromCssColorString("#B0E0E6"));k.PURPLE=Object.freeze(k.fromCssColorString("#800080"));k.RED=Object.freeze(k.fromCssColorString("#FF0000"));k.ROSYBROWN=Object.freeze(k.fromCssColorString("#BC8F8F"));k.ROYALBLUE=Object.freeze(k.fromCssColorString("#4169E1"));k.SADDLEBROWN=Object.freeze(k.fromCssColorString("#8B4513"));k.SALMON=Object.freeze(k.fromCssColorString("#FA8072"));k.SANDYBROWN=Object.freeze(k.fromCssColorString("#F4A460"));k.SEAGREEN=Object.freeze(k.fromCssColorString("#2E8B57"));k.SEASHELL=Object.freeze(k.fromCssColorString("#FFF5EE"));k.SIENNA=Object.freeze(k.fromCssColorString("#A0522D"));k.SILVER=Object.freeze(k.fromCssColorString("#C0C0C0"));k.SKYBLUE=Object.freeze(k.fromCssColorString("#87CEEB"));k.SLATEBLUE=Object.freeze(k.fromCssColorString("#6A5ACD"));k.SLATEGRAY=Object.freeze(k.fromCssColorString("#708090"));k.SLATEGREY=k.SLATEGRAY;k.SNOW=Object.freeze(k.fromCssColorString("#FFFAFA"));k.SPRINGGREEN=Object.freeze(k.fromCssColorString("#00FF7F"));k.STEELBLUE=Object.freeze(k.fromCssColorString("#4682B4"));k.TAN=Object.freeze(k.fromCssColorString("#D2B48C"));k.TEAL=Object.freeze(k.fromCssColorString("#008080"));k.THISTLE=Object.freeze(k.fromCssColorString("#D8BFD8"));k.TOMATO=Object.freeze(k.fromCssColorString("#FF6347"));k.TURQUOISE=Object.freeze(k.fromCssColorString("#40E0D0"));k.VIOLET=Object.freeze(k.fromCssColorString("#EE82EE"));k.WHEAT=Object.freeze(k.fromCssColorString("#F5DEB3"));k.WHITE=Object.freeze(k.fromCssColorString("#FFFFFF"));k.WHITESMOKE=Object.freeze(k.fromCssColorString("#F5F5F5"));k.YELLOW=Object.freeze(k.fromCssColorString("#FFFF00"));k.YELLOWGREEN=Object.freeze(k.fromCssColorString("#9ACD32"));k.TRANSPARENT=Object.freeze(new k(0,0,0,0));function Bo(e){e=A(e,A.EMPTY_OBJECT),this.color=e.color,this.depth=e.depth,this.stencil=e.stencil,this.renderState=e.renderState,this.framebuffer=e.framebuffer,this.owner=e.owner,this.pass=e.pass}Bo.ALL=Object.freeze(new Bo({color:new k(0,0,0,0),depth:1,stencil:0}));Bo.prototype.execute=function(e,t){e.clear(this,t)};const cwe={ENVIRONMENT:0,COMPUTE:1,GLOBE:2,TERRAIN_CLASSIFICATION:3,CESIUM_3D_TILE:4,CESIUM_3D_TILE_CLASSIFICATION:5,CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW:6,OPAQUE:7,TRANSLUCENT:8,VOXELS:9,OVERLAY:10,NUMBER_OF_PASSES:11},We=Object.freeze(cwe);function AE(e){e=A(e,A.EMPTY_OBJECT),this.vertexArray=e.vertexArray,this.fragmentShaderSource=e.fragmentShaderSource,this.shaderProgram=e.shaderProgram,this.uniformMap=e.uniformMap,this.outputTexture=e.outputTexture,this.preExecute=e.preExecute,this.postExecute=e.postExecute,this.canceled=e.canceled,this.persists=A(e.persists,!1),this.pass=We.COMPUTE,this.owner=e.owner}AE.prototype.execute=function(e){e.execute(this)};function $(e,t){this.x=A(e,0),this.y=A(t,0)}$.fromElements=function(e,t,n){return l(n)?(n.x=e,n.y=t,n):new $(e,t)};$.clone=function(e,t){if(l(e))return l(t)?(t.x=e.x,t.y=e.y,t):new $(e.x,e.y)};$.fromCartesian3=$.clone;$.fromCartesian4=$.clone;$.packedLength=2;$.pack=function(e,t,n){return E.typeOf.object("value",e),E.defined("array",t),n=A(n,0),t[n++]=e.x,t[n]=e.y,t};$.unpack=function(e,t,n){return E.defined("array",e),t=A(t,0),l(n)||(n=new $),n.x=e[t++],n.y=e[t],n};$.packArray=function(e,t){E.defined("array",e);const n=e.length,i=n*2;if(!l(t))t=new Array(i);else{if(!Array.isArray(t)&&t.length!==i)throw new w("If result is a typed array, it must have exactly array.length * 2 elements");t.length!==i&&(t.length=i)}for(let o=0;o<n;++o)$.pack(e[o],t,o*2);return t};$.unpackArray=function(e,t){if(E.defined("array",e),E.typeOf.number.greaterThanOrEquals("array.length",e.length,2),e.length%2!==0)throw new w("array length must be a multiple of 2.");const n=e.length;l(t)?t.length=n/2:t=new Array(n/2);for(let i=0;i<n;i+=2){const o=i/2;t[o]=$.unpack(e,i,t[o])}return t};$.fromArray=$.unpack;$.maximumComponent=function(e){return E.typeOf.object("cartesian",e),Math.max(e.x,e.y)};$.minimumComponent=function(e){return E.typeOf.object("cartesian",e),Math.min(e.x,e.y)};$.minimumByComponent=function(e,t,n){return E.typeOf.object("first",e),E.typeOf.object("second",t),E.typeOf.object("result",n),n.x=Math.min(e.x,t.x),n.y=Math.min(e.y,t.y),n};$.maximumByComponent=function(e,t,n){return E.typeOf.object("first",e),E.typeOf.object("second",t),E.typeOf.object("result",n),n.x=Math.max(e.x,t.x),n.y=Math.max(e.y,t.y),n};$.clamp=function(e,t,n,i){E.typeOf.object("value",e),E.typeOf.object("min",t),E.typeOf.object("max",n),E.typeOf.object("result",i);const o=F.clamp(e.x,t.x,n.x),r=F.clamp(e.y,t.y,n.y);return i.x=o,i.y=r,i};$.magnitudeSquared=function(e){return E.typeOf.object("cartesian",e),e.x*e.x+e.y*e.y};$.magnitude=function(e){return Math.sqrt($.magnitudeSquared(e))};const bI=new $;$.distance=function(e,t){return E.typeOf.object("left",e),E.typeOf.object("right",t),$.subtract(e,t,bI),$.magnitude(bI)};$.distanceSquared=function(e,t){return E.typeOf.object("left",e),E.typeOf.object("right",t),$.subtract(e,t,bI),$.magnitudeSquared(bI)};$.normalize=function(e,t){E.typeOf.object("cartesian",e),E.typeOf.object("result",t);const n=$.magnitude(e);if(t.x=e.x/n,t.y=e.y/n,isNaN(t.x)||isNaN(t.y))throw new w("normalized result is not a number");return t};$.dot=function(e,t){return E.typeOf.object("left",e),E.typeOf.object("right",t),e.x*t.x+e.y*t.y};$.cross=function(e,t){return E.typeOf.object("left",e),E.typeOf.object("right",t),e.x*t.y-e.y*t.x};$.multiplyComponents=function(e,t,n){return E.typeOf.object("left",e),E.typeOf.object("right",t),E.typeOf.object("result",n),n.x=e.x*t.x,n.y=e.y*t.y,n};$.divideComponents=function(e,t,n){return E.typeOf.object("left",e),E.typeOf.object("right",t),E.typeOf.object("result",n),n.x=e.x/t.x,n.y=e.y/t.y,n};$.add=function(e,t,n){return E.typeOf.object("left",e),E.typeOf.object("right",t),E.typeOf.object("result",n),n.x=e.x+t.x,n.y=e.y+t.y,n};$.subtract=function(e,t,n){return E.typeOf.object("left",e),E.typeOf.object("right",t),E.typeOf.object("result",n),n.x=e.x-t.x,n.y=e.y-t.y,n};$.multiplyByScalar=function(e,t,n){return E.typeOf.object("cartesian",e),E.typeOf.number("scalar",t),E.typeOf.object("result",n),n.x=e.x*t,n.y=e.y*t,n};$.divideByScalar=function(e,t,n){return E.typeOf.object("cartesian",e),E.typeOf.number("scalar",t),E.typeOf.object("result",n),n.x=e.x/t,n.y=e.y/t,n};$.negate=function(e,t){return E.typeOf.object("cartesian",e),E.typeOf.object("result",t),t.x=-e.x,t.y=-e.y,t};$.abs=function(e,t){return E.typeOf.object("cartesian",e),E.typeOf.object("result",t),t.x=Math.abs(e.x),t.y=Math.abs(e.y),t};const LG=new $;$.lerp=function(e,t,n,i){return E.typeOf.object("start",e),E.typeOf.object("end",t),E.typeOf.number("t",n),E.typeOf.object("result",i),$.multiplyByScalar(t,n,LG),i=$.multiplyByScalar(e,1-n,i),$.add(LG,i,i)};const BG=new $,RG=new $;$.angleBetween=function(e,t){return E.typeOf.object("left",e),E.typeOf.object("right",t),$.normalize(e,BG),$.normalize(t,RG),F.acosClamped($.dot(BG,RG))};const lwe=new $;$.mostOrthogonalAxis=function(e,t){E.typeOf.object("cartesian",e),E.typeOf.object("result",t);const n=$.normalize(e,lwe);return $.abs(n,n),n.x<=n.y?t=$.clone($.UNIT_X,t):t=$.clone($.UNIT_Y,t),t};$.equals=function(e,t){return e===t||l(e)&&l(t)&&e.x===t.x&&e.y===t.y};$.equalsArray=function(e,t,n){return e.x===t[n]&&e.y===t[n+1]};$.equalsEpsilon=function(e,t,n,i){return e===t||l(e)&&l(t)&&F.equalsEpsilon(e.x,t.x,n,i)&&F.equalsEpsilon(e.y,t.y,n,i)};$.ZERO=Object.freeze(new $(0,0));$.ONE=Object.freeze(new $(1,1));$.UNIT_X=Object.freeze(new $(1,0));$.UNIT_Y=Object.freeze(new $(0,1));$.prototype.clone=function(e){return $.clone(this,e)};$.prototype.equals=function(e){return $.equals(this,e)};$.prototype.equalsEpsilon=function(e,t,n){return $.equalsEpsilon(this,e,t,n)};$.prototype.toString=function(){return`(${this.x}, ${this.y})`};const uwe=new d,fwe=new d;function EX(e,t,n,i,o){if(!l(e))throw new w("cartesian is required.");if(!l(t))throw new w("oneOverRadii is required.");if(!l(n))throw new w("oneOverRadiiSquared is required.");if(!l(i))throw new w("centerToleranceSquared is required.");const r=e.x,s=e.y,a=e.z,c=t.x,u=t.y,f=t.z,h=r*r*c*c,_=s*s*u*u,g=a*a*f*f,p=h+_+g,y=Math.sqrt(1/p),T=d.multiplyByScalar(e,y,uwe);if(p<i)return isFinite(y)?d.clone(T,o):void 0;const b=n.x,x=n.y,v=n.z,D=fwe;D.x=T.x*b*2,D.y=T.y*x*2,D.z=T.z*v*2;let L=(1-y)*d.magnitude(e)/(.5*d.magnitude(D)),B=0,V,M,H,G,I,O,m,P,R,U,W;do{L-=B,H=1/(1+L*b),G=1/(1+L*x),I=1/(1+L*v),O=H*H,m=G*G,P=I*I,R=O*H,U=m*G,W=P*I,V=h*O+_*m+g*P-1,M=h*R*b+_*U*x+g*W*v;const q=-2*M;B=V/q}while(Math.abs(V)>F.EPSILON12);return l(o)?(o.x=r*H,o.y=s*G,o.z=a*I,o):new d(r*H,s*G,a*I)}function ve(e,t,n){this.longitude=A(e,0),this.latitude=A(t,0),this.height=A(n,0)}ve.fromRadians=function(e,t,n,i){return E.typeOf.number("longitude",e),E.typeOf.number("latitude",t),n=A(n,0),l(i)?(i.longitude=e,i.latitude=t,i.height=n,i):new ve(e,t,n)};ve.fromDegrees=function(e,t,n,i){return E.typeOf.number("longitude",e),E.typeOf.number("latitude",t),e=F.toRadians(e),t=F.toRadians(t),ve.fromRadians(e,t,n,i)};const dwe=new d,hwe=new d,pwe=new d,mwe=new d(1/6378137,1/6378137,1/6356752314245179e-9),_we=new d(1/(6378137*6378137),1/(6378137*6378137),1/(6356752314245179e-9*6356752314245179e-9)),gwe=F.EPSILON1;ve.fromCartesian=function(e,t,n){const i=l(t)?t.oneOverRadii:mwe,o=l(t)?t.oneOverRadiiSquared:_we,r=l(t)?t._centerToleranceSquared:gwe,s=EX(e,i,o,r,hwe);if(!l(s))return;let a=d.multiplyComponents(s,o,dwe);a=d.normalize(a,a);const c=d.subtract(e,s,pwe),u=Math.atan2(a.y,a.x),f=Math.asin(a.z),h=F.sign(d.dot(c,e))*d.magnitude(c);return l(n)?(n.longitude=u,n.latitude=f,n.height=h,n):new ve(u,f,h)};ve.toCartesian=function(e,t,n){return E.defined("cartographic",e),d.fromRadians(e.longitude,e.latitude,e.height,t,n)};ve.clone=function(e,t){if(l(e))return l(t)?(t.longitude=e.longitude,t.latitude=e.latitude,t.height=e.height,t):new ve(e.longitude,e.latitude,e.height)};ve.equals=function(e,t){return e===t||l(e)&&l(t)&&e.longitude===t.longitude&&e.latitude===t.latitude&&e.height===t.height};ve.equalsEpsilon=function(e,t,n){return n=A(n,0),e===t||l(e)&&l(t)&&Math.abs(e.longitude-t.longitude)<=n&&Math.abs(e.latitude-t.latitude)<=n&&Math.abs(e.height-t.height)<=n};ve.ZERO=Object.freeze(new ve(0,0,0));ve.prototype.clone=function(e){return ve.clone(this,e)};ve.prototype.equals=function(e){return ve.equals(this,e)};ve.prototype.equalsEpsilon=function(e,t){return ve.equalsEpsilon(this,e,t)};ve.prototype.toString=function(){return`(${this.longitude}, ${this.latitude}, ${this.height})`};function xX(e,t,n,i){t=A(t,0),n=A(n,0),i=A(i,0),E.typeOf.number.greaterThanOrEquals("x",t,0),E.typeOf.number.greaterThanOrEquals("y",n,0),E.typeOf.number.greaterThanOrEquals("z",i,0),e._radii=new d(t,n,i),e._radiiSquared=new d(t*t,n*n,i*i),e._radiiToTheFourth=new d(t*t*t*t,n*n*n*n,i*i*i*i),e._oneOverRadii=new d(t===0?0:1/t,n===0?0:1/n,i===0?0:1/i),e._oneOverRadiiSquared=new d(t===0?0:1/(t*t),n===0?0:1/(n*n),i===0?0:1/(i*i)),e._minimumRadius=Math.min(t,n,i),e._maximumRadius=Math.max(t,n,i),e._centerToleranceSquared=F.EPSILON1,e._radiiSquared.z!==0&&(e._squaredXOverSquaredZ=e._radiiSquared.x/e._radiiSquared.z)}function be(e,t,n){this._radii=void 0,this._radiiSquared=void 0,this._radiiToTheFourth=void 0,this._oneOverRadii=void 0,this._oneOverRadiiSquared=void 0,this._minimumRadius=void 0,this._maximumRadius=void 0,this._centerToleranceSquared=void 0,this._squaredXOverSquaredZ=void 0,xX(this,e,t,n)}Object.defineProperties(be.prototype,{radii:{get:function(){return this._radii}},radiiSquared:{get:function(){return this._radiiSquared}},radiiToTheFourth:{get:function(){return this._radiiToTheFourth}},oneOverRadii:{get:function(){return this._oneOverRadii}},oneOverRadiiSquared:{get:function(){return this._oneOverRadiiSquared}},minimumRadius:{get:function(){return this._minimumRadius}},maximumRadius:{get:function(){return this._maximumRadius}}});be.clone=function(e,t){if(!l(e))return;const n=e._radii;return l(t)?(d.clone(n,t._radii),d.clone(e._radiiSquared,t._radiiSquared),d.clone(e._radiiToTheFourth,t._radiiToTheFourth),d.clone(e._oneOverRadii,t._oneOverRadii),d.clone(e._oneOverRadiiSquared,t._oneOverRadiiSquared),t._minimumRadius=e._minimumRadius,t._maximumRadius=e._maximumRadius,t._centerToleranceSquared=e._centerToleranceSquared,t):new be(n.x,n.y,n.z)};be.fromCartesian3=function(e,t){return l(t)||(t=new be),l(e)&&xX(t,e.x,e.y,e.z),t};be.WGS84=Object.freeze(new be(6378137,6378137,6356752314245179e-9));be.UNIT_SPHERE=Object.freeze(new be(1,1,1));be.MOON=Object.freeze(new be(F.LUNAR_RADIUS,F.LUNAR_RADIUS,F.LUNAR_RADIUS));be.prototype.clone=function(e){return be.clone(this,e)};be.packedLength=d.packedLength;be.pack=function(e,t,n){return E.typeOf.object("value",e),E.defined("array",t),n=A(n,0),d.pack(e._radii,t,n),t};be.unpack=function(e,t,n){E.defined("array",e),t=A(t,0);const i=d.unpack(e,t);return be.fromCartesian3(i,n)};be.prototype.geocentricSurfaceNormal=d.normalize;be.prototype.geodeticSurfaceNormalCartographic=function(e,t){E.typeOf.object("cartographic",e);const n=e.longitude,i=e.latitude,o=Math.cos(i),r=o*Math.cos(n),s=o*Math.sin(n),a=Math.sin(i);return l(t)||(t=new d),t.x=r,t.y=s,t.z=a,d.normalize(t,t)};be.prototype.geodeticSurfaceNormal=function(e,t){if(!d.equalsEpsilon(e,d.ZERO,F.EPSILON14))return l(t)||(t=new d),t=d.multiplyComponents(e,this._oneOverRadiiSquared,t),d.normalize(t,t)};const ywe=new d,Awe=new d;be.prototype.cartographicToCartesian=function(e,t){const n=ywe,i=Awe;this.geodeticSurfaceNormalCartographic(e,n),d.multiplyComponents(this._radiiSquared,n,i);const o=Math.sqrt(d.dot(n,i));return d.divideByScalar(i,o,i),d.multiplyByScalar(n,e.height,n),l(t)||(t=new d),d.add(i,n,t)};be.prototype.cartographicArrayToCartesianArray=function(e,t){E.defined("cartographics",e);const n=e.length;l(t)?t.length=n:t=new Array(n);for(let i=0;i<n;i++)t[i]=this.cartographicToCartesian(e[i],t[i]);return t};const Twe=new d,Cwe=new d,bwe=new d;be.prototype.cartesianToCartographic=function(e,t){const n=this.scaleToGeodeticSurface(e,Cwe);if(!l(n))return;const i=this.geodeticSurfaceNormal(n,Twe),o=d.subtract(e,n,bwe),r=Math.atan2(i.y,i.x),s=Math.asin(i.z),a=F.sign(d.dot(o,e))*d.magnitude(o);return l(t)?(t.longitude=r,t.latitude=s,t.height=a,t):new ve(r,s,a)};be.prototype.cartesianArrayToCartographicArray=function(e,t){E.defined("cartesians",e);const n=e.length;l(t)?t.length=n:t=new Array(n);for(let i=0;i<n;++i)t[i]=this.cartesianToCartographic(e[i],t[i]);return t};be.prototype.scaleToGeodeticSurface=function(e,t){return EX(e,this._oneOverRadii,this._oneOverRadiiSquared,this._centerToleranceSquared,t)};be.prototype.scaleToGeocentricSurface=function(e,t){E.typeOf.object("cartesian",e),l(t)||(t=new d);const n=e.x,i=e.y,o=e.z,r=this._oneOverRadiiSquared,s=1/Math.sqrt(n*n*r.x+i*i*r.y+o*o*r.z);return d.multiplyByScalar(e,s,t)};be.prototype.transformPositionToScaledSpace=function(e,t){return l(t)||(t=new d),d.multiplyComponents(e,this._oneOverRadii,t)};be.prototype.transformPositionFromScaledSpace=function(e,t){return l(t)||(t=new d),d.multiplyComponents(e,this._radii,t)};be.prototype.equals=function(e){return this===e||l(e)&&d.equals(this._radii,e._radii)};be.prototype.toString=function(){return this._radii.toString()};be.prototype.getSurfaceNormalIntersectionWithZAxis=function(e,t,n){if(E.typeOf.object("position",e),!F.equalsEpsilon(this._radii.x,this._radii.y,F.EPSILON15))throw new w("Ellipsoid must be an ellipsoid of revolution (radii.x == radii.y)");E.typeOf.number.greaterThan("Ellipsoid.radii.z",this._radii.z,0),t=A(t,0);const i=this._squaredXOverSquaredZ;if(l(n)||(n=new d),n.x=0,n.y=0,n.z=e.z*(1-i),!(Math.abs(n.z)>=this._radii.z-t))return n};const Ewe=[.14887433898163,.43339539412925,.67940956829902,.86506336668898,.97390652851717,0],xwe=[.29552422471475,.26926671930999,.21908636251598,.14945134915058,.066671344308684,0];function NG(e,t,n){E.typeOf.number("a",e),E.typeOf.number("b",t),E.typeOf.func("func",n);const i=.5*(t+e),o=.5*(t-e);let r=0;for(let s=0;s<5;s++){const a=o*Ewe[s];r+=xwe[s]*(n(i+a)+n(i-a))}return r*=o,r}be.prototype.surfaceArea=function(e){E.typeOf.object("rectangle",e);const t=e.west;let n=e.east;const i=e.south,o=e.north;for(;n<t;)n+=F.TWO_PI;const r=this._radiiSquared,s=r.x,a=r.y,c=r.z,u=s*a;return NG(i,o,function(f){const h=Math.cos(f),_=Math.sin(f);return Math.cos(f)*NG(t,n,function(g){const p=Math.cos(g),y=Math.sin(g);return Math.sqrt(u*_*_+c*(a*p*p+s*y*y)*h*h)})})};function Or(e){this._ellipsoid=A(e,be.WGS84),this._semimajorAxis=this._ellipsoid.maximumRadius,this._oneOverSemimajorAxis=1/this._semimajorAxis}Object.defineProperties(Or.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}});Or.prototype.project=function(e,t){const n=this._semimajorAxis,i=e.longitude*n,o=e.latitude*n,r=e.height;return l(t)?(t.x=i,t.y=o,t.z=r,t):new d(i,o,r)};Or.prototype.unproject=function(e,t){if(!l(e))throw new w("cartesian is required");const n=this._oneOverSemimajorAxis,i=e.x*n,o=e.y*n,r=e.z;return l(t)?(t.longitude=i,t.latitude=o,t.height=r,t):new ve(i,o,r)};const wwe={OUTSIDE:-1,INTERSECTING:0,INSIDE:1},Vn=Object.freeze(wwe);function Ee(e,t,n,i){this.west=A(e,0),this.south=A(t,0),this.east=A(n,0),this.north=A(i,0)}Object.defineProperties(Ee.prototype,{width:{get:function(){return Ee.computeWidth(this)}},height:{get:function(){return Ee.computeHeight(this)}}});Ee.packedLength=4;Ee.pack=function(e,t,n){return E.typeOf.object("value",e),E.defined("array",t),n=A(n,0),t[n++]=e.west,t[n++]=e.south,t[n++]=e.east,t[n]=e.north,t};Ee.unpack=function(e,t,n){return E.defined("array",e),t=A(t,0),l(n)||(n=new Ee),n.west=e[t++],n.south=e[t++],n.east=e[t++],n.north=e[t],n};Ee.computeWidth=function(e){E.typeOf.object("rectangle",e);let t=e.east;const n=e.west;return t<n&&(t+=F.TWO_PI),t-n};Ee.computeHeight=function(e){return E.typeOf.object("rectangle",e),e.north-e.south};Ee.fromDegrees=function(e,t,n,i,o){return e=F.toRadians(A(e,0)),t=F.toRadians(A(t,0)),n=F.toRadians(A(n,0)),i=F.toRadians(A(i,0)),l(o)?(o.west=e,o.south=t,o.east=n,o.north=i,o):new Ee(e,t,n,i)};Ee.fromRadians=function(e,t,n,i,o){return l(o)?(o.west=A(e,0),o.south=A(t,0),o.east=A(n,0),o.north=A(i,0),o):new Ee(e,t,n,i)};Ee.fromCartographicArray=function(e,t){E.defined("cartographics",e);let n=Number.MAX_VALUE,i=-Number.MAX_VALUE,o=Number.MAX_VALUE,r=-Number.MAX_VALUE,s=Number.MAX_VALUE,a=-Number.MAX_VALUE;for(let c=0,u=e.length;c<u;c++){const f=e[c];n=Math.min(n,f.longitude),i=Math.max(i,f.longitude),s=Math.min(s,f.latitude),a=Math.max(a,f.latitude);const h=f.longitude>=0?f.longitude:f.longitude+F.TWO_PI;o=Math.min(o,h),r=Math.max(r,h)}return i-n>r-o&&(n=o,i=r,i>F.PI&&(i=i-F.TWO_PI),n>F.PI&&(n=n-F.TWO_PI)),l(t)?(t.west=n,t.south=s,t.east=i,t.north=a,t):new Ee(n,s,i,a)};Ee.fromCartesianArray=function(e,t,n){E.defined("cartesians",e),t=A(t,be.WGS84);let i=Number.MAX_VALUE,o=-Number.MAX_VALUE,r=Number.MAX_VALUE,s=-Number.MAX_VALUE,a=Number.MAX_VALUE,c=-Number.MAX_VALUE;for(let u=0,f=e.length;u<f;u++){const h=t.cartesianToCartographic(e[u]);i=Math.min(i,h.longitude),o=Math.max(o,h.longitude),a=Math.min(a,h.latitude),c=Math.max(c,h.latitude);const _=h.longitude>=0?h.longitude:h.longitude+F.TWO_PI;r=Math.min(r,_),s=Math.max(s,_)}return o-i>s-r&&(i=r,o=s,o>F.PI&&(o=o-F.TWO_PI),i>F.PI&&(i=i-F.TWO_PI)),l(n)?(n.west=i,n.south=a,n.east=o,n.north=c,n):new Ee(i,a,o,c)};Ee.clone=function(e,t){if(l(e))return l(t)?(t.west=e.west,t.south=e.south,t.east=e.east,t.north=e.north,t):new Ee(e.west,e.south,e.east,e.north)};Ee.equalsEpsilon=function(e,t,n){return n=A(n,0),e===t||l(e)&&l(t)&&Math.abs(e.west-t.west)<=n&&Math.abs(e.south-t.south)<=n&&Math.abs(e.east-t.east)<=n&&Math.abs(e.north-t.north)<=n};Ee.prototype.clone=function(e){return Ee.clone(this,e)};Ee.prototype.equals=function(e){return Ee.equals(this,e)};Ee.equals=function(e,t){return e===t||l(e)&&l(t)&&e.west===t.west&&e.south===t.south&&e.east===t.east&&e.north===t.north};Ee.prototype.equalsEpsilon=function(e,t){return Ee.equalsEpsilon(this,e,t)};Ee.validate=function(e){E.typeOf.object("rectangle",e);const t=e.north;E.typeOf.number.greaterThanOrEquals("north",t,-F.PI_OVER_TWO),E.typeOf.number.lessThanOrEquals("north",t,F.PI_OVER_TWO);const n=e.south;E.typeOf.number.greaterThanOrEquals("south",n,-F.PI_OVER_TWO),E.typeOf.number.lessThanOrEquals("south",n,F.PI_OVER_TWO);const i=e.west;E.typeOf.number.greaterThanOrEquals("west",i,-Math.PI),E.typeOf.number.lessThanOrEquals("west",i,Math.PI);const o=e.east;E.typeOf.number.greaterThanOrEquals("east",o,-Math.PI),E.typeOf.number.lessThanOrEquals("east",o,Math.PI)};Ee.southwest=function(e,t){return E.typeOf.object("rectangle",e),l(t)?(t.longitude=e.west,t.latitude=e.south,t.height=0,t):new ve(e.west,e.south)};Ee.northwest=function(e,t){return E.typeOf.object("rectangle",e),l(t)?(t.longitude=e.west,t.latitude=e.north,t.height=0,t):new ve(e.west,e.north)};Ee.northeast=function(e,t){return E.typeOf.object("rectangle",e),l(t)?(t.longitude=e.east,t.latitude=e.north,t.height=0,t):new ve(e.east,e.north)};Ee.southeast=function(e,t){return E.typeOf.object("rectangle",e),l(t)?(t.longitude=e.east,t.latitude=e.south,t.height=0,t):new ve(e.east,e.south)};Ee.center=function(e,t){E.typeOf.object("rectangle",e);let n=e.east;const i=e.west;n<i&&(n+=F.TWO_PI);const o=F.negativePiToPi((i+n)*.5),r=(e.south+e.north)*.5;return l(t)?(t.longitude=o,t.latitude=r,t.height=0,t):new ve(o,r)};Ee.intersection=function(e,t,n){E.typeOf.object("rectangle",e),E.typeOf.object("otherRectangle",t);let i=e.east,o=e.west,r=t.east,s=t.west;i<o&&r>0?i+=F.TWO_PI:r<s&&i>0&&(r+=F.TWO_PI),i<o&&s<0?s+=F.TWO_PI:r<s&&o<0&&(o+=F.TWO_PI);const a=F.negativePiToPi(Math.max(o,s)),c=F.negativePiToPi(Math.min(i,r));if((e.west<e.east||t.west<t.east)&&c<=a)return;const u=Math.max(e.south,t.south),f=Math.min(e.north,t.north);if(!(u>=f))return l(n)?(n.west=a,n.south=u,n.east=c,n.north=f,n):new Ee(a,u,c,f)};Ee.simpleIntersection=function(e,t,n){E.typeOf.object("rectangle",e),E.typeOf.object("otherRectangle",t);const i=Math.max(e.west,t.west),o=Math.max(e.south,t.south),r=Math.min(e.east,t.east),s=Math.min(e.north,t.north);if(!(o>=s||i>=r))return l(n)?(n.west=i,n.south=o,n.east=r,n.north=s,n):new Ee(i,o,r,s)};Ee.union=function(e,t,n){E.typeOf.object("rectangle",e),E.typeOf.object("otherRectangle",t),l(n)||(n=new Ee);let i=e.east,o=e.west,r=t.east,s=t.west;i<o&&r>0?i+=F.TWO_PI:r<s&&i>0&&(r+=F.TWO_PI),i<o&&s<0?s+=F.TWO_PI:r<s&&o<0&&(o+=F.TWO_PI);const a=F.negativePiToPi(Math.min(o,s)),c=F.negativePiToPi(Math.max(i,r));return n.west=a,n.south=Math.min(e.south,t.south),n.east=c,n.north=Math.max(e.north,t.north),n};Ee.expand=function(e,t,n){return E.typeOf.object("rectangle",e),E.typeOf.object("cartographic",t),l(n)||(n=new Ee),n.west=Math.min(e.west,t.longitude),n.south=Math.min(e.south,t.latitude),n.east=Math.max(e.east,t.longitude),n.north=Math.max(e.north,t.latitude),n};Ee.contains=function(e,t){E.typeOf.object("rectangle",e),E.typeOf.object("cartographic",t);let n=t.longitude;const i=t.latitude,o=e.west;let r=e.east;return r<o&&(r+=F.TWO_PI,n<0&&(n+=F.TWO_PI)),(n>o||F.equalsEpsilon(n,o,F.EPSILON14))&&(n<r||F.equalsEpsilon(n,r,F.EPSILON14))&&i>=e.south&&i<=e.north};const Swe=new ve;Ee.subsample=function(e,t,n,i){E.typeOf.object("rectangle",e),t=A(t,be.WGS84),n=A(n,0),l(i)||(i=[]);let o=0;const r=e.north,s=e.south,a=e.east,c=e.west,u=Swe;u.height=n,u.longitude=c,u.latitude=r,i[o]=t.cartographicToCartesian(u,i[o]),o++,u.longitude=a,i[o]=t.cartographicToCartesian(u,i[o]),o++,u.latitude=s,i[o]=t.cartographicToCartesian(u,i[o]),o++,u.longitude=c,i[o]=t.cartographicToCartesian(u,i[o]),o++,r<0?u.latitude=r:s>0?u.latitude=s:u.latitude=0;for(let f=1;f<8;++f)u.longitude=-Math.PI+f*F.PI_OVER_TWO,Ee.contains(e,u)&&(i[o]=t.cartographicToCartesian(u,i[o]),o++);return u.latitude===0&&(u.longitude=c,i[o]=t.cartographicToCartesian(u,i[o]),o++,u.longitude=a,i[o]=t.cartographicToCartesian(u,i[o]),o++),i.length=o,i};Ee.subsection=function(e,t,n,i,o,r){if(E.typeOf.object("rectangle",e),E.typeOf.number.greaterThanOrEquals("westLerp",t,0),E.typeOf.number.lessThanOrEquals("westLerp",t,1),E.typeOf.number.greaterThanOrEquals("southLerp",n,0),E.typeOf.number.lessThanOrEquals("southLerp",n,1),E.typeOf.number.greaterThanOrEquals("eastLerp",i,0),E.typeOf.number.lessThanOrEquals("eastLerp",i,1),E.typeOf.number.greaterThanOrEquals("northLerp",o,0),E.typeOf.number.lessThanOrEquals("northLerp",o,1),E.typeOf.number.lessThanOrEquals("westLerp",t,i),E.typeOf.number.lessThanOrEquals("southLerp",n,o),l(r)||(r=new Ee),e.west<=e.east){const a=e.east-e.west;r.west=e.west+t*a,r.east=e.west+i*a}else{const a=F.TWO_PI+e.east-e.west;r.west=F.negativePiToPi(e.west+t*a),r.east=F.negativePiToPi(e.west+i*a)}const s=e.north-e.south;return r.south=e.south+n*s,r.north=e.south+o*s,t===1&&(r.west=e.east),i===1&&(r.east=e.east),n===1&&(r.south=e.north),o===1&&(r.north=e.north),r};Ee.MAX_VALUE=Object.freeze(new Ee(-Math.PI,-F.PI_OVER_TWO,Math.PI,F.PI_OVER_TWO));function at(e,t,n,i){this.x=A(e,0),this.y=A(t,0),this.width=A(n,0),this.height=A(i,0)}at.packedLength=4;at.pack=function(e,t,n){return E.typeOf.object("value",e),E.defined("array",t),n=A(n,0),t[n++]=e.x,t[n++]=e.y,t[n++]=e.width,t[n]=e.height,t};at.unpack=function(e,t,n){return E.defined("array",e),t=A(t,0),l(n)||(n=new at),n.x=e[t++],n.y=e[t++],n.width=e[t++],n.height=e[t],n};at.fromPoints=function(e,t){if(l(t)||(t=new at),!l(e)||e.length===0)return t.x=0,t.y=0,t.width=0,t.height=0,t;const n=e.length;let i=e[0].x,o=e[0].y,r=e[0].x,s=e[0].y;for(let a=1;a<n;a++){const c=e[a],u=c.x,f=c.y;i=Math.min(u,i),r=Math.max(u,r),o=Math.min(f,o),s=Math.max(f,s)}return t.x=i,t.y=o,t.width=r-i,t.height=s-o,t};const vwe=new Or,Dwe=new ve,Iwe=new ve;at.fromRectangle=function(e,t,n){if(l(n)||(n=new at),!l(e))return n.x=0,n.y=0,n.width=0,n.height=0,n;t=A(t,vwe);const i=t.project(Ee.southwest(e,Dwe)),o=t.project(Ee.northeast(e,Iwe));return $.subtract(o,i,o),n.x=i.x,n.y=i.y,n.width=o.x,n.height=o.y,n};at.clone=function(e,t){if(l(e))return l(t)?(t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height,t):new at(e.x,e.y,e.width,e.height)};at.union=function(e,t,n){E.typeOf.object("left",e),E.typeOf.object("right",t),l(n)||(n=new at);const i=Math.min(e.x,t.x),o=Math.min(e.y,t.y),r=Math.max(e.x+e.width,t.x+t.width),s=Math.max(e.y+e.height,t.y+t.height);return n.x=i,n.y=o,n.width=r-i,n.height=s-o,n};at.expand=function(e,t,n){E.typeOf.object("rectangle",e),E.typeOf.object("point",t),n=at.clone(e,n);const i=t.x-n.x,o=t.y-n.y;return i>n.width?n.width=i:i<0&&(n.width-=i,n.x=t.x),o>n.height?n.height=o:o<0&&(n.height-=o,n.y=t.y),n};at.intersect=function(e,t){E.typeOf.object("left",e),E.typeOf.object("right",t);const n=e.x,i=e.y,o=t.x,r=t.y;return n>o+t.width||n+e.width<o||i+e.height<r||i>r+t.height?Vn.OUTSIDE:Vn.INTERSECTING};at.equals=function(e,t){return e===t||l(e)&&l(t)&&e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height};at.prototype.clone=function(e){return at.clone(this,e)};at.prototype.intersect=function(e){return at.intersect(this,e)};at.prototype.equals=function(e){return at.equals(this,e)};const ra={POINTS:fe.POINTS,LINES:fe.LINES,LINE_LOOP:fe.LINE_LOOP,LINE_STRIP:fe.LINE_STRIP,TRIANGLES:fe.TRIANGLES,TRIANGLE_STRIP:fe.TRIANGLE_STRIP,TRIANGLE_FAN:fe.TRIANGLE_FAN};ra.isLines=function(e){return e===ra.LINES||e===ra.LINE_LOOP||e===ra.LINE_STRIP};ra.isTriangles=function(e){return e===ra.TRIANGLES||e===ra.TRIANGLE_STRIP||e===ra.TRIANGLE_FAN};ra.validate=function(e){return e===ra.POINTS||e===ra.LINES||e===ra.LINE_LOOP||e===ra.LINE_STRIP||e===ra.TRIANGLES||e===ra.TRIANGLE_STRIP||e===ra.TRIANGLE_FAN};const dt=Object.freeze(ra),wX=`attribute vec4 position;
|
||
attribute vec2 textureCoordinates;
|
||
|
||
varying vec2 v_textureCoordinates;
|
||
|
||
void main()
|
||
{
|
||
gl_Position = position;
|
||
v_textureCoordinates = textureCoordinates;
|
||
}
|
||
`,lr={CULL:1,OCCLUDE:2,EXECUTE_IN_CLOSEST_FRUSTUM:4,DEBUG_SHOW_BOUNDING_VOLUME:8,CAST_SHADOWS:16,RECEIVE_SHADOWS:32,PICK_ONLY:64,DEPTH_FOR_TRANSLUCENT_CLASSIFICATION:128};function Dt(e){e=A(e,A.EMPTY_OBJECT),this._boundingVolume=e.boundingVolume,this._orientedBoundingBox=e.orientedBoundingBox,this._modelMatrix=e.modelMatrix,this._primitiveType=A(e.primitiveType,dt.TRIANGLES),this._vertexArray=e.vertexArray,this._count=e.count,this._offset=A(e.offset,0),this._instanceCount=A(e.instanceCount,0),this._shaderProgram=e.shaderProgram,this._uniformMap=e.uniformMap,this._renderState=e.renderState,this._framebuffer=e.framebuffer,this._pass=e.pass,this._owner=e.owner,this._debugOverlappingFrustums=0,this._pickId=e.pickId,this._flags=0,this.cull=A(e.cull,!0),this.occlude=A(e.occlude,!0),this.executeInClosestFrustum=A(e.executeInClosestFrustum,!1),this.debugShowBoundingVolume=A(e.debugShowBoundingVolume,!1),this.castShadows=A(e.castShadows,!1),this.receiveShadows=A(e.receiveShadows,!1),this.pickOnly=A(e.pickOnly,!1),this.depthForTranslucentClassification=A(e.depthForTranslucentClassification,!1),this.dirty=!0,this.lastDirtyTime=0,this.derivedCommands={}}function Ta(e,t){return(e._flags&t)===t}function Wp(e,t,n){n?e._flags|=t:e._flags&=~t}Object.defineProperties(Dt.prototype,{boundingVolume:{get:function(){return this._boundingVolume},set:function(e){this._boundingVolume!==e&&(this._boundingVolume=e,this.dirty=!0)}},orientedBoundingBox:{get:function(){return this._orientedBoundingBox},set:function(e){this._orientedBoundingBox!==e&&(this._orientedBoundingBox=e,this.dirty=!0)}},cull:{get:function(){return Ta(this,lr.CULL)},set:function(e){Ta(this,lr.CULL)!==e&&(Wp(this,lr.CULL,e),this.dirty=!0)}},occlude:{get:function(){return Ta(this,lr.OCCLUDE)},set:function(e){Ta(this,lr.OCCLUDE)!==e&&(Wp(this,lr.OCCLUDE,e),this.dirty=!0)}},modelMatrix:{get:function(){return this._modelMatrix},set:function(e){this._modelMatrix!==e&&(this._modelMatrix=e,this.dirty=!0)}},primitiveType:{get:function(){return this._primitiveType},set:function(e){this._primitiveType!==e&&(this._primitiveType=e,this.dirty=!0)}},vertexArray:{get:function(){return this._vertexArray},set:function(e){this._vertexArray!==e&&(this._vertexArray=e,this.dirty=!0)}},count:{get:function(){return this._count},set:function(e){this._count!==e&&(this._count=e,this.dirty=!0)}},offset:{get:function(){return this._offset},set:function(e){this._offset!==e&&(this._offset=e,this.dirty=!0)}},instanceCount:{get:function(){return this._instanceCount},set:function(e){this._instanceCount!==e&&(this._instanceCount=e,this.dirty=!0)}},shaderProgram:{get:function(){return this._shaderProgram},set:function(e){this._shaderProgram!==e&&(this._shaderProgram=e,this.dirty=!0)}},castShadows:{get:function(){return Ta(this,lr.CAST_SHADOWS)},set:function(e){Ta(this,lr.CAST_SHADOWS)!==e&&(Wp(this,lr.CAST_SHADOWS,e),this.dirty=!0)}},receiveShadows:{get:function(){return Ta(this,lr.RECEIVE_SHADOWS)},set:function(e){Ta(this,lr.RECEIVE_SHADOWS)!==e&&(Wp(this,lr.RECEIVE_SHADOWS,e),this.dirty=!0)}},uniformMap:{get:function(){return this._uniformMap},set:function(e){this._uniformMap!==e&&(this._uniformMap=e,this.dirty=!0)}},renderState:{get:function(){return this._renderState},set:function(e){this._renderState!==e&&(this._renderState=e,this.dirty=!0)}},framebuffer:{get:function(){return this._framebuffer},set:function(e){this._framebuffer!==e&&(this._framebuffer=e,this.dirty=!0)}},pass:{get:function(){return this._pass},set:function(e){this._pass!==e&&(this._pass=e,this.dirty=!0)}},executeInClosestFrustum:{get:function(){return Ta(this,lr.EXECUTE_IN_CLOSEST_FRUSTUM)},set:function(e){Ta(this,lr.EXECUTE_IN_CLOSEST_FRUSTUM)!==e&&(Wp(this,lr.EXECUTE_IN_CLOSEST_FRUSTUM,e),this.dirty=!0)}},owner:{get:function(){return this._owner},set:function(e){this._owner!==e&&(this._owner=e,this.dirty=!0)}},debugShowBoundingVolume:{get:function(){return Ta(this,lr.DEBUG_SHOW_BOUNDING_VOLUME)},set:function(e){Ta(this,lr.DEBUG_SHOW_BOUNDING_VOLUME)!==e&&(Wp(this,lr.DEBUG_SHOW_BOUNDING_VOLUME,e),this.dirty=!0)}},debugOverlappingFrustums:{get:function(){return this._debugOverlappingFrustums},set:function(e){this._debugOverlappingFrustums!==e&&(this._debugOverlappingFrustums=e,this.dirty=!0)}},pickId:{get:function(){return this._pickId},set:function(e){this._pickId!==e&&(this._pickId=e,this.dirty=!0)}},pickOnly:{get:function(){return Ta(this,lr.PICK_ONLY)},set:function(e){Ta(this,lr.PICK_ONLY)!==e&&(Wp(this,lr.PICK_ONLY,e),this.dirty=!0)}},depthForTranslucentClassification:{get:function(){return Ta(this,lr.DEPTH_FOR_TRANSLUCENT_CLASSIFICATION)},set:function(e){Ta(this,lr.DEPTH_FOR_TRANSLUCENT_CLASSIFICATION)!==e&&(Wp(this,lr.DEPTH_FOR_TRANSLUCENT_CLASSIFICATION,e),this.dirty=!0)}}});Dt.shallowClone=function(e,t){if(l(e))return l(t)||(t=new Dt),t._boundingVolume=e._boundingVolume,t._orientedBoundingBox=e._orientedBoundingBox,t._modelMatrix=e._modelMatrix,t._primitiveType=e._primitiveType,t._vertexArray=e._vertexArray,t._count=e._count,t._offset=e._offset,t._instanceCount=e._instanceCount,t._shaderProgram=e._shaderProgram,t._uniformMap=e._uniformMap,t._renderState=e._renderState,t._framebuffer=e._framebuffer,t._pass=e._pass,t._owner=e._owner,t._debugOverlappingFrustums=e._debugOverlappingFrustums,t._pickId=e._pickId,t._flags=e._flags,t.dirty=!0,t.lastDirtyTime=0,t};Dt.prototype.execute=function(e,t){e.draw(this,t)};const wi={UNSIGNED_BYTE:fe.UNSIGNED_BYTE,UNSIGNED_SHORT:fe.UNSIGNED_SHORT,UNSIGNED_INT:fe.UNSIGNED_INT,FLOAT:fe.FLOAT,HALF_FLOAT:fe.HALF_FLOAT_OES,UNSIGNED_INT_24_8:fe.UNSIGNED_INT_24_8,UNSIGNED_SHORT_4_4_4_4:fe.UNSIGNED_SHORT_4_4_4_4,UNSIGNED_SHORT_5_5_5_1:fe.UNSIGNED_SHORT_5_5_5_1,UNSIGNED_SHORT_5_6_5:fe.UNSIGNED_SHORT_5_6_5};wi.toWebGLConstant=function(e,t){switch(e){case wi.UNSIGNED_BYTE:return fe.UNSIGNED_BYTE;case wi.UNSIGNED_SHORT:return fe.UNSIGNED_SHORT;case wi.UNSIGNED_INT:return fe.UNSIGNED_INT;case wi.FLOAT:return fe.FLOAT;case wi.HALF_FLOAT:return t.webgl2?fe.HALF_FLOAT:fe.HALF_FLOAT_OES;case wi.UNSIGNED_INT_24_8:return fe.UNSIGNED_INT_24_8;case wi.UNSIGNED_SHORT_4_4_4_4:return fe.UNSIGNED_SHORT_4_4_4_4;case wi.UNSIGNED_SHORT_5_5_5_1:return fe.UNSIGNED_SHORT_5_5_5_1;case wi.UNSIGNED_SHORT_5_6_5:return wi.UNSIGNED_SHORT_5_6_5}};wi.isPacked=function(e){return e===wi.UNSIGNED_INT_24_8||e===wi.UNSIGNED_SHORT_4_4_4_4||e===wi.UNSIGNED_SHORT_5_5_5_1||e===wi.UNSIGNED_SHORT_5_6_5};wi.sizeInBytes=function(e){switch(e){case wi.UNSIGNED_BYTE:return 1;case wi.UNSIGNED_SHORT:case wi.UNSIGNED_SHORT_4_4_4_4:case wi.UNSIGNED_SHORT_5_5_5_1:case wi.UNSIGNED_SHORT_5_6_5:case wi.HALF_FLOAT:return 2;case wi.UNSIGNED_INT:case wi.FLOAT:case wi.UNSIGNED_INT_24_8:return 4}};wi.validate=function(e){return e===wi.UNSIGNED_BYTE||e===wi.UNSIGNED_SHORT||e===wi.UNSIGNED_INT||e===wi.FLOAT||e===wi.HALF_FLOAT||e===wi.UNSIGNED_INT_24_8||e===wi.UNSIGNED_SHORT_4_4_4_4||e===wi.UNSIGNED_SHORT_5_5_5_1||e===wi.UNSIGNED_SHORT_5_6_5};const ft=Object.freeze(wi),ut={DEPTH_COMPONENT:fe.DEPTH_COMPONENT,DEPTH_STENCIL:fe.DEPTH_STENCIL,ALPHA:fe.ALPHA,RGB:fe.RGB,RGBA:fe.RGBA,LUMINANCE:fe.LUMINANCE,LUMINANCE_ALPHA:fe.LUMINANCE_ALPHA,RGB_DXT1:fe.COMPRESSED_RGB_S3TC_DXT1_EXT,RGBA_DXT1:fe.COMPRESSED_RGBA_S3TC_DXT1_EXT,RGBA_DXT3:fe.COMPRESSED_RGBA_S3TC_DXT3_EXT,RGBA_DXT5:fe.COMPRESSED_RGBA_S3TC_DXT5_EXT,RGB_PVRTC_4BPPV1:fe.COMPRESSED_RGB_PVRTC_4BPPV1_IMG,RGB_PVRTC_2BPPV1:fe.COMPRESSED_RGB_PVRTC_2BPPV1_IMG,RGBA_PVRTC_4BPPV1:fe.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG,RGBA_PVRTC_2BPPV1:fe.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG,RGBA_ASTC:fe.COMPRESSED_RGBA_ASTC_4x4_WEBGL,RGB_ETC1:fe.COMPRESSED_RGB_ETC1_WEBGL,RGB8_ETC2:fe.COMPRESSED_RGB8_ETC2,RGBA8_ETC2_EAC:fe.COMPRESSED_RGBA8_ETC2_EAC,RGBA_BC7:fe.COMPRESSED_RGBA_BPTC_UNORM};ut.componentsLength=function(e){switch(e){case ut.RGB:return 3;case ut.RGBA:return 4;case ut.LUMINANCE_ALPHA:return 2;case ut.ALPHA:case ut.LUMINANCE:return 1;default:return 1}};ut.validate=function(e){return e===ut.DEPTH_COMPONENT||e===ut.DEPTH_STENCIL||e===ut.ALPHA||e===ut.RGB||e===ut.RGBA||e===ut.LUMINANCE||e===ut.LUMINANCE_ALPHA||e===ut.RGB_DXT1||e===ut.RGBA_DXT1||e===ut.RGBA_DXT3||e===ut.RGBA_DXT5||e===ut.RGB_PVRTC_4BPPV1||e===ut.RGB_PVRTC_2BPPV1||e===ut.RGBA_PVRTC_4BPPV1||e===ut.RGBA_PVRTC_2BPPV1||e===ut.RGBA_ASTC||e===ut.RGB_ETC1||e===ut.RGB8_ETC2||e===ut.RGBA8_ETC2_EAC||e===ut.RGBA_BC7};ut.isColorFormat=function(e){return e===ut.ALPHA||e===ut.RGB||e===ut.RGBA||e===ut.LUMINANCE||e===ut.LUMINANCE_ALPHA};ut.isDepthFormat=function(e){return e===ut.DEPTH_COMPONENT||e===ut.DEPTH_STENCIL};ut.isCompressedFormat=function(e){return e===ut.RGB_DXT1||e===ut.RGBA_DXT1||e===ut.RGBA_DXT3||e===ut.RGBA_DXT5||e===ut.RGB_PVRTC_4BPPV1||e===ut.RGB_PVRTC_2BPPV1||e===ut.RGBA_PVRTC_4BPPV1||e===ut.RGBA_PVRTC_2BPPV1||e===ut.RGBA_ASTC||e===ut.RGB_ETC1||e===ut.RGB8_ETC2||e===ut.RGBA8_ETC2_EAC||e===ut.RGBA_BC7};ut.isDXTFormat=function(e){return e===ut.RGB_DXT1||e===ut.RGBA_DXT1||e===ut.RGBA_DXT3||e===ut.RGBA_DXT5};ut.isPVRTCFormat=function(e){return e===ut.RGB_PVRTC_4BPPV1||e===ut.RGB_PVRTC_2BPPV1||e===ut.RGBA_PVRTC_4BPPV1||e===ut.RGBA_PVRTC_2BPPV1};ut.isASTCFormat=function(e){return e===ut.RGBA_ASTC};ut.isETC1Format=function(e){return e===ut.RGB_ETC1};ut.isETC2Format=function(e){return e===ut.RGB8_ETC2||e===ut.RGBA8_ETC2_EAC};ut.isBC7Format=function(e){return e===ut.RGBA_BC7};ut.compressedTextureSizeInBytes=function(e,t,n){switch(e){case ut.RGB_DXT1:case ut.RGBA_DXT1:case ut.RGB_ETC1:case ut.RGB8_ETC2:return Math.floor((t+3)/4)*Math.floor((n+3)/4)*8;case ut.RGBA_DXT3:case ut.RGBA_DXT5:case ut.RGBA_ASTC:case ut.RGBA8_ETC2_EAC:return Math.floor((t+3)/4)*Math.floor((n+3)/4)*16;case ut.RGB_PVRTC_4BPPV1:case ut.RGBA_PVRTC_4BPPV1:return Math.floor((Math.max(t,8)*Math.max(n,8)*4+7)/8);case ut.RGB_PVRTC_2BPPV1:case ut.RGBA_PVRTC_2BPPV1:return Math.floor((Math.max(t,16)*Math.max(n,8)*2+7)/8);case ut.RGBA_BC7:return Math.ceil(t/4)*Math.ceil(n/4)*16;default:return 0}};ut.textureSizeInBytes=function(e,t,n,i){let o=ut.componentsLength(e);return ft.isPacked(t)&&(o=1),o*ft.sizeInBytes(t)*n*i};ut.alignmentInBytes=function(e,t,n){const i=ut.textureSizeInBytes(e,t,n,1)%4;return i===0?4:i===2?2:1};ut.createTypedArray=function(e,t,n,i){let o;const r=ft.sizeInBytes(t);r===Uint8Array.BYTES_PER_ELEMENT?o=Uint8Array:r===Uint16Array.BYTES_PER_ELEMENT?o=Uint16Array:r===Float32Array.BYTES_PER_ELEMENT&&t===ft.FLOAT?o=Float32Array:o=Uint32Array;const s=ut.componentsLength(e)*n*i;return new o(s)};ut.flipY=function(e,t,n,i,o){if(o===1)return e;const r=ut.createTypedArray(t,n,i,o),s=ut.componentsLength(t),a=i*s;for(let c=0;c<o;++c){const u=c*i*s,f=(o-c-1)*i*s;for(let h=0;h<a;++h)r[f+h]=e[u+h]}return r};ut.toInternalFormat=function(e,t,n){if(!n.webgl2)return e;if(e===ut.DEPTH_STENCIL)return fe.DEPTH24_STENCIL8;if(e===ut.DEPTH_COMPONENT){if(t===ft.UNSIGNED_SHORT)return fe.DEPTH_COMPONENT16;if(t===ft.UNSIGNED_INT)return fe.DEPTH_COMPONENT24}if(t===ft.FLOAT)switch(e){case ut.RGBA:return fe.RGBA32F;case ut.RGB:return fe.RGB32F;case ut.RG:return fe.RG32F;case ut.R:return fe.R32F}if(t===ft.HALF_FLOAT)switch(e){case ut.RGBA:return fe.RGBA16F;case ut.RGB:return fe.RGB16F;case ut.RG:return fe.RG16F;case ut.R:return fe.R16F}return e};const yt=Object.freeze(ut),ur={_maximumCombinedTextureImageUnits:0,_maximumCubeMapSize:0,_maximumFragmentUniformVectors:0,_maximumTextureImageUnits:0,_maximumRenderbufferSize:0,_maximumTextureSize:0,_maximumVaryingVectors:0,_maximumVertexAttributes:0,_maximumVertexTextureImageUnits:0,_maximumVertexUniformVectors:0,_minimumAliasedLineWidth:0,_maximumAliasedLineWidth:0,_minimumAliasedPointSize:0,_maximumAliasedPointSize:0,_maximumViewportWidth:0,_maximumViewportHeight:0,_maximumTextureFilterAnisotropy:0,_maximumDrawBuffers:0,_maximumColorAttachments:0,_maximumSamples:0,_highpFloatSupported:!1,_highpIntSupported:!1};Object.defineProperties(ur,{maximumCombinedTextureImageUnits:{get:function(){return ur._maximumCombinedTextureImageUnits}},maximumCubeMapSize:{get:function(){return ur._maximumCubeMapSize}},maximumFragmentUniformVectors:{get:function(){return ur._maximumFragmentUniformVectors}},maximumTextureImageUnits:{get:function(){return ur._maximumTextureImageUnits}},maximumRenderbufferSize:{get:function(){return ur._maximumRenderbufferSize}},maximumTextureSize:{get:function(){return ur._maximumTextureSize}},maximumVaryingVectors:{get:function(){return ur._maximumVaryingVectors}},maximumVertexAttributes:{get:function(){return ur._maximumVertexAttributes}},maximumVertexTextureImageUnits:{get:function(){return ur._maximumVertexTextureImageUnits}},maximumVertexUniformVectors:{get:function(){return ur._maximumVertexUniformVectors}},minimumAliasedLineWidth:{get:function(){return ur._minimumAliasedLineWidth}},maximumAliasedLineWidth:{get:function(){return ur._maximumAliasedLineWidth}},minimumAliasedPointSize:{get:function(){return ur._minimumAliasedPointSize}},maximumAliasedPointSize:{get:function(){return ur._maximumAliasedPointSize}},maximumViewportWidth:{get:function(){return ur._maximumViewportWidth}},maximumViewportHeight:{get:function(){return ur._maximumViewportHeight}},maximumTextureFilterAnisotropy:{get:function(){return ur._maximumTextureFilterAnisotropy}},maximumDrawBuffers:{get:function(){return ur._maximumDrawBuffers}},maximumColorAttachments:{get:function(){return ur._maximumColorAttachments}},maximumSamples:{get:function(){return ur._maximumSamples}},highpFloatSupported:{get:function(){return ur._highpFloatSupported}},highpIntSupported:{get:function(){return ur._highpIntSupported}}});const Gt=ur;function zL(e,t,n){const i=e._gl;i.framebufferTexture2D(i.FRAMEBUFFER,t,n._target,n._texture,0)}function _S(e,t,n){const i=e._gl;i.framebufferRenderbuffer(i.FRAMEBUFFER,t,i.RENDERBUFFER,n._getRenderbuffer())}function Ds(e){e=A(e,A.EMPTY_OBJECT);const t=e.context;E.defined("options.context",t);const n=t._gl,i=Gt.maximumColorAttachments;if(this._gl=n,this._framebuffer=n.createFramebuffer(),this._colorTextures=[],this._colorRenderbuffers=[],this._activeColorAttachments=[],this._depthTexture=void 0,this._depthRenderbuffer=void 0,this._stencilRenderbuffer=void 0,this._depthStencilTexture=void 0,this._depthStencilRenderbuffer=void 0,this.destroyAttachments=A(e.destroyAttachments,!0),l(e.colorTextures)&&l(e.colorRenderbuffers))throw new w("Cannot have both color texture and color renderbuffer attachments.");if(l(e.depthTexture)&&l(e.depthRenderbuffer))throw new w("Cannot have both a depth texture and depth renderbuffer attachment.");if(l(e.depthStencilTexture)&&l(e.depthStencilRenderbuffer))throw new w("Cannot have both a depth-stencil texture and depth-stencil renderbuffer attachment.");const o=l(e.depthTexture)||l(e.depthRenderbuffer),r=l(e.depthStencilTexture)||l(e.depthStencilRenderbuffer);if(o&&r)throw new w("Cannot have both a depth and depth-stencil attachment.");if(l(e.stencilRenderbuffer)&&r)throw new w("Cannot have both a stencil and depth-stencil attachment.");if(o&&l(e.stencilRenderbuffer))throw new w("Cannot have both a depth and stencil attachment.");this._bind();let s,a,c,u,f;if(l(e.colorTextures)){const h=e.colorTextures;if(u=this._colorTextures.length=this._activeColorAttachments.length=h.length,u>i)throw new w("The number of color attachments exceeds the number supported.");for(c=0;c<u;++c){if(s=h[c],!yt.isColorFormat(s.pixelFormat))throw new w("The color-texture pixel-format must be a color format.");if(s.pixelDatatype===ft.FLOAT&&!t.colorBufferFloat)throw new w("The color texture pixel datatype is FLOAT and the WebGL implementation does not support the EXT_color_buffer_float or WEBGL_color_buffer_float extensions. See Context.colorBufferFloat.");if(s.pixelDatatype===ft.HALF_FLOAT&&!t.colorBufferHalfFloat)throw new w("The color texture pixel datatype is HALF_FLOAT and the WebGL implementation does not support the EXT_color_buffer_half_float extension. See Context.colorBufferHalfFloat.");f=this._gl.COLOR_ATTACHMENT0+c,zL(this,f,s),this._activeColorAttachments[c]=f,this._colorTextures[c]=s}}if(l(e.colorRenderbuffers)){const h=e.colorRenderbuffers;if(u=this._colorRenderbuffers.length=this._activeColorAttachments.length=h.length,u>i)throw new w("The number of color attachments exceeds the number supported.");for(c=0;c<u;++c)a=h[c],f=this._gl.COLOR_ATTACHMENT0+c,_S(this,f,a),this._activeColorAttachments[c]=f,this._colorRenderbuffers[c]=a}if(l(e.depthTexture)){if(s=e.depthTexture,s.pixelFormat!==yt.DEPTH_COMPONENT)throw new w("The depth-texture pixel-format must be DEPTH_COMPONENT.");zL(this,this._gl.DEPTH_ATTACHMENT,s),this._depthTexture=s}if(l(e.depthRenderbuffer)&&(a=e.depthRenderbuffer,_S(this,this._gl.DEPTH_ATTACHMENT,a),this._depthRenderbuffer=a),l(e.stencilRenderbuffer)&&(a=e.stencilRenderbuffer,_S(this,this._gl.STENCIL_ATTACHMENT,a),this._stencilRenderbuffer=a),l(e.depthStencilTexture)){if(s=e.depthStencilTexture,s.pixelFormat!==yt.DEPTH_STENCIL)throw new w("The depth-stencil pixel-format must be DEPTH_STENCIL.");zL(this,this._gl.DEPTH_STENCIL_ATTACHMENT,s),this._depthStencilTexture=s}l(e.depthStencilRenderbuffer)&&(a=e.depthStencilRenderbuffer,_S(this,this._gl.DEPTH_STENCIL_ATTACHMENT,a),this._depthStencilRenderbuffer=a),this._unBind()}Object.defineProperties(Ds.prototype,{status:{get:function(){this._bind();const e=this._gl.checkFramebufferStatus(this._gl.FRAMEBUFFER);return this._unBind(),e}},numberOfColorAttachments:{get:function(){return this._activeColorAttachments.length}},depthTexture:{get:function(){return this._depthTexture}},depthRenderbuffer:{get:function(){return this._depthRenderbuffer}},stencilRenderbuffer:{get:function(){return this._stencilRenderbuffer}},depthStencilTexture:{get:function(){return this._depthStencilTexture}},depthStencilRenderbuffer:{get:function(){return this._depthStencilRenderbuffer}},hasDepthAttachment:{get:function(){return!!(this.depthTexture||this.depthRenderbuffer||this.depthStencilTexture||this.depthStencilRenderbuffer)}}});Ds.prototype._bind=function(){const e=this._gl;e.bindFramebuffer(e.FRAMEBUFFER,this._framebuffer)};Ds.prototype._unBind=function(){const e=this._gl;e.bindFramebuffer(e.FRAMEBUFFER,null)};Ds.prototype.bindDraw=function(){const e=this._gl;e.bindFramebuffer(e.DRAW_FRAMEBUFFER,this._framebuffer)};Ds.prototype.bindRead=function(){const e=this._gl;e.bindFramebuffer(e.READ_FRAMEBUFFER,this._framebuffer)};Ds.prototype._getActiveColorAttachments=function(){return this._activeColorAttachments};Ds.prototype.getColorTexture=function(e){if(!l(e)||e<0||e>=this._colorTextures.length)throw new w("index is required, must be greater than or equal to zero and must be less than the number of color attachments.");return this._colorTextures[e]};Ds.prototype.getColorRenderbuffer=function(e){if(!l(e)||e<0||e>=this._colorRenderbuffers.length)throw new w("index is required, must be greater than or equal to zero and must be less than the number of color attachments.");return this._colorRenderbuffers[e]};Ds.prototype.isDestroyed=function(){return!1};Ds.prototype.destroy=function(){if(this.destroyAttachments){let e=0;const t=this._colorTextures;let n=t.length;for(;e<n;++e){const o=t[e];l(o)&&o.destroy()}const i=this._colorRenderbuffers;for(n=i.length,e=0;e<n;++e){const o=i[e];l(o)&&o.destroy()}this._depthTexture=this._depthTexture&&this._depthTexture.destroy(),this._depthRenderbuffer=this._depthRenderbuffer&&this._depthRenderbuffer.destroy(),this._stencilRenderbuffer=this._stencilRenderbuffer&&this._stencilRenderbuffer.destroy(),this._depthStencilTexture=this._depthStencilTexture&&this._depthStencilTexture.destroy(),this._depthStencilRenderbuffer=this._depthStencilRenderbuffer&&this._depthStencilRenderbuffer.destroy()}return this._gl.deleteFramebuffer(this._framebuffer),Je(this)};const yD={CLOCKWISE:fe.CW,COUNTER_CLOCKWISE:fe.CCW};yD.validate=function(e){return e===yD.CLOCKWISE||e===yD.COUNTER_CLOCKWISE};const pu=Object.freeze(yD);function SX(e){if(typeof e!="object"||e===null)return e;let t;const n=Object.keys(e);for(let i=0;i<n.length;i++)t=n[i],e.hasOwnProperty(t)&&t!=="_applyFunctions"&&(e[t]=SX(e[t]));return Object.freeze(e)}function MG(e){return e===fe.FUNC_ADD||e===fe.FUNC_SUBTRACT||e===fe.FUNC_REVERSE_SUBTRACT||e===fe.MIN||e===fe.MAX}function gS(e){return e===fe.ZERO||e===fe.ONE||e===fe.SRC_COLOR||e===fe.ONE_MINUS_SRC_COLOR||e===fe.DST_COLOR||e===fe.ONE_MINUS_DST_COLOR||e===fe.SRC_ALPHA||e===fe.ONE_MINUS_SRC_ALPHA||e===fe.DST_ALPHA||e===fe.ONE_MINUS_DST_ALPHA||e===fe.CONSTANT_COLOR||e===fe.ONE_MINUS_CONSTANT_COLOR||e===fe.CONSTANT_ALPHA||e===fe.ONE_MINUS_CONSTANT_ALPHA||e===fe.SRC_ALPHA_SATURATE}function Pwe(e){return e===fe.FRONT||e===fe.BACK||e===fe.FRONT_AND_BACK}function Owe(e){return e===fe.NEVER||e===fe.LESS||e===fe.EQUAL||e===fe.LEQUAL||e===fe.GREATER||e===fe.NOTEQUAL||e===fe.GEQUAL||e===fe.ALWAYS}function FG(e){return e===fe.NEVER||e===fe.LESS||e===fe.EQUAL||e===fe.LEQUAL||e===fe.GREATER||e===fe.NOTEQUAL||e===fe.GEQUAL||e===fe.ALWAYS}function _0(e){return e===fe.ZERO||e===fe.KEEP||e===fe.REPLACE||e===fe.INCR||e===fe.DECR||e===fe.INVERT||e===fe.INCR_WRAP||e===fe.DECR_WRAP}function ht(e){const t=A(e,A.EMPTY_OBJECT),n=A(t.cull,A.EMPTY_OBJECT),i=A(t.polygonOffset,A.EMPTY_OBJECT),o=A(t.scissorTest,A.EMPTY_OBJECT),r=A(o.rectangle,A.EMPTY_OBJECT),s=A(t.depthRange,A.EMPTY_OBJECT),a=A(t.depthTest,A.EMPTY_OBJECT),c=A(t.colorMask,A.EMPTY_OBJECT),u=A(t.blending,A.EMPTY_OBJECT),f=A(u.color,A.EMPTY_OBJECT),h=A(t.stencilTest,A.EMPTY_OBJECT),_=A(h.frontOperation,A.EMPTY_OBJECT),g=A(h.backOperation,A.EMPTY_OBJECT),p=A(t.sampleCoverage,A.EMPTY_OBJECT),y=t.viewport;if(this.frontFace=A(t.frontFace,pu.COUNTER_CLOCKWISE),this.cull={enabled:A(n.enabled,!1),face:A(n.face,fe.BACK)},this.lineWidth=A(t.lineWidth,1),this.polygonOffset={enabled:A(i.enabled,!1),factor:A(i.factor,0),units:A(i.units,0)},this.scissorTest={enabled:A(o.enabled,!1),rectangle:at.clone(r)},this.depthRange={near:A(s.near,0),far:A(s.far,1)},this.depthTest={enabled:A(a.enabled,!1),func:A(a.func,fe.LESS)},this.colorMask={red:A(c.red,!0),green:A(c.green,!0),blue:A(c.blue,!0),alpha:A(c.alpha,!0)},this.depthMask=A(t.depthMask,!0),this.stencilMask=A(t.stencilMask,-1),this.blending={enabled:A(u.enabled,!1),color:new k(A(f.red,0),A(f.green,0),A(f.blue,0),A(f.alpha,0)),equationRgb:A(u.equationRgb,fe.FUNC_ADD),equationAlpha:A(u.equationAlpha,fe.FUNC_ADD),functionSourceRgb:A(u.functionSourceRgb,fe.ONE),functionSourceAlpha:A(u.functionSourceAlpha,fe.ONE),functionDestinationRgb:A(u.functionDestinationRgb,fe.ZERO),functionDestinationAlpha:A(u.functionDestinationAlpha,fe.ZERO)},this.stencilTest={enabled:A(h.enabled,!1),frontFunction:A(h.frontFunction,fe.ALWAYS),backFunction:A(h.backFunction,fe.ALWAYS),reference:A(h.reference,0),mask:A(h.mask,-1),frontOperation:{fail:A(_.fail,fe.KEEP),zFail:A(_.zFail,fe.KEEP),zPass:A(_.zPass,fe.KEEP)},backOperation:{fail:A(g.fail,fe.KEEP),zFail:A(g.zFail,fe.KEEP),zPass:A(g.zPass,fe.KEEP)}},this.sampleCoverage={enabled:A(p.enabled,!1),value:A(p.value,1),invert:A(p.invert,!1)},this.viewport=l(y)?new at(y.x,y.y,y.width,y.height):void 0,this.lineWidth<Gt.minimumAliasedLineWidth||this.lineWidth>Gt.maximumAliasedLineWidth)throw new w("renderState.lineWidth is out of range. Check minimumAliasedLineWidth and maximumAliasedLineWidth.");if(!pu.validate(this.frontFace))throw new w("Invalid renderState.frontFace.");if(!Pwe(this.cull.face))throw new w("Invalid renderState.cull.face.");if(this.scissorTest.rectangle.width<0||this.scissorTest.rectangle.height<0)throw new w("renderState.scissorTest.rectangle.width and renderState.scissorTest.rectangle.height must be greater than or equal to zero.");if(this.depthRange.near>this.depthRange.far)throw new w("renderState.depthRange.near can not be greater than renderState.depthRange.far.");if(this.depthRange.near<0)throw new w("renderState.depthRange.near must be greater than or equal to zero.");if(this.depthRange.far>1)throw new w("renderState.depthRange.far must be less than or equal to one.");if(!Owe(this.depthTest.func))throw new w("Invalid renderState.depthTest.func.");if(this.blending.color.red<0||this.blending.color.red>1||this.blending.color.green<0||this.blending.color.green>1||this.blending.color.blue<0||this.blending.color.blue>1||this.blending.color.alpha<0||this.blending.color.alpha>1)throw new w("renderState.blending.color components must be greater than or equal to zero and less than or equal to one.");if(!MG(this.blending.equationRgb))throw new w("Invalid renderState.blending.equationRgb.");if(!MG(this.blending.equationAlpha))throw new w("Invalid renderState.blending.equationAlpha.");if(!gS(this.blending.functionSourceRgb))throw new w("Invalid renderState.blending.functionSourceRgb.");if(!gS(this.blending.functionSourceAlpha))throw new w("Invalid renderState.blending.functionSourceAlpha.");if(!gS(this.blending.functionDestinationRgb))throw new w("Invalid renderState.blending.functionDestinationRgb.");if(!gS(this.blending.functionDestinationAlpha))throw new w("Invalid renderState.blending.functionDestinationAlpha.");if(!FG(this.stencilTest.frontFunction))throw new w("Invalid renderState.stencilTest.frontFunction.");if(!FG(this.stencilTest.backFunction))throw new w("Invalid renderState.stencilTest.backFunction.");if(!_0(this.stencilTest.frontOperation.fail))throw new w("Invalid renderState.stencilTest.frontOperation.fail.");if(!_0(this.stencilTest.frontOperation.zFail))throw new w("Invalid renderState.stencilTest.frontOperation.zFail.");if(!_0(this.stencilTest.frontOperation.zPass))throw new w("Invalid renderState.stencilTest.frontOperation.zPass.");if(!_0(this.stencilTest.backOperation.fail))throw new w("Invalid renderState.stencilTest.backOperation.fail.");if(!_0(this.stencilTest.backOperation.zFail))throw new w("Invalid renderState.stencilTest.backOperation.zFail.");if(!_0(this.stencilTest.backOperation.zPass))throw new w("Invalid renderState.stencilTest.backOperation.zPass.");if(l(this.viewport)){if(this.viewport.width<0)throw new w("renderState.viewport.width must be greater than or equal to zero.");if(this.viewport.height<0)throw new w("renderState.viewport.height must be greater than or equal to zero.");if(this.viewport.width>Gt.maximumViewportWidth)throw new w(`renderState.viewport.width must be less than or equal to the maximum viewport width (${Gt.maximumViewportWidth.toString()}). Check maximumViewportWidth.`);if(this.viewport.height>Gt.maximumViewportHeight)throw new w(`renderState.viewport.height must be less than or equal to the maximum viewport height (${Gt.maximumViewportHeight.toString()}). Check maximumViewportHeight.`)}this.id=0,this._applyFunctions=[]}let Lwe=0,cd={};ht.fromCache=function(e){const t=JSON.stringify(e);let n=cd[t];if(l(n))return++n.referenceCount,n.state;let i=new ht(e);const o=JSON.stringify(i);return n=cd[o],l(n)||(i.id=Lwe++,i=SX(i),n={referenceCount:0,state:i},cd[o]=n),++n.referenceCount,cd[t]={referenceCount:1,state:n.state},n.state};ht.removeFromCache=function(e){const t=new ht(e),n=JSON.stringify(t),i=cd[n],o=JSON.stringify(e),r=cd[o];l(r)&&(--r.referenceCount,r.referenceCount===0&&(delete cd[o],l(i)&&--i.referenceCount)),l(i)&&i.referenceCount===0&&delete cd[n]};ht.getCache=function(){return cd};ht.clearCache=function(){cd={}};function Ey(e,t,n){n?e.enable(t):e.disable(t)}function vX(e,t){e.frontFace(t.frontFace)}function DX(e,t){const n=t.cull,i=n.enabled;Ey(e,e.CULL_FACE,i),i&&e.cullFace(n.face)}function IX(e,t){e.lineWidth(t.lineWidth)}function PX(e,t){const n=t.polygonOffset,i=n.enabled;Ey(e,e.POLYGON_OFFSET_FILL,i),i&&e.polygonOffset(n.factor,n.units)}function OX(e,t,n){const i=t.scissorTest,o=l(n.scissorTest)?n.scissorTest.enabled:i.enabled;if(Ey(e,e.SCISSOR_TEST,o),o){const r=l(n.scissorTest)?n.scissorTest.rectangle:i.rectangle;e.scissor(r.x,r.y,r.width,r.height)}}function LX(e,t){const n=t.depthRange;e.depthRange(n.near,n.far)}function BX(e,t){const n=t.depthTest,i=n.enabled;Ey(e,e.DEPTH_TEST,i),i&&e.depthFunc(n.func)}function RX(e,t){const n=t.colorMask;e.colorMask(n.red,n.green,n.blue,n.alpha)}function NX(e,t){e.depthMask(t.depthMask)}function MX(e,t){e.stencilMask(t.stencilMask)}function Bwe(e,t){e.blendColor(t.red,t.green,t.blue,t.alpha)}function FX(e,t,n){const i=t.blending,o=l(n.blendingEnabled)?n.blendingEnabled:i.enabled;Ey(e,e.BLEND,o),o&&(Bwe(e,i.color),e.blendEquationSeparate(i.equationRgb,i.equationAlpha),e.blendFuncSeparate(i.functionSourceRgb,i.functionDestinationRgb,i.functionSourceAlpha,i.functionDestinationAlpha))}function zX(e,t){const n=t.stencilTest,i=n.enabled;if(Ey(e,e.STENCIL_TEST,i),i){const o=n.frontFunction,r=n.backFunction,s=n.reference,a=n.mask;e.stencilFunc(o,s,a),e.stencilFuncSeparate(e.BACK,r,s,a),e.stencilFuncSeparate(e.FRONT,o,s,a);const c=n.frontOperation,u=c.fail,f=c.zFail,h=c.zPass;e.stencilOpSeparate(e.FRONT,u,f,h);const _=n.backOperation,g=_.fail,p=_.zFail,y=_.zPass;e.stencilOpSeparate(e.BACK,g,p,y)}}function UX(e,t){const n=t.sampleCoverage,i=n.enabled;Ey(e,e.SAMPLE_COVERAGE,i),i&&e.sampleCoverage(n.value,n.invert)}const Rwe=new at;function HX(e,t,n){let i=A(t.viewport,n.viewport);l(i)||(i=Rwe,i.width=n.context.drawingBufferWidth,i.height=n.context.drawingBufferHeight),n.context.uniformState.viewport=i,e.viewport(i.x,i.y,i.width,i.height)}ht.apply=function(e,t,n){vX(e,t),DX(e,t),IX(e,t),PX(e,t),LX(e,t),BX(e,t),RX(e,t),NX(e,t),MX(e,t),zX(e,t),UX(e,t),OX(e,t,n),FX(e,t,n),HX(e,t,n)};function Nwe(e,t){const n=[];return e.frontFace!==t.frontFace&&n.push(vX),(e.cull.enabled!==t.cull.enabled||e.cull.face!==t.cull.face)&&n.push(DX),e.lineWidth!==t.lineWidth&&n.push(IX),(e.polygonOffset.enabled!==t.polygonOffset.enabled||e.polygonOffset.factor!==t.polygonOffset.factor||e.polygonOffset.units!==t.polygonOffset.units)&&n.push(PX),(e.depthRange.near!==t.depthRange.near||e.depthRange.far!==t.depthRange.far)&&n.push(LX),(e.depthTest.enabled!==t.depthTest.enabled||e.depthTest.func!==t.depthTest.func)&&n.push(BX),(e.colorMask.red!==t.colorMask.red||e.colorMask.green!==t.colorMask.green||e.colorMask.blue!==t.colorMask.blue||e.colorMask.alpha!==t.colorMask.alpha)&&n.push(RX),e.depthMask!==t.depthMask&&n.push(NX),e.stencilMask!==t.stencilMask&&n.push(MX),(e.stencilTest.enabled!==t.stencilTest.enabled||e.stencilTest.frontFunction!==t.stencilTest.frontFunction||e.stencilTest.backFunction!==t.stencilTest.backFunction||e.stencilTest.reference!==t.stencilTest.reference||e.stencilTest.mask!==t.stencilTest.mask||e.stencilTest.frontOperation.fail!==t.stencilTest.frontOperation.fail||e.stencilTest.frontOperation.zFail!==t.stencilTest.frontOperation.zFail||e.stencilTest.backOperation.fail!==t.stencilTest.backOperation.fail||e.stencilTest.backOperation.zFail!==t.stencilTest.backOperation.zFail||e.stencilTest.backOperation.zPass!==t.stencilTest.backOperation.zPass)&&n.push(zX),(e.sampleCoverage.enabled!==t.sampleCoverage.enabled||e.sampleCoverage.value!==t.sampleCoverage.value||e.sampleCoverage.invert!==t.sampleCoverage.invert)&&n.push(UX),n}ht.partialApply=function(e,t,n,i,o,r){if(t!==n){let f=n._applyFunctions[t.id];l(f)||(f=Nwe(t,n),n._applyFunctions[t.id]=f);const h=f.length;for(let _=0;_<h;++_)f[_](e,n)}const s=l(i.scissorTest)?i.scissorTest:t.scissorTest,a=l(o.scissorTest)?o.scissorTest:n.scissorTest;(s!==a||r)&&OX(e,n,o);const c=l(i.blendingEnabled)?i.blendingEnabled:t.blending.enabled,u=l(o.blendingEnabled)?o.blendingEnabled:n.blending.enabled;(c!==u||u&&t.blending!==n.blending)&&FX(e,n,o),(t!==n||i!==o||i.context!==o.context)&&HX(e,n,o)};ht.getState=function(e){if(!l(e))throw new w("renderState is required.");return{frontFace:e.frontFace,cull:{enabled:e.cull.enabled,face:e.cull.face},lineWidth:e.lineWidth,polygonOffset:{enabled:e.polygonOffset.enabled,factor:e.polygonOffset.factor,units:e.polygonOffset.units},scissorTest:{enabled:e.scissorTest.enabled,rectangle:at.clone(e.scissorTest.rectangle)},depthRange:{near:e.depthRange.near,far:e.depthRange.far},depthTest:{enabled:e.depthTest.enabled,func:e.depthTest.func},colorMask:{red:e.colorMask.red,green:e.colorMask.green,blue:e.colorMask.blue,alpha:e.colorMask.alpha},depthMask:e.depthMask,stencilMask:e.stencilMask,blending:{enabled:e.blending.enabled,color:k.clone(e.blending.color),equationRgb:e.blending.equationRgb,equationAlpha:e.blending.equationAlpha,functionSourceRgb:e.blending.functionSourceRgb,functionSourceAlpha:e.blending.functionSourceAlpha,functionDestinationRgb:e.blending.functionDestinationRgb,functionDestinationAlpha:e.blending.functionDestinationAlpha},stencilTest:{enabled:e.stencilTest.enabled,frontFunction:e.stencilTest.frontFunction,backFunction:e.stencilTest.backFunction,reference:e.stencilTest.reference,mask:e.stencilTest.mask,frontOperation:{fail:e.stencilTest.frontOperation.fail,zFail:e.stencilTest.frontOperation.zFail,zPass:e.stencilTest.frontOperation.zPass},backOperation:{fail:e.stencilTest.backOperation.fail,zFail:e.stencilTest.backOperation.zFail,zPass:e.stencilTest.backOperation.zPass}},sampleCoverage:{enabled:e.sampleCoverage.enabled,value:e.sampleCoverage.value,invert:e.sampleCoverage.invert},viewport:l(e.viewport)?at.clone(e.viewport):void 0}};function Et(e,t,n,i){this[0]=A(e,0),this[1]=A(n,0),this[2]=A(t,0),this[3]=A(i,0)}Et.packedLength=4;Et.pack=function(e,t,n){return E.typeOf.object("value",e),E.defined("array",t),n=A(n,0),t[n++]=e[0],t[n++]=e[1],t[n++]=e[2],t[n++]=e[3],t};Et.unpack=function(e,t,n){return E.defined("array",e),t=A(t,0),l(n)||(n=new Et),n[0]=e[t++],n[1]=e[t++],n[2]=e[t++],n[3]=e[t++],n};Et.packArray=function(e,t){E.defined("array",e);const n=e.length,i=n*4;if(!l(t))t=new Array(i);else{if(!Array.isArray(t)&&t.length!==i)throw new w("If result is a typed array, it must have exactly array.length * 4 elements");t.length!==i&&(t.length=i)}for(let o=0;o<n;++o)Et.pack(e[o],t,o*4);return t};Et.unpackArray=function(e,t){if(E.defined("array",e),E.typeOf.number.greaterThanOrEquals("array.length",e.length,4),e.length%4!==0)throw new w("array length must be a multiple of 4.");const n=e.length;l(t)?t.length=n/4:t=new Array(n/4);for(let i=0;i<n;i+=4){const o=i/4;t[o]=Et.unpack(e,i,t[o])}return t};Et.clone=function(e,t){if(l(e))return l(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t):new Et(e[0],e[2],e[1],e[3])};Et.fromArray=Et.unpack;Et.fromColumnMajorArray=function(e,t){return E.defined("values",e),Et.clone(e,t)};Et.fromRowMajorArray=function(e,t){return E.defined("values",e),l(t)?(t[0]=e[0],t[1]=e[2],t[2]=e[1],t[3]=e[3],t):new Et(e[0],e[1],e[2],e[3])};Et.fromScale=function(e,t){return E.typeOf.object("scale",e),l(t)?(t[0]=e.x,t[1]=0,t[2]=0,t[3]=e.y,t):new Et(e.x,0,0,e.y)};Et.fromUniformScale=function(e,t){return E.typeOf.number("scale",e),l(t)?(t[0]=e,t[1]=0,t[2]=0,t[3]=e,t):new Et(e,0,0,e)};Et.fromRotation=function(e,t){E.typeOf.number("angle",e);const n=Math.cos(e),i=Math.sin(e);return l(t)?(t[0]=n,t[1]=i,t[2]=-i,t[3]=n,t):new Et(n,-i,i,n)};Et.toArray=function(e,t){return E.typeOf.object("matrix",e),l(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t):[e[0],e[1],e[2],e[3]]};Et.getElementIndex=function(e,t){return E.typeOf.number.greaterThanOrEquals("row",t,0),E.typeOf.number.lessThanOrEquals("row",t,1),E.typeOf.number.greaterThanOrEquals("column",e,0),E.typeOf.number.lessThanOrEquals("column",e,1),e*2+t};Et.getColumn=function(e,t,n){E.typeOf.object("matrix",e),E.typeOf.number.greaterThanOrEquals("index",t,0),E.typeOf.number.lessThanOrEquals("index",t,1),E.typeOf.object("result",n);const i=t*2,o=e[i],r=e[i+1];return n.x=o,n.y=r,n};Et.setColumn=function(e,t,n,i){E.typeOf.object("matrix",e),E.typeOf.number.greaterThanOrEquals("index",t,0),E.typeOf.number.lessThanOrEquals("index",t,1),E.typeOf.object("cartesian",n),E.typeOf.object("result",i),i=Et.clone(e,i);const o=t*2;return i[o]=n.x,i[o+1]=n.y,i};Et.getRow=function(e,t,n){E.typeOf.object("matrix",e),E.typeOf.number.greaterThanOrEquals("index",t,0),E.typeOf.number.lessThanOrEquals("index",t,1),E.typeOf.object("result",n);const i=e[t],o=e[t+2];return n.x=i,n.y=o,n};Et.setRow=function(e,t,n,i){return E.typeOf.object("matrix",e),E.typeOf.number.greaterThanOrEquals("index",t,0),E.typeOf.number.lessThanOrEquals("index",t,1),E.typeOf.object("cartesian",n),E.typeOf.object("result",i),i=Et.clone(e,i),i[t]=n.x,i[t+2]=n.y,i};const Mwe=new $;Et.setScale=function(e,t,n){E.typeOf.object("matrix",e),E.typeOf.object("scale",t),E.typeOf.object("result",n);const i=Et.getScale(e,Mwe),o=t.x/i.x,r=t.y/i.y;return n[0]=e[0]*o,n[1]=e[1]*o,n[2]=e[2]*r,n[3]=e[3]*r,n};const Fwe=new $;Et.setUniformScale=function(e,t,n){E.typeOf.object("matrix",e),E.typeOf.number("scale",t),E.typeOf.object("result",n);const i=Et.getScale(e,Fwe),o=t/i.x,r=t/i.y;return n[0]=e[0]*o,n[1]=e[1]*o,n[2]=e[2]*r,n[3]=e[3]*r,n};const zG=new $;Et.getScale=function(e,t){return E.typeOf.object("matrix",e),E.typeOf.object("result",t),t.x=$.magnitude($.fromElements(e[0],e[1],zG)),t.y=$.magnitude($.fromElements(e[2],e[3],zG)),t};const UG=new $;Et.getMaximumScale=function(e){return Et.getScale(e,UG),$.maximumComponent(UG)};const zwe=new $;Et.setRotation=function(e,t,n){E.typeOf.object("matrix",e),E.typeOf.object("result",n);const i=Et.getScale(e,zwe);return n[0]=t[0]*i.x,n[1]=t[1]*i.x,n[2]=t[2]*i.y,n[3]=t[3]*i.y,n};const Uwe=new $;Et.getRotation=function(e,t){E.typeOf.object("matrix",e),E.typeOf.object("result",t);const n=Et.getScale(e,Uwe);return t[0]=e[0]/n.x,t[1]=e[1]/n.x,t[2]=e[2]/n.y,t[3]=e[3]/n.y,t};Et.multiply=function(e,t,n){E.typeOf.object("left",e),E.typeOf.object("right",t),E.typeOf.object("result",n);const i=e[0]*t[0]+e[2]*t[1],o=e[0]*t[2]+e[2]*t[3],r=e[1]*t[0]+e[3]*t[1],s=e[1]*t[2]+e[3]*t[3];return n[0]=i,n[1]=r,n[2]=o,n[3]=s,n};Et.add=function(e,t,n){return E.typeOf.object("left",e),E.typeOf.object("right",t),E.typeOf.object("result",n),n[0]=e[0]+t[0],n[1]=e[1]+t[1],n[2]=e[2]+t[2],n[3]=e[3]+t[3],n};Et.subtract=function(e,t,n){return E.typeOf.object("left",e),E.typeOf.object("right",t),E.typeOf.object("result",n),n[0]=e[0]-t[0],n[1]=e[1]-t[1],n[2]=e[2]-t[2],n[3]=e[3]-t[3],n};Et.multiplyByVector=function(e,t,n){E.typeOf.object("matrix",e),E.typeOf.object("cartesian",t),E.typeOf.object("result",n);const i=e[0]*t.x+e[2]*t.y,o=e[1]*t.x+e[3]*t.y;return n.x=i,n.y=o,n};Et.multiplyByScalar=function(e,t,n){return E.typeOf.object("matrix",e),E.typeOf.number("scalar",t),E.typeOf.object("result",n),n[0]=e[0]*t,n[1]=e[1]*t,n[2]=e[2]*t,n[3]=e[3]*t,n};Et.multiplyByScale=function(e,t,n){return E.typeOf.object("matrix",e),E.typeOf.object("scale",t),E.typeOf.object("result",n),n[0]=e[0]*t.x,n[1]=e[1]*t.x,n[2]=e[2]*t.y,n[3]=e[3]*t.y,n};Et.multiplyByUniformScale=function(e,t,n){return E.typeOf.object("matrix",e),E.typeOf.number("scale",t),E.typeOf.object("result",n),n[0]=e[0]*t,n[1]=e[1]*t,n[2]=e[2]*t,n[3]=e[3]*t,n};Et.negate=function(e,t){return E.typeOf.object("matrix",e),E.typeOf.object("result",t),t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t};Et.transpose=function(e,t){E.typeOf.object("matrix",e),E.typeOf.object("result",t);const n=e[0],i=e[2],o=e[1],r=e[3];return t[0]=n,t[1]=i,t[2]=o,t[3]=r,t};Et.abs=function(e,t){return E.typeOf.object("matrix",e),E.typeOf.object("result",t),t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t[2]=Math.abs(e[2]),t[3]=Math.abs(e[3]),t};Et.equals=function(e,t){return e===t||l(e)&&l(t)&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]};Et.equalsArray=function(e,t,n){return e[0]===t[n]&&e[1]===t[n+1]&&e[2]===t[n+2]&&e[3]===t[n+3]};Et.equalsEpsilon=function(e,t,n){return n=A(n,0),e===t||l(e)&&l(t)&&Math.abs(e[0]-t[0])<=n&&Math.abs(e[1]-t[1])<=n&&Math.abs(e[2]-t[2])<=n&&Math.abs(e[3]-t[3])<=n};Et.IDENTITY=Object.freeze(new Et(1,0,0,1));Et.ZERO=Object.freeze(new Et(0,0,0,0));Et.COLUMN0ROW0=0;Et.COLUMN0ROW1=1;Et.COLUMN1ROW0=2;Et.COLUMN1ROW1=3;Object.defineProperties(Et.prototype,{length:{get:function(){return Et.packedLength}}});Et.prototype.clone=function(e){return Et.clone(this,e)};Et.prototype.equals=function(e){return Et.equals(this,e)};Et.prototype.equalsEpsilon=function(e,t){return Et.equalsEpsilon(this,e,t)};Et.prototype.toString=function(){return`(${this[0]}, ${this[2]})
|
||
(${this[1]}, ${this[3]})`};function Hwe(e,t,n,i){switch(t.type){case e.FLOAT:return new VX(e,t,n,i);case e.FLOAT_VEC2:return new kX(e,t,n,i);case e.FLOAT_VEC3:return new GX(e,t,n,i);case e.FLOAT_VEC4:return new WX(e,t,n,i);case e.SAMPLER_2D:case e.SAMPLER_CUBE:return new L3(e,t,n,i);case e.INT:case e.BOOL:return new qX(e,t,n,i);case e.INT_VEC2:case e.BOOL_VEC2:return new jX(e,t,n,i);case e.INT_VEC3:case e.BOOL_VEC3:return new YX(e,t,n,i);case e.INT_VEC4:case e.BOOL_VEC4:return new $X(e,t,n,i);case e.FLOAT_MAT2:return new XX(e,t,n,i);case e.FLOAT_MAT3:return new KX(e,t,n,i);case e.FLOAT_MAT4:return new JX(e,t,n,i);default:throw new Fe(`Unrecognized uniform type: ${t.type} for uniform "${n}".`)}}function VX(e,t,n,i){this.name=n,this.value=void 0,this._value=0,this._gl=e,this._location=i}VX.prototype.set=function(){this.value!==this._value&&(this._value=this.value,this._gl.uniform1f(this._location,this.value))};function kX(e,t,n,i){this.name=n,this.value=void 0,this._value=new $,this._gl=e,this._location=i}kX.prototype.set=function(){const e=this.value;$.equals(e,this._value)||($.clone(e,this._value),this._gl.uniform2f(this._location,e.x,e.y))};function GX(e,t,n,i){this.name=n,this.value=void 0,this._value=void 0,this._gl=e,this._location=i}GX.prototype.set=function(){const e=this.value;if(l(e.red))k.equals(e,this._value)||(this._value=k.clone(e,this._value),this._gl.uniform3f(this._location,e.red,e.green,e.blue));else if(l(e.x))d.equals(e,this._value)||(this._value=d.clone(e,this._value),this._gl.uniform3f(this._location,e.x,e.y,e.z));else throw new w(`Invalid vec3 value for uniform "${this.name}".`)};function WX(e,t,n,i){this.name=n,this.value=void 0,this._value=void 0,this._gl=e,this._location=i}WX.prototype.set=function(){const e=this.value;if(l(e.red))k.equals(e,this._value)||(this._value=k.clone(e,this._value),this._gl.uniform4f(this._location,e.red,e.green,e.blue,e.alpha));else if(l(e.x))ue.equals(e,this._value)||(this._value=ue.clone(e,this._value),this._gl.uniform4f(this._location,e.x,e.y,e.z,e.w));else throw new w(`Invalid vec4 value for uniform "${this.name}".`)};function L3(e,t,n,i){this.name=n,this.value=void 0,this._gl=e,this._location=i,this.textureUnitIndex=void 0}L3.prototype.set=function(){const e=this._gl;e.activeTexture(e.TEXTURE0+this.textureUnitIndex);const t=this.value;e.bindTexture(t._target,t._texture)};L3.prototype._setSampler=function(e){return this.textureUnitIndex=e,this._gl.uniform1i(this._location,e),e+1};function qX(e,t,n,i){this.name=n,this.value=void 0,this._value=0,this._gl=e,this._location=i}qX.prototype.set=function(){this.value!==this._value&&(this._value=this.value,this._gl.uniform1i(this._location,this.value))};function jX(e,t,n,i){this.name=n,this.value=void 0,this._value=new $,this._gl=e,this._location=i}jX.prototype.set=function(){const e=this.value;$.equals(e,this._value)||($.clone(e,this._value),this._gl.uniform2i(this._location,e.x,e.y))};function YX(e,t,n,i){this.name=n,this.value=void 0,this._value=new d,this._gl=e,this._location=i}YX.prototype.set=function(){const e=this.value;d.equals(e,this._value)||(d.clone(e,this._value),this._gl.uniform3i(this._location,e.x,e.y,e.z))};function $X(e,t,n,i){this.name=n,this.value=void 0,this._value=new ue,this._gl=e,this._location=i}$X.prototype.set=function(){const e=this.value;ue.equals(e,this._value)||(ue.clone(e,this._value),this._gl.uniform4i(this._location,e.x,e.y,e.z,e.w))};const Vwe=new Float32Array(4);function XX(e,t,n,i){this.name=n,this.value=void 0,this._value=new Et,this._gl=e,this._location=i}XX.prototype.set=function(){if(!Et.equalsArray(this.value,this._value,0)){Et.clone(this.value,this._value);const e=Et.toArray(this.value,Vwe);this._gl.uniformMatrix2fv(this._location,!1,e)}};const kwe=new Float32Array(9);function KX(e,t,n,i){this.name=n,this.value=void 0,this._value=new te,this._gl=e,this._location=i}KX.prototype.set=function(){if(!te.equalsArray(this.value,this._value,0)){te.clone(this.value,this._value);const e=te.toArray(this.value,kwe);this._gl.uniformMatrix3fv(this._location,!1,e)}};const Gwe=new Float32Array(16);function JX(e,t,n,i){this.name=n,this.value=void 0,this._value=new N,this._gl=e,this._location=i}JX.prototype.set=function(){if(!N.equalsArray(this.value,this._value,0)){N.clone(this.value,this._value);const e=N.toArray(this.value,Gwe);this._gl.uniformMatrix4fv(this._location,!1,e)}};function Wwe(e,t,n,i){switch(t.type){case e.FLOAT:return new QX(e,t,n,i);case e.FLOAT_VEC2:return new ZX(e,t,n,i);case e.FLOAT_VEC3:return new eK(e,t,n,i);case e.FLOAT_VEC4:return new tK(e,t,n,i);case e.SAMPLER_2D:case e.SAMPLER_CUBE:return new B3(e,t,n,i);case e.INT:case e.BOOL:return new nK(e,t,n,i);case e.INT_VEC2:case e.BOOL_VEC2:return new iK(e,t,n,i);case e.INT_VEC3:case e.BOOL_VEC3:return new oK(e,t,n,i);case e.INT_VEC4:case e.BOOL_VEC4:return new rK(e,t,n,i);case e.FLOAT_MAT2:return new sK(e,t,n,i);case e.FLOAT_MAT3:return new aK(e,t,n,i);case e.FLOAT_MAT4:return new cK(e,t,n,i);default:throw new Fe(`Unrecognized uniform type: ${t.type} for uniform "${n}".`)}}function QX(e,t,n,i){const o=i.length;this.name=n,this.value=new Array(o),this._value=new Float32Array(o),this._gl=e,this._location=i[0]}QX.prototype.set=function(){const e=this.value,t=e.length,n=this._value;let i=!1;for(let o=0;o<t;++o){const r=e[o];r!==n[o]&&(n[o]=r,i=!0)}i&&this._gl.uniform1fv(this._location,n)};function ZX(e,t,n,i){const o=i.length;this.name=n,this.value=new Array(o),this._value=new Float32Array(o*2),this._gl=e,this._location=i[0]}ZX.prototype.set=function(){const e=this.value,t=e.length,n=this._value;let i=!1,o=0;for(let r=0;r<t;++r){const s=e[r];$.equalsArray(s,n,o)||($.pack(s,n,o),i=!0),o+=2}i&&this._gl.uniform2fv(this._location,n)};function eK(e,t,n,i){const o=i.length;this.name=n,this.value=new Array(o),this._value=new Float32Array(o*3),this._gl=e,this._location=i[0]}eK.prototype.set=function(){const e=this.value,t=e.length,n=this._value;let i=!1,o=0;for(let r=0;r<t;++r){const s=e[r];if(l(s.red))(s.red!==n[o]||s.green!==n[o+1]||s.blue!==n[o+2])&&(n[o]=s.red,n[o+1]=s.green,n[o+2]=s.blue,i=!0);else if(l(s.x))d.equalsArray(s,n,o)||(d.pack(s,n,o),i=!0);else throw new w("Invalid vec3 value.");o+=3}i&&this._gl.uniform3fv(this._location,n)};function tK(e,t,n,i){const o=i.length;this.name=n,this.value=new Array(o),this._value=new Float32Array(o*4),this._gl=e,this._location=i[0]}tK.prototype.set=function(){const e=this.value,t=e.length,n=this._value;let i=!1,o=0;for(let r=0;r<t;++r){const s=e[r];if(l(s.red))k.equalsArray(s,n,o)||(k.pack(s,n,o),i=!0);else if(l(s.x))ue.equalsArray(s,n,o)||(ue.pack(s,n,o),i=!0);else throw new w("Invalid vec4 value.");o+=4}i&&this._gl.uniform4fv(this._location,n)};function B3(e,t,n,i){const o=i.length;this.name=n,this.value=new Array(o),this._value=new Float32Array(o),this._gl=e,this._locations=i,this.textureUnitIndex=void 0}B3.prototype.set=function(){const e=this._gl,t=e.TEXTURE0+this.textureUnitIndex,n=this.value,i=n.length;for(let o=0;o<i;++o){const r=n[o];e.activeTexture(t+o),e.bindTexture(r._target,r._texture)}};B3.prototype._setSampler=function(e){this.textureUnitIndex=e;const t=this._locations,n=t.length;for(let i=0;i<n;++i){const o=e+i;this._gl.uniform1i(t[i],o)}return e+n};function nK(e,t,n,i){const o=i.length;this.name=n,this.value=new Array(o),this._value=new Int32Array(o),this._gl=e,this._location=i[0]}nK.prototype.set=function(){const e=this.value,t=e.length,n=this._value;let i=!1;for(let o=0;o<t;++o){const r=e[o];r!==n[o]&&(n[o]=r,i=!0)}i&&this._gl.uniform1iv(this._location,n)};function iK(e,t,n,i){const o=i.length;this.name=n,this.value=new Array(o),this._value=new Int32Array(o*2),this._gl=e,this._location=i[0]}iK.prototype.set=function(){const e=this.value,t=e.length,n=this._value;let i=!1,o=0;for(let r=0;r<t;++r){const s=e[r];$.equalsArray(s,n,o)||($.pack(s,n,o),i=!0),o+=2}i&&this._gl.uniform2iv(this._location,n)};function oK(e,t,n,i){const o=i.length;this.name=n,this.value=new Array(o),this._value=new Int32Array(o*3),this._gl=e,this._location=i[0]}oK.prototype.set=function(){const e=this.value,t=e.length,n=this._value;let i=!1,o=0;for(let r=0;r<t;++r){const s=e[r];d.equalsArray(s,n,o)||(d.pack(s,n,o),i=!0),o+=3}i&&this._gl.uniform3iv(this._location,n)};function rK(e,t,n,i){const o=i.length;this.name=n,this.value=new Array(o),this._value=new Int32Array(o*4),this._gl=e,this._location=i[0]}rK.prototype.set=function(){const e=this.value,t=e.length,n=this._value;let i=!1,o=0;for(let r=0;r<t;++r){const s=e[r];ue.equalsArray(s,n,o)||(ue.pack(s,n,o),i=!0),o+=4}i&&this._gl.uniform4iv(this._location,n)};function sK(e,t,n,i){const o=i.length;this.name=n,this.value=new Array(o),this._value=new Float32Array(o*4),this._gl=e,this._location=i[0]}sK.prototype.set=function(){const e=this.value,t=e.length,n=this._value;let i=!1,o=0;for(let r=0;r<t;++r){const s=e[r];Et.equalsArray(s,n,o)||(Et.pack(s,n,o),i=!0),o+=4}i&&this._gl.uniformMatrix2fv(this._location,!1,n)};function aK(e,t,n,i){const o=i.length;this.name=n,this.value=new Array(o),this._value=new Float32Array(o*9),this._gl=e,this._location=i[0]}aK.prototype.set=function(){const e=this.value,t=e.length,n=this._value;let i=!1,o=0;for(let r=0;r<t;++r){const s=e[r];te.equalsArray(s,n,o)||(te.pack(s,n,o),i=!0),o+=9}i&&this._gl.uniformMatrix3fv(this._location,!1,n)};function cK(e,t,n,i){const o=i.length;this.name=n,this.value=new Array(o),this._value=new Float32Array(o*16),this._gl=e,this._location=i[0]}cK.prototype.set=function(){const e=this.value,t=e.length,n=this._value;let i=!1,o=0;for(let r=0;r<t;++r){const s=e[r];N.equalsArray(s,n,o)||(N.pack(s,n,o),i=!0),o+=16}i&&this._gl.uniformMatrix4fv(this._location,!1,n)};let qwe=0;function Hn(e){let t=e.vertexShaderText,n=e.fragmentShaderText;typeof spector<"u"&&(t=t.replace(/^#line/gm,"//#line"),n=n.replace(/^#line/gm,"//#line"));const i=jwe(t,n);this._gl=e.gl,this._logShaderCompilation=e.logShaderCompilation,this._debugShaders=e.debugShaders,this._attributeLocations=e.attributeLocations,this._program=void 0,this._numberOfVertexAttributes=void 0,this._vertexAttributes=void 0,this._uniformsByName=void 0,this._uniforms=void 0,this._automaticUniforms=void 0,this._manualUniforms=void 0,this._duplicateUniformNames=i.duplicateUniformNames,this._cachedShader=void 0,this.maximumTextureUnitIndex=void 0,this._vertexShaderSource=e.vertexShaderSource,this._vertexShaderText=e.vertexShaderText,this._fragmentShaderSource=e.fragmentShaderSource,this._fragmentShaderText=i.fragmentShaderText,this.id=qwe++}Hn.fromCache=function(e){return e=A(e,A.EMPTY_OBJECT),E.defined("options.context",e.context),e.context.shaderCache.getShaderProgram(e)};Hn.replaceCache=function(e){return e=A(e,A.EMPTY_OBJECT),E.defined("options.context",e.context),e.context.shaderCache.replaceShaderProgram(e)};Object.defineProperties(Hn.prototype,{vertexShaderSource:{get:function(){return this._vertexShaderSource}},fragmentShaderSource:{get:function(){return this._fragmentShaderSource}},vertexAttributes:{get:function(){return AD(this),this._vertexAttributes}},numberOfVertexAttributes:{get:function(){return AD(this),this._numberOfVertexAttributes}},allUniforms:{get:function(){return AD(this),this._uniformsByName}}});function HG(e){const t=[],n=e.match(/uniform.*?(?![^{]*})(?=[=\[;])/g);if(l(n)){const i=n.length;for(let o=0;o<i;o++){const r=n[o].trim(),s=r.slice(r.lastIndexOf(" ")+1);t.push(s)}}return t}function jwe(e,t){const n={};if(!Gt.highpFloatSupported||!Gt.highpIntSupported){let i,o,r,s;const a=HG(e),c=HG(t),u=a.length,f=c.length;for(i=0;i<u;i++)for(o=0;o<f;o++)if(a[i]===c[o]){r=a[i],s=`czm_mediump_${r}`;const h=new RegExp(`${r}\\b`,"g");t=t.replace(h,s),n[s]=r}}return{fragmentShaderText:t,duplicateUniformNames:n}}const jf="[Cesium WebGL] ";function Ywe(e,t){const n=t._vertexShaderText,i=t._fragmentShaderText,o=e.createShader(e.VERTEX_SHADER);e.shaderSource(o,n),e.compileShader(o);const r=e.createShader(e.FRAGMENT_SHADER);e.shaderSource(r,i),e.compileShader(r);const s=e.createProgram();e.attachShader(s,o),e.attachShader(s,r);const a=t._attributeLocations;if(l(a))for(const _ in a)a.hasOwnProperty(_)&&e.bindAttribLocation(s,a[_],_);e.linkProgram(s);let c;if(e.getProgramParameter(s,e.LINK_STATUS))return t._logShaderCompilation&&(c=e.getShaderInfoLog(o),l(c)&&c.length>0&&console.log(`${jf}Vertex shader compile log: ${c}`),c=e.getShaderInfoLog(r),l(c)&&c.length>0&&console.log(`${jf}Fragment shader compile log: ${c}`),c=e.getProgramInfoLog(s),l(c)&&c.length>0&&console.log(`${jf}Shader program link log: ${c}`)),e.deleteShader(o),e.deleteShader(r),s;let u;const f=t._debugShaders;throw e.getShaderParameter(r,e.COMPILE_STATUS)?e.getShaderParameter(o,e.COMPILE_STATUS)?(c=e.getProgramInfoLog(s),console.error(`${jf}Shader program link log: ${c}`),h(o,"vertex"),h(r,"fragment"),u=`Program failed to link. Link log: ${c}`):(c=e.getShaderInfoLog(o),console.error(`${jf}Vertex shader compile log: ${c}`),console.error(`${jf} Vertex shader source:
|
||
${n}`),u=`Vertex shader failed to compile. Compile log: ${c}`):(c=e.getShaderInfoLog(r),console.error(`${jf}Fragment shader compile log: ${c}`),console.error(`${jf} Fragment shader source:
|
||
${i}`),u=`Fragment shader failed to compile. Compile log: ${c}`),e.deleteShader(o),e.deleteShader(r),e.deleteProgram(s),new Fe(u);function h(_,g){if(!l(f))return;const p=f.getTranslatedShaderSource(_);if(p===""){console.error(`${jf}${g} shader translation failed.`);return}console.error(`${jf}Translated ${g} shaderSource:
|
||
${p}`)}}function $we(e,t,n){const i={};for(let o=0;o<n;++o){const r=e.getActiveAttrib(t,o),s=e.getAttribLocation(t,r.name);i[r.name]={name:r.name,type:r.type,index:s}}return i}function Xwe(e,t){const n={},i=[],o=[],r=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let s=0;s<r;++s){const a=e.getActiveUniform(t,s),c="[0]",u=a.name.indexOf(c,a.name.length-c.length)!==-1?a.name.slice(0,a.name.length-3):a.name;if(u.indexOf("gl_")!==0)if(a.name.indexOf("[")<0){const f=e.getUniformLocation(t,u);if(f!==null){const h=Hwe(e,a,u,f);n[u]=h,i.push(h),h._setSampler&&o.push(h)}}else{let f,h,_,g;const p=u.indexOf("[");if(p>=0){if(f=n[u.slice(0,p)],!l(f))continue;h=f._locations,h.length<=1&&(_=f.value,g=e.getUniformLocation(t,u),g!==null&&(h.push(g),_.push(e.getUniform(t,g))))}else{h=[];for(let y=0;y<a.size;++y)g=e.getUniformLocation(t,`${u}[${y}]`),g!==null&&h.push(g);f=Wwe(e,a,u,h),n[u]=f,i.push(f),f._setSampler&&o.push(f)}}}return{uniformsByName:n,uniforms:i,samplerUniforms:o}}function Kwe(e,t){const n=[],i=[];for(const o in t)if(t.hasOwnProperty(o)){const r=t[o];let s=o;const a=e._duplicateUniformNames[s];l(a)&&(r.name=a,s=a);const c=_D[s];l(c)?n.push({uniform:r,automaticUniform:c}):i.push(r)}return{automaticUniforms:n,manualUniforms:i}}function Jwe(e,t,n){e.useProgram(t);let i=0;const o=n.length;for(let r=0;r<o;++r)i=n[r]._setSampler(i);return e.useProgram(null),i}function AD(e){l(e._program)||lK(e)}function lK(e){const t=e._program,n=e._gl,i=Ywe(n,e,e._debugShaders),o=n.getProgramParameter(i,n.ACTIVE_ATTRIBUTES),r=Xwe(n,i),s=Kwe(e,r.uniformsByName);e._program=i,e._numberOfVertexAttributes=o,e._vertexAttributes=$we(n,i,o),e._uniformsByName=r.uniformsByName,e._uniforms=r.uniforms,e._automaticUniforms=s.automaticUniforms,e._manualUniforms=s.manualUniforms,e.maximumTextureUnitIndex=Jwe(n,i,r.samplerUniforms),t&&e._gl.deleteProgram(t),typeof spector<"u"&&(e._program.__SPECTOR_rebuildProgram=function(a,c,u,f){const h=e._vertexShaderText,_=e._fragmentShaderText,g=/ ! = /g;e._vertexShaderText=a.replace(g," != "),e._fragmentShaderText=c.replace(g," != ");try{lK(e),u(e._program)}catch(p){e._vertexShaderText=h,e._fragmentShaderText=_;const T=/(?:Compile|Link) error: ([^]*)/.exec(p.message);f(T?T[1]:p.message)}})}Hn.prototype._bind=function(){AD(this),this._gl.useProgram(this._program)};Hn.prototype._setUniforms=function(e,t,n){let i,o;if(l(e)){const a=this._manualUniforms;for(i=a.length,o=0;o<i;++o){const c=a[o];c.value=e[c.name]()}}const r=this._automaticUniforms;for(i=r.length,o=0;o<i;++o){const a=r[o];a.uniform.value=a.automaticUniform.getValue(t)}const s=this._uniforms;for(i=s.length,o=0;o<i;++o)s[o].set();if(n){const a=this._gl,c=this._program;if(a.validateProgram(c),!a.getProgramParameter(c,a.VALIDATE_STATUS))throw new w(`Program validation failed. Program info log: ${a.getProgramInfoLog(c)}`)}};Hn.prototype.isDestroyed=function(){return!1};Hn.prototype.destroy=function(){this._cachedShader.cache.releaseShaderProgram(this)};Hn.prototype.finalDestroy=function(){return this._gl.deleteProgram(this._program),Je(this)};function G1(e){this._context=e}let mC;const Qwe=new Dt({primitiveType:dt.TRIANGLES}),Zwe=new Bo({color:new k(0,0,0,0)});function eSe(e,t){return new Ds({context:e,colorTextures:[t],destroyAttachments:!1})}function tSe(e,t){return Hn.fromCache({context:e,vertexShaderSource:wX,fragmentShaderSource:t,attributeLocations:{position:0,textureCoordinates:1}})}function nSe(e,t){return(!l(mC)||mC.viewport.width!==e||mC.viewport.height!==t)&&(mC=ht.fromCache({viewport:new at(0,0,e,t)})),mC}G1.prototype.execute=function(e){if(E.defined("computeCommand",e),l(e.preExecute)&&e.preExecute(e),!l(e.fragmentShaderSource)&&!l(e.shaderProgram))throw new w("computeCommand.fragmentShaderSource or computeCommand.shaderProgram is required.");E.defined("computeCommand.outputTexture",e.outputTexture);const t=e.outputTexture,n=t.width,i=t.height,o=this._context,r=l(e.vertexArray)?e.vertexArray:o.getViewportQuadVertexArray(),s=l(e.shaderProgram)?e.shaderProgram:tSe(o,e.fragmentShaderSource),a=eSe(o,t),c=nSe(n,i),u=e.uniformMap,f=Zwe;f.framebuffer=a,f.renderState=c,f.execute(o);const h=Qwe;h.vertexArray=r,h.renderState=c,h.shaderProgram=s,h.uniformMap=u,h.framebuffer=a,h.execute(o),a.destroy(),e.persists||(s.destroy(),l(e.vertexArray)&&r.destroy()),l(e.postExecute)&&e.postExecute(t)};G1.prototype.isDestroyed=function(){return!1};G1.prototype.destroy=function(){return Je(this)};const un={BYTE:fe.BYTE,UNSIGNED_BYTE:fe.UNSIGNED_BYTE,SHORT:fe.SHORT,UNSIGNED_SHORT:fe.UNSIGNED_SHORT,INT:fe.INT,UNSIGNED_INT:fe.UNSIGNED_INT,FLOAT:fe.FLOAT,DOUBLE:fe.DOUBLE};un.getSizeInBytes=function(e){if(!l(e))throw new w("value is required.");switch(e){case un.BYTE:return Int8Array.BYTES_PER_ELEMENT;case un.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case un.SHORT:return Int16Array.BYTES_PER_ELEMENT;case un.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case un.INT:return Int32Array.BYTES_PER_ELEMENT;case un.UNSIGNED_INT:return Uint32Array.BYTES_PER_ELEMENT;case un.FLOAT:return Float32Array.BYTES_PER_ELEMENT;case un.DOUBLE:return Float64Array.BYTES_PER_ELEMENT;default:throw new w("componentDatatype is not a valid value.")}};un.fromTypedArray=function(e){if(e instanceof Int8Array)return un.BYTE;if(e instanceof Uint8Array)return un.UNSIGNED_BYTE;if(e instanceof Int16Array)return un.SHORT;if(e instanceof Uint16Array)return un.UNSIGNED_SHORT;if(e instanceof Int32Array)return un.INT;if(e instanceof Uint32Array)return un.UNSIGNED_INT;if(e instanceof Float32Array)return un.FLOAT;if(e instanceof Float64Array)return un.DOUBLE;throw new w("array must be an Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, or Float64Array.")};un.validate=function(e){return l(e)&&(e===un.BYTE||e===un.UNSIGNED_BYTE||e===un.SHORT||e===un.UNSIGNED_SHORT||e===un.INT||e===un.UNSIGNED_INT||e===un.FLOAT||e===un.DOUBLE)};un.createTypedArray=function(e,t){if(!l(e))throw new w("componentDatatype is required.");if(!l(t))throw new w("valuesOrLength is required.");switch(e){case un.BYTE:return new Int8Array(t);case un.UNSIGNED_BYTE:return new Uint8Array(t);case un.SHORT:return new Int16Array(t);case un.UNSIGNED_SHORT:return new Uint16Array(t);case un.INT:return new Int32Array(t);case un.UNSIGNED_INT:return new Uint32Array(t);case un.FLOAT:return new Float32Array(t);case un.DOUBLE:return new Float64Array(t);default:throw new w("componentDatatype is not a valid value.")}};un.createArrayBufferView=function(e,t,n,i){if(!l(e))throw new w("componentDatatype is required.");if(!l(t))throw new w("buffer is required.");switch(n=A(n,0),i=A(i,(t.byteLength-n)/un.getSizeInBytes(e)),e){case un.BYTE:return new Int8Array(t,n,i);case un.UNSIGNED_BYTE:return new Uint8Array(t,n,i);case un.SHORT:return new Int16Array(t,n,i);case un.UNSIGNED_SHORT:return new Uint16Array(t,n,i);case un.INT:return new Int32Array(t,n,i);case un.UNSIGNED_INT:return new Uint32Array(t,n,i);case un.FLOAT:return new Float32Array(t,n,i);case un.DOUBLE:return new Float64Array(t,n,i);default:throw new w("componentDatatype is not a valid value.")}};un.fromName=function(e){switch(e){case"BYTE":return un.BYTE;case"UNSIGNED_BYTE":return un.UNSIGNED_BYTE;case"SHORT":return un.SHORT;case"UNSIGNED_SHORT":return un.UNSIGNED_SHORT;case"INT":return un.INT;case"UNSIGNED_INT":return un.UNSIGNED_INT;case"FLOAT":return un.FLOAT;case"DOUBLE":return un.DOUBLE;default:throw new w("name is not a valid value.")}};const oe=Object.freeze(un),VG={};function uo(e,t){if(!l(e))throw new w("identifier is required.");l(VG[e])||(VG[e]=!0,console.warn(A(t,e)))}uo.geometryOutlines="Entity geometry outlines are unsupported on terrain. Outlines will be disabled. To enable outlines, disable geometry terrain clamping by explicitly setting height to 0.";uo.geometryZIndex="Entity geometry with zIndex are unsupported when height or extrudedHeight are defined. zIndex will be ignored";uo.geometryHeightReference="Entity corridor, ellipse, polygon or rectangle with heightReference must also have a defined height. heightReference will be ignored";uo.geometryExtrudedHeightReference="Entity corridor, ellipse, polygon or rectangle with extrudedHeightReference must also have a defined extrudedHeight. extrudedHeightReference will be ignored";function p_(e,t){if(!l(e)||!l(t))throw new w("identifier and message are required.");uo(e,t)}const iSe={NONE:0,TRIANGLES:1,LINES:2,POLYLINES:3},fA=Object.freeze(iSe);function De(e,t,n,i){this.x=A(e,0),this.y=A(t,0),this.z=A(n,0),this.w=A(i,0)}let _C=new d;De.fromAxisAngle=function(e,t,n){E.typeOf.object("axis",e),E.typeOf.number("angle",t);const i=t/2,o=Math.sin(i);_C=d.normalize(e,_C);const r=_C.x*o,s=_C.y*o,a=_C.z*o,c=Math.cos(i);return l(n)?(n.x=r,n.y=s,n.z=a,n.w=c,n):new De(r,s,a,c)};const oSe=[1,2,0],rSe=new Array(3);De.fromRotationMatrix=function(e,t){E.typeOf.object("matrix",e);let n,i,o,r,s;const a=e[te.COLUMN0ROW0],c=e[te.COLUMN1ROW1],u=e[te.COLUMN2ROW2],f=a+c+u;if(f>0)n=Math.sqrt(f+1),s=.5*n,n=.5/n,i=(e[te.COLUMN1ROW2]-e[te.COLUMN2ROW1])*n,o=(e[te.COLUMN2ROW0]-e[te.COLUMN0ROW2])*n,r=(e[te.COLUMN0ROW1]-e[te.COLUMN1ROW0])*n;else{const h=oSe;let _=0;c>a&&(_=1),u>a&&u>c&&(_=2);const g=h[_],p=h[g];n=Math.sqrt(e[te.getElementIndex(_,_)]-e[te.getElementIndex(g,g)]-e[te.getElementIndex(p,p)]+1);const y=rSe;y[_]=.5*n,n=.5/n,s=(e[te.getElementIndex(p,g)]-e[te.getElementIndex(g,p)])*n,y[g]=(e[te.getElementIndex(g,_)]+e[te.getElementIndex(_,g)])*n,y[p]=(e[te.getElementIndex(p,_)]+e[te.getElementIndex(_,p)])*n,i=-y[0],o=-y[1],r=-y[2]}return l(t)?(t.x=i,t.y=o,t.z=r,t.w=s,t):new De(i,o,r,s)};const kG=new De;let GG=new De,UL=new De,WG=new De;De.fromHeadingPitchRoll=function(e,t){return E.typeOf.object("headingPitchRoll",e),WG=De.fromAxisAngle(d.UNIT_X,e.roll,kG),UL=De.fromAxisAngle(d.UNIT_Y,-e.pitch,t),t=De.multiply(UL,WG,UL),GG=De.fromAxisAngle(d.UNIT_Z,-e.heading,kG),De.multiply(GG,t,t)};const yS=new d,HL=new d,qu=new De,qG=new De,AS=new De;De.packedLength=4;De.pack=function(e,t,n){return E.typeOf.object("value",e),E.defined("array",t),n=A(n,0),t[n++]=e.x,t[n++]=e.y,t[n++]=e.z,t[n]=e.w,t};De.unpack=function(e,t,n){return E.defined("array",e),t=A(t,0),l(n)||(n=new De),n.x=e[t],n.y=e[t+1],n.z=e[t+2],n.w=e[t+3],n};De.packedInterpolationLength=3;De.convertPackedArrayForInterpolation=function(e,t,n,i){De.unpack(e,n*4,AS),De.conjugate(AS,AS);for(let o=0,r=n-t+1;o<r;o++){const s=o*3;De.unpack(e,(t+o)*4,qu),De.multiply(qu,AS,qu),qu.w<0&&De.negate(qu,qu),De.computeAxis(qu,yS);const a=De.computeAngle(qu);l(i)||(i=[]),i[s]=yS.x*a,i[s+1]=yS.y*a,i[s+2]=yS.z*a}};De.unpackInterpolationResult=function(e,t,n,i,o){l(o)||(o=new De),d.fromArray(e,0,HL);const r=d.magnitude(HL);return De.unpack(t,i*4,qG),r===0?De.clone(De.IDENTITY,qu):De.fromAxisAngle(HL,r,qu),De.multiply(qu,qG,o)};De.clone=function(e,t){if(l(e))return l(t)?(t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t):new De(e.x,e.y,e.z,e.w)};De.conjugate=function(e,t){return E.typeOf.object("quaternion",e),E.typeOf.object("result",t),t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=e.w,t};De.magnitudeSquared=function(e){return E.typeOf.object("quaternion",e),e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w};De.magnitude=function(e){return Math.sqrt(De.magnitudeSquared(e))};De.normalize=function(e,t){E.typeOf.object("result",t);const n=1/De.magnitude(e),i=e.x*n,o=e.y*n,r=e.z*n,s=e.w*n;return t.x=i,t.y=o,t.z=r,t.w=s,t};De.inverse=function(e,t){E.typeOf.object("result",t);const n=De.magnitudeSquared(e);return t=De.conjugate(e,t),De.multiplyByScalar(t,1/n,t)};De.add=function(e,t,n){return E.typeOf.object("left",e),E.typeOf.object("right",t),E.typeOf.object("result",n),n.x=e.x+t.x,n.y=e.y+t.y,n.z=e.z+t.z,n.w=e.w+t.w,n};De.subtract=function(e,t,n){return E.typeOf.object("left",e),E.typeOf.object("right",t),E.typeOf.object("result",n),n.x=e.x-t.x,n.y=e.y-t.y,n.z=e.z-t.z,n.w=e.w-t.w,n};De.negate=function(e,t){return E.typeOf.object("quaternion",e),E.typeOf.object("result",t),t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=-e.w,t};De.dot=function(e,t){return E.typeOf.object("left",e),E.typeOf.object("right",t),e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w};De.multiply=function(e,t,n){E.typeOf.object("left",e),E.typeOf.object("right",t),E.typeOf.object("result",n);const i=e.x,o=e.y,r=e.z,s=e.w,a=t.x,c=t.y,u=t.z,f=t.w,h=s*a+i*f+o*u-r*c,_=s*c-i*u+o*f+r*a,g=s*u+i*c-o*a+r*f,p=s*f-i*a-o*c-r*u;return n.x=h,n.y=_,n.z=g,n.w=p,n};De.multiplyByScalar=function(e,t,n){return E.typeOf.object("quaternion",e),E.typeOf.number("scalar",t),E.typeOf.object("result",n),n.x=e.x*t,n.y=e.y*t,n.z=e.z*t,n.w=e.w*t,n};De.divideByScalar=function(e,t,n){return E.typeOf.object("quaternion",e),E.typeOf.number("scalar",t),E.typeOf.object("result",n),n.x=e.x/t,n.y=e.y/t,n.z=e.z/t,n.w=e.w/t,n};De.computeAxis=function(e,t){E.typeOf.object("quaternion",e),E.typeOf.object("result",t);const n=e.w;if(Math.abs(n-1)<F.EPSILON6)return t.x=t.y=t.z=0,t;const i=1/Math.sqrt(1-n*n);return t.x=e.x*i,t.y=e.y*i,t.z=e.z*i,t};De.computeAngle=function(e){return E.typeOf.object("quaternion",e),Math.abs(e.w-1)<F.EPSILON6?0:2*Math.acos(e.w)};let VL=new De;De.lerp=function(e,t,n,i){return E.typeOf.object("start",e),E.typeOf.object("end",t),E.typeOf.number("t",n),E.typeOf.object("result",i),VL=De.multiplyByScalar(t,n,VL),i=De.multiplyByScalar(e,1-n,i),De.add(VL,i,i)};let jG=new De,kL=new De,GL=new De;De.slerp=function(e,t,n,i){E.typeOf.object("start",e),E.typeOf.object("end",t),E.typeOf.number("t",n),E.typeOf.object("result",i);let o=De.dot(e,t),r=t;if(o<0&&(o=-o,r=jG=De.negate(t,jG)),1-o<F.EPSILON6)return De.lerp(e,r,n,i);const s=Math.acos(o);return kL=De.multiplyByScalar(e,Math.sin((1-n)*s),kL),GL=De.multiplyByScalar(r,Math.sin(n*s),GL),i=De.add(kL,GL,i),De.multiplyByScalar(i,1/Math.sin(s),i)};De.log=function(e,t){E.typeOf.object("quaternion",e),E.typeOf.object("result",t);const n=F.acosClamped(e.w);let i=0;return n!==0&&(i=n/Math.sin(n)),d.multiplyByScalar(e,i,t)};De.exp=function(e,t){E.typeOf.object("cartesian",e),E.typeOf.object("result",t);const n=d.magnitude(e);let i=0;return n!==0&&(i=Math.sin(n)/n),t.x=e.x*i,t.y=e.y*i,t.z=e.z*i,t.w=Math.cos(n),t};const sSe=new d,aSe=new d,Vb=new De,dA=new De;De.computeInnerQuadrangle=function(e,t,n,i){E.typeOf.object("q0",e),E.typeOf.object("q1",t),E.typeOf.object("q2",n),E.typeOf.object("result",i);const o=De.conjugate(t,Vb);De.multiply(o,n,dA);const r=De.log(dA,sSe);De.multiply(o,e,dA);const s=De.log(dA,aSe);return d.add(r,s,r),d.multiplyByScalar(r,.25,r),d.negate(r,r),De.exp(r,Vb),De.multiply(t,Vb,i)};De.squad=function(e,t,n,i,o,r){E.typeOf.object("q0",e),E.typeOf.object("q1",t),E.typeOf.object("s0",n),E.typeOf.object("s1",i),E.typeOf.number("t",o),E.typeOf.object("result",r);const s=De.slerp(e,t,o,Vb),a=De.slerp(n,i,o,dA);return De.slerp(s,a,2*o*(1-o),r)};const cSe=new De,uK=1.9011074535173003,EI=Mn.supportsTypedArrays()?new Float32Array(8):[],xI=Mn.supportsTypedArrays()?new Float32Array(8):[],ch=Mn.supportsTypedArrays()?new Float32Array(8):[],lh=Mn.supportsTypedArrays()?new Float32Array(8):[];for(let e=0;e<7;++e){const t=e+1,n=2*t+1;EI[e]=1/(t*n),xI[e]=t/n}EI[7]=uK/(8*17);xI[7]=uK*8/17;De.fastSlerp=function(e,t,n,i){E.typeOf.object("start",e),E.typeOf.object("end",t),E.typeOf.number("t",n),E.typeOf.object("result",i);let o=De.dot(e,t),r;o>=0?r=1:(r=-1,o=-o);const s=o-1,a=1-n,c=n*n,u=a*a;for(let g=7;g>=0;--g)ch[g]=(EI[g]*c-xI[g])*s,lh[g]=(EI[g]*u-xI[g])*s;const f=r*n*(1+ch[0]*(1+ch[1]*(1+ch[2]*(1+ch[3]*(1+ch[4]*(1+ch[5]*(1+ch[6]*(1+ch[7])))))))),h=a*(1+lh[0]*(1+lh[1]*(1+lh[2]*(1+lh[3]*(1+lh[4]*(1+lh[5]*(1+lh[6]*(1+lh[7])))))))),_=De.multiplyByScalar(e,h,cSe);return De.multiplyByScalar(t,f,i),De.add(_,i,i)};De.fastSquad=function(e,t,n,i,o,r){E.typeOf.object("q0",e),E.typeOf.object("q1",t),E.typeOf.object("s0",n),E.typeOf.object("s1",i),E.typeOf.number("t",o),E.typeOf.object("result",r);const s=De.fastSlerp(e,t,o,Vb),a=De.fastSlerp(n,i,o,dA);return De.fastSlerp(s,a,2*o*(1-o),r)};De.equals=function(e,t){return e===t||l(e)&&l(t)&&e.x===t.x&&e.y===t.y&&e.z===t.z&&e.w===t.w};De.equalsEpsilon=function(e,t,n){return n=A(n,0),e===t||l(e)&&l(t)&&Math.abs(e.x-t.x)<=n&&Math.abs(e.y-t.y)<=n&&Math.abs(e.z-t.z)<=n&&Math.abs(e.w-t.w)<=n};De.ZERO=Object.freeze(new De(0,0,0,0));De.IDENTITY=Object.freeze(new De(0,0,0,1));De.prototype.clone=function(e){return De.clone(this,e)};De.prototype.equals=function(e){return De.equals(this,e)};De.prototype.equalsEpsilon=function(e,t){return De.equalsEpsilon(this,e,t)};De.prototype.toString=function(){return`(${this.x}, ${this.y}, ${this.z}, ${this.w})`};function da(e,t,n){E.defined("array",e),E.defined("itemToFind",t),E.defined("comparator",n);let i=0,o=e.length-1,r,s;for(;i<=o;){if(r=~~((i+o)/2),s=n(e[r],t),s<0){i=r+1;continue}if(s>0){o=r-1;continue}return r}return~(o+1)}function R3(e,t,n,i,o){this.xPoleWander=e,this.yPoleWander=t,this.xPoleOffset=n,this.yPoleOffset=i,this.ut1MinusUtc=o}function dx(e,t,n,i,o,r,s,a){this.year=e,this.month=t,this.day=n,this.hour=i,this.minute=o,this.second=r,this.millisecond=s,this.isLeapSecond=a}function wI(e){if(e===null||isNaN(e))throw new w("year is required and must be a number.");return e%4===0&&e%100!==0||e%400===0}function po(e,t){this.julianDate=e,this.offset=t}const lSe={SECONDS_PER_MILLISECOND:.001,SECONDS_PER_MINUTE:60,MINUTES_PER_HOUR:60,HOURS_PER_DAY:24,SECONDS_PER_HOUR:3600,MINUTES_PER_DAY:1440,SECONDS_PER_DAY:86400,DAYS_PER_JULIAN_CENTURY:36525,PICOSECOND:1e-9,MODIFIED_JULIAN_DATE_DIFFERENCE:24000005e-1},to=Object.freeze(lSe),uSe={UTC:0,TAI:1},di=Object.freeze(uSe),fK=new dx,TS=[31,28,31,30,31,30,31,31,30,31,30,31],CS=29;function N3(e,t){return ce.compare(e.julianDate,t.julianDate)}const KA=new po;function W1(e){KA.julianDate=e;const t=ce.leapSeconds;let n=da(t,KA,N3);n<0&&(n=~n),n>=t.length&&(n=t.length-1);let i=t[n].offset;n>0&&ce.secondsDifference(t[n].julianDate,e)>i&&(n--,i=t[n].offset),ce.addSeconds(e,i,e)}function YG(e,t){KA.julianDate=e;const n=ce.leapSeconds;let i=da(n,KA,N3);if(i<0&&(i=~i),i===0)return ce.addSeconds(e,-n[0].offset,t);if(i>=n.length)return ce.addSeconds(e,-n[i-1].offset,t);const o=ce.secondsDifference(n[i].julianDate,e);if(o===0)return ce.addSeconds(e,-n[i].offset,t);if(!(o<=1))return ce.addSeconds(e,-n[--i].offset,t)}function m_(e,t,n){const i=t/to.SECONDS_PER_DAY|0;return e+=i,t-=to.SECONDS_PER_DAY*i,t<0&&(e--,t+=to.SECONDS_PER_DAY),n.dayNumber=e,n.secondsOfDay=t,n}function M3(e,t,n,i,o,r,s){const a=(t-14)/12|0,c=e+4800+a;let u=(1461*c/4|0)+(367*(t-2-12*a)/12|0)-(3*((c+100)/100|0)/4|0)+n-32075;i=i-12,i<0&&(i+=24);const f=r+(i*to.SECONDS_PER_HOUR+o*to.SECONDS_PER_MINUTE+s*to.SECONDS_PER_MILLISECOND);return f>=43200&&(u-=1),[u,f]}const fSe=/^(\d{4})$/,dSe=/^(\d{4})-(\d{2})$/,hSe=/^(\d{4})-?(\d{3})$/,pSe=/^(\d{4})-?W(\d{2})-?(\d{1})?$/,mSe=/^(\d{4})-?(\d{2})-?(\d{2})$/,F3=/([Z+\-])?(\d{2})?:?(\d{2})?$/,_Se=/^(\d{2})(\.\d+)?/.source+F3.source,gSe=/^(\d{2}):?(\d{2})(\.\d+)?/.source+F3.source,ySe=/^(\d{2}):?(\d{2}):?(\d{2})(\.\d+)?/.source+F3.source,Nu="Invalid ISO 8601 date.";function ce(e,t,n){this.dayNumber=void 0,this.secondsOfDay=void 0,e=A(e,0),t=A(t,0),n=A(n,di.UTC);const i=e|0;t=t+(e-i)*to.SECONDS_PER_DAY,m_(i,t,this),n===di.UTC&&W1(this)}ce.fromGregorianDate=function(e,t){if(!(e instanceof dx))throw new w("date must be a valid GregorianDate.");const n=M3(e.year,e.month,e.day,e.hour,e.minute,e.second,e.millisecond);return l(t)?(m_(n[0],n[1],t),W1(t),t):new ce(n[0],n[1],di.UTC)};ce.fromDate=function(e,t){if(!(e instanceof Date)||isNaN(e.getTime()))throw new w("date must be a valid JavaScript Date.");const n=M3(e.getUTCFullYear(),e.getUTCMonth()+1,e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds());return l(t)?(m_(n[0],n[1],t),W1(t),t):new ce(n[0],n[1],di.UTC)};ce.fromIso8601=function(e,t){if(typeof e!="string")throw new w(Nu);e=e.replace(",",".");let n=e.split("T"),i,o=1,r=1,s=0,a=0,c=0,u=0;const f=n[0],h=n[1];let _,g;if(!l(f))throw new w(Nu);let p;if(n=f.match(mSe),n!==null){if(p=f.split("-").length-1,p>0&&p!==2)throw new w(Nu);i=+n[1],o=+n[2],r=+n[3]}else if(n=f.match(dSe),n!==null)i=+n[1],o=+n[2];else if(n=f.match(fSe),n!==null)i=+n[1];else{let x;if(n=f.match(hSe),n!==null){if(i=+n[1],x=+n[2],g=wI(i),x<1||g&&x>366||!g&&x>365)throw new w(Nu)}else if(n=f.match(pSe),n!==null){i=+n[1];const v=+n[2],D=+n[3]||0;if(p=f.split("-").length-1,p>0&&(!l(n[3])&&p!==1||l(n[3])&&p!==2))throw new w(Nu);const L=new Date(Date.UTC(i,0,4));x=v*7+D-L.getUTCDay()-3}else throw new w(Nu);_=new Date(Date.UTC(i,0,1)),_.setUTCDate(x),o=_.getUTCMonth()+1,r=_.getUTCDate()}if(g=wI(i),o<1||o>12||r<1||(o!==2||!g)&&r>TS[o-1]||g&&o===2&&r>CS)throw new w(Nu);let y;if(l(h)){if(n=h.match(ySe),n!==null){if(p=h.split(":").length-1,p>0&&p!==2&&p!==3)throw new w(Nu);s=+n[1],a=+n[2],c=+n[3],u=+(n[4]||0)*1e3,y=5}else if(n=h.match(gSe),n!==null){if(p=h.split(":").length-1,p>2)throw new w(Nu);s=+n[1],a=+n[2],c=+(n[3]||0)*60,y=4}else if(n=h.match(_Se),n!==null)s=+n[1],a=+(n[2]||0)*60,y=3;else throw new w(Nu);if(a>=60||c>=61||s>24||s===24&&(a>0||c>0||u>0))throw new w(Nu);const x=n[y],v=+n[y+1],D=+(n[y+2]||0);switch(x){case"+":s=s-v,a=a-D;break;case"-":s=s+v,a=a+D;break;case"Z":break;default:a=a+new Date(Date.UTC(i,o-1,r,s,a)).getTimezoneOffset();break}}const T=c===60;for(T&&c--;a>=60;)a-=60,s++;for(;s>=24;)s-=24,r++;for(_=g&&o===2?CS:TS[o-1];r>_;)r-=_,o++,o>12&&(o-=12,i++),_=g&&o===2?CS:TS[o-1];for(;a<0;)a+=60,s--;for(;s<0;)s+=24,r--;for(;r<1;)o--,o<1&&(o+=12,i--),_=g&&o===2?CS:TS[o-1],r+=_;const b=M3(i,o,r,s,a,c,u);return l(t)?(m_(b[0],b[1],t),W1(t)):t=new ce(b[0],b[1],di.UTC),T&&ce.addSeconds(t,1,t),t};ce.now=function(e){return ce.fromDate(new Date,e)};const bS=new ce(0,0,di.TAI);ce.toGregorianDate=function(e,t){if(!l(e))throw new w("julianDate is required.");let n=!1,i=YG(e,bS);l(i)||(ce.addSeconds(e,-1,bS),i=YG(bS,bS),n=!0);let o=i.dayNumber;const r=i.secondsOfDay;r>=43200&&(o+=1);let s=o+68569|0;const a=4*s/146097|0;s=s-((146097*a+3)/4|0)|0;const c=4e3*(s+1)/1461001|0;s=s-(1461*c/4|0)+31|0;const u=80*s/2447|0,f=s-(2447*u/80|0)|0;s=u/11|0;const h=u+2-12*s|0,_=100*(a-49)+c+s|0;let g=r/to.SECONDS_PER_HOUR|0,p=r-g*to.SECONDS_PER_HOUR;const y=p/to.SECONDS_PER_MINUTE|0;p=p-y*to.SECONDS_PER_MINUTE;let T=p|0;const b=(p-T)/to.SECONDS_PER_MILLISECOND;return g+=12,g>23&&(g-=24),n&&(T+=1),l(t)?(t.year=_,t.month=h,t.day=f,t.hour=g,t.minute=y,t.second=T,t.millisecond=b,t.isLeapSecond=n,t):new dx(_,h,f,g,y,T,b,n)};ce.toDate=function(e){if(!l(e))throw new w("julianDate is required.");const t=ce.toGregorianDate(e,fK);let n=t.second;return t.isLeapSecond&&(n-=1),new Date(Date.UTC(t.year,t.month-1,t.day,t.hour,t.minute,n,t.millisecond))};ce.toIso8601=function(e,t){if(!l(e))throw new w("julianDate is required.");const n=ce.toGregorianDate(e,fK);let i=n.year,o=n.month,r=n.day,s=n.hour;const a=n.minute,c=n.second,u=n.millisecond;i===1e4&&o===1&&r===1&&s===0&&a===0&&c===0&&u===0&&(i=9999,o=12,r=31,s=24);let f;return!l(t)&&u!==0?(f=(u*.01).toString().replace(".",""),`${i.toString().padStart(4,"0")}-${o.toString().padStart(2,"0")}-${r.toString().padStart(2,"0")}T${s.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}:${c.toString().padStart(2,"0")}.${f}Z`):!l(t)||t===0?`${i.toString().padStart(4,"0")}-${o.toString().padStart(2,"0")}-${r.toString().padStart(2,"0")}T${s.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}:${c.toString().padStart(2,"0")}Z`:(f=(u*.01).toFixed(t).replace(".","").slice(0,t),`${i.toString().padStart(4,"0")}-${o.toString().padStart(2,"0")}-${r.toString().padStart(2,"0")}T${s.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}:${c.toString().padStart(2,"0")}.${f}Z`)};ce.clone=function(e,t){if(l(e))return l(t)?(t.dayNumber=e.dayNumber,t.secondsOfDay=e.secondsOfDay,t):new ce(e.dayNumber,e.secondsOfDay,di.TAI)};ce.compare=function(e,t){if(!l(e))throw new w("left is required.");if(!l(t))throw new w("right is required.");const n=e.dayNumber-t.dayNumber;return n!==0?n:e.secondsOfDay-t.secondsOfDay};ce.equals=function(e,t){return e===t||l(e)&&l(t)&&e.dayNumber===t.dayNumber&&e.secondsOfDay===t.secondsOfDay};ce.equalsEpsilon=function(e,t,n){return n=A(n,0),e===t||l(e)&&l(t)&&Math.abs(ce.secondsDifference(e,t))<=n};ce.totalDays=function(e){if(!l(e))throw new w("julianDate is required.");return e.dayNumber+e.secondsOfDay/to.SECONDS_PER_DAY};ce.secondsDifference=function(e,t){if(!l(e))throw new w("left is required.");if(!l(t))throw new w("right is required.");return(e.dayNumber-t.dayNumber)*to.SECONDS_PER_DAY+(e.secondsOfDay-t.secondsOfDay)};ce.daysDifference=function(e,t){if(!l(e))throw new w("left is required.");if(!l(t))throw new w("right is required.");const n=e.dayNumber-t.dayNumber,i=(e.secondsOfDay-t.secondsOfDay)/to.SECONDS_PER_DAY;return n+i};ce.computeTaiMinusUtc=function(e){KA.julianDate=e;const t=ce.leapSeconds;let n=da(t,KA,N3);return n<0&&(n=~n,--n,n<0&&(n=0)),t[n].offset};ce.addSeconds=function(e,t,n){if(!l(e))throw new w("julianDate is required.");if(!l(t))throw new w("seconds is required.");if(!l(n))throw new w("result is required.");return m_(e.dayNumber,e.secondsOfDay+t,n)};ce.addMinutes=function(e,t,n){if(!l(e))throw new w("julianDate is required.");if(!l(t))throw new w("minutes is required.");if(!l(n))throw new w("result is required.");const i=e.secondsOfDay+t*to.SECONDS_PER_MINUTE;return m_(e.dayNumber,i,n)};ce.addHours=function(e,t,n){if(!l(e))throw new w("julianDate is required.");if(!l(t))throw new w("hours is required.");if(!l(n))throw new w("result is required.");const i=e.secondsOfDay+t*to.SECONDS_PER_HOUR;return m_(e.dayNumber,i,n)};ce.addDays=function(e,t,n){if(!l(e))throw new w("julianDate is required.");if(!l(t))throw new w("days is required.");if(!l(n))throw new w("result is required.");const i=e.dayNumber+t;return m_(i,e.secondsOfDay,n)};ce.lessThan=function(e,t){return ce.compare(e,t)<0};ce.lessThanOrEquals=function(e,t){return ce.compare(e,t)<=0};ce.greaterThan=function(e,t){return ce.compare(e,t)>0};ce.greaterThanOrEquals=function(e,t){return ce.compare(e,t)>=0};ce.prototype.clone=function(e){return ce.clone(this,e)};ce.prototype.equals=function(e){return ce.equals(this,e)};ce.prototype.equalsEpsilon=function(e,t){return ce.equalsEpsilon(this,e,t)};ce.prototype.toString=function(){return ce.toIso8601(this)};ce.leapSeconds=[new po(new ce(2441317,43210,di.TAI),10),new po(new ce(2441499,43211,di.TAI),11),new po(new ce(2441683,43212,di.TAI),12),new po(new ce(2442048,43213,di.TAI),13),new po(new ce(2442413,43214,di.TAI),14),new po(new ce(2442778,43215,di.TAI),15),new po(new ce(2443144,43216,di.TAI),16),new po(new ce(2443509,43217,di.TAI),17),new po(new ce(2443874,43218,di.TAI),18),new po(new ce(2444239,43219,di.TAI),19),new po(new ce(2444786,43220,di.TAI),20),new po(new ce(2445151,43221,di.TAI),21),new po(new ce(2445516,43222,di.TAI),22),new po(new ce(2446247,43223,di.TAI),23),new po(new ce(2447161,43224,di.TAI),24),new po(new ce(2447892,43225,di.TAI),25),new po(new ce(2448257,43226,di.TAI),26),new po(new ce(2448804,43227,di.TAI),27),new po(new ce(2449169,43228,di.TAI),28),new po(new ce(2449534,43229,di.TAI),29),new po(new ce(2450083,43230,di.TAI),30),new po(new ce(2450630,43231,di.TAI),31),new po(new ce(2451179,43232,di.TAI),32),new po(new ce(2453736,43233,di.TAI),33),new po(new ce(2454832,43234,di.TAI),34),new po(new ce(2456109,43235,di.TAI),35),new po(new ce(2457204,43236,di.TAI),36),new po(new ce(2457754,43237,di.TAI),37)];const ASe="modulepreload",TSe=function(e){return"/satellite-track/"+e},$G={},ES=function(t,n,i){if(!n||n.length===0)return t();const o=document.getElementsByTagName("link");return Promise.all(n.map(r=>{if(r=TSe(r),r in $G)return;$G[r]=!0;const s=r.endsWith(".css"),a=s?'[rel="stylesheet"]':"";if(!!i)for(let f=o.length-1;f>=0;f--){const h=o[f];if(h.href===r&&(!s||h.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${r}"]${a}`))return;const u=document.createElement("link");if(u.rel=s?"stylesheet":ASe,s||(u.as="script",u.crossOrigin=""),u.href=r,document.head.appendChild(u),s)return new Promise((f,h)=>{u.addEventListener("load",f),u.addEventListener("error",()=>h(new Error(`Unable to preload CSS for ${r}`)))})})).then(()=>t())};var UM={},CSe={get exports(){return UM},set exports(e){UM=e}},kb={},bSe={get exports(){return kb},set exports(e){kb=e}};/*! https://mths.be/punycode v1.4.0 by @mathias */var XG;function ESe(){return XG||(XG=1,function(e,t){(function(n){var i=t&&!t.nodeType&&t,o=e&&!e.nodeType&&e,r=typeof Ku=="object"&&Ku;(r.global===r||r.window===r||r.self===r)&&(n=r);var s,a=2147483647,c=36,u=1,f=26,h=38,_=700,g=72,p=128,y="-",T=/^xn--/,b=/[^\x20-\x7E]/,x=/[\x2E\u3002\uFF0E\uFF61]/g,v={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},D=c-u,L=Math.floor,B=String.fromCharCode,V;function M(j){throw new RangeError(v[j])}function H(j,ee){for(var K=j.length,se=[];K--;)se[K]=ee(j[K]);return se}function G(j,ee){var K=j.split("@"),se="";K.length>1&&(se=K[0]+"@",j=K[1]),j=j.replace(x,".");var Q=j.split("."),Z=H(Q,ee).join(".");return se+Z}function I(j){for(var ee=[],K=0,se=j.length,Q,Z;K<se;)Q=j.charCodeAt(K++),Q>=55296&&Q<=56319&&K<se?(Z=j.charCodeAt(K++),(Z&64512)==56320?ee.push(((Q&1023)<<10)+(Z&1023)+65536):(ee.push(Q),K--)):ee.push(Q);return ee}function O(j){return H(j,function(ee){var K="";return ee>65535&&(ee-=65536,K+=B(ee>>>10&1023|55296),ee=56320|ee&1023),K+=B(ee),K}).join("")}function m(j){return j-48<10?j-22:j-65<26?j-65:j-97<26?j-97:c}function P(j,ee){return j+22+75*(j<26)-((ee!=0)<<5)}function R(j,ee,K){var se=0;for(j=K?L(j/_):j>>1,j+=L(j/ee);j>D*f>>1;se+=c)j=L(j/D);return L(se+(D+1)*j/(j+h))}function U(j){var ee=[],K=j.length,se,Q=0,Z=p,J=g,de,_e,le,Te,pe,ne,ae,ye,Ce;for(de=j.lastIndexOf(y),de<0&&(de=0),_e=0;_e<de;++_e)j.charCodeAt(_e)>=128&&M("not-basic"),ee.push(j.charCodeAt(_e));for(le=de>0?de+1:0;le<K;){for(Te=Q,pe=1,ne=c;le>=K&&M("invalid-input"),ae=m(j.charCodeAt(le++)),(ae>=c||ae>L((a-Q)/pe))&&M("overflow"),Q+=ae*pe,ye=ne<=J?u:ne>=J+f?f:ne-J,!(ae<ye);ne+=c)Ce=c-ye,pe>L(a/Ce)&&M("overflow"),pe*=Ce;se=ee.length+1,J=R(Q-Te,se,Te==0),L(Q/se)>a-Z&&M("overflow"),Z+=L(Q/se),Q%=se,ee.splice(Q++,0,Z)}return O(ee)}function W(j){var ee,K,se,Q,Z,J,de,_e,le,Te,pe,ne=[],ae,ye,Ce,Be;for(j=I(j),ae=j.length,ee=p,K=0,Z=g,J=0;J<ae;++J)pe=j[J],pe<128&&ne.push(B(pe));for(se=Q=ne.length,Q&&ne.push(y);se<ae;){for(de=a,J=0;J<ae;++J)pe=j[J],pe>=ee&&pe<de&&(de=pe);for(ye=se+1,de-ee>L((a-K)/ye)&&M("overflow"),K+=(de-ee)*ye,ee=de,J=0;J<ae;++J)if(pe=j[J],pe<ee&&++K>a&&M("overflow"),pe==ee){for(_e=K,le=c;Te=le<=Z?u:le>=Z+f?f:le-Z,!(_e<Te);le+=c)Be=_e-Te,Ce=c-Te,ne.push(B(P(Te+Be%Ce,0))),_e=L(Be/Ce);ne.push(B(P(_e,0))),Z=R(K,ye,se==Q),K=0,++se}++K,++ee}return ne.join("")}function q(j){return G(j,function(ee){return T.test(ee)?U(ee.slice(4).toLowerCase()):ee})}function Y(j){return G(j,function(ee){return b.test(ee)?"xn--"+W(ee):ee})}if(s={version:"1.3.2",ucs2:{decode:I,encode:O},decode:U,encode:W,toASCII:Y,toUnicode:q},i&&o)if(e.exports==i)o.exports=s;else for(V in s)s.hasOwnProperty(V)&&(i[V]=s[V]);else n.punycode=s})(Ku)}(bSe,kb)),kb}var SI={},xSe={get exports(){return SI},set exports(e){SI=e}};/*!
|
||
* URI.js - Mutating URLs
|
||
* IPv6 Support
|
||
*
|
||
* Version: 1.19.11
|
||
*
|
||
* Author: Rodney Rehm
|
||
* Web: http://medialize.github.io/URI.js/
|
||
*
|
||
* Licensed under
|
||
* MIT License http://www.opensource.org/licenses/mit-license
|
||
*
|
||
*/var KG;function wSe(){return KG||(KG=1,function(e){(function(t,n){e.exports?e.exports=n():t.IPv6=n(t)})(Ku,function(t){var n=t&&t.IPv6;function i(r){var s=r.toLowerCase(),a=s.split(":"),c=a.length,u=8;a[0]===""&&a[1]===""&&a[2]===""?(a.shift(),a.shift()):a[0]===""&&a[1]===""?a.shift():a[c-1]===""&&a[c-2]===""&&a.pop(),c=a.length,a[c-1].indexOf(".")!==-1&&(u=7);var f;for(f=0;f<c&&a[f]!=="";f++);if(f<u)for(a.splice(f,1,"0000");a.length<u;)a.splice(f,0,"0000");for(var h,_=0;_<u;_++){h=a[_].split("");for(var g=0;g<3&&(h[0]==="0"&&h.length>1);g++)h.splice(0,1);a[_]=h.join("")}var p=-1,y=0,T=0,b=-1,x=!1;for(_=0;_<u;_++)x?a[_]==="0"?T+=1:(x=!1,T>y&&(p=b,y=T)):a[_]==="0"&&(x=!0,b=_,T=1);T>y&&(p=b,y=T),y>1&&a.splice(p,y,""),c=a.length;var v="";for(a[0]===""&&(v=":"),_=0;_<c&&(v+=a[_],_!==c-1);_++)v+=":";return a[c-1]===""&&(v+=":"),v}function o(){return t.IPv6===this&&(t.IPv6=n),this}return{best:i,noConflict:o}})}(xSe)),SI}var vI={},SSe={get exports(){return vI},set exports(e){vI=e}};/*!
|
||
* URI.js - Mutating URLs
|
||
* Second Level Domain (SLD) Support
|
||
*
|
||
* Version: 1.19.11
|
||
*
|
||
* Author: Rodney Rehm
|
||
* Web: http://medialize.github.io/URI.js/
|
||
*
|
||
* Licensed under
|
||
* MIT License http://www.opensource.org/licenses/mit-license
|
||
*
|
||
*/var JG;function vSe(){return JG||(JG=1,function(e){(function(t,n){e.exports?e.exports=n():t.SecondLevelDomains=n(t)})(Ku,function(t){var n=t&&t.SecondLevelDomains,i={list:{ac:" com gov mil net org ",ae:" ac co gov mil name net org pro sch ",af:" com edu gov net org ",al:" com edu gov mil net org ",ao:" co ed gv it og pb ",ar:" com edu gob gov int mil net org tur ",at:" ac co gv or ",au:" asn com csiro edu gov id net org ",ba:" co com edu gov mil net org rs unbi unmo unsa untz unze ",bb:" biz co com edu gov info net org store tv ",bh:" biz cc com edu gov info net org ",bn:" com edu gov net org ",bo:" com edu gob gov int mil net org tv ",br:" adm adv agr am arq art ato b bio blog bmd cim cng cnt com coop ecn edu eng esp etc eti far flog fm fnd fot fst g12 ggf gov imb ind inf jor jus lel mat med mil mus net nom not ntr odo org ppg pro psc psi qsl rec slg srv tmp trd tur tv vet vlog wiki zlg ",bs:" com edu gov net org ",bz:" du et om ov rg ",ca:" ab bc mb nb nf nl ns nt nu on pe qc sk yk ",ck:" biz co edu gen gov info net org ",cn:" ac ah bj com cq edu fj gd gov gs gx gz ha hb he hi hl hn jl js jx ln mil net nm nx org qh sc sd sh sn sx tj tw xj xz yn zj ",co:" com edu gov mil net nom org ",cr:" ac c co ed fi go or sa ",cy:" ac biz com ekloges gov ltd name net org parliament press pro tm ",do:" art com edu gob gov mil net org sld web ",dz:" art asso com edu gov net org pol ",ec:" com edu fin gov info med mil net org pro ",eg:" com edu eun gov mil name net org sci ",er:" com edu gov ind mil net org rochest w ",es:" com edu gob nom org ",et:" biz com edu gov info name net org ",fj:" ac biz com info mil name net org pro ",fk:" ac co gov net nom org ",fr:" asso com f gouv nom prd presse tm ",gg:" co net org ",gh:" com edu gov mil org ",gn:" ac com gov net org ",gr:" com edu gov mil net org ",gt:" com edu gob ind mil net org ",gu:" com edu gov net org ",hk:" com edu gov idv net org ",hu:" 2000 agrar bolt casino city co erotica erotika film forum games hotel info ingatlan jogasz konyvelo lakas media news org priv reklam sex shop sport suli szex tm tozsde utazas video ",id:" ac co go mil net or sch web ",il:" ac co gov idf k12 muni net org ",in:" ac co edu ernet firm gen gov i ind mil net nic org res ",iq:" com edu gov i mil net org ",ir:" ac co dnssec gov i id net org sch ",it:" edu gov ",je:" co net org ",jo:" com edu gov mil name net org sch ",jp:" ac ad co ed go gr lg ne or ",ke:" ac co go info me mobi ne or sc ",kh:" com edu gov mil net org per ",ki:" biz com de edu gov info mob net org tel ",km:" asso com coop edu gouv k medecin mil nom notaires pharmaciens presse tm veterinaire ",kn:" edu gov net org ",kr:" ac busan chungbuk chungnam co daegu daejeon es gangwon go gwangju gyeongbuk gyeonggi gyeongnam hs incheon jeju jeonbuk jeonnam k kg mil ms ne or pe re sc seoul ulsan ",kw:" com edu gov net org ",ky:" com edu gov net org ",kz:" com edu gov mil net org ",lb:" com edu gov net org ",lk:" assn com edu gov grp hotel int ltd net ngo org sch soc web ",lr:" com edu gov net org ",lv:" asn com conf edu gov id mil net org ",ly:" com edu gov id med net org plc sch ",ma:" ac co gov m net org press ",mc:" asso tm ",me:" ac co edu gov its net org priv ",mg:" com edu gov mil nom org prd tm ",mk:" com edu gov inf name net org pro ",ml:" com edu gov net org presse ",mn:" edu gov org ",mo:" com edu gov net org ",mt:" com edu gov net org ",mv:" aero biz com coop edu gov info int mil museum name net org pro ",mw:" ac co com coop edu gov int museum net org ",mx:" com edu gob net org ",my:" com edu gov mil name net org sch ",nf:" arts com firm info net other per rec store web ",ng:" biz com edu gov mil mobi name net org sch ",ni:" ac co com edu gob mil net nom org ",np:" com edu gov mil net org ",nr:" biz com edu gov info net org ",om:" ac biz co com edu gov med mil museum net org pro sch ",pe:" com edu gob mil net nom org sld ",ph:" com edu gov i mil net ngo org ",pk:" biz com edu fam gob gok gon gop gos gov net org web ",pl:" art bialystok biz com edu gda gdansk gorzow gov info katowice krakow lodz lublin mil net ngo olsztyn org poznan pwr radom slupsk szczecin torun warszawa waw wroc wroclaw zgora ",pr:" ac biz com edu est gov info isla name net org pro prof ",ps:" com edu gov net org plo sec ",pw:" belau co ed go ne or ",ro:" arts com firm info nom nt org rec store tm www ",rs:" ac co edu gov in org ",sb:" com edu gov net org ",sc:" com edu gov net org ",sh:" co com edu gov net nom org ",sl:" com edu gov net org ",st:" co com consulado edu embaixada gov mil net org principe saotome store ",sv:" com edu gob org red ",sz:" ac co org ",tr:" av bbs bel biz com dr edu gen gov info k12 name net org pol tel tsk tv web ",tt:" aero biz cat co com coop edu gov info int jobs mil mobi museum name net org pro tel travel ",tw:" club com ebiz edu game gov idv mil net org ",mu:" ac co com gov net or org ",mz:" ac co edu gov org ",na:" co com ",nz:" ac co cri geek gen govt health iwi maori mil net org parliament school ",pa:" abo ac com edu gob ing med net nom org sld ",pt:" com edu gov int net nome org publ ",py:" com edu gov mil net org ",qa:" com edu gov mil net org ",re:" asso com nom ",ru:" ac adygeya altai amur arkhangelsk astrakhan bashkiria belgorod bir bryansk buryatia cbg chel chelyabinsk chita chukotka chuvashia com dagestan e-burg edu gov grozny int irkutsk ivanovo izhevsk jar joshkar-ola kalmykia kaluga kamchatka karelia kazan kchr kemerovo khabarovsk khakassia khv kirov koenig komi kostroma kranoyarsk kuban kurgan kursk lipetsk magadan mari mari-el marine mil mordovia mosreg msk murmansk nalchik net nnov nov novosibirsk nsk omsk orenburg org oryol penza perm pp pskov ptz rnd ryazan sakhalin samara saratov simbirsk smolensk spb stavropol stv surgut tambov tatarstan tom tomsk tsaritsyn tsk tula tuva tver tyumen udm udmurtia ulan-ude vladikavkaz vladimir vladivostok volgograd vologda voronezh vrn vyatka yakutia yamal yekaterinburg yuzhno-sakhalinsk ",rw:" ac co com edu gouv gov int mil net ",sa:" com edu gov med net org pub sch ",sd:" com edu gov info med net org tv ",se:" a ac b bd c d e f g h i k l m n o org p parti pp press r s t tm u w x y z ",sg:" com edu gov idn net org per ",sn:" art com edu gouv org perso univ ",sy:" com edu gov mil net news org ",th:" ac co go in mi net or ",tj:" ac biz co com edu go gov info int mil name net nic org test web ",tn:" agrinet com defense edunet ens fin gov ind info intl mincom nat net org perso rnrt rns rnu tourism ",tz:" ac co go ne or ",ua:" biz cherkassy chernigov chernovtsy ck cn co com crimea cv dn dnepropetrovsk donetsk dp edu gov if in ivano-frankivsk kh kharkov kherson khmelnitskiy kiev kirovograd km kr ks kv lg lugansk lutsk lviv me mk net nikolaev od odessa org pl poltava pp rovno rv sebastopol sumy te ternopil uzhgorod vinnica vn zaporizhzhe zhitomir zp zt ",ug:" ac co go ne or org sc ",uk:" ac bl british-library co cym gov govt icnet jet lea ltd me mil mod national-library-scotland nel net nhs nic nls org orgn parliament plc police sch scot soc ",us:" dni fed isa kids nsn ",uy:" com edu gub mil net org ",ve:" co com edu gob info mil net org web ",vi:" co com k12 net org ",vn:" ac biz com edu gov health info int name net org pro ",ye:" co com gov ltd me net org plc ",yu:" ac co edu gov org ",za:" ac agric alt bourse city co cybernet db edu gov grondar iaccess imt inca landesign law mil net ngo nis nom olivetti org pix school tm web ",zm:" ac co com edu gov net org sch ",com:"ar br cn de eu gb gr hu jpn kr no qc ru sa se uk us uy za ",net:"gb jp se uk ",org:"ae",de:"com "},has:function(o){var r=o.lastIndexOf(".");if(r<=0||r>=o.length-1)return!1;var s=o.lastIndexOf(".",r-1);if(s<=0||s>=r-1)return!1;var a=i.list[o.slice(r+1)];return a?a.indexOf(" "+o.slice(s+1,r)+" ")>=0:!1},is:function(o){var r=o.lastIndexOf(".");if(r<=0||r>=o.length-1)return!1;var s=o.lastIndexOf(".",r-1);if(s>=0)return!1;var a=i.list[o.slice(r+1)];return a?a.indexOf(" "+o.slice(0,r)+" ")>=0:!1},get:function(o){var r=o.lastIndexOf(".");if(r<=0||r>=o.length-1)return null;var s=o.lastIndexOf(".",r-1);if(s<=0||s>=r-1)return null;var a=i.list[o.slice(r+1)];return!a||a.indexOf(" "+o.slice(s+1,r)+" ")<0?null:o.slice(s+1)},noConflict:function(){return t.SecondLevelDomains===this&&(t.SecondLevelDomains=n),this}};return i})}(SSe)),vI}/*!
|
||
* URI.js - Mutating URLs
|
||
*
|
||
* Version: 1.19.11
|
||
*
|
||
* Author: Rodney Rehm
|
||
* Web: http://medialize.github.io/URI.js/
|
||
*
|
||
* Licensed under
|
||
* MIT License http://www.opensource.org/licenses/mit-license
|
||
*
|
||
*/(function(e){(function(t,n){e.exports?e.exports=n(ESe(),wSe(),vSe()):t.URI=n(t.punycode,t.IPv6,t.SecondLevelDomains,t)})(Ku,function(t,n,i,o){var r=o&&o.URI;function s(m,P){var R=arguments.length>=1,U=arguments.length>=2;if(!(this instanceof s))return R?U?new s(m,P):new s(m):new s;if(m===void 0){if(R)throw new TypeError("undefined is not a valid argument for URI");typeof location<"u"?m=location.href+"":m=""}if(m===null&&R)throw new TypeError("null is not a valid argument for URI");return this.href(m),P!==void 0?this.absoluteTo(P):this}function a(m){return/^[0-9]+$/.test(m)}s.version="1.19.11";var c=s.prototype,u=Object.prototype.hasOwnProperty;function f(m){return m.replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")}function h(m){return m===void 0?"Undefined":String(Object.prototype.toString.call(m)).slice(8,-1)}function _(m){return h(m)==="Array"}function g(m,P){var R={},U,W;if(h(P)==="RegExp")R=null;else if(_(P))for(U=0,W=P.length;U<W;U++)R[P[U]]=!0;else R[P]=!0;for(U=0,W=m.length;U<W;U++){var q=R&&R[m[U]]!==void 0||!R&&P.test(m[U]);q&&(m.splice(U,1),W--,U--)}return m}function p(m,P){var R,U;if(_(P)){for(R=0,U=P.length;R<U;R++)if(!p(m,P[R]))return!1;return!0}var W=h(P);for(R=0,U=m.length;R<U;R++)if(W==="RegExp"){if(typeof m[R]=="string"&&m[R].match(P))return!0}else if(m[R]===P)return!0;return!1}function y(m,P){if(!_(m)||!_(P)||m.length!==P.length)return!1;m.sort(),P.sort();for(var R=0,U=m.length;R<U;R++)if(m[R]!==P[R])return!1;return!0}function T(m){var P=/^\/+|\/+$/g;return m.replace(P,"")}s._parts=function(){return{protocol:null,username:null,password:null,hostname:null,urn:null,port:null,path:null,query:null,fragment:null,preventInvalidHostname:s.preventInvalidHostname,duplicateQueryParameters:s.duplicateQueryParameters,escapeQuerySpace:s.escapeQuerySpace}},s.preventInvalidHostname=!1,s.duplicateQueryParameters=!1,s.escapeQuerySpace=!0,s.protocol_expression=/^[a-z][a-z0-9.+-]*$/i,s.idn_expression=/[^a-z0-9\._-]/i,s.punycode_expression=/(xn--)/i,s.ip4_expression=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,s.ip6_expression=/^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/,s.find_uri_expression=/\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))/ig,s.findUri={start:/\b(?:([a-z][a-z0-9.+-]*:\/\/)|www\.)/gi,end:/[\s\r\n]|$/,trim:/[`!()\[\]{};:'".,<>?«»“”„‘’]+$/,parens:/(\([^\)]*\)|\[[^\]]*\]|\{[^}]*\}|<[^>]*>)/g},s.leading_whitespace_expression=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,s.ascii_tab_whitespace=/[\u0009\u000A\u000D]+/g,s.defaultPorts={http:"80",https:"443",ftp:"21",gopher:"70",ws:"80",wss:"443"},s.hostProtocols=["http","https"],s.invalid_hostname_characters=/[^a-zA-Z0-9\.\-:_]/,s.domAttributes={a:"href",blockquote:"cite",link:"href",base:"href",script:"src",form:"action",img:"src",area:"href",iframe:"src",embed:"src",source:"src",track:"src",input:"src",audio:"src",video:"src"},s.getDomAttribute=function(m){if(!(!m||!m.nodeName)){var P=m.nodeName.toLowerCase();if(!(P==="input"&&m.type!=="image"))return s.domAttributes[P]}};function b(m){return escape(m)}function x(m){return encodeURIComponent(m).replace(/[!'()*]/g,b).replace(/\*/g,"%2A")}s.encode=x,s.decode=decodeURIComponent,s.iso8859=function(){s.encode=escape,s.decode=unescape},s.unicode=function(){s.encode=x,s.decode=decodeURIComponent},s.characters={pathname:{encode:{expression:/%(24|26|2B|2C|3B|3D|3A|40)/ig,map:{"%24":"$","%26":"&","%2B":"+","%2C":",","%3B":";","%3D":"=","%3A":":","%40":"@"}},decode:{expression:/[\/\?#]/g,map:{"/":"%2F","?":"%3F","#":"%23"}}},reserved:{encode:{expression:/%(21|23|24|26|27|28|29|2A|2B|2C|2F|3A|3B|3D|3F|40|5B|5D)/ig,map:{"%3A":":","%2F":"/","%3F":"?","%23":"#","%5B":"[","%5D":"]","%40":"@","%21":"!","%24":"$","%26":"&","%27":"'","%28":"(","%29":")","%2A":"*","%2B":"+","%2C":",","%3B":";","%3D":"="}}},urnpath:{encode:{expression:/%(21|24|27|28|29|2A|2B|2C|3B|3D|40)/ig,map:{"%21":"!","%24":"$","%27":"'","%28":"(","%29":")","%2A":"*","%2B":"+","%2C":",","%3B":";","%3D":"=","%40":"@"}},decode:{expression:/[\/\?#:]/g,map:{"/":"%2F","?":"%3F","#":"%23",":":"%3A"}}}},s.encodeQuery=function(m,P){var R=s.encode(m+"");return P===void 0&&(P=s.escapeQuerySpace),P?R.replace(/%20/g,"+"):R},s.decodeQuery=function(m,P){m+="",P===void 0&&(P=s.escapeQuerySpace);try{return s.decode(P?m.replace(/\+/g,"%20"):m)}catch{return m}};var v={encode:"encode",decode:"decode"},D,L=function(m,P){return function(R){try{return s[P](R+"").replace(s.characters[m][P].expression,function(U){return s.characters[m][P].map[U]})}catch{return R}}};for(D in v)s[D+"PathSegment"]=L("pathname",v[D]),s[D+"UrnPathSegment"]=L("urnpath",v[D]);var B=function(m,P,R){return function(U){var W;R?W=function(ee){return s[P](s[R](ee))}:W=s[P];for(var q=(U+"").split(m),Y=0,j=q.length;Y<j;Y++)q[Y]=W(q[Y]);return q.join(m)}};s.decodePath=B("/","decodePathSegment"),s.decodeUrnPath=B(":","decodeUrnPathSegment"),s.recodePath=B("/","encodePathSegment","decode"),s.recodeUrnPath=B(":","encodeUrnPathSegment","decode"),s.encodeReserved=L("reserved","encode"),s.parse=function(m,P){var R;return P||(P={preventInvalidHostname:s.preventInvalidHostname}),m=m.replace(s.leading_whitespace_expression,""),m=m.replace(s.ascii_tab_whitespace,""),R=m.indexOf("#"),R>-1&&(P.fragment=m.substring(R+1)||null,m=m.substring(0,R)),R=m.indexOf("?"),R>-1&&(P.query=m.substring(R+1)||null,m=m.substring(0,R)),m=m.replace(/^(https?|ftp|wss?)?:+[/\\]*/i,"$1://"),m=m.replace(/^[/\\]{2,}/i,"//"),m.substring(0,2)==="//"?(P.protocol=null,m=m.substring(2),m=s.parseAuthority(m,P)):(R=m.indexOf(":"),R>-1&&(P.protocol=m.substring(0,R)||null,P.protocol&&!P.protocol.match(s.protocol_expression)?P.protocol=void 0:m.substring(R+1,R+3).replace(/\\/g,"/")==="//"?(m=m.substring(R+3),m=s.parseAuthority(m,P)):(m=m.substring(R+1),P.urn=!0))),P.path=m,P},s.parseHost=function(m,P){m||(m=""),m=m.replace(/\\/g,"/");var R=m.indexOf("/"),U,W;if(R===-1&&(R=m.length),m.charAt(0)==="[")U=m.indexOf("]"),P.hostname=m.substring(1,U)||null,P.port=m.substring(U+2,R)||null,P.port==="/"&&(P.port=null);else{var q=m.indexOf(":"),Y=m.indexOf("/"),j=m.indexOf(":",q+1);j!==-1&&(Y===-1||j<Y)?(P.hostname=m.substring(0,R)||null,P.port=null):(W=m.substring(0,R).split(":"),P.hostname=W[0]||null,P.port=W[1]||null)}return P.hostname&&m.substring(R).charAt(0)!=="/"&&(R++,m="/"+m),P.preventInvalidHostname&&s.ensureValidHostname(P.hostname,P.protocol),P.port&&s.ensureValidPort(P.port),m.substring(R)||"/"},s.parseAuthority=function(m,P){return m=s.parseUserinfo(m,P),s.parseHost(m,P)},s.parseUserinfo=function(m,P){var R=m,U=m.indexOf("\\");U!==-1&&(m=m.replace(/\\/g,"/"));var W=m.indexOf("/"),q=m.lastIndexOf("@",W>-1?W:m.length-1),Y;return q>-1&&(W===-1||q<W)?(Y=m.substring(0,q).split(":"),P.username=Y[0]?s.decode(Y[0]):null,Y.shift(),P.password=Y[0]?s.decode(Y.join(":")):null,m=R.substring(q+1)):(P.username=null,P.password=null),m},s.parseQuery=function(m,P){if(!m)return{};if(m=m.replace(/&+/g,"&").replace(/^\?*&*|&+$/g,""),!m)return{};for(var R={},U=m.split("&"),W=U.length,q,Y,j,ee=0;ee<W;ee++)q=U[ee].split("="),Y=s.decodeQuery(q.shift(),P),j=q.length?s.decodeQuery(q.join("="),P):null,Y!=="__proto__"&&(u.call(R,Y)?((typeof R[Y]=="string"||R[Y]===null)&&(R[Y]=[R[Y]]),R[Y].push(j)):R[Y]=j);return R},s.build=function(m){var P="",R=!1;return m.protocol&&(P+=m.protocol+":"),!m.urn&&(P||m.hostname)&&(P+="//",R=!0),P+=s.buildAuthority(m)||"",typeof m.path=="string"&&(m.path.charAt(0)!=="/"&&R&&(P+="/"),P+=m.path),typeof m.query=="string"&&m.query&&(P+="?"+m.query),typeof m.fragment=="string"&&m.fragment&&(P+="#"+m.fragment),P},s.buildHost=function(m){var P="";if(m.hostname)s.ip6_expression.test(m.hostname)?P+="["+m.hostname+"]":P+=m.hostname;else return"";return m.port&&(P+=":"+m.port),P},s.buildAuthority=function(m){return s.buildUserinfo(m)+s.buildHost(m)},s.buildUserinfo=function(m){var P="";return m.username&&(P+=s.encode(m.username)),m.password&&(P+=":"+s.encode(m.password)),P&&(P+="@"),P},s.buildQuery=function(m,P,R){var U="",W,q,Y,j;for(q in m)if(q!=="__proto__"&&u.call(m,q))if(_(m[q]))for(W={},Y=0,j=m[q].length;Y<j;Y++)m[q][Y]!==void 0&&W[m[q][Y]+""]===void 0&&(U+="&"+s.buildQueryParameter(q,m[q][Y],R),P!==!0&&(W[m[q][Y]+""]=!0));else m[q]!==void 0&&(U+="&"+s.buildQueryParameter(q,m[q],R));return U.substring(1)},s.buildQueryParameter=function(m,P,R){return s.encodeQuery(m,R)+(P!==null?"="+s.encodeQuery(P,R):"")},s.addQuery=function(m,P,R){if(typeof P=="object")for(var U in P)u.call(P,U)&&s.addQuery(m,U,P[U]);else if(typeof P=="string"){if(m[P]===void 0){m[P]=R;return}else typeof m[P]=="string"&&(m[P]=[m[P]]);_(R)||(R=[R]),m[P]=(m[P]||[]).concat(R)}else throw new TypeError("URI.addQuery() accepts an object, string as the name parameter")},s.setQuery=function(m,P,R){if(typeof P=="object")for(var U in P)u.call(P,U)&&s.setQuery(m,U,P[U]);else if(typeof P=="string")m[P]=R===void 0?null:R;else throw new TypeError("URI.setQuery() accepts an object, string as the name parameter")},s.removeQuery=function(m,P,R){var U,W,q;if(_(P))for(U=0,W=P.length;U<W;U++)m[P[U]]=void 0;else if(h(P)==="RegExp")for(q in m)P.test(q)&&(m[q]=void 0);else if(typeof P=="object")for(q in P)u.call(P,q)&&s.removeQuery(m,q,P[q]);else if(typeof P=="string")R!==void 0?h(R)==="RegExp"?!_(m[P])&&R.test(m[P])?m[P]=void 0:m[P]=g(m[P],R):m[P]===String(R)&&(!_(R)||R.length===1)?m[P]=void 0:_(m[P])&&(m[P]=g(m[P],R)):m[P]=void 0;else throw new TypeError("URI.removeQuery() accepts an object, string, RegExp as the first parameter")},s.hasQuery=function(m,P,R,U){switch(h(P)){case"String":break;case"RegExp":for(var W in m)if(u.call(m,W)&&P.test(W)&&(R===void 0||s.hasQuery(m,W,R)))return!0;return!1;case"Object":for(var q in P)if(u.call(P,q)&&!s.hasQuery(m,q,P[q]))return!1;return!0;default:throw new TypeError("URI.hasQuery() accepts a string, regular expression or object as the name parameter")}switch(h(R)){case"Undefined":return P in m;case"Boolean":var Y=Boolean(_(m[P])?m[P].length:m[P]);return R===Y;case"Function":return!!R(m[P],P,m);case"Array":if(!_(m[P]))return!1;var j=U?p:y;return j(m[P],R);case"RegExp":return _(m[P])?U?p(m[P],R):!1:Boolean(m[P]&&m[P].match(R));case"Number":R=String(R);case"String":return _(m[P])?U?p(m[P],R):!1:m[P]===R;default:throw new TypeError("URI.hasQuery() accepts undefined, boolean, string, number, RegExp, Function as the value parameter")}},s.joinPaths=function(){for(var m=[],P=[],R=0,U=0;U<arguments.length;U++){var W=new s(arguments[U]);m.push(W);for(var q=W.segment(),Y=0;Y<q.length;Y++)typeof q[Y]=="string"&&P.push(q[Y]),q[Y]&&R++}if(!P.length||!R)return new s("");var j=new s("").segment(P);return(m[0].path()===""||m[0].path().slice(0,1)==="/")&&j.path("/"+j.path()),j.normalize()},s.commonPath=function(m,P){var R=Math.min(m.length,P.length),U;for(U=0;U<R;U++)if(m.charAt(U)!==P.charAt(U)){U--;break}return U<1?m.charAt(0)===P.charAt(0)&&m.charAt(0)==="/"?"/":"":((m.charAt(U)!=="/"||P.charAt(U)!=="/")&&(U=m.substring(0,U).lastIndexOf("/")),m.substring(0,U+1))},s.withinString=function(m,P,R){R||(R={});var U=R.start||s.findUri.start,W=R.end||s.findUri.end,q=R.trim||s.findUri.trim,Y=R.parens||s.findUri.parens,j=/[a-z0-9-]=["']?$/i;for(U.lastIndex=0;;){var ee=U.exec(m);if(!ee)break;var K=ee.index;if(R.ignoreHtml){var se=m.slice(Math.max(K-3,0),K);if(se&&j.test(se))continue}for(var Q=K+m.slice(K).search(W),Z=m.slice(K,Q),J=-1;;){var de=Y.exec(Z);if(!de)break;var _e=de.index+de[0].length;J=Math.max(J,_e)}if(J>-1?Z=Z.slice(0,J)+Z.slice(J).replace(q,""):Z=Z.replace(q,""),!(Z.length<=ee[0].length)&&!(R.ignore&&R.ignore.test(Z))){Q=K+Z.length;var le=P(Z,K,Q,m);if(le===void 0){U.lastIndex=Q;continue}le=String(le),m=m.slice(0,K)+le+m.slice(Q),U.lastIndex=K+le.length}}return U.lastIndex=0,m},s.ensureValidHostname=function(m,P){var R=!!m,U=!!P,W=!1;if(U&&(W=p(s.hostProtocols,P)),W&&!R)throw new TypeError("Hostname cannot be empty, if protocol is "+P);if(m&&m.match(s.invalid_hostname_characters)){if(!t)throw new TypeError('Hostname "'+m+'" contains characters other than [A-Z0-9.-:_] and Punycode.js is not available');if(t.toASCII(m).match(s.invalid_hostname_characters))throw new TypeError('Hostname "'+m+'" contains characters other than [A-Z0-9.-:_]')}},s.ensureValidPort=function(m){if(m){var P=Number(m);if(!(a(P)&&P>0&&P<65536))throw new TypeError('Port "'+m+'" is not a valid port')}},s.noConflict=function(m){if(m){var P={URI:this.noConflict()};return o.URITemplate&&typeof o.URITemplate.noConflict=="function"&&(P.URITemplate=o.URITemplate.noConflict()),o.IPv6&&typeof o.IPv6.noConflict=="function"&&(P.IPv6=o.IPv6.noConflict()),o.SecondLevelDomains&&typeof o.SecondLevelDomains.noConflict=="function"&&(P.SecondLevelDomains=o.SecondLevelDomains.noConflict()),P}else o.URI===this&&(o.URI=r);return this},c.build=function(m){return m===!0?this._deferred_build=!0:(m===void 0||this._deferred_build)&&(this._string=s.build(this._parts),this._deferred_build=!1),this},c.clone=function(){return new s(this)},c.valueOf=c.toString=function(){return this.build(!1)._string};function V(m){return function(P,R){return P===void 0?this._parts[m]||"":(this._parts[m]=P||null,this.build(!R),this)}}function M(m,P){return function(R,U){return R===void 0?this._parts[m]||"":(R!==null&&(R=R+"",R.charAt(0)===P&&(R=R.substring(1))),this._parts[m]=R,this.build(!U),this)}}c.protocol=V("protocol"),c.username=V("username"),c.password=V("password"),c.hostname=V("hostname"),c.port=V("port"),c.query=M("query","?"),c.fragment=M("fragment","#"),c.search=function(m,P){var R=this.query(m,P);return typeof R=="string"&&R.length?"?"+R:R},c.hash=function(m,P){var R=this.fragment(m,P);return typeof R=="string"&&R.length?"#"+R:R},c.pathname=function(m,P){if(m===void 0||m===!0){var R=this._parts.path||(this._parts.hostname?"/":"");return m?(this._parts.urn?s.decodeUrnPath:s.decodePath)(R):R}else return this._parts.urn?this._parts.path=m?s.recodeUrnPath(m):"":this._parts.path=m?s.recodePath(m):"/",this.build(!P),this},c.path=c.pathname,c.href=function(m,P){var R;if(m===void 0)return this.toString();this._string="",this._parts=s._parts();var U=m instanceof s,W=typeof m=="object"&&(m.hostname||m.path||m.pathname);if(m.nodeName){var q=s.getDomAttribute(m);m=m[q]||"",W=!1}if(!U&&W&&m.pathname!==void 0&&(m=m.toString()),typeof m=="string"||m instanceof String)this._parts=s.parse(String(m),this._parts);else if(U||W){var Y=U?m._parts:m;for(R in Y)R!=="query"&&u.call(this._parts,R)&&(this._parts[R]=Y[R]);Y.query&&this.query(Y.query,!1)}else throw new TypeError("invalid input");return this.build(!P),this},c.is=function(m){var P=!1,R=!1,U=!1,W=!1,q=!1,Y=!1,j=!1,ee=!this._parts.urn;switch(this._parts.hostname&&(ee=!1,R=s.ip4_expression.test(this._parts.hostname),U=s.ip6_expression.test(this._parts.hostname),P=R||U,W=!P,q=W&&i&&i.has(this._parts.hostname),Y=W&&s.idn_expression.test(this._parts.hostname),j=W&&s.punycode_expression.test(this._parts.hostname)),m.toLowerCase()){case"relative":return ee;case"absolute":return!ee;case"domain":case"name":return W;case"sld":return q;case"ip":return P;case"ip4":case"ipv4":case"inet4":return R;case"ip6":case"ipv6":case"inet6":return U;case"idn":return Y;case"url":return!this._parts.urn;case"urn":return!!this._parts.urn;case"punycode":return j}return null};var H=c.protocol,G=c.port,I=c.hostname;c.protocol=function(m,P){if(m&&(m=m.replace(/:(\/\/)?$/,""),!m.match(s.protocol_expression)))throw new TypeError('Protocol "'+m+`" contains characters other than [A-Z0-9.+-] or doesn't start with [A-Z]`);return H.call(this,m,P)},c.scheme=c.protocol,c.port=function(m,P){return this._parts.urn?m===void 0?"":this:(m!==void 0&&(m===0&&(m=null),m&&(m+="",m.charAt(0)===":"&&(m=m.substring(1)),s.ensureValidPort(m))),G.call(this,m,P))},c.hostname=function(m,P){if(this._parts.urn)return m===void 0?"":this;if(m!==void 0){var R={preventInvalidHostname:this._parts.preventInvalidHostname},U=s.parseHost(m,R);if(U!=="/")throw new TypeError('Hostname "'+m+'" contains characters other than [A-Z0-9.-]');m=R.hostname,this._parts.preventInvalidHostname&&s.ensureValidHostname(m,this._parts.protocol)}return I.call(this,m,P)},c.origin=function(m,P){if(this._parts.urn)return m===void 0?"":this;if(m===void 0){var R=this.protocol(),U=this.authority();return U?(R?R+"://":"")+this.authority():""}else{var W=s(m);return this.protocol(W.protocol()).authority(W.authority()).build(!P),this}},c.host=function(m,P){if(this._parts.urn)return m===void 0?"":this;if(m===void 0)return this._parts.hostname?s.buildHost(this._parts):"";var R=s.parseHost(m,this._parts);if(R!=="/")throw new TypeError('Hostname "'+m+'" contains characters other than [A-Z0-9.-]');return this.build(!P),this},c.authority=function(m,P){if(this._parts.urn)return m===void 0?"":this;if(m===void 0)return this._parts.hostname?s.buildAuthority(this._parts):"";var R=s.parseAuthority(m,this._parts);if(R!=="/")throw new TypeError('Hostname "'+m+'" contains characters other than [A-Z0-9.-]');return this.build(!P),this},c.userinfo=function(m,P){if(this._parts.urn)return m===void 0?"":this;if(m===void 0){var R=s.buildUserinfo(this._parts);return R&&R.substring(0,R.length-1)}else return m[m.length-1]!=="@"&&(m+="@"),s.parseUserinfo(m,this._parts),this.build(!P),this},c.resource=function(m,P){var R;return m===void 0?this.path()+this.search()+this.hash():(R=s.parse(m),this._parts.path=R.path,this._parts.query=R.query,this._parts.fragment=R.fragment,this.build(!P),this)},c.subdomain=function(m,P){if(this._parts.urn)return m===void 0?"":this;if(m===void 0){if(!this._parts.hostname||this.is("IP"))return"";var R=this._parts.hostname.length-this.domain().length-1;return this._parts.hostname.substring(0,R)||""}else{var U=this._parts.hostname.length-this.domain().length,W=this._parts.hostname.substring(0,U),q=new RegExp("^"+f(W));if(m&&m.charAt(m.length-1)!=="."&&(m+="."),m.indexOf(":")!==-1)throw new TypeError("Domains cannot contain colons");return m&&s.ensureValidHostname(m,this._parts.protocol),this._parts.hostname=this._parts.hostname.replace(q,m),this.build(!P),this}},c.domain=function(m,P){if(this._parts.urn)return m===void 0?"":this;if(typeof m=="boolean"&&(P=m,m=void 0),m===void 0){if(!this._parts.hostname||this.is("IP"))return"";var R=this._parts.hostname.match(/\./g);if(R&&R.length<2)return this._parts.hostname;var U=this._parts.hostname.length-this.tld(P).length-1;return U=this._parts.hostname.lastIndexOf(".",U-1)+1,this._parts.hostname.substring(U)||""}else{if(!m)throw new TypeError("cannot set domain empty");if(m.indexOf(":")!==-1)throw new TypeError("Domains cannot contain colons");if(s.ensureValidHostname(m,this._parts.protocol),!this._parts.hostname||this.is("IP"))this._parts.hostname=m;else{var W=new RegExp(f(this.domain())+"$");this._parts.hostname=this._parts.hostname.replace(W,m)}return this.build(!P),this}},c.tld=function(m,P){if(this._parts.urn)return m===void 0?"":this;if(typeof m=="boolean"&&(P=m,m=void 0),m===void 0){if(!this._parts.hostname||this.is("IP"))return"";var R=this._parts.hostname.lastIndexOf("."),U=this._parts.hostname.substring(R+1);return P!==!0&&i&&i.list[U.toLowerCase()]&&i.get(this._parts.hostname)||U}else{var W;if(m)if(m.match(/[^a-zA-Z0-9-]/))if(i&&i.is(m))W=new RegExp(f(this.tld())+"$"),this._parts.hostname=this._parts.hostname.replace(W,m);else throw new TypeError('TLD "'+m+'" contains characters other than [A-Z0-9]');else{if(!this._parts.hostname||this.is("IP"))throw new ReferenceError("cannot set TLD on non-domain host");W=new RegExp(f(this.tld())+"$"),this._parts.hostname=this._parts.hostname.replace(W,m)}else throw new TypeError("cannot set TLD empty");return this.build(!P),this}},c.directory=function(m,P){if(this._parts.urn)return m===void 0?"":this;if(m===void 0||m===!0){if(!this._parts.path&&!this._parts.hostname)return"";if(this._parts.path==="/")return"/";var R=this._parts.path.length-this.filename().length-1,U=this._parts.path.substring(0,R)||(this._parts.hostname?"/":"");return m?s.decodePath(U):U}else{var W=this._parts.path.length-this.filename().length,q=this._parts.path.substring(0,W),Y=new RegExp("^"+f(q));return this.is("relative")||(m||(m="/"),m.charAt(0)!=="/"&&(m="/"+m)),m&&m.charAt(m.length-1)!=="/"&&(m+="/"),m=s.recodePath(m),this._parts.path=this._parts.path.replace(Y,m),this.build(!P),this}},c.filename=function(m,P){if(this._parts.urn)return m===void 0?"":this;if(typeof m!="string"){if(!this._parts.path||this._parts.path==="/")return"";var R=this._parts.path.lastIndexOf("/"),U=this._parts.path.substring(R+1);return m?s.decodePathSegment(U):U}else{var W=!1;m.charAt(0)==="/"&&(m=m.substring(1)),m.match(/\.?\//)&&(W=!0);var q=new RegExp(f(this.filename())+"$");return m=s.recodePath(m),this._parts.path=this._parts.path.replace(q,m),W?this.normalizePath(P):this.build(!P),this}},c.suffix=function(m,P){if(this._parts.urn)return m===void 0?"":this;if(m===void 0||m===!0){if(!this._parts.path||this._parts.path==="/")return"";var R=this.filename(),U=R.lastIndexOf("."),W,q;return U===-1?"":(W=R.substring(U+1),q=/^[a-z0-9%]+$/i.test(W)?W:"",m?s.decodePathSegment(q):q)}else{m.charAt(0)==="."&&(m=m.substring(1));var Y=this.suffix(),j;if(Y)m?j=new RegExp(f(Y)+"$"):j=new RegExp(f("."+Y)+"$");else{if(!m)return this;this._parts.path+="."+s.recodePath(m)}return j&&(m=s.recodePath(m),this._parts.path=this._parts.path.replace(j,m)),this.build(!P),this}},c.segment=function(m,P,R){var U=this._parts.urn?":":"/",W=this.path(),q=W.substring(0,1)==="/",Y=W.split(U);if(m!==void 0&&typeof m!="number"&&(R=P,P=m,m=void 0),m!==void 0&&typeof m!="number")throw new Error('Bad segment "'+m+'", must be 0-based integer');if(q&&Y.shift(),m<0&&(m=Math.max(Y.length+m,0)),P===void 0)return m===void 0?Y:Y[m];if(m===null||Y[m]===void 0)if(_(P)){Y=[];for(var j=0,ee=P.length;j<ee;j++)!P[j].length&&(!Y.length||!Y[Y.length-1].length)||(Y.length&&!Y[Y.length-1].length&&Y.pop(),Y.push(T(P[j])))}else(P||typeof P=="string")&&(P=T(P),Y[Y.length-1]===""?Y[Y.length-1]=P:Y.push(P));else P?Y[m]=T(P):Y.splice(m,1);return q&&Y.unshift(""),this.path(Y.join(U),R)},c.segmentCoded=function(m,P,R){var U,W,q;if(typeof m!="number"&&(R=P,P=m,m=void 0),P===void 0){if(U=this.segment(m,P,R),!_(U))U=U!==void 0?s.decode(U):void 0;else for(W=0,q=U.length;W<q;W++)U[W]=s.decode(U[W]);return U}if(!_(P))P=typeof P=="string"||P instanceof String?s.encode(P):P;else for(W=0,q=P.length;W<q;W++)P[W]=s.encode(P[W]);return this.segment(m,P,R)};var O=c.query;return c.query=function(m,P){if(m===!0)return s.parseQuery(this._parts.query,this._parts.escapeQuerySpace);if(typeof m=="function"){var R=s.parseQuery(this._parts.query,this._parts.escapeQuerySpace),U=m.call(this,R);return this._parts.query=s.buildQuery(U||R,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),this.build(!P),this}else return m!==void 0&&typeof m!="string"?(this._parts.query=s.buildQuery(m,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),this.build(!P),this):O.call(this,m,P)},c.setQuery=function(m,P,R){var U=s.parseQuery(this._parts.query,this._parts.escapeQuerySpace);if(typeof m=="string"||m instanceof String)U[m]=P!==void 0?P:null;else if(typeof m=="object")for(var W in m)u.call(m,W)&&(U[W]=m[W]);else throw new TypeError("URI.addQuery() accepts an object, string as the name parameter");return this._parts.query=s.buildQuery(U,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),typeof m!="string"&&(R=P),this.build(!R),this},c.addQuery=function(m,P,R){var U=s.parseQuery(this._parts.query,this._parts.escapeQuerySpace);return s.addQuery(U,m,P===void 0?null:P),this._parts.query=s.buildQuery(U,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),typeof m!="string"&&(R=P),this.build(!R),this},c.removeQuery=function(m,P,R){var U=s.parseQuery(this._parts.query,this._parts.escapeQuerySpace);return s.removeQuery(U,m,P),this._parts.query=s.buildQuery(U,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),typeof m!="string"&&(R=P),this.build(!R),this},c.hasQuery=function(m,P,R){var U=s.parseQuery(this._parts.query,this._parts.escapeQuerySpace);return s.hasQuery(U,m,P,R)},c.setSearch=c.setQuery,c.addSearch=c.addQuery,c.removeSearch=c.removeQuery,c.hasSearch=c.hasQuery,c.normalize=function(){return this._parts.urn?this.normalizeProtocol(!1).normalizePath(!1).normalizeQuery(!1).normalizeFragment(!1).build():this.normalizeProtocol(!1).normalizeHostname(!1).normalizePort(!1).normalizePath(!1).normalizeQuery(!1).normalizeFragment(!1).build()},c.normalizeProtocol=function(m){return typeof this._parts.protocol=="string"&&(this._parts.protocol=this._parts.protocol.toLowerCase(),this.build(!m)),this},c.normalizeHostname=function(m){return this._parts.hostname&&(this.is("IDN")&&t?this._parts.hostname=t.toASCII(this._parts.hostname):this.is("IPv6")&&n&&(this._parts.hostname=n.best(this._parts.hostname)),this._parts.hostname=this._parts.hostname.toLowerCase(),this.build(!m)),this},c.normalizePort=function(m){return typeof this._parts.protocol=="string"&&this._parts.port===s.defaultPorts[this._parts.protocol]&&(this._parts.port=null,this.build(!m)),this},c.normalizePath=function(m){var P=this._parts.path;if(!P)return this;if(this._parts.urn)return this._parts.path=s.recodeUrnPath(this._parts.path),this.build(!m),this;if(this._parts.path==="/")return this;P=s.recodePath(P);var R,U="",W,q;for(P.charAt(0)!=="/"&&(R=!0,P="/"+P),(P.slice(-3)==="/.."||P.slice(-2)==="/.")&&(P+="/"),P=P.replace(/(\/(\.\/)+)|(\/\.$)/g,"/").replace(/\/{2,}/g,"/"),R&&(U=P.substring(1).match(/^(\.\.\/)+/)||"",U&&(U=U[0]));W=P.search(/\/\.\.(\/|$)/),W!==-1;){if(W===0){P=P.substring(3);continue}q=P.substring(0,W).lastIndexOf("/"),q===-1&&(q=W),P=P.substring(0,q)+P.substring(W+3)}return R&&this.is("relative")&&(P=U+P.substring(1)),this._parts.path=P,this.build(!m),this},c.normalizePathname=c.normalizePath,c.normalizeQuery=function(m){return typeof this._parts.query=="string"&&(this._parts.query.length?this.query(s.parseQuery(this._parts.query,this._parts.escapeQuerySpace)):this._parts.query=null,this.build(!m)),this},c.normalizeFragment=function(m){return this._parts.fragment||(this._parts.fragment=null,this.build(!m)),this},c.normalizeSearch=c.normalizeQuery,c.normalizeHash=c.normalizeFragment,c.iso8859=function(){var m=s.encode,P=s.decode;s.encode=escape,s.decode=decodeURIComponent;try{this.normalize()}finally{s.encode=m,s.decode=P}return this},c.unicode=function(){var m=s.encode,P=s.decode;s.encode=x,s.decode=unescape;try{this.normalize()}finally{s.encode=m,s.decode=P}return this},c.readable=function(){var m=this.clone();m.username("").password("").normalize();var P="";if(m._parts.protocol&&(P+=m._parts.protocol+"://"),m._parts.hostname&&(m.is("punycode")&&t?(P+=t.toUnicode(m._parts.hostname),m._parts.port&&(P+=":"+m._parts.port)):P+=m.host()),m._parts.hostname&&m._parts.path&&m._parts.path.charAt(0)!=="/"&&(P+="/"),P+=m.path(!0),m._parts.query){for(var R="",U=0,W=m._parts.query.split("&"),q=W.length;U<q;U++){var Y=(W[U]||"").split("=");R+="&"+s.decodeQuery(Y[0],this._parts.escapeQuerySpace).replace(/&/g,"%26"),Y[1]!==void 0&&(R+="="+s.decodeQuery(Y[1],this._parts.escapeQuerySpace).replace(/&/g,"%26"))}P+="?"+R.substring(1)}return P+=s.decodeQuery(m.hash(),!0),P},c.absoluteTo=function(m){var P=this.clone(),R=["protocol","username","password","hostname","port"],U,W,q;if(this._parts.urn)throw new Error("URNs do not have any generally defined hierarchical components");if(m instanceof s||(m=new s(m)),P._parts.protocol||(P._parts.protocol=m._parts.protocol,this._parts.hostname))return P;for(W=0;q=R[W];W++)P._parts[q]=m._parts[q];return P._parts.path?(P._parts.path.substring(-2)===".."&&(P._parts.path+="/"),P.path().charAt(0)!=="/"&&(U=m.directory(),U=U||(m.path().indexOf("/")===0?"/":""),P._parts.path=(U?U+"/":"")+P._parts.path,P.normalizePath())):(P._parts.path=m._parts.path,P._parts.query||(P._parts.query=m._parts.query)),P.build(),P},c.relativeTo=function(m){var P=this.clone().normalize(),R,U,W,q,Y;if(P._parts.urn)throw new Error("URNs do not have any generally defined hierarchical components");if(m=new s(m).normalize(),R=P._parts,U=m._parts,q=P.path(),Y=m.path(),q.charAt(0)!=="/")throw new Error("URI is already relative");if(Y.charAt(0)!=="/")throw new Error("Cannot calculate a URI relative to another relative URI");if(R.protocol===U.protocol&&(R.protocol=null),R.username!==U.username||R.password!==U.password||R.protocol!==null||R.username!==null||R.password!==null)return P.build();if(R.hostname===U.hostname&&R.port===U.port)R.hostname=null,R.port=null;else return P.build();if(q===Y)return R.path="",P.build();if(W=s.commonPath(q,Y),!W)return P.build();var j=U.path.substring(W.length).replace(/[^\/]*$/,"").replace(/.*?\//g,"../");return R.path=j+R.path.substring(W.length)||"./",P.build()},c.equals=function(m){var P=this.clone(),R=new s(m),U={},W={},q={},Y,j,ee;if(P.normalize(),R.normalize(),P.toString()===R.toString())return!0;if(Y=P.query(),j=R.query(),P.query(""),R.query(""),P.toString()!==R.toString()||Y.length!==j.length)return!1;U=s.parseQuery(Y,this._parts.escapeQuerySpace),W=s.parseQuery(j,this._parts.escapeQuerySpace);for(ee in U)if(u.call(U,ee)){if(_(U[ee])){if(!y(U[ee],W[ee]))return!1}else if(U[ee]!==W[ee])return!1;q[ee]=!0}for(ee in W)if(u.call(W,ee)&&!q[ee])return!1;return!0},c.preventInvalidHostname=function(m){return this._parts.preventInvalidHostname=!!m,this},c.duplicateQueryParameters=function(m){return this._parts.duplicateQueryParameters=!!m,this},c.escapeQuerySpace=function(m){return this._parts.escapeQuerySpace=!!m,this},s})})(CSe);const ha=UM;function DSe(e){return(e.length===0||e[e.length-1]!=="/")&&(e=`${e}/`),e}function St(e,t){if(e===null||typeof e!="object")return e;t=A(t,!1);const n=new e.constructor;for(const i in e)if(e.hasOwnProperty(i)){let o=e[i];t&&(o=St(o,t)),n[i]=o}return n}function Ln(e,t,n){n=A(n,!1);const i={},o=l(e),r=l(t);let s,a,c;if(o)for(s in e)e.hasOwnProperty(s)&&(a=e[s],r&&n&&typeof a=="object"&&t.hasOwnProperty(s)?(c=t[s],typeof c=="object"?i[s]=Ln(a,c,n):i[s]=a):i[s]=a);if(r)for(s in t)t.hasOwnProperty(s)&&!i.hasOwnProperty(s)&&(c=t[s],i[s]=c);return i}function __(){let e,t;const n=new Promise(function(i,o){e=i,t=o});return{resolve:e,reject:t,promise:n}}function hx(e,t){let n;return typeof document<"u"&&(n=document),hx._implementation(e,t,n)}hx._implementation=function(e,t,n){if(!l(e))throw new w("relative uri is required.");if(!l(t)){if(typeof n>"u")return e;t=A(n.baseURI,n.location.href)}const i=new ha(e);return i.scheme()!==""?i.toString():i.absoluteTo(t).toString()};function ISe(e,t){if(!l(e))throw new w("uri is required.");let n="";const i=e.lastIndexOf("/");return i!==-1&&(n=e.substring(0,i+1)),t&&(e=new ha(e),e.query().length!==0&&(n+=`?${e.query()}`),e.fragment().length!==0&&(n+=`#${e.fragment()}`)),n}function PSe(e){if(!l(e))throw new w("uri is required.");const t=new ha(e);t.normalize();let n=t.path(),i=n.lastIndexOf("/");return i!==-1&&(n=n.substr(i+1)),i=n.lastIndexOf("."),i===-1?n="":n=n.substr(i+1),n}const QG={};function DI(e,t,n){l(t)||(t=e.width),l(n)||(n=e.height);let i=QG[t];l(i)||(i={},QG[t]=i);let o=i[n];if(!l(o)){const r=document.createElement("canvas");r.width=t,r.height=n,o=r.getContext("2d"),o.globalCompositeOperation="copy",i[n]=o}return o.drawImage(e,0,0,t,n),o.getImageData(0,0,t,n).data}const OSe=/^blob:/i;function dK(e){return E.typeOf.string("uri",e),OSe.test(e)}let Yf;function hK(e){l(Yf)||(Yf=document.createElement("a")),Yf.href=window.location.href;const t=Yf.host,n=Yf.protocol;return Yf.href=e,Yf.href=Yf.href,n!==Yf.protocol||t!==Yf.host}const LSe=/^data:/i;function z3(e){return E.typeOf.string("uri",e),LSe.test(e)}function BSe(e){const t=document.createElement("script");return t.async=!0,t.src=e,new Promise((n,i)=>{window.crossOriginIsolated&&t.setAttribute("crossorigin","anonymous");const o=document.getElementsByTagName("head")[0];t.onload=function(){t.onload=void 0,o.removeChild(t),n()},t.onerror=function(r){i(r)},o.appendChild(t)})}function RSe(e){if(!l(e))throw new w("obj is required.");let t="";for(const n in e)if(e.hasOwnProperty(n)){const i=e[n],o=`${encodeURIComponent(n)}=`;if(Array.isArray(i))for(let r=0,s=i.length;r<s;++r)t+=`${o+encodeURIComponent(i[r])}&`;else t+=`${o+encodeURIComponent(i)}&`}return t=t.slice(0,-1),t}function NSe(e){if(!l(e))throw new w("queryString is required.");const t={};if(e==="")return t;const n=e.replace(/\+/g,"%20").split(/[&;]/);for(let i=0,o=n.length;i<o;++i){const r=n[i].split("="),s=decodeURIComponent(r[0]);let a=r[1];l(a)?a=decodeURIComponent(a):a="";const c=t[s];typeof c=="string"?t[s]=[c,a]:Array.isArray(c)?c.push(a):t[s]=a}return t}const MSe={UNISSUED:0,ISSUED:1,ACTIVE:2,RECEIVED:3,CANCELLED:4,FAILED:5},or=Object.freeze(MSe),FSe={TERRAIN:0,IMAGERY:1,TILES3D:2,OTHER:3},xy=Object.freeze(FSe);function Ad(e){e=A(e,A.EMPTY_OBJECT);const t=A(e.throttleByServer,!1),n=A(e.throttle,!1);this.url=e.url,this.requestFunction=e.requestFunction,this.cancelFunction=e.cancelFunction,this.priorityFunction=e.priorityFunction,this.priority=A(e.priority,0),this.throttle=n,this.throttleByServer=t,this.type=A(e.type,xy.OTHER),this.serverKey=void 0,this.state=or.UNISSUED,this.deferred=void 0,this.cancelled=!1}Ad.prototype.cancel=function(){this.cancelled=!0};Ad.prototype.clone=function(e){return l(e)?(e.url=this.url,e.requestFunction=this.requestFunction,e.cancelFunction=this.cancelFunction,e.priorityFunction=this.priorityFunction,e.priority=this.priority,e.throttle=this.throttle,e.throttleByServer=this.throttleByServer,e.type=this.type,e.serverKey=this.serverKey,e.state=this.RequestState.UNISSUED,e.deferred=void 0,e.cancelled=!1,e):new Ad(this)};function zSe(e){const t={};if(!e)return t;const n=e.split(`\r
|
||
`);for(let i=0;i<n.length;++i){const o=n[i],r=o.indexOf(": ");if(r>0){const s=o.substring(0,r),a=o.substring(r+2);t[s]=a}}return t}function JA(e,t,n){this.statusCode=e,this.response=t,this.responseHeaders=n,typeof this.responseHeaders=="string"&&(this.responseHeaders=zSe(this.responseHeaders))}JA.prototype.toString=function(){let e="Request has failed.";return l(this.statusCode)&&(e+=` Status Code: ${this.statusCode}`),e};function lt(){this._listeners=[],this._scopes=[],this._toRemove=[],this._insideRaiseEvent=!1}Object.defineProperties(lt.prototype,{numberOfListeners:{get:function(){return this._listeners.length-this._toRemove.length}}});lt.prototype.addEventListener=function(e,t){E.typeOf.func("listener",e),this._listeners.push(e),this._scopes.push(t);const n=this;return function(){n.removeEventListener(e,t)}};lt.prototype.removeEventListener=function(e,t){E.typeOf.func("listener",e);const n=this._listeners,i=this._scopes;let o=-1;for(let r=0;r<n.length;r++)if(n[r]===e&&i[r]===t){o=r;break}return o!==-1?(this._insideRaiseEvent?(this._toRemove.push(o),n[o]=void 0,i[o]=void 0):(n.splice(o,1),i.splice(o,1)),!0):!1};function USe(e,t){return t-e}lt.prototype.raiseEvent=function(){this._insideRaiseEvent=!0;let e;const t=this._listeners,n=this._scopes;let i=t.length;for(e=0;e<i;e++){const r=t[e];l(r)&&t[e].apply(n[e],arguments)}const o=this._toRemove;if(i=o.length,i>0){for(o.sort(USe),e=0;e<i;e++){const r=o[e];t.splice(r,1),n.splice(r,1)}o.length=0}this._insideRaiseEvent=!1};function wy(e){E.typeOf.object("options",e),E.defined("options.comparator",e.comparator),this._comparator=e.comparator,this._array=[],this._length=0,this._maximumLength=void 0}Object.defineProperties(wy.prototype,{length:{get:function(){return this._length}},internalArray:{get:function(){return this._array}},maximumLength:{get:function(){return this._maximumLength},set:function(e){E.typeOf.number.greaterThanOrEquals("maximumLength",e,0);const t=this._length;if(e<t){const n=this._array;for(let i=e;i<t;++i)n[i]=void 0;this._length=e,n.length=e}this._maximumLength=e}},comparator:{get:function(){return this._comparator}}});function U3(e,t,n){const i=e[t];e[t]=e[n],e[n]=i}wy.prototype.reserve=function(e){e=A(e,this._length),this._array.length=e};wy.prototype.heapify=function(e){e=A(e,0);const t=this._length,n=this._comparator,i=this._array;let o=-1,r=!0;for(;r;){const s=2*(e+1),a=s-1;a<t&&n(i[a],i[e])<0?o=a:o=e,s<t&&n(i[s],i[o])<0&&(o=s),o!==e?(U3(i,o,e),e=o):r=!1}};wy.prototype.resort=function(){const e=this._length;for(let t=Math.ceil(e/2);t>=0;--t)this.heapify(t)};wy.prototype.insert=function(e){E.defined("element",e);const t=this._array,n=this._comparator,i=this._maximumLength;let o=this._length++;for(o<t.length?t[o]=e:t.push(e);o!==0;){const s=Math.floor((o-1)/2);if(n(t[o],t[s])<0)U3(t,o,s),o=s;else break}let r;return l(i)&&this._length>i&&(r=t[i],this._length=i),r};wy.prototype.pop=function(e){if(e=A(e,0),this._length===0)return;E.typeOf.number.lessThan("index",e,this._length);const t=this._array,n=t[e];return U3(t,e,--this._length),this.heapify(e),t[this._length]=void 0,n};function HSe(e,t){return e.priority-t.priority}const Gi={numberOfAttemptedRequests:0,numberOfActiveRequests:0,numberOfCancelledRequests:0,numberOfCancelledActiveRequests:0,numberOfFailedRequests:0,numberOfActiveRequestsEver:0,lastNumberOfActiveRequests:0};let EA=20;const Ra=new wy({comparator:HSe});Ra.maximumLength=EA;Ra.reserve(EA);const sd=[];let Xh={};const VSe=typeof document<"u"?new ha(document.location.href):new ha,q1=new lt;function Ui(){}Ui.maximumRequests=50;Ui.maximumRequestsPerServer=6;Ui.requestsByServer={"api.cesium.com:443":18,"assets.cesium.com:443":18};Ui.throttleRequests=!0;Ui.debugShowStatistics=!1;Ui.requestCompletedEvent=q1;Object.defineProperties(Ui,{statistics:{get:function(){return Gi}},priorityHeapLength:{get:function(){return EA},set:function(e){if(e<EA)for(;Ra.length>e;){const t=Ra.pop();Hg(t)}EA=e,Ra.maximumLength=e,Ra.reserve(e)}}});function pK(e){l(e.priorityFunction)&&(e.priority=e.priorityFunction())}Ui.serverHasOpenSlots=function(e,t){t=A(t,1);const n=A(Ui.requestsByServer[e],Ui.maximumRequestsPerServer);return Xh[e]+t<=n};Ui.heapHasOpenSlots=function(e){return Ra.length+e<=EA};function mK(e){return e.state===or.UNISSUED&&(e.state=or.ISSUED,e.deferred=__()),e.deferred.promise}function kSe(e){return function(t){if(e.state===or.CANCELLED)return;const n=e.deferred;--Gi.numberOfActiveRequests,--Xh[e.serverKey],q1.raiseEvent(),e.state=or.RECEIVED,e.deferred=void 0,n.resolve(t)}}function GSe(e){return function(t){e.state!==or.CANCELLED&&(++Gi.numberOfFailedRequests,--Gi.numberOfActiveRequests,--Xh[e.serverKey],q1.raiseEvent(t),e.state=or.FAILED,e.deferred.reject(t))}}function _K(e){const t=mK(e);return e.state=or.ACTIVE,sd.push(e),++Gi.numberOfActiveRequests,++Gi.numberOfActiveRequestsEver,++Xh[e.serverKey],e.requestFunction().then(kSe(e)).catch(GSe(e)),t}function Hg(e){const t=e.state===or.ACTIVE;if(e.state=or.CANCELLED,++Gi.numberOfCancelledRequests,l(e.deferred)){const n=e.deferred;e.deferred=void 0,n.reject()}t&&(--Gi.numberOfActiveRequests,--Xh[e.serverKey],++Gi.numberOfCancelledActiveRequests),l(e.cancelFunction)&&e.cancelFunction()}Ui.update=function(){let e,t,n=0;const i=sd.length;for(e=0;e<i;++e){if(t=sd[e],t.cancelled&&Hg(t),t.state!==or.ACTIVE){++n;continue}n>0&&(sd[e-n]=t)}sd.length-=n;const o=Ra.internalArray,r=Ra.length;for(e=0;e<r;++e)pK(o[e]);Ra.resort();const s=Math.max(Ui.maximumRequests-sd.length,0);let a=0;for(;a<s&&Ra.length>0;){if(t=Ra.pop(),t.cancelled){Hg(t);continue}if(t.throttleByServer&&!Ui.serverHasOpenSlots(t.serverKey)){Hg(t);continue}_K(t),++a}WSe()};Ui.getServerKey=function(e){E.typeOf.string("url",e);let t=new ha(e);t.scheme()===""&&(t=new ha(e).absoluteTo(VSe),t.normalize());let n=t.authority();/:/.test(n)||(n=`${n}:${t.scheme()==="https"?"443":"80"}`);const i=Xh[n];return l(i)||(Xh[n]=0),n};Ui.request=function(e){if(E.typeOf.object("request",e),E.typeOf.string("request.url",e.url),E.typeOf.func("request.requestFunction",e.requestFunction),z3(e.url)||dK(e.url))return q1.raiseEvent(),e.state=or.RECEIVED,e.requestFunction();if(++Gi.numberOfAttemptedRequests,l(e.serverKey)||(e.serverKey=Ui.getServerKey(e.url)),Ui.throttleRequests&&e.throttleByServer&&!Ui.serverHasOpenSlots(e.serverKey))return;if(!Ui.throttleRequests||!e.throttle)return _K(e);if(sd.length>=Ui.maximumRequests)return;pK(e);const t=Ra.insert(e);if(l(t)){if(t===e)return;Hg(t)}return mK(e)};function WSe(){Ui.debugShowStatistics&&(Gi.numberOfActiveRequests===0&&Gi.lastNumberOfActiveRequests>0&&(Gi.numberOfAttemptedRequests>0&&(console.log(`Number of attempted requests: ${Gi.numberOfAttemptedRequests}`),Gi.numberOfAttemptedRequests=0),Gi.numberOfCancelledRequests>0&&(console.log(`Number of cancelled requests: ${Gi.numberOfCancelledRequests}`),Gi.numberOfCancelledRequests=0),Gi.numberOfCancelledActiveRequests>0&&(console.log(`Number of cancelled active requests: ${Gi.numberOfCancelledActiveRequests}`),Gi.numberOfCancelledActiveRequests=0),Gi.numberOfFailedRequests>0&&(console.log(`Number of failed requests: ${Gi.numberOfFailedRequests}`),Gi.numberOfFailedRequests=0)),Gi.lastNumberOfActiveRequests=Gi.numberOfActiveRequests)}Ui.clearForSpecs=function(){for(;Ra.length>0;){const t=Ra.pop();Hg(t)}const e=sd.length;for(let t=0;t<e;++t)Hg(sd[t]);sd.length=0,Xh={},Gi.numberOfAttemptedRequests=0,Gi.numberOfActiveRequests=0,Gi.numberOfCancelledRequests=0,Gi.numberOfCancelledActiveRequests=0,Gi.numberOfFailedRequests=0,Gi.numberOfActiveRequestsEver=0,Gi.lastNumberOfActiveRequests=0};Ui.numberOfActiveRequestsByServer=function(e){return Xh[e]};Ui.requestHeap=Ra;const px={};let QA={};px.add=function(e,t){if(!l(e))throw new w("host is required.");if(!l(t)||t<=0)throw new w("port is required to be greater than 0.");const n=`${e.toLowerCase()}:${t}`;l(QA[n])||(QA[n]=!0)};px.remove=function(e,t){if(!l(e))throw new w("host is required.");if(!l(t)||t<=0)throw new w("port is required to be greater than 0.");const n=`${e.toLowerCase()}:${t}`;l(QA[n])&&delete QA[n]};function qSe(e){const t=new ha(e);t.normalize();let n=t.authority();if(n.length!==0){if(t.authority(n),n.indexOf("@")!==-1&&(n=n.split("@")[1]),n.indexOf(":")===-1){let i=t.scheme();if(i.length===0&&(i=window.location.protocol,i=i.substring(0,i.length-1)),i==="http")n+=":80";else if(i==="https")n+=":443";else return}return n}}px.contains=function(e){if(!l(e))throw new w("url is required.");const t=qSe(e);return!!(l(t)&&l(QA[t]))};px.clear=function(){QA={}};const gK=px,yK=function(){try{const e=new XMLHttpRequest;return e.open("GET","#",!0),e.responseType="blob",e.responseType==="blob"}catch{return!1}}();function H3(e,t,n,i){const o=e.query();if(o.length===0)return{};let r;if(o.indexOf("=")===-1){const s={};s[o]=void 0,r=s}else r=NSe(o);n?t._queryParameters=II(r,t._queryParameters,i):t._queryParameters=r,e.search("")}function jSe(e,t){const n=t._queryParameters,i=Object.keys(n);i.length===1&&!l(n[i[0]])?e.search(i[0]):e.search(RSe(n))}function fd(e,t){return l(e)?l(e.clone)?e.clone():St(e):t}function V3(e){if(e.state===or.ISSUED||e.state===or.ACTIVE)throw new Fe("The Resource is already being fetched.");e.state=or.UNISSUED,e.deferred=void 0}function II(e,t,n){if(!n)return Ln(e,t);const i=St(e,!0);for(const o in t)if(t.hasOwnProperty(o)){let r=i[o];const s=t[o];l(r)?(Array.isArray(r)||(r=i[o]=[r]),i[o]=r.concat(s)):i[o]=Array.isArray(s)?s.slice():s}return i}function je(e){e=A(e,A.EMPTY_OBJECT),typeof e=="string"&&(e={url:e}),E.typeOf.string("options.url",e.url),this._url=void 0,this._templateValues=fd(e.templateValues,{}),this._queryParameters=fd(e.queryParameters,{}),this.headers=fd(e.headers,{}),this.request=A(e.request,new Ad),this.proxy=e.proxy,this.retryCallback=e.retryCallback,this.retryAttempts=A(e.retryAttempts,0),this._retryCount=0;const t=new ha(e.url);H3(t,this,!0,!0),t.fragment(""),this._url=t.toString()}je.createIfNeeded=function(e){return e instanceof je?e.getDerivedResource({request:e.request}):typeof e!="string"?e:new je({url:e})};let g0;je.supportsImageBitmapOptions=function(){if(l(g0))return g0;if(typeof createImageBitmap!="function")return g0=Promise.resolve(!1),g0;const e="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAABGdBTUEAAE4g3rEiDgAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAADElEQVQI12Ng6GAAAAEUAIngE3ZiAAAAAElFTkSuQmCC";return g0=je.fetchBlob({url:e}).then(function(t){const n={imageOrientation:"flipY",premultiplyAlpha:"none",colorSpaceConversion:"none"};return Promise.all([createImageBitmap(t,n),createImageBitmap(t)])}).then(function(t){const n=DI(t[0]),i=DI(t[1]);return n[1]!==i[1]}).catch(function(){return!1}),g0};Object.defineProperties(je,{isBlobSupported:{get:function(){return yK}}});Object.defineProperties(je.prototype,{queryParameters:{get:function(){return this._queryParameters}},templateValues:{get:function(){return this._templateValues}},url:{get:function(){return this.getUrlComponent(!0,!0)},set:function(e){const t=new ha(e);H3(t,this,!1),t.fragment(""),this._url=t.toString()}},extension:{get:function(){return PSe(this._url)}},isDataUri:{get:function(){return z3(this._url)}},isBlobUri:{get:function(){return dK(this._url)}},isCrossOriginUrl:{get:function(){return hK(this._url)}},hasHeaders:{get:function(){return Object.keys(this.headers).length>0}}});je.prototype.toString=function(){return this.getUrlComponent(!0,!0)};je.prototype.getUrlComponent=function(e,t){if(this.isDataUri)return this._url;const n=new ha(this._url);e&&jSe(n,this);let i=n.toString().replace(/%7B/g,"{").replace(/%7D/g,"}");const o=this._templateValues;return i=i.replace(/{(.*?)}/g,function(r,s){const a=o[s];return l(a)?encodeURIComponent(a):r}),t&&l(this.proxy)&&(i=this.proxy.getURL(i)),i};je.prototype.setQueryParameters=function(e,t){t?this._queryParameters=II(this._queryParameters,e,!1):this._queryParameters=II(e,this._queryParameters,!1)};je.prototype.appendQueryParameters=function(e){this._queryParameters=II(e,this._queryParameters,!0)};je.prototype.setTemplateValues=function(e,t){t?this._templateValues=Ln(this._templateValues,e):this._templateValues=Ln(e,this._templateValues)};je.prototype.getDerivedResource=function(e){const t=this.clone();if(t._retryCount=0,l(e.url)){const n=new ha(e.url),i=A(e.preserveQueryParameters,!1);H3(n,t,!0,i),n.fragment(""),n.scheme()!==""?t._url=n.toString():t._url=n.absoluteTo(new ha(hx(this._url))).toString()}return l(e.queryParameters)&&(t._queryParameters=Ln(e.queryParameters,t._queryParameters)),l(e.templateValues)&&(t._templateValues=Ln(e.templateValues,t.templateValues)),l(e.headers)&&(t.headers=Ln(e.headers,t.headers)),l(e.proxy)&&(t.proxy=e.proxy),l(e.request)&&(t.request=e.request),l(e.retryCallback)&&(t.retryCallback=e.retryCallback),l(e.retryAttempts)&&(t.retryAttempts=e.retryAttempts),t};je.prototype.retryOnError=function(e){const t=this.retryCallback;if(typeof t!="function"||this._retryCount>=this.retryAttempts)return Promise.resolve(!1);const n=this;return Promise.resolve(t(this,e)).then(function(i){return++n._retryCount,i})};je.prototype.clone=function(e){return l(e)||(e=new je({url:this._url})),e._url=this._url,e._queryParameters=St(this._queryParameters),e._templateValues=St(this._templateValues),e.headers=St(this.headers),e.proxy=this.proxy,e.retryCallback=this.retryCallback,e.retryAttempts=this.retryAttempts,e._retryCount=0,e.request=this.request.clone(),e};je.prototype.getBaseUri=function(e){return ISe(this.getUrlComponent(e),e)};je.prototype.appendForwardSlash=function(){this._url=DSe(this._url)};je.prototype.fetchArrayBuffer=function(){return this.fetch({responseType:"arraybuffer"})};je.fetchArrayBuffer=function(e){return new je(e).fetchArrayBuffer()};je.prototype.fetchBlob=function(){return this.fetch({responseType:"blob"})};je.fetchBlob=function(e){return new je(e).fetchBlob()};je.prototype.fetchImage=function(e){e=A(e,A.EMPTY_OBJECT);const t=A(e.preferImageBitmap,!1),n=A(e.preferBlob,!1),i=A(e.flipY,!1),o=A(e.skipColorSpaceConversion,!1);if(V3(this.request),!yK||this.isDataUri||this.isBlobUri||!this.hasHeaders&&!n)return HM({resource:this,flipY:i,skipColorSpaceConversion:o,preferImageBitmap:t});const r=this.fetchBlob();if(!l(r))return;let s,a,c,u;return je.supportsImageBitmapOptions().then(function(f){return s=f,a=s&&t,r}).then(function(f){if(!l(f))return;if(u=f,a)return je.createImageBitmapFromBlob(f,{flipY:i,premultiplyAlpha:!1,skipColorSpaceConversion:o});const h=window.URL.createObjectURL(f);return c=new je({url:h}),HM({resource:c,flipY:i,skipColorSpaceConversion:o,preferImageBitmap:!1})}).then(function(f){if(l(f))return f.blob=u,a||window.URL.revokeObjectURL(c.url),f}).catch(function(f){return l(c)&&window.URL.revokeObjectURL(c.url),f.blob=u,Promise.reject(f)})};function HM(e){const t=e.resource,n=e.flipY,i=e.skipColorSpaceConversion,o=e.preferImageBitmap,r=t.request;r.url=t.url,r.requestFunction=function(){let a=!1;!t.isDataUri&&!t.isBlobUri&&(a=t.isCrossOriginUrl);const c=__();return je._Implementations.createImage(r,a,c,n,i,o),c.promise};const s=Ui.request(r);if(l(s))return s.catch(function(a){return r.state!==or.FAILED?Promise.reject(a):t.retryOnError(a).then(function(c){return c?(r.state=or.UNISSUED,r.deferred=void 0,HM({resource:t,flipY:n,skipColorSpaceConversion:i,preferImageBitmap:o})):Promise.reject(a)})})}je.fetchImage=function(e){return new je(e).fetchImage({flipY:e.flipY,skipColorSpaceConversion:e.skipColorSpaceConversion,preferBlob:e.preferBlob,preferImageBitmap:e.preferImageBitmap})};je.prototype.fetchText=function(){return this.fetch({responseType:"text"})};je.fetchText=function(e){return new je(e).fetchText()};je.prototype.fetchJson=function(){const e=this.fetch({responseType:"text",headers:{Accept:"application/json,*/*;q=0.01"}});if(l(e))return e.then(function(t){if(l(t))return JSON.parse(t)})};je.fetchJson=function(e){return new je(e).fetchJson()};je.prototype.fetchXML=function(){return this.fetch({responseType:"document",overrideMimeType:"text/xml"})};je.fetchXML=function(e){return new je(e).fetchXML()};je.prototype.fetchJsonp=function(e){e=A(e,"callback"),V3(this.request);let t;do t=`loadJsonp${F.nextRandomNumber().toString().substring(2,8)}`;while(l(window[t]));return AK(this,e,t)};function AK(e,t,n){const i={};i[t]=n,e.setQueryParameters(i);const o=e.request;o.url=e.url,o.requestFunction=function(){const s=__();return window[n]=function(a){s.resolve(a);try{delete window[n]}catch{window[n]=void 0}},je._Implementations.loadAndExecuteScript(e.url,n,s),s.promise};const r=Ui.request(o);if(l(r))return r.catch(function(s){return o.state!==or.FAILED?Promise.reject(s):e.retryOnError(s).then(function(a){return a?(o.state=or.UNISSUED,o.deferred=void 0,AK(e,t,n)):Promise.reject(s)})})}je.fetchJsonp=function(e){return new je(e).fetchJsonp(e.callbackParameterName)};je.prototype._makeRequest=function(e){const t=this;V3(t.request);const n=t.request;n.url=t.url,n.requestFunction=function(){const o=e.responseType,r=Ln(e.headers,t.headers),s=e.overrideMimeType,a=e.method,c=e.data,u=__(),f=je._Implementations.loadWithXhr(t.url,o,a,c,r,u,s);return l(f)&&l(f.abort)&&(n.cancelFunction=function(){f.abort()}),u.promise};const i=Ui.request(n);if(l(i))return i.then(function(o){return n.cancelFunction=void 0,o}).catch(function(o){return n.cancelFunction=void 0,n.state!==or.FAILED?Promise.reject(o):t.retryOnError(o).then(function(r){return r?(n.state=or.UNISSUED,n.deferred=void 0,t.fetch(e)):Promise.reject(o)})})};const YSe=/^data:(.*?)(;base64)?,(.*)$/;function TD(e,t){const n=decodeURIComponent(t);return e?atob(n):n}function ZG(e,t){const n=TD(e,t),i=new ArrayBuffer(n.length),o=new Uint8Array(i);for(let r=0;r<n.length;r++)o[r]=n.charCodeAt(r);return i}function $Se(e,t){t=A(t,"");const n=e[1],i=!!e[2],o=e[3];let r,s;switch(t){case"":case"text":return TD(i,o);case"arraybuffer":return ZG(i,o);case"blob":return r=ZG(i,o),new Blob([r],{type:n});case"document":return s=new DOMParser,s.parseFromString(TD(i,o),n);case"json":return JSON.parse(TD(i,o));default:throw new w(`Unhandled responseType: ${t}`)}}je.prototype.fetch=function(e){return e=fd(e,{}),e.method="GET",this._makeRequest(e)};je.fetch=function(e){return new je(e).fetch({responseType:e.responseType,overrideMimeType:e.overrideMimeType})};je.prototype.delete=function(e){return e=fd(e,{}),e.method="DELETE",this._makeRequest(e)};je.delete=function(e){return new je(e).delete({responseType:e.responseType,overrideMimeType:e.overrideMimeType,data:e.data})};je.prototype.head=function(e){return e=fd(e,{}),e.method="HEAD",this._makeRequest(e)};je.head=function(e){return new je(e).head({responseType:e.responseType,overrideMimeType:e.overrideMimeType})};je.prototype.options=function(e){return e=fd(e,{}),e.method="OPTIONS",this._makeRequest(e)};je.options=function(e){return new je(e).options({responseType:e.responseType,overrideMimeType:e.overrideMimeType})};je.prototype.post=function(e,t){return E.defined("data",e),t=fd(t,{}),t.method="POST",t.data=e,this._makeRequest(t)};je.post=function(e){return new je(e).post(e.data,{responseType:e.responseType,overrideMimeType:e.overrideMimeType})};je.prototype.put=function(e,t){return E.defined("data",e),t=fd(t,{}),t.method="PUT",t.data=e,this._makeRequest(t)};je.put=function(e){return new je(e).put(e.data,{responseType:e.responseType,overrideMimeType:e.overrideMimeType})};je.prototype.patch=function(e,t){return E.defined("data",e),t=fd(t,{}),t.method="PATCH",t.data=e,this._makeRequest(t)};je.patch=function(e){return new je(e).patch(e.data,{responseType:e.responseType,overrideMimeType:e.overrideMimeType})};je._Implementations={};je._Implementations.loadImageElement=function(e,t,n){const i=new Image;i.onload=function(){i.naturalWidth===0&&i.naturalHeight===0&&i.width===0&&i.height===0&&(i.width=300,i.height=150),n.resolve(i)},i.onerror=function(o){n.reject(o)},t&&(gK.contains(e)?i.crossOrigin="use-credentials":i.crossOrigin=""),i.src=e};je._Implementations.createImage=function(e,t,n,i,o,r){const s=e.url;je.supportsImageBitmapOptions().then(function(a){if(!(a&&r)){je._Implementations.loadImageElement(s,t,n);return}const c="blob",u="GET",f=__(),h=je._Implementations.loadWithXhr(s,c,u,void 0,void 0,f,void 0,void 0,void 0);return l(h)&&l(h.abort)&&(e.cancelFunction=function(){h.abort()}),f.promise.then(function(_){if(!l(_)){n.reject(new Fe(`Successfully retrieved ${s} but it contained no content.`));return}return je.createImageBitmapFromBlob(_,{flipY:i,premultiplyAlpha:!1,skipColorSpaceConversion:o})}).then(function(_){n.resolve(_)})}).catch(function(a){n.reject(a)})};je.createImageBitmapFromBlob=function(e,t){return E.defined("options",t),E.typeOf.bool("options.flipY",t.flipY),E.typeOf.bool("options.premultiplyAlpha",t.premultiplyAlpha),E.typeOf.bool("options.skipColorSpaceConversion",t.skipColorSpaceConversion),createImageBitmap(e,{imageOrientation:t.flipY?"flipY":"none",premultiplyAlpha:t.premultiplyAlpha?"premultiply":"none",colorSpaceConversion:t.skipColorSpaceConversion?"none":"default"})};function e5(e,t){switch(t){case"text":return e.toString("utf8");case"json":return JSON.parse(e.toString("utf8"));default:return new Uint8Array(e).buffer}}function XSe(e,t,n,i,o,r,s){let a,c;Promise.all([ES(()=>import("./__vite-browser-external-b25bb000.js"),[]),ES(()=>import("./__vite-browser-external-b25bb000.js"),[])]).then(([u,f])=>(a=u.parse(e),c=f,a.protocol==="https:"?ES(()=>import("./__vite-browser-external-b25bb000.js"),[]):ES(()=>import("./__vite-browser-external-b25bb000.js"),[]))).then(u=>{const f={protocol:a.protocol,hostname:a.hostname,port:a.port,path:a.path,query:a.query,method:n,headers:o};u.request(f).on("response",function(h){if(h.statusCode<200||h.statusCode>=300){r.reject(new JA(h.statusCode,h,h.headers));return}const _=[];h.on("data",function(g){_.push(g)}),h.on("end",function(){const g=Buffer.concat(_);h.headers["content-encoding"]==="gzip"?c.gunzip(g,function(p,y){p?r.reject(new Fe("Error decompressing response.")):r.resolve(e5(y,t))}):r.resolve(e5(g,t))})}).on("error",function(h){r.reject(new JA)}).end()})}const KSe=typeof XMLHttpRequest>"u";je._Implementations.loadWithXhr=function(e,t,n,i,o,r,s){const a=YSe.exec(e);if(a!==null){r.resolve($Se(a,t));return}if(KSe){XSe(e,t,n,i,o,r);return}const c=new XMLHttpRequest;if(gK.contains(e)&&(c.withCredentials=!0),c.open(n,e,!0),l(s)&&l(c.overrideMimeType)&&c.overrideMimeType(s),l(o))for(const f in o)o.hasOwnProperty(f)&&c.setRequestHeader(f,o[f]);l(t)&&(c.responseType=t);let u=!1;return typeof e=="string"&&(u=e.indexOf("file://")===0||typeof window<"u"&&window.location.origin==="file://"),c.onload=function(){if((c.status<200||c.status>=300)&&!(u&&c.status===0)){r.reject(new JA(c.status,c.response,c.getAllResponseHeaders()));return}const f=c.response,h=c.responseType;if(n==="HEAD"||n==="OPTIONS"){const g=c.getAllResponseHeaders().trim().split(/[\r\n]+/),p={};g.forEach(function(y){const T=y.split(": "),b=T.shift();p[b]=T.join(": ")}),r.resolve(p);return}if(c.status===204)r.resolve();else if(l(f)&&(!l(t)||h===t))r.resolve(f);else if(t==="json"&&typeof f=="string")try{r.resolve(JSON.parse(f))}catch(_){r.reject(_)}else(h===""||h==="document")&&l(c.responseXML)&&c.responseXML.hasChildNodes()?r.resolve(c.responseXML):(h===""||h==="text")&&l(c.responseText)?r.resolve(c.responseText):r.reject(new Fe("Invalid XMLHttpRequest response type."))},c.onerror=function(f){r.reject(new JA)},c.send(i),c};je._Implementations.loadAndExecuteScript=function(e,t,n){return BSe(e).catch(function(i){n.reject(i)})};je._DefaultImplementations={};je._DefaultImplementations.createImage=je._Implementations.createImage;je._DefaultImplementations.loadWithXhr=je._Implementations.loadWithXhr;je._DefaultImplementations.loadAndExecuteScript=je._Implementations.loadAndExecuteScript;je.DEFAULT=Object.freeze(new je({url:typeof document>"u"?"":document.location.href.split("?")[0]}));function TE(e){e=A(e,A.EMPTY_OBJECT),this._dates=void 0,this._samples=void 0,this._dateColumn=-1,this._xPoleWanderRadiansColumn=-1,this._yPoleWanderRadiansColumn=-1,this._ut1MinusUtcSecondsColumn=-1,this._xCelestialPoleOffsetRadiansColumn=-1,this._yCelestialPoleOffsetRadiansColumn=-1,this._taiMinusUtcSecondsColumn=-1,this._columnCount=0,this._lastIndex=-1,this._addNewLeapSeconds=A(e.addNewLeapSeconds,!0),l(e.data)?t5(this,e.data):t5(this,{columnNames:["dateIso8601","modifiedJulianDateUtc","xPoleWanderRadians","yPoleWanderRadians","ut1MinusUtcSeconds","lengthOfDayCorrectionSeconds","xCelestialPoleOffsetRadians","yCelestialPoleOffsetRadians","taiMinusUtcSeconds"],samples:[]})}TE.fromUrl=async function(e,t){E.defined("url",e),t=A(t,A.EMPTY_OBJECT);const n=je.createIfNeeded(e);let i;try{i=await n.fetchJson()}catch{throw new Fe(`An error occurred while retrieving the EOP data from the URL ${n.url}.`)}return new TE({addNewLeapSeconds:t.addNewLeapSeconds,data:i})};TE.NONE=Object.freeze({compute:function(e,t){return l(t)?(t.xPoleWander=0,t.yPoleWander=0,t.xPoleOffset=0,t.yPoleOffset=0,t.ut1MinusUtc=0):t=new R3(0,0,0,0,0),t}});TE.prototype.compute=function(e,t){if(!l(this._samples))return;if(l(t)||(t=new R3(0,0,0,0,0)),this._samples.length===0)return t.xPoleWander=0,t.yPoleWander=0,t.xPoleOffset=0,t.yPoleOffset=0,t.ut1MinusUtc=0,t;const n=this._dates,i=this._lastIndex;let o=0,r=0;if(l(i)){const a=n[i],c=n[i+1],u=ce.lessThanOrEquals(a,e),f=!l(c),h=f||ce.greaterThanOrEquals(c,e);if(u&&h)return o=i,!f&&c.equals(e)&&++o,r=o+1,i5(this,n,this._samples,e,o,r,t),t}let s=da(n,e,ce.compare,this._dateColumn);return s>=0?(s<n.length-1&&n[s+1].equals(e)&&++s,o=s,r=s):(r=~s,o=r-1,o<0&&(o=0)),this._lastIndex=o,i5(this,n,this._samples,e,o,r,t),t};function JSe(e,t){return ce.compare(e.julianDate,t)}function t5(e,t){if(!l(t.columnNames))throw new Fe("Error in loaded EOP data: The columnNames property is required.");if(!l(t.samples))throw new Fe("Error in loaded EOP data: The samples property is required.");const n=t.columnNames.indexOf("modifiedJulianDateUtc"),i=t.columnNames.indexOf("xPoleWanderRadians"),o=t.columnNames.indexOf("yPoleWanderRadians"),r=t.columnNames.indexOf("ut1MinusUtcSeconds"),s=t.columnNames.indexOf("xCelestialPoleOffsetRadians"),a=t.columnNames.indexOf("yCelestialPoleOffsetRadians"),c=t.columnNames.indexOf("taiMinusUtcSeconds");if(n<0||i<0||o<0||r<0||s<0||a<0||c<0)throw new Fe("Error in loaded EOP data: The columnNames property must include modifiedJulianDateUtc, xPoleWanderRadians, yPoleWanderRadians, ut1MinusUtcSeconds, xCelestialPoleOffsetRadians, yCelestialPoleOffsetRadians, and taiMinusUtcSeconds columns");const u=e._samples=t.samples,f=e._dates=[];e._dateColumn=n,e._xPoleWanderRadiansColumn=i,e._yPoleWanderRadiansColumn=o,e._ut1MinusUtcSecondsColumn=r,e._xCelestialPoleOffsetRadiansColumn=s,e._yCelestialPoleOffsetRadiansColumn=a,e._taiMinusUtcSecondsColumn=c,e._columnCount=t.columnNames.length,e._lastIndex=void 0;let h;const _=e._addNewLeapSeconds;for(let g=0,p=u.length;g<p;g+=e._columnCount){const y=u[g+n],T=u[g+c],b=y+to.MODIFIED_JULIAN_DATE_DIFFERENCE,x=new ce(b,T,di.TAI);if(f.push(x),_){if(T!==h&&l(h)){const v=ce.leapSeconds,D=da(v,x,JSe);if(D<0){const L=new po(x,T);v.splice(~D,0,L)}}h=T}}}function n5(e,t,n,i,o){const r=n*i;o.xPoleWander=t[r+e._xPoleWanderRadiansColumn],o.yPoleWander=t[r+e._yPoleWanderRadiansColumn],o.xPoleOffset=t[r+e._xCelestialPoleOffsetRadiansColumn],o.yPoleOffset=t[r+e._yCelestialPoleOffsetRadiansColumn],o.ut1MinusUtc=t[r+e._ut1MinusUtcSecondsColumn]}function gC(e,t,n){return t+e*(n-t)}function i5(e,t,n,i,o,r,s){const a=e._columnCount;if(r>t.length-1)return s.xPoleWander=0,s.yPoleWander=0,s.xPoleOffset=0,s.yPoleOffset=0,s.ut1MinusUtc=0,s;const c=t[o],u=t[r];if(c.equals(u)||i.equals(c))return n5(e,n,o,a,s),s;if(i.equals(u))return n5(e,n,r,a,s),s;const f=ce.secondsDifference(i,c)/ce.secondsDifference(u,c),h=o*a,_=r*a;let g=n[h+e._ut1MinusUtcSecondsColumn],p=n[_+e._ut1MinusUtcSecondsColumn];const y=p-g;if(y>.5||y<-.5){const T=n[h+e._taiMinusUtcSecondsColumn],b=n[_+e._taiMinusUtcSecondsColumn];T!==b&&(u.equals(i)?g=p:p-=b-T)}return s.xPoleWander=gC(f,n[h+e._xPoleWanderRadiansColumn],n[_+e._xPoleWanderRadiansColumn]),s.yPoleWander=gC(f,n[h+e._yPoleWanderRadiansColumn],n[_+e._yPoleWanderRadiansColumn]),s.xPoleOffset=gC(f,n[h+e._xCelestialPoleOffsetRadiansColumn],n[_+e._xCelestialPoleOffsetRadiansColumn]),s.yPoleOffset=gC(f,n[h+e._yCelestialPoleOffsetRadiansColumn],n[_+e._yCelestialPoleOffsetRadiansColumn]),s.ut1MinusUtc=gC(f,g,p),s}function Is(e,t,n){this.heading=A(e,0),this.pitch=A(t,0),this.roll=A(n,0)}Is.fromQuaternion=function(e,t){if(!l(e))throw new w("quaternion is required");l(t)||(t=new Is);const n=2*(e.w*e.y-e.z*e.x),i=1-2*(e.x*e.x+e.y*e.y),o=2*(e.w*e.x+e.y*e.z),r=1-2*(e.y*e.y+e.z*e.z),s=2*(e.w*e.z+e.x*e.y);return t.heading=-Math.atan2(s,r),t.roll=Math.atan2(o,i),t.pitch=-F.asinClamped(n),t};Is.fromDegrees=function(e,t,n,i){if(!l(e))throw new w("heading is required");if(!l(t))throw new w("pitch is required");if(!l(n))throw new w("roll is required");return l(i)||(i=new Is),i.heading=e*F.RADIANS_PER_DEGREE,i.pitch=t*F.RADIANS_PER_DEGREE,i.roll=n*F.RADIANS_PER_DEGREE,i};Is.clone=function(e,t){if(l(e))return l(t)?(t.heading=e.heading,t.pitch=e.pitch,t.roll=e.roll,t):new Is(e.heading,e.pitch,e.roll)};Is.equals=function(e,t){return e===t||l(e)&&l(t)&&e.heading===t.heading&&e.pitch===t.pitch&&e.roll===t.roll};Is.equalsEpsilon=function(e,t,n,i){return e===t||l(e)&&l(t)&&F.equalsEpsilon(e.heading,t.heading,n,i)&&F.equalsEpsilon(e.pitch,t.pitch,n,i)&&F.equalsEpsilon(e.roll,t.roll,n,i)};Is.prototype.clone=function(e){return Is.clone(this,e)};Is.prototype.equals=function(e){return Is.equals(this,e)};Is.prototype.equalsEpsilon=function(e,t,n){return Is.equalsEpsilon(this,e,t,n)};Is.prototype.toString=function(){return`(${this.heading}, ${this.pitch}, ${this.roll})`};const TK=/((?:.*\/)|^)Cesium\.js(?:\?|\#|$)/;function QSe(){const e=document.getElementsByTagName("script");for(let t=0,n=e.length;t<n;++t){const i=e[t].getAttribute("src"),o=TK.exec(i);if(o!==null)return o[1]}}let y0;function CK(e){return typeof document>"u"?e:(l(y0)||(y0=document.createElement("a")),y0.href=e,y0.href=y0.href,y0.href)}let wg;function bK(){if(l(wg))return wg;let e;if(typeof CESIUM_BASE_URL<"u"?e=CESIUM_BASE_URL:typeof define=="object"&&l(define.amd)&&!define.amd.toUrlUndefined&&l(require.toUrl)?e=hx("..",Un("Core/buildModuleUrl.js")):e=QSe(),!l(e))throw new w("Unable to determine Cesium base URL automatically, try defining a global variable called CESIUM_BASE_URL.");return wg=new je({url:CK(e)}),wg.appendForwardSlash(),wg}function ZSe(e){return CK(require.toUrl(`../${e}`))}function EK(e){return bK().getDerivedResource({url:e}).url}let xS;function Un(e){return l(xS)||(typeof define=="object"&&l(define.amd)&&!define.amd.toUrlUndefined&&l(require.toUrl)?xS=ZSe:xS=EK),xS(e)}Un._cesiumScriptRegex=TK;Un._buildModuleUrlFromBaseUrl=EK;Un._clearBaseResource=function(){wg=void 0};Un.setBaseUrl=function(e){wg=je.DEFAULT.getDerivedResource({url:e})};Un.getCesiumBaseUrl=bK;function xK(e,t,n){this.x=e,this.y=t,this.s=n}function k3(e){e=A(e,A.EMPTY_OBJECT),this._xysFileUrlTemplate=je.createIfNeeded(e.xysFileUrlTemplate),this._interpolationOrder=A(e.interpolationOrder,9),this._sampleZeroJulianEphemerisDate=A(e.sampleZeroJulianEphemerisDate,24423965e-1),this._sampleZeroDateTT=new ce(this._sampleZeroJulianEphemerisDate,0,di.TAI),this._stepSizeDays=A(e.stepSizeDays,1),this._samplesPerXysFile=A(e.samplesPerXysFile,1e3),this._totalSamples=A(e.totalSamples,27426),this._samples=new Array(this._totalSamples*3),this._chunkDownloadsInProgress=[];const t=this._interpolationOrder,n=this._denominators=new Array(t+1),i=this._xTable=new Array(t+1),o=Math.pow(this._stepSizeDays,t);for(let r=0;r<=t;++r){n[r]=o,i[r]=r*this._stepSizeDays;for(let s=0;s<=t;++s)s!==r&&(n[r]*=r-s);n[r]=1/n[r]}this._work=new Array(t+1),this._coef=new Array(t+1)}const eve=new ce(0,0,di.TAI);function VM(e,t,n){const i=eve;return i.dayNumber=t,i.secondsOfDay=n,ce.daysDifference(i,e._sampleZeroDateTT)}k3.prototype.preload=function(e,t,n,i){const o=VM(this,e,t),r=VM(this,n,i);let s=o/this._stepSizeDays-this._interpolationOrder/2|0;s<0&&(s=0);let a=r/this._stepSizeDays-this._interpolationOrder/2|0+this._interpolationOrder;a>=this._totalSamples&&(a=this._totalSamples-1);const c=s/this._samplesPerXysFile|0,u=a/this._samplesPerXysFile|0,f=[];for(let h=c;h<=u;++h)f.push(kM(this,h));return Promise.all(f)};k3.prototype.computeXysRadians=function(e,t,n){const i=VM(this,e,t);if(i<0)return;const o=i/this._stepSizeDays|0;if(o>=this._totalSamples)return;const r=this._interpolationOrder;let s=o-(r/2|0);s<0&&(s=0);let a=s+r;a>=this._totalSamples&&(a=this._totalSamples-1,s=a-r,s<0&&(s=0));let c=!1;const u=this._samples;if(l(u[s*3])||(kM(this,s/this._samplesPerXysFile|0),c=!0),l(u[a*3])||(kM(this,a/this._samplesPerXysFile|0),c=!0),c)return;l(n)?(n.x=0,n.y=0,n.s=0):n=new xK(0,0,0);const f=i-s*this._stepSizeDays,h=this._work,_=this._denominators,g=this._coef,p=this._xTable;let y,T;for(y=0;y<=r;++y)h[y]=f-p[y];for(y=0;y<=r;++y){for(g[y]=1,T=0;T<=r;++T)T!==y&&(g[y]*=h[T]);g[y]*=_[y];let b=(s+y)*3;n.x+=g[y]*u[b++],n.y+=g[y]*u[b++],n.s+=g[y]*u[b]}return n};function kM(e,t){if(e._chunkDownloadsInProgress[t])return e._chunkDownloadsInProgress[t];let n;const i=e._xysFileUrlTemplate;l(i)?n=i.getDerivedResource({templateValues:{0:t}}):n=new je({url:Un(`Assets/IAU2006_XYS/IAU2006_XYS_${t}.json`)});const o=n.fetchJson().then(function(r){e._chunkDownloadsInProgress[t]=!1;const s=e._samples,a=r.samples,c=t*e._samplesPerXysFile*3;for(let u=0,f=a.length;u<f;++u)s[c+u]=a[u]});return e._chunkDownloadsInProgress[t]=o,o}const Hi={},WL={up:{south:"east",north:"west",west:"south",east:"north"},down:{south:"west",north:"east",west:"north",east:"south"},south:{up:"west",down:"east",west:"down",east:"up"},north:{up:"east",down:"west",west:"up",east:"down"},west:{up:"north",down:"south",north:"down",south:"up"},east:{up:"south",down:"north",north:"up",south:"down"}},A0={north:[-1,0,0],east:[0,1,0],up:[0,0,1],south:[1,0,0],west:[0,-1,0],down:[0,0,-1]},qL={},Dc={east:new d,north:new d,up:new d,west:new d,south:new d,down:new d};let qp=new d,jp=new d,Yp=new d;Hi.localFrameToFixedFrameGenerator=function(e,t){if(!WL.hasOwnProperty(e)||!WL[e].hasOwnProperty(t))throw new w("firstAxis and secondAxis must be east, north, up, west, south or down.");const n=WL[e][t];let i;const o=e+t;return l(qL[o])?i=qL[o]:(i=function(r,s,a){if(!l(r))throw new w("origin is required.");if(l(a)||(a=new N),d.equalsEpsilon(r,d.ZERO,F.EPSILON14))d.unpack(A0[e],0,qp),d.unpack(A0[t],0,jp),d.unpack(A0[n],0,Yp);else if(F.equalsEpsilon(r.x,0,F.EPSILON14)&&F.equalsEpsilon(r.y,0,F.EPSILON14)){const c=F.sign(r.z);d.unpack(A0[e],0,qp),e!=="east"&&e!=="west"&&d.multiplyByScalar(qp,c,qp),d.unpack(A0[t],0,jp),t!=="east"&&t!=="west"&&d.multiplyByScalar(jp,c,jp),d.unpack(A0[n],0,Yp),n!=="east"&&n!=="west"&&d.multiplyByScalar(Yp,c,Yp)}else{s=A(s,be.WGS84),s.geodeticSurfaceNormal(r,Dc.up);const c=Dc.up,u=Dc.east;u.x=-r.y,u.y=r.x,u.z=0,d.normalize(u,Dc.east),d.cross(c,u,Dc.north),d.multiplyByScalar(Dc.up,-1,Dc.down),d.multiplyByScalar(Dc.east,-1,Dc.west),d.multiplyByScalar(Dc.north,-1,Dc.south),qp=Dc[e],jp=Dc[t],Yp=Dc[n]}return a[0]=qp.x,a[1]=qp.y,a[2]=qp.z,a[3]=0,a[4]=jp.x,a[5]=jp.y,a[6]=jp.z,a[7]=0,a[8]=Yp.x,a[9]=Yp.y,a[10]=Yp.z,a[11]=0,a[12]=r.x,a[13]=r.y,a[14]=r.z,a[15]=1,a},qL[o]=i),i};Hi.eastNorthUpToFixedFrame=Hi.localFrameToFixedFrameGenerator("east","north");Hi.northEastDownToFixedFrame=Hi.localFrameToFixedFrameGenerator("north","east");Hi.northUpEastToFixedFrame=Hi.localFrameToFixedFrameGenerator("north","up");Hi.northWestUpToFixedFrame=Hi.localFrameToFixedFrameGenerator("north","west");const tve=new De,nve=new d(1,1,1),ive=new N;Hi.headingPitchRollToFixedFrame=function(e,t,n,i,o){E.typeOf.object("HeadingPitchRoll",t),i=A(i,Hi.eastNorthUpToFixedFrame);const r=De.fromHeadingPitchRoll(t,tve),s=N.fromTranslationQuaternionRotationScale(d.ZERO,r,nve,ive);return o=i(e,n,o),N.multiply(o,s,o)};const ove=new N,rve=new te;Hi.headingPitchRollQuaternion=function(e,t,n,i,o){E.typeOf.object("HeadingPitchRoll",t);const r=Hi.headingPitchRollToFixedFrame(e,t,n,i,ove),s=N.getMatrix3(r,rve);return De.fromRotationMatrix(s,o)};const sve=new d(1,1,1),ave=new d,o5=new N,cve=new N,lve=new te,uve=new De;Hi.fixedFrameToHeadingPitchRoll=function(e,t,n,i){E.defined("transform",e),t=A(t,be.WGS84),n=A(n,Hi.eastNorthUpToFixedFrame),l(i)||(i=new Is);const o=N.getTranslation(e,ave);if(d.equals(o,d.ZERO))return i.heading=0,i.pitch=0,i.roll=0,i;let r=N.inverseTransformation(n(o,t,o5),o5),s=N.setScale(e,sve,cve);s=N.setTranslation(s,d.ZERO,s),r=N.multiply(r,s,r);let a=De.fromRotationMatrix(N.getMatrix3(r,lve),uve);return a=De.normalize(a,a),Is.fromQuaternion(a,i)};const fve=6*3600+41*60+50.54841,dve=8640184812866e-6,hve=.093104,pve=-62e-7,mve=11772758384668e-32,_ve=72921158553e-15,gve=F.TWO_PI/86400;let wS=new ce;Hi.computeTemeToPseudoFixedMatrix=function(e,t){if(!l(e))throw new w("date is required.");wS=ce.addSeconds(e,-ce.computeTaiMinusUtc(e),wS);const n=wS.dayNumber,i=wS.secondsOfDay;let o;const r=n-2451545;i>=43200?o=(r+.5)/to.DAYS_PER_JULIAN_CENTURY:o=(r-.5)/to.DAYS_PER_JULIAN_CENTURY;const a=(fve+o*(dve+o*(hve+o*pve)))*gve%F.TWO_PI,c=_ve+mve*(n-24515455e-1),u=(i+to.SECONDS_PER_DAY*.5)%to.SECONDS_PER_DAY,f=a+c*u,h=Math.cos(f),_=Math.sin(f);return l(t)?(t[0]=h,t[1]=-_,t[2]=0,t[3]=_,t[4]=h,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t):new te(h,_,0,-_,h,0,0,0,1)};Hi.iau2006XysData=new k3;Hi.earthOrientationParameters=TE.NONE;const GM=32.184,yve=2451545;Hi.preloadIcrfFixed=function(e){const t=e.start.dayNumber,n=e.start.secondsOfDay+GM,i=e.stop.dayNumber,o=e.stop.secondsOfDay+GM;return Hi.iau2006XysData.preload(t,n,i,o)};Hi.computeIcrfToFixedMatrix=function(e,t){if(!l(e))throw new w("date is required.");l(t)||(t=new te);const n=Hi.computeFixedToIcrfMatrix(e,t);if(l(n))return te.transpose(n,t)};const Ave=new xK(0,0,0),Tve=new R3(0,0,0,0,0),jL=new te,YL=new te;Hi.computeFixedToIcrfMatrix=function(e,t){if(!l(e))throw new w("date is required.");l(t)||(t=new te);const n=Hi.earthOrientationParameters.compute(e,Tve);if(!l(n))return;const i=e.dayNumber,o=e.secondsOfDay+GM,r=Hi.iau2006XysData.computeXysRadians(i,o,Ave);if(!l(r))return;const s=r.x+n.xPoleOffset,a=r.y+n.yPoleOffset,c=1/(1+Math.sqrt(1-s*s-a*a)),u=jL;u[0]=1-c*s*s,u[3]=-c*s*a,u[6]=s,u[1]=-c*s*a,u[4]=1-c*a*a,u[7]=a,u[2]=-s,u[5]=-a,u[8]=1-c*(s*s+a*a);const f=te.fromRotationZ(-r.s,YL),h=te.multiply(u,f,jL),_=e.dayNumber,g=e.secondsOfDay-ce.computeTaiMinusUtc(e)+n.ut1MinusUtc,p=_-2451545,y=g/to.SECONDS_PER_DAY;let T=.779057273264+y+.00273781191135448*(p+y);T=T%1*F.TWO_PI;const b=te.fromRotationZ(T,YL),x=te.multiply(h,b,jL),v=Math.cos(n.xPoleWander),D=Math.cos(n.yPoleWander),L=Math.sin(n.xPoleWander),B=Math.sin(n.yPoleWander);let V=i-yve+o/to.SECONDS_PER_DAY;V/=36525;const M=-47e-6*V*F.RADIANS_PER_DEGREE/3600,H=Math.cos(M),G=Math.sin(M),I=YL;return I[0]=v*H,I[1]=v*G,I[2]=L,I[3]=-D*G+B*L*H,I[4]=D*H+B*L*G,I[5]=-B*v,I[6]=-B*G-D*L*H,I[7]=B*H-D*L*G,I[8]=D*v,te.multiply(x,I,t)};const Cve=new ue;Hi.pointToWindowCoordinates=function(e,t,n,i){return i=Hi.pointToGLWindowCoordinates(e,t,n,i),i.y=2*t[5]-i.y,i};Hi.pointToGLWindowCoordinates=function(e,t,n,i){if(!l(e))throw new w("modelViewProjectionMatrix is required.");if(!l(t))throw new w("viewportTransformation is required.");if(!l(n))throw new w("point is required.");l(i)||(i=new $);const o=Cve;return N.multiplyByVector(e,ue.fromElements(n.x,n.y,n.z,1,o),o),ue.multiplyByScalar(o,1/o.w,o),N.multiplyByVector(t,o,o),$.fromCartesian4(o,i)};const bve=new d,Eve=new d,xve=new d;Hi.rotationMatrixFromPositionVelocity=function(e,t,n,i){if(!l(e))throw new w("position is required.");if(!l(t))throw new w("velocity is required.");const o=A(n,be.WGS84).geodeticSurfaceNormal(e,bve);let r=d.cross(t,o,Eve);d.equalsEpsilon(r,d.ZERO,F.EPSILON6)&&(r=d.clone(d.UNIT_X,r));const s=d.cross(r,t,xve);return d.normalize(s,s),d.cross(t,s,r),d.negate(r,r),d.normalize(r,r),l(i)||(i=new te),i[0]=t.x,i[1]=t.y,i[2]=t.z,i[3]=r.x,i[4]=r.y,i[5]=r.z,i[6]=s.x,i[7]=s.y,i[8]=s.z,i};const wK=new N(0,0,1,0,1,0,0,0,0,1,0,0,0,0,0,1),SK=new ve,vK=new d,wve=new d,Sve=new te,WM=new N,DK=new N;Hi.basisTo2D=function(e,t,n){if(!l(e))throw new w("projection is required.");if(!l(t))throw new w("matrix is required.");if(!l(n))throw new w("result is required.");const i=N.getTranslation(t,wve),o=e.ellipsoid,r=o.cartesianToCartographic(i,SK),s=e.project(r,vK);d.fromElements(s.z,s.x,s.y,s);const a=Hi.eastNorthUpToFixedFrame(i,o,WM),c=N.inverseTransformation(a,DK),u=N.getMatrix3(t,Sve),f=N.multiplyByMatrix3(c,u,n);return N.multiply(wK,f,n),N.setTranslation(n,s,n),n};Hi.wgs84To2DModelMatrix=function(e,t,n){if(!l(e))throw new w("projection is required.");if(!l(t))throw new w("center is required.");if(!l(n))throw new w("result is required.");const i=e.ellipsoid,o=Hi.eastNorthUpToFixedFrame(t,i,WM),r=N.inverseTransformation(o,DK),s=i.cartesianToCartographic(t,SK),a=e.project(s,vK);d.fromElements(a.z,a.x,a.y,a);const c=N.fromTranslation(a,WM);return N.multiply(wK,r,n),N.multiply(c,n,n),n};const En=Hi;function $t(e){e=A(e,A.EMPTY_OBJECT),E.typeOf.object("options.attributes",e.attributes),this.attributes=e.attributes,this.indices=e.indices,this.primitiveType=A(e.primitiveType,dt.TRIANGLES),this.boundingSphere=e.boundingSphere,this.geometryType=A(e.geometryType,fA.NONE),this.boundingSphereCV=e.boundingSphereCV,this.offsetAttribute=e.offsetAttribute}$t.computeNumberOfVertices=function(e){E.typeOf.object("geometry",e);let t=-1;for(const n in e.attributes)if(e.attributes.hasOwnProperty(n)&&l(e.attributes[n])&&l(e.attributes[n].values)){const i=e.attributes[n],o=i.values.length/i.componentsPerAttribute;if(t!==o&&t!==-1)throw new w("All attribute lists must have the same number of attributes.");t=o}return t};const vve=new ve,Dve=new d,r5=new N,Ive=[new ve,new ve,new ve],Pve=[new $,new $,new $],Ove=[new $,new $,new $],Lve=new d,Bve=new De,Rve=new N,Nve=new Et;$t._textureCoordinateRotationPoints=function(e,t,n,i){let o;const r=Ee.center(i,vve),s=ve.toCartesian(r,n,Dve),a=En.eastNorthUpToFixedFrame(s,n,r5),c=N.inverse(a,r5),u=Pve,f=Ive;f[0].longitude=i.west,f[0].latitude=i.south,f[1].longitude=i.west,f[1].latitude=i.north,f[2].longitude=i.east,f[2].latitude=i.south;let h=Lve;for(o=0;o<3;o++)ve.toCartesian(f[o],n,h),h=N.multiplyByPointAsVector(c,h,h),u[o].x=h.x,u[o].y=h.y;const _=De.fromAxisAngle(d.UNIT_Z,-t,Bve),g=te.fromQuaternion(_,Rve),p=e.length;let y=Number.POSITIVE_INFINITY,T=Number.POSITIVE_INFINITY,b=Number.NEGATIVE_INFINITY,x=Number.NEGATIVE_INFINITY;for(o=0;o<p;o++)h=N.multiplyByPointAsVector(c,e[o],h),h=te.multiplyByVector(g,h,h),y=Math.min(y,h.x),T=Math.min(T,h.y),b=Math.max(b,h.x),x=Math.max(x,h.y);const v=Et.fromRotation(t,Nve),D=Ove;D[0].x=y,D[0].y=T,D[1].x=y,D[1].y=x,D[2].x=b,D[2].y=T;const L=u[0],B=u[2].x-L.x,V=u[1].y-L.y;for(o=0;o<3;o++){const O=D[o];Et.multiplyByVector(v,O,O),O.x=(O.x-L.x)/B,O.y=(O.y-L.y)/V}const M=D[0],H=D[1],G=D[2],I=new Array(6);return $.pack(M,I),$.pack(H,I,2),$.pack(G,I,4),I};function Xe(e){if(e=A(e,A.EMPTY_OBJECT),!l(e.componentDatatype))throw new w("options.componentDatatype is required.");if(!l(e.componentsPerAttribute))throw new w("options.componentsPerAttribute is required.");if(e.componentsPerAttribute<1||e.componentsPerAttribute>4)throw new w("options.componentsPerAttribute must be between 1 and 4.");if(!l(e.values))throw new w("options.values is required.");this.componentDatatype=e.componentDatatype,this.componentsPerAttribute=e.componentsPerAttribute,this.normalize=A(e.normalize,!1),this.values=e.values}function ZA(e,t,n,i,o){this._format=e,this._datatype=t,this._width=n,this._height=i,this._buffer=o}Object.defineProperties(ZA.prototype,{internalFormat:{get:function(){return this._format}},pixelDatatype:{get:function(){return this._datatype}},width:{get:function(){return this._width}},height:{get:function(){return this._height}},bufferView:{get:function(){return this._buffer}}});ZA.clone=function(e){if(l(e))return new ZA(e._format,e._datatype,e._width,e._height,e._buffer)};ZA.prototype.clone=function(){return ZA.clone(this)};function IK(){if(!l(lo._canTransferArrayBuffer)){const e=new Worker(OK("Workers/transferTypedArrayTest.js"));e.postMessage=A(e.webkitPostMessage,e.postMessage);const t=99,n=new Int8Array([t]);try{e.postMessage({array:n},[n.buffer])}catch{return lo._canTransferArrayBuffer=!1,lo._canTransferArrayBuffer}const i=__();e.onmessage=function(o){const r=o.data.array,s=l(r)&&r[0]===t;i.resolve(s),e.terminate(),lo._canTransferArrayBuffer=s},lo._canTransferArrayBuffer=i.promise}return lo._canTransferArrayBuffer}const qM=new lt;function PK(e,t){--e._activeTasks;const n=t.id;if(!l(n))return;const i=e._deferreds,o=i[n];if(l(t.error)){let r=t.error;r.name==="RuntimeError"?(r=new Fe(t.error.message),r.stack=t.error.stack):r.name==="DeveloperError"&&(r=new w(t.error.message),r.stack=t.error.stack),qM.raiseEvent(r),o.reject(r)}else qM.raiseEvent(),o.resolve(t.result);delete i[n]}function OK(e){let t=Un(e);if(hK(t)){const n=`importScripts("${t}");`;let i;try{i=new Blob([n],{type:"application/javascript"})}catch{const s=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder,a=new s;a.append(n),i=a.getBlob("application/javascript")}t=(window.URL||window.webkitURL).createObjectURL(i)}return t}let $L;function Mve(){return l($L)||($L=OK("Workers/cesiumWorkerBootstrapper.js")),$L}function LK(e){const t=new Worker(Mve());t.postMessage=A(t.webkitPostMessage,t.postMessage);const n={loaderConfig:{paths:{Workers:Un("Workers")},baseUrl:Un.getCesiumBaseUrl().url},workerModule:e._workerPath};return t.postMessage(n),t.onmessage=function(i){PK(e,i.data)},t}function Fve(e,t){const n={modulePath:void 0,wasmBinaryFile:void 0,wasmBinary:void 0};if(!Mn.supportsWebAssembly()){if(!l(t.fallbackModulePath))throw new Fe(`This browser does not support Web Assembly, and no backup module was provided for ${e._workerPath}`);return n.modulePath=Un(t.fallbackModulePath),Promise.resolve(n)}return n.modulePath=Un(t.modulePath),n.wasmBinaryFile=Un(t.wasmBinaryFile),je.fetchArrayBuffer({url:n.wasmBinaryFile}).then(function(i){return n.wasmBinary=i,n})}function lo(e,t){const n=new ha(e);this._workerPath=n.scheme().length!==0&&n.fragment().length===0?e:lo._workerModulePrefix+e,this._maximumActiveTasks=A(t,Number.POSITIVE_INFINITY),this._activeTasks=0,this._deferreds={},this._nextID=0}const zve=[];lo.prototype.scheduleTask=function(e,t){if(l(this._worker)||(this._worker=LK(this)),this._activeTasks>=this._maximumActiveTasks)return;++this._activeTasks;const n=this;return Promise.resolve(IK()).then(function(i){l(t)?i||(t.length=0):t=zve;const o=n._nextID++,r=__();return n._deferreds[o]=r,n._worker.postMessage({id:o,parameters:e,canTransferArrayBuffer:i},t),r.promise})};lo.prototype.initWebAssemblyModule=function(e){l(this._worker)||(this._worker=LK(this));const t=__(),n=this,i=this._worker;return Fve(this,e).then(function(o){return Promise.resolve(IK()).then(function(r){let s;const a=o.wasmBinary;l(a)&&r&&(s=[a]),i.onmessage=function(c){i.onmessage=function(u){PK(n,u.data)},t.resolve(c.data)},i.postMessage({webAssemblyConfig:o},s)})}),t.promise};lo.prototype.isDestroyed=function(){return!1};lo.prototype.destroy=function(){return l(this._worker)&&this._worker.terminate(),Je(this)};lo.taskCompletedEvent=qM;lo._defaultWorkerModulePrefix="Workers/";lo._workerModulePrefix=lo._defaultWorkerModulePrefix;lo._canTransferArrayBuffer=void 0;function Rh(){}Rh._transcodeTaskProcessor=new lo("transcodeKTX2",Number.POSITIVE_INFINITY);Rh._readyPromise=void 0;function Uve(){const e=Rh._transcodeTaskProcessor.initWebAssemblyModule({modulePath:"ThirdParty/Workers/basis_transcoder.js",wasmBinaryFile:"ThirdParty/basis_transcoder.wasm"}).then(function(){return Rh._transcodeTaskProcessor});Rh._readyPromise=e}Rh.transcode=function(e,t){return E.defined("supportedTargetFormats",t),l(Rh._readyPromise)||Uve(),Rh._readyPromise.then(function(n){let i;if(e instanceof ArrayBuffer){const o=new Uint8Array(e);return i={supportedTargetFormats:t,ktx2Buffer:o},n.scheduleTask(i,[e])}return i={supportedTargetFormats:t,ktx2Buffer:e},n.scheduleTask(i,[e.buffer])}).then(function(n){const i=n.length,o=Object.keys(n[0]),r=o.length;let s;for(s=0;s<i;s++){const a=n[s];for(let c=0;c<r;c++){const u=a[o[c]];a[o[c]]=new ZA(u.internalFormat,u.datatype,u.width,u.height,u.levelBuffer)}}if(r===1){for(s=0;s<i;++s)n[s]=n[s][o[0]];i===1&&(n=n[0])}return n}).catch(function(n){throw n})};let BK;Sy.setKTX2SupportedFormats=function(e,t,n,i,o,r){BK={s3tc:e,pvrtc:t,astc:n,etc:i,etc1:o,bc7:r}};function Sy(e){E.defined("resourceOrUrlOrBuffer",e);let t;return e instanceof ArrayBuffer||ArrayBuffer.isView(e)?t=Promise.resolve(e):t=je.createIfNeeded(e).fetchArrayBuffer(),t.then(function(n){return Rh.transcode(n,BK)})}function Th(e,t,n,i,o,r,s,a,c,u,f){this._context=e,this._texture=t,this._textureTarget=n,this._targetFace=i,this._pixelDatatype=s,this._internalFormat=o,this._pixelFormat=r,this._size=a,this._preMultiplyAlpha=c,this._flipY=u,this._initialized=f}Object.defineProperties(Th.prototype,{pixelFormat:{get:function(){return this._pixelFormat}},pixelDatatype:{get:function(){return this._pixelDatatype}},_target:{get:function(){return this._targetFace}}});Th.prototype.copyFrom=function(e){E.defined("options",e);const t=A(e.xOffset,0),n=A(e.yOffset,0);if(E.defined("options.source",e.source),E.typeOf.number.greaterThanOrEquals("xOffset",t,0),E.typeOf.number.greaterThanOrEquals("yOffset",n,0),t+e.source.width>this._size)throw new w("xOffset + options.source.width must be less than or equal to width.");if(n+e.source.height>this._size)throw new w("yOffset + options.source.height must be less than or equal to height.");const i=e.source,o=this._context._gl,r=this._textureTarget,s=this._targetFace;o.activeTexture(o.TEXTURE0),o.bindTexture(r,this._texture);const a=i.width,c=i.height;let u=i.arrayBufferView;const f=this._size,h=this._pixelFormat,_=this._internalFormat,g=this._pixelDatatype,p=this._preMultiplyAlpha,y=this._flipY,T=A(e.skipColorSpaceConversion,!1);let b=4;l(u)&&(b=yt.alignmentInBytes(h,g,a)),o.pixelStorei(o.UNPACK_ALIGNMENT,b),T?o.pixelStorei(o.UNPACK_COLORSPACE_CONVERSION_WEBGL,o.NONE):o.pixelStorei(o.UNPACK_COLORSPACE_CONVERSION_WEBGL,o.BROWSER_DEFAULT_WEBGL);let x=!1;if(!this._initialized){if(t===0&&n===0&&a===f&&c===f)l(u)?(o.pixelStorei(o.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),o.pixelStorei(o.UNPACK_FLIP_Y_WEBGL,!1),y&&(u=yt.flipY(u,h,g,f,f)),o.texImage2D(s,0,_,f,f,0,h,ft.toWebGLConstant(g,this._context),u)):(o.pixelStorei(o.UNPACK_PREMULTIPLY_ALPHA_WEBGL,p),o.pixelStorei(o.UNPACK_FLIP_Y_WEBGL,y),o.texImage2D(s,0,_,h,ft.toWebGLConstant(g,this._context),i)),x=!0;else{o.pixelStorei(o.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),o.pixelStorei(o.UNPACK_FLIP_Y_WEBGL,!1);const v=yt.createTypedArray(h,g,f,f);o.texImage2D(s,0,_,f,f,0,h,ft.toWebGLConstant(g,this._context),v)}this._initialized=!0}x||(l(u)?(o.pixelStorei(o.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),o.pixelStorei(o.UNPACK_FLIP_Y_WEBGL,!1),y&&(u=yt.flipY(u,h,g,a,c)),o.texSubImage2D(s,0,t,n,a,c,h,ft.toWebGLConstant(g,this._context),u)):(o.pixelStorei(o.UNPACK_PREMULTIPLY_ALPHA_WEBGL,p),o.pixelStorei(o.UNPACK_FLIP_Y_WEBGL,y),o.texSubImage2D(s,0,t,n,h,ft.toWebGLConstant(g,this._context),i))),o.bindTexture(r,null)};Th.prototype.copyFromFramebuffer=function(e,t,n,i,o,r){if(e=A(e,0),t=A(t,0),n=A(n,0),i=A(i,0),o=A(o,this._size),r=A(r,this._size),E.typeOf.number.greaterThanOrEquals("xOffset",e,0),E.typeOf.number.greaterThanOrEquals("yOffset",t,0),E.typeOf.number.greaterThanOrEquals("framebufferXOffset",n,0),E.typeOf.number.greaterThanOrEquals("framebufferYOffset",i,0),e+o>this._size)throw new w("xOffset + source.width must be less than or equal to width.");if(t+r>this._size)throw new w("yOffset + source.height must be less than or equal to height.");if(this._pixelDatatype===ft.FLOAT)throw new w("Cannot call copyFromFramebuffer when the texture pixel data type is FLOAT.");if(this._pixelDatatype===ft.HALF_FLOAT)throw new w("Cannot call copyFromFramebuffer when the texture pixel data type is HALF_FLOAT.");const s=this._context._gl,a=this._textureTarget;s.activeTexture(s.TEXTURE0),s.bindTexture(a,this._texture),s.copyTexSubImage2D(this._targetFace,0,e,t,n,i,o,r),s.bindTexture(a,null),this._initialized=!0};const CD={DONT_CARE:fe.DONT_CARE,FASTEST:fe.FASTEST,NICEST:fe.NICEST,validate:function(e){return e===CD.DONT_CARE||e===CD.FASTEST||e===CD.NICEST}},eT=Object.freeze(CD),bD={NEAREST:fe.NEAREST,LINEAR:fe.LINEAR};bD.validate=function(e){return e===bD.NEAREST||e===bD.LINEAR};const Ps=Object.freeze(bD),fm={NEAREST:fe.NEAREST,LINEAR:fe.LINEAR,NEAREST_MIPMAP_NEAREST:fe.NEAREST_MIPMAP_NEAREST,LINEAR_MIPMAP_NEAREST:fe.LINEAR_MIPMAP_NEAREST,NEAREST_MIPMAP_LINEAR:fe.NEAREST_MIPMAP_LINEAR,LINEAR_MIPMAP_LINEAR:fe.LINEAR_MIPMAP_LINEAR};fm.validate=function(e){return e===fm.NEAREST||e===fm.LINEAR||e===fm.NEAREST_MIPMAP_NEAREST||e===fm.LINEAR_MIPMAP_NEAREST||e===fm.NEAREST_MIPMAP_LINEAR||e===fm.LINEAR_MIPMAP_LINEAR};const Wn=Object.freeze(fm),ED={CLAMP_TO_EDGE:fe.CLAMP_TO_EDGE,REPEAT:fe.REPEAT,MIRRORED_REPEAT:fe.MIRRORED_REPEAT,validate:function(e){return e===ED.CLAMP_TO_EDGE||e===ED.REPEAT||e===ED.MIRRORED_REPEAT}},io=Object.freeze(ED);function Ci(e){e=A(e,A.EMPTY_OBJECT);const t=A(e.wrapS,io.CLAMP_TO_EDGE),n=A(e.wrapT,io.CLAMP_TO_EDGE),i=A(e.minificationFilter,Wn.LINEAR),o=A(e.magnificationFilter,Ps.LINEAR),r=l(e.maximumAnisotropy)?e.maximumAnisotropy:1;if(!io.validate(t))throw new w("Invalid sampler.wrapS.");if(!io.validate(n))throw new w("Invalid sampler.wrapT.");if(!Wn.validate(i))throw new w("Invalid sampler.minificationFilter.");if(!Ps.validate(o))throw new w("Invalid sampler.magnificationFilter.");E.typeOf.number.greaterThanOrEquals("maximumAnisotropy",r,1),this._wrapS=t,this._wrapT=n,this._minificationFilter=i,this._magnificationFilter=o,this._maximumAnisotropy=r}Object.defineProperties(Ci.prototype,{wrapS:{get:function(){return this._wrapS}},wrapT:{get:function(){return this._wrapT}},minificationFilter:{get:function(){return this._minificationFilter}},magnificationFilter:{get:function(){return this._magnificationFilter}},maximumAnisotropy:{get:function(){return this._maximumAnisotropy}}});Ci.equals=function(e,t){return e===t||l(e)&&l(t)&&e._wrapS===t._wrapS&&e._wrapT===t._wrapT&&e._minificationFilter===t._minificationFilter&&e._magnificationFilter===t._magnificationFilter&&e._maximumAnisotropy===t._maximumAnisotropy};Ci.NEAREST=Object.freeze(new Ci({wrapS:io.CLAMP_TO_EDGE,wrapT:io.CLAMP_TO_EDGE,minificationFilter:Wn.NEAREST,magnificationFilter:Ps.NEAREST}));function xf(e){e=A(e,A.EMPTY_OBJECT),E.defined("options.context",e.context);const t=e.context,n=e.source;let i,o;if(l(n)){const x=[n.positiveX,n.negativeX,n.positiveY,n.negativeY,n.positiveZ,n.negativeZ];if(!x[0]||!x[1]||!x[2]||!x[3]||!x[4]||!x[5])throw new w("options.source requires positiveX, negativeX, positiveY, negativeY, positiveZ, and negativeZ faces.");i=x[0].width,o=x[0].height;for(let v=1;v<6;++v)if(Number(x[v].width)!==i||Number(x[v].height)!==o)throw new w("Each face in options.source must have the same width and height.")}else i=e.width,o=e.height;const r=i,s=A(e.pixelDatatype,ft.UNSIGNED_BYTE),a=A(e.pixelFormat,yt.RGBA),c=yt.toInternalFormat(a,s,t);if(!l(i)||!l(o))throw new w("options requires a source field to create an initialized cube map or width and height fields to create a blank cube map.");if(i!==o)throw new w("Width must equal height.");if(r<=0)throw new w("Width and height must be greater than zero.");if(r>Gt.maximumCubeMapSize)throw new w(`Width and height must be less than or equal to the maximum cube map size (${Gt.maximumCubeMapSize}). Check maximumCubeMapSize.`);if(!yt.validate(a))throw new w("Invalid options.pixelFormat.");if(yt.isDepthFormat(a))throw new w("options.pixelFormat cannot be DEPTH_COMPONENT or DEPTH_STENCIL.");if(!ft.validate(s))throw new w("Invalid options.pixelDatatype.");if(s===ft.FLOAT&&!t.floatingPointTexture)throw new w("When options.pixelDatatype is FLOAT, this WebGL implementation must support the OES_texture_float extension.");if(s===ft.HALF_FLOAT&&!t.halfFloatingPointTexture)throw new w("When options.pixelDatatype is HALF_FLOAT, this WebGL implementation must support the OES_texture_half_float extension.");const u=yt.textureSizeInBytes(a,s,r,r)*6,f=e.preMultiplyAlpha||a===yt.RGB||a===yt.LUMINANCE,h=A(e.flipY,!0),_=A(e.skipColorSpaceConversion,!1),g=t._gl,p=g.TEXTURE_CUBE_MAP,y=g.createTexture();g.activeTexture(g.TEXTURE0),g.bindTexture(p,y);function T(x,v,D,L,B){let V=v.arrayBufferView;l(V)||(V=v.bufferView);let M=4;l(V)&&(M=yt.alignmentInBytes(a,s,i)),g.pixelStorei(g.UNPACK_ALIGNMENT,M),B?g.pixelStorei(g.UNPACK_COLORSPACE_CONVERSION_WEBGL,g.NONE):g.pixelStorei(g.UNPACK_COLORSPACE_CONVERSION_WEBGL,g.BROWSER_DEFAULT_WEBGL),l(V)?(g.pixelStorei(g.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),g.pixelStorei(g.UNPACK_FLIP_Y_WEBGL,!1),L&&(V=yt.flipY(V,a,s,r,r)),g.texImage2D(x,0,c,r,r,0,a,ft.toWebGLConstant(s,t),V)):(g.pixelStorei(g.UNPACK_PREMULTIPLY_ALPHA_WEBGL,D),g.pixelStorei(g.UNPACK_FLIP_Y_WEBGL,L),g.texImage2D(x,0,c,a,ft.toWebGLConstant(s,t),v))}l(n)?(T(g.TEXTURE_CUBE_MAP_POSITIVE_X,n.positiveX,f,h,_),T(g.TEXTURE_CUBE_MAP_NEGATIVE_X,n.negativeX,f,h,_),T(g.TEXTURE_CUBE_MAP_POSITIVE_Y,n.positiveY,f,h,_),T(g.TEXTURE_CUBE_MAP_NEGATIVE_Y,n.negativeY,f,h,_),T(g.TEXTURE_CUBE_MAP_POSITIVE_Z,n.positiveZ,f,h,_),T(g.TEXTURE_CUBE_MAP_NEGATIVE_Z,n.negativeZ,f,h,_)):(g.texImage2D(g.TEXTURE_CUBE_MAP_POSITIVE_X,0,c,r,r,0,a,ft.toWebGLConstant(s,t),null),g.texImage2D(g.TEXTURE_CUBE_MAP_NEGATIVE_X,0,c,r,r,0,a,ft.toWebGLConstant(s,t),null),g.texImage2D(g.TEXTURE_CUBE_MAP_POSITIVE_Y,0,c,r,r,0,a,ft.toWebGLConstant(s,t),null),g.texImage2D(g.TEXTURE_CUBE_MAP_NEGATIVE_Y,0,c,r,r,0,a,ft.toWebGLConstant(s,t),null),g.texImage2D(g.TEXTURE_CUBE_MAP_POSITIVE_Z,0,c,r,r,0,a,ft.toWebGLConstant(s,t),null),g.texImage2D(g.TEXTURE_CUBE_MAP_NEGATIVE_Z,0,c,r,r,0,a,ft.toWebGLConstant(s,t),null)),g.bindTexture(p,null),this._context=t,this._textureFilterAnisotropic=t._textureFilterAnisotropic,this._textureTarget=p,this._texture=y,this._pixelFormat=a,this._pixelDatatype=s,this._size=r,this._hasMipmap=!1,this._sizeInBytes=u,this._preMultiplyAlpha=f,this._flipY=h,this._sampler=void 0;const b=l(n);this._positiveX=new Th(t,y,p,g.TEXTURE_CUBE_MAP_POSITIVE_X,c,a,s,r,f,h,b),this._negativeX=new Th(t,y,p,g.TEXTURE_CUBE_MAP_NEGATIVE_X,c,a,s,r,f,h,b),this._positiveY=new Th(t,y,p,g.TEXTURE_CUBE_MAP_POSITIVE_Y,c,a,s,r,f,h,b),this._negativeY=new Th(t,y,p,g.TEXTURE_CUBE_MAP_NEGATIVE_Y,c,a,s,r,f,h,b),this._positiveZ=new Th(t,y,p,g.TEXTURE_CUBE_MAP_POSITIVE_Z,c,a,s,r,f,h,b),this._negativeZ=new Th(t,y,p,g.TEXTURE_CUBE_MAP_NEGATIVE_Z,c,a,s,r,f,h,b),this.sampler=l(e.sampler)?e.sampler:new Ci}Object.defineProperties(xf.prototype,{positiveX:{get:function(){return this._positiveX}},negativeX:{get:function(){return this._negativeX}},positiveY:{get:function(){return this._positiveY}},negativeY:{get:function(){return this._negativeY}},positiveZ:{get:function(){return this._positiveZ}},negativeZ:{get:function(){return this._negativeZ}},sampler:{get:function(){return this._sampler},set:function(e){let t=e.minificationFilter,n=e.magnificationFilter;const i=t===Wn.NEAREST_MIPMAP_NEAREST||t===Wn.NEAREST_MIPMAP_LINEAR||t===Wn.LINEAR_MIPMAP_NEAREST||t===Wn.LINEAR_MIPMAP_LINEAR,o=this._context,r=this._pixelDatatype;(r===ft.FLOAT&&!o.textureFloatLinear||r===ft.HALF_FLOAT&&!o.textureHalfFloatLinear)&&(t=i?Wn.NEAREST_MIPMAP_NEAREST:Wn.NEAREST,n=Ps.NEAREST);const s=o._gl,a=this._textureTarget;s.activeTexture(s.TEXTURE0),s.bindTexture(a,this._texture),s.texParameteri(a,s.TEXTURE_MIN_FILTER,t),s.texParameteri(a,s.TEXTURE_MAG_FILTER,n),s.texParameteri(a,s.TEXTURE_WRAP_S,e.wrapS),s.texParameteri(a,s.TEXTURE_WRAP_T,e.wrapT),l(this._textureFilterAnisotropic)&&s.texParameteri(a,this._textureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,e.maximumAnisotropy),s.bindTexture(a,null),this._sampler=e}},pixelFormat:{get:function(){return this._pixelFormat}},pixelDatatype:{get:function(){return this._pixelDatatype}},width:{get:function(){return this._size}},height:{get:function(){return this._size}},sizeInBytes:{get:function(){return this._hasMipmap?Math.floor(this._sizeInBytes*4/3):this._sizeInBytes}},preMultiplyAlpha:{get:function(){return this._preMultiplyAlpha}},flipY:{get:function(){return this._flipY}},_target:{get:function(){return this._textureTarget}}});xf.prototype.generateMipmap=function(e){if(e=A(e,eT.DONT_CARE),this._size>1&&!F.isPowerOfTwo(this._size))throw new w("width and height must be a power of two to call generateMipmap().");if(!eT.validate(e))throw new w("hint is invalid.");this._hasMipmap=!0;const t=this._context._gl,n=this._textureTarget;t.hint(t.GENERATE_MIPMAP_HINT,e),t.activeTexture(t.TEXTURE0),t.bindTexture(n,this._texture),t.generateMipmap(n),t.bindTexture(n,null)};xf.prototype.isDestroyed=function(){return!1};xf.prototype.destroy=function(){return this._context._gl.deleteTexture(this._texture),this._positiveX=Je(this._positiveX),this._negativeX=Je(this._negativeX),this._positiveY=Je(this._positiveY),this._negativeY=Je(this._negativeY),this._positiveZ=Je(this._positiveZ),this._negativeZ=Je(this._negativeZ),Je(this)};function vy(e){this.context=e,this.framebuffer=void 0,this.blendingEnabled=void 0,this.scissorTest=void 0,this.viewport=void 0}function Hve(e,t){const n=/#define OUTPUT_DECLARATION/,i=e.split(`
|
||
`);if(/#version 300 es/g.test(e))return e;let o=-1,r,s;for(r=0;r<i.length;++r)if(s=i[r],n.test(s)){o=r;break}if(o===-1)throw new w("Could not find a #define OUTPUT_DECLARATION!");const a=[];for(r=0;r<10;r++){const y=`gl_FragData\\[${r}\\]`,T=`czm_out${r}`;new RegExp(y,"g").test(e)&&(s5(T,a),Jf(y,T,i),i.splice(o,0,`layout(location = ${r}) out vec4 ${T};`),o+=1)}const c="czm_fragColor";kve("gl_FragColor",i)&&(s5(c,a),Jf("gl_FragColor",c,i),i.splice(o,0,"layout(location = 0) out vec4 czm_fragColor;"),o+=1);const u=Wve(a,i),f={};for(r=0;r<i.length;r++){s=i[r];for(const y in u)u.hasOwnProperty(y)&&new RegExp(`(layout)[^]+(out)[^]+(${y})[^]+`,"g").test(s)&&(f[s]=y)}for(const y in f)if(f.hasOwnProperty(y)){const T=f[y];let b=i.indexOf(y);const x=u[T],v=x.length;for(let D=0;D<v;D++)i.splice(b,0,x[D]);b+=v+1;for(let D=v-1;D>=0;D--)i.splice(b,0,`#endif //${x[D]}`)}const h="WEBGL_2",_=`#define ${h}`,g="#version 300 es";let p=!1;for(r=0;r<i.length;r++)if(/#version/.test(i[r])){i[r]=g,p=!0;break}return p||i.splice(0,0,g),i.splice(1,0,_),XL("EXT_draw_buffers",h,i),XL("EXT_frag_depth",h,i),XL("OES_standard_derivatives",h,i),Jf("texture2D","texture",i),Jf("texture3D","texture",i),Jf("textureCube","texture",i),Jf("gl_FragDepthEXT","gl_FragDepth",i),t?Jf("varying","in",i):(Jf("attribute","in",i),Jf("varying","out",i)),Gve(i)}function Jf(e,t,n){const i=`(^|[^\\w])(${e})($|[^\\w])`,o=new RegExp(i,"g"),r=n.length;for(let s=0;s<r;++s){const a=n[s];n[s]=a.replace(o,`$1${t}$3`)}}function Vve(e,t,n){const i=n.length;for(let o=0;o<i;++o){const r=n[o];n[o]=r.replace(e,t)}}function kve(e,t){const n=`(^|[^\\w])(${e})($|[^\\w])`,i=new RegExp(n,"g"),o=t.length;for(let r=0;r<o;++r){const s=t[r];if(i.test(s))return!0}return!1}function Gve(e){let t="";const n=e.length;for(let i=0;i<n;++i)t+=`${e[i]}
|
||
`;return t}function s5(e,t){t.indexOf(e)===-1&&t.push(e)}function Wve(e,t){const n={},i=e.length,o=[];for(let r=0;r<t.length;++r){const s=t[r],a=/(#ifdef|#if)/g.test(s),c=/#else/g.test(s),u=/#endif/g.test(s);if(a)o.push(s);else if(c){let h=o[o.length-1].replace("ifdef","ifndef");/if/g.test(h)&&(h=h.replace(/(#if\s+)(\S*)([^]*)/,"$1!($2)$3")),o.pop(),o.push(h)}else if(u)o.pop();else if(!/layout/g.test(s))for(let f=0;f<i;++f){const h=e[f];s.indexOf(h)!==-1&&(l(n[h])?n[h]=n[h].filter(function(_){return o.indexOf(_)>=0}):n[h]=o.slice())}}return n}function XL(e,t,n){const i=`#extension\\s+GL_${e}\\s+:\\s+[a-zA-Z0-9]+\\s*$`;Vve(new RegExp(i,"g"),"",n),Jf(`GL_${e}`,t,n)}const qve=`/**
|
||
* A built-in GLSL floating-point constant for converting radians to degrees.
|
||
*
|
||
* @alias czm_degreesPerRadian
|
||
* @glslConstant
|
||
*
|
||
* @see CesiumMath.DEGREES_PER_RADIAN
|
||
*
|
||
* @example
|
||
* // GLSL declaration
|
||
* const float czm_degreesPerRadian = ...;
|
||
*
|
||
* // Example
|
||
* float deg = czm_degreesPerRadian * rad;
|
||
*/
|
||
const float czm_degreesPerRadian = 57.29577951308232;
|
||
`,jve=`/**
|
||
* A built-in GLSL vec2 constant for defining the depth range.
|
||
* This is a workaround to a bug where IE11 does not implement gl_DepthRange.
|
||
*
|
||
* @alias czm_depthRange
|
||
* @glslConstant
|
||
*
|
||
* @example
|
||
* // GLSL declaration
|
||
* float depthRangeNear = czm_depthRange.near;
|
||
* float depthRangeFar = czm_depthRange.far;
|
||
*
|
||
*/
|
||
const czm_depthRangeStruct czm_depthRange = czm_depthRangeStruct(0.0, 1.0);
|
||
`,Yve=`/**
|
||
* 0.1
|
||
*
|
||
* @name czm_epsilon1
|
||
* @glslConstant
|
||
*/
|
||
const float czm_epsilon1 = 0.1;
|
||
`,$ve=`/**
|
||
* 0.01
|
||
*
|
||
* @name czm_epsilon2
|
||
* @glslConstant
|
||
*/
|
||
const float czm_epsilon2 = 0.01;
|
||
`,Xve=`/**
|
||
* 0.001
|
||
*
|
||
* @name czm_epsilon3
|
||
* @glslConstant
|
||
*/
|
||
const float czm_epsilon3 = 0.001;
|
||
`,Kve=`/**
|
||
* 0.0001
|
||
*
|
||
* @name czm_epsilon4
|
||
* @glslConstant
|
||
*/
|
||
const float czm_epsilon4 = 0.0001;
|
||
`,Jve=`/**
|
||
* 0.00001
|
||
*
|
||
* @name czm_epsilon5
|
||
* @glslConstant
|
||
*/
|
||
const float czm_epsilon5 = 0.00001;
|
||
`,Qve=`/**
|
||
* 0.000001
|
||
*
|
||
* @name czm_epsilon6
|
||
* @glslConstant
|
||
*/
|
||
const float czm_epsilon6 = 0.000001;
|
||
`,Zve=`/**
|
||
* 0.0000001
|
||
*
|
||
* @name czm_epsilon7
|
||
* @glslConstant
|
||
*/
|
||
const float czm_epsilon7 = 0.0000001;
|
||
`,eDe=`/**
|
||
* DOC_TBA
|
||
*
|
||
* @name czm_infinity
|
||
* @glslConstant
|
||
*/
|
||
const float czm_infinity = 5906376272000.0; // Distance from the Sun to Pluto in meters. TODO: What is best given lowp, mediump, and highp?
|
||
`,tDe=`/**
|
||
* A built-in GLSL floating-point constant for <code>1/pi</code>.
|
||
*
|
||
* @alias czm_oneOverPi
|
||
* @glslConstant
|
||
*
|
||
* @see CesiumMath.ONE_OVER_PI
|
||
*
|
||
* @example
|
||
* // GLSL declaration
|
||
* const float czm_oneOverPi = ...;
|
||
*
|
||
* // Example
|
||
* float pi = 1.0 / czm_oneOverPi;
|
||
*/
|
||
const float czm_oneOverPi = 0.3183098861837907;
|
||
`,nDe=`/**
|
||
* A built-in GLSL floating-point constant for <code>1/2pi</code>.
|
||
*
|
||
* @alias czm_oneOverTwoPi
|
||
* @glslConstant
|
||
*
|
||
* @see CesiumMath.ONE_OVER_TWO_PI
|
||
*
|
||
* @example
|
||
* // GLSL declaration
|
||
* const float czm_oneOverTwoPi = ...;
|
||
*
|
||
* // Example
|
||
* float pi = 2.0 * czm_oneOverTwoPi;
|
||
*/
|
||
const float czm_oneOverTwoPi = 0.15915494309189535;
|
||
`,iDe=`/**
|
||
* The automatic GLSL constant for {@link Pass#CESIUM_3D_TILE}
|
||
*
|
||
* @name czm_passCesium3DTile
|
||
* @glslConstant
|
||
*
|
||
* @see czm_pass
|
||
*/
|
||
const float czm_passCesium3DTile = 4.0;
|
||
`,oDe=`/**
|
||
* The automatic GLSL constant for {@link Pass#CESIUM_3D_TILE_CLASSIFICATION}
|
||
*
|
||
* @name czm_passCesium3DTileClassification
|
||
* @glslConstant
|
||
*
|
||
* @see czm_pass
|
||
*/
|
||
const float czm_passCesium3DTileClassification = 5.0;
|
||
`,rDe=`/**
|
||
* The automatic GLSL constant for {@link Pass#CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW}
|
||
*
|
||
* @name czm_passCesium3DTileClassificationIgnoreShow
|
||
* @glslConstant
|
||
*
|
||
* @see czm_pass
|
||
*/
|
||
const float czm_passCesium3DTileClassificationIgnoreShow = 6.0;
|
||
`,sDe=`/**
|
||
* The automatic GLSL constant for {@link Pass#CLASSIFICATION}
|
||
*
|
||
* @name czm_passClassification
|
||
* @glslConstant
|
||
*
|
||
* @see czm_pass
|
||
*/
|
||
const float czm_passClassification = 7.0;
|
||
`,aDe=`/**
|
||
* The automatic GLSL constant for {@link Pass#COMPUTE}
|
||
*
|
||
* @name czm_passCompute
|
||
* @glslConstant
|
||
*
|
||
* @see czm_pass
|
||
*/
|
||
const float czm_passCompute = 1.0;
|
||
`,cDe=`/**
|
||
* The automatic GLSL constant for {@link Pass#ENVIRONMENT}
|
||
*
|
||
* @name czm_passEnvironment
|
||
* @glslConstant
|
||
*
|
||
* @see czm_pass
|
||
*/
|
||
const float czm_passEnvironment = 0.0;
|
||
`,lDe=`/**
|
||
* The automatic GLSL constant for {@link Pass#GLOBE}
|
||
*
|
||
* @name czm_passGlobe
|
||
* @glslConstant
|
||
*
|
||
* @see czm_pass
|
||
*/
|
||
const float czm_passGlobe = 2.0;
|
||
`,uDe=`/**
|
||
* The automatic GLSL constant for {@link Pass#OPAQUE}
|
||
*
|
||
* @name czm_passOpaque
|
||
* @glslConstant
|
||
*
|
||
* @see czm_pass
|
||
*/
|
||
const float czm_passOpaque = 7.0;
|
||
`,fDe=`/**
|
||
* The automatic GLSL constant for {@link Pass#OVERLAY}
|
||
*
|
||
* @name czm_passOverlay
|
||
* @glslConstant
|
||
*
|
||
* @see czm_pass
|
||
*/
|
||
const float czm_passOverlay = 10.0;
|
||
`,dDe=`/**
|
||
* The automatic GLSL constant for {@link Pass#TERRAIN_CLASSIFICATION}
|
||
*
|
||
* @name czm_passTerrainClassification
|
||
* @glslConstant
|
||
*
|
||
* @see czm_pass
|
||
*/
|
||
const float czm_passTerrainClassification = 3.0;
|
||
`,hDe=`/**
|
||
* The automatic GLSL constant for {@link Pass#TRANSLUCENT}
|
||
*
|
||
* @name czm_passTranslucent
|
||
* @glslConstant
|
||
*
|
||
* @see czm_pass
|
||
*/
|
||
const float czm_passTranslucent = 8.0;
|
||
`,pDe=`/**
|
||
* The automatic GLSL constant for {@link Pass#VOXELS}
|
||
*
|
||
* @name czm_passVoxels
|
||
* @glslConstant
|
||
*
|
||
* @see czm_pass
|
||
*/
|
||
const float czm_passVoxels = 9.0;
|
||
`,mDe=`/**
|
||
* A built-in GLSL floating-point constant for <code>Math.PI</code>.
|
||
*
|
||
* @alias czm_pi
|
||
* @glslConstant
|
||
*
|
||
* @see CesiumMath.PI
|
||
*
|
||
* @example
|
||
* // GLSL declaration
|
||
* const float czm_pi = ...;
|
||
*
|
||
* // Example
|
||
* float twoPi = 2.0 * czm_pi;
|
||
*/
|
||
const float czm_pi = 3.141592653589793;
|
||
`,_De=`/**
|
||
* A built-in GLSL floating-point constant for <code>pi/4</code>.
|
||
*
|
||
* @alias czm_piOverFour
|
||
* @glslConstant
|
||
*
|
||
* @see CesiumMath.PI_OVER_FOUR
|
||
*
|
||
* @example
|
||
* // GLSL declaration
|
||
* const float czm_piOverFour = ...;
|
||
*
|
||
* // Example
|
||
* float pi = 4.0 * czm_piOverFour;
|
||
*/
|
||
const float czm_piOverFour = 0.7853981633974483;
|
||
`,gDe=`/**
|
||
* A built-in GLSL floating-point constant for <code>pi/6</code>.
|
||
*
|
||
* @alias czm_piOverSix
|
||
* @glslConstant
|
||
*
|
||
* @see CesiumMath.PI_OVER_SIX
|
||
*
|
||
* @example
|
||
* // GLSL declaration
|
||
* const float czm_piOverSix = ...;
|
||
*
|
||
* // Example
|
||
* float pi = 6.0 * czm_piOverSix;
|
||
*/
|
||
const float czm_piOverSix = 0.5235987755982988;
|
||
`,yDe=`/**
|
||
* A built-in GLSL floating-point constant for <code>pi/3</code>.
|
||
*
|
||
* @alias czm_piOverThree
|
||
* @glslConstant
|
||
*
|
||
* @see CesiumMath.PI_OVER_THREE
|
||
*
|
||
* @example
|
||
* // GLSL declaration
|
||
* const float czm_piOverThree = ...;
|
||
*
|
||
* // Example
|
||
* float pi = 3.0 * czm_piOverThree;
|
||
*/
|
||
const float czm_piOverThree = 1.0471975511965976;
|
||
`,ADe=`/**
|
||
* A built-in GLSL floating-point constant for <code>pi/2</code>.
|
||
*
|
||
* @alias czm_piOverTwo
|
||
* @glslConstant
|
||
*
|
||
* @see CesiumMath.PI_OVER_TWO
|
||
*
|
||
* @example
|
||
* // GLSL declaration
|
||
* const float czm_piOverTwo = ...;
|
||
*
|
||
* // Example
|
||
* float pi = 2.0 * czm_piOverTwo;
|
||
*/
|
||
const float czm_piOverTwo = 1.5707963267948966;
|
||
`,TDe=`/**
|
||
* A built-in GLSL floating-point constant for converting degrees to radians.
|
||
*
|
||
* @alias czm_radiansPerDegree
|
||
* @glslConstant
|
||
*
|
||
* @see CesiumMath.RADIANS_PER_DEGREE
|
||
*
|
||
* @example
|
||
* // GLSL declaration
|
||
* const float czm_radiansPerDegree = ...;
|
||
*
|
||
* // Example
|
||
* float rad = czm_radiansPerDegree * deg;
|
||
*/
|
||
const float czm_radiansPerDegree = 0.017453292519943295;
|
||
`,CDe=`/**
|
||
* The constant identifier for the 2D {@link SceneMode}
|
||
*
|
||
* @name czm_sceneMode2D
|
||
* @glslConstant
|
||
* @see czm_sceneMode
|
||
* @see czm_sceneModeColumbusView
|
||
* @see czm_sceneMode3D
|
||
* @see czm_sceneModeMorphing
|
||
*/
|
||
const float czm_sceneMode2D = 2.0;
|
||
`,bDe=`/**
|
||
* The constant identifier for the 3D {@link SceneMode}
|
||
*
|
||
* @name czm_sceneMode3D
|
||
* @glslConstant
|
||
* @see czm_sceneMode
|
||
* @see czm_sceneMode2D
|
||
* @see czm_sceneModeColumbusView
|
||
* @see czm_sceneModeMorphing
|
||
*/
|
||
const float czm_sceneMode3D = 3.0;
|
||
`,EDe=`/**
|
||
* The constant identifier for the Columbus View {@link SceneMode}
|
||
*
|
||
* @name czm_sceneModeColumbusView
|
||
* @glslConstant
|
||
* @see czm_sceneMode
|
||
* @see czm_sceneMode2D
|
||
* @see czm_sceneMode3D
|
||
* @see czm_sceneModeMorphing
|
||
*/
|
||
const float czm_sceneModeColumbusView = 1.0;
|
||
`,xDe=`/**
|
||
* The constant identifier for the Morphing {@link SceneMode}
|
||
*
|
||
* @name czm_sceneModeMorphing
|
||
* @glslConstant
|
||
* @see czm_sceneMode
|
||
* @see czm_sceneMode2D
|
||
* @see czm_sceneModeColumbusView
|
||
* @see czm_sceneMode3D
|
||
*/
|
||
const float czm_sceneModeMorphing = 0.0;
|
||
`,wDe=`/**
|
||
* A built-in GLSL floating-point constant for one solar radius.
|
||
*
|
||
* @alias czm_solarRadius
|
||
* @glslConstant
|
||
*
|
||
* @see CesiumMath.SOLAR_RADIUS
|
||
*
|
||
* @example
|
||
* // GLSL declaration
|
||
* const float czm_solarRadius = ...;
|
||
*/
|
||
const float czm_solarRadius = 695500000.0;
|
||
`,SDe=`/**
|
||
* A built-in GLSL floating-point constant for <code>3pi/2</code>.
|
||
*
|
||
* @alias czm_threePiOver2
|
||
* @glslConstant
|
||
*
|
||
* @see CesiumMath.THREE_PI_OVER_TWO
|
||
*
|
||
* @example
|
||
* // GLSL declaration
|
||
* const float czm_threePiOver2 = ...;
|
||
*
|
||
* // Example
|
||
* float pi = (2.0 / 3.0) * czm_threePiOver2;
|
||
*/
|
||
const float czm_threePiOver2 = 4.71238898038469;
|
||
`,vDe=`/**
|
||
* A built-in GLSL floating-point constant for <code>2pi</code>.
|
||
*
|
||
* @alias czm_twoPi
|
||
* @glslConstant
|
||
*
|
||
* @see CesiumMath.TWO_PI
|
||
*
|
||
* @example
|
||
* // GLSL declaration
|
||
* const float czm_twoPi = ...;
|
||
*
|
||
* // Example
|
||
* float pi = czm_twoPi / 2.0;
|
||
*/
|
||
const float czm_twoPi = 6.283185307179586;
|
||
`,DDe=`/**
|
||
* The maximum latitude, in radians, both North and South, supported by a Web Mercator
|
||
* (EPSG:3857) projection. Technically, the Mercator projection is defined
|
||
* for any latitude up to (but not including) 90 degrees, but it makes sense
|
||
* to cut it off sooner because it grows exponentially with increasing latitude.
|
||
* The logic behind this particular cutoff value, which is the one used by
|
||
* Google Maps, Bing Maps, and Esri, is that it makes the projection
|
||
* square. That is, the rectangle is equal in the X and Y directions.
|
||
*
|
||
* The constant value is computed as follows:
|
||
* czm_pi * 0.5 - (2.0 * atan(exp(-czm_pi)))
|
||
*
|
||
* @name czm_webMercatorMaxLatitude
|
||
* @glslConstant
|
||
*/
|
||
const float czm_webMercatorMaxLatitude = 1.4844222297453324;
|
||
`,IDe=`/**
|
||
* @name czm_depthRangeStruct
|
||
* @glslStruct
|
||
*/
|
||
struct czm_depthRangeStruct
|
||
{
|
||
float near;
|
||
float far;
|
||
};
|
||
`,PDe=`/**
|
||
* Holds material information that can be used for lighting. Returned by all czm_getMaterial functions.
|
||
*
|
||
* @name czm_material
|
||
* @glslStruct
|
||
*
|
||
* @property {vec3} diffuse Incoming light that scatters evenly in all directions.
|
||
* @property {float} specular Intensity of incoming light reflecting in a single direction.
|
||
* @property {float} shininess The sharpness of the specular reflection. Higher values create a smaller, more focused specular highlight.
|
||
* @property {vec3} normal Surface's normal in eye coordinates. It is used for effects such as normal mapping. The default is the surface's unmodified normal.
|
||
* @property {vec3} emission Light emitted by the material equally in all directions. The default is vec3(0.0), which emits no light.
|
||
* @property {float} alpha Alpha of this material. 0.0 is completely transparent; 1.0 is completely opaque.
|
||
*/
|
||
struct czm_material
|
||
{
|
||
vec3 diffuse;
|
||
float specular;
|
||
float shininess;
|
||
vec3 normal;
|
||
vec3 emission;
|
||
float alpha;
|
||
};
|
||
`,ODe=`/**
|
||
* Used as input to every material's czm_getMaterial function.
|
||
*
|
||
* @name czm_materialInput
|
||
* @glslStruct
|
||
*
|
||
* @property {float} s 1D texture coordinates.
|
||
* @property {vec2} st 2D texture coordinates.
|
||
* @property {vec3} str 3D texture coordinates.
|
||
* @property {vec3} normalEC Unperturbed surface normal in eye coordinates.
|
||
* @property {mat3} tangentToEyeMatrix Matrix for converting a tangent space normal to eye space.
|
||
* @property {vec3} positionToEyeEC Vector from the fragment to the eye in eye coordinates. The magnitude is the distance in meters from the fragment to the eye.
|
||
* @property {float} height The height of the terrain in meters above or below the WGS84 ellipsoid. Only available for globe materials.
|
||
* @property {float} slope The slope of the terrain in radians. 0 is flat; pi/2 is vertical. Only available for globe materials.
|
||
* @property {float} aspect The aspect of the terrain in radians. 0 is East, pi/2 is North, pi is West, 3pi/2 is South. Only available for globe materials.
|
||
*/
|
||
struct czm_materialInput
|
||
{
|
||
float s;
|
||
vec2 st;
|
||
vec3 str;
|
||
vec3 normalEC;
|
||
mat3 tangentToEyeMatrix;
|
||
vec3 positionToEyeEC;
|
||
float height;
|
||
float slope;
|
||
float aspect;
|
||
};
|
||
`,LDe=`/**
|
||
* Struct for representing a material for a {@link Model}. The model
|
||
* rendering pipeline will pass this struct between material, custom shaders,
|
||
* and lighting stages. This is not to be confused with {@link czm_material}
|
||
* which is used by the older Fabric materials system, although they are similar.
|
||
* <p>
|
||
* All color values (diffuse, specular, emissive) are in linear color space.
|
||
* </p>
|
||
*
|
||
* @name czm_modelMaterial
|
||
* @glslStruct
|
||
*
|
||
* @property {vec3} diffuse Incoming light that scatters evenly in all directions.
|
||
* @property {float} alpha Alpha of this material. 0.0 is completely transparent; 1.0 is completely opaque.
|
||
* @property {vec3} specular Color of reflected light at normal incidence in PBR materials. This is sometimes referred to as f0 in the literature.
|
||
* @property {float} roughness A number from 0.0 to 1.0 representing how rough the surface is. Values near 0.0 produce glossy surfaces, while values near 1.0 produce rough surfaces.
|
||
* @property {vec3} normalEC Surface's normal in eye coordinates. It is used for effects such as normal mapping. The default is the surface's unmodified normal.
|
||
* @property {float} occlusion Ambient occlusion recieved at this point on the material. 1.0 means fully lit, 0.0 means fully occluded.
|
||
* @property {vec3} emissive Light emitted by the material equally in all directions. The default is vec3(0.0), which emits no light.
|
||
*/
|
||
struct czm_modelMaterial {
|
||
vec3 diffuse;
|
||
float alpha;
|
||
vec3 specular;
|
||
float roughness;
|
||
vec3 normalEC;
|
||
float occlusion;
|
||
vec3 emissive;
|
||
};
|
||
`,BDe=`/**
|
||
* Struct for representing the output of a custom vertex shader.
|
||
*
|
||
* @name czm_modelVertexOutput
|
||
* @glslStruct
|
||
*
|
||
* @see {@link CustomShader}
|
||
* @see {@link Model}
|
||
*
|
||
* @property {vec3} positionMC The position of the vertex in model coordinates
|
||
* @property {float} pointSize A custom value for gl_PointSize. This is only used for point primitives.
|
||
*/
|
||
struct czm_modelVertexOutput {
|
||
vec3 positionMC;
|
||
float pointSize;
|
||
};
|
||
`,RDe=`/**
|
||
* Parameters for {@link czm_pbrLighting}
|
||
*
|
||
* @name czm_material
|
||
* @glslStruct
|
||
*
|
||
* @property {vec3} diffuseColor the diffuse color of the material for the lambert term of the rendering equation
|
||
* @property {float} roughness a value from 0.0 to 1.0 that indicates how rough the surface of the material is.
|
||
* @property {vec3} f0 The reflectance of the material at normal incidence
|
||
*/
|
||
struct czm_pbrParameters
|
||
{
|
||
vec3 diffuseColor;
|
||
float roughness;
|
||
vec3 f0;
|
||
};
|
||
`,NDe=`/**
|
||
* DOC_TBA
|
||
*
|
||
* @name czm_ray
|
||
* @glslStruct
|
||
*/
|
||
struct czm_ray
|
||
{
|
||
vec3 origin;
|
||
vec3 direction;
|
||
};
|
||
`,MDe=`/**
|
||
* DOC_TBA
|
||
*
|
||
* @name czm_raySegment
|
||
* @glslStruct
|
||
*/
|
||
struct czm_raySegment
|
||
{
|
||
float start;
|
||
float stop;
|
||
};
|
||
|
||
/**
|
||
* DOC_TBA
|
||
*
|
||
* @name czm_emptyRaySegment
|
||
* @glslConstant
|
||
*/
|
||
const czm_raySegment czm_emptyRaySegment = czm_raySegment(-czm_infinity, -czm_infinity);
|
||
|
||
/**
|
||
* DOC_TBA
|
||
*
|
||
* @name czm_fullRaySegment
|
||
* @glslConstant
|
||
*/
|
||
const czm_raySegment czm_fullRaySegment = czm_raySegment(0.0, czm_infinity);
|
||
`,FDe=`struct czm_shadowParameters
|
||
{
|
||
#ifdef USE_CUBE_MAP_SHADOW
|
||
vec3 texCoords;
|
||
#else
|
||
vec2 texCoords;
|
||
#endif
|
||
|
||
float depthBias;
|
||
float depth;
|
||
float nDotL;
|
||
vec2 texelStepSize;
|
||
float normalShadingSmooth;
|
||
float darkness;
|
||
};
|
||
`,zDe=`/**
|
||
* Converts an HSB color (hue, saturation, brightness) to RGB
|
||
* HSB <-> RGB conversion with minimal branching: {@link http://lolengine.net/blog/2013/07/27/rgb-to-hsv-in-glsl}
|
||
*
|
||
* @name czm_HSBToRGB
|
||
* @glslFunction
|
||
*
|
||
* @param {vec3} hsb The color in HSB.
|
||
*
|
||
* @returns {vec3} The color in RGB.
|
||
*
|
||
* @example
|
||
* vec3 hsb = czm_RGBToHSB(rgb);
|
||
* hsb.z *= 0.1;
|
||
* rgb = czm_HSBToRGB(hsb);
|
||
*/
|
||
|
||
const vec4 K_HSB2RGB = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
|
||
|
||
vec3 czm_HSBToRGB(vec3 hsb)
|
||
{
|
||
vec3 p = abs(fract(hsb.xxx + K_HSB2RGB.xyz) * 6.0 - K_HSB2RGB.www);
|
||
return hsb.z * mix(K_HSB2RGB.xxx, clamp(p - K_HSB2RGB.xxx, 0.0, 1.0), hsb.y);
|
||
}
|
||
`,UDe=`/**
|
||
* Converts an HSL color (hue, saturation, lightness) to RGB
|
||
* HSL <-> RGB conversion: {@link http://www.chilliant.com/rgb2hsv.html}
|
||
*
|
||
* @name czm_HSLToRGB
|
||
* @glslFunction
|
||
*
|
||
* @param {vec3} rgb The color in HSL.
|
||
*
|
||
* @returns {vec3} The color in RGB.
|
||
*
|
||
* @example
|
||
* vec3 hsl = czm_RGBToHSL(rgb);
|
||
* hsl.z *= 0.1;
|
||
* rgb = czm_HSLToRGB(hsl);
|
||
*/
|
||
|
||
vec3 hueToRGB(float hue)
|
||
{
|
||
float r = abs(hue * 6.0 - 3.0) - 1.0;
|
||
float g = 2.0 - abs(hue * 6.0 - 2.0);
|
||
float b = 2.0 - abs(hue * 6.0 - 4.0);
|
||
return clamp(vec3(r, g, b), 0.0, 1.0);
|
||
}
|
||
|
||
vec3 czm_HSLToRGB(vec3 hsl)
|
||
{
|
||
vec3 rgb = hueToRGB(hsl.x);
|
||
float c = (1.0 - abs(2.0 * hsl.z - 1.0)) * hsl.y;
|
||
return (rgb - 0.5) * c + hsl.z;
|
||
}
|
||
`,HDe=`/**
|
||
* Converts an RGB color to HSB (hue, saturation, brightness)
|
||
* HSB <-> RGB conversion with minimal branching: {@link http://lolengine.net/blog/2013/07/27/rgb-to-hsv-in-glsl}
|
||
*
|
||
* @name czm_RGBToHSB
|
||
* @glslFunction
|
||
*
|
||
* @param {vec3} rgb The color in RGB.
|
||
*
|
||
* @returns {vec3} The color in HSB.
|
||
*
|
||
* @example
|
||
* vec3 hsb = czm_RGBToHSB(rgb);
|
||
* hsb.z *= 0.1;
|
||
* rgb = czm_HSBToRGB(hsb);
|
||
*/
|
||
|
||
const vec4 K_RGB2HSB = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
|
||
|
||
vec3 czm_RGBToHSB(vec3 rgb)
|
||
{
|
||
vec4 p = mix(vec4(rgb.bg, K_RGB2HSB.wz), vec4(rgb.gb, K_RGB2HSB.xy), step(rgb.b, rgb.g));
|
||
vec4 q = mix(vec4(p.xyw, rgb.r), vec4(rgb.r, p.yzx), step(p.x, rgb.r));
|
||
|
||
float d = q.x - min(q.w, q.y);
|
||
return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + czm_epsilon7)), d / (q.x + czm_epsilon7), q.x);
|
||
}
|
||
`,VDe=`/**
|
||
* Converts an RGB color to HSL (hue, saturation, lightness)
|
||
* HSL <-> RGB conversion: {@link http://www.chilliant.com/rgb2hsv.html}
|
||
*
|
||
* @name czm_RGBToHSL
|
||
* @glslFunction
|
||
*
|
||
* @param {vec3} rgb The color in RGB.
|
||
*
|
||
* @returns {vec3} The color in HSL.
|
||
*
|
||
* @example
|
||
* vec3 hsl = czm_RGBToHSL(rgb);
|
||
* hsl.z *= 0.1;
|
||
* rgb = czm_HSLToRGB(hsl);
|
||
*/
|
||
|
||
vec3 RGBtoHCV(vec3 rgb)
|
||
{
|
||
// Based on work by Sam Hocevar and Emil Persson
|
||
vec4 p = (rgb.g < rgb.b) ? vec4(rgb.bg, -1.0, 2.0 / 3.0) : vec4(rgb.gb, 0.0, -1.0 / 3.0);
|
||
vec4 q = (rgb.r < p.x) ? vec4(p.xyw, rgb.r) : vec4(rgb.r, p.yzx);
|
||
float c = q.x - min(q.w, q.y);
|
||
float h = abs((q.w - q.y) / (6.0 * c + czm_epsilon7) + q.z);
|
||
return vec3(h, c, q.x);
|
||
}
|
||
|
||
vec3 czm_RGBToHSL(vec3 rgb)
|
||
{
|
||
vec3 hcv = RGBtoHCV(rgb);
|
||
float l = hcv.z - hcv.y * 0.5;
|
||
float s = hcv.y / (1.0 - abs(l * 2.0 - 1.0) + czm_epsilon7);
|
||
return vec3(hcv.x, s, l);
|
||
}
|
||
`,kDe=`/**
|
||
* Converts an RGB color to CIE Yxy.
|
||
* <p>The conversion is described in
|
||
* {@link http://content.gpwiki.org/index.php/D3DBook:High-Dynamic_Range_Rendering#Luminance_Transform|Luminance Transform}
|
||
* </p>
|
||
*
|
||
* @name czm_RGBToXYZ
|
||
* @glslFunction
|
||
*
|
||
* @param {vec3} rgb The color in RGB.
|
||
*
|
||
* @returns {vec3} The color in CIE Yxy.
|
||
*
|
||
* @example
|
||
* vec3 xyz = czm_RGBToXYZ(rgb);
|
||
* xyz.x = max(xyz.x - luminanceThreshold, 0.0);
|
||
* rgb = czm_XYZToRGB(xyz);
|
||
*/
|
||
vec3 czm_RGBToXYZ(vec3 rgb)
|
||
{
|
||
const mat3 RGB2XYZ = mat3(0.4124, 0.2126, 0.0193,
|
||
0.3576, 0.7152, 0.1192,
|
||
0.1805, 0.0722, 0.9505);
|
||
vec3 xyz = RGB2XYZ * rgb;
|
||
vec3 Yxy;
|
||
Yxy.r = xyz.g;
|
||
float temp = dot(vec3(1.0), xyz);
|
||
Yxy.gb = xyz.rg / temp;
|
||
return Yxy;
|
||
}
|
||
`,GDe=`/**
|
||
* Converts a CIE Yxy color to RGB.
|
||
* <p>The conversion is described in
|
||
* {@link http://content.gpwiki.org/index.php/D3DBook:High-Dynamic_Range_Rendering#Luminance_Transform|Luminance Transform}
|
||
* </p>
|
||
*
|
||
* @name czm_XYZToRGB
|
||
* @glslFunction
|
||
*
|
||
* @param {vec3} Yxy The color in CIE Yxy.
|
||
*
|
||
* @returns {vec3} The color in RGB.
|
||
*
|
||
* @example
|
||
* vec3 xyz = czm_RGBToXYZ(rgb);
|
||
* xyz.x = max(xyz.x - luminanceThreshold, 0.0);
|
||
* rgb = czm_XYZToRGB(xyz);
|
||
*/
|
||
vec3 czm_XYZToRGB(vec3 Yxy)
|
||
{
|
||
const mat3 XYZ2RGB = mat3( 3.2405, -0.9693, 0.0556,
|
||
-1.5371, 1.8760, -0.2040,
|
||
-0.4985, 0.0416, 1.0572);
|
||
vec3 xyz;
|
||
xyz.r = Yxy.r * Yxy.g / Yxy.b;
|
||
xyz.g = Yxy.r;
|
||
xyz.b = Yxy.r * (1.0 - Yxy.g - Yxy.b) / Yxy.b;
|
||
|
||
return XYZ2RGB * xyz;
|
||
}
|
||
`,WDe=`// See:
|
||
// https://knarkowicz.wordpress.com/2016/01/06/aces-filmic-tone-mapping-curve/
|
||
|
||
vec3 czm_acesTonemapping(vec3 color) {
|
||
float g = 0.985;
|
||
float a = 0.065;
|
||
float b = 0.0001;
|
||
float c = 0.433;
|
||
float d = 0.238;
|
||
|
||
color = (color * (color + a) - b) / (color * (g * color + c) + d);
|
||
|
||
color = clamp(color, 0.0, 1.0);
|
||
|
||
return color;
|
||
}
|
||
`,qDe=`/**
|
||
* @private
|
||
*/
|
||
float czm_alphaWeight(float a)
|
||
{
|
||
float z = (gl_FragCoord.z - czm_viewportTransformation[3][2]) / czm_viewportTransformation[2][2];
|
||
|
||
// See Weighted Blended Order-Independent Transparency for examples of different weighting functions:
|
||
// http://jcgt.org/published/0002/02/09/
|
||
return pow(a + 0.01, 4.0) + max(1e-2, min(3.0 * 1e3, 0.003 / (1e-5 + pow(abs(z) / 200.0, 4.0))));
|
||
}
|
||
`,jDe=`/**
|
||
* Procedural anti-aliasing by blurring two colors that meet at a sharp edge.
|
||
*
|
||
* @name czm_antialias
|
||
* @glslFunction
|
||
*
|
||
* @param {vec4} color1 The color on one side of the edge.
|
||
* @param {vec4} color2 The color on the other side of the edge.
|
||
* @param {vec4} currentcolor The current color, either <code>color1</code> or <code>color2</code>.
|
||
* @param {float} dist The distance to the edge in texture coordinates.
|
||
* @param {float} [fuzzFactor=0.1] Controls the blurriness between the two colors.
|
||
* @returns {vec4} The anti-aliased color.
|
||
*
|
||
* @example
|
||
* // GLSL declarations
|
||
* vec4 czm_antialias(vec4 color1, vec4 color2, vec4 currentColor, float dist, float fuzzFactor);
|
||
* vec4 czm_antialias(vec4 color1, vec4 color2, vec4 currentColor, float dist);
|
||
*
|
||
* // get the color for a material that has a sharp edge at the line y = 0.5 in texture space
|
||
* float dist = abs(textureCoordinates.t - 0.5);
|
||
* vec4 currentColor = mix(bottomColor, topColor, step(0.5, textureCoordinates.t));
|
||
* vec4 color = czm_antialias(bottomColor, topColor, currentColor, dist, 0.1);
|
||
*/
|
||
vec4 czm_antialias(vec4 color1, vec4 color2, vec4 currentColor, float dist, float fuzzFactor)
|
||
{
|
||
float val1 = clamp(dist / fuzzFactor, 0.0, 1.0);
|
||
float val2 = clamp((dist - 0.5) / fuzzFactor, 0.0, 1.0);
|
||
val1 = val1 * (1.0 - val2);
|
||
val1 = val1 * val1 * (3.0 - (2.0 * val1));
|
||
val1 = pow(val1, 0.5); //makes the transition nicer
|
||
|
||
vec4 midColor = (color1 + color2) * 0.5;
|
||
return mix(midColor, currentColor, val1);
|
||
}
|
||
|
||
vec4 czm_antialias(vec4 color1, vec4 color2, vec4 currentColor, float dist)
|
||
{
|
||
return czm_antialias(color1, color2, currentColor, dist, 0.1);
|
||
}
|
||
`,YDe=`/**
|
||
* Approximately computes spherical coordinates given a normal.
|
||
* Uses approximate inverse trigonometry for speed and consistency,
|
||
* since inverse trigonometry can differ from vendor-to-vendor and when compared with the CPU.
|
||
*
|
||
* @name czm_approximateSphericalCoordinates
|
||
* @glslFunction
|
||
*
|
||
* @param {vec3} normal arbitrary-length normal.
|
||
*
|
||
* @returns {vec2} Approximate latitude and longitude spherical coordinates.
|
||
*/
|
||
vec2 czm_approximateSphericalCoordinates(vec3 normal) {
|
||
// Project into plane with vertical for latitude
|
||
float latitudeApproximation = czm_fastApproximateAtan(sqrt(normal.x * normal.x + normal.y * normal.y), normal.z);
|
||
float longitudeApproximation = czm_fastApproximateAtan(normal.x, normal.y);
|
||
return vec2(latitudeApproximation, longitudeApproximation);
|
||
}
|
||
`,$De=`/**
|
||
* Determines if the fragment is back facing
|
||
*
|
||
* @name czm_backFacing
|
||
* @glslFunction
|
||
*
|
||
* @returns {bool} <code>true</code> if the fragment is back facing; otherwise, <code>false</code>.
|
||
*/
|
||
bool czm_backFacing()
|
||
{
|
||
// !gl_FrontFacing doesn't work as expected on Mac/Intel so use the more verbose form instead. See https://github.com/CesiumGS/cesium/pull/8494.
|
||
return gl_FrontFacing == false;
|
||
}
|
||
`,XDe=`/**
|
||
* Branchless ternary operator to be used when it's inexpensive to explicitly
|
||
* evaluate both possibilities for a float expression.
|
||
*
|
||
* @name czm_branchFreeTernary
|
||
* @glslFunction
|
||
*
|
||
* @param {bool} comparison A comparison statement
|
||
* @param {float} a Value to return if the comparison is true.
|
||
* @param {float} b Value to return if the comparison is false.
|
||
*
|
||
* @returns {float} equivalent of comparison ? a : b
|
||
*/
|
||
float czm_branchFreeTernary(bool comparison, float a, float b) {
|
||
float useA = float(comparison);
|
||
return a * useA + b * (1.0 - useA);
|
||
}
|
||
|
||
/**
|
||
* Branchless ternary operator to be used when it's inexpensive to explicitly
|
||
* evaluate both possibilities for a vec2 expression.
|
||
*
|
||
* @name czm_branchFreeTernary
|
||
* @glslFunction
|
||
*
|
||
* @param {bool} comparison A comparison statement
|
||
* @param {vec2} a Value to return if the comparison is true.
|
||
* @param {vec2} b Value to return if the comparison is false.
|
||
*
|
||
* @returns {vec2} equivalent of comparison ? a : b
|
||
*/
|
||
vec2 czm_branchFreeTernary(bool comparison, vec2 a, vec2 b) {
|
||
float useA = float(comparison);
|
||
return a * useA + b * (1.0 - useA);
|
||
}
|
||
|
||
/**
|
||
* Branchless ternary operator to be used when it's inexpensive to explicitly
|
||
* evaluate both possibilities for a vec3 expression.
|
||
*
|
||
* @name czm_branchFreeTernary
|
||
* @glslFunction
|
||
*
|
||
* @param {bool} comparison A comparison statement
|
||
* @param {vec3} a Value to return if the comparison is true.
|
||
* @param {vec3} b Value to return if the comparison is false.
|
||
*
|
||
* @returns {vec3} equivalent of comparison ? a : b
|
||
*/
|
||
vec3 czm_branchFreeTernary(bool comparison, vec3 a, vec3 b) {
|
||
float useA = float(comparison);
|
||
return a * useA + b * (1.0 - useA);
|
||
}
|
||
|
||
/**
|
||
* Branchless ternary operator to be used when it's inexpensive to explicitly
|
||
* evaluate both possibilities for a vec4 expression.
|
||
*
|
||
* @name czm_branchFreeTernary
|
||
* @glslFunction
|
||
*
|
||
* @param {bool} comparison A comparison statement
|
||
* @param {vec3} a Value to return if the comparison is true.
|
||
* @param {vec3} b Value to return if the comparison is false.
|
||
*
|
||
* @returns {vec3} equivalent of comparison ? a : b
|
||
*/
|
||
vec4 czm_branchFreeTernary(bool comparison, vec4 a, vec4 b) {
|
||
float useA = float(comparison);
|
||
return a * useA + b * (1.0 - useA);
|
||
}
|
||
`,KDe=`
|
||
vec4 czm_cascadeColor(vec4 weights)
|
||
{
|
||
return vec4(1.0, 0.0, 0.0, 1.0) * weights.x +
|
||
vec4(0.0, 1.0, 0.0, 1.0) * weights.y +
|
||
vec4(0.0, 0.0, 1.0, 1.0) * weights.z +
|
||
vec4(1.0, 0.0, 1.0, 1.0) * weights.w;
|
||
}
|
||
`,JDe=`
|
||
uniform vec4 shadowMap_cascadeDistances;
|
||
|
||
float czm_cascadeDistance(vec4 weights)
|
||
{
|
||
return dot(shadowMap_cascadeDistances, weights);
|
||
}
|
||
`,QDe=`
|
||
uniform mat4 shadowMap_cascadeMatrices[4];
|
||
|
||
mat4 czm_cascadeMatrix(vec4 weights)
|
||
{
|
||
return shadowMap_cascadeMatrices[0] * weights.x +
|
||
shadowMap_cascadeMatrices[1] * weights.y +
|
||
shadowMap_cascadeMatrices[2] * weights.z +
|
||
shadowMap_cascadeMatrices[3] * weights.w;
|
||
}
|
||
`,ZDe=`
|
||
uniform vec4 shadowMap_cascadeSplits[2];
|
||
|
||
vec4 czm_cascadeWeights(float depthEye)
|
||
{
|
||
// One component is set to 1.0 and all others set to 0.0.
|
||
vec4 near = step(shadowMap_cascadeSplits[0], vec4(depthEye));
|
||
vec4 far = step(depthEye, shadowMap_cascadeSplits[1]);
|
||
return near * far;
|
||
}
|
||
`,eIe=`/**
|
||
* DOC_TBA
|
||
*
|
||
* @name czm_columbusViewMorph
|
||
* @glslFunction
|
||
*/
|
||
vec4 czm_columbusViewMorph(vec4 position2D, vec4 position3D, float time)
|
||
{
|
||
// Just linear for now.
|
||
vec3 p = mix(position2D.xyz, position3D.xyz, time);
|
||
return vec4(p, 1.0);
|
||
}
|
||
`,tIe=`/**
|
||
* Returns a position in model coordinates relative to eye taking into
|
||
* account the current scene mode: 3D, 2D, or Columbus view.
|
||
* <p>
|
||
* This uses standard position attributes, <code>position3DHigh</code>,
|
||
* <code>position3DLow</code>, <code>position2DHigh</code>, and <code>position2DLow</code>,
|
||
* and should be used when writing a vertex shader for an {@link Appearance}.
|
||
* </p>
|
||
*
|
||
* @name czm_computePosition
|
||
* @glslFunction
|
||
*
|
||
* @returns {vec4} The position relative to eye.
|
||
*
|
||
* @example
|
||
* vec4 p = czm_computePosition();
|
||
* v_positionEC = (czm_modelViewRelativeToEye * p).xyz;
|
||
* gl_Position = czm_modelViewProjectionRelativeToEye * p;
|
||
*
|
||
* @see czm_translateRelativeToEye
|
||
*/
|
||
vec4 czm_computePosition();
|
||
`,nIe=`/**
|
||
* @private
|
||
*/
|
||
vec2 cordic(float angle)
|
||
{
|
||
// Scale the vector by the appropriate factor for the 24 iterations to follow.
|
||
vec2 vector = vec2(6.0725293500888267e-1, 0.0);
|
||
// Iteration 1
|
||
float sense = (angle < 0.0) ? -1.0 : 1.0;
|
||
// float factor = sense * 1.0; // 2^-0
|
||
mat2 rotation = mat2(1.0, sense, -sense, 1.0);
|
||
vector = rotation * vector;
|
||
angle -= sense * 7.8539816339744828e-1; // atan(2^-0)
|
||
// Iteration 2
|
||
sense = (angle < 0.0) ? -1.0 : 1.0;
|
||
float factor = sense * 5.0e-1; // 2^-1
|
||
rotation[0][1] = factor;
|
||
rotation[1][0] = -factor;
|
||
vector = rotation * vector;
|
||
angle -= sense * 4.6364760900080609e-1; // atan(2^-1)
|
||
// Iteration 3
|
||
sense = (angle < 0.0) ? -1.0 : 1.0;
|
||
factor = sense * 2.5e-1; // 2^-2
|
||
rotation[0][1] = factor;
|
||
rotation[1][0] = -factor;
|
||
vector = rotation * vector;
|
||
angle -= sense * 2.4497866312686414e-1; // atan(2^-2)
|
||
// Iteration 4
|
||
sense = (angle < 0.0) ? -1.0 : 1.0;
|
||
factor = sense * 1.25e-1; // 2^-3
|
||
rotation[0][1] = factor;
|
||
rotation[1][0] = -factor;
|
||
vector = rotation * vector;
|
||
angle -= sense * 1.2435499454676144e-1; // atan(2^-3)
|
||
// Iteration 5
|
||
sense = (angle < 0.0) ? -1.0 : 1.0;
|
||
factor = sense * 6.25e-2; // 2^-4
|
||
rotation[0][1] = factor;
|
||
rotation[1][0] = -factor;
|
||
vector = rotation * vector;
|
||
angle -= sense * 6.2418809995957350e-2; // atan(2^-4)
|
||
// Iteration 6
|
||
sense = (angle < 0.0) ? -1.0 : 1.0;
|
||
factor = sense * 3.125e-2; // 2^-5
|
||
rotation[0][1] = factor;
|
||
rotation[1][0] = -factor;
|
||
vector = rotation * vector;
|
||
angle -= sense * 3.1239833430268277e-2; // atan(2^-5)
|
||
// Iteration 7
|
||
sense = (angle < 0.0) ? -1.0 : 1.0;
|
||
factor = sense * 1.5625e-2; // 2^-6
|
||
rotation[0][1] = factor;
|
||
rotation[1][0] = -factor;
|
||
vector = rotation * vector;
|
||
angle -= sense * 1.5623728620476831e-2; // atan(2^-6)
|
||
// Iteration 8
|
||
sense = (angle < 0.0) ? -1.0 : 1.0;
|
||
factor = sense * 7.8125e-3; // 2^-7
|
||
rotation[0][1] = factor;
|
||
rotation[1][0] = -factor;
|
||
vector = rotation * vector;
|
||
angle -= sense * 7.8123410601011111e-3; // atan(2^-7)
|
||
// Iteration 9
|
||
sense = (angle < 0.0) ? -1.0 : 1.0;
|
||
factor = sense * 3.90625e-3; // 2^-8
|
||
rotation[0][1] = factor;
|
||
rotation[1][0] = -factor;
|
||
vector = rotation * vector;
|
||
angle -= sense * 3.9062301319669718e-3; // atan(2^-8)
|
||
// Iteration 10
|
||
sense = (angle < 0.0) ? -1.0 : 1.0;
|
||
factor = sense * 1.953125e-3; // 2^-9
|
||
rotation[0][1] = factor;
|
||
rotation[1][0] = -factor;
|
||
vector = rotation * vector;
|
||
angle -= sense * 1.9531225164788188e-3; // atan(2^-9)
|
||
// Iteration 11
|
||
sense = (angle < 0.0) ? -1.0 : 1.0;
|
||
factor = sense * 9.765625e-4; // 2^-10
|
||
rotation[0][1] = factor;
|
||
rotation[1][0] = -factor;
|
||
vector = rotation * vector;
|
||
angle -= sense * 9.7656218955931946e-4; // atan(2^-10)
|
||
// Iteration 12
|
||
sense = (angle < 0.0) ? -1.0 : 1.0;
|
||
factor = sense * 4.8828125e-4; // 2^-11
|
||
rotation[0][1] = factor;
|
||
rotation[1][0] = -factor;
|
||
vector = rotation * vector;
|
||
angle -= sense * 4.8828121119489829e-4; // atan(2^-11)
|
||
// Iteration 13
|
||
sense = (angle < 0.0) ? -1.0 : 1.0;
|
||
factor = sense * 2.44140625e-4; // 2^-12
|
||
rotation[0][1] = factor;
|
||
rotation[1][0] = -factor;
|
||
vector = rotation * vector;
|
||
angle -= sense * 2.4414062014936177e-4; // atan(2^-12)
|
||
// Iteration 14
|
||
sense = (angle < 0.0) ? -1.0 : 1.0;
|
||
factor = sense * 1.220703125e-4; // 2^-13
|
||
rotation[0][1] = factor;
|
||
rotation[1][0] = -factor;
|
||
vector = rotation * vector;
|
||
angle -= sense * 1.2207031189367021e-4; // atan(2^-13)
|
||
// Iteration 15
|
||
sense = (angle < 0.0) ? -1.0 : 1.0;
|
||
factor = sense * 6.103515625e-5; // 2^-14
|
||
rotation[0][1] = factor;
|
||
rotation[1][0] = -factor;
|
||
vector = rotation * vector;
|
||
angle -= sense * 6.1035156174208773e-5; // atan(2^-14)
|
||
// Iteration 16
|
||
sense = (angle < 0.0) ? -1.0 : 1.0;
|
||
factor = sense * 3.0517578125e-5; // 2^-15
|
||
rotation[0][1] = factor;
|
||
rotation[1][0] = -factor;
|
||
vector = rotation * vector;
|
||
angle -= sense * 3.0517578115526096e-5; // atan(2^-15)
|
||
// Iteration 17
|
||
sense = (angle < 0.0) ? -1.0 : 1.0;
|
||
factor = sense * 1.52587890625e-5; // 2^-16
|
||
rotation[0][1] = factor;
|
||
rotation[1][0] = -factor;
|
||
vector = rotation * vector;
|
||
angle -= sense * 1.5258789061315762e-5; // atan(2^-16)
|
||
// Iteration 18
|
||
sense = (angle < 0.0) ? -1.0 : 1.0;
|
||
factor = sense * 7.62939453125e-6; // 2^-17
|
||
rotation[0][1] = factor;
|
||
rotation[1][0] = -factor;
|
||
vector = rotation * vector;
|
||
angle -= sense * 7.6293945311019700e-6; // atan(2^-17)
|
||
// Iteration 19
|
||
sense = (angle < 0.0) ? -1.0 : 1.0;
|
||
factor = sense * 3.814697265625e-6; // 2^-18
|
||
rotation[0][1] = factor;
|
||
rotation[1][0] = -factor;
|
||
vector = rotation * vector;
|
||
angle -= sense * 3.8146972656064961e-6; // atan(2^-18)
|
||
// Iteration 20
|
||
sense = (angle < 0.0) ? -1.0 : 1.0;
|
||
factor = sense * 1.9073486328125e-6; // 2^-19
|
||
rotation[0][1] = factor;
|
||
rotation[1][0] = -factor;
|
||
vector = rotation * vector;
|
||
angle -= sense * 1.9073486328101870e-6; // atan(2^-19)
|
||
// Iteration 21
|
||
sense = (angle < 0.0) ? -1.0 : 1.0;
|
||
factor = sense * 9.5367431640625e-7; // 2^-20
|
||
rotation[0][1] = factor;
|
||
rotation[1][0] = -factor;
|
||
vector = rotation * vector;
|
||
angle -= sense * 9.5367431640596084e-7; // atan(2^-20)
|
||
// Iteration 22
|
||
sense = (angle < 0.0) ? -1.0 : 1.0;
|
||
factor = sense * 4.76837158203125e-7; // 2^-21
|
||
rotation[0][1] = factor;
|
||
rotation[1][0] = -factor;
|
||
vector = rotation * vector;
|
||
angle -= sense * 4.7683715820308884e-7; // atan(2^-21)
|
||
// Iteration 23
|
||
sense = (angle < 0.0) ? -1.0 : 1.0;
|
||
factor = sense * 2.384185791015625e-7; // 2^-22
|
||
rotation[0][1] = factor;
|
||
rotation[1][0] = -factor;
|
||
vector = rotation * vector;
|
||
angle -= sense * 2.3841857910155797e-7; // atan(2^-22)
|
||
// Iteration 24
|
||
sense = (angle < 0.0) ? -1.0 : 1.0;
|
||
factor = sense * 1.1920928955078125e-7; // 2^-23
|
||
rotation[0][1] = factor;
|
||
rotation[1][0] = -factor;
|
||
vector = rotation * vector;
|
||
// angle -= sense * 1.1920928955078068e-7; // atan(2^-23)
|
||
|
||
return vector;
|
||
}
|
||
|
||
/**
|
||
* Computes the cosine and sine of the provided angle using the CORDIC algorithm.
|
||
*
|
||
* @name czm_cosineAndSine
|
||
* @glslFunction
|
||
*
|
||
* @param {float} angle The angle in radians.
|
||
*
|
||
* @returns {vec2} The resulting cosine of the angle (as the x coordinate) and sine of the angle (as the y coordinate).
|
||
*
|
||
* @example
|
||
* vec2 v = czm_cosineAndSine(czm_piOverSix);
|
||
* float cosine = v.x;
|
||
* float sine = v.y;
|
||
*/
|
||
vec2 czm_cosineAndSine(float angle)
|
||
{
|
||
if (angle < -czm_piOverTwo || angle > czm_piOverTwo)
|
||
{
|
||
if (angle < 0.0)
|
||
{
|
||
return -cordic(angle + czm_pi);
|
||
}
|
||
else
|
||
{
|
||
return -cordic(angle - czm_pi);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
return cordic(angle);
|
||
}
|
||
}
|
||
`,iIe=`/**
|
||
* Decompresses texture coordinates that were packed into a single float.
|
||
*
|
||
* @name czm_decompressTextureCoordinates
|
||
* @glslFunction
|
||
*
|
||
* @param {float} encoded The compressed texture coordinates.
|
||
* @returns {vec2} The decompressed texture coordinates.
|
||
*/
|
||
vec2 czm_decompressTextureCoordinates(float encoded)
|
||
{
|
||
float temp = encoded / 4096.0;
|
||
float xZeroTo4095 = floor(temp);
|
||
float stx = xZeroTo4095 / 4095.0;
|
||
float sty = (encoded - xZeroTo4095 * 4096.0) / 4095.0;
|
||
return vec2(stx, sty);
|
||
}
|
||
`,oIe=`/**
|
||
* Get default parameters for physically based rendering. These defaults
|
||
* describe a rough dielectric (non-metal) surface (e.g. rough plastic).
|
||
*
|
||
* @return {czm_pbrParameters} Default parameters for {@link czm_pbrLighting}
|
||
*/
|
||
czm_pbrParameters czm_defaultPbrMaterial()
|
||
{
|
||
czm_pbrParameters results;
|
||
results.diffuseColor = vec3(1.0);
|
||
results.roughness = 1.0;
|
||
|
||
const vec3 REFLECTANCE_DIELECTRIC = vec3(0.04);
|
||
results.f0 = REFLECTANCE_DIELECTRIC;
|
||
return results;
|
||
}
|
||
`,rIe=`// emulated noperspective
|
||
#if defined(GL_EXT_frag_depth) && !defined(LOG_DEPTH)
|
||
varying float v_WindowZ;
|
||
#endif
|
||
|
||
/**
|
||
* Emulates GL_DEPTH_CLAMP, which is not available in WebGL 1 or 2.
|
||
* GL_DEPTH_CLAMP clamps geometry that is outside the near and far planes,
|
||
* capping the shadow volume. More information here:
|
||
* https://www.khronos.org/registry/OpenGL/extensions/ARB/ARB_depth_clamp.txt.
|
||
*
|
||
* When GL_EXT_frag_depth is available we emulate GL_DEPTH_CLAMP by ensuring
|
||
* no geometry gets clipped by setting the clip space z value to 0.0 and then
|
||
* sending the unaltered screen space z value (using emulated noperspective
|
||
* interpolation) to the frag shader where it is clamped to [0,1] and then
|
||
* written with gl_FragDepth (see czm_writeDepthClamp). This technique is based on:
|
||
* https://stackoverflow.com/questions/5960757/how-to-emulate-gl-depth-clamp-nv.
|
||
*
|
||
* When GL_EXT_frag_depth is not available, which is the case on some mobile
|
||
* devices, we must attempt to fix this only in the vertex shader.
|
||
* The approach is to clamp the z value to the far plane, which closes the
|
||
* shadow volume but also distorts the geometry, so there can still be artifacts
|
||
* on frustum seams.
|
||
*
|
||
* @name czm_depthClamp
|
||
* @glslFunction
|
||
*
|
||
* @param {vec4} coords The vertex in clip coordinates.
|
||
* @returns {vec4} The modified vertex.
|
||
*
|
||
* @example
|
||
* gl_Position = czm_depthClamp(czm_modelViewProjection * vec4(position, 1.0));
|
||
*
|
||
* @see czm_writeDepthClamp
|
||
*/
|
||
vec4 czm_depthClamp(vec4 coords)
|
||
{
|
||
#ifndef LOG_DEPTH
|
||
#ifdef GL_EXT_frag_depth
|
||
v_WindowZ = (0.5 * (coords.z / coords.w) + 0.5) * coords.w;
|
||
coords.z = 0.0;
|
||
#else
|
||
coords.z = min(coords.z, coords.w);
|
||
#endif
|
||
#endif
|
||
return coords;
|
||
}
|
||
`,sIe=`/**
|
||
* Computes a 3x3 rotation matrix that transforms vectors from an ellipsoid's east-north-up coordinate system
|
||
* to eye coordinates. In east-north-up coordinates, x points east, y points north, and z points along the
|
||
* surface normal. East-north-up can be used as an ellipsoid's tangent space for operations such as bump mapping.
|
||
* <br /><br />
|
||
* The ellipsoid is assumed to be centered at the model coordinate's origin.
|
||
*
|
||
* @name czm_eastNorthUpToEyeCoordinates
|
||
* @glslFunction
|
||
*
|
||
* @param {vec3} positionMC The position on the ellipsoid in model coordinates.
|
||
* @param {vec3} normalEC The normalized ellipsoid surface normal, at <code>positionMC</code>, in eye coordinates.
|
||
*
|
||
* @returns {mat3} A 3x3 rotation matrix that transforms vectors from the east-north-up coordinate system to eye coordinates.
|
||
*
|
||
* @example
|
||
* // Transform a vector defined in the east-north-up coordinate
|
||
* // system, (0, 0, 1) which is the surface normal, to eye
|
||
* // coordinates.
|
||
* mat3 m = czm_eastNorthUpToEyeCoordinates(positionMC, normalEC);
|
||
* vec3 normalEC = m * vec3(0.0, 0.0, 1.0);
|
||
*/
|
||
mat3 czm_eastNorthUpToEyeCoordinates(vec3 positionMC, vec3 normalEC)
|
||
{
|
||
vec3 tangentMC = normalize(vec3(-positionMC.y, positionMC.x, 0.0)); // normalized surface tangent in model coordinates
|
||
vec3 tangentEC = normalize(czm_normal3D * tangentMC); // normalized surface tangent in eye coordiantes
|
||
vec3 bitangentEC = normalize(cross(normalEC, tangentEC)); // normalized surface bitangent in eye coordinates
|
||
|
||
return mat3(
|
||
tangentEC.x, tangentEC.y, tangentEC.z,
|
||
bitangentEC.x, bitangentEC.y, bitangentEC.z,
|
||
normalEC.x, normalEC.y, normalEC.z);
|
||
}
|
||
`,aIe=`/**
|
||
* DOC_TBA
|
||
*
|
||
* @name czm_ellipsoidContainsPoint
|
||
* @glslFunction
|
||
*
|
||
*/
|
||
bool czm_ellipsoidContainsPoint(vec3 ellipsoid_inverseRadii, vec3 point)
|
||
{
|
||
vec3 scaled = ellipsoid_inverseRadii * (czm_inverseModelView * vec4(point, 1.0)).xyz;
|
||
return (dot(scaled, scaled) <= 1.0);
|
||
}
|
||
`,cIe=`/**
|
||
* DOC_TBA
|
||
*
|
||
* @name czm_ellipsoidWgs84TextureCoordinates
|
||
* @glslFunction
|
||
*/
|
||
vec2 czm_ellipsoidWgs84TextureCoordinates(vec3 normal)
|
||
{
|
||
return vec2(atan(normal.y, normal.x) * czm_oneOverTwoPi + 0.5, asin(normal.z) * czm_oneOverPi + 0.5);
|
||
}
|
||
`,lIe=`/**
|
||
* Compares <code>left</code> and <code>right</code> componentwise. Returns <code>true</code>
|
||
* if they are within <code>epsilon</code> and <code>false</code> otherwise. The inputs
|
||
* <code>left</code> and <code>right</code> can be <code>float</code>s, <code>vec2</code>s,
|
||
* <code>vec3</code>s, or <code>vec4</code>s.
|
||
*
|
||
* @name czm_equalsEpsilon
|
||
* @glslFunction
|
||
*
|
||
* @param {} left The first vector.
|
||
* @param {} right The second vector.
|
||
* @param {float} epsilon The epsilon to use for equality testing.
|
||
* @returns {bool} <code>true</code> if the components are within <code>epsilon</code> and <code>false</code> otherwise.
|
||
*
|
||
* @example
|
||
* // GLSL declarations
|
||
* bool czm_equalsEpsilon(float left, float right, float epsilon);
|
||
* bool czm_equalsEpsilon(vec2 left, vec2 right, float epsilon);
|
||
* bool czm_equalsEpsilon(vec3 left, vec3 right, float epsilon);
|
||
* bool czm_equalsEpsilon(vec4 left, vec4 right, float epsilon);
|
||
*/
|
||
bool czm_equalsEpsilon(vec4 left, vec4 right, float epsilon) {
|
||
return all(lessThanEqual(abs(left - right), vec4(epsilon)));
|
||
}
|
||
|
||
bool czm_equalsEpsilon(vec3 left, vec3 right, float epsilon) {
|
||
return all(lessThanEqual(abs(left - right), vec3(epsilon)));
|
||
}
|
||
|
||
bool czm_equalsEpsilon(vec2 left, vec2 right, float epsilon) {
|
||
return all(lessThanEqual(abs(left - right), vec2(epsilon)));
|
||
}
|
||
|
||
bool czm_equalsEpsilon(float left, float right, float epsilon) {
|
||
return (abs(left - right) <= epsilon);
|
||
}
|
||
`,uIe=`/**
|
||
* DOC_TBA
|
||
*
|
||
* @name czm_eyeOffset
|
||
* @glslFunction
|
||
*
|
||
* @param {vec4} positionEC DOC_TBA.
|
||
* @param {vec3} eyeOffset DOC_TBA.
|
||
*
|
||
* @returns {vec4} DOC_TBA.
|
||
*/
|
||
vec4 czm_eyeOffset(vec4 positionEC, vec3 eyeOffset)
|
||
{
|
||
// This equation is approximate in x and y.
|
||
vec4 p = positionEC;
|
||
vec4 zEyeOffset = normalize(p) * eyeOffset.z;
|
||
p.xy += eyeOffset.xy + zEyeOffset.xy;
|
||
p.z += zEyeOffset.z;
|
||
return p;
|
||
}
|
||
`,fIe=`/**
|
||
* Transforms a position from eye to window coordinates. The transformation
|
||
* from eye to clip coordinates is done using {@link czm_projection}.
|
||
* The transform from normalized device coordinates to window coordinates is
|
||
* done using {@link czm_viewportTransformation}, which assumes a depth range
|
||
* of <code>near = 0</code> and <code>far = 1</code>.
|
||
* <br /><br />
|
||
* This transform is useful when there is a need to manipulate window coordinates
|
||
* in a vertex shader as done by {@link BillboardCollection}.
|
||
*
|
||
* @name czm_eyeToWindowCoordinates
|
||
* @glslFunction
|
||
*
|
||
* @param {vec4} position The position in eye coordinates to transform.
|
||
*
|
||
* @returns {vec4} The transformed position in window coordinates.
|
||
*
|
||
* @see czm_modelToWindowCoordinates
|
||
* @see czm_projection
|
||
* @see czm_viewportTransformation
|
||
* @see BillboardCollection
|
||
*
|
||
* @example
|
||
* vec4 positionWC = czm_eyeToWindowCoordinates(positionEC);
|
||
*/
|
||
vec4 czm_eyeToWindowCoordinates(vec4 positionEC)
|
||
{
|
||
vec4 q = czm_projection * positionEC; // clip coordinates
|
||
q.xyz /= q.w; // normalized device coordinates
|
||
q.xyz = (czm_viewportTransformation * vec4(q.xyz, 1.0)).xyz; // window coordinates
|
||
return q;
|
||
}
|
||
`,dIe=`/**
|
||
* Approxiamtes atan over the range [0, 1]. Safe to flip output for negative input.
|
||
*
|
||
* Based on Michal Drobot's approximation from ShaderFastLibs, which in turn is based on
|
||
* "Efficient approximations for the arctangent function," Rajan, S. Sichun Wang Inkol, R. Joyal, A., May 2006.
|
||
* Adapted from ShaderFastLibs under MIT License.
|
||
*
|
||
* Chosen for the following characteristics over range [0, 1]:
|
||
* - basically no error at 0 and 1, important for getting around range limit (naive atan2 via atan requires infinite range atan)
|
||
* - no visible artifacts from first-derivative discontinuities, unlike latitude via range-reduced sqrt asin approximations (at equator)
|
||
*
|
||
* The original code is x * (-0.1784 * abs(x) - 0.0663 * x * x + 1.0301);
|
||
* Removed the abs() in here because it isn't needed, the input range is guaranteed as [0, 1] by how we're approximating atan2.
|
||
*
|
||
* @name czm_fastApproximateAtan
|
||
* @glslFunction
|
||
*
|
||
* @param {float} x Value between 0 and 1 inclusive.
|
||
*
|
||
* @returns {float} Approximation of atan(x)
|
||
*/
|
||
float czm_fastApproximateAtan(float x) {
|
||
return x * (-0.1784 * x - 0.0663 * x * x + 1.0301);
|
||
}
|
||
|
||
/**
|
||
* Approximation of atan2.
|
||
*
|
||
* Range reduction math based on nvidia's cg reference implementation for atan2: http://developer.download.nvidia.com/cg/atan2.html
|
||
* However, we replaced their atan curve with Michael Drobot's (see above).
|
||
*
|
||
* @name czm_fastApproximateAtan
|
||
* @glslFunction
|
||
*
|
||
* @param {float} x Value between -1 and 1 inclusive.
|
||
* @param {float} y Value between -1 and 1 inclusive.
|
||
*
|
||
* @returns {float} Approximation of atan2(x, y)
|
||
*/
|
||
float czm_fastApproximateAtan(float x, float y) {
|
||
// atan approximations are usually only reliable over [-1, 1], or, in our case, [0, 1] due to modifications.
|
||
// So range-reduce using abs and by flipping whether x or y is on top.
|
||
float t = abs(x); // t used as swap and atan result.
|
||
float opposite = abs(y);
|
||
float adjacent = max(t, opposite);
|
||
opposite = min(t, opposite);
|
||
|
||
t = czm_fastApproximateAtan(opposite / adjacent);
|
||
|
||
// Undo range reduction
|
||
t = czm_branchFreeTernary(abs(y) > abs(x), czm_piOverTwo - t, t);
|
||
t = czm_branchFreeTernary(x < 0.0, czm_pi - t, t);
|
||
t = czm_branchFreeTernary(y < 0.0, -t, t);
|
||
return t;
|
||
}
|
||
`,hIe=`/**
|
||
* Gets the color with fog at a distance from the camera.
|
||
*
|
||
* @name czm_fog
|
||
* @glslFunction
|
||
*
|
||
* @param {float} distanceToCamera The distance to the camera in meters.
|
||
* @param {vec3} color The original color.
|
||
* @param {vec3} fogColor The color of the fog.
|
||
*
|
||
* @returns {vec3} The color adjusted for fog at the distance from the camera.
|
||
*/
|
||
vec3 czm_fog(float distanceToCamera, vec3 color, vec3 fogColor)
|
||
{
|
||
float scalar = distanceToCamera * czm_fogDensity;
|
||
float fog = 1.0 - exp(-(scalar * scalar));
|
||
return mix(color, fogColor, fog);
|
||
}
|
||
|
||
/**
|
||
* Gets the color with fog at a distance from the camera.
|
||
*
|
||
* @name czm_fog
|
||
* @glslFunction
|
||
*
|
||
* @param {float} distanceToCamera The distance to the camera in meters.
|
||
* @param {vec3} color The original color.
|
||
* @param {vec3} fogColor The color of the fog.
|
||
* @param {float} fogModifierConstant A constant to modify the appearance of fog.
|
||
*
|
||
* @returns {vec3} The color adjusted for fog at the distance from the camera.
|
||
*/
|
||
vec3 czm_fog(float distanceToCamera, vec3 color, vec3 fogColor, float fogModifierConstant)
|
||
{
|
||
float scalar = distanceToCamera * czm_fogDensity;
|
||
float fog = 1.0 - exp(-((fogModifierConstant * scalar + fogModifierConstant) * (scalar * (1.0 + fogModifierConstant))));
|
||
return mix(color, fogColor, fog);
|
||
}
|
||
`,pIe=`/**
|
||
* Converts a color from RGB space to linear space.
|
||
*
|
||
* @name czm_gammaCorrect
|
||
* @glslFunction
|
||
*
|
||
* @param {vec3} color The color in RGB space.
|
||
* @returns {vec3} The color in linear space.
|
||
*/
|
||
vec3 czm_gammaCorrect(vec3 color) {
|
||
#ifdef HDR
|
||
color = pow(color, vec3(czm_gamma));
|
||
#endif
|
||
return color;
|
||
}
|
||
|
||
vec4 czm_gammaCorrect(vec4 color) {
|
||
#ifdef HDR
|
||
color.rgb = pow(color.rgb, vec3(czm_gamma));
|
||
#endif
|
||
return color;
|
||
}
|
||
`,mIe=`/**
|
||
* DOC_TBA
|
||
*
|
||
* @name czm_geodeticSurfaceNormal
|
||
* @glslFunction
|
||
*
|
||
* @param {vec3} positionOnEllipsoid DOC_TBA
|
||
* @param {vec3} ellipsoidCenter DOC_TBA
|
||
* @param {vec3} oneOverEllipsoidRadiiSquared DOC_TBA
|
||
*
|
||
* @returns {vec3} DOC_TBA.
|
||
*/
|
||
vec3 czm_geodeticSurfaceNormal(vec3 positionOnEllipsoid, vec3 ellipsoidCenter, vec3 oneOverEllipsoidRadiiSquared)
|
||
{
|
||
return normalize((positionOnEllipsoid - ellipsoidCenter) * oneOverEllipsoidRadiiSquared);
|
||
}
|
||
`,_Ie=`/**
|
||
* An czm_material with default values. Every material's czm_getMaterial
|
||
* should use this default material as a base for the material it returns.
|
||
* The default normal value is given by materialInput.normalEC.
|
||
*
|
||
* @name czm_getDefaultMaterial
|
||
* @glslFunction
|
||
*
|
||
* @param {czm_materialInput} input The input used to construct the default material.
|
||
*
|
||
* @returns {czm_material} The default material.
|
||
*
|
||
* @see czm_materialInput
|
||
* @see czm_material
|
||
* @see czm_getMaterial
|
||
*/
|
||
czm_material czm_getDefaultMaterial(czm_materialInput materialInput)
|
||
{
|
||
czm_material material;
|
||
material.diffuse = vec3(0.0);
|
||
material.specular = 0.0;
|
||
material.shininess = 1.0;
|
||
material.normal = materialInput.normalEC;
|
||
material.emission = vec3(0.0);
|
||
material.alpha = 1.0;
|
||
return material;
|
||
}
|
||
`,gIe=`/**
|
||
* Calculates the intensity of diffusely reflected light.
|
||
*
|
||
* @name czm_getLambertDiffuse
|
||
* @glslFunction
|
||
*
|
||
* @param {vec3} lightDirectionEC Unit vector pointing to the light source in eye coordinates.
|
||
* @param {vec3} normalEC The surface normal in eye coordinates.
|
||
*
|
||
* @returns {float} The intensity of the diffuse reflection.
|
||
*
|
||
* @see czm_phong
|
||
*
|
||
* @example
|
||
* float diffuseIntensity = czm_getLambertDiffuse(lightDirectionEC, normalEC);
|
||
* float specularIntensity = czm_getSpecular(lightDirectionEC, toEyeEC, normalEC, 200);
|
||
* vec3 color = (diffuseColor * diffuseIntensity) + (specularColor * specularIntensity);
|
||
*/
|
||
float czm_getLambertDiffuse(vec3 lightDirectionEC, vec3 normalEC)
|
||
{
|
||
return max(dot(lightDirectionEC, normalEC), 0.0);
|
||
}
|
||
`,yIe=`/**
|
||
* Calculates the specular intensity of reflected light.
|
||
*
|
||
* @name czm_getSpecular
|
||
* @glslFunction
|
||
*
|
||
* @param {vec3} lightDirectionEC Unit vector pointing to the light source in eye coordinates.
|
||
* @param {vec3} toEyeEC Unit vector pointing to the eye position in eye coordinates.
|
||
* @param {vec3} normalEC The surface normal in eye coordinates.
|
||
* @param {float} shininess The sharpness of the specular reflection. Higher values create a smaller, more focused specular highlight.
|
||
*
|
||
* @returns {float} The intensity of the specular highlight.
|
||
*
|
||
* @see czm_phong
|
||
*
|
||
* @example
|
||
* float diffuseIntensity = czm_getLambertDiffuse(lightDirectionEC, normalEC);
|
||
* float specularIntensity = czm_getSpecular(lightDirectionEC, toEyeEC, normalEC, 200);
|
||
* vec3 color = (diffuseColor * diffuseIntensity) + (specularColor * specularIntensity);
|
||
*/
|
||
float czm_getSpecular(vec3 lightDirectionEC, vec3 toEyeEC, vec3 normalEC, float shininess)
|
||
{
|
||
vec3 toReflectedLight = reflect(-lightDirectionEC, normalEC);
|
||
float specular = max(dot(toReflectedLight, toEyeEC), 0.0);
|
||
|
||
// pow has undefined behavior if both parameters <= 0.
|
||
// Prevent this by making sure shininess is at least czm_epsilon2.
|
||
return pow(specular, max(shininess, czm_epsilon2));
|
||
}
|
||
`,AIe=`/**
|
||
* @private
|
||
*/
|
||
vec4 czm_getWaterNoise(sampler2D normalMap, vec2 uv, float time, float angleInRadians)
|
||
{
|
||
float cosAngle = cos(angleInRadians);
|
||
float sinAngle = sin(angleInRadians);
|
||
|
||
// time dependent sampling directions
|
||
vec2 s0 = vec2(1.0/17.0, 0.0);
|
||
vec2 s1 = vec2(-1.0/29.0, 0.0);
|
||
vec2 s2 = vec2(1.0/101.0, 1.0/59.0);
|
||
vec2 s3 = vec2(-1.0/109.0, -1.0/57.0);
|
||
|
||
// rotate sampling direction by specified angle
|
||
s0 = vec2((cosAngle * s0.x) - (sinAngle * s0.y), (sinAngle * s0.x) + (cosAngle * s0.y));
|
||
s1 = vec2((cosAngle * s1.x) - (sinAngle * s1.y), (sinAngle * s1.x) + (cosAngle * s1.y));
|
||
s2 = vec2((cosAngle * s2.x) - (sinAngle * s2.y), (sinAngle * s2.x) + (cosAngle * s2.y));
|
||
s3 = vec2((cosAngle * s3.x) - (sinAngle * s3.y), (sinAngle * s3.x) + (cosAngle * s3.y));
|
||
|
||
vec2 uv0 = (uv/103.0) + (time * s0);
|
||
vec2 uv1 = uv/107.0 + (time * s1) + vec2(0.23);
|
||
vec2 uv2 = uv/vec2(897.0, 983.0) + (time * s2) + vec2(0.51);
|
||
vec2 uv3 = uv/vec2(991.0, 877.0) + (time * s3) + vec2(0.71);
|
||
|
||
uv0 = fract(uv0);
|
||
uv1 = fract(uv1);
|
||
uv2 = fract(uv2);
|
||
uv3 = fract(uv3);
|
||
vec4 noise = (texture2D(normalMap, uv0)) +
|
||
(texture2D(normalMap, uv1)) +
|
||
(texture2D(normalMap, uv2)) +
|
||
(texture2D(normalMap, uv3));
|
||
|
||
// average and scale to between -1 and 1
|
||
return ((noise / 4.0) - 0.5) * 2.0;
|
||
}
|
||
`,TIe=`/**
|
||
* Adjusts the hue of a color.
|
||
*
|
||
* @name czm_hue
|
||
* @glslFunction
|
||
*
|
||
* @param {vec3} rgb The color.
|
||
* @param {float} adjustment The amount to adjust the hue of the color in radians.
|
||
*
|
||
* @returns {float} The color with the hue adjusted.
|
||
*
|
||
* @example
|
||
* vec3 adjustHue = czm_hue(color, czm_pi); // The same as czm_hue(color, -czm_pi)
|
||
*/
|
||
vec3 czm_hue(vec3 rgb, float adjustment)
|
||
{
|
||
const mat3 toYIQ = mat3(0.299, 0.587, 0.114,
|
||
0.595716, -0.274453, -0.321263,
|
||
0.211456, -0.522591, 0.311135);
|
||
const mat3 toRGB = mat3(1.0, 0.9563, 0.6210,
|
||
1.0, -0.2721, -0.6474,
|
||
1.0, -1.107, 1.7046);
|
||
|
||
vec3 yiq = toYIQ * rgb;
|
||
float hue = atan(yiq.z, yiq.y) + adjustment;
|
||
float chroma = sqrt(yiq.z * yiq.z + yiq.y * yiq.y);
|
||
|
||
vec3 color = vec3(yiq.x, chroma * cos(hue), chroma * sin(hue));
|
||
return toRGB * color;
|
||
}
|
||
`,CIe=`/**
|
||
* Converts a color in linear space to RGB space.
|
||
*
|
||
* @name czm_inverseGamma
|
||
* @glslFunction
|
||
*
|
||
* @param {vec3} color The color in linear space.
|
||
* @returns {vec3} The color in RGB space.
|
||
*/
|
||
vec3 czm_inverseGamma(vec3 color) {
|
||
return pow(color, vec3(1.0 / czm_gamma));
|
||
}
|
||
`,bIe=`/**
|
||
* Determines if a time interval is empty.
|
||
*
|
||
* @name czm_isEmpty
|
||
* @glslFunction
|
||
*
|
||
* @param {czm_raySegment} interval The interval to test.
|
||
*
|
||
* @returns {bool} <code>true</code> if the time interval is empty; otherwise, <code>false</code>.
|
||
*
|
||
* @example
|
||
* bool b0 = czm_isEmpty(czm_emptyRaySegment); // true
|
||
* bool b1 = czm_isEmpty(czm_raySegment(0.0, 1.0)); // false
|
||
* bool b2 = czm_isEmpty(czm_raySegment(1.0, 1.0)); // false, contains 1.0.
|
||
*/
|
||
bool czm_isEmpty(czm_raySegment interval)
|
||
{
|
||
return (interval.stop < 0.0);
|
||
}
|
||
`,EIe=`/**
|
||
* Determines if a time interval is empty.
|
||
*
|
||
* @name czm_isFull
|
||
* @glslFunction
|
||
*
|
||
* @param {czm_raySegment} interval The interval to test.
|
||
*
|
||
* @returns {bool} <code>true</code> if the time interval is empty; otherwise, <code>false</code>.
|
||
*
|
||
* @example
|
||
* bool b0 = czm_isEmpty(czm_emptyRaySegment); // true
|
||
* bool b1 = czm_isEmpty(czm_raySegment(0.0, 1.0)); // false
|
||
* bool b2 = czm_isEmpty(czm_raySegment(1.0, 1.0)); // false, contains 1.0.
|
||
*/
|
||
bool czm_isFull(czm_raySegment interval)
|
||
{
|
||
return (interval.start == 0.0 && interval.stop == czm_infinity);
|
||
}
|
||
`,xIe=`/**
|
||
* Computes the fraction of a Web Wercator rectangle at which a given geodetic latitude is located.
|
||
*
|
||
* @name czm_latitudeToWebMercatorFraction
|
||
* @glslFunction
|
||
*
|
||
* @param {float} latitude The geodetic latitude, in radians.
|
||
* @param {float} southMercatorY The Web Mercator coordinate of the southern boundary of the rectangle.
|
||
* @param {float} oneOverMercatorHeight The total height of the rectangle in Web Mercator coordinates.
|
||
*
|
||
* @returns {float} The fraction of the rectangle at which the latitude occurs. If the latitude is the southern
|
||
* boundary of the rectangle, the return value will be zero. If it is the northern boundary, the return
|
||
* value will be 1.0. Latitudes in between are mapped according to the Web Mercator projection.
|
||
*/
|
||
float czm_latitudeToWebMercatorFraction(float latitude, float southMercatorY, float oneOverMercatorHeight)
|
||
{
|
||
float sinLatitude = sin(latitude);
|
||
float mercatorY = 0.5 * log((1.0 + sinLatitude) / (1.0 - sinLatitude));
|
||
|
||
return (mercatorY - southMercatorY) * oneOverMercatorHeight;
|
||
}
|
||
`,wIe=`/**
|
||
* Computes distance from an point in 2D to a line in 2D.
|
||
*
|
||
* @name czm_lineDistance
|
||
* @glslFunction
|
||
*
|
||
* param {vec2} point1 A point along the line.
|
||
* param {vec2} point2 A point along the line.
|
||
* param {vec2} point A point that may or may not be on the line.
|
||
* returns {float} The distance from the point to the line.
|
||
*/
|
||
float czm_lineDistance(vec2 point1, vec2 point2, vec2 point) {
|
||
return abs((point2.y - point1.y) * point.x - (point2.x - point1.x) * point.y + point2.x * point1.y - point2.y * point1.x) / distance(point2, point1);
|
||
}
|
||
`,SIe=`/**
|
||
* Converts a linear RGB color to an sRGB color.
|
||
*
|
||
* @param {vec3|vec4} linearIn The color in linear color space.
|
||
* @returns {vec3|vec4} The color in sRGB color space. The vector type matches the input.
|
||
*/
|
||
vec3 czm_linearToSrgb(vec3 linearIn)
|
||
{
|
||
return pow(linearIn, vec3(1.0/2.2));
|
||
}
|
||
|
||
vec4 czm_linearToSrgb(vec4 linearIn)
|
||
{
|
||
vec3 srgbOut = pow(linearIn.rgb, vec3(1.0/2.2));
|
||
return vec4(srgbOut, linearIn.a);
|
||
}
|
||
`,vIe=`/**
|
||
* Computes the luminance of a color.
|
||
*
|
||
* @name czm_luminance
|
||
* @glslFunction
|
||
*
|
||
* @param {vec3} rgb The color.
|
||
*
|
||
* @returns {float} The luminance.
|
||
*
|
||
* @example
|
||
* float light = czm_luminance(vec3(0.0)); // 0.0
|
||
* float dark = czm_luminance(vec3(1.0)); // ~1.0
|
||
*/
|
||
float czm_luminance(vec3 rgb)
|
||
{
|
||
// Algorithm from Chapter 10 of Graphics Shaders.
|
||
const vec3 W = vec3(0.2125, 0.7154, 0.0721);
|
||
return dot(rgb, W);
|
||
}
|
||
`,DIe=`/**
|
||
* Computes the size of a pixel in meters at a distance from the eye.
|
||
* <p>
|
||
* Use this version when passing in a custom pixel ratio. For example, passing in 1.0 will return meters per native device pixel.
|
||
* </p>
|
||
* @name czm_metersPerPixel
|
||
* @glslFunction
|
||
*
|
||
* @param {vec3} positionEC The position to get the meters per pixel in eye coordinates.
|
||
* @param {float} pixelRatio The scaling factor from pixel space to coordinate space
|
||
*
|
||
* @returns {float} The meters per pixel at positionEC.
|
||
*/
|
||
float czm_metersPerPixel(vec4 positionEC, float pixelRatio)
|
||
{
|
||
float width = czm_viewport.z;
|
||
float height = czm_viewport.w;
|
||
float pixelWidth;
|
||
float pixelHeight;
|
||
|
||
float top = czm_frustumPlanes.x;
|
||
float bottom = czm_frustumPlanes.y;
|
||
float left = czm_frustumPlanes.z;
|
||
float right = czm_frustumPlanes.w;
|
||
|
||
if (czm_sceneMode == czm_sceneMode2D || czm_orthographicIn3D == 1.0)
|
||
{
|
||
float frustumWidth = right - left;
|
||
float frustumHeight = top - bottom;
|
||
pixelWidth = frustumWidth / width;
|
||
pixelHeight = frustumHeight / height;
|
||
}
|
||
else
|
||
{
|
||
float distanceToPixel = -positionEC.z;
|
||
float inverseNear = 1.0 / czm_currentFrustum.x;
|
||
float tanTheta = top * inverseNear;
|
||
pixelHeight = 2.0 * distanceToPixel * tanTheta / height;
|
||
tanTheta = right * inverseNear;
|
||
pixelWidth = 2.0 * distanceToPixel * tanTheta / width;
|
||
}
|
||
|
||
return max(pixelWidth, pixelHeight) * pixelRatio;
|
||
}
|
||
|
||
/**
|
||
* Computes the size of a pixel in meters at a distance from the eye.
|
||
* <p>
|
||
* Use this version when scaling by pixel ratio.
|
||
* </p>
|
||
* @name czm_metersPerPixel
|
||
* @glslFunction
|
||
*
|
||
* @param {vec3} positionEC The position to get the meters per pixel in eye coordinates.
|
||
*
|
||
* @returns {float} The meters per pixel at positionEC.
|
||
*/
|
||
float czm_metersPerPixel(vec4 positionEC)
|
||
{
|
||
return czm_metersPerPixel(positionEC, czm_pixelRatio);
|
||
}
|
||
`,IIe=`/**
|
||
* Transforms a position from model to window coordinates. The transformation
|
||
* from model to clip coordinates is done using {@link czm_modelViewProjection}.
|
||
* The transform from normalized device coordinates to window coordinates is
|
||
* done using {@link czm_viewportTransformation}, which assumes a depth range
|
||
* of <code>near = 0</code> and <code>far = 1</code>.
|
||
* <br /><br />
|
||
* This transform is useful when there is a need to manipulate window coordinates
|
||
* in a vertex shader as done by {@link BillboardCollection}.
|
||
* <br /><br />
|
||
* This function should not be confused with {@link czm_viewportOrthographic},
|
||
* which is an orthographic projection matrix that transforms from window
|
||
* coordinates to clip coordinates.
|
||
*
|
||
* @name czm_modelToWindowCoordinates
|
||
* @glslFunction
|
||
*
|
||
* @param {vec4} position The position in model coordinates to transform.
|
||
*
|
||
* @returns {vec4} The transformed position in window coordinates.
|
||
*
|
||
* @see czm_eyeToWindowCoordinates
|
||
* @see czm_modelViewProjection
|
||
* @see czm_viewportTransformation
|
||
* @see czm_viewportOrthographic
|
||
* @see BillboardCollection
|
||
*
|
||
* @example
|
||
* vec4 positionWC = czm_modelToWindowCoordinates(positionMC);
|
||
*/
|
||
vec4 czm_modelToWindowCoordinates(vec4 position)
|
||
{
|
||
vec4 q = czm_modelViewProjection * position; // clip coordinates
|
||
q.xyz /= q.w; // normalized device coordinates
|
||
q.xyz = (czm_viewportTransformation * vec4(q.xyz, 1.0)).xyz; // window coordinates
|
||
return q;
|
||
}
|
||
`,PIe=`/**
|
||
* DOC_TBA
|
||
*
|
||
* @name czm_multiplyWithColorBalance
|
||
* @glslFunction
|
||
*/
|
||
vec3 czm_multiplyWithColorBalance(vec3 left, vec3 right)
|
||
{
|
||
// Algorithm from Chapter 10 of Graphics Shaders.
|
||
const vec3 W = vec3(0.2125, 0.7154, 0.0721);
|
||
|
||
vec3 target = left * right;
|
||
float leftLuminance = dot(left, W);
|
||
float rightLuminance = dot(right, W);
|
||
float targetLuminance = dot(target, W);
|
||
|
||
return ((leftLuminance + rightLuminance) / (2.0 * targetLuminance)) * target;
|
||
}
|
||
`,OIe=`/**
|
||
* Computes a value that scales with distance. The scaling is clamped at the near and
|
||
* far distances, and does not extrapolate. This function works with the
|
||
* {@link NearFarScalar} JavaScript class.
|
||
*
|
||
* @name czm_nearFarScalar
|
||
* @glslFunction
|
||
*
|
||
* @param {vec4} nearFarScalar A vector with 4 components: Near distance (x), Near value (y), Far distance (z), Far value (w).
|
||
* @param {float} cameraDistSq The square of the current distance from the camera.
|
||
*
|
||
* @returns {float} The value at this distance.
|
||
*/
|
||
float czm_nearFarScalar(vec4 nearFarScalar, float cameraDistSq)
|
||
{
|
||
float valueAtMin = nearFarScalar.y;
|
||
float valueAtMax = nearFarScalar.w;
|
||
float nearDistanceSq = nearFarScalar.x * nearFarScalar.x;
|
||
float farDistanceSq = nearFarScalar.z * nearFarScalar.z;
|
||
|
||
float t = (cameraDistSq - nearDistanceSq) / (farDistanceSq - nearDistanceSq);
|
||
|
||
t = pow(clamp(t, 0.0, 1.0), 0.2);
|
||
|
||
return mix(valueAtMin, valueAtMax, t);
|
||
}
|
||
`,LIe=` /**
|
||
* Decodes a unit-length vector in 'oct' encoding to a normalized 3-component Cartesian vector.
|
||
* The 'oct' encoding is described in "A Survey of Efficient Representations of Independent Unit Vectors",
|
||
* Cigolle et al 2014: http://jcgt.org/published/0003/02/01/
|
||
*
|
||
* @name czm_octDecode
|
||
* @param {vec2} encoded The oct-encoded, unit-length vector
|
||
* @param {float} range The maximum value of the SNORM range. The encoded vector is stored in log2(rangeMax+1) bits.
|
||
* @returns {vec3} The decoded and normalized vector
|
||
*/
|
||
vec3 czm_octDecode(vec2 encoded, float range)
|
||
{
|
||
if (encoded.x == 0.0 && encoded.y == 0.0) {
|
||
return vec3(0.0, 0.0, 0.0);
|
||
}
|
||
|
||
encoded = encoded / range * 2.0 - 1.0;
|
||
vec3 v = vec3(encoded.x, encoded.y, 1.0 - abs(encoded.x) - abs(encoded.y));
|
||
if (v.z < 0.0)
|
||
{
|
||
v.xy = (1.0 - abs(v.yx)) * czm_signNotZero(v.xy);
|
||
}
|
||
|
||
return normalize(v);
|
||
}
|
||
|
||
/**
|
||
* Decodes a unit-length vector in 'oct' encoding to a normalized 3-component Cartesian vector.
|
||
* The 'oct' encoding is described in "A Survey of Efficient Representations of Independent Unit Vectors",
|
||
* Cigolle et al 2014: http://jcgt.org/published/0003/02/01/
|
||
*
|
||
* @name czm_octDecode
|
||
* @param {vec2} encoded The oct-encoded, unit-length vector
|
||
* @returns {vec3} The decoded and normalized vector
|
||
*/
|
||
vec3 czm_octDecode(vec2 encoded)
|
||
{
|
||
return czm_octDecode(encoded, 255.0);
|
||
}
|
||
|
||
/**
|
||
* Decodes a unit-length vector in 'oct' encoding packed into a floating-point number to a normalized 3-component Cartesian vector.
|
||
* The 'oct' encoding is described in "A Survey of Efficient Representations of Independent Unit Vectors",
|
||
* Cigolle et al 2014: http://jcgt.org/published/0003/02/01/
|
||
*
|
||
* @name czm_octDecode
|
||
* @param {float} encoded The oct-encoded, unit-length vector
|
||
* @returns {vec3} The decoded and normalized vector
|
||
*/
|
||
vec3 czm_octDecode(float encoded)
|
||
{
|
||
float temp = encoded / 256.0;
|
||
float x = floor(temp);
|
||
float y = (temp - x) * 256.0;
|
||
return czm_octDecode(vec2(x, y));
|
||
}
|
||
|
||
/**
|
||
* Decodes three unit-length vectors in 'oct' encoding packed into two floating-point numbers to normalized 3-component Cartesian vectors.
|
||
* The 'oct' encoding is described in "A Survey of Efficient Representations of Independent Unit Vectors",
|
||
* Cigolle et al 2014: http://jcgt.org/published/0003/02/01/
|
||
*
|
||
* @name czm_octDecode
|
||
* @param {vec2} encoded The packed oct-encoded, unit-length vectors.
|
||
* @param {vec3} vector1 One decoded and normalized vector.
|
||
* @param {vec3} vector2 One decoded and normalized vector.
|
||
* @param {vec3} vector3 One decoded and normalized vector.
|
||
*/
|
||
void czm_octDecode(vec2 encoded, out vec3 vector1, out vec3 vector2, out vec3 vector3)
|
||
{
|
||
float temp = encoded.x / 65536.0;
|
||
float x = floor(temp);
|
||
float encodedFloat1 = (temp - x) * 65536.0;
|
||
|
||
temp = encoded.y / 65536.0;
|
||
float y = floor(temp);
|
||
float encodedFloat2 = (temp - y) * 65536.0;
|
||
|
||
vector1 = czm_octDecode(encodedFloat1);
|
||
vector2 = czm_octDecode(encodedFloat2);
|
||
vector3 = czm_octDecode(vec2(x, y));
|
||
}
|
||
|
||
`,BIe=`/**
|
||
* Packs a depth value into a vec3 that can be represented by unsigned bytes.
|
||
*
|
||
* @name czm_packDepth
|
||
* @glslFunction
|
||
*
|
||
* @param {float} depth The floating-point depth.
|
||
* @returns {vec3} The packed depth.
|
||
*/
|
||
vec4 czm_packDepth(float depth)
|
||
{
|
||
// See Aras Pranckevičius' post Encoding Floats to RGBA
|
||
// http://aras-p.info/blog/2009/07/30/encoding-floats-to-rgba-the-final/
|
||
vec4 enc = vec4(1.0, 255.0, 65025.0, 16581375.0) * depth;
|
||
enc = fract(enc);
|
||
enc -= enc.yzww * vec4(1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0, 0.0);
|
||
return enc;
|
||
}
|
||
`,RIe=`vec3 lambertianDiffuse(vec3 diffuseColor)
|
||
{
|
||
return diffuseColor / czm_pi;
|
||
}
|
||
|
||
vec3 fresnelSchlick2(vec3 f0, vec3 f90, float VdotH)
|
||
{
|
||
return f0 + (f90 - f0) * pow(clamp(1.0 - VdotH, 0.0, 1.0), 5.0);
|
||
}
|
||
|
||
float smithVisibilityG1(float NdotV, float roughness)
|
||
{
|
||
// this is the k value for direct lighting.
|
||
// for image based lighting it will be roughness^2 / 2
|
||
float k = (roughness + 1.0) * (roughness + 1.0) / 8.0;
|
||
return NdotV / (NdotV * (1.0 - k) + k);
|
||
}
|
||
|
||
float smithVisibilityGGX(float roughness, float NdotL, float NdotV)
|
||
{
|
||
return (
|
||
smithVisibilityG1(NdotL, roughness) *
|
||
smithVisibilityG1(NdotV, roughness)
|
||
);
|
||
}
|
||
|
||
float GGX(float roughness, float NdotH)
|
||
{
|
||
float roughnessSquared = roughness * roughness;
|
||
float f = (NdotH * roughnessSquared - NdotH) * NdotH + 1.0;
|
||
return roughnessSquared / (czm_pi * f * f);
|
||
}
|
||
|
||
/**
|
||
* Compute the diffuse and specular contributions using physically based
|
||
* rendering. This function only handles direct lighting.
|
||
* <p>
|
||
* This function only handles the lighting calculations. Metallic/roughness
|
||
* and specular/glossy must be handled separately. See {@czm_pbrMetallicRoughnessMaterial}, {@czm_pbrSpecularGlossinessMaterial} and {@czm_defaultPbrMaterial}
|
||
* </p>
|
||
*
|
||
* @name czm_pbrlighting
|
||
* @glslFunction
|
||
*
|
||
* @param {vec3} positionEC The position of the fragment in eye coordinates
|
||
* @param {vec3} normalEC The surface normal in eye coordinates
|
||
* @param {vec3} lightDirectionEC Unit vector pointing to the light source in eye coordinates.
|
||
* @param {vec3} lightColorHdr radiance of the light source. This is a HDR value.
|
||
* @param {czm_pbrParameters} The computed PBR parameters.
|
||
* @return {vec3} The computed HDR color
|
||
*
|
||
* @example
|
||
* czm_pbrParameters pbrParameters = czm_pbrMetallicRoughnessMaterial(
|
||
* baseColor,
|
||
* metallic,
|
||
* roughness
|
||
* );
|
||
* vec3 color = czm_pbrlighting(
|
||
* positionEC,
|
||
* normalEC,
|
||
* lightDirectionEC,
|
||
* lightColorHdr,
|
||
* pbrParameters);
|
||
*/
|
||
vec3 czm_pbrLighting(
|
||
vec3 positionEC,
|
||
vec3 normalEC,
|
||
vec3 lightDirectionEC,
|
||
vec3 lightColorHdr,
|
||
czm_pbrParameters pbrParameters
|
||
)
|
||
{
|
||
vec3 v = -normalize(positionEC);
|
||
vec3 l = normalize(lightDirectionEC);
|
||
vec3 h = normalize(v + l);
|
||
vec3 n = normalEC;
|
||
float NdotL = clamp(dot(n, l), 0.001, 1.0);
|
||
float NdotV = abs(dot(n, v)) + 0.001;
|
||
float NdotH = clamp(dot(n, h), 0.0, 1.0);
|
||
float LdotH = clamp(dot(l, h), 0.0, 1.0);
|
||
float VdotH = clamp(dot(v, h), 0.0, 1.0);
|
||
|
||
vec3 f0 = pbrParameters.f0;
|
||
float reflectance = max(max(f0.r, f0.g), f0.b);
|
||
vec3 f90 = vec3(clamp(reflectance * 25.0, 0.0, 1.0));
|
||
vec3 F = fresnelSchlick2(f0, f90, VdotH);
|
||
|
||
float alpha = pbrParameters.roughness;
|
||
float G = smithVisibilityGGX(alpha, NdotL, NdotV);
|
||
float D = GGX(alpha, NdotH);
|
||
vec3 specularContribution = F * G * D / (4.0 * NdotL * NdotV);
|
||
|
||
vec3 diffuseColor = pbrParameters.diffuseColor;
|
||
// F here represents the specular contribution
|
||
vec3 diffuseContribution = (1.0 - F) * lambertianDiffuse(diffuseColor);
|
||
|
||
// Lo = (diffuse + specular) * Li * NdotL
|
||
return (diffuseContribution + specularContribution) * NdotL * lightColorHdr;
|
||
}
|
||
`,NIe=`/**
|
||
* Compute parameters for physically based rendering using the
|
||
* metallic/roughness workflow. All inputs are linear; sRGB texture values must
|
||
* be decoded beforehand
|
||
*
|
||
* @name czm_pbrMetallicRoughnessMaterial
|
||
* @glslFunction
|
||
*
|
||
* @param {vec3} baseColor For dielectrics, this is the base color. For metals, this is the f0 value (reflectance at normal incidence)
|
||
* @param {float} metallic 0.0 indicates dielectric. 1.0 indicates metal. Values in between are allowed (e.g. to model rust or dirt);
|
||
* @param {float} roughness A value between 0.0 and 1.0
|
||
* @return {czm_pbrParameters} parameters to pass into {@link czm_pbrLighting}
|
||
*/
|
||
czm_pbrParameters czm_pbrMetallicRoughnessMaterial(
|
||
vec3 baseColor,
|
||
float metallic,
|
||
float roughness
|
||
)
|
||
{
|
||
czm_pbrParameters results;
|
||
|
||
// roughness is authored as perceptual roughness
|
||
// square it to get material roughness
|
||
roughness = clamp(roughness, 0.0, 1.0);
|
||
results.roughness = roughness * roughness;
|
||
|
||
// dielectrics use f0 = 0.04, metals use albedo as f0
|
||
metallic = clamp(metallic, 0.0, 1.0);
|
||
const vec3 REFLECTANCE_DIELECTRIC = vec3(0.04);
|
||
vec3 f0 = mix(REFLECTANCE_DIELECTRIC, baseColor, metallic);
|
||
results.f0 = f0;
|
||
|
||
// diffuse only applies to dielectrics.
|
||
results.diffuseColor = baseColor * (1.0 - f0) * (1.0 - metallic);
|
||
|
||
return results;
|
||
}
|
||
`,MIe=`/**
|
||
* Compute parameters for physically based rendering using the
|
||
* specular/glossy workflow. All inputs are linear; sRGB texture values must
|
||
* be decoded beforehand
|
||
*
|
||
* @name czm_pbrSpecularGlossinessMaterial
|
||
* @glslFunction
|
||
*
|
||
* @param {vec3} diffuse The diffuse color for dielectrics (non-metals)
|
||
* @param {vec3} specular The reflectance at normal incidence (f0)
|
||
* @param {float} glossiness A number from 0.0 to 1.0 indicating how smooth the surface is.
|
||
* @return {czm_pbrParameters} parameters to pass into {@link czm_pbrLighting}
|
||
*/
|
||
czm_pbrParameters czm_pbrSpecularGlossinessMaterial(
|
||
vec3 diffuse,
|
||
vec3 specular,
|
||
float glossiness
|
||
)
|
||
{
|
||
czm_pbrParameters results;
|
||
|
||
// glossiness is the opposite of roughness, but easier for artists to use.
|
||
float roughness = 1.0 - glossiness;
|
||
results.roughness = roughness * roughness;
|
||
|
||
results.diffuseColor = diffuse * (1.0 - max(max(specular.r, specular.g), specular.b));
|
||
results.f0 = specular;
|
||
|
||
return results;
|
||
}
|
||
`,FIe=`float czm_private_getLambertDiffuseOfMaterial(vec3 lightDirectionEC, czm_material material)
|
||
{
|
||
return czm_getLambertDiffuse(lightDirectionEC, material.normal);
|
||
}
|
||
|
||
float czm_private_getSpecularOfMaterial(vec3 lightDirectionEC, vec3 toEyeEC, czm_material material)
|
||
{
|
||
return czm_getSpecular(lightDirectionEC, toEyeEC, material.normal, material.shininess);
|
||
}
|
||
|
||
/**
|
||
* Computes a color using the Phong lighting model.
|
||
*
|
||
* @name czm_phong
|
||
* @glslFunction
|
||
*
|
||
* @param {vec3} toEye A normalized vector from the fragment to the eye in eye coordinates.
|
||
* @param {czm_material} material The fragment's material.
|
||
*
|
||
* @returns {vec4} The computed color.
|
||
*
|
||
* @example
|
||
* vec3 positionToEyeEC = // ...
|
||
* czm_material material = // ...
|
||
* vec3 lightDirectionEC = // ...
|
||
* gl_FragColor = czm_phong(normalize(positionToEyeEC), material, lightDirectionEC);
|
||
*
|
||
* @see czm_getMaterial
|
||
*/
|
||
vec4 czm_phong(vec3 toEye, czm_material material, vec3 lightDirectionEC)
|
||
{
|
||
// Diffuse from directional light sources at eye (for top-down)
|
||
float diffuse = czm_private_getLambertDiffuseOfMaterial(vec3(0.0, 0.0, 1.0), material);
|
||
if (czm_sceneMode == czm_sceneMode3D) {
|
||
// (and horizon views in 3D)
|
||
diffuse += czm_private_getLambertDiffuseOfMaterial(vec3(0.0, 1.0, 0.0), material);
|
||
}
|
||
|
||
float specular = czm_private_getSpecularOfMaterial(lightDirectionEC, toEye, material);
|
||
|
||
// Temporary workaround for adding ambient.
|
||
vec3 materialDiffuse = material.diffuse * 0.5;
|
||
|
||
vec3 ambient = materialDiffuse;
|
||
vec3 color = ambient + material.emission;
|
||
color += materialDiffuse * diffuse * czm_lightColor;
|
||
color += material.specular * specular * czm_lightColor;
|
||
|
||
return vec4(color, material.alpha);
|
||
}
|
||
|
||
vec4 czm_private_phong(vec3 toEye, czm_material material, vec3 lightDirectionEC)
|
||
{
|
||
float diffuse = czm_private_getLambertDiffuseOfMaterial(lightDirectionEC, material);
|
||
float specular = czm_private_getSpecularOfMaterial(lightDirectionEC, toEye, material);
|
||
|
||
vec3 ambient = vec3(0.0);
|
||
vec3 color = ambient + material.emission;
|
||
color += material.diffuse * diffuse * czm_lightColor;
|
||
color += material.specular * specular * czm_lightColor;
|
||
|
||
return vec4(color, material.alpha);
|
||
}
|
||
`,zIe=`/**
|
||
* Computes distance from a point to a plane.
|
||
*
|
||
* @name czm_planeDistance
|
||
* @glslFunction
|
||
*
|
||
* param {vec4} plane A Plane in Hessian Normal Form. See Plane.js
|
||
* param {vec3} point A point in the same space as the plane.
|
||
* returns {float} The distance from the point to the plane.
|
||
*/
|
||
float czm_planeDistance(vec4 plane, vec3 point) {
|
||
return (dot(plane.xyz, point) + plane.w);
|
||
}
|
||
|
||
/**
|
||
* Computes distance from a point to a plane.
|
||
*
|
||
* @name czm_planeDistance
|
||
* @glslFunction
|
||
*
|
||
* param {vec3} planeNormal Normal for a plane in Hessian Normal Form. See Plane.js
|
||
* param {float} planeDistance Distance for a plane in Hessian Normal form. See Plane.js
|
||
* param {vec3} point A point in the same space as the plane.
|
||
* returns {float} The distance from the point to the plane.
|
||
*/
|
||
float czm_planeDistance(vec3 planeNormal, float planeDistance, vec3 point) {
|
||
return (dot(planeNormal, point) + planeDistance);
|
||
}
|
||
`,UIe=`/**
|
||
* Computes the point along a ray at the given time. <code>time</code> can be positive, negative, or zero.
|
||
*
|
||
* @name czm_pointAlongRay
|
||
* @glslFunction
|
||
*
|
||
* @param {czm_ray} ray The ray to compute the point along.
|
||
* @param {float} time The time along the ray.
|
||
*
|
||
* @returns {vec3} The point along the ray at the given time.
|
||
*
|
||
* @example
|
||
* czm_ray ray = czm_ray(vec3(0.0), vec3(1.0, 0.0, 0.0)); // origin, direction
|
||
* vec3 v = czm_pointAlongRay(ray, 2.0); // (2.0, 0.0, 0.0)
|
||
*/
|
||
vec3 czm_pointAlongRay(czm_ray ray, float time)
|
||
{
|
||
return ray.origin + (time * ray.direction);
|
||
}
|
||
`,HIe=`/**
|
||
* DOC_TBA
|
||
*
|
||
* @name czm_rayEllipsoidIntersectionInterval
|
||
* @glslFunction
|
||
*/
|
||
czm_raySegment czm_rayEllipsoidIntersectionInterval(czm_ray ray, vec3 ellipsoid_center, vec3 ellipsoid_inverseRadii)
|
||
{
|
||
// ray and ellipsoid center in eye coordinates. radii in model coordinates.
|
||
vec3 q = ellipsoid_inverseRadii * (czm_inverseModelView * vec4(ray.origin, 1.0)).xyz;
|
||
vec3 w = ellipsoid_inverseRadii * (czm_inverseModelView * vec4(ray.direction, 0.0)).xyz;
|
||
|
||
q = q - ellipsoid_inverseRadii * (czm_inverseModelView * vec4(ellipsoid_center, 1.0)).xyz;
|
||
|
||
float q2 = dot(q, q);
|
||
float qw = dot(q, w);
|
||
|
||
if (q2 > 1.0) // Outside ellipsoid.
|
||
{
|
||
if (qw >= 0.0) // Looking outward or tangent (0 intersections).
|
||
{
|
||
return czm_emptyRaySegment;
|
||
}
|
||
else // qw < 0.0.
|
||
{
|
||
float qw2 = qw * qw;
|
||
float difference = q2 - 1.0; // Positively valued.
|
||
float w2 = dot(w, w);
|
||
float product = w2 * difference;
|
||
|
||
if (qw2 < product) // Imaginary roots (0 intersections).
|
||
{
|
||
return czm_emptyRaySegment;
|
||
}
|
||
else if (qw2 > product) // Distinct roots (2 intersections).
|
||
{
|
||
float discriminant = qw * qw - product;
|
||
float temp = -qw + sqrt(discriminant); // Avoid cancellation.
|
||
float root0 = temp / w2;
|
||
float root1 = difference / temp;
|
||
if (root0 < root1)
|
||
{
|
||
czm_raySegment i = czm_raySegment(root0, root1);
|
||
return i;
|
||
}
|
||
else
|
||
{
|
||
czm_raySegment i = czm_raySegment(root1, root0);
|
||
return i;
|
||
}
|
||
}
|
||
else // qw2 == product. Repeated roots (2 intersections).
|
||
{
|
||
float root = sqrt(difference / w2);
|
||
czm_raySegment i = czm_raySegment(root, root);
|
||
return i;
|
||
}
|
||
}
|
||
}
|
||
else if (q2 < 1.0) // Inside ellipsoid (2 intersections).
|
||
{
|
||
float difference = q2 - 1.0; // Negatively valued.
|
||
float w2 = dot(w, w);
|
||
float product = w2 * difference; // Negatively valued.
|
||
float discriminant = qw * qw - product;
|
||
float temp = -qw + sqrt(discriminant); // Positively valued.
|
||
czm_raySegment i = czm_raySegment(0.0, temp / w2);
|
||
return i;
|
||
}
|
||
else // q2 == 1.0. On ellipsoid.
|
||
{
|
||
if (qw < 0.0) // Looking inward.
|
||
{
|
||
float w2 = dot(w, w);
|
||
czm_raySegment i = czm_raySegment(0.0, -qw / w2);
|
||
return i;
|
||
}
|
||
else // qw >= 0.0. Looking outward or tangent.
|
||
{
|
||
return czm_emptyRaySegment;
|
||
}
|
||
}
|
||
}
|
||
`,VIe=`/**
|
||
* Compute the intersection interval of a ray with a sphere.
|
||
*
|
||
* @name czm_raySphereIntersectionInterval
|
||
* @glslFunction
|
||
*
|
||
* @param {czm_ray} ray The ray.
|
||
* @param {vec3} center The center of the sphere.
|
||
* @param {float} radius The radius of the sphere.
|
||
* @return {czm_raySegment} The intersection interval of the ray with the sphere.
|
||
*/
|
||
czm_raySegment czm_raySphereIntersectionInterval(czm_ray ray, vec3 center, float radius)
|
||
{
|
||
vec3 o = ray.origin;
|
||
vec3 d = ray.direction;
|
||
|
||
vec3 oc = o - center;
|
||
|
||
float a = dot(d, d);
|
||
float b = 2.0 * dot(d, oc);
|
||
float c = dot(oc, oc) - (radius * radius);
|
||
|
||
float det = (b * b) - (4.0 * a * c);
|
||
|
||
if (det < 0.0) {
|
||
return czm_emptyRaySegment;
|
||
}
|
||
|
||
float sqrtDet = sqrt(det);
|
||
|
||
float t0 = (-b - sqrtDet) / (2.0 * a);
|
||
float t1 = (-b + sqrtDet) / (2.0 * a);
|
||
|
||
czm_raySegment result = czm_raySegment(t0, t1);
|
||
return result;
|
||
}
|
||
`,kIe=`float czm_readDepth(sampler2D depthTexture, vec2 texCoords)
|
||
{
|
||
return czm_reverseLogDepth(texture2D(depthTexture, texCoords).r);
|
||
}
|
||
`,GIe=`/**
|
||
* Reads a value previously transformed with {@link czm_writeNonPerspective}
|
||
* by dividing it by \`w\`, the value used in the perspective divide.
|
||
* This function is intended to be called in a fragment shader to access a
|
||
* \`varying\` that should not be subject to perspective interpolation.
|
||
* For example, screen-space texture coordinates. The value should have been
|
||
* previously written in the vertex shader with a call to
|
||
* {@link czm_writeNonPerspective}.
|
||
*
|
||
* @name czm_readNonPerspective
|
||
* @glslFunction
|
||
*
|
||
* @param {float|vec2|vec3|vec4} value The non-perspective value to be read.
|
||
* @param {float} oneOverW One over the perspective divide value, \`w\`. Usually this is simply \`gl_FragCoord.w\`.
|
||
* @returns {float|vec2|vec3|vec4} The usable value.
|
||
*/
|
||
float czm_readNonPerspective(float value, float oneOverW) {
|
||
return value * oneOverW;
|
||
}
|
||
|
||
vec2 czm_readNonPerspective(vec2 value, float oneOverW) {
|
||
return value * oneOverW;
|
||
}
|
||
|
||
vec3 czm_readNonPerspective(vec3 value, float oneOverW) {
|
||
return value * oneOverW;
|
||
}
|
||
|
||
vec4 czm_readNonPerspective(vec4 value, float oneOverW) {
|
||
return value * oneOverW;
|
||
}
|
||
`,WIe=`float czm_reverseLogDepth(float logZ)
|
||
{
|
||
#ifdef LOG_DEPTH
|
||
float near = czm_currentFrustum.x;
|
||
float far = czm_currentFrustum.y;
|
||
float log2Depth = logZ * czm_log2FarDepthFromNearPlusOne;
|
||
float depthFromNear = pow(2.0, log2Depth) - 1.0;
|
||
return far * (1.0 - near / (depthFromNear + near)) / (far - near);
|
||
#endif
|
||
return logZ;
|
||
}
|
||
`,qIe=`/**
|
||
* Round a floating point value. This function exists because round() doesn't
|
||
* exist in GLSL 1.00.
|
||
*
|
||
* @param {float|vec2|vec3|vec4} value The value to round
|
||
* @param {float|vec2|vec3|vec3} The rounded value. The type matches the input.
|
||
*/
|
||
float czm_round(float value) {
|
||
return floor(value + 0.5);
|
||
}
|
||
|
||
vec2 czm_round(vec2 value) {
|
||
return floor(value + 0.5);
|
||
}
|
||
|
||
vec3 czm_round(vec3 value) {
|
||
return floor(value + 0.5);
|
||
}
|
||
|
||
vec4 czm_round(vec4 value) {
|
||
return floor(value + 0.5);
|
||
}
|
||
`,jIe=`/**
|
||
* Samples the 4 neighboring pixels and return the weighted average.
|
||
*
|
||
* @private
|
||
*/
|
||
vec3 czm_sampleOctahedralProjectionWithFiltering(sampler2D projectedMap, vec2 textureSize, vec3 direction, float lod)
|
||
{
|
||
direction /= dot(vec3(1.0), abs(direction));
|
||
vec2 rev = abs(direction.zx) - vec2(1.0);
|
||
vec2 neg = vec2(direction.x < 0.0 ? rev.x : -rev.x,
|
||
direction.z < 0.0 ? rev.y : -rev.y);
|
||
vec2 uv = direction.y < 0.0 ? neg : direction.xz;
|
||
vec2 coord = 0.5 * uv + vec2(0.5);
|
||
vec2 pixel = 1.0 / textureSize;
|
||
|
||
if (lod > 0.0)
|
||
{
|
||
// Each subseqeuent mip level is half the size
|
||
float scale = 1.0 / pow(2.0, lod);
|
||
float offset = ((textureSize.y + 1.0) / textureSize.x);
|
||
|
||
coord.x *= offset;
|
||
coord *= scale;
|
||
|
||
coord.x += offset + pixel.x;
|
||
coord.y += (1.0 - (1.0 / pow(2.0, lod - 1.0))) + pixel.y * (lod - 1.0) * 2.0;
|
||
}
|
||
else
|
||
{
|
||
coord.x *= (textureSize.y / textureSize.x);
|
||
}
|
||
|
||
// Do bilinear filtering
|
||
#ifndef OES_texture_float_linear
|
||
vec3 color1 = texture2D(projectedMap, coord + vec2(0.0, pixel.y)).rgb;
|
||
vec3 color2 = texture2D(projectedMap, coord + vec2(pixel.x, 0.0)).rgb;
|
||
vec3 color3 = texture2D(projectedMap, coord + pixel).rgb;
|
||
vec3 color4 = texture2D(projectedMap, coord).rgb;
|
||
|
||
vec2 texturePosition = coord * textureSize;
|
||
|
||
float fu = fract(texturePosition.x);
|
||
float fv = fract(texturePosition.y);
|
||
|
||
vec3 average1 = mix(color4, color2, fu);
|
||
vec3 average2 = mix(color1, color3, fu);
|
||
|
||
vec3 color = mix(average1, average2, fv);
|
||
#else
|
||
vec3 color = texture2D(projectedMap, coord).rgb;
|
||
#endif
|
||
|
||
return color;
|
||
}
|
||
|
||
|
||
/**
|
||
* Samples from a cube map that has been projected using an octahedral projection from the given direction.
|
||
*
|
||
* @name czm_sampleOctahedralProjection
|
||
* @glslFunction
|
||
*
|
||
* @param {sampler2D} projectedMap The texture with the octahedral projected cube map.
|
||
* @param {vec2} textureSize The width and height dimensions in pixels of the projected map.
|
||
* @param {vec3} direction The normalized direction used to sample the cube map.
|
||
* @param {float} lod The level of detail to sample.
|
||
* @param {float} maxLod The maximum level of detail.
|
||
* @returns {vec3} The color of the cube map at the direction.
|
||
*/
|
||
vec3 czm_sampleOctahedralProjection(sampler2D projectedMap, vec2 textureSize, vec3 direction, float lod, float maxLod) {
|
||
float currentLod = floor(lod + 0.5);
|
||
float nextLod = min(currentLod + 1.0, maxLod);
|
||
|
||
vec3 colorCurrentLod = czm_sampleOctahedralProjectionWithFiltering(projectedMap, textureSize, direction, currentLod);
|
||
vec3 colorNextLod = czm_sampleOctahedralProjectionWithFiltering(projectedMap, textureSize, direction, nextLod);
|
||
|
||
return mix(colorNextLod, colorCurrentLod, nextLod - lod);
|
||
}
|
||
`,YIe=`/**
|
||
* Adjusts the saturation of a color.
|
||
*
|
||
* @name czm_saturation
|
||
* @glslFunction
|
||
*
|
||
* @param {vec3} rgb The color.
|
||
* @param {float} adjustment The amount to adjust the saturation of the color.
|
||
*
|
||
* @returns {float} The color with the saturation adjusted.
|
||
*
|
||
* @example
|
||
* vec3 greyScale = czm_saturation(color, 0.0);
|
||
* vec3 doubleSaturation = czm_saturation(color, 2.0);
|
||
*/
|
||
vec3 czm_saturation(vec3 rgb, float adjustment)
|
||
{
|
||
// Algorithm from Chapter 16 of OpenGL Shading Language
|
||
const vec3 W = vec3(0.2125, 0.7154, 0.0721);
|
||
vec3 intensity = vec3(dot(rgb, W));
|
||
return mix(intensity, rgb, adjustment);
|
||
}
|
||
`,$Ie=`
|
||
float czm_sampleShadowMap(highp samplerCube shadowMap, vec3 d)
|
||
{
|
||
return czm_unpackDepth(textureCube(shadowMap, d));
|
||
}
|
||
|
||
float czm_sampleShadowMap(highp sampler2D shadowMap, vec2 uv)
|
||
{
|
||
#ifdef USE_SHADOW_DEPTH_TEXTURE
|
||
return texture2D(shadowMap, uv).r;
|
||
#else
|
||
return czm_unpackDepth(texture2D(shadowMap, uv));
|
||
#endif
|
||
}
|
||
|
||
float czm_shadowDepthCompare(samplerCube shadowMap, vec3 uv, float depth)
|
||
{
|
||
return step(depth, czm_sampleShadowMap(shadowMap, uv));
|
||
}
|
||
|
||
float czm_shadowDepthCompare(sampler2D shadowMap, vec2 uv, float depth)
|
||
{
|
||
return step(depth, czm_sampleShadowMap(shadowMap, uv));
|
||
}
|
||
`,XIe=`
|
||
float czm_private_shadowVisibility(float visibility, float nDotL, float normalShadingSmooth, float darkness)
|
||
{
|
||
#ifdef USE_NORMAL_SHADING
|
||
#ifdef USE_NORMAL_SHADING_SMOOTH
|
||
float strength = clamp(nDotL / normalShadingSmooth, 0.0, 1.0);
|
||
#else
|
||
float strength = step(0.0, nDotL);
|
||
#endif
|
||
visibility *= strength;
|
||
#endif
|
||
|
||
visibility = max(visibility, darkness);
|
||
return visibility;
|
||
}
|
||
|
||
#ifdef USE_CUBE_MAP_SHADOW
|
||
float czm_shadowVisibility(samplerCube shadowMap, czm_shadowParameters shadowParameters)
|
||
{
|
||
float depthBias = shadowParameters.depthBias;
|
||
float depth = shadowParameters.depth;
|
||
float nDotL = shadowParameters.nDotL;
|
||
float normalShadingSmooth = shadowParameters.normalShadingSmooth;
|
||
float darkness = shadowParameters.darkness;
|
||
vec3 uvw = shadowParameters.texCoords;
|
||
|
||
depth -= depthBias;
|
||
float visibility = czm_shadowDepthCompare(shadowMap, uvw, depth);
|
||
return czm_private_shadowVisibility(visibility, nDotL, normalShadingSmooth, darkness);
|
||
}
|
||
#else
|
||
float czm_shadowVisibility(sampler2D shadowMap, czm_shadowParameters shadowParameters)
|
||
{
|
||
float depthBias = shadowParameters.depthBias;
|
||
float depth = shadowParameters.depth;
|
||
float nDotL = shadowParameters.nDotL;
|
||
float normalShadingSmooth = shadowParameters.normalShadingSmooth;
|
||
float darkness = shadowParameters.darkness;
|
||
vec2 uv = shadowParameters.texCoords;
|
||
|
||
depth -= depthBias;
|
||
#ifdef USE_SOFT_SHADOWS
|
||
vec2 texelStepSize = shadowParameters.texelStepSize;
|
||
float radius = 1.0;
|
||
float dx0 = -texelStepSize.x * radius;
|
||
float dy0 = -texelStepSize.y * radius;
|
||
float dx1 = texelStepSize.x * radius;
|
||
float dy1 = texelStepSize.y * radius;
|
||
float visibility = (
|
||
czm_shadowDepthCompare(shadowMap, uv, depth) +
|
||
czm_shadowDepthCompare(shadowMap, uv + vec2(dx0, dy0), depth) +
|
||
czm_shadowDepthCompare(shadowMap, uv + vec2(0.0, dy0), depth) +
|
||
czm_shadowDepthCompare(shadowMap, uv + vec2(dx1, dy0), depth) +
|
||
czm_shadowDepthCompare(shadowMap, uv + vec2(dx0, 0.0), depth) +
|
||
czm_shadowDepthCompare(shadowMap, uv + vec2(dx1, 0.0), depth) +
|
||
czm_shadowDepthCompare(shadowMap, uv + vec2(dx0, dy1), depth) +
|
||
czm_shadowDepthCompare(shadowMap, uv + vec2(0.0, dy1), depth) +
|
||
czm_shadowDepthCompare(shadowMap, uv + vec2(dx1, dy1), depth)
|
||
) * (1.0 / 9.0);
|
||
#else
|
||
float visibility = czm_shadowDepthCompare(shadowMap, uv, depth);
|
||
#endif
|
||
|
||
return czm_private_shadowVisibility(visibility, nDotL, normalShadingSmooth, darkness);
|
||
}
|
||
#endif
|
||
`,KIe=`/**
|
||
* Returns 1.0 if the given value is positive or zero, and -1.0 if it is negative. This is similar to the GLSL
|
||
* built-in function <code>sign</code> except that returns 1.0 instead of 0.0 when the input value is 0.0.
|
||
*
|
||
* @name czm_signNotZero
|
||
* @glslFunction
|
||
*
|
||
* @param {} value The value for which to determine the sign.
|
||
* @returns {} 1.0 if the value is positive or zero, -1.0 if the value is negative.
|
||
*/
|
||
float czm_signNotZero(float value)
|
||
{
|
||
return value >= 0.0 ? 1.0 : -1.0;
|
||
}
|
||
|
||
vec2 czm_signNotZero(vec2 value)
|
||
{
|
||
return vec2(czm_signNotZero(value.x), czm_signNotZero(value.y));
|
||
}
|
||
|
||
vec3 czm_signNotZero(vec3 value)
|
||
{
|
||
return vec3(czm_signNotZero(value.x), czm_signNotZero(value.y), czm_signNotZero(value.z));
|
||
}
|
||
|
||
vec4 czm_signNotZero(vec4 value)
|
||
{
|
||
return vec4(czm_signNotZero(value.x), czm_signNotZero(value.y), czm_signNotZero(value.z), czm_signNotZero(value.w));
|
||
}
|
||
`,JIe=`/**
|
||
* Computes a color from the third order spherical harmonic coefficients and a normalized direction vector.
|
||
* <p>
|
||
* The order of the coefficients is [L00, L1_1, L10, L11, L2_2, L2_1, L20, L21, L22].
|
||
* </p>
|
||
*
|
||
* @name czm_sphericalHarmonics
|
||
* @glslFunction
|
||
*
|
||
* @param {vec3} normal The normalized direction.
|
||
* @param {vec3[9]} coefficients The third order spherical harmonic coefficients.
|
||
* @returns {vec3} The color at the direction.
|
||
*
|
||
* @see https://graphics.stanford.edu/papers/envmap/envmap.pdf
|
||
*/
|
||
vec3 czm_sphericalHarmonics(vec3 normal, vec3 coefficients[9])
|
||
{
|
||
vec3 L00 = coefficients[0];
|
||
vec3 L1_1 = coefficients[1];
|
||
vec3 L10 = coefficients[2];
|
||
vec3 L11 = coefficients[3];
|
||
vec3 L2_2 = coefficients[4];
|
||
vec3 L2_1 = coefficients[5];
|
||
vec3 L20 = coefficients[6];
|
||
vec3 L21 = coefficients[7];
|
||
vec3 L22 = coefficients[8];
|
||
|
||
float x = normal.x;
|
||
float y = normal.y;
|
||
float z = normal.z;
|
||
|
||
return
|
||
L00
|
||
+ L1_1 * y
|
||
+ L10 * z
|
||
+ L11 * x
|
||
+ L2_2 * (y * x)
|
||
+ L2_1 * (y * z)
|
||
+ L20 * (3.0 * z * z - 1.0)
|
||
+ L21 * (z * x)
|
||
+ L22 * (x * x - y * y);
|
||
}
|
||
`,QIe=`/**
|
||
* Converts an sRGB color to a linear RGB color.
|
||
*
|
||
* @param {vec3|vec4} srgbIn The color in sRGB space
|
||
* @returns {vec3|vec4} The color in linear color space. The vector type matches the input.
|
||
*/
|
||
vec3 czm_srgbToLinear(vec3 srgbIn)
|
||
{
|
||
return pow(srgbIn, vec3(2.2));
|
||
}
|
||
|
||
vec4 czm_srgbToLinear(vec4 srgbIn)
|
||
{
|
||
vec3 linearOut = pow(srgbIn.rgb, vec3(2.2));
|
||
return vec4(linearOut, srgbIn.a);
|
||
}
|
||
`,ZIe=`/**
|
||
* Creates a matrix that transforms vectors from tangent space to eye space.
|
||
*
|
||
* @name czm_tangentToEyeSpaceMatrix
|
||
* @glslFunction
|
||
*
|
||
* @param {vec3} normalEC The normal vector in eye coordinates.
|
||
* @param {vec3} tangentEC The tangent vector in eye coordinates.
|
||
* @param {vec3} bitangentEC The bitangent vector in eye coordinates.
|
||
*
|
||
* @returns {mat3} The matrix that transforms from tangent space to eye space.
|
||
*
|
||
* @example
|
||
* mat3 tangentToEye = czm_tangentToEyeSpaceMatrix(normalEC, tangentEC, bitangentEC);
|
||
* vec3 normal = tangentToEye * texture2D(normalMap, st).xyz;
|
||
*/
|
||
mat3 czm_tangentToEyeSpaceMatrix(vec3 normalEC, vec3 tangentEC, vec3 bitangentEC)
|
||
{
|
||
vec3 normal = normalize(normalEC);
|
||
vec3 tangent = normalize(tangentEC);
|
||
vec3 bitangent = normalize(bitangentEC);
|
||
return mat3(tangent.x , tangent.y , tangent.z,
|
||
bitangent.x, bitangent.y, bitangent.z,
|
||
normal.x , normal.y , normal.z);
|
||
}
|
||
`,e1e=`/**
|
||
* Transforms a plane.
|
||
*
|
||
* @name czm_transformPlane
|
||
* @glslFunction
|
||
*
|
||
* @param {vec4} plane The plane in Hessian Normal Form.
|
||
* @param {mat4} transform The inverse-transpose of a transformation matrix.
|
||
*/
|
||
vec4 czm_transformPlane(vec4 plane, mat4 transform) {
|
||
vec4 transformedPlane = transform * plane;
|
||
// Convert the transformed plane to Hessian Normal Form
|
||
float normalMagnitude = length(transformedPlane.xyz);
|
||
return transformedPlane / normalMagnitude;
|
||
}
|
||
`,t1e=`/**
|
||
* Translates a position (or any <code>vec3</code>) that was encoded with {@link EncodedCartesian3},
|
||
* and then provided to the shader as separate <code>high</code> and <code>low</code> bits to
|
||
* be relative to the eye. As shown in the example, the position can then be transformed in eye
|
||
* or clip coordinates using {@link czm_modelViewRelativeToEye} or {@link czm_modelViewProjectionRelativeToEye},
|
||
* respectively.
|
||
* <p>
|
||
* This technique, called GPU RTE, eliminates jittering artifacts when using large coordinates as
|
||
* described in {@link http://help.agi.com/AGIComponents/html/BlogPrecisionsPrecisions.htm|Precisions, Precisions}.
|
||
* </p>
|
||
*
|
||
* @name czm_translateRelativeToEye
|
||
* @glslFunction
|
||
*
|
||
* @param {vec3} high The position's high bits.
|
||
* @param {vec3} low The position's low bits.
|
||
* @returns {vec3} The position translated to be relative to the camera's position.
|
||
*
|
||
* @example
|
||
* attribute vec3 positionHigh;
|
||
* attribute vec3 positionLow;
|
||
*
|
||
* void main()
|
||
* {
|
||
* vec4 p = czm_translateRelativeToEye(positionHigh, positionLow);
|
||
* gl_Position = czm_modelViewProjectionRelativeToEye * p;
|
||
* }
|
||
*
|
||
* @see czm_modelViewRelativeToEye
|
||
* @see czm_modelViewProjectionRelativeToEye
|
||
* @see czm_computePosition
|
||
* @see EncodedCartesian3
|
||
*/
|
||
vec4 czm_translateRelativeToEye(vec3 high, vec3 low)
|
||
{
|
||
vec3 highDifference = high - czm_encodedCameraPositionMCHigh;
|
||
vec3 lowDifference = low - czm_encodedCameraPositionMCLow;
|
||
|
||
return vec4(highDifference + lowDifference, 1.0);
|
||
}
|
||
`,n1e=`/**
|
||
* @private
|
||
*/
|
||
vec4 czm_translucentPhong(vec3 toEye, czm_material material, vec3 lightDirectionEC)
|
||
{
|
||
// Diffuse from directional light sources at eye (for top-down and horizon views)
|
||
float diffuse = czm_getLambertDiffuse(vec3(0.0, 0.0, 1.0), material.normal);
|
||
|
||
if (czm_sceneMode == czm_sceneMode3D) {
|
||
// (and horizon views in 3D)
|
||
diffuse += czm_getLambertDiffuse(vec3(0.0, 1.0, 0.0), material.normal);
|
||
}
|
||
|
||
diffuse = clamp(diffuse, 0.0, 1.0);
|
||
|
||
float specular = czm_getSpecular(lightDirectionEC, toEye, material.normal, material.shininess);
|
||
|
||
// Temporary workaround for adding ambient.
|
||
vec3 materialDiffuse = material.diffuse * 0.5;
|
||
|
||
vec3 ambient = materialDiffuse;
|
||
vec3 color = ambient + material.emission;
|
||
color += materialDiffuse * diffuse * czm_lightColor;
|
||
color += material.specular * specular * czm_lightColor;
|
||
|
||
return vec4(color, material.alpha);
|
||
}
|
||
`,i1e=`/**
|
||
* Returns the transpose of the matrix. The input <code>matrix</code> can be
|
||
* a <code>mat2</code>, <code>mat3</code>, or <code>mat4</code>.
|
||
*
|
||
* @name czm_transpose
|
||
* @glslFunction
|
||
*
|
||
* @param {} matrix The matrix to transpose.
|
||
*
|
||
* @returns {} The transposed matrix.
|
||
*
|
||
* @example
|
||
* // GLSL declarations
|
||
* mat2 czm_transpose(mat2 matrix);
|
||
* mat3 czm_transpose(mat3 matrix);
|
||
* mat4 czm_transpose(mat4 matrix);
|
||
*
|
||
* // Transpose a 3x3 rotation matrix to find its inverse.
|
||
* mat3 eastNorthUpToEye = czm_eastNorthUpToEyeCoordinates(
|
||
* positionMC, normalEC);
|
||
* mat3 eyeToEastNorthUp = czm_transpose(eastNorthUpToEye);
|
||
*/
|
||
mat2 czm_transpose(mat2 matrix)
|
||
{
|
||
return mat2(
|
||
matrix[0][0], matrix[1][0],
|
||
matrix[0][1], matrix[1][1]);
|
||
}
|
||
|
||
mat3 czm_transpose(mat3 matrix)
|
||
{
|
||
return mat3(
|
||
matrix[0][0], matrix[1][0], matrix[2][0],
|
||
matrix[0][1], matrix[1][1], matrix[2][1],
|
||
matrix[0][2], matrix[1][2], matrix[2][2]);
|
||
}
|
||
|
||
mat4 czm_transpose(mat4 matrix)
|
||
{
|
||
return mat4(
|
||
matrix[0][0], matrix[1][0], matrix[2][0], matrix[3][0],
|
||
matrix[0][1], matrix[1][1], matrix[2][1], matrix[3][1],
|
||
matrix[0][2], matrix[1][2], matrix[2][2], matrix[3][2],
|
||
matrix[0][3], matrix[1][3], matrix[2][3], matrix[3][3]);
|
||
}
|
||
`,o1e=`/**
|
||
* Unpacks a vec4 depth value to a float in [0, 1) range.
|
||
*
|
||
* @name czm_unpackDepth
|
||
* @glslFunction
|
||
*
|
||
* @param {vec4} packedDepth The packed depth.
|
||
*
|
||
* @returns {float} The floating-point depth in [0, 1) range.
|
||
*/
|
||
float czm_unpackDepth(vec4 packedDepth)
|
||
{
|
||
// See Aras Pranckevičius' post Encoding Floats to RGBA
|
||
// http://aras-p.info/blog/2009/07/30/encoding-floats-to-rgba-the-final/
|
||
return dot(packedDepth, vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0));
|
||
}
|
||
`,r1e=`/**
|
||
* Unpack an IEEE 754 single-precision float that is packed as a little-endian unsigned normalized vec4.
|
||
*
|
||
* @name czm_unpackFloat
|
||
* @glslFunction
|
||
*
|
||
* @param {vec4} packedFloat The packed float.
|
||
*
|
||
* @returns {float} The floating-point depth in arbitrary range.
|
||
*/
|
||
float czm_unpackFloat(vec4 packedFloat)
|
||
{
|
||
// Convert to [0.0, 255.0] and round to integer
|
||
packedFloat = floor(packedFloat * 255.0 + 0.5);
|
||
float sign = 1.0 - step(128.0, packedFloat[3]) * 2.0;
|
||
float exponent = 2.0 * mod(packedFloat[3], 128.0) + step(128.0, packedFloat[2]) - 127.0;
|
||
if (exponent == -127.0)
|
||
{
|
||
return 0.0;
|
||
}
|
||
float mantissa = mod(packedFloat[2], 128.0) * 65536.0 + packedFloat[1] * 256.0 + packedFloat[0] + float(0x800000);
|
||
float result = sign * exp2(exponent - 23.0) * mantissa;
|
||
return result;
|
||
}
|
||
`,s1e=`/**
|
||
* Unpack unsigned integers of 1-4 bytes. in WebGL 1, there is no uint type,
|
||
* so the return value is an int.
|
||
* <p>
|
||
* There are also precision limitations in WebGL 1. highp int is still limited
|
||
* to 24 bits. Above the value of 2^24 = 16777216, precision loss may occur.
|
||
* </p>
|
||
*
|
||
* @param {float|vec2|vec3|vec4} packed The packed value. For vectors, the components are listed in little-endian order.
|
||
*
|
||
* @return {int} The unpacked value.
|
||
*/
|
||
int czm_unpackUint(float packedValue) {
|
||
float rounded = czm_round(packedValue * 255.0);
|
||
return int(rounded);
|
||
}
|
||
|
||
int czm_unpackUint(vec2 packedValue) {
|
||
vec2 rounded = czm_round(packedValue * 255.0);
|
||
return int(dot(rounded, vec2(1.0, 256.0)));
|
||
}
|
||
|
||
int czm_unpackUint(vec3 packedValue) {
|
||
vec3 rounded = czm_round(packedValue * 255.0);
|
||
return int(dot(rounded, vec3(1.0, 256.0, 65536.0)));
|
||
}
|
||
|
||
int czm_unpackUint(vec4 packedValue) {
|
||
vec4 rounded = czm_round(packedValue * 255.0);
|
||
return int(dot(rounded, vec4(1.0, 256.0, 65536.0, 16777216.0)));
|
||
}
|
||
`,a1e=`/**
|
||
* Transform metadata values following the EXT_structural_metadata spec
|
||
* by multiplying by scale and adding the offset. Operations are always
|
||
* performed component-wise, even for matrices.
|
||
*
|
||
* @param {float|vec2|vec3|vec4|mat2|mat3|mat4} offset The offset to add
|
||
* @param {float|vec2|vec3|vec4|mat2|mat3|mat4} scale The scale factor to multiply
|
||
* @param {float|vec2|vec3|vec4|mat2|mat3|mat4} value The original value.
|
||
*
|
||
* @return {float|vec2|vec3|vec4|mat2|mat3|mat4} The transformed value of the same scalar/vector/matrix type as the input.
|
||
*/
|
||
float czm_valueTransform(float offset, float scale, float value) {
|
||
return scale * value + offset;
|
||
}
|
||
|
||
vec2 czm_valueTransform(vec2 offset, vec2 scale, vec2 value) {
|
||
return scale * value + offset;
|
||
}
|
||
|
||
vec3 czm_valueTransform(vec3 offset, vec3 scale, vec3 value) {
|
||
return scale * value + offset;
|
||
}
|
||
|
||
vec4 czm_valueTransform(vec4 offset, vec4 scale, vec4 value) {
|
||
return scale * value + offset;
|
||
}
|
||
|
||
mat2 czm_valueTransform(mat2 offset, mat2 scale, mat2 value) {
|
||
return matrixCompMult(scale, value) + offset;
|
||
}
|
||
|
||
mat3 czm_valueTransform(mat3 offset, mat3 scale, mat3 value) {
|
||
return matrixCompMult(scale, value) + offset;
|
||
}
|
||
|
||
mat4 czm_valueTransform(mat4 offset, mat4 scale, mat4 value) {
|
||
return matrixCompMult(scale, value) + offset;
|
||
}
|
||
`,c1e=`#ifdef LOG_DEPTH
|
||
// 1.0 at the near plane, increasing linearly from there.
|
||
varying float v_depthFromNearPlusOne;
|
||
#ifdef SHADOW_MAP
|
||
varying vec3 v_logPositionEC;
|
||
#endif
|
||
#endif
|
||
|
||
vec4 czm_updatePositionDepth(vec4 coords) {
|
||
#if defined(LOG_DEPTH)
|
||
|
||
#ifdef SHADOW_MAP
|
||
vec3 logPositionEC = (czm_inverseProjection * coords).xyz;
|
||
v_logPositionEC = logPositionEC;
|
||
#endif
|
||
|
||
// With the very high far/near ratios used with the logarithmic depth
|
||
// buffer, floating point rounding errors can cause linear depth values
|
||
// to end up on the wrong side of the far plane, even for vertices that
|
||
// are really nowhere near it. Since we always write a correct logarithmic
|
||
// depth value in the fragment shader anyway, we just need to make sure
|
||
// such errors don't cause the primitive to be clipped entirely before
|
||
// we even get to the fragment shader.
|
||
coords.z = clamp(coords.z / coords.w, -1.0, 1.0) * coords.w;
|
||
#endif
|
||
|
||
return coords;
|
||
}
|
||
|
||
/**
|
||
* Writes the logarithmic depth to gl_Position using the already computed gl_Position.
|
||
*
|
||
* @name czm_vertexLogDepth
|
||
* @glslFunction
|
||
*/
|
||
void czm_vertexLogDepth()
|
||
{
|
||
#ifdef LOG_DEPTH
|
||
v_depthFromNearPlusOne = (gl_Position.w - czm_currentFrustum.x) + 1.0;
|
||
gl_Position = czm_updatePositionDepth(gl_Position);
|
||
#endif
|
||
}
|
||
|
||
/**
|
||
* Writes the logarithmic depth to gl_Position using the provided clip coordinates.
|
||
* <p>
|
||
* An example use case for this function would be moving the vertex in window coordinates
|
||
* before converting back to clip coordinates. Use the original vertex clip coordinates.
|
||
* </p>
|
||
* @name czm_vertexLogDepth
|
||
* @glslFunction
|
||
*
|
||
* @param {vec4} clipCoords The vertex in clip coordinates.
|
||
*
|
||
* @example
|
||
* czm_vertexLogDepth(czm_projection * vec4(positionEyeCoordinates, 1.0));
|
||
*/
|
||
void czm_vertexLogDepth(vec4 clipCoords)
|
||
{
|
||
#ifdef LOG_DEPTH
|
||
v_depthFromNearPlusOne = (clipCoords.w - czm_currentFrustum.x) + 1.0;
|
||
czm_updatePositionDepth(clipCoords);
|
||
#endif
|
||
}
|
||
`,l1e=`vec4 czm_screenToEyeCoordinates(vec4 screenCoordinate)
|
||
{
|
||
// Reconstruct NDC coordinates
|
||
float x = 2.0 * screenCoordinate.x - 1.0;
|
||
float y = 2.0 * screenCoordinate.y - 1.0;
|
||
float z = (screenCoordinate.z - czm_viewportTransformation[3][2]) / czm_viewportTransformation[2][2];
|
||
vec4 q = vec4(x, y, z, 1.0);
|
||
|
||
// Reverse the perspective division to obtain clip coordinates.
|
||
q /= screenCoordinate.w;
|
||
|
||
// Reverse the projection transformation to obtain eye coordinates.
|
||
if (!(czm_inverseProjection == mat4(0.0))) // IE and Edge sometimes do something weird with != between mat4s
|
||
{
|
||
q = czm_inverseProjection * q;
|
||
}
|
||
else
|
||
{
|
||
float top = czm_frustumPlanes.x;
|
||
float bottom = czm_frustumPlanes.y;
|
||
float left = czm_frustumPlanes.z;
|
||
float right = czm_frustumPlanes.w;
|
||
|
||
float near = czm_currentFrustum.x;
|
||
float far = czm_currentFrustum.y;
|
||
|
||
q.x = (q.x * (right - left) + left + right) * 0.5;
|
||
q.y = (q.y * (top - bottom) + bottom + top) * 0.5;
|
||
q.z = (q.z * (near - far) - near - far) * 0.5;
|
||
q.w = 1.0;
|
||
}
|
||
|
||
return q;
|
||
}
|
||
|
||
/**
|
||
* Transforms a position from window to eye coordinates.
|
||
* The transform from window to normalized device coordinates is done using components
|
||
* of (@link czm_viewport} and {@link czm_viewportTransformation} instead of calculating
|
||
* the inverse of <code>czm_viewportTransformation</code>. The transformation from
|
||
* normalized device coordinates to clip coordinates is done using <code>fragmentCoordinate.w</code>,
|
||
* which is expected to be the scalar used in the perspective divide. The transformation
|
||
* from clip to eye coordinates is done using {@link czm_inverseProjection}.
|
||
*
|
||
* @name czm_windowToEyeCoordinates
|
||
* @glslFunction
|
||
*
|
||
* @param {vec4} fragmentCoordinate The position in window coordinates to transform.
|
||
*
|
||
* @returns {vec4} The transformed position in eye coordinates.
|
||
*
|
||
* @see czm_modelToWindowCoordinates
|
||
* @see czm_eyeToWindowCoordinates
|
||
* @see czm_inverseProjection
|
||
* @see czm_viewport
|
||
* @see czm_viewportTransformation
|
||
*
|
||
* @example
|
||
* vec4 positionEC = czm_windowToEyeCoordinates(gl_FragCoord);
|
||
*/
|
||
vec4 czm_windowToEyeCoordinates(vec4 fragmentCoordinate)
|
||
{
|
||
vec2 screenCoordXY = (fragmentCoordinate.xy - czm_viewport.xy) / czm_viewport.zw;
|
||
return czm_screenToEyeCoordinates(vec4(screenCoordXY, fragmentCoordinate.zw));
|
||
}
|
||
|
||
vec4 czm_screenToEyeCoordinates(vec2 screenCoordinateXY, float depthOrLogDepth)
|
||
{
|
||
// See reverseLogDepth.glsl. This is separate to re-use the pow.
|
||
#if defined(LOG_DEPTH) || defined(LOG_DEPTH_READ_ONLY)
|
||
float near = czm_currentFrustum.x;
|
||
float far = czm_currentFrustum.y;
|
||
float log2Depth = depthOrLogDepth * czm_log2FarDepthFromNearPlusOne;
|
||
float depthFromNear = pow(2.0, log2Depth) - 1.0;
|
||
float depthFromCamera = depthFromNear + near;
|
||
vec4 screenCoord = vec4(screenCoordinateXY, far * (1.0 - near / depthFromCamera) / (far - near), 1.0);
|
||
vec4 eyeCoordinate = czm_screenToEyeCoordinates(screenCoord);
|
||
eyeCoordinate.w = 1.0 / depthFromCamera; // Better precision
|
||
return eyeCoordinate;
|
||
#else
|
||
vec4 screenCoord = vec4(screenCoordinateXY, depthOrLogDepth, 1.0);
|
||
vec4 eyeCoordinate = czm_screenToEyeCoordinates(screenCoord);
|
||
#endif
|
||
return eyeCoordinate;
|
||
}
|
||
|
||
/**
|
||
* Transforms a position given as window x/y and a depth or a log depth from window to eye coordinates.
|
||
* This function produces more accurate results for window positions with log depth than
|
||
* conventionally unpacking the log depth using czm_reverseLogDepth and using the standard version
|
||
* of czm_windowToEyeCoordinates.
|
||
*
|
||
* @name czm_windowToEyeCoordinates
|
||
* @glslFunction
|
||
*
|
||
* @param {vec2} fragmentCoordinateXY The XY position in window coordinates to transform.
|
||
* @param {float} depthOrLogDepth A depth or log depth for the fragment.
|
||
*
|
||
* @see czm_modelToWindowCoordinates
|
||
* @see czm_eyeToWindowCoordinates
|
||
* @see czm_inverseProjection
|
||
* @see czm_viewport
|
||
* @see czm_viewportTransformation
|
||
*
|
||
* @returns {vec4} The transformed position in eye coordinates.
|
||
*/
|
||
vec4 czm_windowToEyeCoordinates(vec2 fragmentCoordinateXY, float depthOrLogDepth)
|
||
{
|
||
vec2 screenCoordXY = (fragmentCoordinateXY.xy - czm_viewport.xy) / czm_viewport.zw;
|
||
return czm_screenToEyeCoordinates(screenCoordXY, depthOrLogDepth);
|
||
}
|
||
`,u1e=`// emulated noperspective
|
||
#if defined(GL_EXT_frag_depth) && !defined(LOG_DEPTH)
|
||
varying float v_WindowZ;
|
||
#endif
|
||
|
||
/**
|
||
* Emulates GL_DEPTH_CLAMP. Clamps a fragment to the near and far plane
|
||
* by writing the fragment's depth. See czm_depthClamp for more details.
|
||
* <p>
|
||
* The shader must enable the GL_EXT_frag_depth extension.
|
||
* </p>
|
||
*
|
||
* @name czm_writeDepthClamp
|
||
* @glslFunction
|
||
*
|
||
* @example
|
||
* gl_FragColor = color;
|
||
* czm_writeDepthClamp();
|
||
*
|
||
* @see czm_depthClamp
|
||
*/
|
||
void czm_writeDepthClamp()
|
||
{
|
||
#if defined(GL_EXT_frag_depth) && !defined(LOG_DEPTH)
|
||
gl_FragDepthEXT = clamp(v_WindowZ * gl_FragCoord.w, 0.0, 1.0);
|
||
#endif
|
||
}
|
||
`,f1e=`#ifdef LOG_DEPTH
|
||
varying float v_depthFromNearPlusOne;
|
||
|
||
#ifdef POLYGON_OFFSET
|
||
uniform vec2 u_polygonOffset;
|
||
#ifdef GL_OES_standard_derivatives
|
||
#extension GL_OES_standard_derivatives : enable
|
||
#endif
|
||
#endif
|
||
|
||
#endif
|
||
|
||
/**
|
||
* Writes the fragment depth to the logarithmic depth buffer.
|
||
* <p>
|
||
* Use this when the vertex shader does not call {@link czm_vertexlogDepth}, for example, when
|
||
* ray-casting geometry using a full screen quad.
|
||
* </p>
|
||
* @name czm_writeLogDepth
|
||
* @glslFunction
|
||
*
|
||
* @param {float} depth The depth coordinate, where 1.0 is on the near plane and
|
||
* depth increases in eye-space units from there
|
||
*
|
||
* @example
|
||
* czm_writeLogDepth((czm_projection * v_positionEyeCoordinates).w + 1.0);
|
||
*/
|
||
void czm_writeLogDepth(float depth)
|
||
{
|
||
#if defined(GL_EXT_frag_depth) && defined(LOG_DEPTH)
|
||
// Discard the vertex if it's not between the near and far planes.
|
||
// We allow a bit of epsilon on the near plane comparison because a 1.0
|
||
// from the vertex shader (indicating the vertex should be _on_ the near
|
||
// plane) will not necessarily come here as exactly 1.0.
|
||
if (depth <= 0.9999999 || depth > czm_farDepthFromNearPlusOne) {
|
||
discard;
|
||
}
|
||
|
||
#ifdef POLYGON_OFFSET
|
||
// Polygon offset: m * factor + r * units
|
||
float factor = u_polygonOffset[0];
|
||
float units = u_polygonOffset[1];
|
||
|
||
// If we can't compute derivatives, just leave out the factor I guess?
|
||
#ifdef GL_OES_standard_derivatives
|
||
if (factor != 0.0) {
|
||
// m = sqrt(dZdX^2 + dZdY^2);
|
||
float x = dFdx(depth);
|
||
float y = dFdy(depth);
|
||
float m = sqrt(x * x + y * y);
|
||
|
||
// Apply the factor before computing the log depth.
|
||
depth += m * factor;
|
||
}
|
||
#endif
|
||
|
||
#endif
|
||
|
||
gl_FragDepthEXT = log2(depth) * czm_oneOverLog2FarDepthFromNearPlusOne;
|
||
|
||
#ifdef POLYGON_OFFSET
|
||
// Apply the units after the log depth.
|
||
gl_FragDepthEXT += czm_epsilon7 * units;
|
||
#endif
|
||
|
||
#endif
|
||
}
|
||
|
||
/**
|
||
* Writes the fragment depth to the logarithmic depth buffer.
|
||
* <p>
|
||
* Use this when the vertex shader calls {@link czm_vertexlogDepth}.
|
||
* </p>
|
||
*
|
||
* @name czm_writeLogDepth
|
||
* @glslFunction
|
||
*/
|
||
void czm_writeLogDepth() {
|
||
#ifdef LOG_DEPTH
|
||
czm_writeLogDepth(v_depthFromNearPlusOne);
|
||
#endif
|
||
}
|
||
`,d1e=`/**
|
||
* Transforms a value for non-perspective interpolation by multiplying
|
||
* it by w, the value used in the perspective divide. This function is
|
||
* intended to be called in a vertex shader to compute the value of a
|
||
* \`varying\` that should not be subject to perspective interpolation.
|
||
* For example, screen-space texture coordinates. The fragment shader
|
||
* must call {@link czm_readNonPerspective} to retrieve the final
|
||
* non-perspective value.
|
||
*
|
||
* @name czm_writeNonPerspective
|
||
* @glslFunction
|
||
*
|
||
* @param {float|vec2|vec3|vec4} value The value to be interpolated without accounting for perspective.
|
||
* @param {float} w The perspective divide value. Usually this is the computed \`gl_Position.w\`.
|
||
* @returns {float|vec2|vec3|vec4} The transformed value, intended to be stored in a \`varying\` and read in the
|
||
* fragment shader with {@link czm_readNonPerspective}.
|
||
*/
|
||
float czm_writeNonPerspective(float value, float w) {
|
||
return value * w;
|
||
}
|
||
|
||
vec2 czm_writeNonPerspective(vec2 value, float w) {
|
||
return value * w;
|
||
}
|
||
|
||
vec3 czm_writeNonPerspective(vec3 value, float w) {
|
||
return value * w;
|
||
}
|
||
|
||
vec4 czm_writeNonPerspective(vec4 value, float w) {
|
||
return value * w;
|
||
}
|
||
`,KL={czm_degreesPerRadian:qve,czm_depthRange:jve,czm_epsilon1:Yve,czm_epsilon2:$ve,czm_epsilon3:Xve,czm_epsilon4:Kve,czm_epsilon5:Jve,czm_epsilon6:Qve,czm_epsilon7:Zve,czm_infinity:eDe,czm_oneOverPi:tDe,czm_oneOverTwoPi:nDe,czm_passCesium3DTile:iDe,czm_passCesium3DTileClassification:oDe,czm_passCesium3DTileClassificationIgnoreShow:rDe,czm_passClassification:sDe,czm_passCompute:aDe,czm_passEnvironment:cDe,czm_passGlobe:lDe,czm_passOpaque:uDe,czm_passOverlay:fDe,czm_passTerrainClassification:dDe,czm_passTranslucent:hDe,czm_passVoxels:pDe,czm_pi:mDe,czm_piOverFour:_De,czm_piOverSix:gDe,czm_piOverThree:yDe,czm_piOverTwo:ADe,czm_radiansPerDegree:TDe,czm_sceneMode2D:CDe,czm_sceneMode3D:bDe,czm_sceneModeColumbusView:EDe,czm_sceneModeMorphing:xDe,czm_solarRadius:wDe,czm_threePiOver2:SDe,czm_twoPi:vDe,czm_webMercatorMaxLatitude:DDe,czm_depthRangeStruct:IDe,czm_material:PDe,czm_materialInput:ODe,czm_modelMaterial:LDe,czm_modelVertexOutput:BDe,czm_pbrParameters:RDe,czm_ray:NDe,czm_raySegment:MDe,czm_shadowParameters:FDe,czm_HSBToRGB:zDe,czm_HSLToRGB:UDe,czm_RGBToHSB:HDe,czm_RGBToHSL:VDe,czm_RGBToXYZ:kDe,czm_XYZToRGB:GDe,czm_acesTonemapping:WDe,czm_alphaWeight:qDe,czm_antialias:jDe,czm_approximateSphericalCoordinates:YDe,czm_backFacing:$De,czm_branchFreeTernary:XDe,czm_cascadeColor:KDe,czm_cascadeDistance:JDe,czm_cascadeMatrix:QDe,czm_cascadeWeights:ZDe,czm_columbusViewMorph:eIe,czm_computePosition:tIe,czm_cosineAndSine:nIe,czm_decompressTextureCoordinates:iIe,czm_defaultPbrMaterial:oIe,czm_depthClamp:rIe,czm_eastNorthUpToEyeCoordinates:sIe,czm_ellipsoidContainsPoint:aIe,czm_ellipsoidWgs84TextureCoordinates:cIe,czm_equalsEpsilon:lIe,czm_eyeOffset:uIe,czm_eyeToWindowCoordinates:fIe,czm_fastApproximateAtan:dIe,czm_fog:hIe,czm_gammaCorrect:pIe,czm_geodeticSurfaceNormal:mIe,czm_getDefaultMaterial:_Ie,czm_getLambertDiffuse:gIe,czm_getSpecular:yIe,czm_getWaterNoise:AIe,czm_hue:TIe,czm_inverseGamma:CIe,czm_isEmpty:bIe,czm_isFull:EIe,czm_latitudeToWebMercatorFraction:xIe,czm_lineDistance:wIe,czm_linearToSrgb:SIe,czm_luminance:vIe,czm_metersPerPixel:DIe,czm_modelToWindowCoordinates:IIe,czm_multiplyWithColorBalance:PIe,czm_nearFarScalar:OIe,czm_octDecode:LIe,czm_packDepth:BIe,czm_pbrLighting:RIe,czm_pbrMetallicRoughnessMaterial:NIe,czm_pbrSpecularGlossinessMaterial:MIe,czm_phong:FIe,czm_planeDistance:zIe,czm_pointAlongRay:UIe,czm_rayEllipsoidIntersectionInterval:HIe,czm_raySphereIntersectionInterval:VIe,czm_readDepth:kIe,czm_readNonPerspective:GIe,czm_reverseLogDepth:WIe,czm_round:qIe,czm_sampleOctahedralProjection:jIe,czm_saturation:YIe,czm_shadowDepthCompare:$Ie,czm_shadowVisibility:XIe,czm_signNotZero:KIe,czm_sphericalHarmonics:JIe,czm_srgbToLinear:QIe,czm_tangentToEyeSpaceMatrix:ZIe,czm_transformPlane:e1e,czm_translateRelativeToEye:t1e,czm_translucentPhong:n1e,czm_transpose:i1e,czm_unpackDepth:o1e,czm_unpackFloat:r1e,czm_unpackUint:s1e,czm_valueTransform:a1e,czm_vertexLogDepth:c1e,czm_windowToEyeCoordinates:l1e,czm_writeDepthClamp:u1e,czm_writeLogDepth:f1e,czm_writeNonPerspective:d1e};function RK(e){return e=e.replace(/\/\/.*/g,""),e.replace(/\/\*\*[\s\S]*?\*\//gm,function(t){const n=t.match(/\n/gm).length;let i="";for(let o=0;o<n;++o)i+=`
|
||
`;return i})}function NK(e,t,n){let i;for(let o=0;o<n.length;++o)n[o].name===e&&(i=n[o]);return l(i)||(t=RK(t),i={name:e,glslSource:t,dependsOn:[],requiredBy:[],evaluated:!1},n.push(i)),i}function MK(e,t){if(e.evaluated)return;e.evaluated=!0;let n=e.glslSource.match(/\bczm_[a-zA-Z0-9_]*/g);l(n)&&n!==null&&(n=n.filter(function(i,o){return n.indexOf(i)===o}),n.forEach(function(i){if(i!==e.name&&nt._czmBuiltinsAndUniforms.hasOwnProperty(i)){const o=NK(i,nt._czmBuiltinsAndUniforms[i],t);e.dependsOn.push(o),o.requiredBy.push(e),MK(o,t)}}))}function h1e(e){const t=[],n=[];for(;e.length>0;){const o=e.pop();n.push(o),o.requiredBy.length===0&&t.push(o)}for(;t.length>0;){const o=t.shift();e.push(o);for(let r=0;r<o.dependsOn.length;++r){const s=o.dependsOn[r],a=s.requiredBy.indexOf(o);s.requiredBy.splice(a,1),s.requiredBy.length===0&&t.push(s)}}const i=[];for(let o=0;o<n.length;++o)n[o].requiredBy.length!==0&&i.push(n[o]);if(i.length!==0){let o=`A circular dependency was found in the following built-in functions/structs/constants:
|
||
`;for(let r=0;r<i.length;++r)o=`${o+i[r].name}
|
||
`;throw new w(o)}}function p1e(e){const t=[],n=NK("main",e,t);MK(n,t),h1e(t);let i="";for(let o=t.length-1;o>=0;--o)i=`${i+t[o].glslSource}
|
||
`;return i.replace(n.glslSource,"")}function FK(e,t,n){let i,o,r="";const s=e.sources;if(l(s))for(i=0,o=s.length;i<o;++i)r+=`
|
||
#line 0
|
||
${s[i]}`;r=RK(r);let a;r=r.replace(/#version\s+(.*?)\n/gm,function(g,p){if(l(a)&&a!==p)throw new w(`inconsistent versions found: ${a} and ${p}`);return a=p,`
|
||
`});const c=[];r=r.replace(/#extension.*\n/gm,function(g){return c.push(g),`
|
||
`}),r=r.replace(/precision\s(lowp|mediump|highp)\s(float|int);/,"");const u=e.pickColorQualifier;l(u)&&(r=nt.createPickFragmentShaderSource(r,u));let f="";l(a)&&(f=`#version ${a}
|
||
`);const h=c.length;for(i=0;i<h;i++)f+=c[i];t&&(f+=`#ifdef GL_FRAGMENT_PRECISION_HIGH
|
||
precision highp float;
|
||
precision highp int;
|
||
#else
|
||
precision mediump float;
|
||
precision mediump int;
|
||
#define highp mediump
|
||
#endif
|
||
|
||
`);const _=e.defines;if(l(_))for(i=0,o=_.length;i<o;++i){const g=_[i];g.length!==0&&(f+=`#define ${g}
|
||
`)}return n.webgl2&&(f+=`#define OUTPUT_DECLARATION
|
||
|
||
`),n.textureFloatLinear&&(f+=`#define OES_texture_float_linear
|
||
|
||
`),n.floatingPointTexture&&(f+=`#define OES_texture_float
|
||
|
||
`),e.includeBuiltIns&&(f+=p1e(r)),f+=`
|
||
#line 0
|
||
`,f+=r,n.webgl2&&(f=Hve(f,t)),f}function nt(e){e=A(e,A.EMPTY_OBJECT);const t=e.pickColorQualifier;if(l(t)&&t!=="uniform"&&t!=="varying")throw new w("options.pickColorQualifier must be 'uniform' or 'varying'.");this.defines=l(e.defines)?e.defines.slice(0):[],this.sources=l(e.sources)?e.sources.slice(0):[],this.pickColorQualifier=t,this.includeBuiltIns=A(e.includeBuiltIns,!0)}nt.prototype.clone=function(){return new nt({sources:this.sources,defines:this.defines,pickColorQualifier:this.pickColorQualifier,includeBuiltIns:this.includeBuiltIns})};nt.replaceMain=function(e,t){return t=`void ${t}()`,e.replace(/void\s+main\s*\(\s*(?:void)?\s*\)/g,t)};nt.prototype.getCacheKey=function(){const t=this.defines.slice().sort().join(","),n=this.pickColorQualifier,i=this.includeBuiltIns,o=this.sources.join(`
|
||
`);return`${t}:${n}:${i}:${o}`};nt.prototype.createCombinedVertexShader=function(e){return FK(this,!1,e)};nt.prototype.createCombinedFragmentShader=function(e){return FK(this,!0,e)};nt._czmBuiltinsAndUniforms={};for(const e in KL)KL.hasOwnProperty(e)&&(nt._czmBuiltinsAndUniforms[e]=KL[e]);for(const e in _D)if(_D.hasOwnProperty(e)){const t=_D[e];typeof t.getDeclaration=="function"&&(nt._czmBuiltinsAndUniforms[e]=t.getDeclaration(e))}nt.createPickVertexShaderSource=function(e){return`${nt.replaceMain(e,"czm_old_main")}
|
||
attribute vec4 pickColor;
|
||
varying vec4 czm_pickColor;
|
||
void main()
|
||
{
|
||
czm_old_main();
|
||
czm_pickColor = pickColor;
|
||
}`};nt.createPickFragmentShaderSource=function(e,t){const n=nt.replaceMain(e,"czm_old_main"),i=`${t} vec4 czm_pickColor;
|
||
void main()
|
||
{
|
||
czm_old_main();
|
||
if (gl_FragColor.a == 0.0) {
|
||
discard;
|
||
}
|
||
gl_FragColor = czm_pickColor;
|
||
}`;return`${n}
|
||
${i}`};function m1e(e,t){const n=e.defines,i=n.length;for(let o=0;o<i;++o)if(n[o]===t)return!0;return!1}function zK(e,t){const n=e.sources,i=n.length;for(let o=0;o<i;++o)if(n[o].indexOf(t)!==-1)return!0;return!1}function UK(e,t){const n=t.length;for(let i=0;i<n;++i){const o=t[i];if(zK(e,o))return o}}const _1e=["v_normalEC","v_normal"];nt.findNormalVarying=function(e){return zK(e,"#ifdef HAS_NORMALS")?m1e(e,"HAS_NORMALS")?"v_normalEC":void 0:UK(e,_1e)};const g1e=["v_positionEC"];nt.findPositionVarying=function(e){return UK(e,g1e)};function wf(e){this._context=e,this._shaders={},this._numberOfShaders=0,this._shadersToRelease={}}Object.defineProperties(wf.prototype,{numberOfShaders:{get:function(){return this._numberOfShaders}}});wf.prototype.replaceShaderProgram=function(e){return l(e.shaderProgram)&&e.shaderProgram.destroy(),this.getShaderProgram(e)};function y1e(e){const t=Object.keys(e).sort();return JSON.stringify(e,t)}wf.prototype.getShaderProgram=function(e){let t=e.vertexShaderSource,n=e.fragmentShaderSource;const i=e.attributeLocations;typeof t=="string"&&(t=new nt({sources:[t]})),typeof n=="string"&&(n=new nt({sources:[n]}));const o=t.getCacheKey(),r=n.getCacheKey(),s=l(i)?y1e(i):"",a=`${o}:${r}:${s}`;let c;if(l(this._shaders[a]))c=this._shaders[a],delete this._shadersToRelease[a];else{const u=this._context,f=t.createCombinedVertexShader(u),h=n.createCombinedFragmentShader(u),_=new Hn({gl:u._gl,logShaderCompilation:u.logShaderCompilation,debugShaders:u.debugShaders,vertexShaderSource:t,vertexShaderText:f,fragmentShaderSource:n,fragmentShaderText:h,attributeLocations:i});c={cache:this,shaderProgram:_,keyword:a,derivedKeywords:[],count:0},_._cachedShader=c,this._shaders[a]=c,++this._numberOfShaders}return++c.count,c.shaderProgram};wf.prototype.replaceDerivedShaderProgram=function(e,t,n){const i=e._cachedShader,o=t+i.keyword,r=this._shaders[o];if(l(r)){G3(this,r);const s=i.derivedKeywords.indexOf(t);s>-1&&i.derivedKeywords.splice(s,1)}return this.createDerivedShaderProgram(e,t,n)};wf.prototype.getDerivedShaderProgram=function(e,t){const n=e._cachedShader,i=t+n.keyword,o=this._shaders[i];if(l(o))return o.shaderProgram};wf.prototype.createDerivedShaderProgram=function(e,t,n){const i=e._cachedShader,o=t+i.keyword;let r=n.vertexShaderSource,s=n.fragmentShaderSource;const a=n.attributeLocations;typeof r=="string"&&(r=new nt({sources:[r]})),typeof s=="string"&&(s=new nt({sources:[s]}));const c=this._context,u=r.createCombinedVertexShader(c),f=s.createCombinedFragmentShader(c),h=new Hn({gl:c._gl,logShaderCompilation:c.logShaderCompilation,debugShaders:c.debugShaders,vertexShaderSource:r,vertexShaderText:u,fragmentShaderSource:s,fragmentShaderText:f,attributeLocations:a}),_={cache:this,shaderProgram:h,keyword:o,derivedKeywords:[],count:0};return i.derivedKeywords.push(t),h._cachedShader=_,this._shaders[o]=_,h};function G3(e,t){const n=t.derivedKeywords,i=n.length;for(let o=0;o<i;++o){const r=n[o]+t.keyword,s=e._shaders[r];G3(e,s)}delete e._shaders[t.keyword],t.shaderProgram.finalDestroy()}wf.prototype.destroyReleasedShaderPrograms=function(){const e=this._shadersToRelease;for(const t in e)if(e.hasOwnProperty(t)){const n=e[t];G3(this,n),--this._numberOfShaders}this._shadersToRelease={}};wf.prototype.releaseShaderProgram=function(e){if(l(e)){const t=e._cachedShader;t&&--t.count===0&&(this._shadersToRelease[t.keyword]=t)}};wf.prototype.isDestroyed=function(){return!1};wf.prototype.destroy=function(){const e=this._shaders;for(const t in e)e.hasOwnProperty(t)&&e[t].shaderProgram.finalDestroy();return Je(this)};function rn(e){e=A(e,A.EMPTY_OBJECT),E.defined("options.context",e.context);const t=e.context;let n=e.width,i=e.height;const o=e.source;l(o)&&(l(n)||(n=A(o.videoWidth,o.width)),l(i)||(i=A(o.videoHeight,o.height)));const r=A(e.pixelFormat,yt.RGBA),s=A(e.pixelDatatype,ft.UNSIGNED_BYTE),a=yt.toInternalFormat(r,s,t),c=yt.isCompressedFormat(a);if(!l(n)||!l(i))throw new w("options requires a source field to create an initialized texture or width and height fields to create a blank texture.");if(E.typeOf.number.greaterThan("width",n,0),n>Gt.maximumTextureSize)throw new w(`Width must be less than or equal to the maximum texture size (${Gt.maximumTextureSize}). Check maximumTextureSize.`);if(E.typeOf.number.greaterThan("height",i,0),i>Gt.maximumTextureSize)throw new w(`Height must be less than or equal to the maximum texture size (${Gt.maximumTextureSize}). Check maximumTextureSize.`);if(!yt.validate(r))throw new w("Invalid options.pixelFormat.");if(!c&&!ft.validate(s))throw new w("Invalid options.pixelDatatype.");if(r===yt.DEPTH_COMPONENT&&s!==ft.UNSIGNED_SHORT&&s!==ft.UNSIGNED_INT)throw new w("When options.pixelFormat is DEPTH_COMPONENT, options.pixelDatatype must be UNSIGNED_SHORT or UNSIGNED_INT.");if(r===yt.DEPTH_STENCIL&&s!==ft.UNSIGNED_INT_24_8)throw new w("When options.pixelFormat is DEPTH_STENCIL, options.pixelDatatype must be UNSIGNED_INT_24_8.");if(s===ft.FLOAT&&!t.floatingPointTexture)throw new w("When options.pixelDatatype is FLOAT, this WebGL implementation must support the OES_texture_float extension. Check context.floatingPointTexture.");if(s===ft.HALF_FLOAT&&!t.halfFloatingPointTexture)throw new w("When options.pixelDatatype is HALF_FLOAT, this WebGL implementation must support the OES_texture_half_float extension. Check context.halfFloatingPointTexture.");if(yt.isDepthFormat(r)){if(l(o))throw new w("When options.pixelFormat is DEPTH_COMPONENT or DEPTH_STENCIL, source cannot be provided.");if(!t.depthTexture)throw new w("When options.pixelFormat is DEPTH_COMPONENT or DEPTH_STENCIL, this WebGL implementation must support WEBGL_depth_texture. Check context.depthTexture.")}if(c){if(!l(o)||!l(o.arrayBufferView))throw new w("When options.pixelFormat is compressed, options.source.arrayBufferView must be defined.");if(yt.isDXTFormat(a)&&!t.s3tc)throw new w("When options.pixelFormat is S3TC compressed, this WebGL implementation must support the WEBGL_compressed_texture_s3tc extension. Check context.s3tc.");if(yt.isPVRTCFormat(a)&&!t.pvrtc)throw new w("When options.pixelFormat is PVRTC compressed, this WebGL implementation must support the WEBGL_compressed_texture_pvrtc extension. Check context.pvrtc.");if(yt.isASTCFormat(a)&&!t.astc)throw new w("When options.pixelFormat is ASTC compressed, this WebGL implementation must support the WEBGL_compressed_texture_astc extension. Check context.astc.");if(yt.isETC2Format(a)&&!t.etc)throw new w("When options.pixelFormat is ETC2 compressed, this WebGL implementation must support the WEBGL_compressed_texture_etc extension. Check context.etc.");if(yt.isETC1Format(a)&&!t.etc1)throw new w("When options.pixelFormat is ETC1 compressed, this WebGL implementation must support the WEBGL_compressed_texture_etc1 extension. Check context.etc1.");if(yt.isBC7Format(a)&&!t.bc7)throw new w("When options.pixelFormat is BC7 compressed, this WebGL implementation must support the EXT_texture_compression_bptc extension. Check context.bc7.");if(yt.compressedTextureSizeInBytes(a,n,i)!==o.arrayBufferView.byteLength)throw new w("The byte length of the array buffer is invalid for the compressed texture with the given width and height.")}const u=e.preMultiplyAlpha||r===yt.RGB||r===yt.LUMINANCE,f=A(e.flipY,!0),h=A(e.skipColorSpaceConversion,!1);let _=!0;const g=t._gl,p=g.TEXTURE_2D,y=g.createTexture();g.activeTexture(g.TEXTURE0),g.bindTexture(p,y);let T=4;if(l(o)&&l(o.arrayBufferView)&&!c&&(T=yt.alignmentInBytes(r,s,n)),g.pixelStorei(g.UNPACK_ALIGNMENT,T),h?g.pixelStorei(g.UNPACK_COLORSPACE_CONVERSION_WEBGL,g.NONE):g.pixelStorei(g.UNPACK_COLORSPACE_CONVERSION_WEBGL,g.BROWSER_DEFAULT_WEBGL),l(o))if(l(o.arrayBufferView)){g.pixelStorei(g.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),g.pixelStorei(g.UNPACK_FLIP_Y_WEBGL,!1);let x=o.arrayBufferView,v,D,L;if(c){if(g.compressedTexImage2D(p,0,a,n,i,0,x),l(o.mipLevels))for(D=n,L=i,v=0;v<o.mipLevels.length;++v)D=Math.floor(D/2)|0,D<1&&(D=1),L=Math.floor(L/2)|0,L<1&&(L=1),g.compressedTexImage2D(p,v+1,a,D,L,0,o.mipLevels[v])}else if(f&&(x=yt.flipY(x,r,s,n,i)),g.texImage2D(p,0,a,n,i,0,r,ft.toWebGLConstant(s,t),x),l(o.mipLevels))for(D=n,L=i,v=0;v<o.mipLevels.length;++v)D=Math.floor(D/2)|0,D<1&&(D=1),L=Math.floor(L/2)|0,L<1&&(L=1),g.texImage2D(p,v+1,a,D,L,0,r,ft.toWebGLConstant(s,t),o.mipLevels[v])}else l(o.framebuffer)?(g.pixelStorei(g.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),g.pixelStorei(g.UNPACK_FLIP_Y_WEBGL,!1),o.framebuffer!==t.defaultFramebuffer&&o.framebuffer._bind(),g.copyTexImage2D(p,0,a,o.xOffset,o.yOffset,n,i,0),o.framebuffer!==t.defaultFramebuffer&&o.framebuffer._unBind()):(g.pixelStorei(g.UNPACK_PREMULTIPLY_ALPHA_WEBGL,u),g.pixelStorei(g.UNPACK_FLIP_Y_WEBGL,f),g.texImage2D(p,0,a,r,ft.toWebGLConstant(s,t),o));else g.texImage2D(p,0,a,n,i,0,r,ft.toWebGLConstant(s,t),null),_=!1;g.bindTexture(p,null);let b;c?b=yt.compressedTextureSizeInBytes(r,n,i):b=yt.textureSizeInBytes(r,s,n,i),this._id=ma(),this._context=t,this._textureFilterAnisotropic=t._textureFilterAnisotropic,this._textureTarget=p,this._texture=y,this._internalFormat=a,this._pixelFormat=r,this._pixelDatatype=s,this._width=n,this._height=i,this._dimensions=new $(n,i),this._hasMipmap=!1,this._sizeInBytes=b,this._preMultiplyAlpha=u,this._flipY=f,this._initialized=_,this._sampler=void 0,this.sampler=l(e.sampler)?e.sampler:new Ci}rn.create=function(e){return new rn(e)};rn.fromFramebuffer=function(e){e=A(e,A.EMPTY_OBJECT),E.defined("options.context",e.context);const t=e.context,n=t._gl,i=A(e.pixelFormat,yt.RGB),o=A(e.framebufferXOffset,0),r=A(e.framebufferYOffset,0),s=A(e.width,n.drawingBufferWidth),a=A(e.height,n.drawingBufferHeight),c=e.framebuffer;if(!yt.validate(i))throw new w("Invalid pixelFormat.");if(yt.isDepthFormat(i)||yt.isCompressedFormat(i))throw new w("pixelFormat cannot be DEPTH_COMPONENT, DEPTH_STENCIL or a compressed format.");if(E.defined("options.context",e.context),E.typeOf.number.greaterThanOrEquals("framebufferXOffset",o,0),E.typeOf.number.greaterThanOrEquals("framebufferYOffset",r,0),o+s>n.drawingBufferWidth)throw new w("framebufferXOffset + width must be less than or equal to drawingBufferWidth");if(r+a>n.drawingBufferHeight)throw new w("framebufferYOffset + height must be less than or equal to drawingBufferHeight.");return new rn({context:t,width:s,height:a,pixelFormat:i,source:{framebuffer:l(c)?c:t.defaultFramebuffer,xOffset:o,yOffset:r,width:s,height:a}})};Object.defineProperties(rn.prototype,{id:{get:function(){return this._id}},sampler:{get:function(){return this._sampler},set:function(e){let t=e.minificationFilter,n=e.magnificationFilter;const i=this._context,o=this._pixelFormat,r=this._pixelDatatype,s=t===Wn.NEAREST_MIPMAP_NEAREST||t===Wn.NEAREST_MIPMAP_LINEAR||t===Wn.LINEAR_MIPMAP_NEAREST||t===Wn.LINEAR_MIPMAP_LINEAR;(r===ft.FLOAT&&!i.textureFloatLinear||r===ft.HALF_FLOAT&&!i.textureHalfFloatLinear)&&(t=s?Wn.NEAREST_MIPMAP_NEAREST:Wn.NEAREST,n=Ps.NEAREST),i.webgl2&&yt.isDepthFormat(o)&&(t=Wn.NEAREST,n=Ps.NEAREST);const a=i._gl,c=this._textureTarget;a.activeTexture(a.TEXTURE0),a.bindTexture(c,this._texture),a.texParameteri(c,a.TEXTURE_MIN_FILTER,t),a.texParameteri(c,a.TEXTURE_MAG_FILTER,n),a.texParameteri(c,a.TEXTURE_WRAP_S,e.wrapS),a.texParameteri(c,a.TEXTURE_WRAP_T,e.wrapT),l(this._textureFilterAnisotropic)&&a.texParameteri(c,this._textureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,e.maximumAnisotropy),a.bindTexture(c,null),this._sampler=e}},pixelFormat:{get:function(){return this._pixelFormat}},pixelDatatype:{get:function(){return this._pixelDatatype}},dimensions:{get:function(){return this._dimensions}},preMultiplyAlpha:{get:function(){return this._preMultiplyAlpha}},flipY:{get:function(){return this._flipY}},width:{get:function(){return this._width}},height:{get:function(){return this._height}},sizeInBytes:{get:function(){return this._hasMipmap?Math.floor(this._sizeInBytes*4/3):this._sizeInBytes}},_target:{get:function(){return this._textureTarget}}});rn.prototype.copyFrom=function(e){E.defined("options",e);const t=A(e.xOffset,0),n=A(e.yOffset,0);if(E.defined("options.source",e.source),yt.isDepthFormat(this._pixelFormat))throw new w("Cannot call copyFrom when the texture pixel format is DEPTH_COMPONENT or DEPTH_STENCIL.");if(yt.isCompressedFormat(this._pixelFormat))throw new w("Cannot call copyFrom with a compressed texture pixel format.");E.typeOf.number.greaterThanOrEquals("xOffset",t,0),E.typeOf.number.greaterThanOrEquals("yOffset",n,0),E.typeOf.number.lessThanOrEquals("xOffset + options.source.width",t+e.source.width,this._width),E.typeOf.number.lessThanOrEquals("yOffset + options.source.height",n+e.source.height,this._height);const i=e.source,o=this._context,r=o._gl,s=this._textureTarget;r.activeTexture(r.TEXTURE0),r.bindTexture(s,this._texture);const a=i.width,c=i.height;let u=i.arrayBufferView;const f=this._width,h=this._height,_=this._internalFormat,g=this._pixelFormat,p=this._pixelDatatype,y=this._preMultiplyAlpha,T=this._flipY,b=A(e.skipColorSpaceConversion,!1);let x=4;l(u)&&(x=yt.alignmentInBytes(g,p,a)),r.pixelStorei(r.UNPACK_ALIGNMENT,x),b?r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,r.NONE):r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,r.BROWSER_DEFAULT_WEBGL);let v=!1;if(!this._initialized){if(t===0&&n===0&&a===f&&c===h)l(u)?(r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!1),T&&(u=yt.flipY(u,g,p,f,h)),r.texImage2D(s,0,_,f,h,0,g,ft.toWebGLConstant(p,o),u)):(r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,y),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,T),r.texImage2D(s,0,_,g,ft.toWebGLConstant(p,o),i)),v=!0;else{r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!1);const D=yt.createTypedArray(g,p,f,h);r.texImage2D(s,0,_,f,h,0,g,ft.toWebGLConstant(p,o),D)}this._initialized=!0}v||(l(u)?(r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!1),T&&(u=yt.flipY(u,g,p,a,c)),r.texSubImage2D(s,0,t,n,a,c,g,ft.toWebGLConstant(p,o),u)):(r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,y),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,T),r.texSubImage2D(s,0,t,n,g,ft.toWebGLConstant(p,o),i))),r.bindTexture(s,null)};rn.prototype.copyFromFramebuffer=function(e,t,n,i,o,r){if(e=A(e,0),t=A(t,0),n=A(n,0),i=A(i,0),o=A(o,this._width),r=A(r,this._height),yt.isDepthFormat(this._pixelFormat))throw new w("Cannot call copyFromFramebuffer when the texture pixel format is DEPTH_COMPONENT or DEPTH_STENCIL.");if(this._pixelDatatype===ft.FLOAT)throw new w("Cannot call copyFromFramebuffer when the texture pixel data type is FLOAT.");if(this._pixelDatatype===ft.HALF_FLOAT)throw new w("Cannot call copyFromFramebuffer when the texture pixel data type is HALF_FLOAT.");if(yt.isCompressedFormat(this._pixelFormat))throw new w("Cannot call copyFrom with a compressed texture pixel format.");E.typeOf.number.greaterThanOrEquals("xOffset",e,0),E.typeOf.number.greaterThanOrEquals("yOffset",t,0),E.typeOf.number.greaterThanOrEquals("framebufferXOffset",n,0),E.typeOf.number.greaterThanOrEquals("framebufferYOffset",i,0),E.typeOf.number.lessThanOrEquals("xOffset + width",e+o,this._width),E.typeOf.number.lessThanOrEquals("yOffset + height",t+r,this._height);const s=this._context._gl,a=this._textureTarget;s.activeTexture(s.TEXTURE0),s.bindTexture(a,this._texture),s.copyTexSubImage2D(a,0,e,t,n,i,o,r),s.bindTexture(a,null),this._initialized=!0};rn.prototype.generateMipmap=function(e){if(e=A(e,eT.DONT_CARE),yt.isDepthFormat(this._pixelFormat))throw new w("Cannot call generateMipmap when the texture pixel format is DEPTH_COMPONENT or DEPTH_STENCIL.");if(yt.isCompressedFormat(this._pixelFormat))throw new w("Cannot call generateMipmap with a compressed pixel format.");if(!this._context.webgl2){if(this._width>1&&!F.isPowerOfTwo(this._width))throw new w("width must be a power of two to call generateMipmap() in a WebGL1 context.");if(this._height>1&&!F.isPowerOfTwo(this._height))throw new w("height must be a power of two to call generateMipmap() in a WebGL1 context.")}if(!eT.validate(e))throw new w("hint is invalid.");this._hasMipmap=!0;const t=this._context._gl,n=this._textureTarget;t.hint(t.GENERATE_MIPMAP_HINT,e),t.activeTexture(t.TEXTURE0),t.bindTexture(n,this._texture),t.generateMipmap(n),t.bindTexture(n,null)};rn.prototype.isDestroyed=function(){return!1};rn.prototype.destroy=function(){return this._context._gl.deleteTexture(this._texture),Je(this)};function Dy(){this._textures={},this._numberOfTextures=0,this._texturesToRelease={}}Object.defineProperties(Dy.prototype,{numberOfTextures:{get:function(){return this._numberOfTextures}}});Dy.prototype.getTexture=function(e){const t=this._textures[e];if(l(t))return delete this._texturesToRelease[e],++t.count,t.texture};Dy.prototype.addTexture=function(e,t){const n={texture:t,count:1};t.finalDestroy=t.destroy;const i=this;t.destroy=function(){--n.count===0&&(i._texturesToRelease[e]=n)},this._textures[e]=n,++this._numberOfTextures};Dy.prototype.destroyReleasedTextures=function(){const e=this._texturesToRelease;for(const t in e)if(e.hasOwnProperty(t)){const n=e[t];delete this._textures[t],n.texture.finalDestroy(),--this._numberOfTextures}this._texturesToRelease={}};Dy.prototype.isDestroyed=function(){return!1};Dy.prototype.destroy=function(){const e=this._textures;for(const t in e)e.hasOwnProperty(t)&&e[t].texture.finalDestroy();return Je(this)};function Zn(){this.high=d.clone(d.ZERO),this.low=d.clone(d.ZERO)}Zn.encode=function(e,t){E.typeOf.number("value",e),l(t)||(t={high:0,low:0});let n;return e>=0?(n=Math.floor(e/65536)*65536,t.high=n,t.low=e-n):(n=Math.floor(-e/65536)*65536,t.high=-n,t.low=e+n),t};const uh={high:0,low:0};Zn.fromCartesian=function(e,t){E.typeOf.object("cartesian",e),l(t)||(t=new Zn);const n=t.high,i=t.low;return Zn.encode(e.x,uh),n.x=uh.high,i.x=uh.low,Zn.encode(e.y,uh),n.y=uh.high,i.y=uh.low,Zn.encode(e.z,uh),n.z=uh.high,i.z=uh.low,t};const JL=new Zn;Zn.writeElements=function(e,t,n){E.defined("cartesianArray",t),E.typeOf.number("index",n),E.typeOf.number.greaterThanOrEquals("index",n,0),Zn.fromCartesian(e,JL);const i=JL.high,o=JL.low;t[n]=i.x,t[n+1]=i.y,t[n+2]=i.z,t[n+3]=o.x,t[n+4]=o.y,t[n+5]=o.z};function Wt(e,t){if(E.typeOf.object("normal",e),!F.equalsEpsilon(d.magnitude(e),1,F.EPSILON6))throw new w("normal must be normalized.");E.typeOf.number("distance",t),this.normal=d.clone(e),this.distance=t}Wt.fromPointNormal=function(e,t,n){if(E.typeOf.object("point",e),E.typeOf.object("normal",t),!F.equalsEpsilon(d.magnitude(t),1,F.EPSILON6))throw new w("normal must be normalized.");const i=-d.dot(t,e);return l(n)?(d.clone(t,n.normal),n.distance=i,n):new Wt(t,i)};const A1e=new d;Wt.fromCartesian4=function(e,t){E.typeOf.object("coefficients",e);const n=d.fromCartesian4(e,A1e),i=e.w;if(!F.equalsEpsilon(d.magnitude(n),1,F.EPSILON6))throw new w("normal must be normalized.");return l(t)?(d.clone(n,t.normal),t.distance=i,t):new Wt(n,i)};Wt.getPointDistance=function(e,t){return E.typeOf.object("plane",e),E.typeOf.object("point",t),d.dot(e.normal,t)+e.distance};const T1e=new d;Wt.projectPointOntoPlane=function(e,t,n){E.typeOf.object("plane",e),E.typeOf.object("point",t),l(n)||(n=new d);const i=Wt.getPointDistance(e,t),o=d.multiplyByScalar(e.normal,i,T1e);return d.subtract(t,o,n)};const C1e=new N,b1e=new ue,E1e=new d;Wt.transform=function(e,t,n){E.typeOf.object("plane",e),E.typeOf.object("transform",t);const i=e.normal,o=e.distance,r=N.inverseTranspose(t,C1e);let s=ue.fromElements(i.x,i.y,i.z,o,b1e);s=N.multiplyByVector(r,s,s);const a=d.fromCartesian4(s,E1e);return s=ue.divideByScalar(s,d.magnitude(a),s),Wt.fromCartesian4(s,n)};Wt.clone=function(e,t){return E.typeOf.object("plane",e),l(t)?(d.clone(e.normal,t.normal),t.distance=e.distance,t):new Wt(e.normal,e.distance)};Wt.equals=function(e,t){return E.typeOf.object("left",e),E.typeOf.object("right",t),e.distance===t.distance&&d.equals(e.normal,t.normal)};Wt.ORIGIN_XY_PLANE=Object.freeze(new Wt(d.UNIT_Z,0));Wt.ORIGIN_YZ_PLANE=Object.freeze(new Wt(d.UNIT_X,0));Wt.ORIGIN_ZX_PLANE=Object.freeze(new Wt(d.UNIT_Y,0));function Ur(e){this.planes=A(e,[])}const CE=[new d,new d,new d];d.clone(d.UNIT_X,CE[0]);d.clone(d.UNIT_Y,CE[1]);d.clone(d.UNIT_Z,CE[2]);const $p=new d,x1e=new d,HK=new Wt(new d(1,0,0),0);Ur.fromBoundingSphere=function(e,t){if(!l(e))throw new w("boundingSphere is required.");l(t)||(t=new Ur);const n=CE.length,i=t.planes;i.length=2*n;const o=e.center,r=e.radius;let s=0;for(let a=0;a<n;++a){const c=CE[a];let u=i[s],f=i[s+1];l(u)||(u=i[s]=new ue),l(f)||(f=i[s+1]=new ue),d.multiplyByScalar(c,-r,$p),d.add(o,$p,$p),u.x=c.x,u.y=c.y,u.z=c.z,u.w=-d.dot(c,$p),d.multiplyByScalar(c,r,$p),d.add(o,$p,$p),f.x=-c.x,f.y=-c.y,f.z=-c.z,f.w=-d.dot(d.negate(c,x1e),$p),s+=2}return t};Ur.prototype.computeVisibility=function(e){if(!l(e))throw new w("boundingVolume is required.");const t=this.planes;let n=!1;for(let i=0,o=t.length;i<o;++i){const r=e.intersectPlane(Wt.fromCartesian4(t[i],HK));if(r===Vn.OUTSIDE)return Vn.OUTSIDE;r===Vn.INTERSECTING&&(n=!0)}return n?Vn.INTERSECTING:Vn.INSIDE};Ur.prototype.computeVisibilityWithPlaneMask=function(e,t){if(!l(e))throw new w("boundingVolume is required.");if(!l(t))throw new w("parentPlaneMask is required.");if(t===Ur.MASK_OUTSIDE||t===Ur.MASK_INSIDE)return t;let n=Ur.MASK_INSIDE;const i=this.planes;for(let o=0,r=i.length;o<r;++o){const s=o<31?1<<o:0;if(o<31&&!(t&s))continue;const a=e.intersectPlane(Wt.fromCartesian4(i[o],HK));if(a===Vn.OUTSIDE)return Ur.MASK_OUTSIDE;a===Vn.INTERSECTING&&(n|=s)}return n};Ur.MASK_OUTSIDE=4294967295;Ur.MASK_INSIDE=0;Ur.MASK_INDETERMINATE=2147483647;function yr(e){e=A(e,A.EMPTY_OBJECT),this.left=e.left,this._left=void 0,this.right=e.right,this._right=void 0,this.top=e.top,this._top=void 0,this.bottom=e.bottom,this._bottom=void 0,this.near=A(e.near,1),this._near=this.near,this.far=A(e.far,5e8),this._far=this.far,this._cullingVolume=new Ur,this._orthographicMatrix=new N}function VK(e){if(!l(e.right)||!l(e.left)||!l(e.top)||!l(e.bottom)||!l(e.near)||!l(e.far))throw new w("right, left, top, bottom, near, or far parameters are not set.");if(e.top!==e._top||e.bottom!==e._bottom||e.left!==e._left||e.right!==e._right||e.near!==e._near||e.far!==e._far){if(e.left>e.right)throw new w("right must be greater than left.");if(e.bottom>e.top)throw new w("top must be greater than bottom.");if(e.near<=0||e.near>e.far)throw new w("near must be greater than zero and less than far.");e._left=e.left,e._right=e.right,e._top=e.top,e._bottom=e.bottom,e._near=e.near,e._far=e.far,e._orthographicMatrix=N.computeOrthographicOffCenter(e.left,e.right,e.bottom,e.top,e.near,e.far,e._orthographicMatrix)}}Object.defineProperties(yr.prototype,{projectionMatrix:{get:function(){return VK(this),this._orthographicMatrix}}});const w1e=new d,S1e=new d,v1e=new d,QL=new d;yr.prototype.computeCullingVolume=function(e,t,n){if(!l(e))throw new w("position is required.");if(!l(t))throw new w("direction is required.");if(!l(n))throw new w("up is required.");const i=this._cullingVolume.planes,o=this.top,r=this.bottom,s=this.right,a=this.left,c=this.near,u=this.far,f=d.cross(t,n,w1e);d.normalize(f,f);const h=S1e;d.multiplyByScalar(t,c,h),d.add(e,h,h);const _=v1e;d.multiplyByScalar(f,a,_),d.add(h,_,_);let g=i[0];return l(g)||(g=i[0]=new ue),g.x=f.x,g.y=f.y,g.z=f.z,g.w=-d.dot(f,_),d.multiplyByScalar(f,s,_),d.add(h,_,_),g=i[1],l(g)||(g=i[1]=new ue),g.x=-f.x,g.y=-f.y,g.z=-f.z,g.w=-d.dot(d.negate(f,QL),_),d.multiplyByScalar(n,r,_),d.add(h,_,_),g=i[2],l(g)||(g=i[2]=new ue),g.x=n.x,g.y=n.y,g.z=n.z,g.w=-d.dot(n,_),d.multiplyByScalar(n,o,_),d.add(h,_,_),g=i[3],l(g)||(g=i[3]=new ue),g.x=-n.x,g.y=-n.y,g.z=-n.z,g.w=-d.dot(d.negate(n,QL),_),g=i[4],l(g)||(g=i[4]=new ue),g.x=t.x,g.y=t.y,g.z=t.z,g.w=-d.dot(t,h),d.multiplyByScalar(t,u,_),d.add(e,_,_),g=i[5],l(g)||(g=i[5]=new ue),g.x=-t.x,g.y=-t.y,g.z=-t.z,g.w=-d.dot(d.negate(t,QL),_),this._cullingVolume};yr.prototype.getPixelDimensions=function(e,t,n,i,o){if(VK(this),!l(e)||!l(t))throw new w("Both drawingBufferWidth and drawingBufferHeight are required.");if(e<=0)throw new w("drawingBufferWidth must be greater than zero.");if(t<=0)throw new w("drawingBufferHeight must be greater than zero.");if(!l(n))throw new w("distance is required.");if(!l(i))throw new w("pixelRatio is required.");if(i<=0)throw new w("pixelRatio must be greater than zero.");if(!l(o))throw new w("A result object is required.");const r=this.right-this.left,s=this.top-this.bottom,a=i*r/e,c=i*s/t;return o.x=a,o.y=c,o};yr.prototype.clone=function(e){return l(e)||(e=new yr),e.left=this.left,e.right=this.right,e.top=this.top,e.bottom=this.bottom,e.near=this.near,e.far=this.far,e._left=void 0,e._right=void 0,e._top=void 0,e._bottom=void 0,e._near=void 0,e._far=void 0,e};yr.prototype.equals=function(e){return l(e)&&e instanceof yr&&this.right===e.right&&this.left===e.left&&this.top===e.top&&this.bottom===e.bottom&&this.near===e.near&&this.far===e.far};yr.prototype.equalsEpsilon=function(e,t,n){return e===this||l(e)&&e instanceof yr&&F.equalsEpsilon(this.right,e.right,t,n)&&F.equalsEpsilon(this.left,e.left,t,n)&&F.equalsEpsilon(this.top,e.top,t,n)&&F.equalsEpsilon(this.bottom,e.bottom,t,n)&&F.equalsEpsilon(this.near,e.near,t,n)&&F.equalsEpsilon(this.far,e.far,t,n)};function nn(e){e=A(e,A.EMPTY_OBJECT),this._offCenterFrustum=new yr,this.width=e.width,this._width=void 0,this.aspectRatio=e.aspectRatio,this._aspectRatio=void 0,this.near=A(e.near,1),this._near=this.near,this.far=A(e.far,5e8),this._far=this.far}nn.packedLength=4;nn.pack=function(e,t,n){return E.typeOf.object("value",e),E.defined("array",t),n=A(n,0),t[n++]=e.width,t[n++]=e.aspectRatio,t[n++]=e.near,t[n]=e.far,t};nn.unpack=function(e,t,n){return E.defined("array",e),t=A(t,0),l(n)||(n=new nn),n.width=e[t++],n.aspectRatio=e[t++],n.near=e[t++],n.far=e[t],n};function ey(e){if(!l(e.width)||!l(e.aspectRatio)||!l(e.near)||!l(e.far))throw new w("width, aspectRatio, near, or far parameters are not set.");const t=e._offCenterFrustum;if(e.width!==e._width||e.aspectRatio!==e._aspectRatio||e.near!==e._near||e.far!==e._far){if(e.aspectRatio<0)throw new w("aspectRatio must be positive.");if(e.near<0||e.near>e.far)throw new w("near must be greater than zero and less than far.");e._aspectRatio=e.aspectRatio,e._width=e.width,e._near=e.near,e._far=e.far;const n=1/e.aspectRatio;t.right=e.width*.5,t.left=-t.right,t.top=n*t.right,t.bottom=-t.top,t.near=e.near,t.far=e.far}}Object.defineProperties(nn.prototype,{projectionMatrix:{get:function(){return ey(this),this._offCenterFrustum.projectionMatrix}}});nn.prototype.computeCullingVolume=function(e,t,n){return ey(this),this._offCenterFrustum.computeCullingVolume(e,t,n)};nn.prototype.getPixelDimensions=function(e,t,n,i,o){return ey(this),this._offCenterFrustum.getPixelDimensions(e,t,n,i,o)};nn.prototype.clone=function(e){return l(e)||(e=new nn),e.aspectRatio=this.aspectRatio,e.width=this.width,e.near=this.near,e.far=this.far,e._aspectRatio=void 0,e._width=void 0,e._near=void 0,e._far=void 0,this._offCenterFrustum.clone(e._offCenterFrustum),e};nn.prototype.equals=function(e){return!l(e)||!(e instanceof nn)?!1:(ey(this),ey(e),this.width===e.width&&this.aspectRatio===e.aspectRatio&&this._offCenterFrustum.equals(e._offCenterFrustum))};nn.prototype.equalsEpsilon=function(e,t,n){return!l(e)||!(e instanceof nn)?!1:(ey(this),ey(e),F.equalsEpsilon(this.width,e.width,t,n)&&F.equalsEpsilon(this.aspectRatio,e.aspectRatio,t,n)&&this._offCenterFrustum.equalsEpsilon(e._offCenterFrustum,t,n))};const W3={};function D1e(e){const t=6.239996+.0172019696544*e;return .001657*Math.sin(t+.01671*Math.sin(t))}const I1e=32.184,P1e=2451545;function kK(e,t){t=ce.addSeconds(e,I1e,t);const n=ce.totalDays(t)-P1e;return t=ce.addSeconds(t,D1e(n),t),t}const PI=new ce(2451545,0,di.TAI),O1e=1e3,jl=F.RADIANS_PER_DEGREE,Kc=F.RADIANS_PER_ARCSECOND,_a=14959787e4,a5=new te;function GK(e,t,n,i,o,r,s){if(n<0&&(n=-n,o+=F.PI),n<0||n>F.PI)throw new w("The inclination is out of range. Inclination must be greater than or equal to zero and less than or equal to Pi radians.");const a=e*(1-t),c=i-o,u=o,f=B1e(r-i,t);if(L1e(t,0)==="Hyperbolic"&&Math.abs(F.negativePiToPi(f))>=Math.acos(-1/t))throw new w("The true anomaly of the hyperbolic orbit lies outside of the bounds of the hyperbola.");F1e(c,n,u,a5);const _=a*(1+t),g=Math.cos(f),p=Math.sin(f),y=1+t*g;if(y<=F.Epsilon10)throw new w("elements cannot be converted to cartesian");const T=_/y;return l(s)?(s.x=T*g,s.y=T*p,s.z=0):s=new d(T*g,T*p,0),te.multiplyByVector(a5,s,s)}function L1e(e,t){if(e<0)throw new w("eccentricity cannot be negative.");return e<=t?"Circular":e<1-t?"Elliptical":e<=1+t?"Parabolic":"Hyperbolic"}function B1e(e,t){if(t<0||t>=1)throw new w("eccentricity out of range.");const n=N1e(e,t);return M1e(n,t)}const c5=50,R1e=F.EPSILON8;function N1e(e,t){if(t<0||t>=1)throw new w("eccentricity out of range.");const n=Math.floor(e/F.TWO_PI);e-=n*F.TWO_PI;let i=e+t*Math.sin(e)/(1-Math.sin(e+t)+Math.sin(e)),o=Number.MAX_VALUE,r;for(r=0;r<c5&&Math.abs(o-i)>R1e;++r){o=i;const s=o-t*Math.sin(o)-e,a=1-t*Math.cos(o);i=o-s/a}if(r>=c5)throw new w("Kepler equation did not converge");return o=i+n*F.TWO_PI,o}function M1e(e,t){if(t<0||t>=1)throw new w("eccentricity out of range.");const n=Math.floor(e/F.TWO_PI);e-=n*F.TWO_PI;const i=Math.cos(e)-t,o=Math.sin(e)*Math.sqrt(1-t*t);let r=Math.atan2(o,i);return r=F.zeroToTwoPi(r),e<0&&(r-=F.TWO_PI),r+=n*F.TWO_PI,r}function F1e(e,t,n,i){if(t<0||t>F.PI)throw new w("inclination out of range");const o=Math.cos(e),r=Math.sin(e),s=Math.cos(t),a=Math.sin(t),c=Math.cos(n),u=Math.sin(n);return l(i)?(i[0]=c*o-u*r*s,i[1]=u*o+c*r*s,i[2]=r*a,i[3]=-c*r-u*o*s,i[4]=-u*r+c*o*s,i[5]=o*a,i[6]=u*a,i[7]=-c*a,i[8]=s):i=new te(c*o-u*r*s,-c*r-u*o*s,u*a,u*o+c*r*s,-u*r+c*o*s,-c*a,r*a,o*a,s),i}const z1e=1.0000010178*_a,U1e=100.46645683*jl,H1e=129597742283429e-5*Kc,l5=16002,u5=21863,f5=32004,d5=10931,h5=14529,p5=16368,m5=15318,_5=32794,V1e=64*1e-7*_a,k1e=-152*1e-7*_a,G1e=62*1e-7*_a,W1e=-8*1e-7*_a,q1e=32*1e-7*_a,j1e=-41*1e-7*_a,Y1e=19*1e-7*_a,$1e=-11*1e-7*_a,X1e=-150*1e-7*_a,K1e=-46*1e-7*_a,J1e=68*1e-7*_a,Q1e=54*1e-7*_a,Z1e=14*1e-7*_a,ePe=24*1e-7*_a,tPe=-28*1e-7*_a,nPe=22*1e-7*_a,g5=10,y5=16002,A5=21863,T5=10931,C5=1473,b5=32004,E5=4387,x5=73,iPe=-325*1e-7,oPe=-322*1e-7,rPe=-79*1e-7,sPe=232*1e-7,aPe=-52*1e-7,cPe=97*1e-7,lPe=55*1e-7,uPe=-41*1e-7,fPe=-105*1e-7,dPe=-137*1e-7,hPe=258*1e-7,pPe=35*1e-7,mPe=-116*1e-7,_Pe=-88*1e-7,gPe=-112*1e-7,yPe=-80*1e-7,xA=new ce(0,0,di.TAI);function APe(e,t){kK(e,xA);const i=(xA.dayNumber-PI.dayNumber+(xA.secondsOfDay-PI.secondsOfDay)/to.SECONDS_PER_DAY)/(to.DAYS_PER_JULIAN_CENTURY*10),o=.3595362*i,r=z1e+V1e*Math.cos(l5*o)+X1e*Math.sin(l5*o)+k1e*Math.cos(u5*o)+K1e*Math.sin(u5*o)+G1e*Math.cos(f5*o)+J1e*Math.sin(f5*o)+W1e*Math.cos(d5*o)+Q1e*Math.sin(d5*o)+q1e*Math.cos(h5*o)+Z1e*Math.sin(h5*o)+j1e*Math.cos(p5*o)+ePe*Math.sin(p5*o)+Y1e*Math.cos(m5*o)+tPe*Math.sin(m5*o)+$1e*Math.cos(_5*o)+nPe*Math.sin(_5*o),s=U1e+H1e*i+iPe*Math.cos(g5*o)+fPe*Math.sin(g5*o)+oPe*Math.cos(y5*o)+dPe*Math.sin(y5*o)+rPe*Math.cos(A5*o)+hPe*Math.sin(A5*o)+sPe*Math.cos(T5*o)+pPe*Math.sin(T5*o)+aPe*Math.cos(C5*o)+mPe*Math.sin(C5*o)+cPe*Math.cos(b5*o)+_Pe*Math.sin(b5*o)+lPe*Math.cos(E5*o)+gPe*Math.sin(E5*o)+uPe*Math.cos(x5*o)+yPe*Math.sin(x5*o),a=.0167086342-.0004203654*i,c=102.93734808*jl+11612.3529*Kc*i,u=469.97289*Kc*i,f=174.87317577*jl-8679.27034*Kc*i;return GK(r,a,u,c,f,s,t)}function WK(e,t){kK(e,xA);const i=(xA.dayNumber-PI.dayNumber+(xA.secondsOfDay-PI.secondsOfDay)/to.SECONDS_PER_DAY)/to.DAYS_PER_JULIAN_CENTURY,o=i*i,r=o*i,s=r*i;let a=383397.7725+.004*i,c=.055545526-16e-9*i;const u=5.15668983*jl;let f=-8e-5*i+.02966*o-42e-6*r-13e-8*s;const h=83.35324312*jl;let _=146434202669e-4*i-38.2702*o-.045047*r+21301e-8*s;const g=125.04455501*jl;let p=-69679193631e-4*i+6.3602*o+.007625*r-3586e-8*s;const y=218.31664563*jl;let T=17325593434847e-4*i-6.391*o+.006588*r-3169e-8*s;const b=297.85019547*jl+Kc*(1602961601209e-3*i-6.3706*o+.006593*r-3169e-8*s),x=93.27209062*jl+Kc*(17395272628478e-4*i-12.7512*o-.001037*r+417e-8*s),v=134.96340251*jl+Kc*(17179159232178e-4*i+31.8792*o+.051635*r-2447e-7*s),D=357.52910918*jl+Kc*(1295965810481e-4*i-.5532*o+136e-6*r-1149e-8*s),L=310.17137918*jl-Kc*(6967051436e-3*i+6.2068*o+.007618*r-3219e-8*s),B=2*b,V=4*b,M=6*b,H=2*v,G=3*v,I=4*v,O=2*x;a+=3400.4*Math.cos(B)-635.6*Math.cos(B-v)-235.6*Math.cos(v)+218.1*Math.cos(B-D)+181*Math.cos(B+v),c+=.014216*Math.cos(B-v)+.008551*Math.cos(B-H)-.001383*Math.cos(v)+.001356*Math.cos(B+v)-.001147*Math.cos(V-G)-914e-6*Math.cos(V-H)+869e-6*Math.cos(B-D-v)-627e-6*Math.cos(B)-394e-6*Math.cos(V-I)+282e-6*Math.cos(B-D-H)-279e-6*Math.cos(b-v)-236e-6*Math.cos(H)+231e-6*Math.cos(V)+229e-6*Math.cos(M-I)-201e-6*Math.cos(H-O),f+=486.26*Math.cos(B-O)-40.13*Math.cos(B)+37.51*Math.cos(O)+25.73*Math.cos(H-O)+19.97*Math.cos(B-D-O),_+=-55609*Math.sin(B-v)-34711*Math.sin(B-H)-9792*Math.sin(v)+9385*Math.sin(V-G)+7505*Math.sin(V-H)+5318*Math.sin(B+v)+3484*Math.sin(V-I)-3417*Math.sin(B-D-v)-2530*Math.sin(M-I)-2376*Math.sin(B)-2075*Math.sin(B-G)-1883*Math.sin(H)-1736*Math.sin(M-5*v)+1626*Math.sin(D)-1370*Math.sin(M-G),p+=-5392*Math.sin(B-O)-540*Math.sin(D)-441*Math.sin(B)+423*Math.sin(O)-288*Math.sin(H-O),T+=-3332.9*Math.sin(B)+1197.4*Math.sin(B-v)-662.5*Math.sin(D)+396.3*Math.sin(v)-218*Math.sin(B-D);const m=2*L,P=3*L;f+=46.997*Math.cos(L)*i-.614*Math.cos(B-O+L)*i+.614*Math.cos(B-O-L)*i-.0297*Math.cos(m)*o-.0335*Math.cos(L)*o+.0012*Math.cos(B-O+m)*o-16e-5*Math.cos(L)*r+4e-5*Math.cos(P)*r+4e-5*Math.cos(m)*r;const R=2.116*Math.sin(L)*i-.111*Math.sin(B-O-L)*i-.0015*Math.sin(L)*o;_+=R,T+=R,p+=-520.77*Math.sin(L)*i+13.66*Math.sin(B-O+L)*i+1.12*Math.sin(B-L)*i-1.06*Math.sin(O-L)*i+.66*Math.sin(m)*o+.371*Math.sin(L)*o-.035*Math.sin(B-O+m)*o-.015*Math.sin(B-O+L)*o+.0014*Math.sin(L)*r-.0011*Math.sin(P)*r-9e-4*Math.sin(m)*r,a*=O1e;const U=u+f*Kc,W=h+_*Kc,q=y+T*Kc,Y=g+p*Kc;return GK(a,c,U,W,Y,q,t)}const w5=.012300034,TPe=w5/(w5+1)*-1;function CPe(e,t){return t=WK(e,t),d.multiplyByScalar(t,TPe,t)}const qK=new te(1.0000000000000002,5619723173785822e-31,4690511510146299e-34,-5154129427414611e-31,.9174820620691819,-.39777715593191376,-223970096136568e-30,.39777715593191376,.9174820620691819);let yC=new d;W3.computeSunPositionInEarthInertialFrame=function(e,t){return l(e)||(e=ce.now()),l(t)||(t=new d),yC=APe(e,yC),t=d.negate(yC,t),CPe(e,yC),d.subtract(t,yC,t),te.multiplyByVector(qK,t,t),t};W3.computeMoonPositionInEarthInertialFrame=function(e,t){return l(e)||(e=ce.now()),t=WK(e,t),te.multiplyByVector(qK,t,t),t};const jM=W3,xD={MORPHING:0,COLUMBUS_VIEW:1,SCENE2D:2,SCENE3D:3};xD.getMorphTime=function(e){return e===xD.SCENE3D?1:e===xD.MORPHING?void 0:0};const me=Object.freeze(xD);function j1(e){e=A(e,A.EMPTY_OBJECT),this.color=k.clone(A(e.color,k.WHITE)),this.intensity=A(e.intensity,2)}function CT(){this.globeDepthTexture=void 0,this.gamma=void 0,this._viewport=new at,this._viewportCartesian4=new ue,this._viewportDirty=!1,this._viewportOrthographicMatrix=N.clone(N.IDENTITY),this._viewportTransformation=N.clone(N.IDENTITY),this._model=N.clone(N.IDENTITY),this._view=N.clone(N.IDENTITY),this._inverseView=N.clone(N.IDENTITY),this._projection=N.clone(N.IDENTITY),this._infiniteProjection=N.clone(N.IDENTITY),this._entireFrustum=new $,this._currentFrustum=new $,this._frustumPlanes=new ue,this._farDepthFromNearPlusOne=void 0,this._log2FarDepthFromNearPlusOne=void 0,this._oneOverLog2FarDepthFromNearPlusOne=void 0,this._frameState=void 0,this._temeToPseudoFixed=te.clone(N.IDENTITY),this._view3DDirty=!0,this._view3D=new N,this._inverseView3DDirty=!0,this._inverseView3D=new N,this._inverseModelDirty=!0,this._inverseModel=new N,this._inverseTransposeModelDirty=!0,this._inverseTransposeModel=new te,this._viewRotation=new te,this._inverseViewRotation=new te,this._viewRotation3D=new te,this._inverseViewRotation3D=new te,this._inverseProjectionDirty=!0,this._inverseProjection=new N,this._modelViewDirty=!0,this._modelView=new N,this._modelView3DDirty=!0,this._modelView3D=new N,this._modelViewRelativeToEyeDirty=!0,this._modelViewRelativeToEye=new N,this._inverseModelViewDirty=!0,this._inverseModelView=new N,this._inverseModelView3DDirty=!0,this._inverseModelView3D=new N,this._viewProjectionDirty=!0,this._viewProjection=new N,this._inverseViewProjectionDirty=!0,this._inverseViewProjection=new N,this._modelViewProjectionDirty=!0,this._modelViewProjection=new N,this._inverseModelViewProjectionDirty=!0,this._inverseModelViewProjection=new N,this._modelViewProjectionRelativeToEyeDirty=!0,this._modelViewProjectionRelativeToEye=new N,this._modelViewInfiniteProjectionDirty=!0,this._modelViewInfiniteProjection=new N,this._normalDirty=!0,this._normal=new te,this._normal3DDirty=!0,this._normal3D=new te,this._inverseNormalDirty=!0,this._inverseNormal=new te,this._inverseNormal3DDirty=!0,this._inverseNormal3D=new te,this._encodedCameraPositionMCDirty=!0,this._encodedCameraPositionMC=new Zn,this._cameraPosition=new d,this._sunPositionWC=new d,this._sunPositionColumbusView=new d,this._sunDirectionWC=new d,this._sunDirectionEC=new d,this._moonDirectionEC=new d,this._lightDirectionWC=new d,this._lightDirectionEC=new d,this._lightColor=new d,this._lightColorHdr=new d,this._pass=void 0,this._mode=void 0,this._mapProjection=void 0,this._ellipsoid=void 0,this._cameraDirection=new d,this._cameraRight=new d,this._cameraUp=new d,this._frustum2DWidth=0,this._eyeHeight=0,this._eyeHeight2D=new $,this._pixelRatio=1,this._orthographicIn3D=!1,this._backgroundColor=new k,this._brdfLut=void 0,this._environmentMap=void 0,this._sphericalHarmonicCoefficients=void 0,this._specularEnvironmentMaps=void 0,this._specularEnvironmentMapsDimensions=new $,this._specularEnvironmentMapsMaximumLOD=void 0,this._fogDensity=void 0,this._invertClassificationColor=void 0,this._splitPosition=0,this._pixelSizePerMeter=void 0,this._geometricToleranceOverMeter=void 0,this._minimumDisableDepthTestDistance=void 0}Object.defineProperties(CT.prototype,{frameState:{get:function(){return this._frameState}},viewport:{get:function(){return this._viewport},set:function(e){if(!at.equals(e,this._viewport)){at.clone(e,this._viewport);const t=this._viewport,n=this._viewportCartesian4;n.x=t.x,n.y=t.y,n.z=t.width,n.w=t.height,this._viewportDirty=!0}}},viewportCartesian4:{get:function(){return this._viewportCartesian4}},viewportOrthographic:{get:function(){return S5(this),this._viewportOrthographicMatrix}},viewportTransformation:{get:function(){return S5(this),this._viewportTransformation}},model:{get:function(){return this._model},set:function(e){N.clone(e,this._model),this._modelView3DDirty=!0,this._inverseModelView3DDirty=!0,this._inverseModelDirty=!0,this._inverseTransposeModelDirty=!0,this._modelViewDirty=!0,this._inverseModelViewDirty=!0,this._modelViewRelativeToEyeDirty=!0,this._inverseModelViewDirty=!0,this._modelViewProjectionDirty=!0,this._inverseModelViewProjectionDirty=!0,this._modelViewProjectionRelativeToEyeDirty=!0,this._modelViewInfiniteProjectionDirty=!0,this._normalDirty=!0,this._inverseNormalDirty=!0,this._normal3DDirty=!0,this._inverseNormal3DDirty=!0,this._encodedCameraPositionMCDirty=!0}},inverseModel:{get:function(){return this._inverseModelDirty&&(this._inverseModelDirty=!1,N.inverse(this._model,this._inverseModel)),this._inverseModel}},inverseTransposeModel:{get:function(){const e=this._inverseTransposeModel;return this._inverseTransposeModelDirty&&(this._inverseTransposeModelDirty=!1,N.getMatrix3(this.inverseModel,e),te.transpose(e,e)),e}},view:{get:function(){return this._view}},view3D:{get:function(){return ZL(this),this._view3D}},viewRotation:{get:function(){return ZL(this),this._viewRotation}},viewRotation3D:{get:function(){return ZL(this),this._viewRotation3D}},inverseView:{get:function(){return this._inverseView}},inverseView3D:{get:function(){return I5(this),this._inverseView3D}},inverseViewRotation:{get:function(){return this._inverseViewRotation}},inverseViewRotation3D:{get:function(){return I5(this),this._inverseViewRotation3D}},projection:{get:function(){return this._projection}},inverseProjection:{get:function(){return OPe(this),this._inverseProjection}},infiniteProjection:{get:function(){return this._infiniteProjection}},modelView:{get:function(){return LPe(this),this._modelView}},modelView3D:{get:function(){return BPe(this),this._modelView3D}},modelViewRelativeToEye:{get:function(){return UPe(this),this._modelViewRelativeToEye}},inverseModelView:{get:function(){return RPe(this),this._inverseModelView}},inverseModelView3D:{get:function(){return NPe(this),this._inverseModelView3D}},viewProjection:{get:function(){return MPe(this),this._viewProjection}},inverseViewProjection:{get:function(){return FPe(this),this._inverseViewProjection}},modelViewProjection:{get:function(){return zPe(this),this._modelViewProjection}},inverseModelViewProjection:{get:function(){return HPe(this),this._inverseModelViewProjection}},modelViewProjectionRelativeToEye:{get:function(){return VPe(this),this._modelViewProjectionRelativeToEye}},modelViewInfiniteProjection:{get:function(){return kPe(this),this._modelViewInfiniteProjection}},normal:{get:function(){return GPe(this),this._normal}},normal3D:{get:function(){return WPe(this),this._normal3D}},inverseNormal:{get:function(){return qPe(this),this._inverseNormal}},inverseNormal3D:{get:function(){return jPe(this),this._inverseNormal3D}},entireFrustum:{get:function(){return this._entireFrustum}},currentFrustum:{get:function(){return this._currentFrustum}},frustumPlanes:{get:function(){return this._frustumPlanes}},farDepthFromNearPlusOne:{get:function(){return this._farDepthFromNearPlusOne}},log2FarDepthFromNearPlusOne:{get:function(){return this._log2FarDepthFromNearPlusOne}},oneOverLog2FarDepthFromNearPlusOne:{get:function(){return this._oneOverLog2FarDepthFromNearPlusOne}},eyeHeight:{get:function(){return this._eyeHeight}},eyeHeight2D:{get:function(){return this._eyeHeight2D}},sunPositionWC:{get:function(){return this._sunPositionWC}},sunPositionColumbusView:{get:function(){return this._sunPositionColumbusView}},sunDirectionWC:{get:function(){return this._sunDirectionWC}},sunDirectionEC:{get:function(){return this._sunDirectionEC}},moonDirectionEC:{get:function(){return this._moonDirectionEC}},lightDirectionWC:{get:function(){return this._lightDirectionWC}},lightDirectionEC:{get:function(){return this._lightDirectionEC}},lightColor:{get:function(){return this._lightColor}},lightColorHdr:{get:function(){return this._lightColorHdr}},encodedCameraPositionMCHigh:{get:function(){return D5(this),this._encodedCameraPositionMC.high}},encodedCameraPositionMCLow:{get:function(){return D5(this),this._encodedCameraPositionMC.low}},temeToPseudoFixedMatrix:{get:function(){return this._temeToPseudoFixed}},pixelRatio:{get:function(){return this._pixelRatio}},fogDensity:{get:function(){return this._fogDensity}},geometricToleranceOverMeter:{get:function(){return this._geometricToleranceOverMeter}},pass:{get:function(){return this._pass}},backgroundColor:{get:function(){return this._backgroundColor}},brdfLut:{get:function(){return this._brdfLut}},environmentMap:{get:function(){return this._environmentMap}},sphericalHarmonicCoefficients:{get:function(){return this._sphericalHarmonicCoefficients}},specularEnvironmentMaps:{get:function(){return this._specularEnvironmentMaps}},specularEnvironmentMapsDimensions:{get:function(){return this._specularEnvironmentMapsDimensions}},specularEnvironmentMapsMaximumLOD:{get:function(){return this._specularEnvironmentMapsMaximumLOD}},splitPosition:{get:function(){return this._splitPosition}},minimumDisableDepthTestDistance:{get:function(){return this._minimumDisableDepthTestDistance}},invertClassificationColor:{get:function(){return this._invertClassificationColor}},orthographicIn3D:{get:function(){return this._orthographicIn3D}},ellipsoid:{get:function(){return A(this._ellipsoid,be.WGS84)}}});function bPe(e,t){N.clone(t,e._view),N.getMatrix3(t,e._viewRotation),e._view3DDirty=!0,e._inverseView3DDirty=!0,e._modelViewDirty=!0,e._modelView3DDirty=!0,e._modelViewRelativeToEyeDirty=!0,e._inverseModelViewDirty=!0,e._inverseModelView3DDirty=!0,e._viewProjectionDirty=!0,e._inverseViewProjectionDirty=!0,e._modelViewProjectionDirty=!0,e._modelViewProjectionRelativeToEyeDirty=!0,e._modelViewInfiniteProjectionDirty=!0,e._normalDirty=!0,e._inverseNormalDirty=!0,e._normal3DDirty=!0,e._inverseNormal3DDirty=!0}function EPe(e,t){N.clone(t,e._inverseView),N.getMatrix3(t,e._inverseViewRotation)}function xPe(e,t){N.clone(t,e._projection),e._inverseProjectionDirty=!0,e._viewProjectionDirty=!0,e._inverseViewProjectionDirty=!0,e._modelViewProjectionDirty=!0,e._modelViewProjectionRelativeToEyeDirty=!0}function wPe(e,t){N.clone(t,e._infiniteProjection),e._modelViewInfiniteProjectionDirty=!0}function SPe(e,t){d.clone(t.positionWC,e._cameraPosition),d.clone(t.directionWC,e._cameraDirection),d.clone(t.rightWC,e._cameraRight),d.clone(t.upWC,e._cameraUp);const n=t.positionCartographic;l(n)?e._eyeHeight=n.height:e._eyeHeight=-e._ellipsoid.maximumRadius,e._encodedCameraPositionMCDirty=!0}let AC=new te;const vPe=new ve;function DPe(e,t){l(En.computeIcrfToFixedMatrix(t.time,AC))||(AC=En.computeTemeToPseudoFixedMatrix(t.time,AC));let n=jM.computeSunPositionInEarthInertialFrame(t.time,e._sunPositionWC);te.multiplyByVector(AC,n,n),d.normalize(n,e._sunDirectionWC),n=te.multiplyByVector(e.viewRotation3D,n,e._sunDirectionEC),d.normalize(n,n),n=jM.computeMoonPositionInEarthInertialFrame(t.time,e._moonDirectionEC),te.multiplyByVector(AC,n,n),te.multiplyByVector(e.viewRotation3D,n,n),d.normalize(n,n);const i=t.mapProjection,r=i.ellipsoid.cartesianToCartographic(e._sunPositionWC,vPe);i.project(r,e._sunPositionColumbusView)}CT.prototype.updateCamera=function(e){bPe(this,e.viewMatrix),EPe(this,e.inverseViewMatrix),SPe(this,e),this._entireFrustum.x=e.frustum.near,this._entireFrustum.y=e.frustum.far,this.updateFrustum(e.frustum),this._orthographicIn3D=this._mode!==me.SCENE2D&&e.frustum instanceof nn};CT.prototype.updateFrustum=function(e){xPe(this,e.projectionMatrix),l(e.infiniteProjectionMatrix)&&wPe(this,e.infiniteProjectionMatrix),this._currentFrustum.x=e.near,this._currentFrustum.y=e.far,this._farDepthFromNearPlusOne=e.far-e.near+1,this._log2FarDepthFromNearPlusOne=F.log2(this._farDepthFromNearPlusOne),this._oneOverLog2FarDepthFromNearPlusOne=1/this._log2FarDepthFromNearPlusOne,l(e._offCenterFrustum)&&(e=e._offCenterFrustum),this._frustumPlanes.x=e.top,this._frustumPlanes.y=e.bottom,this._frustumPlanes.z=e.left,this._frustumPlanes.w=e.right};CT.prototype.updatePass=function(e){this._pass=e};const IPe=[],PPe=new j1;CT.prototype.update=function(e){this._mode=e.mode,this._mapProjection=e.mapProjection,this._ellipsoid=e.mapProjection.ellipsoid,this._pixelRatio=e.pixelRatio;const t=e.camera;this.updateCamera(t),e.mode===me.SCENE2D?(this._frustum2DWidth=t.frustum.right-t.frustum.left,this._eyeHeight2D.x=this._frustum2DWidth*.5,this._eyeHeight2D.y=this._eyeHeight2D.x*this._eyeHeight2D.x):(this._frustum2DWidth=0,this._eyeHeight2D.x=0,this._eyeHeight2D.y=0),DPe(this,e);const n=A(e.light,PPe);n instanceof j1?(this._lightDirectionWC=d.clone(this._sunDirectionWC,this._lightDirectionWC),this._lightDirectionEC=d.clone(this._sunDirectionEC,this._lightDirectionEC)):(this._lightDirectionWC=d.normalize(d.negate(n.direction,this._lightDirectionWC),this._lightDirectionWC),this._lightDirectionEC=te.multiplyByVector(this.viewRotation3D,this._lightDirectionWC,this._lightDirectionEC));const i=n.color;let o=d.fromElements(i.red,i.green,i.blue,this._lightColorHdr);o=d.multiplyByScalar(o,n.intensity,o);const r=d.maximumComponent(o);r>1?d.divideByScalar(o,r,this._lightColor):d.clone(o,this._lightColor);const s=e.brdfLutGenerator,a=l(s)?s.colorTexture:void 0;this._brdfLut=a,this._environmentMap=A(e.environmentMap,e.context.defaultCubeMap),this._sphericalHarmonicCoefficients=A(e.sphericalHarmonicCoefficients,IPe),this._specularEnvironmentMaps=e.specularEnvironmentMaps,this._specularEnvironmentMapsMaximumLOD=e.specularEnvironmentMapsMaximumLOD,l(this._specularEnvironmentMaps)&&$.clone(this._specularEnvironmentMaps.dimensions,this._specularEnvironmentMapsDimensions),this._fogDensity=e.fog.density,this._invertClassificationColor=e.invertClassificationColor,this._frameState=e,this._temeToPseudoFixed=En.computeTemeToPseudoFixedMatrix(e.time,this._temeToPseudoFixed),this._splitPosition=e.splitPosition*e.context.drawingBufferWidth;const c=t.frustum.fov,u=this._viewport;let f;l(c)?u.height>u.width?f=Math.tan(.5*c)*2/u.height:f=Math.tan(.5*c)*2/u.width:f=1/Math.max(u.width,u.height),this._geometricToleranceOverMeter=f*e.maximumScreenSpaceError,k.clone(e.backgroundColor,this._backgroundColor),this._minimumDisableDepthTestDistance=e.minimumDisableDepthTestDistance,this._minimumDisableDepthTestDistance*=this._minimumDisableDepthTestDistance,this._minimumDisableDepthTestDistance===Number.POSITIVE_INFINITY&&(this._minimumDisableDepthTestDistance=-1)};function S5(e){if(e._viewportDirty){const t=e._viewport;N.computeOrthographicOffCenter(t.x,t.x+t.width,t.y,t.y+t.height,0,1,e._viewportOrthographicMatrix),N.computeViewportTransformation(t,0,1,e._viewportTransformation),e._viewportDirty=!1}}function OPe(e){e._inverseProjectionDirty&&(e._inverseProjectionDirty=!1,e._mode!==me.SCENE2D&&e._mode!==me.MORPHING&&!e._orthographicIn3D?N.inverse(e._projection,e._inverseProjection):N.clone(N.ZERO,e._inverseProjection))}function LPe(e){e._modelViewDirty&&(e._modelViewDirty=!1,N.multiplyTransformation(e._view,e._model,e._modelView))}function BPe(e){e._modelView3DDirty&&(e._modelView3DDirty=!1,N.multiplyTransformation(e.view3D,e._model,e._modelView3D))}function RPe(e){e._inverseModelViewDirty&&(e._inverseModelViewDirty=!1,N.inverse(e.modelView,e._inverseModelView))}function NPe(e){e._inverseModelView3DDirty&&(e._inverseModelView3DDirty=!1,N.inverse(e.modelView3D,e._inverseModelView3D))}function MPe(e){e._viewProjectionDirty&&(e._viewProjectionDirty=!1,N.multiply(e._projection,e._view,e._viewProjection))}function FPe(e){e._inverseViewProjectionDirty&&(e._inverseViewProjectionDirty=!1,N.inverse(e.viewProjection,e._inverseViewProjection))}function zPe(e){e._modelViewProjectionDirty&&(e._modelViewProjectionDirty=!1,N.multiply(e._projection,e.modelView,e._modelViewProjection))}function UPe(e){if(e._modelViewRelativeToEyeDirty){e._modelViewRelativeToEyeDirty=!1;const t=e.modelView,n=e._modelViewRelativeToEye;n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[4]=t[4],n[5]=t[5],n[6]=t[6],n[7]=t[7],n[8]=t[8],n[9]=t[9],n[10]=t[10],n[11]=t[11],n[12]=0,n[13]=0,n[14]=0,n[15]=t[15]}}function HPe(e){e._inverseModelViewProjectionDirty&&(e._inverseModelViewProjectionDirty=!1,N.inverse(e.modelViewProjection,e._inverseModelViewProjection))}function VPe(e){e._modelViewProjectionRelativeToEyeDirty&&(e._modelViewProjectionRelativeToEyeDirty=!1,N.multiply(e._projection,e.modelViewRelativeToEye,e._modelViewProjectionRelativeToEye))}function kPe(e){e._modelViewInfiniteProjectionDirty&&(e._modelViewInfiniteProjectionDirty=!1,N.multiply(e._infiniteProjection,e.modelView,e._modelViewInfiniteProjection))}function GPe(e){if(e._normalDirty){e._normalDirty=!1;const t=e._normal;N.getMatrix3(e.inverseModelView,t),te.getRotation(t,t),te.transpose(t,t)}}function WPe(e){if(e._normal3DDirty){e._normal3DDirty=!1;const t=e._normal3D;N.getMatrix3(e.inverseModelView3D,t),te.getRotation(t,t),te.transpose(t,t)}}function qPe(e){e._inverseNormalDirty&&(e._inverseNormalDirty=!1,N.getMatrix3(e.inverseModelView,e._inverseNormal),te.getRotation(e._inverseNormal,e._inverseNormal))}function jPe(e){e._inverseNormal3DDirty&&(e._inverseNormal3DDirty=!1,N.getMatrix3(e.inverseModelView3D,e._inverseNormal3D),te.getRotation(e._inverseNormal3D,e._inverseNormal3D))}const v5=new d;function D5(e){e._encodedCameraPositionMCDirty&&(e._encodedCameraPositionMCDirty=!1,N.multiplyByPoint(e.inverseModel,e._cameraPosition,v5),Zn.fromCartesian(v5,e._encodedCameraPositionMC))}const YPe=new d,$Pe=new d,XPe=new d,KPe=new d,JPe=new ve,QPe=new d,ZPe=new N;function eOe(e,t,n,i,o,r,s,a){const c=YPe;c.x=e.y,c.y=e.z,c.z=e.x;const u=$Pe;u.x=n.y,u.y=n.z,u.z=n.x;const f=XPe;f.x=i.y,f.y=i.z,f.z=i.x;const h=KPe;h.x=t.y,h.y=t.z,h.z=t.x,r===me.SCENE2D&&(c.z=o*.5);const _=s.unproject(c,JPe);_.longitude=F.clamp(_.longitude,-Math.PI,Math.PI),_.latitude=F.clamp(_.latitude,-F.PI_OVER_TWO,F.PI_OVER_TWO);const g=s.ellipsoid,p=g.cartographicToCartesian(_,QPe),y=En.eastNorthUpToFixedFrame(p,g,ZPe);return N.multiplyByPointAsVector(y,u,u),N.multiplyByPointAsVector(y,f,f),N.multiplyByPointAsVector(y,h,h),l(a)||(a=new N),a[0]=u.x,a[1]=f.x,a[2]=-h.x,a[3]=0,a[4]=u.y,a[5]=f.y,a[6]=-h.y,a[7]=0,a[8]=u.z,a[9]=f.z,a[10]=-h.z,a[11]=0,a[12]=-d.dot(u,p),a[13]=-d.dot(f,p),a[14]=d.dot(h,p),a[15]=1,a}function ZL(e){e._view3DDirty&&(e._mode===me.SCENE3D?N.clone(e._view,e._view3D):eOe(e._cameraPosition,e._cameraDirection,e._cameraRight,e._cameraUp,e._frustum2DWidth,e._mode,e._mapProjection,e._view3D),N.getMatrix3(e._view3D,e._viewRotation3D),e._view3DDirty=!1)}function I5(e){e._inverseView3DDirty&&(N.inverseTransformation(e.view3D,e._inverseView3D),N.getMatrix3(e._inverseView3D,e._inverseViewRotation3D),e._inverseView3DDirty=!1)}function tOe(e,t,n,i){const o=l(t.vertexBuffer),r=l(t.value),s=t.value?t.value.length:t.componentsPerAttribute;if(!o&&!r)throw new w("attribute must have a vertexBuffer or a value.");if(o&&r)throw new w("attribute cannot have both a vertexBuffer and a value. It must have either a vertexBuffer property defining per-vertex data or a value property defining data for all vertices.");if(s!==1&&s!==2&&s!==3&&s!==4)throw r?new w("attribute.value.length must be in the range [1, 4]."):new w("attribute.componentsPerAttribute must be in the range [1, 4].");if(l(t.componentDatatype)&&!oe.validate(t.componentDatatype))throw new w("attribute must have a valid componentDatatype or not specify it.");if(l(t.strideInBytes)&&t.strideInBytes>255)throw new w("attribute must have a strideInBytes less than or equal to 255 or not specify it.");if(l(t.instanceDivisor)&&t.instanceDivisor>0&&!i.instancedArrays)throw new w("instanced arrays is not supported");if(l(t.instanceDivisor)&&t.instanceDivisor<0)throw new w("attribute must have an instanceDivisor greater than or equal to zero");if(l(t.instanceDivisor)&&r)throw new w("attribute cannot have have an instanceDivisor if it is not backed by a buffer");if(l(t.instanceDivisor)&&t.instanceDivisor>0&&t.index===0)throw new w("attribute zero cannot have an instanceDivisor greater than 0");const a={index:A(t.index,n),enabled:A(t.enabled,!0),vertexBuffer:t.vertexBuffer,value:r?t.value.slice(0):void 0,componentsPerAttribute:s,componentDatatype:A(t.componentDatatype,oe.FLOAT),normalize:A(t.normalize,!1),offsetInBytes:A(t.offsetInBytes,0),strideInBytes:A(t.strideInBytes,0),instanceDivisor:A(t.instanceDivisor,0)};if(o)a.vertexAttrib=function(c){const u=this.index;c.bindBuffer(c.ARRAY_BUFFER,this.vertexBuffer._getBuffer()),c.vertexAttribPointer(u,this.componentsPerAttribute,this.componentDatatype,this.normalize,this.strideInBytes,this.offsetInBytes),c.enableVertexAttribArray(u),this.instanceDivisor>0&&(i.glVertexAttribDivisor(u,this.instanceDivisor),i._vertexAttribDivisors[u]=this.instanceDivisor,i._previousDrawInstanced=!0)},a.disableVertexAttribArray=function(c){c.disableVertexAttribArray(this.index),this.instanceDivisor>0&&i.glVertexAttribDivisor(n,0)};else{switch(a.componentsPerAttribute){case 1:a.vertexAttrib=function(c){c.vertexAttrib1fv(this.index,this.value)};break;case 2:a.vertexAttrib=function(c){c.vertexAttrib2fv(this.index,this.value)};break;case 3:a.vertexAttrib=function(c){c.vertexAttrib3fv(this.index,this.value)};break;case 4:a.vertexAttrib=function(c){c.vertexAttrib4fv(this.index,this.value)};break}a.disableVertexAttribArray=function(c){}}e.push(a)}function jK(e,t,n){for(let i=0;i<t.length;++i){const o=t[i];o.enabled&&o.vertexAttrib(e)}l(n)&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n._getBuffer())}function Fo(e){e=A(e,A.EMPTY_OBJECT),E.defined("options.context",e.context),E.defined("options.attributes",e.attributes);const t=e.context,n=t._gl,i=e.attributes,o=e.indexBuffer;let r;const s=[];let a=1,c=!1,u=!1,f=i.length;for(r=0;r<f;++r)tOe(s,i[r],r,t);for(f=s.length,r=0;r<f;++r){const g=s[r];if(l(g.vertexBuffer)&&g.instanceDivisor===0){const p=g.strideInBytes||g.componentsPerAttribute*oe.getSizeInBytes(g.componentDatatype);a=g.vertexBuffer.sizeInBytes/p;break}}for(r=0;r<f;++r)s[r].instanceDivisor>0&&(c=!0),l(s[r].value)&&(u=!0);const h={};for(r=0;r<f;++r){const g=s[r].index;if(h[g])throw new w(`Index ${g} is used by more than one attribute.`);h[g]=!0}let _;t.vertexArrayObject&&(_=t.glCreateVertexArray(),t.glBindVertexArray(_),jK(n,s,o),t.glBindVertexArray(null)),this._numberOfVertices=a,this._hasInstancedAttributes=c,this._hasConstantAttributes=u,this._context=t,this._gl=n,this._vao=_,this._attributes=s,this._indexBuffer=o}function P5(e){return e.values.length/e.componentsPerAttribute}function nOe(e){return oe.getSizeInBytes(e.componentDatatype)*e.componentsPerAttribute}function iOe(e){let t,n,i;const o=[];for(n in e)e.hasOwnProperty(n)&&l(e[n])&&l(e[n].values)&&(o.push(n),e[n].componentDatatype===oe.DOUBLE&&(e[n].componentDatatype=oe.FLOAT,e[n].values=oe.createTypedArray(oe.FLOAT,e[n].values)));let r;const s=o.length;if(s>0)for(r=P5(e[o[0]]),t=1;t<s;++t){const u=P5(e[o[t]]);if(u!==r)throw new Fe(`Each attribute list must have the same number of vertices. Attribute ${o[t]} has a different number of vertices (${u.toString()}) than attribute ${o[0]} (${r.toString()}).`)}o.sort(function(u,f){return oe.getSizeInBytes(e[f].componentDatatype)-oe.getSizeInBytes(e[u].componentDatatype)});let a=0;const c={};for(t=0;t<s;++t)n=o[t],i=e[n],c[n]=a,a+=nOe(i);if(a>0){const u=oe.getSizeInBytes(e[o[0]].componentDatatype),f=a%u;f!==0&&(a+=u-f);const h=r*a,_=new ArrayBuffer(h),g={};for(t=0;t<s;++t){n=o[t];const p=oe.getSizeInBytes(e[n].componentDatatype);g[n]={pointer:oe.createTypedArray(e[n].componentDatatype,_),index:c[n]/p,strideInComponentType:a/p}}for(t=0;t<r;++t)for(let p=0;p<s;++p){n=o[p],i=e[n];const y=i.values,T=g[n],b=T.pointer,x=i.componentsPerAttribute;for(let v=0;v<x;++v)b[T.index+v]=y[t*x+v];T.index+=T.strideInComponentType}return{buffer:_,offsetsInBytes:c,vertexSizeInBytes:a}}}Fo.fromGeometry=function(e){e=A(e,A.EMPTY_OBJECT),E.defined("options.context",e.context);const t=e.context,n=A(e.geometry,A.EMPTY_OBJECT),i=A(e.bufferUsage,mt.DYNAMIC_DRAW),o=A(e.attributeLocations,A.EMPTY_OBJECT),r=A(e.interleave,!1),s=e.vertexArrayAttributes;let a,c,u;const f=l(s)?s:[],h=n.attributes;if(r){const p=iOe(h);if(l(p)){u=Mt.createVertexBuffer({context:t,typedArray:p.buffer,usage:i});const y=p.offsetsInBytes,T=p.vertexSizeInBytes;for(a in h)h.hasOwnProperty(a)&&l(h[a])&&(c=h[a],l(c.values)?f.push({index:o[a],vertexBuffer:u,componentDatatype:c.componentDatatype,componentsPerAttribute:c.componentsPerAttribute,normalize:c.normalize,offsetInBytes:y[a],strideInBytes:T}):f.push({index:o[a],value:c.value,componentDatatype:c.componentDatatype,normalize:c.normalize}))}}else for(a in h)if(h.hasOwnProperty(a)&&l(h[a])){c=h[a];let p=c.componentDatatype;p===oe.DOUBLE&&(p=oe.FLOAT),u=void 0,l(c.values)&&(u=Mt.createVertexBuffer({context:t,typedArray:oe.createTypedArray(p,c.values),usage:i})),f.push({index:o[a],vertexBuffer:u,value:c.value,componentDatatype:p,componentsPerAttribute:c.componentsPerAttribute,normalize:c.normalize})}let _;const g=n.indices;return l(g)&&($t.computeNumberOfVertices(n)>=F.SIXTY_FOUR_KILOBYTES&&t.elementIndexUint?_=Mt.createIndexBuffer({context:t,typedArray:new Uint32Array(g),usage:i,indexDatatype:At.UNSIGNED_INT}):_=Mt.createIndexBuffer({context:t,typedArray:new Uint16Array(g),usage:i,indexDatatype:At.UNSIGNED_SHORT})),new Fo({context:t,attributes:f,indexBuffer:_})};Object.defineProperties(Fo.prototype,{numberOfAttributes:{get:function(){return this._attributes.length}},numberOfVertices:{get:function(){return this._numberOfVertices}},indexBuffer:{get:function(){return this._indexBuffer}}});Fo.prototype.getAttribute=function(e){return E.defined("index",e),this._attributes[e]};function oOe(e){const t=e._context,n=e._hasInstancedAttributes;if(!n&&!t._previousDrawInstanced)return;t._previousDrawInstanced=n;const i=t._vertexAttribDivisors,o=e._attributes,r=Gt.maximumVertexAttributes;let s;if(n){const a=o.length;for(s=0;s<a;++s){const c=o[s];if(c.enabled){const u=c.instanceDivisor,f=c.index;u!==i[f]&&(t.glVertexAttribDivisor(f,u),i[f]=u)}}}else for(s=0;s<r;++s)i[s]>0&&(t.glVertexAttribDivisor(s,0),i[s]=0)}function rOe(e,t){const n=e._attributes,i=n.length;for(let o=0;o<i;++o){const r=n[o];r.enabled&&l(r.value)&&r.vertexAttrib(t)}}Fo.prototype._bind=function(){l(this._vao)?(this._context.glBindVertexArray(this._vao),this._context.instancedArrays&&oOe(this),this._hasConstantAttributes&&rOe(this,this._gl)):jK(this._gl,this._attributes,this._indexBuffer)};Fo.prototype._unBind=function(){if(l(this._vao))this._context.glBindVertexArray(null);else{const e=this._attributes,t=this._gl;for(let n=0;n<e.length;++n){const i=e[n];i.enabled&&i.disableVertexAttribArray(t)}this._indexBuffer&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,null)}};Fo.prototype.isDestroyed=function(){return!1};Fo.prototype.destroy=function(){const e=this._attributes;for(let n=0;n<e.length;++n){const i=e[n].vertexBuffer;l(i)&&!i.isDestroyed()&&i.vertexArrayDestroyable&&i.destroy()}const t=this._indexBuffer;return l(t)&&!t.isDestroyed()&&t.vertexArrayDestroyable&&t.destroy(),l(this._vao)&&this._context.glDeleteVertexArray(this._vao),Je(this)};function Hc(e,t){E.defined("canvas",e);let n=!1;l(t)&&l(t.requestWebgl2)&&(n=t.requestWebgl2,Hc._deprecationWarning("ContextOptions.requestWebgl2","Cesium.requestWebgl2 was deprecated in CesiumJS 1.101 and will be removed in 1.102. Use Cesium.requestWebgl1 to request a WebGL1 or WebGL2 context."));const{getWebGLStub:i,requestWebgl1:o=!n,webgl:r={},allowTextureFilterAnisotropic:s=!0}=A(t,{});r.alpha=A(r.alpha,!1),r.stencil=A(r.stencil,!0),r.powerPreference=A(r.powerPreference,"high-performance");const a=l(i)?i(e,r):sOe(e,r,o),c=typeof WebGL2RenderingContext<"u"&&a instanceof WebGL2RenderingContext;this._canvas=e,this._originalGLContext=a,this._gl=a,this._webgl2=c,this._id=ma(),this.validateFramebuffer=!1,this.validateShaderProgram=!1,this.logShaderCompilation=!1,this._throwOnWebGLError=!1,this._shaderCache=new wf(this),this._textureCache=new Dy;const u=a;this._stencilBits=u.getParameter(u.STENCIL_BITS),Gt._maximumCombinedTextureImageUnits=u.getParameter(u.MAX_COMBINED_TEXTURE_IMAGE_UNITS),Gt._maximumCubeMapSize=u.getParameter(u.MAX_CUBE_MAP_TEXTURE_SIZE),Gt._maximumFragmentUniformVectors=u.getParameter(u.MAX_FRAGMENT_UNIFORM_VECTORS),Gt._maximumTextureImageUnits=u.getParameter(u.MAX_TEXTURE_IMAGE_UNITS),Gt._maximumRenderbufferSize=u.getParameter(u.MAX_RENDERBUFFER_SIZE),Gt._maximumTextureSize=u.getParameter(u.MAX_TEXTURE_SIZE),Gt._maximumVaryingVectors=u.getParameter(u.MAX_VARYING_VECTORS),Gt._maximumVertexAttributes=u.getParameter(u.MAX_VERTEX_ATTRIBS),Gt._maximumVertexTextureImageUnits=u.getParameter(u.MAX_VERTEX_TEXTURE_IMAGE_UNITS),Gt._maximumVertexUniformVectors=u.getParameter(u.MAX_VERTEX_UNIFORM_VECTORS),Gt._maximumSamples=this._webgl2?u.getParameter(u.MAX_SAMPLES):0;const f=u.getParameter(u.ALIASED_LINE_WIDTH_RANGE);Gt._minimumAliasedLineWidth=f[0],Gt._maximumAliasedLineWidth=f[1];const h=u.getParameter(u.ALIASED_POINT_SIZE_RANGE);Gt._minimumAliasedPointSize=h[0],Gt._maximumAliasedPointSize=h[1];const _=u.getParameter(u.MAX_VIEWPORT_DIMS);Gt._maximumViewportWidth=_[0],Gt._maximumViewportHeight=_[1];const g=u.getShaderPrecisionFormat(u.FRAGMENT_SHADER,u.HIGH_FLOAT);Gt._highpFloatSupported=g.precision!==0;const p=u.getShaderPrecisionFormat(u.FRAGMENT_SHADER,u.HIGH_INT);Gt._highpIntSupported=p.rangeMax!==0,this._antialias=u.getContextAttributes().antialias,this._standardDerivatives=!!xr(u,["OES_standard_derivatives"]),this._blendMinmax=!!xr(u,["EXT_blend_minmax"]),this._elementIndexUint=!!xr(u,["OES_element_index_uint"]),this._depthTexture=!!xr(u,["WEBGL_depth_texture","WEBKIT_WEBGL_depth_texture"]),this._fragDepth=!!xr(u,["EXT_frag_depth"]),this._debugShaders=xr(u,["WEBGL_debug_shaders"]),this._textureFloat=!!xr(u,["OES_texture_float"]),this._textureHalfFloat=!!xr(u,["OES_texture_half_float"]),this._textureFloatLinear=!!xr(u,["OES_texture_float_linear"]),this._textureHalfFloatLinear=!!xr(u,["OES_texture_half_float_linear"]),this._colorBufferFloat=!!xr(u,["EXT_color_buffer_float","WEBGL_color_buffer_float"]),this._floatBlend=!!xr(u,["EXT_float_blend"]),this._colorBufferHalfFloat=!!xr(u,["EXT_color_buffer_half_float"]),this._s3tc=!!xr(u,["WEBGL_compressed_texture_s3tc","MOZ_WEBGL_compressed_texture_s3tc","WEBKIT_WEBGL_compressed_texture_s3tc"]),this._pvrtc=!!xr(u,["WEBGL_compressed_texture_pvrtc","WEBKIT_WEBGL_compressed_texture_pvrtc"]),this._astc=!!xr(u,["WEBGL_compressed_texture_astc"]),this._etc=!!xr(u,["WEBG_compressed_texture_etc"]),this._etc1=!!xr(u,["WEBGL_compressed_texture_etc1"]),this._bc7=!!xr(u,["EXT_texture_compression_bptc"]),Sy.setKTX2SupportedFormats(this._s3tc,this._pvrtc,this._astc,this._etc,this._etc1,this._bc7);const y=s?xr(u,["EXT_texture_filter_anisotropic","WEBKIT_EXT_texture_filter_anisotropic"]):void 0;this._textureFilterAnisotropic=y,Gt._maximumTextureFilterAnisotropy=l(y)?u.getParameter(y.MAX_TEXTURE_MAX_ANISOTROPY_EXT):1;let T,b,x,v,D,L,B,V,M,H;if(c){const m=this;T=function(){return m._gl.createVertexArray()},b=function(P){m._gl.bindVertexArray(P)},x=function(P){m._gl.deleteVertexArray(P)},v=function(P,R,U,W,q){u.drawElementsInstanced(P,R,U,W,q)},D=function(P,R,U,W){u.drawArraysInstanced(P,R,U,W)},L=function(P,R){u.vertexAttribDivisor(P,R)},B=function(P){u.drawBuffers(P)}}else V=xr(u,["OES_vertex_array_object"]),l(V)&&(T=function(){return V.createVertexArrayOES()},b=function(m){V.bindVertexArrayOES(m)},x=function(m){V.deleteVertexArrayOES(m)}),M=xr(u,["ANGLE_instanced_arrays"]),l(M)&&(v=function(m,P,R,U,W){M.drawElementsInstancedANGLE(m,P,R,U,W)},D=function(m,P,R,U){M.drawArraysInstancedANGLE(m,P,R,U)},L=function(m,P){M.vertexAttribDivisorANGLE(m,P)}),H=xr(u,["WEBGL_draw_buffers"]),l(H)&&(B=function(m){H.drawBuffersWEBGL(m)});this.glCreateVertexArray=T,this.glBindVertexArray=b,this.glDeleteVertexArray=x,this.glDrawElementsInstanced=v,this.glDrawArraysInstanced=D,this.glVertexAttribDivisor=L,this.glDrawBuffers=B,this._vertexArrayObject=!!V,this._instancedArrays=!!M,this._drawBuffers=!!H,Gt._maximumDrawBuffers=this.drawBuffers?u.getParameter(fe.MAX_DRAW_BUFFERS):1,Gt._maximumColorAttachments=this.drawBuffers?u.getParameter(fe.MAX_COLOR_ATTACHMENTS):1,this._clearColor=new k(0,0,0,0),this._clearDepth=1,this._clearStencil=0;const G=new CT,I=new vy(this),O=ht.fromCache();this._defaultPassState=I,this._defaultRenderState=O,this._defaultTexture=void 0,this._defaultEmissiveTexture=void 0,this._defaultNormalTexture=void 0,this._defaultCubeMap=void 0,this._us=G,this._currentRenderState=O,this._currentPassState=I,this._currentFramebuffer=void 0,this._maxFrameTextureUnitIndex=0,this._vertexAttribDivisors=[],this._previousDrawInstanced=!1;for(let m=0;m<Gt._maximumVertexAttributes;m++)this._vertexAttribDivisors.push(0);this._pickObjects={},this._nextPickColor=new Uint32Array(1),this.options={getWebGLStub:i,requestWebgl1:o,webgl:r,allowTextureFilterAnisotropic:s},this.cache={},ht.apply(u,O,I)}function sOe(e,t,n){if(typeof WebGLRenderingContext>"u")throw new Fe("The browser does not support WebGL. Visit http://get.webgl.org.");!n&&!(typeof WebGL2RenderingContext<"u")&&(n=!0);const o=n?"webgl":"webgl2",r=e.getContext(o,t);if(!l(r))throw new Fe("The browser supports WebGL, but initialization failed.");return r}function aOe(e,t){let n="WebGL Error: ";switch(t){case e.INVALID_ENUM:n+="INVALID_ENUM";break;case e.INVALID_VALUE:n+="INVALID_VALUE";break;case e.INVALID_OPERATION:n+="INVALID_OPERATION";break;case e.OUT_OF_MEMORY:n+="OUT_OF_MEMORY";break;case e.CONTEXT_LOST_WEBGL:n+="CONTEXT_LOST_WEBGL lost";break;default:n+=`Unknown (${t})`}return n}function cOe(e,t,n,i){let o=`${aOe(e,i)}: ${t.name}(`;for(let r=0;r<n.length;++r)r!==0&&(o+=", "),o+=n[r];return o+=");",o}function lOe(e,t,n){const i=e.getError();if(i!==e.NO_ERROR)throw new Fe(cOe(e,t,n,i))}function uOe(e,t,n){return{get:function(){const i=e[t];return n(e,`get: ${t}`,i),e[t]},set:function(i){e[t]=i,n(e,`set: ${t}`,i)}}}function fOe(e,t){if(!l(t))return e;function n(o){return function(){const r=o.apply(e,arguments);return t(e,o,arguments),r}}const i={};for(const o in e){const r=e[o];r instanceof Function?i[o]=n(r):Object.defineProperty(i,o,uOe(e,o,t))}return i}function xr(e,t){const n=t.length;for(let i=0;i<n;++i){const o=e.getExtension(t[i]);if(o)return o}}const dOe={};Object.defineProperties(Hc.prototype,{id:{get:function(){return this._id}},webgl2:{get:function(){return this._webgl2}},canvas:{get:function(){return this._canvas}},shaderCache:{get:function(){return this._shaderCache}},textureCache:{get:function(){return this._textureCache}},uniformState:{get:function(){return this._us}},stencilBits:{get:function(){return this._stencilBits}},stencilBuffer:{get:function(){return this._stencilBits>=8}},antialias:{get:function(){return this._antialias}},msaa:{get:function(){return this._webgl2}},standardDerivatives:{get:function(){return this._standardDerivatives||this._webgl2}},floatBlend:{get:function(){return this._floatBlend}},blendMinmax:{get:function(){return this._blendMinmax||this._webgl2}},elementIndexUint:{get:function(){return this._elementIndexUint||this._webgl2}},depthTexture:{get:function(){return this._depthTexture||this._webgl2}},floatingPointTexture:{get:function(){return this._webgl2||this._textureFloat}},halfFloatingPointTexture:{get:function(){return this._webgl2||this._textureHalfFloat}},textureFloatLinear:{get:function(){return this._textureFloatLinear}},textureHalfFloatLinear:{get:function(){return this._webgl2&&this._textureFloatLinear||!this._webgl2&&this._textureHalfFloatLinear}},textureFilterAnisotropic:{get:function(){return!!this._textureFilterAnisotropic}},s3tc:{get:function(){return this._s3tc}},pvrtc:{get:function(){return this._pvrtc}},astc:{get:function(){return this._astc}},etc:{get:function(){return this._etc}},etc1:{get:function(){return this._etc1}},bc7:{get:function(){return this._bc7}},supportsBasis:{get:function(){return this._s3tc||this._pvrtc||this._astc||this._etc||this._etc1||this._bc7}},vertexArrayObject:{get:function(){return this._vertexArrayObject||this._webgl2}},fragmentDepth:{get:function(){return this._fragDepth||this._webgl2}},instancedArrays:{get:function(){return this._instancedArrays||this._webgl2}},colorBufferFloat:{get:function(){return this._colorBufferFloat}},colorBufferHalfFloat:{get:function(){return this._webgl2&&this._colorBufferFloat||!this._webgl2&&this._colorBufferHalfFloat}},drawBuffers:{get:function(){return this._drawBuffers||this._webgl2}},debugShaders:{get:function(){return this._debugShaders}},throwOnWebGLError:{get:function(){return this._throwOnWebGLError},set:function(e){this._throwOnWebGLError=e,this._gl=fOe(this._originalGLContext,e?lOe:void 0)}},defaultTexture:{get:function(){return this._defaultTexture===void 0&&(this._defaultTexture=new rn({context:this,source:{width:1,height:1,arrayBufferView:new Uint8Array([255,255,255,255])},flipY:!1})),this._defaultTexture}},defaultEmissiveTexture:{get:function(){return this._defaultEmissiveTexture===void 0&&(this._defaultEmissiveTexture=new rn({context:this,pixelFormat:yt.RGB,source:{width:1,height:1,arrayBufferView:new Uint8Array([0,0,0])},flipY:!1})),this._defaultEmissiveTexture}},defaultNormalTexture:{get:function(){return this._defaultNormalTexture===void 0&&(this._defaultNormalTexture=new rn({context:this,pixelFormat:yt.RGB,source:{width:1,height:1,arrayBufferView:new Uint8Array([128,128,255])},flipY:!1})),this._defaultNormalTexture}},defaultCubeMap:{get:function(){if(this._defaultCubeMap===void 0){const e={width:1,height:1,arrayBufferView:new Uint8Array([255,255,255,255])};this._defaultCubeMap=new xf({context:this,source:{positiveX:e,negativeX:e,positiveY:e,negativeY:e,positiveZ:e,negativeZ:e},flipY:!1})}return this._defaultCubeMap}},drawingBufferHeight:{get:function(){return this._gl.drawingBufferHeight}},drawingBufferWidth:{get:function(){return this._gl.drawingBufferWidth}},defaultFramebuffer:{get:function(){return dOe}}});function hOe(e){if(e.validateFramebuffer){const t=e._gl,n=t.checkFramebufferStatus(t.FRAMEBUFFER);if(n!==t.FRAMEBUFFER_COMPLETE){let i;switch(n){case t.FRAMEBUFFER_INCOMPLETE_ATTACHMENT:i="Framebuffer is not complete. Incomplete attachment: at least one attachment point with a renderbuffer or texture attached has its attached object no longer in existence or has an attached image with a width or height of zero, or the color attachment point has a non-color-renderable image attached, or the depth attachment point has a non-depth-renderable image attached, or the stencil attachment point has a non-stencil-renderable image attached. Color-renderable formats include GL_RGBA4, GL_RGB5_A1, and GL_RGB565. GL_DEPTH_COMPONENT16 is the only depth-renderable format. GL_STENCIL_INDEX8 is the only stencil-renderable format.";break;case t.FRAMEBUFFER_INCOMPLETE_DIMENSIONS:i="Framebuffer is not complete. Incomplete dimensions: not all attached images have the same width and height.";break;case t.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:i="Framebuffer is not complete. Missing attachment: no images are attached to the framebuffer.";break;case t.FRAMEBUFFER_UNSUPPORTED:i="Framebuffer is not complete. Unsupported: the combination of internal formats of the attached images violates an implementation-dependent set of restrictions.";break}throw new w(i)}}}function YK(e,t,n,i){const o=e._currentRenderState,r=e._currentPassState;e._currentRenderState=t,e._currentPassState=n,ht.partialApply(e._gl,o,t,r,n,i)}let q3;typeof WebGLRenderingContext<"u"&&(q3=[fe.BACK]);function j3(e,t){if(t!==e._currentFramebuffer){e._currentFramebuffer=t;let n=q3;if(l(t))t._bind(),hOe(e),n=t._getActiveColorAttachments();else{const i=e._gl;i.bindFramebuffer(i.FRAMEBUFFER,null)}e.drawBuffers&&e.glDrawBuffers(n)}}const pOe=new Bo;Hc.prototype.clear=function(e,t){e=A(e,pOe),t=A(t,this._defaultPassState);const n=this._gl;let i=0;const o=e.color,r=e.depth,s=e.stencil;l(o)&&(k.equals(this._clearColor,o)||(k.clone(o,this._clearColor),n.clearColor(o.red,o.green,o.blue,o.alpha)),i|=n.COLOR_BUFFER_BIT),l(r)&&(r!==this._clearDepth&&(this._clearDepth=r,n.clearDepth(r)),i|=n.DEPTH_BUFFER_BIT),l(s)&&(s!==this._clearStencil&&(this._clearStencil=s,n.clearStencil(s)),i|=n.STENCIL_BUFFER_BIT);const a=A(e.renderState,this._defaultRenderState);YK(this,a,t,!0);const c=A(e.framebuffer,t.framebuffer);j3(this,c),n.clear(i)};function mOe(e,t,n,i,o){if(l(t)&&o.depthTest&&o.depthTest.enabled&&!t.hasDepthAttachment)throw new w("The depth test can not be enabled (drawCommand.renderState.depthTest.enabled) because the framebuffer (drawCommand.framebuffer) does not have a depth or depth-stencil renderbuffer.");j3(e,t),YK(e,o,n,!1),i._bind(),e._maxFrameTextureUnitIndex=Math.max(e._maxFrameTextureUnitIndex,i.maximumTextureUnitIndex)}function _Oe(e,t,n,i){const o=t._primitiveType,r=t._vertexArray;let s=t._offset,a=t._count;const c=t.instanceCount;if(!dt.validate(o))throw new w("drawCommand.primitiveType is required and must be valid.");if(E.defined("drawCommand.vertexArray",r),E.typeOf.number.greaterThanOrEquals("drawCommand.offset",s,0),l(a)&&E.typeOf.number.greaterThanOrEquals("drawCommand.count",a,0),E.typeOf.number.greaterThanOrEquals("drawCommand.instanceCount",c,0),c>0&&!e.instancedArrays)throw new w("Instanced arrays extension is not supported");e._us.model=A(t._modelMatrix,N.IDENTITY),n._setUniforms(i,e._us,e.validateShaderProgram),r._bind();const u=r.indexBuffer;l(u)?(s=s*u.bytesPerIndex,a=A(a,u.numberOfIndices),c===0?e._gl.drawElements(o,a,u.indexDatatype,s):e.glDrawElementsInstanced(o,a,u.indexDatatype,s,c)):(a=A(a,r.numberOfVertices),c===0?e._gl.drawArrays(o,s,a):e.glDrawArraysInstanced(o,s,a,c)),r._unBind()}Hc.prototype.draw=function(e,t,n,i){E.defined("drawCommand",e),E.defined("drawCommand.shaderProgram",e._shaderProgram),t=A(t,this._defaultPassState);const o=A(e._framebuffer,t.framebuffer),r=A(e._renderState,this._defaultRenderState);n=A(n,e._shaderProgram),i=A(i,e._uniformMap),mOe(this,o,t,n,r),_Oe(this,e,n,i)};Hc.prototype.endFrame=function(){const e=this._gl;e.useProgram(null),this._currentFramebuffer=void 0,e.bindFramebuffer(e.FRAMEBUFFER,null);const t=q3;this.drawBuffers&&this.glDrawBuffers(t);const n=this._maxFrameTextureUnitIndex;this._maxFrameTextureUnitIndex=0;for(let i=0;i<n;++i)e.activeTexture(e.TEXTURE0+i),e.bindTexture(e.TEXTURE_2D,null),e.bindTexture(e.TEXTURE_CUBE_MAP,null)};Hc.prototype.readPixels=function(e){const t=this._gl;e=A(e,A.EMPTY_OBJECT);const n=Math.max(A(e.x,0),0),i=Math.max(A(e.y,0),0),o=A(e.width,t.drawingBufferWidth),r=A(e.height,t.drawingBufferHeight),s=e.framebuffer;E.typeOf.number.greaterThan("readState.width",o,0),E.typeOf.number.greaterThan("readState.height",r,0);let a=ft.UNSIGNED_BYTE;l(s)&&s.numberOfColorAttachments>0&&(a=s.getColorTexture(0).pixelDatatype);const c=yt.createTypedArray(yt.RGBA,a,o,r);return j3(this,s),t.readPixels(n,i,o,r,yt.RGBA,ft.toWebGLConstant(a,this),c),c};const $K={position:0,textureCoordinates:1};Hc.prototype.getViewportQuadVertexArray=function(){let e=this.cache.viewportQuad_vertexArray;if(!l(e)){const t=new $t({attributes:{position:new Xe({componentDatatype:oe.FLOAT,componentsPerAttribute:2,values:[-1,-1,1,-1,1,1,-1,1]}),textureCoordinates:new Xe({componentDatatype:oe.FLOAT,componentsPerAttribute:2,values:[0,0,1,0,1,1,0,1]})},indices:new Uint16Array([0,1,2,0,2,3]),primitiveType:dt.TRIANGLES});e=Fo.fromGeometry({context:this,geometry:t,attributeLocations:$K,bufferUsage:mt.STATIC_DRAW,interleave:!0}),this.cache.viewportQuad_vertexArray=e}return e};Hc.prototype.createViewportQuadCommand=function(e,t){return t=A(t,A.EMPTY_OBJECT),new Dt({vertexArray:this.getViewportQuadVertexArray(),primitiveType:dt.TRIANGLES,renderState:t.renderState,shaderProgram:Hn.fromCache({context:this,vertexShaderSource:wX,fragmentShaderSource:e,attributeLocations:$K}),uniformMap:t.uniformMap,owner:t.owner,framebuffer:t.framebuffer,pass:t.pass})};Hc.prototype.getObjectByPickColor=function(e){return E.defined("pickColor",e),this._pickObjects[e.toRgba()]};function Y3(e,t,n){this._pickObjects=e,this.key=t,this.color=n}Object.defineProperties(Y3.prototype,{object:{get:function(){return this._pickObjects[this.key]},set:function(e){this._pickObjects[this.key]=e}}});Y3.prototype.destroy=function(){delete this._pickObjects[this.key]};Hc.prototype.createPickId=function(e){E.defined("object",e),++this._nextPickColor[0];const t=this._nextPickColor[0];if(t===0)throw new Fe("Out of unique Pick IDs.");return this._pickObjects[t]=e,new Y3(this._pickObjects,t,k.fromRgba(t))};Hc.prototype.isDestroyed=function(){return!1};Hc.prototype.destroy=function(){const e=this.cache;for(const t in e)if(e.hasOwnProperty(t)){const n=e[t];l(n.destroy)&&n.destroy()}return this._shaderCache=this._shaderCache.destroy(),this._textureCache=this._textureCache.destroy(),this._defaultTexture=this._defaultTexture&&this._defaultTexture.destroy(),this._defaultEmissiveTexture=this._defaultEmissiveTexture&&this._defaultEmissiveTexture.destroy(),this._defaultNormalTexture=this._defaultNormalTexture&&this._defaultNormalTexture.destroy(),this._defaultCubeMap=this._defaultCubeMap&&this._defaultCubeMap.destroy(),Je(this)};Hc._deprecationWarning=p_;function bT(e){e=A(e,A.EMPTY_OBJECT);const t=e.context,n=e.width,i=e.height;E.defined("options.context",t),E.defined("options.width",n),E.defined("options.height",i),this._width=n,this._height=i;const o=e.colorRenderbuffers,r=e.colorTextures;if(l(o)!==l(r))throw new w("Both color renderbuffer and texture attachments must be provided.");const s=e.depthStencilRenderbuffer,a=e.depthStencilTexture;if(l(s)!==l(a))throw new w("Both depth-stencil renderbuffer and texture attachments must be provided.");this._renderFramebuffer=new Ds({context:t,colorRenderbuffers:o,depthStencilRenderbuffer:s,destroyAttachments:e.destroyAttachments}),this._colorFramebuffer=new Ds({context:t,colorTextures:r,depthStencilTexture:a,destroyAttachments:e.destroyAttachments})}bT.prototype.getRenderFramebuffer=function(){return this._renderFramebuffer};bT.prototype.getColorFramebuffer=function(){return this._colorFramebuffer};bT.prototype.blitFramebuffers=function(e,t){this._renderFramebuffer.bindRead(),this._colorFramebuffer.bindDraw();const n=e._gl;let i=0;this._colorFramebuffer._colorTextures.length>0&&(i|=n.COLOR_BUFFER_BIT),l(this._colorFramebuffer.depthStencilTexture)&&(i|=n.DEPTH_BUFFER_BIT|(t?n.STENCIL_BUFFER_BIT:0)),n.blitFramebuffer(0,0,this._width,this._height,0,0,this._width,this._height,i,n.NEAREST),n.bindFramebuffer(n.READ_FRAMEBUFFER,null),n.bindFramebuffer(n.DRAW_FRAMEBUFFER,null)};bT.prototype.isDestroyed=function(){return!1};bT.prototype.destroy=function(){return this._renderFramebuffer.destroy(),this._colorFramebuffer.destroy(),Je(this)};const Lc={RGBA4:fe.RGBA4,RGBA8:fe.RGBA8,RGBA16F:fe.RGBA16F,RGBA32F:fe.RGBA32F,RGB5_A1:fe.RGB5_A1,RGB565:fe.RGB565,DEPTH_COMPONENT16:fe.DEPTH_COMPONENT16,STENCIL_INDEX8:fe.STENCIL_INDEX8,DEPTH_STENCIL:fe.DEPTH_STENCIL,DEPTH24_STENCIL8:fe.DEPTH24_STENCIL8,validate:function(e){return e===Lc.RGBA4||e===Lc.RGBA8||e===Lc.RGBA16F||e===Lc.RGBA32F||e===Lc.RGB5_A1||e===Lc.RGB565||e===Lc.DEPTH_COMPONENT16||e===Lc.STENCIL_INDEX8||e===Lc.DEPTH_STENCIL||e===Lc.DEPTH24_STENCIL8},getColorFormat:function(e){return e===fe.FLOAT?Lc.RGBA32F:e===fe.HALF_FLOAT_OES?Lc.RGBA16F:Lc.RGBA8}},vh=Object.freeze(Lc);function Qu(e){e=A(e,A.EMPTY_OBJECT),E.defined("options.context",e.context);const n=e.context._gl,i=Gt.maximumRenderbufferSize,o=A(e.format,vh.RGBA4),r=l(e.width)?e.width:n.drawingBufferWidth,s=l(e.height)?e.height:n.drawingBufferHeight,a=A(e.numSamples,1);if(!vh.validate(o))throw new w("Invalid format.");if(E.typeOf.number.greaterThan("width",r,0),r>i)throw new w(`Width must be less than or equal to the maximum renderbuffer size (${i}). Check maximumRenderbufferSize.`);if(E.typeOf.number.greaterThan("height",s,0),s>i)throw new w(`Height must be less than or equal to the maximum renderbuffer size (${i}). Check maximumRenderbufferSize.`);this._gl=n,this._format=o,this._width=r,this._height=s,this._renderbuffer=this._gl.createRenderbuffer(),n.bindRenderbuffer(n.RENDERBUFFER,this._renderbuffer),a>1?n.renderbufferStorageMultisample(n.RENDERBUFFER,a,o,r,s):n.renderbufferStorage(n.RENDERBUFFER,o,r,s),n.bindRenderbuffer(n.RENDERBUFFER,null)}Object.defineProperties(Qu.prototype,{format:{get:function(){return this._format}},width:{get:function(){return this._width}},height:{get:function(){return this._height}}});Qu.prototype._getRenderbuffer=function(){return this._renderbuffer};Qu.prototype.isDestroyed=function(){return!1};Qu.prototype.destroy=function(){return this._gl.deleteRenderbuffer(this._renderbuffer),Je(this)};function Xn(e){if(e=A(e,A.EMPTY_OBJECT),this._numSamples=A(e.numSamples,1),this._colorAttachmentsLength=A(e.colorAttachmentsLength,1),this._color=A(e.color,!0),this._depth=A(e.depth,!1),this._depthStencil=A(e.depthStencil,!1),this._supportsDepthTexture=A(e.supportsDepthTexture,!1),!this._color&&!this._depth&&!this._depthStencil)throw new w("Must enable at least one type of framebuffer attachment.");if(this._depth&&this._depthStencil)throw new w("Cannot have both a depth and depth-stencil attachment.");this._createColorAttachments=A(e.createColorAttachments,!0),this._createDepthAttachments=A(e.createDepthAttachments,!0),this._pixelDatatype=e.pixelDatatype,this._pixelFormat=e.pixelFormat,this._width=void 0,this._height=void 0,this._framebuffer=void 0,this._multisampleFramebuffer=void 0,this._colorTextures=void 0,this._color&&(this._colorTextures=new Array(this._colorAttachmentsLength),this._colorRenderbuffers=new Array(this._colorAttachmentsLength)),this._colorRenderbuffer=void 0,this._depthStencilRenderbuffer=void 0,this._depthStencilTexture=void 0,this._depthRenderbuffer=void 0,this._depthTexture=void 0,this._attachmentsDirty=!1}Object.defineProperties(Xn.prototype,{framebuffer:{get:function(){return this._numSamples>1?this._multisampleFramebuffer.getRenderFramebuffer():this._framebuffer}},numSamples:{get:function(){return this._numSamples}},status:{get:function(){return this.framebuffer.status}}});Xn.prototype.isDirty=function(e,t,n,i,o){n=A(n,1);const r=this._width!==e||this._height!==t,s=this._numSamples!==n,a=l(i)&&this._pixelDatatype!==i||l(o)&&this._pixelFormat!==o,c=l(n===1?this._framebuffer:this._multisampleFramebuffer);return this._attachmentsDirty||r||s||a||!c||this._color&&!l(this._colorTextures[0])};Xn.prototype.update=function(e,t,n,i,o,r){if(!l(t)||!l(n))throw new w("width and height must be defined.");if(i=e.msaa?A(i,1):1,o=A(o,this._color?A(this._pixelDatatype,ft.UNSIGNED_BYTE):void 0),r=A(r,this._color?A(this._pixelFormat,yt.RGBA):void 0),this.isDirty(t,n,i,o,r)){if(this.destroy(),this._width=t,this._height=n,this._numSamples=i,this._pixelDatatype=o,this._pixelFormat=r,this._attachmentsDirty=!1,this._color&&this._createColorAttachments){for(let s=0;s<this._colorAttachmentsLength;++s)if(this._colorTextures[s]=new rn({context:e,width:t,height:n,pixelFormat:r,pixelDatatype:o,sampler:Ci.NEAREST}),this._numSamples>1){const a=vh.getColorFormat(o);this._colorRenderbuffers[s]=new Qu({context:e,width:t,height:n,format:a,numSamples:this._numSamples})}}this._depthStencil&&this._createDepthAttachments&&(this._supportsDepthTexture&&e.depthTexture?(this._depthStencilTexture=new rn({context:e,width:t,height:n,pixelFormat:yt.DEPTH_STENCIL,pixelDatatype:ft.UNSIGNED_INT_24_8,sampler:Ci.NEAREST}),this._numSamples>1&&(this._depthStencilRenderbuffer=new Qu({context:e,width:t,height:n,format:vh.DEPTH24_STENCIL8,numSamples:this._numSamples}))):this._depthStencilRenderbuffer=new Qu({context:e,width:t,height:n,format:vh.DEPTH_STENCIL})),this._depth&&this._createDepthAttachments&&(this._supportsDepthTexture&&e.depthTexture?this._depthTexture=new rn({context:e,width:t,height:n,pixelFormat:yt.DEPTH_COMPONENT,pixelDatatype:ft.UNSIGNED_INT,sampler:Ci.NEAREST}):this._depthRenderbuffer=new Qu({context:e,width:t,height:n,format:vh.DEPTH_COMPONENT16})),this._numSamples>1?this._multisampleFramebuffer=new bT({context:e,width:this._width,height:this._height,colorTextures:this._colorTextures,colorRenderbuffers:this._colorRenderbuffers,depthStencilTexture:this._depthStencilTexture,depthStencilRenderbuffer:this._depthStencilRenderbuffer,destroyAttachments:!1}):this._framebuffer=new Ds({context:e,colorTextures:this._colorTextures,depthTexture:this._depthTexture,depthRenderbuffer:this._depthRenderbuffer,depthStencilTexture:this._depthStencilTexture,depthStencilRenderbuffer:this._depthStencilRenderbuffer,destroyAttachments:!1})}};Xn.prototype.getColorTexture=function(e){if(e=A(e,0),e>=this._colorAttachmentsLength)throw new w("index must be smaller than total number of color attachments.");return this._colorTextures[e]};Xn.prototype.setColorTexture=function(e,t){if(t=A(t,0),this._createColorAttachments)throw new w("createColorAttachments must be false if setColorTexture is called.");if(t>=this._colorAttachmentsLength)throw new w("index must be smaller than total number of color attachments.");this._attachmentsDirty=e!==this._colorTextures[t],this._colorTextures[t]=e};Xn.prototype.getColorRenderbuffer=function(e){if(e=A(e,0),e>=this._colorAttachmentsLength)throw new w("index must be smaller than total number of color attachments.");return this._colorRenderbuffers[e]};Xn.prototype.setColorRenderbuffer=function(e,t){if(t=A(t,0),this._createColorAttachments)throw new w("createColorAttachments must be false if setColorRenderbuffer is called.");if(t>=this._colorAttachmentsLength)throw new w("index must be smaller than total number of color attachments.");this._attachmentsDirty=e!==this._colorRenderbuffers[t],this._colorRenderbuffers[t]=e};Xn.prototype.getDepthRenderbuffer=function(){return this._depthRenderbuffer};Xn.prototype.setDepthRenderbuffer=function(e){if(this._createDepthAttachments)throw new w("createDepthAttachments must be false if setDepthRenderbuffer is called.");this._attachmentsDirty=e!==this._depthRenderbuffer,this._depthRenderbuffer=e};Xn.prototype.getDepthTexture=function(){return this._depthTexture};Xn.prototype.setDepthTexture=function(e){if(this._createDepthAttachments)throw new w("createDepthAttachments must be false if setDepthTexture is called.");this._attachmentsDirty=e!==this._depthTexture,this._depthTexture=e};Xn.prototype.getDepthStencilRenderbuffer=function(){return this._depthStencilRenderbuffer};Xn.prototype.setDepthStencilRenderbuffer=function(e){if(this._createDepthAttachments)throw new w("createDepthAttachments must be false if setDepthStencilRenderbuffer is called.");this._attachmentsDirty=e!==this._depthStencilRenderbuffer,this._depthStencilRenderbuffer=e};Xn.prototype.getDepthStencilTexture=function(){return this._depthStencilTexture};Xn.prototype.setDepthStencilTexture=function(e){if(this._createDepthAttachments)throw new w("createDepthAttachments must be false if setDepthStencilTexture is called.");this._attachmentsDirty=e!==this._depthStencilTexture,this._depthStencilTexture=e};Xn.prototype.prepareTextures=function(e,t){this._numSamples>1&&this._multisampleFramebuffer.blitFramebuffers(e,t)};Xn.prototype.clear=function(e,t,n){const i=t.framebuffer;t.framebuffer=this.framebuffer,t.execute(e,n),t.framebuffer=i};Xn.prototype.destroyFramebuffer=function(){this._framebuffer=this._framebuffer&&this._framebuffer.destroy(),this._multisampleFramebuffer=this._multisampleFramebuffer&&this._multisampleFramebuffer.destroy()};Xn.prototype.destroy=function(){if(this._color){let e;const t=this._colorTextures.length;for(e=0;e<t;++e){const n=this._colorTextures[e];this._createColorAttachments&&l(n)&&!n.isDestroyed()&&(this._colorTextures[e].destroy(),this._colorTextures[e]=void 0),l(n)&&n.isDestroyed()&&(this._colorTextures[e]=void 0);const i=this._colorRenderbuffers[e];this._createColorAttachments&&l(i)&&!i.isDestroyed()&&(this._colorRenderbuffers[e].destroy(),this._colorRenderbuffers[e]=void 0),l(i)&&i.isDestroyed()&&(this._colorRenderbuffers[e]=void 0)}}this._depthStencil&&(this._createDepthAttachments&&(this._depthStencilTexture=this._depthStencilTexture&&this._depthStencilTexture.destroy(),this._depthStencilRenderbuffer=this._depthStencilRenderbuffer&&this._depthStencilRenderbuffer.destroy()),l(this._depthStencilTexture)&&this._depthStencilTexture.isDestroyed()&&(this._depthStencilTexture=void 0),l(this._depthStencilRenderbuffer)&&this._depthStencilRenderbuffer.isDestroyed()&&(this._depthStencilRenderbuffer=void 0)),this._depth&&(this._createDepthAttachments&&(this._depthTexture=this._depthTexture&&this._depthTexture.destroy(),this._depthRenderbuffer=this._depthRenderbuffer&&this._depthRenderbuffer.destroy()),l(this._depthTexture)&&this._depthTexture.isDestroyed()&&(this._depthTexture=void 0),l(this._depthRenderbuffer)&&this._depthRenderbuffer.isDestroyed()&&(this._depthRenderbuffer=void 0)),this.destroyFramebuffer()};const Vg={VERTEX:0,FRAGMENT:1,BOTH:2};Vg.includesVertexShader=function(e){return E.typeOf.number("destination",e),e===Vg.VERTEX||e===Vg.BOTH};Vg.includesFragmentShader=function(e){return E.typeOf.number("destination",e),e===Vg.FRAGMENT||e===Vg.BOTH};const Re=Object.freeze(Vg);function $3(e){this.name=e,this.fields=[]}$3.prototype.addField=function(e,t){const n=` ${e} ${t};`;this.fields.push(n)};$3.prototype.generateGlslLines=function(){let e=this.fields;return e.length===0&&(e=[" float _empty;"]),[].concat(`struct ${this.name}`,"{",e,"};")};function X3(e){this.signature=e,this.body=[]}X3.prototype.addLines=function(e){if(typeof e!="string"&&!Array.isArray(e))throw new w(`Expected lines to be a string or an array of strings, actual value was ${e}`);const t=this.body;if(Array.isArray(e)){const n=e.length;for(let i=0;i<n;i++)t.push(` ${e[i]}`)}else t.push(` ${e}`)};X3.prototype.generateGlslLines=function(){return[].concat(this.signature,"{",this.body,"}")};function Qa(){this._positionAttributeLine=void 0,this._nextAttributeLocation=1,this._attributeLocations={},this._attributeLines=[],this._structs={},this._functions={},this._vertexShaderParts={defineLines:[],uniformLines:[],shaderLines:[],varyingLines:[],structIds:[],functionIds:[]},this._fragmentShaderParts={defineLines:[],uniformLines:[],shaderLines:[],varyingLines:[],structIds:[],functionIds:[]}}Object.defineProperties(Qa.prototype,{attributeLocations:{get:function(){return this._attributeLocations}}});Qa.prototype.addDefine=function(e,t,n){E.typeOf.string("identifier",e),n=A(n,Re.BOTH);let i=e;l(t)&&(i+=` ${t.toString()}`),Re.includesVertexShader(n)&&this._vertexShaderParts.defineLines.push(i),Re.includesFragmentShader(n)&&this._fragmentShaderParts.defineLines.push(i)};Qa.prototype.addStruct=function(e,t,n){E.typeOf.string("structId",e),E.typeOf.string("structName",t),E.typeOf.number("destination",n),this._structs[e]=new $3(t),Re.includesVertexShader(n)&&this._vertexShaderParts.structIds.push(e),Re.includesFragmentShader(n)&&this._fragmentShaderParts.structIds.push(e)};Qa.prototype.addStructField=function(e,t,n){E.typeOf.string("structId",e),E.typeOf.string("type",t),E.typeOf.string("identifier",n),this._structs[e].addField(t,n)};Qa.prototype.addFunction=function(e,t,n){E.typeOf.string("functionName",e),E.typeOf.string("signature",t),E.typeOf.number("destination",n),this._functions[e]=new X3(t),Re.includesVertexShader(n)&&this._vertexShaderParts.functionIds.push(e),Re.includesFragmentShader(n)&&this._fragmentShaderParts.functionIds.push(e)};Qa.prototype.addFunctionLines=function(e,t){if(E.typeOf.string("functionName",e),typeof t!="string"&&!Array.isArray(t))throw new w(`Expected lines to be a string or an array of strings, actual value was ${t}`);this._functions[e].addLines(t)};Qa.prototype.addUniform=function(e,t,n){E.typeOf.string("type",e),E.typeOf.string("identifier",t),n=A(n,Re.BOTH);const i=`uniform ${e} ${t};`;Re.includesVertexShader(n)&&this._vertexShaderParts.uniformLines.push(i),Re.includesFragmentShader(n)&&this._fragmentShaderParts.uniformLines.push(i)};Qa.prototype.setPositionAttribute=function(e,t){if(E.typeOf.string("type",e),E.typeOf.string("identifier",t),l(this._positionAttributeLine))throw new w("setPositionAttribute() must be called exactly once for the attribute used for gl_Position. For other attributes, use addAttribute()");return this._positionAttributeLine=`attribute ${e} ${t};`,this._attributeLocations[t]=0,0};Qa.prototype.addAttribute=function(e,t){E.typeOf.string("type",e),E.typeOf.string("identifier",t);const n=`attribute ${e} ${t};`;this._attributeLines.push(n);const i=this._nextAttributeLocation;return this._attributeLocations[t]=i,this._nextAttributeLocation+=yOe(e),i};Qa.prototype.addVarying=function(e,t){E.typeOf.string("type",e),E.typeOf.string("identifier",t);const n=`varying ${e} ${t};`;this._vertexShaderParts.varyingLines.push(n),this._fragmentShaderParts.varyingLines.push(n)};Qa.prototype.addVertexLines=function(e){if(typeof e!="string"&&!Array.isArray(e))throw new w(`Expected lines to be a string or an array of strings, actual value was ${e}`);const t=this._vertexShaderParts.shaderLines;Array.isArray(e)?t.push.apply(t,e):t.push(e)};Qa.prototype.addFragmentLines=function(e){if(typeof e!="string"&&!Array.isArray(e))throw new w(`Expected lines to be a string or an array of strings, actual value was ${e}`);const t=this._fragmentShaderParts.shaderLines;Array.isArray(e)?t.push.apply(t,e):t.push(e)};Qa.prototype.buildShaderProgram=function(e){E.typeOf.object("context",e);const t=l(this._positionAttributeLine)?[this._positionAttributeLine]:[],n=gOe(this),i=AOe(this),o=t.concat(this._attributeLines,this._vertexShaderParts.uniformLines,this._vertexShaderParts.varyingLines,n.vertexLines,i.vertexLines,this._vertexShaderParts.shaderLines).join(`
|
||
`),r=new nt({defines:this._vertexShaderParts.defineLines,sources:[o]}),s=this._fragmentShaderParts.uniformLines.concat(this._fragmentShaderParts.varyingLines,n.fragmentLines,i.fragmentLines,this._fragmentShaderParts.shaderLines).join(`
|
||
`),a=new nt({defines:this._fragmentShaderParts.defineLines,sources:[s]});return Hn.fromCache({context:e,vertexShaderSource:r,fragmentShaderSource:a,attributeLocations:this._attributeLocations})};Qa.prototype.clone=function(){return St(this,!0)};function gOe(e){const t=[],n=[];let i,o=e._vertexShaderParts.structIds,r,s,a;for(i=0;i<o.length;i++)r=o[i],s=e._structs[r],a=s.generateGlslLines(),t.push.apply(t,a);for(o=e._fragmentShaderParts.structIds,i=0;i<o.length;i++)r=o[i],s=e._structs[r],a=s.generateGlslLines(),n.push.apply(n,a);return{vertexLines:t,fragmentLines:n}}function yOe(e){switch(e){case"mat2":return 2;case"mat3":return 3;case"mat4":return 4;default:return 1}}function AOe(e){const t=[],n=[];let i,o=e._vertexShaderParts.functionIds,r,s,a;for(i=0;i<o.length;i++)r=o[i],s=e._functions[r],a=s.generateGlslLines(),t.push.apply(t,a);for(o=e._fragmentShaderParts.functionIds,i=0;i<o.length;i++)r=o[i],s=e._functions[r],a=s.generateGlslLines(),n.push.apply(n,a);return{vertexLines:t,fragmentLines:n}}function ds(e,t,n,i){if(E.defined("context",e),!t||t.length===0)throw new w("At least one attribute is required.");const o=ds._verifyAttributes(t);n=A(n,0);const r=[],s={};let a,c;const u=o.length;for(let h=0;h<u;++h){const _=o[h];if(_.vertexBuffer){r.push(_);continue}c=_.usage,a=s[c],l(a)||(a=s[c]=[]),a.push(_)}function f(h,_){return oe.getSizeInBytes(_.componentDatatype)-oe.getSizeInBytes(h.componentDatatype)}this._allBuffers=[];for(c in s)if(s.hasOwnProperty(c)){a=s[c],a.sort(f);const h=ds._vertexSizeInBytes(a),_=a[0].usage,g={vertexSizeInBytes:h,vertexBuffer:void 0,usage:_,needsCommit:!1,arrayBuffer:void 0,arrayViews:ds._createArrayViews(a,h)};this._allBuffers.push(g)}this._size=0,this._instanced=A(i,!1),this._precreated=r,this._context=e,this.writers=void 0,this.va=void 0,this.resize(n)}ds._verifyAttributes=function(e){const t=[];for(let i=0;i<e.length;++i){const o=e[i],r={index:A(o.index,i),enabled:A(o.enabled,!0),componentsPerAttribute:o.componentsPerAttribute,componentDatatype:A(o.componentDatatype,oe.FLOAT),normalize:A(o.normalize,!1),vertexBuffer:o.vertexBuffer,usage:A(o.usage,mt.STATIC_DRAW)};if(t.push(r),r.componentsPerAttribute!==1&&r.componentsPerAttribute!==2&&r.componentsPerAttribute!==3&&r.componentsPerAttribute!==4)throw new w("attribute.componentsPerAttribute must be in the range [1, 4].");const s=r.componentDatatype;if(!oe.validate(s))throw new w("Attribute must have a valid componentDatatype or not specify it.");if(!mt.validate(r.usage))throw new w("Attribute must have a valid usage or not specify it.")}const n=new Array(t.length);for(let i=0;i<t.length;++i){const r=t[i].index;if(n[r])throw new w(`Index ${r} is used by more than one attribute.`);n[r]=!0}return t};ds._vertexSizeInBytes=function(e){let t=0;const n=e.length;for(let s=0;s<n;++s){const a=e[s];t+=a.componentsPerAttribute*oe.getSizeInBytes(a.componentDatatype)}const i=n>0?oe.getSizeInBytes(e[0].componentDatatype):0,o=i>0?t%i:0,r=o===0?0:i-o;return t+=r,t};ds._createArrayViews=function(e,t){const n=[];let i=0;const o=e.length;for(let r=0;r<o;++r){const s=e[r],a=s.componentDatatype;n.push({index:s.index,enabled:s.enabled,componentsPerAttribute:s.componentsPerAttribute,componentDatatype:a,normalize:s.normalize,offsetInBytes:i,vertexSizeInComponentType:t/oe.getSizeInBytes(a),view:void 0}),i+=s.componentsPerAttribute*oe.getSizeInBytes(a)}return n};ds.prototype.resize=function(e){this._size=e;const t=this._allBuffers;this.writers=[];for(let n=0,i=t.length;n<i;++n){const o=t[n];ds._resize(o,this._size),ds._appendWriters(this.writers,o)}K3(this)};ds._resize=function(e,t){if(e.vertexSizeInBytes>0){const n=new ArrayBuffer(t*e.vertexSizeInBytes);if(l(e.arrayBuffer)){const r=new Uint8Array(n),s=new Uint8Array(e.arrayBuffer),a=s.length;for(let c=0;c<a;++c)r[c]=s[c]}const i=e.arrayViews,o=i.length;for(let r=0;r<o;++r){const s=i[r];s.view=oe.createArrayBufferView(s.componentDatatype,n,s.offsetInBytes)}e.arrayBuffer=n}};const TOe=[function(e,t,n){return function(i,o){t[i*n]=o,e.needsCommit=!0}},function(e,t,n){return function(i,o,r){const s=i*n;t[s]=o,t[s+1]=r,e.needsCommit=!0}},function(e,t,n){return function(i,o,r,s){const a=i*n;t[a]=o,t[a+1]=r,t[a+2]=s,e.needsCommit=!0}},function(e,t,n){return function(i,o,r,s,a){const c=i*n;t[c]=o,t[c+1]=r,t[c+2]=s,t[c+3]=a,e.needsCommit=!0}}];ds._appendWriters=function(e,t){const n=t.arrayViews,i=n.length;for(let o=0;o<i;++o){const r=n[o];e[r.index]=TOe[r.componentsPerAttribute-1](t,r.view,r.vertexSizeInComponentType)}};ds.prototype.commit=function(e){let t=!1;const n=this._allBuffers;let i,o,r;for(o=0,r=n.length;o<r;++o)i=n[o],t=COe(this,i)||t;if(t||!l(this.va)){K3(this);const s=this.va=[],a=F.SIXTY_FOUR_KILOBYTES-4,c=l(e)&&!this._instanced?Math.ceil(this._size/a):1;for(let u=0;u<c;++u){let f=[];for(o=0,r=n.length;o<r;++o){i=n[o];const h=u*(i.vertexSizeInBytes*a);ds._appendAttributes(f,i,h,this._instanced)}f=f.concat(this._precreated),s.push({va:new Fo({context:this._context,attributes:f,indexBuffer:e}),indicesCount:1.5*(u!==c-1?a:this._size%a)})}}};function COe(e,t){if(t.needsCommit&&t.vertexSizeInBytes>0){t.needsCommit=!1;const n=t.vertexBuffer,i=e._size*t.vertexSizeInBytes,o=l(n);if(!o||n.sizeInBytes<i)return o&&n.destroy(),t.vertexBuffer=Mt.createVertexBuffer({context:e._context,typedArray:t.arrayBuffer,usage:t.usage}),t.vertexBuffer.vertexArrayDestroyable=!1,!0;t.vertexBuffer.copyFromArrayView(t.arrayBuffer)}return!1}ds._appendAttributes=function(e,t,n,i){const o=t.arrayViews,r=o.length;for(let s=0;s<r;++s){const a=o[s];e.push({index:a.index,enabled:a.enabled,componentsPerAttribute:a.componentsPerAttribute,componentDatatype:a.componentDatatype,normalize:a.normalize,vertexBuffer:t.vertexBuffer,offsetInBytes:n+a.offsetInBytes,strideInBytes:t.vertexSizeInBytes,instanceDivisor:i?1:0})}};ds.prototype.subCommit=function(e,t){if(e<0||e>=this._size)throw new w("offsetInVertices must be greater than or equal to zero and less than the vertex array size.");if(e+t>this._size)throw new w("offsetInVertices + lengthInVertices cannot exceed the vertex array size.");const n=this._allBuffers;for(let i=0,o=n.length;i<o;++i)bOe(n[i],e,t)};function bOe(e,t,n){if(e.needsCommit&&e.vertexSizeInBytes>0){const i=e.vertexSizeInBytes*t,o=e.vertexSizeInBytes*n;e.vertexBuffer.copyFromArrayView(new Uint8Array(e.arrayBuffer,i,o),i)}}ds.prototype.endSubCommits=function(){const e=this._allBuffers;for(let t=0,n=e.length;t<n;++t)e[t].needsCommit=!1};function K3(e){const t=e.va;if(!l(t))return;const n=t.length;for(let i=0;i<n;++i)t[i].va.destroy();e.va=void 0}ds.prototype.isDestroyed=function(){return!1};ds.prototype.destroy=function(){const e=this._allBuffers;for(let t=0,n=e.length;t<n;++t){const i=e[t];i.vertexBuffer=i.vertexBuffer&&i.vertexBuffer.destroy()}return K3(this),Je(this)};function EOe(e,t,n){if(E.defined("context",e),!l(t)||!l(t.positiveX)||!l(t.negativeX)||!l(t.positiveY)||!l(t.negativeY)||!l(t.positiveZ)||!l(t.negativeZ))throw new w("urls is required and must have positiveX, negativeX, positiveY, negativeY, positiveZ, and negativeZ properties.");const i={flipY:!0,skipColorSpaceConversion:n,preferImageBitmap:!0},o=[je.createIfNeeded(t.positiveX).fetchImage(i),je.createIfNeeded(t.negativeX).fetchImage(i),je.createIfNeeded(t.positiveY).fetchImage(i),je.createIfNeeded(t.negativeY).fetchImage(i),je.createIfNeeded(t.positiveZ).fetchImage(i),je.createIfNeeded(t.negativeZ).fetchImage(i)];return Promise.all(o).then(function(r){return new xf({context:e,source:{positiveX:r[0],negativeX:r[1],positiveY:r[2],negativeY:r[3],positiveZ:r[4],negativeZ:r[5]}})})}const O5=`#ifdef MRT
|
||
#extension GL_EXT_draw_buffers : enable
|
||
#endif
|
||
|
||
uniform vec4 u_bgColor;
|
||
uniform sampler2D u_depthTexture;
|
||
|
||
varying vec2 v_textureCoordinates;
|
||
|
||
void main()
|
||
{
|
||
if (texture2D(u_depthTexture, v_textureCoordinates).r < 1.0)
|
||
{
|
||
#ifdef MRT
|
||
gl_FragData[0] = u_bgColor;
|
||
gl_FragData[1] = vec4(u_bgColor.a);
|
||
#else
|
||
gl_FragColor = u_bgColor;
|
||
#endif
|
||
return;
|
||
}
|
||
|
||
discard;
|
||
}
|
||
`,OI=`uniform vec3 u_radiiAndDynamicAtmosphereColor;
|
||
|
||
uniform float u_atmosphereLightIntensity;
|
||
uniform float u_atmosphereRayleighScaleHeight;
|
||
uniform float u_atmosphereMieScaleHeight;
|
||
uniform float u_atmosphereMieAnisotropy;
|
||
uniform vec3 u_atmosphereRayleighCoefficient;
|
||
uniform vec3 u_atmosphereMieCoefficient;
|
||
|
||
const float ATMOSPHERE_THICKNESS = 111e3; // The thickness of the atmosphere in meters.
|
||
const int PRIMARY_STEPS = 16; // Number of times the ray from the camera to the world position (primary ray) is sampled.
|
||
const int LIGHT_STEPS = 4; // Number of times the light is sampled from the light source's intersection with the atmosphere to a sample position on the primary ray.
|
||
|
||
/**
|
||
* This function computes the colors contributed by Rayliegh and Mie scattering on a given ray, as well as
|
||
* the transmittance value for the ray.
|
||
*
|
||
* @param {czm_ray} primaryRay The ray from the camera to the position.
|
||
* @param {float} primaryRayLength The length of the primary ray.
|
||
* @param {vec3} lightDirection The direction of the light to calculate the scattering from.
|
||
* @param {vec3} rayleighColor The variable the Rayleigh scattering will be written to.
|
||
* @param {vec3} mieColor The variable the Mie scattering will be written to.
|
||
* @param {float} opacity The variable the transmittance will be written to.
|
||
* @glslFunction
|
||
*/
|
||
void computeScattering(
|
||
czm_ray primaryRay,
|
||
float primaryRayLength,
|
||
vec3 lightDirection,
|
||
float atmosphereInnerRadius,
|
||
out vec3 rayleighColor,
|
||
out vec3 mieColor,
|
||
out float opacity
|
||
) {
|
||
|
||
// Initialize the default scattering amounts to 0.
|
||
rayleighColor = vec3(0.0);
|
||
mieColor = vec3(0.0);
|
||
opacity = 0.0;
|
||
|
||
float atmosphereOuterRadius = atmosphereInnerRadius + ATMOSPHERE_THICKNESS;
|
||
|
||
vec3 origin = vec3(0.0);
|
||
|
||
// Calculate intersection from the camera to the outer ring of the atmosphere.
|
||
czm_raySegment primaryRayAtmosphereIntersect = czm_raySphereIntersectionInterval(primaryRay, origin, atmosphereOuterRadius);
|
||
|
||
// Return empty colors if no intersection with the atmosphere geometry.
|
||
if (primaryRayAtmosphereIntersect == czm_emptyRaySegment) {
|
||
return;
|
||
}
|
||
|
||
// The ray should start from the first intersection with the outer atmopshere, or from the camera position, if it is inside the atmosphere.
|
||
primaryRayAtmosphereIntersect.start = max(primaryRayAtmosphereIntersect.start, 0.0);
|
||
// The ray should end at the exit from the atmosphere or at the distance to the vertex, whichever is smaller.
|
||
primaryRayAtmosphereIntersect.stop = min(primaryRayAtmosphereIntersect.stop, length(primaryRayLength));
|
||
|
||
// Setup for sampling positions along the ray - starting from the intersection with the outer ring of the atmosphere.
|
||
float rayStepLength = (primaryRayAtmosphereIntersect.stop - primaryRayAtmosphereIntersect.start) / float(PRIMARY_STEPS);
|
||
float rayPositionLength = primaryRayAtmosphereIntersect.start;
|
||
|
||
vec3 rayleighAccumulation = vec3(0.0);
|
||
vec3 mieAccumulation = vec3(0.0);
|
||
vec2 opticalDepth = vec2(0.0);
|
||
vec2 heightScale = vec2(u_atmosphereRayleighScaleHeight, u_atmosphereMieScaleHeight);
|
||
|
||
// Sample positions on the primary ray.
|
||
for (int i = 0; i < PRIMARY_STEPS; i++) {
|
||
// Calculate sample position along viewpoint ray.
|
||
vec3 samplePosition = primaryRay.origin + primaryRay.direction * (rayPositionLength + rayStepLength);
|
||
|
||
// Calculate height of sample position above ellipsoid.
|
||
float sampleHeight = length(samplePosition) - atmosphereInnerRadius;
|
||
|
||
// Calculate and accumulate density of particles at the sample position.
|
||
vec2 sampleDensity = exp(-sampleHeight / heightScale) * rayStepLength;
|
||
opticalDepth += sampleDensity;
|
||
|
||
// Generate ray from the sample position segment to the light source, up to the outer ring of the atmosphere.
|
||
czm_ray lightRay = czm_ray(samplePosition, lightDirection);
|
||
czm_raySegment lightRayAtmosphereIntersect = czm_raySphereIntersectionInterval(lightRay, origin, atmosphereOuterRadius);
|
||
|
||
float lightStepLength = lightRayAtmosphereIntersect.stop / float(LIGHT_STEPS);
|
||
float lightPositionLength = 0.0;
|
||
|
||
vec2 lightOpticalDepth = vec2(0.0);
|
||
|
||
// Sample positions along the light ray, to accumulate incidence of light on the latest sample segment.
|
||
for (int j = 0; j < LIGHT_STEPS; j++) {
|
||
|
||
// Calculate sample position along light ray.
|
||
vec3 lightPosition = samplePosition + lightDirection * (lightPositionLength + lightStepLength * 0.5);
|
||
|
||
// Calculate height of the light sample position above ellipsoid.
|
||
float lightHeight = length(lightPosition) - atmosphereInnerRadius;
|
||
|
||
// Calculate density of photons at the light sample position.
|
||
lightOpticalDepth += exp(-lightHeight / heightScale) * lightStepLength;
|
||
|
||
// Increment distance on light ray.
|
||
lightPositionLength += lightStepLength;
|
||
}
|
||
|
||
// Compute attenuation via the primary ray and the light ray.
|
||
vec3 attenuation = exp(-((u_atmosphereMieCoefficient * (opticalDepth.y + lightOpticalDepth.y)) + (u_atmosphereRayleighCoefficient * (opticalDepth.x + lightOpticalDepth.x))));
|
||
|
||
// Accumulate the scattering.
|
||
rayleighAccumulation += sampleDensity.x * attenuation;
|
||
mieAccumulation += sampleDensity.y * attenuation;
|
||
|
||
// Increment distance on primary ray.
|
||
rayPositionLength += rayStepLength;
|
||
}
|
||
|
||
// Compute the scattering amount.
|
||
rayleighColor = u_atmosphereRayleighCoefficient * rayleighAccumulation;
|
||
mieColor = u_atmosphereMieCoefficient * mieAccumulation;
|
||
|
||
// Compute the transmittance i.e. how much light is passing through the atmosphere.
|
||
opacity = length(exp(-((u_atmosphereMieCoefficient * opticalDepth.y) + (u_atmosphereRayleighCoefficient * opticalDepth.x))));
|
||
}
|
||
|
||
vec4 computeAtmosphereColor(
|
||
vec3 positionWC,
|
||
vec3 lightDirection,
|
||
vec3 rayleighColor,
|
||
vec3 mieColor,
|
||
float opacity
|
||
) {
|
||
// Setup the primary ray: from the camera position to the vertex position.
|
||
vec3 cameraToPositionWC = positionWC - czm_viewerPositionWC;
|
||
vec3 cameraToPositionWCDirection = normalize(cameraToPositionWC);
|
||
|
||
float cosAngle = dot(cameraToPositionWCDirection, lightDirection);
|
||
float cosAngleSq = cosAngle * cosAngle;
|
||
|
||
float G = u_atmosphereMieAnisotropy;
|
||
float GSq = G * G;
|
||
|
||
// The Rayleigh phase function.
|
||
float rayleighPhase = 3.0 / (50.2654824574) * (1.0 + cosAngleSq);
|
||
// The Mie phase function.
|
||
float miePhase = 3.0 / (25.1327412287) * ((1.0 - GSq) * (cosAngleSq + 1.0)) / (pow(1.0 + GSq - 2.0 * cosAngle * G, 1.5) * (2.0 + GSq));
|
||
|
||
// The final color is generated by combining the effects of the Rayleigh and Mie scattering.
|
||
vec3 rayleigh = rayleighPhase * rayleighColor;
|
||
vec3 mie = miePhase * mieColor;
|
||
|
||
vec3 color = (rayleigh + mie) * u_atmosphereLightIntensity;
|
||
|
||
return vec4(color, opacity);
|
||
}
|
||
`,xOe=`#ifdef GL_OES_standard_derivatives
|
||
#extension GL_OES_standard_derivatives : enable
|
||
#endif
|
||
|
||
uniform sampler2D u_atlas;
|
||
|
||
#ifdef VECTOR_TILE
|
||
uniform vec4 u_highlightColor;
|
||
#endif
|
||
|
||
varying vec2 v_textureCoordinates;
|
||
varying vec4 v_pickColor;
|
||
varying vec4 v_color;
|
||
|
||
#ifdef SDF
|
||
varying vec4 v_outlineColor;
|
||
varying float v_outlineWidth;
|
||
#endif
|
||
|
||
#ifdef FRAGMENT_DEPTH_CHECK
|
||
varying vec4 v_textureCoordinateBounds; // the min and max x and y values for the texture coordinates
|
||
varying vec4 v_originTextureCoordinateAndTranslate; // texture coordinate at the origin, billboard translate (used for label glyphs)
|
||
varying vec4 v_compressed; // x: eyeDepth, y: applyTranslate & enableDepthCheck, z: dimensions, w: imageSize
|
||
varying mat2 v_rotationMatrix;
|
||
|
||
const float SHIFT_LEFT12 = 4096.0;
|
||
const float SHIFT_LEFT1 = 2.0;
|
||
|
||
const float SHIFT_RIGHT12 = 1.0 / 4096.0;
|
||
const float SHIFT_RIGHT1 = 1.0 / 2.0;
|
||
|
||
float getGlobeDepth(vec2 adjustedST, vec2 depthLookupST, bool applyTranslate, vec2 dimensions, vec2 imageSize)
|
||
{
|
||
vec2 lookupVector = imageSize * (depthLookupST - adjustedST);
|
||
lookupVector = v_rotationMatrix * lookupVector;
|
||
vec2 labelOffset = (dimensions - imageSize) * (depthLookupST - vec2(0.0, v_originTextureCoordinateAndTranslate.y)); // aligns label glyph with bounding rectangle. Will be zero for billboards because dimensions and imageSize will be equal
|
||
|
||
vec2 translation = v_originTextureCoordinateAndTranslate.zw;
|
||
|
||
if (applyTranslate)
|
||
{
|
||
// this is only needed for labels where the horizontal origin is not LEFT
|
||
// it moves the label back to where the "origin" should be since all label glyphs are set to HorizontalOrigin.LEFT
|
||
translation += (dimensions * v_originTextureCoordinateAndTranslate.xy * vec2(1.0, 0.0));
|
||
}
|
||
|
||
vec2 st = ((lookupVector - translation + labelOffset) + gl_FragCoord.xy) / czm_viewport.zw;
|
||
float logDepthOrDepth = czm_unpackDepth(texture2D(czm_globeDepthTexture, st));
|
||
|
||
if (logDepthOrDepth == 0.0)
|
||
{
|
||
return 0.0; // not on the globe
|
||
}
|
||
|
||
vec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, logDepthOrDepth);
|
||
return eyeCoordinate.z / eyeCoordinate.w;
|
||
}
|
||
#endif
|
||
|
||
|
||
#ifdef SDF
|
||
|
||
// Get the distance from the edge of a glyph at a given position sampling an SDF texture.
|
||
float getDistance(vec2 position)
|
||
{
|
||
return texture2D(u_atlas, position).r;
|
||
}
|
||
|
||
// Samples the sdf texture at the given position and produces a color based on the fill color and the outline.
|
||
vec4 getSDFColor(vec2 position, float outlineWidth, vec4 outlineColor, float smoothing)
|
||
{
|
||
float distance = getDistance(position);
|
||
|
||
if (outlineWidth > 0.0)
|
||
{
|
||
// Don't get the outline edge exceed the SDF_EDGE
|
||
float outlineEdge = clamp(SDF_EDGE - outlineWidth, 0.0, SDF_EDGE);
|
||
float outlineFactor = smoothstep(SDF_EDGE - smoothing, SDF_EDGE + smoothing, distance);
|
||
vec4 sdfColor = mix(outlineColor, v_color, outlineFactor);
|
||
float alpha = smoothstep(outlineEdge - smoothing, outlineEdge + smoothing, distance);
|
||
return vec4(sdfColor.rgb, sdfColor.a * alpha);
|
||
}
|
||
else
|
||
{
|
||
float alpha = smoothstep(SDF_EDGE - smoothing, SDF_EDGE + smoothing, distance);
|
||
return vec4(v_color.rgb, v_color.a * alpha);
|
||
}
|
||
}
|
||
#endif
|
||
|
||
void main()
|
||
{
|
||
vec4 color = texture2D(u_atlas, v_textureCoordinates);
|
||
|
||
#ifdef SDF
|
||
float outlineWidth = v_outlineWidth;
|
||
vec4 outlineColor = v_outlineColor;
|
||
|
||
// Get the current distance
|
||
float distance = getDistance(v_textureCoordinates);
|
||
|
||
#ifdef GL_OES_standard_derivatives
|
||
float smoothing = fwidth(distance);
|
||
// Get an offset that is approximately half the distance to the neighbor pixels
|
||
// 0.354 is approximately half of 1/sqrt(2)
|
||
vec2 sampleOffset = 0.354 * vec2(dFdx(v_textureCoordinates) + dFdy(v_textureCoordinates));
|
||
|
||
// Sample the center point
|
||
vec4 center = getSDFColor(v_textureCoordinates, outlineWidth, outlineColor, smoothing);
|
||
|
||
// Sample the 4 neighbors
|
||
vec4 color1 = getSDFColor(v_textureCoordinates + vec2(sampleOffset.x, sampleOffset.y), outlineWidth, outlineColor, smoothing);
|
||
vec4 color2 = getSDFColor(v_textureCoordinates + vec2(-sampleOffset.x, sampleOffset.y), outlineWidth, outlineColor, smoothing);
|
||
vec4 color3 = getSDFColor(v_textureCoordinates + vec2(-sampleOffset.x, -sampleOffset.y), outlineWidth, outlineColor, smoothing);
|
||
vec4 color4 = getSDFColor(v_textureCoordinates + vec2(sampleOffset.x, -sampleOffset.y), outlineWidth, outlineColor, smoothing);
|
||
|
||
// Equally weight the center sample and the 4 neighboring samples
|
||
color = (center + color1 + color2 + color3 + color4)/5.0;
|
||
#else
|
||
// Just do a single sample
|
||
float smoothing = 1.0/32.0;
|
||
color = getSDFColor(v_textureCoordinates, outlineWidth, outlineColor, smoothing);
|
||
#endif
|
||
|
||
color = czm_gammaCorrect(color);
|
||
#else
|
||
color = czm_gammaCorrect(color);
|
||
color *= czm_gammaCorrect(v_color);
|
||
#endif
|
||
|
||
// Fully transparent parts of the billboard are not pickable.
|
||
#if !defined(OPAQUE) && !defined(TRANSLUCENT)
|
||
if (color.a < 0.005) // matches 0/255 and 1/255
|
||
{
|
||
discard;
|
||
}
|
||
#else
|
||
// The billboard is rendered twice. The opaque pass discards translucent fragments
|
||
// and the translucent pass discards opaque fragments.
|
||
#ifdef OPAQUE
|
||
if (color.a < 0.995) // matches < 254/255
|
||
{
|
||
discard;
|
||
}
|
||
#else
|
||
if (color.a >= 0.995) // matches 254/255 and 255/255
|
||
{
|
||
discard;
|
||
}
|
||
#endif
|
||
#endif
|
||
|
||
#ifdef VECTOR_TILE
|
||
color *= u_highlightColor;
|
||
#endif
|
||
gl_FragColor = color;
|
||
|
||
#ifdef LOG_DEPTH
|
||
czm_writeLogDepth();
|
||
#endif
|
||
|
||
#ifdef FRAGMENT_DEPTH_CHECK
|
||
float temp = v_compressed.y;
|
||
|
||
temp = temp * SHIFT_RIGHT1;
|
||
|
||
float temp2 = (temp - floor(temp)) * SHIFT_LEFT1;
|
||
bool enableDepthTest = temp2 != 0.0;
|
||
bool applyTranslate = floor(temp) != 0.0;
|
||
|
||
if (enableDepthTest) {
|
||
temp = v_compressed.z;
|
||
temp = temp * SHIFT_RIGHT12;
|
||
|
||
vec2 dimensions;
|
||
dimensions.y = (temp - floor(temp)) * SHIFT_LEFT12;
|
||
dimensions.x = floor(temp);
|
||
|
||
temp = v_compressed.w;
|
||
temp = temp * SHIFT_RIGHT12;
|
||
|
||
vec2 imageSize;
|
||
imageSize.y = (temp - floor(temp)) * SHIFT_LEFT12;
|
||
imageSize.x = floor(temp);
|
||
|
||
vec2 adjustedST = v_textureCoordinates - v_textureCoordinateBounds.xy;
|
||
adjustedST = adjustedST / vec2(v_textureCoordinateBounds.z - v_textureCoordinateBounds.x, v_textureCoordinateBounds.w - v_textureCoordinateBounds.y);
|
||
|
||
float epsilonEyeDepth = v_compressed.x + czm_epsilon1;
|
||
float globeDepth1 = getGlobeDepth(adjustedST, v_originTextureCoordinateAndTranslate.xy, applyTranslate, dimensions, imageSize);
|
||
|
||
// negative values go into the screen
|
||
if (globeDepth1 != 0.0 && globeDepth1 > epsilonEyeDepth)
|
||
{
|
||
float globeDepth2 = getGlobeDepth(adjustedST, vec2(0.0, 1.0), applyTranslate, dimensions, imageSize); // top left corner
|
||
if (globeDepth2 != 0.0 && globeDepth2 > epsilonEyeDepth)
|
||
{
|
||
float globeDepth3 = getGlobeDepth(adjustedST, vec2(1.0, 1.0), applyTranslate, dimensions, imageSize); // top right corner
|
||
if (globeDepth3 != 0.0 && globeDepth3 > epsilonEyeDepth)
|
||
{
|
||
discard;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
#endif
|
||
|
||
}
|
||
`,wOe=`#ifdef INSTANCED
|
||
attribute vec2 direction;
|
||
#endif
|
||
attribute vec4 positionHighAndScale;
|
||
attribute vec4 positionLowAndRotation;
|
||
attribute vec4 compressedAttribute0; // pixel offset, translate, horizontal origin, vertical origin, show, direction, texture coordinates (texture offset)
|
||
attribute vec4 compressedAttribute1; // aligned axis, translucency by distance, image width
|
||
attribute vec4 compressedAttribute2; // label horizontal origin, image height, color, pick color, size in meters, valid aligned axis, 13 bits free
|
||
attribute vec4 eyeOffset; // eye offset in meters, 4 bytes free (texture range)
|
||
attribute vec4 scaleByDistance; // near, nearScale, far, farScale
|
||
attribute vec4 pixelOffsetScaleByDistance; // near, nearScale, far, farScale
|
||
attribute vec4 compressedAttribute3; // distance display condition near, far, disableDepthTestDistance, dimensions
|
||
attribute vec2 sdf; // sdf outline color (rgb) and width (w)
|
||
#if defined(VERTEX_DEPTH_CHECK) || defined(FRAGMENT_DEPTH_CHECK)
|
||
attribute vec4 textureCoordinateBoundsOrLabelTranslate; // the min and max x and y values for the texture coordinates
|
||
#endif
|
||
#ifdef VECTOR_TILE
|
||
attribute float a_batchId;
|
||
#endif
|
||
|
||
varying vec2 v_textureCoordinates;
|
||
#ifdef FRAGMENT_DEPTH_CHECK
|
||
varying vec4 v_textureCoordinateBounds;
|
||
varying vec4 v_originTextureCoordinateAndTranslate;
|
||
varying vec4 v_compressed; // x: eyeDepth, y: applyTranslate & enableDepthCheck, z: dimensions, w: imageSize
|
||
varying mat2 v_rotationMatrix;
|
||
#endif
|
||
|
||
varying vec4 v_pickColor;
|
||
varying vec4 v_color;
|
||
#ifdef SDF
|
||
varying vec4 v_outlineColor;
|
||
varying float v_outlineWidth;
|
||
#endif
|
||
|
||
const float UPPER_BOUND = 32768.0;
|
||
|
||
const float SHIFT_LEFT16 = 65536.0;
|
||
const float SHIFT_LEFT12 = 4096.0;
|
||
const float SHIFT_LEFT8 = 256.0;
|
||
const float SHIFT_LEFT7 = 128.0;
|
||
const float SHIFT_LEFT5 = 32.0;
|
||
const float SHIFT_LEFT3 = 8.0;
|
||
const float SHIFT_LEFT2 = 4.0;
|
||
const float SHIFT_LEFT1 = 2.0;
|
||
|
||
const float SHIFT_RIGHT12 = 1.0 / 4096.0;
|
||
const float SHIFT_RIGHT8 = 1.0 / 256.0;
|
||
const float SHIFT_RIGHT7 = 1.0 / 128.0;
|
||
const float SHIFT_RIGHT5 = 1.0 / 32.0;
|
||
const float SHIFT_RIGHT3 = 1.0 / 8.0;
|
||
const float SHIFT_RIGHT2 = 1.0 / 4.0;
|
||
const float SHIFT_RIGHT1 = 1.0 / 2.0;
|
||
|
||
vec4 addScreenSpaceOffset(vec4 positionEC, vec2 imageSize, float scale, vec2 direction, vec2 origin, vec2 translate, vec2 pixelOffset, vec3 alignedAxis, bool validAlignedAxis, float rotation, bool sizeInMeters, out mat2 rotationMatrix, out float mpp)
|
||
{
|
||
// Note the halfSize cannot be computed in JavaScript because it is sent via
|
||
// compressed vertex attributes that coerce it to an integer.
|
||
vec2 halfSize = imageSize * scale * 0.5;
|
||
halfSize *= ((direction * 2.0) - 1.0);
|
||
|
||
vec2 originTranslate = origin * abs(halfSize);
|
||
|
||
#if defined(ROTATION) || defined(ALIGNED_AXIS)
|
||
if (validAlignedAxis || rotation != 0.0)
|
||
{
|
||
float angle = rotation;
|
||
if (validAlignedAxis)
|
||
{
|
||
vec4 projectedAlignedAxis = czm_modelView3D * vec4(alignedAxis, 0.0);
|
||
angle += sign(-projectedAlignedAxis.x) * acos(sign(projectedAlignedAxis.y) * (projectedAlignedAxis.y * projectedAlignedAxis.y) /
|
||
(projectedAlignedAxis.x * projectedAlignedAxis.x + projectedAlignedAxis.y * projectedAlignedAxis.y));
|
||
}
|
||
|
||
float cosTheta = cos(angle);
|
||
float sinTheta = sin(angle);
|
||
rotationMatrix = mat2(cosTheta, sinTheta, -sinTheta, cosTheta);
|
||
halfSize = rotationMatrix * halfSize;
|
||
}
|
||
else
|
||
{
|
||
rotationMatrix = mat2(1.0, 0.0, 0.0, 1.0);
|
||
}
|
||
#endif
|
||
|
||
mpp = czm_metersPerPixel(positionEC);
|
||
positionEC.xy += (originTranslate + halfSize) * czm_branchFreeTernary(sizeInMeters, 1.0, mpp);
|
||
positionEC.xy += (translate + pixelOffset) * mpp;
|
||
|
||
return positionEC;
|
||
}
|
||
|
||
#ifdef VERTEX_DEPTH_CHECK
|
||
float getGlobeDepth(vec4 positionEC)
|
||
{
|
||
vec4 posWC = czm_eyeToWindowCoordinates(positionEC);
|
||
|
||
float globeDepth = czm_unpackDepth(texture2D(czm_globeDepthTexture, posWC.xy / czm_viewport.zw));
|
||
|
||
if (globeDepth == 0.0)
|
||
{
|
||
return 0.0; // not on the globe
|
||
}
|
||
|
||
vec4 eyeCoordinate = czm_windowToEyeCoordinates(posWC.xy, globeDepth);
|
||
return eyeCoordinate.z / eyeCoordinate.w;
|
||
}
|
||
#endif
|
||
void main()
|
||
{
|
||
// Modifying this shader may also require modifications to Billboard._computeScreenSpacePosition
|
||
|
||
// unpack attributes
|
||
vec3 positionHigh = positionHighAndScale.xyz;
|
||
vec3 positionLow = positionLowAndRotation.xyz;
|
||
float scale = positionHighAndScale.w;
|
||
|
||
#if defined(ROTATION) || defined(ALIGNED_AXIS)
|
||
float rotation = positionLowAndRotation.w;
|
||
#else
|
||
float rotation = 0.0;
|
||
#endif
|
||
|
||
float compressed = compressedAttribute0.x;
|
||
|
||
vec2 pixelOffset;
|
||
pixelOffset.x = floor(compressed * SHIFT_RIGHT7);
|
||
compressed -= pixelOffset.x * SHIFT_LEFT7;
|
||
pixelOffset.x -= UPPER_BOUND;
|
||
|
||
vec2 origin;
|
||
origin.x = floor(compressed * SHIFT_RIGHT5);
|
||
compressed -= origin.x * SHIFT_LEFT5;
|
||
|
||
origin.y = floor(compressed * SHIFT_RIGHT3);
|
||
compressed -= origin.y * SHIFT_LEFT3;
|
||
|
||
#ifdef FRAGMENT_DEPTH_CHECK
|
||
vec2 depthOrigin = origin.xy;
|
||
#endif
|
||
origin -= vec2(1.0);
|
||
|
||
float show = floor(compressed * SHIFT_RIGHT2);
|
||
compressed -= show * SHIFT_LEFT2;
|
||
|
||
#ifdef INSTANCED
|
||
vec2 textureCoordinatesBottomLeft = czm_decompressTextureCoordinates(compressedAttribute0.w);
|
||
vec2 textureCoordinatesRange = czm_decompressTextureCoordinates(eyeOffset.w);
|
||
vec2 textureCoordinates = textureCoordinatesBottomLeft + direction * textureCoordinatesRange;
|
||
#else
|
||
vec2 direction;
|
||
direction.x = floor(compressed * SHIFT_RIGHT1);
|
||
direction.y = compressed - direction.x * SHIFT_LEFT1;
|
||
|
||
vec2 textureCoordinates = czm_decompressTextureCoordinates(compressedAttribute0.w);
|
||
#endif
|
||
|
||
float temp = compressedAttribute0.y * SHIFT_RIGHT8;
|
||
pixelOffset.y = -(floor(temp) - UPPER_BOUND);
|
||
|
||
vec2 translate;
|
||
translate.y = (temp - floor(temp)) * SHIFT_LEFT16;
|
||
|
||
temp = compressedAttribute0.z * SHIFT_RIGHT8;
|
||
translate.x = floor(temp) - UPPER_BOUND;
|
||
|
||
translate.y += (temp - floor(temp)) * SHIFT_LEFT8;
|
||
translate.y -= UPPER_BOUND;
|
||
|
||
temp = compressedAttribute1.x * SHIFT_RIGHT8;
|
||
float temp2 = floor(compressedAttribute2.w * SHIFT_RIGHT2);
|
||
|
||
vec2 imageSize = vec2(floor(temp), temp2);
|
||
|
||
#ifdef FRAGMENT_DEPTH_CHECK
|
||
float labelHorizontalOrigin = floor(compressedAttribute2.w - (temp2 * SHIFT_LEFT2));
|
||
float applyTranslate = 0.0;
|
||
if (labelHorizontalOrigin != 0.0) // is a billboard, so set apply translate to false
|
||
{
|
||
applyTranslate = 1.0;
|
||
labelHorizontalOrigin -= 2.0;
|
||
depthOrigin.x = labelHorizontalOrigin + 1.0;
|
||
}
|
||
|
||
depthOrigin = vec2(1.0) - (depthOrigin * 0.5);
|
||
#endif
|
||
|
||
#ifdef EYE_DISTANCE_TRANSLUCENCY
|
||
vec4 translucencyByDistance;
|
||
translucencyByDistance.x = compressedAttribute1.z;
|
||
translucencyByDistance.z = compressedAttribute1.w;
|
||
|
||
translucencyByDistance.y = ((temp - floor(temp)) * SHIFT_LEFT8) / 255.0;
|
||
|
||
temp = compressedAttribute1.y * SHIFT_RIGHT8;
|
||
translucencyByDistance.w = ((temp - floor(temp)) * SHIFT_LEFT8) / 255.0;
|
||
#endif
|
||
|
||
#if defined(VERTEX_DEPTH_CHECK) || defined(FRAGMENT_DEPTH_CHECK)
|
||
temp = compressedAttribute3.w;
|
||
temp = temp * SHIFT_RIGHT12;
|
||
|
||
vec2 dimensions;
|
||
dimensions.y = (temp - floor(temp)) * SHIFT_LEFT12;
|
||
dimensions.x = floor(temp);
|
||
#endif
|
||
|
||
#ifdef ALIGNED_AXIS
|
||
vec3 alignedAxis = czm_octDecode(floor(compressedAttribute1.y * SHIFT_RIGHT8));
|
||
temp = compressedAttribute2.z * SHIFT_RIGHT5;
|
||
bool validAlignedAxis = (temp - floor(temp)) * SHIFT_LEFT1 > 0.0;
|
||
#else
|
||
vec3 alignedAxis = vec3(0.0);
|
||
bool validAlignedAxis = false;
|
||
#endif
|
||
|
||
vec4 pickColor;
|
||
vec4 color;
|
||
|
||
temp = compressedAttribute2.y;
|
||
temp = temp * SHIFT_RIGHT8;
|
||
pickColor.b = (temp - floor(temp)) * SHIFT_LEFT8;
|
||
temp = floor(temp) * SHIFT_RIGHT8;
|
||
pickColor.g = (temp - floor(temp)) * SHIFT_LEFT8;
|
||
pickColor.r = floor(temp);
|
||
|
||
temp = compressedAttribute2.x;
|
||
temp = temp * SHIFT_RIGHT8;
|
||
color.b = (temp - floor(temp)) * SHIFT_LEFT8;
|
||
temp = floor(temp) * SHIFT_RIGHT8;
|
||
color.g = (temp - floor(temp)) * SHIFT_LEFT8;
|
||
color.r = floor(temp);
|
||
|
||
temp = compressedAttribute2.z * SHIFT_RIGHT8;
|
||
bool sizeInMeters = floor((temp - floor(temp)) * SHIFT_LEFT7) > 0.0;
|
||
temp = floor(temp) * SHIFT_RIGHT8;
|
||
|
||
pickColor.a = (temp - floor(temp)) * SHIFT_LEFT8;
|
||
pickColor /= 255.0;
|
||
|
||
color.a = floor(temp);
|
||
color /= 255.0;
|
||
|
||
///////////////////////////////////////////////////////////////////////////
|
||
|
||
vec4 p = czm_translateRelativeToEye(positionHigh, positionLow);
|
||
vec4 positionEC = czm_modelViewRelativeToEye * p;
|
||
|
||
#if defined(FRAGMENT_DEPTH_CHECK) || defined(VERTEX_DEPTH_CHECK)
|
||
float eyeDepth = positionEC.z;
|
||
#endif
|
||
|
||
positionEC = czm_eyeOffset(positionEC, eyeOffset.xyz);
|
||
positionEC.xyz *= show;
|
||
|
||
///////////////////////////////////////////////////////////////////////////
|
||
|
||
#if defined(EYE_DISTANCE_SCALING) || defined(EYE_DISTANCE_TRANSLUCENCY) || defined(EYE_DISTANCE_PIXEL_OFFSET) || defined(DISTANCE_DISPLAY_CONDITION) || defined(DISABLE_DEPTH_DISTANCE)
|
||
float lengthSq;
|
||
if (czm_sceneMode == czm_sceneMode2D)
|
||
{
|
||
// 2D camera distance is a special case
|
||
// treat all billboards as flattened to the z=0.0 plane
|
||
lengthSq = czm_eyeHeight2D.y;
|
||
}
|
||
else
|
||
{
|
||
lengthSq = dot(positionEC.xyz, positionEC.xyz);
|
||
}
|
||
#endif
|
||
|
||
#ifdef EYE_DISTANCE_SCALING
|
||
float distanceScale = czm_nearFarScalar(scaleByDistance, lengthSq);
|
||
scale *= distanceScale;
|
||
translate *= distanceScale;
|
||
// push vertex behind near plane for clipping
|
||
if (scale == 0.0)
|
||
{
|
||
positionEC.xyz = vec3(0.0);
|
||
}
|
||
#endif
|
||
|
||
float translucency = 1.0;
|
||
#ifdef EYE_DISTANCE_TRANSLUCENCY
|
||
translucency = czm_nearFarScalar(translucencyByDistance, lengthSq);
|
||
// push vertex behind near plane for clipping
|
||
if (translucency == 0.0)
|
||
{
|
||
positionEC.xyz = vec3(0.0);
|
||
}
|
||
#endif
|
||
|
||
#ifdef EYE_DISTANCE_PIXEL_OFFSET
|
||
float pixelOffsetScale = czm_nearFarScalar(pixelOffsetScaleByDistance, lengthSq);
|
||
pixelOffset *= pixelOffsetScale;
|
||
#endif
|
||
|
||
#ifdef DISTANCE_DISPLAY_CONDITION
|
||
float nearSq = compressedAttribute3.x;
|
||
float farSq = compressedAttribute3.y;
|
||
if (lengthSq < nearSq || lengthSq > farSq)
|
||
{
|
||
positionEC.xyz = vec3(0.0);
|
||
}
|
||
#endif
|
||
|
||
mat2 rotationMatrix;
|
||
float mpp;
|
||
|
||
#ifdef DISABLE_DEPTH_DISTANCE
|
||
float disableDepthTestDistance = compressedAttribute3.z;
|
||
#endif
|
||
|
||
#ifdef VERTEX_DEPTH_CHECK
|
||
if (lengthSq < disableDepthTestDistance) {
|
||
float depthsilon = 10.0;
|
||
|
||
vec2 labelTranslate = textureCoordinateBoundsOrLabelTranslate.xy;
|
||
vec4 pEC1 = addScreenSpaceOffset(positionEC, dimensions, scale, vec2(0.0), origin, labelTranslate, pixelOffset, alignedAxis, validAlignedAxis, rotation, sizeInMeters, rotationMatrix, mpp);
|
||
float globeDepth1 = getGlobeDepth(pEC1);
|
||
|
||
if (globeDepth1 != 0.0 && pEC1.z + depthsilon < globeDepth1)
|
||
{
|
||
vec4 pEC2 = addScreenSpaceOffset(positionEC, dimensions, scale, vec2(0.0, 1.0), origin, labelTranslate, pixelOffset, alignedAxis, validAlignedAxis, rotation, sizeInMeters, rotationMatrix, mpp);
|
||
float globeDepth2 = getGlobeDepth(pEC2);
|
||
|
||
if (globeDepth2 != 0.0 && pEC2.z + depthsilon < globeDepth2)
|
||
{
|
||
vec4 pEC3 = addScreenSpaceOffset(positionEC, dimensions, scale, vec2(1.0), origin, labelTranslate, pixelOffset, alignedAxis, validAlignedAxis, rotation, sizeInMeters, rotationMatrix, mpp);
|
||
float globeDepth3 = getGlobeDepth(pEC3);
|
||
if (globeDepth3 != 0.0 && pEC3.z + depthsilon < globeDepth3)
|
||
{
|
||
positionEC.xyz = vec3(0.0);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
#endif
|
||
|
||
positionEC = addScreenSpaceOffset(positionEC, imageSize, scale, direction, origin, translate, pixelOffset, alignedAxis, validAlignedAxis, rotation, sizeInMeters, rotationMatrix, mpp);
|
||
gl_Position = czm_projection * positionEC;
|
||
v_textureCoordinates = textureCoordinates;
|
||
|
||
#ifdef LOG_DEPTH
|
||
czm_vertexLogDepth();
|
||
#endif
|
||
|
||
#ifdef DISABLE_DEPTH_DISTANCE
|
||
if (disableDepthTestDistance == 0.0 && czm_minimumDisableDepthTestDistance != 0.0)
|
||
{
|
||
disableDepthTestDistance = czm_minimumDisableDepthTestDistance;
|
||
}
|
||
|
||
if (disableDepthTestDistance != 0.0)
|
||
{
|
||
// Don't try to "multiply both sides" by w. Greater/less-than comparisons won't work for negative values of w.
|
||
float zclip = gl_Position.z / gl_Position.w;
|
||
bool clipped = (zclip < -1.0 || zclip > 1.0);
|
||
if (!clipped && (disableDepthTestDistance < 0.0 || (lengthSq > 0.0 && lengthSq < disableDepthTestDistance)))
|
||
{
|
||
// Position z on the near plane.
|
||
gl_Position.z = -gl_Position.w;
|
||
#ifdef LOG_DEPTH
|
||
v_depthFromNearPlusOne = 1.0;
|
||
#endif
|
||
}
|
||
}
|
||
#endif
|
||
|
||
#ifdef FRAGMENT_DEPTH_CHECK
|
||
if (sizeInMeters) {
|
||
translate /= mpp;
|
||
dimensions /= mpp;
|
||
imageSize /= mpp;
|
||
}
|
||
|
||
#if defined(ROTATION) || defined(ALIGNED_AXIS)
|
||
v_rotationMatrix = rotationMatrix;
|
||
#else
|
||
v_rotationMatrix = mat2(1.0, 0.0, 0.0, 1.0);
|
||
#endif
|
||
|
||
float enableDepthCheck = 0.0;
|
||
if (lengthSq < disableDepthTestDistance)
|
||
{
|
||
enableDepthCheck = 1.0;
|
||
}
|
||
|
||
float dw = floor(clamp(dimensions.x, 0.0, SHIFT_LEFT12));
|
||
float dh = floor(clamp(dimensions.y, 0.0, SHIFT_LEFT12));
|
||
|
||
float iw = floor(clamp(imageSize.x, 0.0, SHIFT_LEFT12));
|
||
float ih = floor(clamp(imageSize.y, 0.0, SHIFT_LEFT12));
|
||
|
||
v_compressed.x = eyeDepth;
|
||
v_compressed.y = applyTranslate * SHIFT_LEFT1 + enableDepthCheck;
|
||
v_compressed.z = dw * SHIFT_LEFT12 + dh;
|
||
v_compressed.w = iw * SHIFT_LEFT12 + ih;
|
||
v_originTextureCoordinateAndTranslate.xy = depthOrigin;
|
||
v_originTextureCoordinateAndTranslate.zw = translate;
|
||
v_textureCoordinateBounds = textureCoordinateBoundsOrLabelTranslate;
|
||
|
||
#endif
|
||
|
||
#ifdef SDF
|
||
vec4 outlineColor;
|
||
float outlineWidth;
|
||
|
||
temp = sdf.x;
|
||
temp = temp * SHIFT_RIGHT8;
|
||
outlineColor.b = (temp - floor(temp)) * SHIFT_LEFT8;
|
||
temp = floor(temp) * SHIFT_RIGHT8;
|
||
outlineColor.g = (temp - floor(temp)) * SHIFT_LEFT8;
|
||
outlineColor.r = floor(temp);
|
||
|
||
temp = sdf.y;
|
||
temp = temp * SHIFT_RIGHT8;
|
||
float temp3 = (temp - floor(temp)) * SHIFT_LEFT8;
|
||
temp = floor(temp) * SHIFT_RIGHT8;
|
||
outlineWidth = (temp - floor(temp)) * SHIFT_LEFT8;
|
||
outlineColor.a = floor(temp);
|
||
outlineColor /= 255.0;
|
||
|
||
v_outlineWidth = outlineWidth / 255.0;
|
||
v_outlineColor = outlineColor;
|
||
v_outlineColor.a *= translucency;
|
||
#endif
|
||
|
||
v_pickColor = pickColor;
|
||
|
||
v_color = color;
|
||
v_color.a *= translucency;
|
||
|
||
}
|
||
`,SOe=`varying vec2 v_textureCoordinates;
|
||
const float M_PI = 3.141592653589793;
|
||
|
||
float vdcRadicalInverse(int i)
|
||
{
|
||
float r;
|
||
float base = 2.0;
|
||
float value = 0.0;
|
||
float invBase = 1.0 / base;
|
||
float invBi = invBase;
|
||
for (int x = 0; x < 100; x++)
|
||
{
|
||
if (i <= 0)
|
||
{
|
||
break;
|
||
}
|
||
r = mod(float(i), base);
|
||
value += r * invBi;
|
||
invBi *= invBase;
|
||
i = int(float(i) * invBase);
|
||
}
|
||
return value;
|
||
}
|
||
|
||
vec2 hammersley2D(int i, int N)
|
||
{
|
||
return vec2(float(i) / float(N), vdcRadicalInverse(i));
|
||
}
|
||
|
||
vec3 importanceSampleGGX(vec2 xi, float roughness, vec3 N)
|
||
{
|
||
float a = roughness * roughness;
|
||
float phi = 2.0 * M_PI * xi.x;
|
||
float cosTheta = sqrt((1.0 - xi.y) / (1.0 + (a * a - 1.0) * xi.y));
|
||
float sinTheta = sqrt(1.0 - cosTheta * cosTheta);
|
||
vec3 H = vec3(sinTheta * cos(phi), sinTheta * sin(phi), cosTheta);
|
||
vec3 upVector = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);
|
||
vec3 tangentX = normalize(cross(upVector, N));
|
||
vec3 tangentY = cross(N, tangentX);
|
||
return tangentX * H.x + tangentY * H.y + N * H.z;
|
||
}
|
||
|
||
float G1_Smith(float NdotV, float k)
|
||
{
|
||
return NdotV / (NdotV * (1.0 - k) + k);
|
||
}
|
||
|
||
float G_Smith(float roughness, float NdotV, float NdotL)
|
||
{
|
||
float k = roughness * roughness / 2.0;
|
||
return G1_Smith(NdotV, k) * G1_Smith(NdotL, k);
|
||
}
|
||
|
||
vec2 integrateBrdf(float roughness, float NdotV)
|
||
{
|
||
vec3 V = vec3(sqrt(1.0 - NdotV * NdotV), 0.0, NdotV);
|
||
float A = 0.0;
|
||
float B = 0.0;
|
||
const int NumSamples = 1024;
|
||
for (int i = 0; i < NumSamples; i++)
|
||
{
|
||
vec2 xi = hammersley2D(i, NumSamples);
|
||
vec3 H = importanceSampleGGX(xi, roughness, vec3(0.0, 0.0, 1.0));
|
||
vec3 L = 2.0 * dot(V, H) * H - V;
|
||
float NdotL = clamp(L.z, 0.0, 1.0);
|
||
float NdotH = clamp(H.z, 0.0, 1.0);
|
||
float VdotH = clamp(dot(V, H), 0.0, 1.0);
|
||
if (NdotL > 0.0)
|
||
{
|
||
float G = G_Smith(roughness, NdotV, NdotL);
|
||
float G_Vis = G * VdotH / (NdotH * NdotV);
|
||
float Fc = pow(1.0 - VdotH, 5.0);
|
||
A += (1.0 - Fc) * G_Vis;
|
||
B += Fc * G_Vis;
|
||
}
|
||
}
|
||
return vec2(A, B) / float(NumSamples);
|
||
}
|
||
|
||
void main()
|
||
{
|
||
gl_FragColor = vec4(integrateBrdf(v_textureCoordinates.y, v_textureCoordinates.x), 0.0, 1.0);
|
||
}
|
||
`,vOe=`uniform sampler2D u_opaqueDepthTexture;
|
||
uniform sampler2D u_translucentDepthTexture;
|
||
|
||
varying vec2 v_textureCoordinates;
|
||
|
||
void main()
|
||
{
|
||
float opaqueDepth = texture2D(u_opaqueDepthTexture, v_textureCoordinates).r;
|
||
float translucentDepth = texture2D(u_translucentDepthTexture, v_textureCoordinates).r;
|
||
translucentDepth = czm_branchFreeTernary(translucentDepth > opaqueDepth, 1.0, translucentDepth);
|
||
gl_FragColor = czm_packDepth(translucentDepth);
|
||
}
|
||
`,DOe=`/**
|
||
* Compositing for Weighted Blended Order-Independent Transparency. See:
|
||
* - http://jcgt.org/published/0002/02/09/
|
||
* - http://casual-effects.blogspot.com/2014/03/weighted-blended-order-independent.html
|
||
*/
|
||
|
||
uniform sampler2D u_opaque;
|
||
uniform sampler2D u_accumulation;
|
||
uniform sampler2D u_revealage;
|
||
|
||
varying vec2 v_textureCoordinates;
|
||
|
||
void main()
|
||
{
|
||
vec4 opaque = texture2D(u_opaque, v_textureCoordinates);
|
||
vec4 accum = texture2D(u_accumulation, v_textureCoordinates);
|
||
float r = texture2D(u_revealage, v_textureCoordinates).r;
|
||
|
||
#ifdef MRT
|
||
vec4 transparent = vec4(accum.rgb / clamp(r, 1e-4, 5e4), accum.a);
|
||
#else
|
||
vec4 transparent = vec4(accum.rgb / clamp(accum.a, 1e-4, 5e4), r);
|
||
#endif
|
||
|
||
gl_FragColor = (1.0 - transparent.a) * transparent + transparent.a * opaque;
|
||
|
||
if (opaque != czm_backgroundColor)
|
||
{
|
||
gl_FragColor.a = 1.0;
|
||
}
|
||
}
|
||
`,IOe=`varying vec4 positionEC;
|
||
|
||
void main()
|
||
{
|
||
vec3 position;
|
||
vec3 direction;
|
||
if (czm_orthographicIn3D == 1.0)
|
||
{
|
||
vec2 uv = (gl_FragCoord.xy - czm_viewport.xy) / czm_viewport.zw;
|
||
vec2 minPlane = vec2(czm_frustumPlanes.z, czm_frustumPlanes.y); // left, bottom
|
||
vec2 maxPlane = vec2(czm_frustumPlanes.w, czm_frustumPlanes.x); // right, top
|
||
position = vec3(mix(minPlane, maxPlane, uv), 0.0);
|
||
direction = vec3(0.0, 0.0, -1.0);
|
||
}
|
||
else
|
||
{
|
||
position = vec3(0.0);
|
||
direction = normalize(positionEC.xyz);
|
||
}
|
||
|
||
czm_ray ray = czm_ray(position, direction);
|
||
|
||
vec3 ellipsoid_center = czm_view[3].xyz;
|
||
|
||
czm_raySegment intersection = czm_rayEllipsoidIntersectionInterval(ray, ellipsoid_center, czm_ellipsoidInverseRadii);
|
||
if (!czm_isEmpty(intersection))
|
||
{
|
||
gl_FragColor = vec4(1.0, 1.0, 0.0, 1.0);
|
||
}
|
||
else
|
||
{
|
||
discard;
|
||
}
|
||
|
||
czm_writeLogDepth();
|
||
}
|
||
`,POe=`attribute vec4 position;
|
||
|
||
varying vec4 positionEC;
|
||
|
||
void main()
|
||
{
|
||
positionEC = czm_modelView * position;
|
||
gl_Position = czm_projection * positionEC;
|
||
|
||
czm_vertexLogDepth();
|
||
}
|
||
`,L5=`#ifdef WRITE_DEPTH
|
||
#ifdef GL_EXT_frag_depth
|
||
#extension GL_EXT_frag_depth : enable
|
||
#endif
|
||
#endif
|
||
|
||
uniform vec3 u_radii;
|
||
uniform vec3 u_oneOverEllipsoidRadiiSquared;
|
||
|
||
varying vec3 v_positionEC;
|
||
|
||
vec4 computeEllipsoidColor(czm_ray ray, float intersection, float side)
|
||
{
|
||
vec3 positionEC = czm_pointAlongRay(ray, intersection);
|
||
vec3 positionMC = (czm_inverseModelView * vec4(positionEC, 1.0)).xyz;
|
||
vec3 geodeticNormal = normalize(czm_geodeticSurfaceNormal(positionMC, vec3(0.0), u_oneOverEllipsoidRadiiSquared));
|
||
vec3 sphericalNormal = normalize(positionMC / u_radii);
|
||
vec3 normalMC = geodeticNormal * side; // normalized surface normal (always facing the viewer) in model coordinates
|
||
vec3 normalEC = normalize(czm_normal * normalMC); // normalized surface normal in eye coordiantes
|
||
|
||
vec2 st = czm_ellipsoidWgs84TextureCoordinates(sphericalNormal);
|
||
vec3 positionToEyeEC = -positionEC;
|
||
|
||
czm_materialInput materialInput;
|
||
materialInput.s = st.s;
|
||
materialInput.st = st;
|
||
materialInput.str = (positionMC + u_radii) / u_radii;
|
||
materialInput.normalEC = normalEC;
|
||
materialInput.tangentToEyeMatrix = czm_eastNorthUpToEyeCoordinates(positionMC, normalEC);
|
||
materialInput.positionToEyeEC = positionToEyeEC;
|
||
czm_material material = czm_getMaterial(materialInput);
|
||
|
||
#ifdef ONLY_SUN_LIGHTING
|
||
return czm_private_phong(normalize(positionToEyeEC), material, czm_sunDirectionEC);
|
||
#else
|
||
return czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC);
|
||
#endif
|
||
}
|
||
|
||
void main()
|
||
{
|
||
// PERFORMANCE_TODO: When dynamic branching is available, compute ratio of maximum and minimum radii
|
||
// in the vertex shader. Only when it is larger than some constant, march along the ray.
|
||
// Otherwise perform one intersection test which will be the common case.
|
||
|
||
// Test if the ray intersects a sphere with the ellipsoid's maximum radius.
|
||
// For very oblate ellipsoids, using the ellipsoid's radii for an intersection test
|
||
// may cause false negatives. This will discard fragments before marching the ray forward.
|
||
float maxRadius = max(u_radii.x, max(u_radii.y, u_radii.z)) * 1.5;
|
||
vec3 direction = normalize(v_positionEC);
|
||
vec3 ellipsoidCenter = czm_modelView[3].xyz;
|
||
|
||
float t1 = -1.0;
|
||
float t2 = -1.0;
|
||
|
||
float b = -2.0 * dot(direction, ellipsoidCenter);
|
||
float c = dot(ellipsoidCenter, ellipsoidCenter) - maxRadius * maxRadius;
|
||
|
||
float discriminant = b * b - 4.0 * c;
|
||
if (discriminant >= 0.0) {
|
||
t1 = (-b - sqrt(discriminant)) * 0.5;
|
||
t2 = (-b + sqrt(discriminant)) * 0.5;
|
||
}
|
||
|
||
if (t1 < 0.0 && t2 < 0.0) {
|
||
discard;
|
||
}
|
||
|
||
float t = min(t1, t2);
|
||
if (t < 0.0) {
|
||
t = 0.0;
|
||
}
|
||
|
||
// March ray forward to intersection with larger sphere and find
|
||
czm_ray ray = czm_ray(t * direction, direction);
|
||
|
||
vec3 ellipsoid_inverseRadii = vec3(1.0 / u_radii.x, 1.0 / u_radii.y, 1.0 / u_radii.z);
|
||
|
||
czm_raySegment intersection = czm_rayEllipsoidIntersectionInterval(ray, ellipsoidCenter, ellipsoid_inverseRadii);
|
||
|
||
if (czm_isEmpty(intersection))
|
||
{
|
||
discard;
|
||
}
|
||
|
||
// If the viewer is outside, compute outsideFaceColor, with normals facing outward.
|
||
vec4 outsideFaceColor = (intersection.start != 0.0) ? computeEllipsoidColor(ray, intersection.start, 1.0) : vec4(0.0);
|
||
|
||
// If the viewer either is inside or can see inside, compute insideFaceColor, with normals facing inward.
|
||
vec4 insideFaceColor = (outsideFaceColor.a < 1.0) ? computeEllipsoidColor(ray, intersection.stop, -1.0) : vec4(0.0);
|
||
|
||
gl_FragColor = mix(insideFaceColor, outsideFaceColor, outsideFaceColor.a);
|
||
gl_FragColor.a = 1.0 - (1.0 - insideFaceColor.a) * (1.0 - outsideFaceColor.a);
|
||
|
||
#ifdef WRITE_DEPTH
|
||
#ifdef GL_EXT_frag_depth
|
||
t = (intersection.start != 0.0) ? intersection.start : intersection.stop;
|
||
vec3 positionEC = czm_pointAlongRay(ray, t);
|
||
vec4 positionCC = czm_projection * vec4(positionEC, 1.0);
|
||
#ifdef LOG_DEPTH
|
||
czm_writeLogDepth(1.0 + positionCC.w);
|
||
#else
|
||
float z = positionCC.z / positionCC.w;
|
||
|
||
float n = czm_depthRange.near;
|
||
float f = czm_depthRange.far;
|
||
|
||
gl_FragDepthEXT = (z * (f - n) + f + n) * 0.5;
|
||
#endif
|
||
#endif
|
||
#endif
|
||
}
|
||
`,B5=`attribute vec3 position;
|
||
|
||
uniform vec3 u_radii;
|
||
|
||
varying vec3 v_positionEC;
|
||
|
||
void main()
|
||
{
|
||
// In the vertex data, the cube goes from (-1.0, -1.0, -1.0) to (1.0, 1.0, 1.0) in model coordinates.
|
||
// Scale to consider the radii. We could also do this once on the CPU when using the BoxGeometry,
|
||
// but doing it here allows us to change the radii without rewriting the vertex data, and
|
||
// allows all ellipsoids to reuse the same vertex data.
|
||
vec4 p = vec4(u_radii * position, 1.0);
|
||
|
||
v_positionEC = (czm_modelView * p).xyz; // position in eye coordinates
|
||
gl_Position = czm_modelViewProjection * p; // position in clip coordinates
|
||
|
||
// With multi-frustum, when the ellipsoid primitive is positioned on the intersection of two frustums
|
||
// and close to terrain, the terrain (writes depth) in the closest frustum can overwrite part of the
|
||
// ellipsoid (does not write depth) that was rendered in the farther frustum.
|
||
//
|
||
// Here, we clamp the depth in the vertex shader to avoid being overwritten; however, this creates
|
||
// artifacts since some fragments can be alpha blended twice. This is solved by only rendering
|
||
// the ellipsoid in the closest frustum to the viewer.
|
||
gl_Position.z = clamp(gl_Position.z, czm_depthRange.near, czm_depthRange.far);
|
||
|
||
czm_vertexLogDepth();
|
||
}
|
||
`;/**
|
||
* @license
|
||
* Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved.
|
||
*
|
||
* Redistribution and use in source and binary forms, with or without
|
||
* modification, are permitted provided that the following conditions
|
||
* are met:
|
||
* * Redistributions of source code must retain the above copyright
|
||
* notice, this list of conditions and the following disclaimer.
|
||
* * Redistributions in binary form must reproduce the above copyright
|
||
* notice, this list of conditions and the following disclaimer in the
|
||
* documentation and/or other materials provided with the distribution.
|
||
* * Neither the name of NVIDIA CORPORATION nor the names of its
|
||
* contributors may be used to endorse or promote products derived
|
||
* from this software without specific prior written permission.
|
||
*
|
||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
|
||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||
*/const OOe=`/**
|
||
* @license
|
||
* Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved.
|
||
*
|
||
* Redistribution and use in source and binary forms, with or without
|
||
* modification, are permitted provided that the following conditions
|
||
* are met:
|
||
* * Redistributions of source code must retain the above copyright
|
||
* notice, this list of conditions and the following disclaimer.
|
||
* * Redistributions in binary form must reproduce the above copyright
|
||
* notice, this list of conditions and the following disclaimer in the
|
||
* documentation and/or other materials provided with the distribution.
|
||
* * Neither the name of NVIDIA CORPORATION nor the names of its
|
||
* contributors may be used to endorse or promote products derived
|
||
* from this software without specific prior written permission.
|
||
*
|
||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS \`\`AS IS'' AND ANY
|
||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||
*/
|
||
|
||
// NVIDIA GameWorks Graphics Samples GitHub link: https://github.com/NVIDIAGameWorks/GraphicsSamples
|
||
// Original FXAA 3.11 shader link: https://github.com/NVIDIAGameWorks/GraphicsSamples/blob/master/samples/es3-kepler/FXAA/FXAA3_11.h
|
||
|
||
// Steps used to integrate into Cesium:
|
||
// * The following defines are set:
|
||
// #define FXAA_PC 1
|
||
// #define FXAA_WEBGL_1 1
|
||
// #define FXAA_GREEN_AS_LUMA 1
|
||
// #define FXAA_EARLY_EXIT 1
|
||
// #define FXAA_GLSL_120 1
|
||
// * All other preprocessor directives besides the FXAA_QUALITY__P* directives were removed.
|
||
// * Double underscores are invalid for preprocessor directives so replace them with a single underscore. Replace
|
||
// /FXAA_QUALITY__P(.*)/g with /FXAA_QUALITY__P$1/.
|
||
// * There are no implicit conversions from ivec* to vec* so replace:
|
||
// #define FxaaInt2 ivec2
|
||
// with
|
||
// #define FxaaInt2 vec2
|
||
// * The texture2DLod function is only available in vertex shaders so replace:
|
||
// #define FxaaTexTop(t, p) texture2DLod(t, p, 0.0)
|
||
// #define FxaaTexOff(t, p, o, r) texture2DLod(t, p + (o * r), 0.0)
|
||
// with
|
||
// #define FxaaTexTop(t, p) texture2D(t, p)
|
||
// #define FxaaTexOff(t, p, o, r) texture2D(t, p + (o * r))
|
||
// * FXAA_QUALITY_PRESET is prepended in the javascript code. We may want to expose that setting in the future.
|
||
// * The following parameters to FxaaPixelShader are unused and can be removed:
|
||
// fxaaConsolePosPos
|
||
// fxaaConsoleRcpFrameOpt
|
||
// fxaaConsoleRcpFrameOpt2
|
||
// fxaaConsole360RcpFrameOpt2
|
||
// fxaaConsoleEdgeSharpness
|
||
// fxaaConsoleEdgeThreshold
|
||
// fxaaConsoleEdgeThresholdMi
|
||
// fxaaConsole360ConstDir
|
||
|
||
//
|
||
// Choose the quality preset.
|
||
// This needs to be compiled into the shader as it effects code.
|
||
// Best option to include multiple presets is to
|
||
// in each shader define the preset, then include this file.
|
||
//
|
||
// OPTIONS
|
||
// -----------------------------------------------------------------------
|
||
// 10 to 15 - default medium dither (10=fastest, 15=highest quality)
|
||
// 20 to 29 - less dither, more expensive (20=fastest, 29=highest quality)
|
||
// 39 - no dither, very expensive
|
||
//
|
||
// NOTES
|
||
// -----------------------------------------------------------------------
|
||
// 12 = slightly faster then FXAA 3.9 and higher edge quality (default)
|
||
// 13 = about same speed as FXAA 3.9 and better than 12
|
||
// 23 = closest to FXAA 3.9 visually and performance wise
|
||
// _ = the lowest digit is directly related to performance
|
||
// _ = the highest digit is directly related to style
|
||
//
|
||
//#define FXAA_QUALITY_PRESET 12
|
||
|
||
|
||
#if (FXAA_QUALITY_PRESET == 10)
|
||
#define FXAA_QUALITY_PS 3
|
||
#define FXAA_QUALITY_P0 1.5
|
||
#define FXAA_QUALITY_P1 3.0
|
||
#define FXAA_QUALITY_P2 12.0
|
||
#endif
|
||
#if (FXAA_QUALITY_PRESET == 11)
|
||
#define FXAA_QUALITY_PS 4
|
||
#define FXAA_QUALITY_P0 1.0
|
||
#define FXAA_QUALITY_P1 1.5
|
||
#define FXAA_QUALITY_P2 3.0
|
||
#define FXAA_QUALITY_P3 12.0
|
||
#endif
|
||
#if (FXAA_QUALITY_PRESET == 12)
|
||
#define FXAA_QUALITY_PS 5
|
||
#define FXAA_QUALITY_P0 1.0
|
||
#define FXAA_QUALITY_P1 1.5
|
||
#define FXAA_QUALITY_P2 2.0
|
||
#define FXAA_QUALITY_P3 4.0
|
||
#define FXAA_QUALITY_P4 12.0
|
||
#endif
|
||
#if (FXAA_QUALITY_PRESET == 13)
|
||
#define FXAA_QUALITY_PS 6
|
||
#define FXAA_QUALITY_P0 1.0
|
||
#define FXAA_QUALITY_P1 1.5
|
||
#define FXAA_QUALITY_P2 2.0
|
||
#define FXAA_QUALITY_P3 2.0
|
||
#define FXAA_QUALITY_P4 4.0
|
||
#define FXAA_QUALITY_P5 12.0
|
||
#endif
|
||
#if (FXAA_QUALITY_PRESET == 14)
|
||
#define FXAA_QUALITY_PS 7
|
||
#define FXAA_QUALITY_P0 1.0
|
||
#define FXAA_QUALITY_P1 1.5
|
||
#define FXAA_QUALITY_P2 2.0
|
||
#define FXAA_QUALITY_P3 2.0
|
||
#define FXAA_QUALITY_P4 2.0
|
||
#define FXAA_QUALITY_P5 4.0
|
||
#define FXAA_QUALITY_P6 12.0
|
||
#endif
|
||
#if (FXAA_QUALITY_PRESET == 15)
|
||
#define FXAA_QUALITY_PS 8
|
||
#define FXAA_QUALITY_P0 1.0
|
||
#define FXAA_QUALITY_P1 1.5
|
||
#define FXAA_QUALITY_P2 2.0
|
||
#define FXAA_QUALITY_P3 2.0
|
||
#define FXAA_QUALITY_P4 2.0
|
||
#define FXAA_QUALITY_P5 2.0
|
||
#define FXAA_QUALITY_P6 4.0
|
||
#define FXAA_QUALITY_P7 12.0
|
||
#endif
|
||
#if (FXAA_QUALITY_PRESET == 20)
|
||
#define FXAA_QUALITY_PS 3
|
||
#define FXAA_QUALITY_P0 1.5
|
||
#define FXAA_QUALITY_P1 2.0
|
||
#define FXAA_QUALITY_P2 8.0
|
||
#endif
|
||
#if (FXAA_QUALITY_PRESET == 21)
|
||
#define FXAA_QUALITY_PS 4
|
||
#define FXAA_QUALITY_P0 1.0
|
||
#define FXAA_QUALITY_P1 1.5
|
||
#define FXAA_QUALITY_P2 2.0
|
||
#define FXAA_QUALITY_P3 8.0
|
||
#endif
|
||
#if (FXAA_QUALITY_PRESET == 22)
|
||
#define FXAA_QUALITY_PS 5
|
||
#define FXAA_QUALITY_P0 1.0
|
||
#define FXAA_QUALITY_P1 1.5
|
||
#define FXAA_QUALITY_P2 2.0
|
||
#define FXAA_QUALITY_P3 2.0
|
||
#define FXAA_QUALITY_P4 8.0
|
||
#endif
|
||
#if (FXAA_QUALITY_PRESET == 23)
|
||
#define FXAA_QUALITY_PS 6
|
||
#define FXAA_QUALITY_P0 1.0
|
||
#define FXAA_QUALITY_P1 1.5
|
||
#define FXAA_QUALITY_P2 2.0
|
||
#define FXAA_QUALITY_P3 2.0
|
||
#define FXAA_QUALITY_P4 2.0
|
||
#define FXAA_QUALITY_P5 8.0
|
||
#endif
|
||
#if (FXAA_QUALITY_PRESET == 24)
|
||
#define FXAA_QUALITY_PS 7
|
||
#define FXAA_QUALITY_P0 1.0
|
||
#define FXAA_QUALITY_P1 1.5
|
||
#define FXAA_QUALITY_P2 2.0
|
||
#define FXAA_QUALITY_P3 2.0
|
||
#define FXAA_QUALITY_P4 2.0
|
||
#define FXAA_QUALITY_P5 3.0
|
||
#define FXAA_QUALITY_P6 8.0
|
||
#endif
|
||
#if (FXAA_QUALITY_PRESET == 25)
|
||
#define FXAA_QUALITY_PS 8
|
||
#define FXAA_QUALITY_P0 1.0
|
||
#define FXAA_QUALITY_P1 1.5
|
||
#define FXAA_QUALITY_P2 2.0
|
||
#define FXAA_QUALITY_P3 2.0
|
||
#define FXAA_QUALITY_P4 2.0
|
||
#define FXAA_QUALITY_P5 2.0
|
||
#define FXAA_QUALITY_P6 4.0
|
||
#define FXAA_QUALITY_P7 8.0
|
||
#endif
|
||
#if (FXAA_QUALITY_PRESET == 26)
|
||
#define FXAA_QUALITY_PS 9
|
||
#define FXAA_QUALITY_P0 1.0
|
||
#define FXAA_QUALITY_P1 1.5
|
||
#define FXAA_QUALITY_P2 2.0
|
||
#define FXAA_QUALITY_P3 2.0
|
||
#define FXAA_QUALITY_P4 2.0
|
||
#define FXAA_QUALITY_P5 2.0
|
||
#define FXAA_QUALITY_P6 2.0
|
||
#define FXAA_QUALITY_P7 4.0
|
||
#define FXAA_QUALITY_P8 8.0
|
||
#endif
|
||
#if (FXAA_QUALITY_PRESET == 27)
|
||
#define FXAA_QUALITY_PS 10
|
||
#define FXAA_QUALITY_P0 1.0
|
||
#define FXAA_QUALITY_P1 1.5
|
||
#define FXAA_QUALITY_P2 2.0
|
||
#define FXAA_QUALITY_P3 2.0
|
||
#define FXAA_QUALITY_P4 2.0
|
||
#define FXAA_QUALITY_P5 2.0
|
||
#define FXAA_QUALITY_P6 2.0
|
||
#define FXAA_QUALITY_P7 2.0
|
||
#define FXAA_QUALITY_P8 4.0
|
||
#define FXAA_QUALITY_P9 8.0
|
||
#endif
|
||
#if (FXAA_QUALITY_PRESET == 28)
|
||
#define FXAA_QUALITY_PS 11
|
||
#define FXAA_QUALITY_P0 1.0
|
||
#define FXAA_QUALITY_P1 1.5
|
||
#define FXAA_QUALITY_P2 2.0
|
||
#define FXAA_QUALITY_P3 2.0
|
||
#define FXAA_QUALITY_P4 2.0
|
||
#define FXAA_QUALITY_P5 2.0
|
||
#define FXAA_QUALITY_P6 2.0
|
||
#define FXAA_QUALITY_P7 2.0
|
||
#define FXAA_QUALITY_P8 2.0
|
||
#define FXAA_QUALITY_P9 4.0
|
||
#define FXAA_QUALITY_P10 8.0
|
||
#endif
|
||
#if (FXAA_QUALITY_PRESET == 29)
|
||
#define FXAA_QUALITY_PS 12
|
||
#define FXAA_QUALITY_P0 1.0
|
||
#define FXAA_QUALITY_P1 1.5
|
||
#define FXAA_QUALITY_P2 2.0
|
||
#define FXAA_QUALITY_P3 2.0
|
||
#define FXAA_QUALITY_P4 2.0
|
||
#define FXAA_QUALITY_P5 2.0
|
||
#define FXAA_QUALITY_P6 2.0
|
||
#define FXAA_QUALITY_P7 2.0
|
||
#define FXAA_QUALITY_P8 2.0
|
||
#define FXAA_QUALITY_P9 2.0
|
||
#define FXAA_QUALITY_P10 4.0
|
||
#define FXAA_QUALITY_P11 8.0
|
||
#endif
|
||
#if (FXAA_QUALITY_PRESET == 39)
|
||
#define FXAA_QUALITY_PS 12
|
||
#define FXAA_QUALITY_P0 1.0
|
||
#define FXAA_QUALITY_P1 1.0
|
||
#define FXAA_QUALITY_P2 1.0
|
||
#define FXAA_QUALITY_P3 1.0
|
||
#define FXAA_QUALITY_P4 1.0
|
||
#define FXAA_QUALITY_P5 1.5
|
||
#define FXAA_QUALITY_P6 2.0
|
||
#define FXAA_QUALITY_P7 2.0
|
||
#define FXAA_QUALITY_P8 2.0
|
||
#define FXAA_QUALITY_P9 2.0
|
||
#define FXAA_QUALITY_P10 4.0
|
||
#define FXAA_QUALITY_P11 8.0
|
||
#endif
|
||
|
||
#define FxaaBool bool
|
||
#define FxaaFloat float
|
||
#define FxaaFloat2 vec2
|
||
#define FxaaFloat3 vec3
|
||
#define FxaaFloat4 vec4
|
||
#define FxaaHalf float
|
||
#define FxaaHalf2 vec2
|
||
#define FxaaHalf3 vec3
|
||
#define FxaaHalf4 vec4
|
||
#define FxaaInt2 vec2
|
||
#define FxaaTex sampler2D
|
||
|
||
#define FxaaSat(x) clamp(x, 0.0, 1.0)
|
||
#define FxaaTexTop(t, p) texture2D(t, p)
|
||
#define FxaaTexOff(t, p, o, r) texture2D(t, p + (o * r))
|
||
|
||
FxaaFloat FxaaLuma(FxaaFloat4 rgba) { return rgba.y; }
|
||
|
||
FxaaFloat4 FxaaPixelShader(
|
||
//
|
||
// Use noperspective interpolation here (turn off perspective interpolation).
|
||
// {xy} = center of pixel
|
||
FxaaFloat2 pos,
|
||
//
|
||
// Input color texture.
|
||
// {rgb_} = color in linear or perceptual color space
|
||
// if (FXAA_GREEN_AS_LUMA == 0)
|
||
// {___a} = luma in perceptual color space (not linear)
|
||
FxaaTex tex,
|
||
//
|
||
// Only used on FXAA Quality.
|
||
// This must be from a constant/uniform.
|
||
// {x_} = 1.0/screenWidthInPixels
|
||
// {_y} = 1.0/screenHeightInPixels
|
||
FxaaFloat2 fxaaQualityRcpFrame,
|
||
//
|
||
// Only used on FXAA Quality.
|
||
// This used to be the FXAA_QUALITY_SUBPIX define.
|
||
// It is here now to allow easier tuning.
|
||
// Choose the amount of sub-pixel aliasing removal.
|
||
// This can effect sharpness.
|
||
// 1.00 - upper limit (softer)
|
||
// 0.75 - default amount of filtering
|
||
// 0.50 - lower limit (sharper, less sub-pixel aliasing removal)
|
||
// 0.25 - almost off
|
||
// 0.00 - completely off
|
||
FxaaFloat fxaaQualitySubpix,
|
||
//
|
||
// Only used on FXAA Quality.
|
||
// This used to be the FXAA_QUALITY_EDGE_THRESHOLD define.
|
||
// It is here now to allow easier tuning.
|
||
// The minimum amount of local contrast required to apply algorithm.
|
||
// 0.333 - too little (faster)
|
||
// 0.250 - low quality
|
||
// 0.166 - default
|
||
// 0.125 - high quality
|
||
// 0.063 - overkill (slower)
|
||
FxaaFloat fxaaQualityEdgeThreshold,
|
||
//
|
||
// Only used on FXAA Quality.
|
||
// This used to be the FXAA_QUALITY_EDGE_THRESHOLD_MIN define.
|
||
// It is here now to allow easier tuning.
|
||
// Trims the algorithm from processing darks.
|
||
// 0.0833 - upper limit (default, the start of visible unfiltered edges)
|
||
// 0.0625 - high quality (faster)
|
||
// 0.0312 - visible limit (slower)
|
||
// Special notes when using FXAA_GREEN_AS_LUMA,
|
||
// Likely want to set this to zero.
|
||
// As colors that are mostly not-green
|
||
// will appear very dark in the green channel!
|
||
// Tune by looking at mostly non-green content,
|
||
// then start at zero and increase until aliasing is a problem.
|
||
FxaaFloat fxaaQualityEdgeThresholdMin
|
||
) {
|
||
/*--------------------------------------------------------------------------*/
|
||
FxaaFloat2 posM;
|
||
posM.x = pos.x;
|
||
posM.y = pos.y;
|
||
FxaaFloat4 rgbyM = FxaaTexTop(tex, posM);
|
||
#define lumaM rgbyM.y
|
||
FxaaFloat lumaS = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 0, 1), fxaaQualityRcpFrame.xy));
|
||
FxaaFloat lumaE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1, 0), fxaaQualityRcpFrame.xy));
|
||
FxaaFloat lumaN = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 0,-1), fxaaQualityRcpFrame.xy));
|
||
FxaaFloat lumaW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 0), fxaaQualityRcpFrame.xy));
|
||
/*--------------------------------------------------------------------------*/
|
||
FxaaFloat maxSM = max(lumaS, lumaM);
|
||
FxaaFloat minSM = min(lumaS, lumaM);
|
||
FxaaFloat maxESM = max(lumaE, maxSM);
|
||
FxaaFloat minESM = min(lumaE, minSM);
|
||
FxaaFloat maxWN = max(lumaN, lumaW);
|
||
FxaaFloat minWN = min(lumaN, lumaW);
|
||
FxaaFloat rangeMax = max(maxWN, maxESM);
|
||
FxaaFloat rangeMin = min(minWN, minESM);
|
||
FxaaFloat rangeMaxScaled = rangeMax * fxaaQualityEdgeThreshold;
|
||
FxaaFloat range = rangeMax - rangeMin;
|
||
FxaaFloat rangeMaxClamped = max(fxaaQualityEdgeThresholdMin, rangeMaxScaled);
|
||
FxaaBool earlyExit = range < rangeMaxClamped;
|
||
/*--------------------------------------------------------------------------*/
|
||
if(earlyExit)
|
||
return rgbyM;
|
||
/*--------------------------------------------------------------------------*/
|
||
FxaaFloat lumaNW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1,-1), fxaaQualityRcpFrame.xy));
|
||
FxaaFloat lumaSE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1, 1), fxaaQualityRcpFrame.xy));
|
||
FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1,-1), fxaaQualityRcpFrame.xy));
|
||
FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 1), fxaaQualityRcpFrame.xy));
|
||
/*--------------------------------------------------------------------------*/
|
||
FxaaFloat lumaNS = lumaN + lumaS;
|
||
FxaaFloat lumaWE = lumaW + lumaE;
|
||
FxaaFloat subpixRcpRange = 1.0/range;
|
||
FxaaFloat subpixNSWE = lumaNS + lumaWE;
|
||
FxaaFloat edgeHorz1 = (-2.0 * lumaM) + lumaNS;
|
||
FxaaFloat edgeVert1 = (-2.0 * lumaM) + lumaWE;
|
||
/*--------------------------------------------------------------------------*/
|
||
FxaaFloat lumaNESE = lumaNE + lumaSE;
|
||
FxaaFloat lumaNWNE = lumaNW + lumaNE;
|
||
FxaaFloat edgeHorz2 = (-2.0 * lumaE) + lumaNESE;
|
||
FxaaFloat edgeVert2 = (-2.0 * lumaN) + lumaNWNE;
|
||
/*--------------------------------------------------------------------------*/
|
||
FxaaFloat lumaNWSW = lumaNW + lumaSW;
|
||
FxaaFloat lumaSWSE = lumaSW + lumaSE;
|
||
FxaaFloat edgeHorz4 = (abs(edgeHorz1) * 2.0) + abs(edgeHorz2);
|
||
FxaaFloat edgeVert4 = (abs(edgeVert1) * 2.0) + abs(edgeVert2);
|
||
FxaaFloat edgeHorz3 = (-2.0 * lumaW) + lumaNWSW;
|
||
FxaaFloat edgeVert3 = (-2.0 * lumaS) + lumaSWSE;
|
||
FxaaFloat edgeHorz = abs(edgeHorz3) + edgeHorz4;
|
||
FxaaFloat edgeVert = abs(edgeVert3) + edgeVert4;
|
||
/*--------------------------------------------------------------------------*/
|
||
FxaaFloat subpixNWSWNESE = lumaNWSW + lumaNESE;
|
||
FxaaFloat lengthSign = fxaaQualityRcpFrame.x;
|
||
FxaaBool horzSpan = edgeHorz >= edgeVert;
|
||
FxaaFloat subpixA = subpixNSWE * 2.0 + subpixNWSWNESE;
|
||
/*--------------------------------------------------------------------------*/
|
||
if(!horzSpan) lumaN = lumaW;
|
||
if(!horzSpan) lumaS = lumaE;
|
||
if(horzSpan) lengthSign = fxaaQualityRcpFrame.y;
|
||
FxaaFloat subpixB = (subpixA * (1.0/12.0)) - lumaM;
|
||
/*--------------------------------------------------------------------------*/
|
||
FxaaFloat gradientN = lumaN - lumaM;
|
||
FxaaFloat gradientS = lumaS - lumaM;
|
||
FxaaFloat lumaNN = lumaN + lumaM;
|
||
FxaaFloat lumaSS = lumaS + lumaM;
|
||
FxaaBool pairN = abs(gradientN) >= abs(gradientS);
|
||
FxaaFloat gradient = max(abs(gradientN), abs(gradientS));
|
||
if(pairN) lengthSign = -lengthSign;
|
||
FxaaFloat subpixC = FxaaSat(abs(subpixB) * subpixRcpRange);
|
||
/*--------------------------------------------------------------------------*/
|
||
FxaaFloat2 posB;
|
||
posB.x = posM.x;
|
||
posB.y = posM.y;
|
||
FxaaFloat2 offNP;
|
||
offNP.x = (!horzSpan) ? 0.0 : fxaaQualityRcpFrame.x;
|
||
offNP.y = ( horzSpan) ? 0.0 : fxaaQualityRcpFrame.y;
|
||
if(!horzSpan) posB.x += lengthSign * 0.5;
|
||
if( horzSpan) posB.y += lengthSign * 0.5;
|
||
/*--------------------------------------------------------------------------*/
|
||
FxaaFloat2 posN;
|
||
posN.x = posB.x - offNP.x * FXAA_QUALITY_P0;
|
||
posN.y = posB.y - offNP.y * FXAA_QUALITY_P0;
|
||
FxaaFloat2 posP;
|
||
posP.x = posB.x + offNP.x * FXAA_QUALITY_P0;
|
||
posP.y = posB.y + offNP.y * FXAA_QUALITY_P0;
|
||
FxaaFloat subpixD = ((-2.0)*subpixC) + 3.0;
|
||
FxaaFloat lumaEndN = FxaaLuma(FxaaTexTop(tex, posN));
|
||
FxaaFloat subpixE = subpixC * subpixC;
|
||
FxaaFloat lumaEndP = FxaaLuma(FxaaTexTop(tex, posP));
|
||
/*--------------------------------------------------------------------------*/
|
||
if(!pairN) lumaNN = lumaSS;
|
||
FxaaFloat gradientScaled = gradient * 1.0/4.0;
|
||
FxaaFloat lumaMM = lumaM - lumaNN * 0.5;
|
||
FxaaFloat subpixF = subpixD * subpixE;
|
||
FxaaBool lumaMLTZero = lumaMM < 0.0;
|
||
/*--------------------------------------------------------------------------*/
|
||
lumaEndN -= lumaNN * 0.5;
|
||
lumaEndP -= lumaNN * 0.5;
|
||
FxaaBool doneN = abs(lumaEndN) >= gradientScaled;
|
||
FxaaBool doneP = abs(lumaEndP) >= gradientScaled;
|
||
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P1;
|
||
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P1;
|
||
FxaaBool doneNP = (!doneN) || (!doneP);
|
||
if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P1;
|
||
if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P1;
|
||
/*--------------------------------------------------------------------------*/
|
||
if(doneNP) {
|
||
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
|
||
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
|
||
if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
|
||
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
|
||
doneN = abs(lumaEndN) >= gradientScaled;
|
||
doneP = abs(lumaEndP) >= gradientScaled;
|
||
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P2;
|
||
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P2;
|
||
doneNP = (!doneN) || (!doneP);
|
||
if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P2;
|
||
if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P2;
|
||
/*--------------------------------------------------------------------------*/
|
||
#if (FXAA_QUALITY_PS > 3)
|
||
if(doneNP) {
|
||
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
|
||
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
|
||
if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
|
||
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
|
||
doneN = abs(lumaEndN) >= gradientScaled;
|
||
doneP = abs(lumaEndP) >= gradientScaled;
|
||
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P3;
|
||
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P3;
|
||
doneNP = (!doneN) || (!doneP);
|
||
if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P3;
|
||
if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P3;
|
||
/*--------------------------------------------------------------------------*/
|
||
#if (FXAA_QUALITY_PS > 4)
|
||
if(doneNP) {
|
||
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
|
||
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
|
||
if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
|
||
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
|
||
doneN = abs(lumaEndN) >= gradientScaled;
|
||
doneP = abs(lumaEndP) >= gradientScaled;
|
||
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P4;
|
||
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P4;
|
||
doneNP = (!doneN) || (!doneP);
|
||
if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P4;
|
||
if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P4;
|
||
/*--------------------------------------------------------------------------*/
|
||
#if (FXAA_QUALITY_PS > 5)
|
||
if(doneNP) {
|
||
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
|
||
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
|
||
if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
|
||
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
|
||
doneN = abs(lumaEndN) >= gradientScaled;
|
||
doneP = abs(lumaEndP) >= gradientScaled;
|
||
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P5;
|
||
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P5;
|
||
doneNP = (!doneN) || (!doneP);
|
||
if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P5;
|
||
if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P5;
|
||
/*--------------------------------------------------------------------------*/
|
||
#if (FXAA_QUALITY_PS > 6)
|
||
if(doneNP) {
|
||
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
|
||
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
|
||
if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
|
||
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
|
||
doneN = abs(lumaEndN) >= gradientScaled;
|
||
doneP = abs(lumaEndP) >= gradientScaled;
|
||
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P6;
|
||
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P6;
|
||
doneNP = (!doneN) || (!doneP);
|
||
if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P6;
|
||
if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P6;
|
||
/*--------------------------------------------------------------------------*/
|
||
#if (FXAA_QUALITY_PS > 7)
|
||
if(doneNP) {
|
||
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
|
||
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
|
||
if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
|
||
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
|
||
doneN = abs(lumaEndN) >= gradientScaled;
|
||
doneP = abs(lumaEndP) >= gradientScaled;
|
||
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P7;
|
||
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P7;
|
||
doneNP = (!doneN) || (!doneP);
|
||
if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P7;
|
||
if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P7;
|
||
/*--------------------------------------------------------------------------*/
|
||
#if (FXAA_QUALITY_PS > 8)
|
||
if(doneNP) {
|
||
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
|
||
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
|
||
if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
|
||
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
|
||
doneN = abs(lumaEndN) >= gradientScaled;
|
||
doneP = abs(lumaEndP) >= gradientScaled;
|
||
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P8;
|
||
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P8;
|
||
doneNP = (!doneN) || (!doneP);
|
||
if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P8;
|
||
if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P8;
|
||
/*--------------------------------------------------------------------------*/
|
||
#if (FXAA_QUALITY_PS > 9)
|
||
if(doneNP) {
|
||
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
|
||
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
|
||
if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
|
||
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
|
||
doneN = abs(lumaEndN) >= gradientScaled;
|
||
doneP = abs(lumaEndP) >= gradientScaled;
|
||
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P9;
|
||
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P9;
|
||
doneNP = (!doneN) || (!doneP);
|
||
if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P9;
|
||
if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P9;
|
||
/*--------------------------------------------------------------------------*/
|
||
#if (FXAA_QUALITY_PS > 10)
|
||
if(doneNP) {
|
||
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
|
||
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
|
||
if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
|
||
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
|
||
doneN = abs(lumaEndN) >= gradientScaled;
|
||
doneP = abs(lumaEndP) >= gradientScaled;
|
||
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P10;
|
||
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P10;
|
||
doneNP = (!doneN) || (!doneP);
|
||
if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P10;
|
||
if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P10;
|
||
/*--------------------------------------------------------------------------*/
|
||
#if (FXAA_QUALITY_PS > 11)
|
||
if(doneNP) {
|
||
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
|
||
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
|
||
if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
|
||
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
|
||
doneN = abs(lumaEndN) >= gradientScaled;
|
||
doneP = abs(lumaEndP) >= gradientScaled;
|
||
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P11;
|
||
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P11;
|
||
doneNP = (!doneN) || (!doneP);
|
||
if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P11;
|
||
if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P11;
|
||
/*--------------------------------------------------------------------------*/
|
||
#if (FXAA_QUALITY_PS > 12)
|
||
if(doneNP) {
|
||
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
|
||
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
|
||
if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
|
||
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
|
||
doneN = abs(lumaEndN) >= gradientScaled;
|
||
doneP = abs(lumaEndP) >= gradientScaled;
|
||
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P12;
|
||
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P12;
|
||
doneNP = (!doneN) || (!doneP);
|
||
if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P12;
|
||
if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P12;
|
||
/*--------------------------------------------------------------------------*/
|
||
}
|
||
#endif
|
||
/*--------------------------------------------------------------------------*/
|
||
}
|
||
#endif
|
||
/*--------------------------------------------------------------------------*/
|
||
}
|
||
#endif
|
||
/*--------------------------------------------------------------------------*/
|
||
}
|
||
#endif
|
||
/*--------------------------------------------------------------------------*/
|
||
}
|
||
#endif
|
||
/*--------------------------------------------------------------------------*/
|
||
}
|
||
#endif
|
||
/*--------------------------------------------------------------------------*/
|
||
}
|
||
#endif
|
||
/*--------------------------------------------------------------------------*/
|
||
}
|
||
#endif
|
||
/*--------------------------------------------------------------------------*/
|
||
}
|
||
#endif
|
||
/*--------------------------------------------------------------------------*/
|
||
}
|
||
#endif
|
||
/*--------------------------------------------------------------------------*/
|
||
}
|
||
/*--------------------------------------------------------------------------*/
|
||
FxaaFloat dstN = posM.x - posN.x;
|
||
FxaaFloat dstP = posP.x - posM.x;
|
||
if(!horzSpan) dstN = posM.y - posN.y;
|
||
if(!horzSpan) dstP = posP.y - posM.y;
|
||
/*--------------------------------------------------------------------------*/
|
||
FxaaBool goodSpanN = (lumaEndN < 0.0) != lumaMLTZero;
|
||
FxaaFloat spanLength = (dstP + dstN);
|
||
FxaaBool goodSpanP = (lumaEndP < 0.0) != lumaMLTZero;
|
||
FxaaFloat spanLengthRcp = 1.0/spanLength;
|
||
/*--------------------------------------------------------------------------*/
|
||
FxaaBool directionN = dstN < dstP;
|
||
FxaaFloat dst = min(dstN, dstP);
|
||
FxaaBool goodSpan = directionN ? goodSpanN : goodSpanP;
|
||
FxaaFloat subpixG = subpixF * subpixF;
|
||
FxaaFloat pixelOffset = (dst * (-spanLengthRcp)) + 0.5;
|
||
FxaaFloat subpixH = subpixG * fxaaQualitySubpix;
|
||
/*--------------------------------------------------------------------------*/
|
||
FxaaFloat pixelOffsetGood = goodSpan ? pixelOffset : 0.0;
|
||
FxaaFloat pixelOffsetSubpix = max(pixelOffsetGood, subpixH);
|
||
if(!horzSpan) posM.x += pixelOffsetSubpix * lengthSign;
|
||
if( horzSpan) posM.y += pixelOffsetSubpix * lengthSign;
|
||
return FxaaFloat4(FxaaTexTop(tex, posM).xyz, lumaM);
|
||
}
|
||
`,LOe=`uniform vec4 u_initialColor;
|
||
|
||
#if TEXTURE_UNITS > 0
|
||
uniform sampler2D u_dayTextures[TEXTURE_UNITS];
|
||
uniform vec4 u_dayTextureTranslationAndScale[TEXTURE_UNITS];
|
||
uniform bool u_dayTextureUseWebMercatorT[TEXTURE_UNITS];
|
||
|
||
#ifdef APPLY_ALPHA
|
||
uniform float u_dayTextureAlpha[TEXTURE_UNITS];
|
||
#endif
|
||
|
||
#ifdef APPLY_DAY_NIGHT_ALPHA
|
||
uniform float u_dayTextureNightAlpha[TEXTURE_UNITS];
|
||
uniform float u_dayTextureDayAlpha[TEXTURE_UNITS];
|
||
#endif
|
||
|
||
#ifdef APPLY_SPLIT
|
||
uniform float u_dayTextureSplit[TEXTURE_UNITS];
|
||
#endif
|
||
|
||
#ifdef APPLY_BRIGHTNESS
|
||
uniform float u_dayTextureBrightness[TEXTURE_UNITS];
|
||
#endif
|
||
|
||
#ifdef APPLY_CONTRAST
|
||
uniform float u_dayTextureContrast[TEXTURE_UNITS];
|
||
#endif
|
||
|
||
#ifdef APPLY_HUE
|
||
uniform float u_dayTextureHue[TEXTURE_UNITS];
|
||
#endif
|
||
|
||
#ifdef APPLY_SATURATION
|
||
uniform float u_dayTextureSaturation[TEXTURE_UNITS];
|
||
#endif
|
||
|
||
#ifdef APPLY_GAMMA
|
||
uniform float u_dayTextureOneOverGamma[TEXTURE_UNITS];
|
||
#endif
|
||
|
||
#ifdef APPLY_IMAGERY_CUTOUT
|
||
uniform vec4 u_dayTextureCutoutRectangles[TEXTURE_UNITS];
|
||
#endif
|
||
|
||
#ifdef APPLY_COLOR_TO_ALPHA
|
||
uniform vec4 u_colorsToAlpha[TEXTURE_UNITS];
|
||
#endif
|
||
|
||
uniform vec4 u_dayTextureTexCoordsRectangle[TEXTURE_UNITS];
|
||
#endif
|
||
|
||
#ifdef SHOW_REFLECTIVE_OCEAN
|
||
uniform sampler2D u_waterMask;
|
||
uniform vec4 u_waterMaskTranslationAndScale;
|
||
uniform float u_zoomedOutOceanSpecularIntensity;
|
||
#endif
|
||
|
||
#ifdef SHOW_OCEAN_WAVES
|
||
uniform sampler2D u_oceanNormalMap;
|
||
#endif
|
||
|
||
#if defined(ENABLE_DAYNIGHT_SHADING) || defined(GROUND_ATMOSPHERE)
|
||
uniform vec2 u_lightingFadeDistance;
|
||
#endif
|
||
|
||
#ifdef TILE_LIMIT_RECTANGLE
|
||
uniform vec4 u_cartographicLimitRectangle;
|
||
#endif
|
||
|
||
#ifdef GROUND_ATMOSPHERE
|
||
uniform vec2 u_nightFadeDistance;
|
||
#endif
|
||
|
||
#ifdef ENABLE_CLIPPING_PLANES
|
||
uniform highp sampler2D u_clippingPlanes;
|
||
uniform mat4 u_clippingPlanesMatrix;
|
||
uniform vec4 u_clippingPlanesEdgeStyle;
|
||
#endif
|
||
|
||
#if defined(GROUND_ATMOSPHERE) || defined(FOG) && defined(DYNAMIC_ATMOSPHERE_LIGHTING) && (defined(ENABLE_VERTEX_LIGHTING) || defined(ENABLE_DAYNIGHT_SHADING))
|
||
uniform float u_minimumBrightness;
|
||
#endif
|
||
|
||
#ifdef COLOR_CORRECT
|
||
uniform vec3 u_hsbShift; // Hue, saturation, brightness
|
||
#endif
|
||
|
||
#ifdef HIGHLIGHT_FILL_TILE
|
||
uniform vec4 u_fillHighlightColor;
|
||
#endif
|
||
|
||
#ifdef TRANSLUCENT
|
||
uniform vec4 u_frontFaceAlphaByDistance;
|
||
uniform vec4 u_backFaceAlphaByDistance;
|
||
uniform vec4 u_translucencyRectangle;
|
||
#endif
|
||
|
||
#ifdef UNDERGROUND_COLOR
|
||
uniform vec4 u_undergroundColor;
|
||
uniform vec4 u_undergroundColorAlphaByDistance;
|
||
#endif
|
||
|
||
#ifdef ENABLE_VERTEX_LIGHTING
|
||
uniform float u_lambertDiffuseMultiplier;
|
||
uniform float u_vertexShadowDarkness;
|
||
#endif
|
||
|
||
varying vec3 v_positionMC;
|
||
varying vec3 v_positionEC;
|
||
varying vec3 v_textureCoordinates;
|
||
varying vec3 v_normalMC;
|
||
varying vec3 v_normalEC;
|
||
|
||
#ifdef APPLY_MATERIAL
|
||
varying float v_height;
|
||
varying float v_slope;
|
||
varying float v_aspect;
|
||
#endif
|
||
|
||
#if defined(FOG) || defined(GROUND_ATMOSPHERE) || defined(UNDERGROUND_COLOR) || defined(TRANSLUCENT)
|
||
varying float v_distance;
|
||
#endif
|
||
|
||
#if defined(GROUND_ATMOSPHERE) || defined(FOG)
|
||
varying vec3 v_atmosphereRayleighColor;
|
||
varying vec3 v_atmosphereMieColor;
|
||
varying float v_atmosphereOpacity;
|
||
#endif
|
||
|
||
#if defined(UNDERGROUND_COLOR) || defined(TRANSLUCENT)
|
||
float interpolateByDistance(vec4 nearFarScalar, float distance)
|
||
{
|
||
float startDistance = nearFarScalar.x;
|
||
float startValue = nearFarScalar.y;
|
||
float endDistance = nearFarScalar.z;
|
||
float endValue = nearFarScalar.w;
|
||
float t = clamp((distance - startDistance) / (endDistance - startDistance), 0.0, 1.0);
|
||
return mix(startValue, endValue, t);
|
||
}
|
||
#endif
|
||
|
||
#if defined(UNDERGROUND_COLOR) || defined(TRANSLUCENT) || defined(APPLY_MATERIAL)
|
||
vec4 alphaBlend(vec4 sourceColor, vec4 destinationColor)
|
||
{
|
||
return sourceColor * vec4(sourceColor.aaa, 1.0) + destinationColor * (1.0 - sourceColor.a);
|
||
}
|
||
#endif
|
||
|
||
#ifdef TRANSLUCENT
|
||
bool inTranslucencyRectangle()
|
||
{
|
||
return
|
||
v_textureCoordinates.x > u_translucencyRectangle.x &&
|
||
v_textureCoordinates.x < u_translucencyRectangle.z &&
|
||
v_textureCoordinates.y > u_translucencyRectangle.y &&
|
||
v_textureCoordinates.y < u_translucencyRectangle.w;
|
||
}
|
||
#endif
|
||
|
||
vec4 sampleAndBlend(
|
||
vec4 previousColor,
|
||
sampler2D textureToSample,
|
||
vec2 tileTextureCoordinates,
|
||
vec4 textureCoordinateRectangle,
|
||
vec4 textureCoordinateTranslationAndScale,
|
||
float textureAlpha,
|
||
float textureNightAlpha,
|
||
float textureDayAlpha,
|
||
float textureBrightness,
|
||
float textureContrast,
|
||
float textureHue,
|
||
float textureSaturation,
|
||
float textureOneOverGamma,
|
||
float split,
|
||
vec4 colorToAlpha,
|
||
float nightBlend)
|
||
{
|
||
// This crazy step stuff sets the alpha to 0.0 if this following condition is true:
|
||
// tileTextureCoordinates.s < textureCoordinateRectangle.s ||
|
||
// tileTextureCoordinates.s > textureCoordinateRectangle.p ||
|
||
// tileTextureCoordinates.t < textureCoordinateRectangle.t ||
|
||
// tileTextureCoordinates.t > textureCoordinateRectangle.q
|
||
// In other words, the alpha is zero if the fragment is outside the rectangle
|
||
// covered by this texture. Would an actual 'if' yield better performance?
|
||
vec2 alphaMultiplier = step(textureCoordinateRectangle.st, tileTextureCoordinates);
|
||
textureAlpha = textureAlpha * alphaMultiplier.x * alphaMultiplier.y;
|
||
|
||
alphaMultiplier = step(vec2(0.0), textureCoordinateRectangle.pq - tileTextureCoordinates);
|
||
textureAlpha = textureAlpha * alphaMultiplier.x * alphaMultiplier.y;
|
||
|
||
#if defined(APPLY_DAY_NIGHT_ALPHA) && defined(ENABLE_DAYNIGHT_SHADING)
|
||
textureAlpha *= mix(textureDayAlpha, textureNightAlpha, nightBlend);
|
||
#endif
|
||
|
||
vec2 translation = textureCoordinateTranslationAndScale.xy;
|
||
vec2 scale = textureCoordinateTranslationAndScale.zw;
|
||
vec2 textureCoordinates = tileTextureCoordinates * scale + translation;
|
||
vec4 value = texture2D(textureToSample, textureCoordinates);
|
||
vec3 color = value.rgb;
|
||
float alpha = value.a;
|
||
|
||
#ifdef APPLY_COLOR_TO_ALPHA
|
||
vec3 colorDiff = abs(color.rgb - colorToAlpha.rgb);
|
||
colorDiff.r = max(max(colorDiff.r, colorDiff.g), colorDiff.b);
|
||
alpha = czm_branchFreeTernary(colorDiff.r < colorToAlpha.a, 0.0, alpha);
|
||
#endif
|
||
|
||
#if !defined(APPLY_GAMMA)
|
||
vec4 tempColor = czm_gammaCorrect(vec4(color, alpha));
|
||
color = tempColor.rgb;
|
||
alpha = tempColor.a;
|
||
#else
|
||
color = pow(color, vec3(textureOneOverGamma));
|
||
#endif
|
||
|
||
#ifdef APPLY_SPLIT
|
||
float splitPosition = czm_splitPosition;
|
||
// Split to the left
|
||
if (split < 0.0 && gl_FragCoord.x > splitPosition) {
|
||
alpha = 0.0;
|
||
}
|
||
// Split to the right
|
||
else if (split > 0.0 && gl_FragCoord.x < splitPosition) {
|
||
alpha = 0.0;
|
||
}
|
||
#endif
|
||
|
||
#ifdef APPLY_BRIGHTNESS
|
||
color = mix(vec3(0.0), color, textureBrightness);
|
||
#endif
|
||
|
||
#ifdef APPLY_CONTRAST
|
||
color = mix(vec3(0.5), color, textureContrast);
|
||
#endif
|
||
|
||
#ifdef APPLY_HUE
|
||
color = czm_hue(color, textureHue);
|
||
#endif
|
||
|
||
#ifdef APPLY_SATURATION
|
||
color = czm_saturation(color, textureSaturation);
|
||
#endif
|
||
|
||
float sourceAlpha = alpha * textureAlpha;
|
||
float outAlpha = mix(previousColor.a, 1.0, sourceAlpha);
|
||
outAlpha += sign(outAlpha) - 1.0;
|
||
|
||
vec3 outColor = mix(previousColor.rgb * previousColor.a, color, sourceAlpha) / outAlpha;
|
||
|
||
// When rendering imagery for a tile in multiple passes,
|
||
// some GPU/WebGL implementation combinations will not blend fragments in
|
||
// additional passes correctly if their computation includes an unmasked
|
||
// divide-by-zero operation,
|
||
// even if it's not in the output or if the output has alpha zero.
|
||
//
|
||
// For example, without sanitization for outAlpha,
|
||
// this renders without artifacts:
|
||
// if (outAlpha == 0.0) { outColor = vec3(0.0); }
|
||
//
|
||
// but using czm_branchFreeTernary will cause portions of the tile that are
|
||
// alpha-zero in the additional pass to render as black instead of blending
|
||
// with the previous pass:
|
||
// outColor = czm_branchFreeTernary(outAlpha == 0.0, vec3(0.0), outColor);
|
||
//
|
||
// So instead, sanitize against divide-by-zero,
|
||
// store this state on the sign of outAlpha, and correct on return.
|
||
|
||
return vec4(outColor, max(outAlpha, 0.0));
|
||
}
|
||
|
||
vec3 colorCorrect(vec3 rgb) {
|
||
#ifdef COLOR_CORRECT
|
||
// Convert rgb color to hsb
|
||
vec3 hsb = czm_RGBToHSB(rgb);
|
||
// Perform hsb shift
|
||
hsb.x += u_hsbShift.x; // hue
|
||
hsb.y = clamp(hsb.y + u_hsbShift.y, 0.0, 1.0); // saturation
|
||
hsb.z = hsb.z > czm_epsilon7 ? hsb.z + u_hsbShift.z : 0.0; // brightness
|
||
// Convert shifted hsb back to rgb
|
||
rgb = czm_HSBToRGB(hsb);
|
||
#endif
|
||
return rgb;
|
||
}
|
||
|
||
vec4 computeDayColor(vec4 initialColor, vec3 textureCoordinates, float nightBlend);
|
||
vec4 computeWaterColor(vec3 positionEyeCoordinates, vec2 textureCoordinates, mat3 enuToEye, vec4 imageryColor, float specularMapValue, float fade);
|
||
|
||
const float fExposure = 2.0;
|
||
|
||
vec3 computeEllipsoidPosition()
|
||
{
|
||
float mpp = czm_metersPerPixel(vec4(0.0, 0.0, -czm_currentFrustum.x, 1.0), 1.0);
|
||
vec2 xy = gl_FragCoord.xy / czm_viewport.zw * 2.0 - vec2(1.0);
|
||
xy *= czm_viewport.zw * mpp * 0.5;
|
||
|
||
vec3 direction = normalize(vec3(xy, -czm_currentFrustum.x));
|
||
czm_ray ray = czm_ray(vec3(0.0), direction);
|
||
|
||
vec3 ellipsoid_center = czm_view[3].xyz;
|
||
|
||
czm_raySegment intersection = czm_rayEllipsoidIntersectionInterval(ray, ellipsoid_center, czm_ellipsoidInverseRadii);
|
||
|
||
vec3 ellipsoidPosition = czm_pointAlongRay(ray, intersection.start);
|
||
return (czm_inverseView * vec4(ellipsoidPosition, 1.0)).xyz;
|
||
}
|
||
|
||
void main()
|
||
{
|
||
#ifdef TILE_LIMIT_RECTANGLE
|
||
if (v_textureCoordinates.x < u_cartographicLimitRectangle.x || u_cartographicLimitRectangle.z < v_textureCoordinates.x ||
|
||
v_textureCoordinates.y < u_cartographicLimitRectangle.y || u_cartographicLimitRectangle.w < v_textureCoordinates.y)
|
||
{
|
||
discard;
|
||
}
|
||
#endif
|
||
|
||
#ifdef ENABLE_CLIPPING_PLANES
|
||
float clipDistance = clip(gl_FragCoord, u_clippingPlanes, u_clippingPlanesMatrix);
|
||
#endif
|
||
|
||
#if defined(SHOW_REFLECTIVE_OCEAN) || defined(ENABLE_DAYNIGHT_SHADING) || defined(HDR)
|
||
vec3 normalMC = czm_geodeticSurfaceNormal(v_positionMC, vec3(0.0), vec3(1.0)); // normalized surface normal in model coordinates
|
||
vec3 normalEC = czm_normal3D * normalMC; // normalized surface normal in eye coordiantes
|
||
#endif
|
||
|
||
#if defined(APPLY_DAY_NIGHT_ALPHA) && defined(ENABLE_DAYNIGHT_SHADING)
|
||
float nightBlend = 1.0 - clamp(czm_getLambertDiffuse(czm_lightDirectionEC, normalEC) * 5.0, 0.0, 1.0);
|
||
#else
|
||
float nightBlend = 0.0;
|
||
#endif
|
||
|
||
// The clamp below works around an apparent bug in Chrome Canary v23.0.1241.0
|
||
// where the fragment shader sees textures coordinates < 0.0 and > 1.0 for the
|
||
// fragments on the edges of tiles even though the vertex shader is outputting
|
||
// coordinates strictly in the 0-1 range.
|
||
vec4 color = computeDayColor(u_initialColor, clamp(v_textureCoordinates, 0.0, 1.0), nightBlend);
|
||
|
||
#ifdef SHOW_TILE_BOUNDARIES
|
||
if (v_textureCoordinates.x < (1.0/256.0) || v_textureCoordinates.x > (255.0/256.0) ||
|
||
v_textureCoordinates.y < (1.0/256.0) || v_textureCoordinates.y > (255.0/256.0))
|
||
{
|
||
color = vec4(1.0, 0.0, 0.0, 1.0);
|
||
}
|
||
#endif
|
||
|
||
#if defined(ENABLE_DAYNIGHT_SHADING) || defined(GROUND_ATMOSPHERE)
|
||
float cameraDist;
|
||
if (czm_sceneMode == czm_sceneMode2D)
|
||
{
|
||
cameraDist = max(czm_frustumPlanes.x - czm_frustumPlanes.y, czm_frustumPlanes.w - czm_frustumPlanes.z) * 0.5;
|
||
}
|
||
else if (czm_sceneMode == czm_sceneModeColumbusView)
|
||
{
|
||
cameraDist = -czm_view[3].z;
|
||
}
|
||
else
|
||
{
|
||
cameraDist = length(czm_view[3]);
|
||
}
|
||
float fadeOutDist = u_lightingFadeDistance.x;
|
||
float fadeInDist = u_lightingFadeDistance.y;
|
||
if (czm_sceneMode != czm_sceneMode3D) {
|
||
vec3 radii = czm_ellipsoidRadii;
|
||
float maxRadii = max(radii.x, max(radii.y, radii.z));
|
||
fadeOutDist -= maxRadii;
|
||
fadeInDist -= maxRadii;
|
||
}
|
||
float fade = clamp((cameraDist - fadeOutDist) / (fadeInDist - fadeOutDist), 0.0, 1.0);
|
||
#else
|
||
float fade = 0.0;
|
||
#endif
|
||
|
||
#ifdef SHOW_REFLECTIVE_OCEAN
|
||
vec2 waterMaskTranslation = u_waterMaskTranslationAndScale.xy;
|
||
vec2 waterMaskScale = u_waterMaskTranslationAndScale.zw;
|
||
vec2 waterMaskTextureCoordinates = v_textureCoordinates.xy * waterMaskScale + waterMaskTranslation;
|
||
waterMaskTextureCoordinates.y = 1.0 - waterMaskTextureCoordinates.y;
|
||
|
||
float mask = texture2D(u_waterMask, waterMaskTextureCoordinates).r;
|
||
|
||
if (mask > 0.0)
|
||
{
|
||
mat3 enuToEye = czm_eastNorthUpToEyeCoordinates(v_positionMC, normalEC);
|
||
|
||
vec2 ellipsoidTextureCoordinates = czm_ellipsoidWgs84TextureCoordinates(normalMC);
|
||
vec2 ellipsoidFlippedTextureCoordinates = czm_ellipsoidWgs84TextureCoordinates(normalMC.zyx);
|
||
|
||
vec2 textureCoordinates = mix(ellipsoidTextureCoordinates, ellipsoidFlippedTextureCoordinates, czm_morphTime * smoothstep(0.9, 0.95, normalMC.z));
|
||
|
||
color = computeWaterColor(v_positionEC, textureCoordinates, enuToEye, color, mask, fade);
|
||
}
|
||
#endif
|
||
|
||
#ifdef APPLY_MATERIAL
|
||
czm_materialInput materialInput;
|
||
materialInput.st = v_textureCoordinates.st;
|
||
materialInput.normalEC = normalize(v_normalEC);
|
||
materialInput.positionToEyeEC = -v_positionEC;
|
||
materialInput.tangentToEyeMatrix = czm_eastNorthUpToEyeCoordinates(v_positionMC, normalize(v_normalEC));
|
||
materialInput.slope = v_slope;
|
||
materialInput.height = v_height;
|
||
materialInput.aspect = v_aspect;
|
||
czm_material material = czm_getMaterial(materialInput);
|
||
vec4 materialColor = vec4(material.diffuse, material.alpha);
|
||
color = alphaBlend(materialColor, color);
|
||
#endif
|
||
|
||
#ifdef ENABLE_VERTEX_LIGHTING
|
||
float diffuseIntensity = clamp(czm_getLambertDiffuse(czm_lightDirectionEC, normalize(v_normalEC)) * u_lambertDiffuseMultiplier + u_vertexShadowDarkness, 0.0, 1.0);
|
||
vec4 finalColor = vec4(color.rgb * czm_lightColor * diffuseIntensity, color.a);
|
||
#elif defined(ENABLE_DAYNIGHT_SHADING)
|
||
float diffuseIntensity = clamp(czm_getLambertDiffuse(czm_lightDirectionEC, normalEC) * 5.0 + 0.3, 0.0, 1.0);
|
||
diffuseIntensity = mix(1.0, diffuseIntensity, fade);
|
||
vec4 finalColor = vec4(color.rgb * czm_lightColor * diffuseIntensity, color.a);
|
||
#else
|
||
vec4 finalColor = color;
|
||
#endif
|
||
|
||
#ifdef ENABLE_CLIPPING_PLANES
|
||
vec4 clippingPlanesEdgeColor = vec4(1.0);
|
||
clippingPlanesEdgeColor.rgb = u_clippingPlanesEdgeStyle.rgb;
|
||
float clippingPlanesEdgeWidth = u_clippingPlanesEdgeStyle.a;
|
||
|
||
if (clipDistance < clippingPlanesEdgeWidth)
|
||
{
|
||
finalColor = clippingPlanesEdgeColor;
|
||
}
|
||
#endif
|
||
|
||
#ifdef HIGHLIGHT_FILL_TILE
|
||
finalColor = vec4(mix(finalColor.rgb, u_fillHighlightColor.rgb, u_fillHighlightColor.a), finalColor.a);
|
||
#endif
|
||
|
||
#if defined(DYNAMIC_ATMOSPHERE_LIGHTING_FROM_SUN)
|
||
vec3 atmosphereLightDirection = czm_sunDirectionWC;
|
||
#else
|
||
vec3 atmosphereLightDirection = czm_lightDirectionWC;
|
||
#endif
|
||
|
||
#if defined(GROUND_ATMOSPHERE) || defined(FOG)
|
||
if (!czm_backFacing())
|
||
{
|
||
bool dynamicLighting = false;
|
||
#if defined(DYNAMIC_ATMOSPHERE_LIGHTING) && (defined(ENABLE_DAYNIGHT_SHADING) || defined(ENABLE_VERTEX_LIGHTING))
|
||
dynamicLighting = true;
|
||
#endif
|
||
|
||
vec3 rayleighColor;
|
||
vec3 mieColor;
|
||
float opacity;
|
||
|
||
vec3 positionWC;
|
||
vec3 lightDirection;
|
||
|
||
// When the camera is far away (camera distance > nightFadeOutDistance), the scattering is computed in the fragment shader.
|
||
// Otherwise, the scattering is computed in the vertex shader.
|
||
#ifdef PER_FRAGMENT_GROUND_ATMOSPHERE
|
||
positionWC = computeEllipsoidPosition();
|
||
lightDirection = czm_branchFreeTernary(dynamicLighting, atmosphereLightDirection, normalize(positionWC));
|
||
computeAtmosphereScattering(
|
||
positionWC,
|
||
lightDirection,
|
||
rayleighColor,
|
||
mieColor,
|
||
opacity
|
||
);
|
||
#else
|
||
positionWC = v_positionMC;
|
||
lightDirection = czm_branchFreeTernary(dynamicLighting, atmosphereLightDirection, normalize(positionWC));
|
||
rayleighColor = v_atmosphereRayleighColor;
|
||
mieColor = v_atmosphereMieColor;
|
||
opacity = v_atmosphereOpacity;
|
||
#endif
|
||
|
||
rayleighColor = colorCorrect(rayleighColor);
|
||
mieColor = colorCorrect(mieColor);
|
||
|
||
vec4 groundAtmosphereColor = computeAtmosphereColor(positionWC, lightDirection, rayleighColor, mieColor, opacity);
|
||
|
||
// Fog is applied to tiles selected for fog, close to the Earth.
|
||
#ifdef FOG
|
||
vec3 fogColor = groundAtmosphereColor.rgb;
|
||
|
||
// If there is lighting, apply that to the fog.
|
||
#if defined(DYNAMIC_ATMOSPHERE_LIGHTING) && (defined(ENABLE_VERTEX_LIGHTING) || defined(ENABLE_DAYNIGHT_SHADING))
|
||
float darken = clamp(dot(normalize(czm_viewerPositionWC), atmosphereLightDirection), u_minimumBrightness, 1.0);
|
||
fogColor *= darken;
|
||
#endif
|
||
|
||
#ifndef HDR
|
||
fogColor.rgb = czm_acesTonemapping(fogColor.rgb);
|
||
fogColor.rgb = czm_inverseGamma(fogColor.rgb);
|
||
#endif
|
||
|
||
const float modifier = 0.15;
|
||
finalColor = vec4(czm_fog(v_distance, finalColor.rgb, fogColor.rgb, modifier), finalColor.a);
|
||
|
||
#else
|
||
// The transmittance is based on optical depth i.e. the length of segment of the ray inside the atmosphere.
|
||
// This value is larger near the "circumference", as it is further away from the camera. We use it to
|
||
// brighten up that area of the ground atmosphere.
|
||
const float transmittanceModifier = 0.5;
|
||
float transmittance = transmittanceModifier + clamp(1.0 - groundAtmosphereColor.a, 0.0, 1.0);
|
||
|
||
vec3 finalAtmosphereColor = finalColor.rgb + groundAtmosphereColor.rgb * transmittance;
|
||
|
||
#if defined(DYNAMIC_ATMOSPHERE_LIGHTING) && (defined(ENABLE_VERTEX_LIGHTING) || defined(ENABLE_DAYNIGHT_SHADING))
|
||
float fadeInDist = u_nightFadeDistance.x;
|
||
float fadeOutDist = u_nightFadeDistance.y;
|
||
|
||
float sunlitAtmosphereIntensity = clamp((cameraDist - fadeOutDist) / (fadeInDist - fadeOutDist), 0.05, 1.0);
|
||
float darken = clamp(dot(normalize(positionWC), atmosphereLightDirection), 0.0, 1.0);
|
||
vec3 darkenendGroundAtmosphereColor = mix(groundAtmosphereColor.rgb, finalAtmosphereColor.rgb, darken);
|
||
|
||
finalAtmosphereColor = mix(darkenendGroundAtmosphereColor, finalAtmosphereColor, sunlitAtmosphereIntensity);
|
||
#endif
|
||
|
||
#ifndef HDR
|
||
finalAtmosphereColor.rgb = vec3(1.0) - exp(-fExposure * finalAtmosphereColor.rgb);
|
||
#else
|
||
finalAtmosphereColor.rgb = czm_saturation(finalAtmosphereColor.rgb, 1.6);
|
||
#endif
|
||
|
||
finalColor.rgb = mix(finalColor.rgb, finalAtmosphereColor.rgb, fade);
|
||
#endif
|
||
}
|
||
#endif
|
||
|
||
#ifdef UNDERGROUND_COLOR
|
||
if (czm_backFacing())
|
||
{
|
||
float distanceFromEllipsoid = max(czm_eyeHeight, 0.0);
|
||
float distance = max(v_distance - distanceFromEllipsoid, 0.0);
|
||
float blendAmount = interpolateByDistance(u_undergroundColorAlphaByDistance, distance);
|
||
vec4 undergroundColor = vec4(u_undergroundColor.rgb, u_undergroundColor.a * blendAmount);
|
||
finalColor = alphaBlend(undergroundColor, finalColor);
|
||
}
|
||
#endif
|
||
|
||
#ifdef TRANSLUCENT
|
||
if (inTranslucencyRectangle())
|
||
{
|
||
vec4 alphaByDistance = gl_FrontFacing ? u_frontFaceAlphaByDistance : u_backFaceAlphaByDistance;
|
||
finalColor.a *= interpolateByDistance(alphaByDistance, v_distance);
|
||
}
|
||
#endif
|
||
|
||
gl_FragColor = finalColor;
|
||
}
|
||
|
||
|
||
#ifdef SHOW_REFLECTIVE_OCEAN
|
||
|
||
float waveFade(float edge0, float edge1, float x)
|
||
{
|
||
float y = clamp((x - edge0) / (edge1 - edge0), 0.0, 1.0);
|
||
return pow(1.0 - y, 5.0);
|
||
}
|
||
|
||
float linearFade(float edge0, float edge1, float x)
|
||
{
|
||
return clamp((x - edge0) / (edge1 - edge0), 0.0, 1.0);
|
||
}
|
||
|
||
// Based on water rendering by Jonas Wagner:
|
||
// http://29a.ch/2012/7/19/webgl-terrain-rendering-water-fog
|
||
|
||
// low altitude wave settings
|
||
const float oceanFrequencyLowAltitude = 825000.0;
|
||
const float oceanAnimationSpeedLowAltitude = 0.004;
|
||
const float oceanOneOverAmplitudeLowAltitude = 1.0 / 2.0;
|
||
const float oceanSpecularIntensity = 0.5;
|
||
|
||
// high altitude wave settings
|
||
const float oceanFrequencyHighAltitude = 125000.0;
|
||
const float oceanAnimationSpeedHighAltitude = 0.008;
|
||
const float oceanOneOverAmplitudeHighAltitude = 1.0 / 2.0;
|
||
|
||
vec4 computeWaterColor(vec3 positionEyeCoordinates, vec2 textureCoordinates, mat3 enuToEye, vec4 imageryColor, float maskValue, float fade)
|
||
{
|
||
vec3 positionToEyeEC = -positionEyeCoordinates;
|
||
float positionToEyeECLength = length(positionToEyeEC);
|
||
|
||
// The double normalize below works around a bug in Firefox on Android devices.
|
||
vec3 normalizedPositionToEyeEC = normalize(normalize(positionToEyeEC));
|
||
|
||
// Fade out the waves as the camera moves far from the surface.
|
||
float waveIntensity = waveFade(70000.0, 1000000.0, positionToEyeECLength);
|
||
|
||
#ifdef SHOW_OCEAN_WAVES
|
||
// high altitude waves
|
||
float time = czm_frameNumber * oceanAnimationSpeedHighAltitude;
|
||
vec4 noise = czm_getWaterNoise(u_oceanNormalMap, textureCoordinates * oceanFrequencyHighAltitude, time, 0.0);
|
||
vec3 normalTangentSpaceHighAltitude = vec3(noise.xy, noise.z * oceanOneOverAmplitudeHighAltitude);
|
||
|
||
// low altitude waves
|
||
time = czm_frameNumber * oceanAnimationSpeedLowAltitude;
|
||
noise = czm_getWaterNoise(u_oceanNormalMap, textureCoordinates * oceanFrequencyLowAltitude, time, 0.0);
|
||
vec3 normalTangentSpaceLowAltitude = vec3(noise.xy, noise.z * oceanOneOverAmplitudeLowAltitude);
|
||
|
||
// blend the 2 wave layers based on distance to surface
|
||
float highAltitudeFade = linearFade(0.0, 60000.0, positionToEyeECLength);
|
||
float lowAltitudeFade = 1.0 - linearFade(20000.0, 60000.0, positionToEyeECLength);
|
||
vec3 normalTangentSpace =
|
||
(highAltitudeFade * normalTangentSpaceHighAltitude) +
|
||
(lowAltitudeFade * normalTangentSpaceLowAltitude);
|
||
normalTangentSpace = normalize(normalTangentSpace);
|
||
|
||
// fade out the normal perturbation as we move farther from the water surface
|
||
normalTangentSpace.xy *= waveIntensity;
|
||
normalTangentSpace = normalize(normalTangentSpace);
|
||
#else
|
||
vec3 normalTangentSpace = vec3(0.0, 0.0, 1.0);
|
||
#endif
|
||
|
||
vec3 normalEC = enuToEye * normalTangentSpace;
|
||
|
||
const vec3 waveHighlightColor = vec3(0.3, 0.45, 0.6);
|
||
|
||
// Use diffuse light to highlight the waves
|
||
float diffuseIntensity = czm_getLambertDiffuse(czm_lightDirectionEC, normalEC) * maskValue;
|
||
vec3 diffuseHighlight = waveHighlightColor * diffuseIntensity * (1.0 - fade);
|
||
|
||
#ifdef SHOW_OCEAN_WAVES
|
||
// Where diffuse light is low or non-existent, use wave highlights based solely on
|
||
// the wave bumpiness and no particular light direction.
|
||
float tsPerturbationRatio = normalTangentSpace.z;
|
||
vec3 nonDiffuseHighlight = mix(waveHighlightColor * 5.0 * (1.0 - tsPerturbationRatio), vec3(0.0), diffuseIntensity);
|
||
#else
|
||
vec3 nonDiffuseHighlight = vec3(0.0);
|
||
#endif
|
||
|
||
// Add specular highlights in 3D, and in all modes when zoomed in.
|
||
float specularIntensity = czm_getSpecular(czm_lightDirectionEC, normalizedPositionToEyeEC, normalEC, 10.0);
|
||
float surfaceReflectance = mix(0.0, mix(u_zoomedOutOceanSpecularIntensity, oceanSpecularIntensity, waveIntensity), maskValue);
|
||
float specular = specularIntensity * surfaceReflectance;
|
||
|
||
#ifdef HDR
|
||
specular *= 1.4;
|
||
|
||
float e = 0.2;
|
||
float d = 3.3;
|
||
float c = 1.7;
|
||
|
||
vec3 color = imageryColor.rgb + (c * (vec3(e) + imageryColor.rgb * d) * (diffuseHighlight + nonDiffuseHighlight + specular));
|
||
#else
|
||
vec3 color = imageryColor.rgb + diffuseHighlight + nonDiffuseHighlight + specular;
|
||
#endif
|
||
|
||
return vec4(color, imageryColor.a);
|
||
}
|
||
|
||
#endif // #ifdef SHOW_REFLECTIVE_OCEAN
|
||
`,BOe=`#ifdef QUANTIZATION_BITS12
|
||
attribute vec4 compressed0;
|
||
attribute float compressed1;
|
||
#else
|
||
attribute vec4 position3DAndHeight;
|
||
attribute vec4 textureCoordAndEncodedNormals;
|
||
#endif
|
||
|
||
#ifdef GEODETIC_SURFACE_NORMALS
|
||
attribute vec3 geodeticSurfaceNormal;
|
||
#endif
|
||
|
||
#ifdef EXAGGERATION
|
||
uniform vec2 u_terrainExaggerationAndRelativeHeight;
|
||
#endif
|
||
|
||
uniform vec3 u_center3D;
|
||
uniform mat4 u_modifiedModelView;
|
||
uniform mat4 u_modifiedModelViewProjection;
|
||
uniform vec4 u_tileRectangle;
|
||
|
||
// Uniforms for 2D Mercator projection
|
||
uniform vec2 u_southAndNorthLatitude;
|
||
uniform vec2 u_southMercatorYAndOneOverHeight;
|
||
|
||
varying vec3 v_positionMC;
|
||
varying vec3 v_positionEC;
|
||
|
||
varying vec3 v_textureCoordinates;
|
||
varying vec3 v_normalMC;
|
||
varying vec3 v_normalEC;
|
||
|
||
#ifdef APPLY_MATERIAL
|
||
varying float v_slope;
|
||
varying float v_aspect;
|
||
varying float v_height;
|
||
#endif
|
||
|
||
#if defined(FOG) || defined(GROUND_ATMOSPHERE) || defined(UNDERGROUND_COLOR) || defined(TRANSLUCENT)
|
||
varying float v_distance;
|
||
#endif
|
||
|
||
#if defined(FOG) || defined(GROUND_ATMOSPHERE)
|
||
varying vec3 v_atmosphereRayleighColor;
|
||
varying vec3 v_atmosphereMieColor;
|
||
varying float v_atmosphereOpacity;
|
||
#endif
|
||
|
||
// These functions are generated at runtime.
|
||
vec4 getPosition(vec3 position, float height, vec2 textureCoordinates);
|
||
float get2DYPositionFraction(vec2 textureCoordinates);
|
||
|
||
vec4 getPosition3DMode(vec3 position, float height, vec2 textureCoordinates)
|
||
{
|
||
return u_modifiedModelViewProjection * vec4(position, 1.0);
|
||
}
|
||
|
||
float get2DMercatorYPositionFraction(vec2 textureCoordinates)
|
||
{
|
||
// The width of a tile at level 11, in radians and assuming a single root tile, is
|
||
// 2.0 * czm_pi / pow(2.0, 11.0)
|
||
// We want to just linearly interpolate the 2D position from the texture coordinates
|
||
// when we're at this level or higher. The constant below is the expression
|
||
// above evaluated and then rounded up at the 4th significant digit.
|
||
const float maxTileWidth = 0.003068;
|
||
float positionFraction = textureCoordinates.y;
|
||
float southLatitude = u_southAndNorthLatitude.x;
|
||
float northLatitude = u_southAndNorthLatitude.y;
|
||
if (northLatitude - southLatitude > maxTileWidth)
|
||
{
|
||
float southMercatorY = u_southMercatorYAndOneOverHeight.x;
|
||
float oneOverMercatorHeight = u_southMercatorYAndOneOverHeight.y;
|
||
|
||
float currentLatitude = mix(southLatitude, northLatitude, textureCoordinates.y);
|
||
currentLatitude = clamp(currentLatitude, -czm_webMercatorMaxLatitude, czm_webMercatorMaxLatitude);
|
||
positionFraction = czm_latitudeToWebMercatorFraction(currentLatitude, southMercatorY, oneOverMercatorHeight);
|
||
}
|
||
return positionFraction;
|
||
}
|
||
|
||
float get2DGeographicYPositionFraction(vec2 textureCoordinates)
|
||
{
|
||
return textureCoordinates.y;
|
||
}
|
||
|
||
vec4 getPositionPlanarEarth(vec3 position, float height, vec2 textureCoordinates)
|
||
{
|
||
float yPositionFraction = get2DYPositionFraction(textureCoordinates);
|
||
vec4 rtcPosition2D = vec4(height, mix(u_tileRectangle.st, u_tileRectangle.pq, vec2(textureCoordinates.x, yPositionFraction)), 1.0);
|
||
return u_modifiedModelViewProjection * rtcPosition2D;
|
||
}
|
||
|
||
vec4 getPosition2DMode(vec3 position, float height, vec2 textureCoordinates)
|
||
{
|
||
return getPositionPlanarEarth(position, 0.0, textureCoordinates);
|
||
}
|
||
|
||
vec4 getPositionColumbusViewMode(vec3 position, float height, vec2 textureCoordinates)
|
||
{
|
||
return getPositionPlanarEarth(position, height, textureCoordinates);
|
||
}
|
||
|
||
vec4 getPositionMorphingMode(vec3 position, float height, vec2 textureCoordinates)
|
||
{
|
||
// We do not do RTC while morphing, so there is potential for jitter.
|
||
// This is unlikely to be noticeable, though.
|
||
vec3 position3DWC = position + u_center3D;
|
||
float yPositionFraction = get2DYPositionFraction(textureCoordinates);
|
||
vec4 position2DWC = vec4(height, mix(u_tileRectangle.st, u_tileRectangle.pq, vec2(textureCoordinates.x, yPositionFraction)), 1.0);
|
||
vec4 morphPosition = czm_columbusViewMorph(position2DWC, vec4(position3DWC, 1.0), czm_morphTime);
|
||
return czm_modelViewProjection * morphPosition;
|
||
}
|
||
|
||
#ifdef QUANTIZATION_BITS12
|
||
uniform vec2 u_minMaxHeight;
|
||
uniform mat4 u_scaleAndBias;
|
||
#endif
|
||
|
||
void main()
|
||
{
|
||
#ifdef QUANTIZATION_BITS12
|
||
vec2 xy = czm_decompressTextureCoordinates(compressed0.x);
|
||
vec2 zh = czm_decompressTextureCoordinates(compressed0.y);
|
||
vec3 position = vec3(xy, zh.x);
|
||
float height = zh.y;
|
||
vec2 textureCoordinates = czm_decompressTextureCoordinates(compressed0.z);
|
||
|
||
height = height * (u_minMaxHeight.y - u_minMaxHeight.x) + u_minMaxHeight.x;
|
||
position = (u_scaleAndBias * vec4(position, 1.0)).xyz;
|
||
|
||
#if (defined(ENABLE_VERTEX_LIGHTING) || defined(GENERATE_POSITION_AND_NORMAL)) && defined(INCLUDE_WEB_MERCATOR_Y)
|
||
float webMercatorT = czm_decompressTextureCoordinates(compressed0.w).x;
|
||
float encodedNormal = compressed1;
|
||
#elif defined(INCLUDE_WEB_MERCATOR_Y)
|
||
float webMercatorT = czm_decompressTextureCoordinates(compressed0.w).x;
|
||
float encodedNormal = 0.0;
|
||
#elif defined(ENABLE_VERTEX_LIGHTING) || defined(GENERATE_POSITION_AND_NORMAL)
|
||
float webMercatorT = textureCoordinates.y;
|
||
float encodedNormal = compressed0.w;
|
||
#else
|
||
float webMercatorT = textureCoordinates.y;
|
||
float encodedNormal = 0.0;
|
||
#endif
|
||
|
||
#else
|
||
// A single float per element
|
||
vec3 position = position3DAndHeight.xyz;
|
||
float height = position3DAndHeight.w;
|
||
vec2 textureCoordinates = textureCoordAndEncodedNormals.xy;
|
||
|
||
#if (defined(ENABLE_VERTEX_LIGHTING) || defined(GENERATE_POSITION_AND_NORMAL) || defined(APPLY_MATERIAL)) && defined(INCLUDE_WEB_MERCATOR_Y)
|
||
float webMercatorT = textureCoordAndEncodedNormals.z;
|
||
float encodedNormal = textureCoordAndEncodedNormals.w;
|
||
#elif defined(ENABLE_VERTEX_LIGHTING) || defined(GENERATE_POSITION_AND_NORMAL) || defined(APPLY_MATERIAL)
|
||
float webMercatorT = textureCoordinates.y;
|
||
float encodedNormal = textureCoordAndEncodedNormals.z;
|
||
#elif defined(INCLUDE_WEB_MERCATOR_Y)
|
||
float webMercatorT = textureCoordAndEncodedNormals.z;
|
||
float encodedNormal = 0.0;
|
||
#else
|
||
float webMercatorT = textureCoordinates.y;
|
||
float encodedNormal = 0.0;
|
||
#endif
|
||
|
||
#endif
|
||
|
||
vec3 position3DWC = position + u_center3D;
|
||
|
||
#ifdef GEODETIC_SURFACE_NORMALS
|
||
vec3 ellipsoidNormal = geodeticSurfaceNormal;
|
||
#else
|
||
vec3 ellipsoidNormal = normalize(position3DWC);
|
||
#endif
|
||
|
||
#if defined(EXAGGERATION) && defined(GEODETIC_SURFACE_NORMALS)
|
||
float exaggeration = u_terrainExaggerationAndRelativeHeight.x;
|
||
float relativeHeight = u_terrainExaggerationAndRelativeHeight.y;
|
||
float newHeight = (height - relativeHeight) * exaggeration + relativeHeight;
|
||
|
||
// stop from going through center of earth
|
||
float minRadius = min(min(czm_ellipsoidRadii.x, czm_ellipsoidRadii.y), czm_ellipsoidRadii.z);
|
||
newHeight = max(newHeight, -minRadius);
|
||
|
||
vec3 offset = ellipsoidNormal * (newHeight - height);
|
||
position += offset;
|
||
position3DWC += offset;
|
||
height = newHeight;
|
||
#endif
|
||
|
||
gl_Position = getPosition(position, height, textureCoordinates);
|
||
|
||
v_positionEC = (u_modifiedModelView * vec4(position, 1.0)).xyz;
|
||
v_positionMC = position3DWC; // position in model coordinates
|
||
|
||
v_textureCoordinates = vec3(textureCoordinates, webMercatorT);
|
||
|
||
#if defined(ENABLE_VERTEX_LIGHTING) || defined(GENERATE_POSITION_AND_NORMAL) || defined(APPLY_MATERIAL)
|
||
vec3 normalMC = czm_octDecode(encodedNormal);
|
||
|
||
#if defined(EXAGGERATION) && defined(GEODETIC_SURFACE_NORMALS)
|
||
vec3 projection = dot(normalMC, ellipsoidNormal) * ellipsoidNormal;
|
||
vec3 rejection = normalMC - projection;
|
||
normalMC = normalize(projection + rejection * exaggeration);
|
||
#endif
|
||
|
||
v_normalMC = normalMC;
|
||
v_normalEC = czm_normal3D * v_normalMC;
|
||
#endif
|
||
|
||
#if defined(FOG) || (defined(GROUND_ATMOSPHERE) && !defined(PER_FRAGMENT_GROUND_ATMOSPHERE))
|
||
|
||
bool dynamicLighting = false;
|
||
|
||
#if defined(DYNAMIC_ATMOSPHERE_LIGHTING) && (defined(ENABLE_DAYNIGHT_SHADING) || defined(ENABLE_VERTEX_LIGHTING))
|
||
dynamicLighting = true;
|
||
#endif
|
||
|
||
#if defined(DYNAMIC_ATMOSPHERE_LIGHTING_FROM_SUN)
|
||
vec3 atmosphereLightDirection = czm_sunDirectionWC;
|
||
#else
|
||
vec3 atmosphereLightDirection = czm_lightDirectionWC;
|
||
#endif
|
||
|
||
vec3 lightDirection = czm_branchFreeTernary(dynamicLighting, atmosphereLightDirection, normalize(position3DWC));
|
||
|
||
computeAtmosphereScattering(
|
||
position3DWC,
|
||
lightDirection,
|
||
v_atmosphereRayleighColor,
|
||
v_atmosphereMieColor,
|
||
v_atmosphereOpacity
|
||
);
|
||
#endif
|
||
|
||
#if defined(FOG) || defined(GROUND_ATMOSPHERE) || defined(UNDERGROUND_COLOR) || defined(TRANSLUCENT)
|
||
v_distance = length((czm_modelView3D * vec4(position3DWC, 1.0)).xyz);
|
||
#endif
|
||
|
||
#ifdef APPLY_MATERIAL
|
||
float northPoleZ = czm_ellipsoidRadii.z;
|
||
vec3 northPolePositionMC = vec3(0.0, 0.0, northPoleZ);
|
||
vec3 vectorEastMC = normalize(cross(northPolePositionMC - v_positionMC, ellipsoidNormal));
|
||
float dotProd = abs(dot(ellipsoidNormal, v_normalMC));
|
||
v_slope = acos(dotProd);
|
||
vec3 normalRejected = ellipsoidNormal * dotProd;
|
||
vec3 normalProjected = v_normalMC - normalRejected;
|
||
vec3 aspectVector = normalize(normalProjected);
|
||
v_aspect = acos(dot(aspectVector, vectorEastMC));
|
||
float determ = dot(cross(vectorEastMC, aspectVector), ellipsoidNormal);
|
||
v_aspect = czm_branchFreeTernary(determ < 0.0, 2.0 * czm_pi - v_aspect, v_aspect);
|
||
v_height = height;
|
||
#endif
|
||
}
|
||
`,R5=`void computeAtmosphereScattering(vec3 positionWC, vec3 lightDirection, out vec3 rayleighColor, out vec3 mieColor, out float opacity) {
|
||
|
||
vec3 cameraToPositionWC = positionWC - czm_viewerPositionWC;
|
||
vec3 cameraToPositionWCDirection = normalize(cameraToPositionWC);
|
||
czm_ray primaryRay = czm_ray(czm_viewerPositionWC, cameraToPositionWCDirection);
|
||
|
||
float atmosphereInnerRadius = length(positionWC);
|
||
|
||
computeScattering(
|
||
primaryRay,
|
||
length(cameraToPositionWC),
|
||
lightDirection,
|
||
atmosphereInnerRadius,
|
||
rayleighColor,
|
||
mieColor,
|
||
opacity
|
||
);
|
||
}
|
||
`,ROe=`varying vec2 v_textureCoordinates;
|
||
|
||
uniform float originalSize;
|
||
uniform sampler2D texture0;
|
||
uniform sampler2D texture1;
|
||
uniform sampler2D texture2;
|
||
uniform sampler2D texture3;
|
||
uniform sampler2D texture4;
|
||
uniform sampler2D texture5;
|
||
|
||
const float yMipLevel1 = 1.0 - (1.0 / pow(2.0, 1.0));
|
||
const float yMipLevel2 = 1.0 - (1.0 / pow(2.0, 2.0));
|
||
const float yMipLevel3 = 1.0 - (1.0 / pow(2.0, 3.0));
|
||
const float yMipLevel4 = 1.0 - (1.0 / pow(2.0, 4.0));
|
||
|
||
void main()
|
||
{
|
||
vec2 uv = v_textureCoordinates;
|
||
vec2 textureSize = vec2(originalSize * 1.5 + 2.0, originalSize);
|
||
vec2 pixel = 1.0 / textureSize;
|
||
|
||
float mipLevel = 0.0;
|
||
|
||
if (uv.x - pixel.x > (textureSize.y / textureSize.x))
|
||
{
|
||
mipLevel = 1.0;
|
||
if (uv.y - pixel.y > yMipLevel1)
|
||
{
|
||
mipLevel = 2.0;
|
||
if (uv.y - pixel.y * 3.0 > yMipLevel2)
|
||
{
|
||
mipLevel = 3.0;
|
||
if (uv.y - pixel.y * 5.0 > yMipLevel3)
|
||
{
|
||
mipLevel = 4.0;
|
||
if (uv.y - pixel.y * 7.0 > yMipLevel4)
|
||
{
|
||
mipLevel = 5.0;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
if (mipLevel > 0.0)
|
||
{
|
||
float scale = pow(2.0, mipLevel);
|
||
|
||
uv.y -= (pixel.y * (mipLevel - 1.0) * 2.0);
|
||
uv.x *= ((textureSize.x - 2.0) / textureSize.y);
|
||
|
||
uv.x -= 1.0 + pixel.x;
|
||
uv.y -= (1.0 - (1.0 / pow(2.0, mipLevel - 1.0)));
|
||
uv *= scale;
|
||
}
|
||
else
|
||
{
|
||
uv.x *= (textureSize.x / textureSize.y);
|
||
}
|
||
|
||
if(mipLevel == 0.0)
|
||
{
|
||
gl_FragColor = texture2D(texture0, uv);
|
||
}
|
||
else if(mipLevel == 1.0)
|
||
{
|
||
gl_FragColor = texture2D(texture1, uv);
|
||
}
|
||
else if(mipLevel == 2.0)
|
||
{
|
||
gl_FragColor = texture2D(texture2, uv);
|
||
}
|
||
else if(mipLevel == 3.0)
|
||
{
|
||
gl_FragColor = texture2D(texture3, uv);
|
||
}
|
||
else if(mipLevel == 4.0)
|
||
{
|
||
gl_FragColor = texture2D(texture4, uv);
|
||
}
|
||
else if(mipLevel == 5.0)
|
||
{
|
||
gl_FragColor = texture2D(texture5, uv);
|
||
}
|
||
else
|
||
{
|
||
gl_FragColor = vec4(0.0);
|
||
}
|
||
}
|
||
`,NOe=`varying vec3 v_cubeMapCoordinates;
|
||
uniform samplerCube cubeMap;
|
||
|
||
void main()
|
||
{
|
||
vec4 rgba = textureCube(cubeMap, v_cubeMapCoordinates);
|
||
#ifdef RGBA_NORMALIZED
|
||
gl_FragColor = vec4(rgba.rgb, 1.0);
|
||
#else
|
||
float m = rgba.a * 16.0;
|
||
vec3 r = rgba.rgb * m;
|
||
gl_FragColor = vec4(r * r, 1.0);
|
||
#endif
|
||
}
|
||
`,MOe=`attribute vec4 position;
|
||
attribute vec3 cubeMapCoordinates;
|
||
|
||
varying vec3 v_cubeMapCoordinates;
|
||
|
||
void main()
|
||
{
|
||
gl_Position = position;
|
||
v_cubeMapCoordinates = cubeMapCoordinates;
|
||
}
|
||
`,SS=`varying vec4 v_color;
|
||
varying vec4 v_outlineColor;
|
||
varying float v_innerPercent;
|
||
varying float v_pixelDistance;
|
||
varying vec4 v_pickColor;
|
||
|
||
void main()
|
||
{
|
||
// The distance in UV space from this fragment to the center of the point, at most 0.5.
|
||
float distanceToCenter = length(gl_PointCoord - vec2(0.5));
|
||
// The max distance stops one pixel shy of the edge to leave space for anti-aliasing.
|
||
float maxDistance = max(0.0, 0.5 - v_pixelDistance);
|
||
float wholeAlpha = 1.0 - smoothstep(maxDistance, 0.5, distanceToCenter);
|
||
float innerAlpha = 1.0 - smoothstep(maxDistance * v_innerPercent, 0.5 * v_innerPercent, distanceToCenter);
|
||
|
||
vec4 color = mix(v_outlineColor, v_color, innerAlpha);
|
||
color.a *= wholeAlpha;
|
||
|
||
// Fully transparent parts of the billboard are not pickable.
|
||
#if !defined(OPAQUE) && !defined(TRANSLUCENT)
|
||
if (color.a < 0.005) // matches 0/255 and 1/255
|
||
{
|
||
discard;
|
||
}
|
||
#else
|
||
// The billboard is rendered twice. The opaque pass discards translucent fragments
|
||
// and the translucent pass discards opaque fragments.
|
||
#ifdef OPAQUE
|
||
if (color.a < 0.995) // matches < 254/255
|
||
{
|
||
discard;
|
||
}
|
||
#else
|
||
if (color.a >= 0.995) // matches 254/255 and 255/255
|
||
{
|
||
discard;
|
||
}
|
||
#endif
|
||
#endif
|
||
|
||
gl_FragColor = czm_gammaCorrect(color);
|
||
czm_writeLogDepth();
|
||
}
|
||
`,FOe=`uniform float u_maxTotalPointSize;
|
||
|
||
attribute vec4 positionHighAndSize;
|
||
attribute vec4 positionLowAndOutline;
|
||
attribute vec4 compressedAttribute0; // color, outlineColor, pick color
|
||
attribute vec4 compressedAttribute1; // show, translucency by distance, some free space
|
||
attribute vec4 scaleByDistance; // near, nearScale, far, farScale
|
||
attribute vec3 distanceDisplayConditionAndDisableDepth; // near, far, disableDepthTestDistance
|
||
|
||
varying vec4 v_color;
|
||
varying vec4 v_outlineColor;
|
||
varying float v_innerPercent;
|
||
varying float v_pixelDistance;
|
||
varying vec4 v_pickColor;
|
||
|
||
const float SHIFT_LEFT8 = 256.0;
|
||
const float SHIFT_RIGHT8 = 1.0 / 256.0;
|
||
|
||
void main()
|
||
{
|
||
// Modifying this shader may also require modifications to PointPrimitive._computeScreenSpacePosition
|
||
|
||
// unpack attributes
|
||
vec3 positionHigh = positionHighAndSize.xyz;
|
||
vec3 positionLow = positionLowAndOutline.xyz;
|
||
float outlineWidthBothSides = 2.0 * positionLowAndOutline.w;
|
||
float totalSize = positionHighAndSize.w + outlineWidthBothSides;
|
||
float outlinePercent = outlineWidthBothSides / totalSize;
|
||
// Scale in response to browser-zoom.
|
||
totalSize *= czm_pixelRatio;
|
||
|
||
float temp = compressedAttribute1.x * SHIFT_RIGHT8;
|
||
float show = floor(temp);
|
||
|
||
#ifdef EYE_DISTANCE_TRANSLUCENCY
|
||
vec4 translucencyByDistance;
|
||
translucencyByDistance.x = compressedAttribute1.z;
|
||
translucencyByDistance.z = compressedAttribute1.w;
|
||
|
||
translucencyByDistance.y = ((temp - floor(temp)) * SHIFT_LEFT8) / 255.0;
|
||
|
||
temp = compressedAttribute1.y * SHIFT_RIGHT8;
|
||
translucencyByDistance.w = ((temp - floor(temp)) * SHIFT_LEFT8) / 255.0;
|
||
#endif
|
||
|
||
///////////////////////////////////////////////////////////////////////////
|
||
|
||
vec4 color;
|
||
vec4 outlineColor;
|
||
vec4 pickColor;
|
||
|
||
// compressedAttribute0.z => pickColor.rgb
|
||
|
||
temp = compressedAttribute0.z * SHIFT_RIGHT8;
|
||
pickColor.b = (temp - floor(temp)) * SHIFT_LEFT8;
|
||
temp = floor(temp) * SHIFT_RIGHT8;
|
||
pickColor.g = (temp - floor(temp)) * SHIFT_LEFT8;
|
||
pickColor.r = floor(temp);
|
||
|
||
// compressedAttribute0.x => color.rgb
|
||
|
||
temp = compressedAttribute0.x * SHIFT_RIGHT8;
|
||
color.b = (temp - floor(temp)) * SHIFT_LEFT8;
|
||
temp = floor(temp) * SHIFT_RIGHT8;
|
||
color.g = (temp - floor(temp)) * SHIFT_LEFT8;
|
||
color.r = floor(temp);
|
||
|
||
// compressedAttribute0.y => outlineColor.rgb
|
||
|
||
temp = compressedAttribute0.y * SHIFT_RIGHT8;
|
||
outlineColor.b = (temp - floor(temp)) * SHIFT_LEFT8;
|
||
temp = floor(temp) * SHIFT_RIGHT8;
|
||
outlineColor.g = (temp - floor(temp)) * SHIFT_LEFT8;
|
||
outlineColor.r = floor(temp);
|
||
|
||
// compressedAttribute0.w => color.a, outlineColor.a, pickColor.a
|
||
|
||
temp = compressedAttribute0.w * SHIFT_RIGHT8;
|
||
pickColor.a = (temp - floor(temp)) * SHIFT_LEFT8;
|
||
pickColor = pickColor / 255.0;
|
||
|
||
temp = floor(temp) * SHIFT_RIGHT8;
|
||
outlineColor.a = (temp - floor(temp)) * SHIFT_LEFT8;
|
||
outlineColor /= 255.0;
|
||
color.a = floor(temp);
|
||
color /= 255.0;
|
||
|
||
///////////////////////////////////////////////////////////////////////////
|
||
|
||
vec4 p = czm_translateRelativeToEye(positionHigh, positionLow);
|
||
vec4 positionEC = czm_modelViewRelativeToEye * p;
|
||
|
||
///////////////////////////////////////////////////////////////////////////
|
||
|
||
#if defined(EYE_DISTANCE_SCALING) || defined(EYE_DISTANCE_TRANSLUCENCY) || defined(DISTANCE_DISPLAY_CONDITION) || defined(DISABLE_DEPTH_DISTANCE)
|
||
float lengthSq;
|
||
if (czm_sceneMode == czm_sceneMode2D)
|
||
{
|
||
// 2D camera distance is a special case
|
||
// treat all billboards as flattened to the z=0.0 plane
|
||
lengthSq = czm_eyeHeight2D.y;
|
||
}
|
||
else
|
||
{
|
||
lengthSq = dot(positionEC.xyz, positionEC.xyz);
|
||
}
|
||
#endif
|
||
|
||
#ifdef EYE_DISTANCE_SCALING
|
||
totalSize *= czm_nearFarScalar(scaleByDistance, lengthSq);
|
||
#endif
|
||
if (totalSize > 0.0) {
|
||
// Add padding for anti-aliasing on both sides.
|
||
totalSize += 3.0;
|
||
}
|
||
|
||
// Clamp to max point size.
|
||
totalSize = min(totalSize, u_maxTotalPointSize);
|
||
// If size is too small, push vertex behind near plane for clipping.
|
||
// Note that context.minimumAliasedPointSize "will be at most 1.0".
|
||
if (totalSize < 1.0)
|
||
{
|
||
positionEC.xyz = vec3(0.0);
|
||
totalSize = 1.0;
|
||
}
|
||
|
||
float translucency = 1.0;
|
||
#ifdef EYE_DISTANCE_TRANSLUCENCY
|
||
translucency = czm_nearFarScalar(translucencyByDistance, lengthSq);
|
||
// push vertex behind near plane for clipping
|
||
if (translucency < 0.004)
|
||
{
|
||
positionEC.xyz = vec3(0.0);
|
||
}
|
||
#endif
|
||
|
||
#ifdef DISTANCE_DISPLAY_CONDITION
|
||
float nearSq = distanceDisplayConditionAndDisableDepth.x;
|
||
float farSq = distanceDisplayConditionAndDisableDepth.y;
|
||
if (lengthSq < nearSq || lengthSq > farSq) {
|
||
// push vertex behind camera to force it to be clipped
|
||
positionEC.xyz = vec3(0.0, 0.0, 1.0);
|
||
}
|
||
#endif
|
||
|
||
gl_Position = czm_projection * positionEC;
|
||
czm_vertexLogDepth();
|
||
|
||
#ifdef DISABLE_DEPTH_DISTANCE
|
||
float disableDepthTestDistance = distanceDisplayConditionAndDisableDepth.z;
|
||
if (disableDepthTestDistance == 0.0 && czm_minimumDisableDepthTestDistance != 0.0)
|
||
{
|
||
disableDepthTestDistance = czm_minimumDisableDepthTestDistance;
|
||
}
|
||
|
||
if (disableDepthTestDistance != 0.0)
|
||
{
|
||
// Don't try to "multiply both sides" by w. Greater/less-than comparisons won't work for negative values of w.
|
||
float zclip = gl_Position.z / gl_Position.w;
|
||
bool clipped = (zclip < -1.0 || zclip > 1.0);
|
||
if (!clipped && (disableDepthTestDistance < 0.0 || (lengthSq > 0.0 && lengthSq < disableDepthTestDistance)))
|
||
{
|
||
// Position z on the near plane.
|
||
gl_Position.z = -gl_Position.w;
|
||
#ifdef LOG_DEPTH
|
||
czm_vertexLogDepth(vec4(czm_currentFrustum.x));
|
||
#endif
|
||
}
|
||
}
|
||
#endif
|
||
|
||
v_color = color;
|
||
v_color.a *= translucency * show;
|
||
v_outlineColor = outlineColor;
|
||
v_outlineColor.a *= translucency * show;
|
||
|
||
v_innerPercent = 1.0 - outlinePercent;
|
||
v_pixelDistance = 2.0 / totalSize;
|
||
gl_PointSize = totalSize * show;
|
||
gl_Position *= show;
|
||
|
||
v_pickColor = pickColor;
|
||
}
|
||
`,mx=`void clipLineSegmentToNearPlane(
|
||
vec3 p0,
|
||
vec3 p1,
|
||
out vec4 positionWC,
|
||
out bool clipped,
|
||
out bool culledByNearPlane,
|
||
out vec4 clippedPositionEC)
|
||
{
|
||
culledByNearPlane = false;
|
||
clipped = false;
|
||
|
||
vec3 p0ToP1 = p1 - p0;
|
||
float magnitude = length(p0ToP1);
|
||
vec3 direction = normalize(p0ToP1);
|
||
|
||
// Distance that p0 is behind the near plane. Negative means p0 is
|
||
// in front of the near plane.
|
||
float endPoint0Distance = czm_currentFrustum.x + p0.z;
|
||
|
||
// Camera looks down -Z.
|
||
// When moving a point along +Z: LESS VISIBLE
|
||
// * Points in front of the camera move closer to the camera.
|
||
// * Points behind the camrea move farther away from the camera.
|
||
// When moving a point along -Z: MORE VISIBLE
|
||
// * Points in front of the camera move farther away from the camera.
|
||
// * Points behind the camera move closer to the camera.
|
||
|
||
// Positive denominator: -Z, becoming more visible
|
||
// Negative denominator: +Z, becoming less visible
|
||
// Nearly zero: parallel to near plane
|
||
float denominator = -direction.z;
|
||
|
||
if (endPoint0Distance > 0.0 && abs(denominator) < czm_epsilon7)
|
||
{
|
||
// p0 is behind the near plane and the line to p1 is nearly parallel to
|
||
// the near plane, so cull the segment completely.
|
||
culledByNearPlane = true;
|
||
}
|
||
else if (endPoint0Distance > 0.0)
|
||
{
|
||
// p0 is behind the near plane, and the line to p1 is moving distinctly
|
||
// toward or away from it.
|
||
|
||
// t = (-plane distance - dot(plane normal, ray origin)) / dot(plane normal, ray direction)
|
||
float t = endPoint0Distance / denominator;
|
||
if (t < 0.0 || t > magnitude)
|
||
{
|
||
// Near plane intersection is not between the two points.
|
||
// We already confirmed p0 is behind the naer plane, so now
|
||
// we know the entire segment is behind it.
|
||
culledByNearPlane = true;
|
||
}
|
||
else
|
||
{
|
||
// Segment crosses the near plane, update p0 to lie exactly on it.
|
||
p0 = p0 + t * direction;
|
||
|
||
// Numerical noise might put us a bit on the wrong side of the near plane.
|
||
// Don't let that happen.
|
||
p0.z = min(p0.z, -czm_currentFrustum.x);
|
||
|
||
clipped = true;
|
||
}
|
||
}
|
||
|
||
clippedPositionEC = vec4(p0, 1.0);
|
||
positionWC = czm_eyeToWindowCoordinates(clippedPositionEC);
|
||
}
|
||
|
||
vec4 getPolylineWindowCoordinatesEC(vec4 positionEC, vec4 prevEC, vec4 nextEC, float expandDirection, float width, bool usePrevious, out float angle)
|
||
{
|
||
// expandDirection +1 is to the _left_ when looking from positionEC toward nextEC.
|
||
|
||
#ifdef POLYLINE_DASH
|
||
// Compute the window coordinates of the points.
|
||
vec4 positionWindow = czm_eyeToWindowCoordinates(positionEC);
|
||
vec4 previousWindow = czm_eyeToWindowCoordinates(prevEC);
|
||
vec4 nextWindow = czm_eyeToWindowCoordinates(nextEC);
|
||
|
||
// Determine the relative screen space direction of the line.
|
||
vec2 lineDir;
|
||
if (usePrevious) {
|
||
lineDir = normalize(positionWindow.xy - previousWindow.xy);
|
||
}
|
||
else {
|
||
lineDir = normalize(nextWindow.xy - positionWindow.xy);
|
||
}
|
||
angle = atan(lineDir.x, lineDir.y) - 1.570796327; // precomputed atan(1,0)
|
||
|
||
// Quantize the angle so it doesn't change rapidly between segments.
|
||
angle = floor(angle / czm_piOverFour + 0.5) * czm_piOverFour;
|
||
#endif
|
||
|
||
vec4 clippedPrevWC, clippedPrevEC;
|
||
bool prevSegmentClipped, prevSegmentCulled;
|
||
clipLineSegmentToNearPlane(prevEC.xyz, positionEC.xyz, clippedPrevWC, prevSegmentClipped, prevSegmentCulled, clippedPrevEC);
|
||
|
||
vec4 clippedNextWC, clippedNextEC;
|
||
bool nextSegmentClipped, nextSegmentCulled;
|
||
clipLineSegmentToNearPlane(nextEC.xyz, positionEC.xyz, clippedNextWC, nextSegmentClipped, nextSegmentCulled, clippedNextEC);
|
||
|
||
bool segmentClipped, segmentCulled;
|
||
vec4 clippedPositionWC, clippedPositionEC;
|
||
clipLineSegmentToNearPlane(positionEC.xyz, usePrevious ? prevEC.xyz : nextEC.xyz, clippedPositionWC, segmentClipped, segmentCulled, clippedPositionEC);
|
||
|
||
if (segmentCulled)
|
||
{
|
||
return vec4(0.0, 0.0, 0.0, 1.0);
|
||
}
|
||
|
||
vec2 directionToPrevWC = normalize(clippedPrevWC.xy - clippedPositionWC.xy);
|
||
vec2 directionToNextWC = normalize(clippedNextWC.xy - clippedPositionWC.xy);
|
||
|
||
// If a segment was culled, we can't use the corresponding direction
|
||
// computed above. We should never see both of these be true without
|
||
// \`segmentCulled\` above also being true.
|
||
if (prevSegmentCulled)
|
||
{
|
||
directionToPrevWC = -directionToNextWC;
|
||
}
|
||
else if (nextSegmentCulled)
|
||
{
|
||
directionToNextWC = -directionToPrevWC;
|
||
}
|
||
|
||
vec2 thisSegmentForwardWC, otherSegmentForwardWC;
|
||
if (usePrevious)
|
||
{
|
||
thisSegmentForwardWC = -directionToPrevWC;
|
||
otherSegmentForwardWC = directionToNextWC;
|
||
}
|
||
else
|
||
{
|
||
thisSegmentForwardWC = directionToNextWC;
|
||
otherSegmentForwardWC = -directionToPrevWC;
|
||
}
|
||
|
||
vec2 thisSegmentLeftWC = vec2(-thisSegmentForwardWC.y, thisSegmentForwardWC.x);
|
||
|
||
vec2 leftWC = thisSegmentLeftWC;
|
||
float expandWidth = width * 0.5;
|
||
|
||
// When lines are split at the anti-meridian, the position may be at the
|
||
// same location as the next or previous position, and we need to handle
|
||
// that to avoid producing NaNs.
|
||
if (!czm_equalsEpsilon(prevEC.xyz - positionEC.xyz, vec3(0.0), czm_epsilon1) && !czm_equalsEpsilon(nextEC.xyz - positionEC.xyz, vec3(0.0), czm_epsilon1))
|
||
{
|
||
vec2 otherSegmentLeftWC = vec2(-otherSegmentForwardWC.y, otherSegmentForwardWC.x);
|
||
|
||
vec2 leftSumWC = thisSegmentLeftWC + otherSegmentLeftWC;
|
||
float leftSumLength = length(leftSumWC);
|
||
leftWC = leftSumLength < czm_epsilon6 ? thisSegmentLeftWC : (leftSumWC / leftSumLength);
|
||
|
||
// The sine of the angle between the two vectors is given by the formula
|
||
// |a x b| = |a||b|sin(theta)
|
||
// which is
|
||
// float sinAngle = length(cross(vec3(leftWC, 0.0), vec3(-thisSegmentForwardWC, 0.0)));
|
||
// Because the z components of both vectors are zero, the x and y coordinate will be zero.
|
||
// Therefore, the sine of the angle is just the z component of the cross product.
|
||
vec2 u = -thisSegmentForwardWC;
|
||
vec2 v = leftWC;
|
||
float sinAngle = abs(u.x * v.y - u.y * v.x);
|
||
expandWidth = clamp(expandWidth / sinAngle, 0.0, width * 2.0);
|
||
}
|
||
|
||
vec2 offset = leftWC * expandDirection * expandWidth * czm_pixelRatio;
|
||
return vec4(clippedPositionWC.xy + offset, -clippedPositionWC.z, 1.0) * (czm_projection * clippedPositionEC).w;
|
||
}
|
||
|
||
vec4 getPolylineWindowCoordinates(vec4 position, vec4 previous, vec4 next, float expandDirection, float width, bool usePrevious, out float angle)
|
||
{
|
||
vec4 positionEC = czm_modelViewRelativeToEye * position;
|
||
vec4 prevEC = czm_modelViewRelativeToEye * previous;
|
||
vec4 nextEC = czm_modelViewRelativeToEye * next;
|
||
return getPolylineWindowCoordinatesEC(positionEC, prevEC, nextEC, expandDirection, width, usePrevious, angle);
|
||
}
|
||
`,XK=`#ifdef VECTOR_TILE
|
||
uniform vec4 u_highlightColor;
|
||
#endif
|
||
|
||
varying vec2 v_st;
|
||
|
||
void main()
|
||
{
|
||
czm_materialInput materialInput;
|
||
|
||
vec2 st = v_st;
|
||
st.t = czm_readNonPerspective(st.t, gl_FragCoord.w);
|
||
|
||
materialInput.s = st.s;
|
||
materialInput.st = st;
|
||
materialInput.str = vec3(st, 0.0);
|
||
|
||
czm_material material = czm_getMaterial(materialInput);
|
||
gl_FragColor = vec4(material.diffuse + material.emission, material.alpha);
|
||
#ifdef VECTOR_TILE
|
||
gl_FragColor *= u_highlightColor;
|
||
#endif
|
||
|
||
czm_writeLogDepth();
|
||
}
|
||
`,zOe=`#ifdef GL_EXT_frag_depth
|
||
#extension GL_EXT_frag_depth : enable
|
||
#endif
|
||
|
||
varying vec4 v_startPlaneNormalEcAndHalfWidth;
|
||
varying vec4 v_endPlaneNormalEcAndBatchId;
|
||
varying vec4 v_rightPlaneEC; // Technically can compute distance for this here
|
||
varying vec4 v_endEcAndStartEcX;
|
||
varying vec4 v_texcoordNormalizationAndStartEcYZ;
|
||
|
||
#ifdef PER_INSTANCE_COLOR
|
||
varying vec4 v_color;
|
||
#endif
|
||
|
||
void main(void)
|
||
{
|
||
float logDepthOrDepth = czm_branchFreeTernary(czm_sceneMode == czm_sceneMode2D, gl_FragCoord.z, czm_unpackDepth(texture2D(czm_globeDepthTexture, gl_FragCoord.xy / czm_viewport.zw)));
|
||
vec3 ecStart = vec3(v_endEcAndStartEcX.w, v_texcoordNormalizationAndStartEcYZ.zw);
|
||
|
||
// Discard for sky
|
||
if (logDepthOrDepth == 0.0) {
|
||
#ifdef DEBUG_SHOW_VOLUME
|
||
gl_FragColor = vec4(1.0, 0.0, 0.0, 0.5);
|
||
return;
|
||
#else // DEBUG_SHOW_VOLUME
|
||
discard;
|
||
#endif // DEBUG_SHOW_VOLUME
|
||
}
|
||
|
||
vec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, logDepthOrDepth);
|
||
eyeCoordinate /= eyeCoordinate.w;
|
||
|
||
float halfMaxWidth = v_startPlaneNormalEcAndHalfWidth.w * czm_metersPerPixel(eyeCoordinate);
|
||
// Check distance of the eye coordinate against the right-facing plane
|
||
float widthwiseDistance = czm_planeDistance(v_rightPlaneEC, eyeCoordinate.xyz);
|
||
|
||
// Check eye coordinate against the mitering planes
|
||
float distanceFromStart = czm_planeDistance(v_startPlaneNormalEcAndHalfWidth.xyz, -dot(ecStart, v_startPlaneNormalEcAndHalfWidth.xyz), eyeCoordinate.xyz);
|
||
float distanceFromEnd = czm_planeDistance(v_endPlaneNormalEcAndBatchId.xyz, -dot(v_endEcAndStartEcX.xyz, v_endPlaneNormalEcAndBatchId.xyz), eyeCoordinate.xyz);
|
||
|
||
if (abs(widthwiseDistance) > halfMaxWidth || distanceFromStart < 0.0 || distanceFromEnd < 0.0) {
|
||
#ifdef DEBUG_SHOW_VOLUME
|
||
gl_FragColor = vec4(1.0, 0.0, 0.0, 0.5);
|
||
return;
|
||
#else // DEBUG_SHOW_VOLUME
|
||
discard;
|
||
#endif // DEBUG_SHOW_VOLUME
|
||
}
|
||
|
||
// Check distance of the eye coordinate against start and end planes with normals in the right plane.
|
||
// For computing unskewed lengthwise texture coordinate.
|
||
// Can also be used for clipping extremely pointy miters, but in practice unnecessary because of miter breaking.
|
||
|
||
// aligned plane: cross the right plane normal with miter plane normal, then cross the result with right again to point it more "forward"
|
||
vec3 alignedPlaneNormal;
|
||
|
||
// start aligned plane
|
||
alignedPlaneNormal = cross(v_rightPlaneEC.xyz, v_startPlaneNormalEcAndHalfWidth.xyz);
|
||
alignedPlaneNormal = normalize(cross(alignedPlaneNormal, v_rightPlaneEC.xyz));
|
||
distanceFromStart = czm_planeDistance(alignedPlaneNormal, -dot(alignedPlaneNormal, ecStart), eyeCoordinate.xyz);
|
||
|
||
// end aligned plane
|
||
alignedPlaneNormal = cross(v_rightPlaneEC.xyz, v_endPlaneNormalEcAndBatchId.xyz);
|
||
alignedPlaneNormal = normalize(cross(alignedPlaneNormal, v_rightPlaneEC.xyz));
|
||
distanceFromEnd = czm_planeDistance(alignedPlaneNormal, -dot(alignedPlaneNormal, v_endEcAndStartEcX.xyz), eyeCoordinate.xyz);
|
||
|
||
#ifdef PER_INSTANCE_COLOR
|
||
gl_FragColor = czm_gammaCorrect(v_color);
|
||
#else // PER_INSTANCE_COLOR
|
||
// Clamp - distance to aligned planes may be negative due to mitering,
|
||
// so fragment texture coordinate might be out-of-bounds.
|
||
float s = clamp(distanceFromStart / (distanceFromStart + distanceFromEnd), 0.0, 1.0);
|
||
s = (s * v_texcoordNormalizationAndStartEcYZ.x) + v_texcoordNormalizationAndStartEcYZ.y;
|
||
float t = (widthwiseDistance + halfMaxWidth) / (2.0 * halfMaxWidth);
|
||
|
||
czm_materialInput materialInput;
|
||
|
||
materialInput.s = s;
|
||
materialInput.st = vec2(s, t);
|
||
materialInput.str = vec3(s, t, 0.0);
|
||
|
||
czm_material material = czm_getMaterial(materialInput);
|
||
gl_FragColor = vec4(material.diffuse + material.emission, material.alpha);
|
||
#endif // PER_INSTANCE_COLOR
|
||
|
||
// Premultiply alpha. Required for classification primitives on translucent globe.
|
||
gl_FragColor.rgb *= gl_FragColor.a;
|
||
|
||
czm_writeDepthClamp();
|
||
}
|
||
`,UOe=`varying vec3 v_forwardDirectionEC;
|
||
varying vec3 v_texcoordNormalizationAndHalfWidth;
|
||
varying float v_batchId;
|
||
|
||
#ifdef PER_INSTANCE_COLOR
|
||
varying vec4 v_color;
|
||
#else
|
||
varying vec2 v_alignedPlaneDistances;
|
||
varying float v_texcoordT;
|
||
#endif
|
||
|
||
float rayPlaneDistanceUnsafe(vec3 origin, vec3 direction, vec3 planeNormal, float planeDistance) {
|
||
// We don't expect the ray to ever be parallel to the plane
|
||
return (-planeDistance - dot(planeNormal, origin)) / dot(planeNormal, direction);
|
||
}
|
||
|
||
void main(void)
|
||
{
|
||
vec4 eyeCoordinate = gl_FragCoord;
|
||
eyeCoordinate /= eyeCoordinate.w;
|
||
|
||
#ifdef PER_INSTANCE_COLOR
|
||
gl_FragColor = czm_gammaCorrect(v_color);
|
||
#else // PER_INSTANCE_COLOR
|
||
// Use distances for planes aligned with segment to prevent skew in dashing
|
||
float distanceFromStart = rayPlaneDistanceUnsafe(eyeCoordinate.xyz, -v_forwardDirectionEC, v_forwardDirectionEC.xyz, v_alignedPlaneDistances.x);
|
||
float distanceFromEnd = rayPlaneDistanceUnsafe(eyeCoordinate.xyz, v_forwardDirectionEC, -v_forwardDirectionEC.xyz, v_alignedPlaneDistances.y);
|
||
|
||
// Clamp - distance to aligned planes may be negative due to mitering
|
||
distanceFromStart = max(0.0, distanceFromStart);
|
||
distanceFromEnd = max(0.0, distanceFromEnd);
|
||
|
||
float s = distanceFromStart / (distanceFromStart + distanceFromEnd);
|
||
s = (s * v_texcoordNormalizationAndHalfWidth.x) + v_texcoordNormalizationAndHalfWidth.y;
|
||
|
||
czm_materialInput materialInput;
|
||
|
||
materialInput.s = s;
|
||
materialInput.st = vec2(s, v_texcoordT);
|
||
materialInput.str = vec3(s, v_texcoordT, 0.0);
|
||
|
||
czm_material material = czm_getMaterial(materialInput);
|
||
gl_FragColor = vec4(material.diffuse + material.emission, material.alpha);
|
||
#endif // PER_INSTANCE_COLOR
|
||
}
|
||
`,HOe=`attribute vec3 position3DHigh;
|
||
attribute vec3 position3DLow;
|
||
|
||
attribute vec4 startHiAndForwardOffsetX;
|
||
attribute vec4 startLoAndForwardOffsetY;
|
||
attribute vec4 startNormalAndForwardOffsetZ;
|
||
attribute vec4 endNormalAndTextureCoordinateNormalizationX;
|
||
attribute vec4 rightNormalAndTextureCoordinateNormalizationY;
|
||
attribute vec4 startHiLo2D;
|
||
attribute vec4 offsetAndRight2D;
|
||
attribute vec4 startEndNormals2D;
|
||
attribute vec2 texcoordNormalization2D;
|
||
|
||
attribute float batchId;
|
||
|
||
varying vec3 v_forwardDirectionEC;
|
||
varying vec3 v_texcoordNormalizationAndHalfWidth;
|
||
varying float v_batchId;
|
||
|
||
// For materials
|
||
#ifdef WIDTH_VARYING
|
||
varying float v_width;
|
||
#endif
|
||
#ifdef ANGLE_VARYING
|
||
varying float v_polylineAngle;
|
||
#endif
|
||
|
||
#ifdef PER_INSTANCE_COLOR
|
||
varying vec4 v_color;
|
||
#else
|
||
varying vec2 v_alignedPlaneDistances;
|
||
varying float v_texcoordT;
|
||
#endif
|
||
|
||
// Morphing planes using SLERP or NLERP doesn't seem to work, so instead draw the material directly on the shadow volume.
|
||
// Morph views are from very far away and aren't meant to be used precisely, so this should be sufficient.
|
||
void main()
|
||
{
|
||
v_batchId = batchId;
|
||
|
||
// Start position
|
||
vec4 posRelativeToEye2D = czm_translateRelativeToEye(vec3(0.0, startHiLo2D.xy), vec3(0.0, startHiLo2D.zw));
|
||
vec4 posRelativeToEye3D = czm_translateRelativeToEye(startHiAndForwardOffsetX.xyz, startLoAndForwardOffsetY.xyz);
|
||
vec4 posRelativeToEye = czm_columbusViewMorph(posRelativeToEye2D, posRelativeToEye3D, czm_morphTime);
|
||
vec3 posEc2D = (czm_modelViewRelativeToEye * posRelativeToEye2D).xyz;
|
||
vec3 posEc3D = (czm_modelViewRelativeToEye * posRelativeToEye3D).xyz;
|
||
vec3 startEC = (czm_modelViewRelativeToEye * posRelativeToEye).xyz;
|
||
|
||
// Start plane
|
||
vec4 startPlane2D;
|
||
vec4 startPlane3D;
|
||
startPlane2D.xyz = czm_normal * vec3(0.0, startEndNormals2D.xy);
|
||
startPlane3D.xyz = czm_normal * startNormalAndForwardOffsetZ.xyz;
|
||
startPlane2D.w = -dot(startPlane2D.xyz, posEc2D);
|
||
startPlane3D.w = -dot(startPlane3D.xyz, posEc3D);
|
||
|
||
// Right plane
|
||
vec4 rightPlane2D;
|
||
vec4 rightPlane3D;
|
||
rightPlane2D.xyz = czm_normal * vec3(0.0, offsetAndRight2D.zw);
|
||
rightPlane3D.xyz = czm_normal * rightNormalAndTextureCoordinateNormalizationY.xyz;
|
||
rightPlane2D.w = -dot(rightPlane2D.xyz, posEc2D);
|
||
rightPlane3D.w = -dot(rightPlane3D.xyz, posEc3D);
|
||
|
||
// End position
|
||
posRelativeToEye2D = posRelativeToEye2D + vec4(0.0, offsetAndRight2D.xy, 0.0);
|
||
posRelativeToEye3D = posRelativeToEye3D + vec4(startHiAndForwardOffsetX.w, startLoAndForwardOffsetY.w, startNormalAndForwardOffsetZ.w, 0.0);
|
||
posRelativeToEye = czm_columbusViewMorph(posRelativeToEye2D, posRelativeToEye3D, czm_morphTime);
|
||
posEc2D = (czm_modelViewRelativeToEye * posRelativeToEye2D).xyz;
|
||
posEc3D = (czm_modelViewRelativeToEye * posRelativeToEye3D).xyz;
|
||
vec3 endEC = (czm_modelViewRelativeToEye * posRelativeToEye).xyz;
|
||
vec3 forwardEc3D = czm_normal * normalize(vec3(startHiAndForwardOffsetX.w, startLoAndForwardOffsetY.w, startNormalAndForwardOffsetZ.w));
|
||
vec3 forwardEc2D = czm_normal * normalize(vec3(0.0, offsetAndRight2D.xy));
|
||
|
||
// End plane
|
||
vec4 endPlane2D;
|
||
vec4 endPlane3D;
|
||
endPlane2D.xyz = czm_normal * vec3(0.0, startEndNormals2D.zw);
|
||
endPlane3D.xyz = czm_normal * endNormalAndTextureCoordinateNormalizationX.xyz;
|
||
endPlane2D.w = -dot(endPlane2D.xyz, posEc2D);
|
||
endPlane3D.w = -dot(endPlane3D.xyz, posEc3D);
|
||
|
||
// Forward direction
|
||
v_forwardDirectionEC = normalize(endEC - startEC);
|
||
|
||
vec2 cleanTexcoordNormalization2D;
|
||
cleanTexcoordNormalization2D.x = abs(texcoordNormalization2D.x);
|
||
cleanTexcoordNormalization2D.y = czm_branchFreeTernary(texcoordNormalization2D.y > 1.0, 0.0, abs(texcoordNormalization2D.y));
|
||
vec2 cleanTexcoordNormalization3D;
|
||
cleanTexcoordNormalization3D.x = abs(endNormalAndTextureCoordinateNormalizationX.w);
|
||
cleanTexcoordNormalization3D.y = rightNormalAndTextureCoordinateNormalizationY.w;
|
||
cleanTexcoordNormalization3D.y = czm_branchFreeTernary(cleanTexcoordNormalization3D.y > 1.0, 0.0, abs(cleanTexcoordNormalization3D.y));
|
||
|
||
v_texcoordNormalizationAndHalfWidth.xy = mix(cleanTexcoordNormalization2D, cleanTexcoordNormalization3D, czm_morphTime);
|
||
|
||
#ifdef PER_INSTANCE_COLOR
|
||
v_color = czm_batchTable_color(batchId);
|
||
#else // PER_INSTANCE_COLOR
|
||
// For computing texture coordinates
|
||
|
||
v_alignedPlaneDistances.x = -dot(v_forwardDirectionEC, startEC);
|
||
v_alignedPlaneDistances.y = -dot(-v_forwardDirectionEC, endEC);
|
||
#endif // PER_INSTANCE_COLOR
|
||
|
||
#ifdef WIDTH_VARYING
|
||
float width = czm_batchTable_width(batchId);
|
||
float halfWidth = width * 0.5;
|
||
v_width = width;
|
||
v_texcoordNormalizationAndHalfWidth.z = halfWidth;
|
||
#else
|
||
float halfWidth = 0.5 * czm_batchTable_width(batchId);
|
||
v_texcoordNormalizationAndHalfWidth.z = halfWidth;
|
||
#endif
|
||
|
||
// Compute a normal along which to "push" the position out, extending the miter depending on view distance.
|
||
// Position has already been "pushed" by unit length along miter normal, and miter normals are encoded in the planes.
|
||
// Decode the normal to use at this specific vertex, push the position back, and then push to where it needs to be.
|
||
// Since this is morphing, compute both 3D and 2D positions and then blend.
|
||
|
||
// ****** 3D ******
|
||
// Check distance to the end plane and start plane, pick the plane that is closer
|
||
vec4 positionEc3D = czm_modelViewRelativeToEye * czm_translateRelativeToEye(position3DHigh, position3DLow); // w = 1.0, see czm_computePosition
|
||
float absStartPlaneDistance = abs(czm_planeDistance(startPlane3D, positionEc3D.xyz));
|
||
float absEndPlaneDistance = abs(czm_planeDistance(endPlane3D, positionEc3D.xyz));
|
||
vec3 planeDirection = czm_branchFreeTernary(absStartPlaneDistance < absEndPlaneDistance, startPlane3D.xyz, endPlane3D.xyz);
|
||
vec3 upOrDown = normalize(cross(rightPlane3D.xyz, planeDirection)); // Points "up" for start plane, "down" at end plane.
|
||
vec3 normalEC = normalize(cross(planeDirection, upOrDown)); // In practice, the opposite seems to work too.
|
||
|
||
// Nudge the top vertex upwards to prevent flickering
|
||
vec3 geodeticSurfaceNormal = normalize(cross(normalEC, forwardEc3D));
|
||
geodeticSurfaceNormal *= float(0.0 <= rightNormalAndTextureCoordinateNormalizationY.w && rightNormalAndTextureCoordinateNormalizationY.w <= 1.0);
|
||
geodeticSurfaceNormal *= MAX_TERRAIN_HEIGHT;
|
||
positionEc3D.xyz += geodeticSurfaceNormal;
|
||
|
||
// Determine if this vertex is on the "left" or "right"
|
||
normalEC *= sign(endNormalAndTextureCoordinateNormalizationX.w);
|
||
|
||
// A "perfect" implementation would push along normals according to the angle against forward.
|
||
// In practice, just pushing the normal out by halfWidth is sufficient for morph views.
|
||
positionEc3D.xyz += halfWidth * max(0.0, czm_metersPerPixel(positionEc3D)) * normalEC; // prevent artifacts when czm_metersPerPixel is negative (behind camera)
|
||
|
||
// ****** 2D ******
|
||
// Check distance to the end plane and start plane, pick the plane that is closer
|
||
vec4 positionEc2D = czm_modelViewRelativeToEye * czm_translateRelativeToEye(position2DHigh.zxy, position2DLow.zxy); // w = 1.0, see czm_computePosition
|
||
absStartPlaneDistance = abs(czm_planeDistance(startPlane2D, positionEc2D.xyz));
|
||
absEndPlaneDistance = abs(czm_planeDistance(endPlane2D, positionEc2D.xyz));
|
||
planeDirection = czm_branchFreeTernary(absStartPlaneDistance < absEndPlaneDistance, startPlane2D.xyz, endPlane2D.xyz);
|
||
upOrDown = normalize(cross(rightPlane2D.xyz, planeDirection)); // Points "up" for start plane, "down" at end plane.
|
||
normalEC = normalize(cross(planeDirection, upOrDown)); // In practice, the opposite seems to work too.
|
||
|
||
// Nudge the top vertex upwards to prevent flickering
|
||
geodeticSurfaceNormal = normalize(cross(normalEC, forwardEc2D));
|
||
geodeticSurfaceNormal *= float(0.0 <= texcoordNormalization2D.y && texcoordNormalization2D.y <= 1.0);
|
||
geodeticSurfaceNormal *= MAX_TERRAIN_HEIGHT;
|
||
positionEc2D.xyz += geodeticSurfaceNormal;
|
||
|
||
// Determine if this vertex is on the "left" or "right"
|
||
normalEC *= sign(texcoordNormalization2D.x);
|
||
#ifndef PER_INSTANCE_COLOR
|
||
// Use vertex's sidedness to compute its texture coordinate.
|
||
v_texcoordT = clamp(sign(texcoordNormalization2D.x), 0.0, 1.0);
|
||
#endif
|
||
|
||
// A "perfect" implementation would push along normals according to the angle against forward.
|
||
// In practice, just pushing the normal out by halfWidth is sufficient for morph views.
|
||
positionEc2D.xyz += halfWidth * max(0.0, czm_metersPerPixel(positionEc2D)) * normalEC; // prevent artifacts when czm_metersPerPixel is negative (behind camera)
|
||
|
||
// Blend for actual position
|
||
gl_Position = czm_projection * mix(positionEc2D, positionEc3D, czm_morphTime);
|
||
|
||
#ifdef ANGLE_VARYING
|
||
// Approximate relative screen space direction of the line.
|
||
vec2 approxLineDirection = normalize(vec2(v_forwardDirectionEC.x, -v_forwardDirectionEC.y));
|
||
approxLineDirection.y = czm_branchFreeTernary(approxLineDirection.x == 0.0 && approxLineDirection.y == 0.0, -1.0, approxLineDirection.y);
|
||
v_polylineAngle = czm_fastApproximateAtan(approxLineDirection.x, approxLineDirection.y);
|
||
#endif
|
||
}
|
||
`,VOe=`attribute vec3 position3DHigh;
|
||
attribute vec3 position3DLow;
|
||
|
||
// In 2D and in 3D, texture coordinate normalization component signs encodes:
|
||
// * X sign - sidedness relative to right plane
|
||
// * Y sign - is negative OR magnitude is greater than 1.0 if vertex is on bottom of volume
|
||
#ifndef COLUMBUS_VIEW_2D
|
||
attribute vec4 startHiAndForwardOffsetX;
|
||
attribute vec4 startLoAndForwardOffsetY;
|
||
attribute vec4 startNormalAndForwardOffsetZ;
|
||
attribute vec4 endNormalAndTextureCoordinateNormalizationX;
|
||
attribute vec4 rightNormalAndTextureCoordinateNormalizationY;
|
||
#else
|
||
attribute vec4 startHiLo2D;
|
||
attribute vec4 offsetAndRight2D;
|
||
attribute vec4 startEndNormals2D;
|
||
attribute vec2 texcoordNormalization2D;
|
||
#endif
|
||
|
||
attribute float batchId;
|
||
|
||
varying vec4 v_startPlaneNormalEcAndHalfWidth;
|
||
varying vec4 v_endPlaneNormalEcAndBatchId;
|
||
varying vec4 v_rightPlaneEC;
|
||
varying vec4 v_endEcAndStartEcX;
|
||
varying vec4 v_texcoordNormalizationAndStartEcYZ;
|
||
|
||
// For materials
|
||
#ifdef WIDTH_VARYING
|
||
varying float v_width;
|
||
#endif
|
||
#ifdef ANGLE_VARYING
|
||
varying float v_polylineAngle;
|
||
#endif
|
||
|
||
#ifdef PER_INSTANCE_COLOR
|
||
varying vec4 v_color;
|
||
#endif
|
||
|
||
void main()
|
||
{
|
||
#ifdef COLUMBUS_VIEW_2D
|
||
vec3 ecStart = (czm_modelViewRelativeToEye * czm_translateRelativeToEye(vec3(0.0, startHiLo2D.xy), vec3(0.0, startHiLo2D.zw))).xyz;
|
||
|
||
vec3 forwardDirectionEC = czm_normal * vec3(0.0, offsetAndRight2D.xy);
|
||
vec3 ecEnd = forwardDirectionEC + ecStart;
|
||
forwardDirectionEC = normalize(forwardDirectionEC);
|
||
|
||
// Right plane
|
||
v_rightPlaneEC.xyz = czm_normal * vec3(0.0, offsetAndRight2D.zw);
|
||
v_rightPlaneEC.w = -dot(v_rightPlaneEC.xyz, ecStart);
|
||
|
||
// start plane
|
||
vec4 startPlaneEC;
|
||
startPlaneEC.xyz = czm_normal * vec3(0.0, startEndNormals2D.xy);
|
||
startPlaneEC.w = -dot(startPlaneEC.xyz, ecStart);
|
||
|
||
// end plane
|
||
vec4 endPlaneEC;
|
||
endPlaneEC.xyz = czm_normal * vec3(0.0, startEndNormals2D.zw);
|
||
endPlaneEC.w = -dot(endPlaneEC.xyz, ecEnd);
|
||
|
||
v_texcoordNormalizationAndStartEcYZ.x = abs(texcoordNormalization2D.x);
|
||
v_texcoordNormalizationAndStartEcYZ.y = texcoordNormalization2D.y;
|
||
|
||
#else // COLUMBUS_VIEW_2D
|
||
vec3 ecStart = (czm_modelViewRelativeToEye * czm_translateRelativeToEye(startHiAndForwardOffsetX.xyz, startLoAndForwardOffsetY.xyz)).xyz;
|
||
vec3 offset = czm_normal * vec3(startHiAndForwardOffsetX.w, startLoAndForwardOffsetY.w, startNormalAndForwardOffsetZ.w);
|
||
vec3 ecEnd = ecStart + offset;
|
||
|
||
vec3 forwardDirectionEC = normalize(offset);
|
||
|
||
// start plane
|
||
vec4 startPlaneEC;
|
||
startPlaneEC.xyz = czm_normal * startNormalAndForwardOffsetZ.xyz;
|
||
startPlaneEC.w = -dot(startPlaneEC.xyz, ecStart);
|
||
|
||
// end plane
|
||
vec4 endPlaneEC;
|
||
endPlaneEC.xyz = czm_normal * endNormalAndTextureCoordinateNormalizationX.xyz;
|
||
endPlaneEC.w = -dot(endPlaneEC.xyz, ecEnd);
|
||
|
||
// Right plane
|
||
v_rightPlaneEC.xyz = czm_normal * rightNormalAndTextureCoordinateNormalizationY.xyz;
|
||
v_rightPlaneEC.w = -dot(v_rightPlaneEC.xyz, ecStart);
|
||
|
||
v_texcoordNormalizationAndStartEcYZ.x = abs(endNormalAndTextureCoordinateNormalizationX.w);
|
||
v_texcoordNormalizationAndStartEcYZ.y = rightNormalAndTextureCoordinateNormalizationY.w;
|
||
|
||
#endif // COLUMBUS_VIEW_2D
|
||
|
||
v_endEcAndStartEcX.xyz = ecEnd;
|
||
v_endEcAndStartEcX.w = ecStart.x;
|
||
v_texcoordNormalizationAndStartEcYZ.zw = ecStart.yz;
|
||
|
||
#ifdef PER_INSTANCE_COLOR
|
||
v_color = czm_batchTable_color(batchId);
|
||
#endif // PER_INSTANCE_COLOR
|
||
|
||
// Compute a normal along which to "push" the position out, extending the miter depending on view distance.
|
||
// Position has already been "pushed" by unit length along miter normal, and miter normals are encoded in the planes.
|
||
// Decode the normal to use at this specific vertex, push the position back, and then push to where it needs to be.
|
||
vec4 positionRelativeToEye = czm_computePosition();
|
||
|
||
// Check distance to the end plane and start plane, pick the plane that is closer
|
||
vec4 positionEC = czm_modelViewRelativeToEye * positionRelativeToEye; // w = 1.0, see czm_computePosition
|
||
float absStartPlaneDistance = abs(czm_planeDistance(startPlaneEC, positionEC.xyz));
|
||
float absEndPlaneDistance = abs(czm_planeDistance(endPlaneEC, positionEC.xyz));
|
||
vec3 planeDirection = czm_branchFreeTernary(absStartPlaneDistance < absEndPlaneDistance, startPlaneEC.xyz, endPlaneEC.xyz);
|
||
vec3 upOrDown = normalize(cross(v_rightPlaneEC.xyz, planeDirection)); // Points "up" for start plane, "down" at end plane.
|
||
vec3 normalEC = normalize(cross(planeDirection, upOrDown)); // In practice, the opposite seems to work too.
|
||
|
||
// Extrude bottom vertices downward for far view distances, like for GroundPrimitives
|
||
upOrDown = cross(forwardDirectionEC, normalEC);
|
||
upOrDown = float(czm_sceneMode == czm_sceneMode3D) * upOrDown;
|
||
upOrDown = float(v_texcoordNormalizationAndStartEcYZ.y > 1.0 || v_texcoordNormalizationAndStartEcYZ.y < 0.0) * upOrDown;
|
||
upOrDown = min(GLOBE_MINIMUM_ALTITUDE, czm_geometricToleranceOverMeter * length(positionRelativeToEye.xyz)) * upOrDown;
|
||
positionEC.xyz += upOrDown;
|
||
|
||
v_texcoordNormalizationAndStartEcYZ.y = czm_branchFreeTernary(v_texcoordNormalizationAndStartEcYZ.y > 1.0, 0.0, abs(v_texcoordNormalizationAndStartEcYZ.y));
|
||
|
||
// Determine distance along normalEC to push for a volume of appropriate width.
|
||
// Make volumes about double pixel width for a conservative fit - in practice the
|
||
// extra cost here is minimal compared to the loose volume heights.
|
||
//
|
||
// N = normalEC (guaranteed "right-facing")
|
||
// R = rightEC
|
||
// p = angle between N and R
|
||
// w = distance to push along R if R == N
|
||
// d = distance to push along N
|
||
//
|
||
// N R
|
||
// { p| } * cos(p) = dot(N, R) = w / d
|
||
// d | |w * d = w / dot(N, R)
|
||
// { | }
|
||
// o---------- polyline segment ---->
|
||
//
|
||
float width = czm_batchTable_width(batchId);
|
||
#ifdef WIDTH_VARYING
|
||
v_width = width;
|
||
#endif
|
||
|
||
v_startPlaneNormalEcAndHalfWidth.xyz = startPlaneEC.xyz;
|
||
v_startPlaneNormalEcAndHalfWidth.w = width * 0.5;
|
||
|
||
v_endPlaneNormalEcAndBatchId.xyz = endPlaneEC.xyz;
|
||
v_endPlaneNormalEcAndBatchId.w = batchId;
|
||
|
||
width = width * max(0.0, czm_metersPerPixel(positionEC)); // width = distance to push along R
|
||
width = width / dot(normalEC, v_rightPlaneEC.xyz); // width = distance to push along N
|
||
|
||
// Determine if this vertex is on the "left" or "right"
|
||
#ifdef COLUMBUS_VIEW_2D
|
||
normalEC *= sign(texcoordNormalization2D.x);
|
||
#else
|
||
normalEC *= sign(endNormalAndTextureCoordinateNormalizationX.w);
|
||
#endif
|
||
|
||
positionEC.xyz += width * normalEC;
|
||
gl_Position = czm_depthClamp(czm_projection * positionEC);
|
||
|
||
#ifdef ANGLE_VARYING
|
||
// Approximate relative screen space direction of the line.
|
||
vec2 approxLineDirection = normalize(vec2(forwardDirectionEC.x, -forwardDirectionEC.y));
|
||
approxLineDirection.y = czm_branchFreeTernary(approxLineDirection.x == 0.0 && approxLineDirection.y == 0.0, -1.0, approxLineDirection.y);
|
||
v_polylineAngle = czm_fastApproximateAtan(approxLineDirection.x, approxLineDirection.y);
|
||
#endif
|
||
}
|
||
`,kOe=`attribute vec3 position3DHigh;
|
||
attribute vec3 position3DLow;
|
||
attribute vec3 position2DHigh;
|
||
attribute vec3 position2DLow;
|
||
attribute vec3 prevPosition3DHigh;
|
||
attribute vec3 prevPosition3DLow;
|
||
attribute vec3 prevPosition2DHigh;
|
||
attribute vec3 prevPosition2DLow;
|
||
attribute vec3 nextPosition3DHigh;
|
||
attribute vec3 nextPosition3DLow;
|
||
attribute vec3 nextPosition2DHigh;
|
||
attribute vec3 nextPosition2DLow;
|
||
attribute vec4 texCoordExpandAndBatchIndex;
|
||
|
||
varying vec2 v_st;
|
||
varying float v_width;
|
||
varying vec4 v_pickColor;
|
||
varying float v_polylineAngle;
|
||
|
||
void main()
|
||
{
|
||
float texCoord = texCoordExpandAndBatchIndex.x;
|
||
float expandDir = texCoordExpandAndBatchIndex.y;
|
||
bool usePrev = texCoordExpandAndBatchIndex.z < 0.0;
|
||
float batchTableIndex = texCoordExpandAndBatchIndex.w;
|
||
|
||
vec2 widthAndShow = batchTable_getWidthAndShow(batchTableIndex);
|
||
float width = widthAndShow.x + 0.5;
|
||
float show = widthAndShow.y;
|
||
|
||
if (width < 1.0)
|
||
{
|
||
show = 0.0;
|
||
}
|
||
|
||
vec4 pickColor = batchTable_getPickColor(batchTableIndex);
|
||
|
||
vec4 p, prev, next;
|
||
if (czm_morphTime == 1.0)
|
||
{
|
||
p = czm_translateRelativeToEye(position3DHigh.xyz, position3DLow.xyz);
|
||
prev = czm_translateRelativeToEye(prevPosition3DHigh.xyz, prevPosition3DLow.xyz);
|
||
next = czm_translateRelativeToEye(nextPosition3DHigh.xyz, nextPosition3DLow.xyz);
|
||
}
|
||
else if (czm_morphTime == 0.0)
|
||
{
|
||
p = czm_translateRelativeToEye(position2DHigh.zxy, position2DLow.zxy);
|
||
prev = czm_translateRelativeToEye(prevPosition2DHigh.zxy, prevPosition2DLow.zxy);
|
||
next = czm_translateRelativeToEye(nextPosition2DHigh.zxy, nextPosition2DLow.zxy);
|
||
}
|
||
else
|
||
{
|
||
p = czm_columbusViewMorph(
|
||
czm_translateRelativeToEye(position2DHigh.zxy, position2DLow.zxy),
|
||
czm_translateRelativeToEye(position3DHigh.xyz, position3DLow.xyz),
|
||
czm_morphTime);
|
||
prev = czm_columbusViewMorph(
|
||
czm_translateRelativeToEye(prevPosition2DHigh.zxy, prevPosition2DLow.zxy),
|
||
czm_translateRelativeToEye(prevPosition3DHigh.xyz, prevPosition3DLow.xyz),
|
||
czm_morphTime);
|
||
next = czm_columbusViewMorph(
|
||
czm_translateRelativeToEye(nextPosition2DHigh.zxy, nextPosition2DLow.zxy),
|
||
czm_translateRelativeToEye(nextPosition3DHigh.xyz, nextPosition3DLow.xyz),
|
||
czm_morphTime);
|
||
}
|
||
|
||
#ifdef DISTANCE_DISPLAY_CONDITION
|
||
vec3 centerHigh = batchTable_getCenterHigh(batchTableIndex);
|
||
vec4 centerLowAndRadius = batchTable_getCenterLowAndRadius(batchTableIndex);
|
||
vec3 centerLow = centerLowAndRadius.xyz;
|
||
float radius = centerLowAndRadius.w;
|
||
vec2 distanceDisplayCondition = batchTable_getDistanceDisplayCondition(batchTableIndex);
|
||
|
||
float lengthSq;
|
||
if (czm_sceneMode == czm_sceneMode2D)
|
||
{
|
||
lengthSq = czm_eyeHeight2D.y;
|
||
}
|
||
else
|
||
{
|
||
vec4 center = czm_translateRelativeToEye(centerHigh.xyz, centerLow.xyz);
|
||
lengthSq = max(0.0, dot(center.xyz, center.xyz) - radius * radius);
|
||
}
|
||
|
||
float nearSq = distanceDisplayCondition.x * distanceDisplayCondition.x;
|
||
float farSq = distanceDisplayCondition.y * distanceDisplayCondition.y;
|
||
if (lengthSq < nearSq || lengthSq > farSq)
|
||
{
|
||
show = 0.0;
|
||
}
|
||
#endif
|
||
|
||
float polylineAngle;
|
||
vec4 positionWC = getPolylineWindowCoordinates(p, prev, next, expandDir, width, usePrev, polylineAngle);
|
||
gl_Position = czm_viewportOrthographic * positionWC * show;
|
||
|
||
v_st.s = texCoord;
|
||
v_st.t = czm_writeNonPerspective(clamp(expandDir, 0.0, 1.0), gl_Position.w);
|
||
|
||
v_width = width;
|
||
v_pickColor = pickColor;
|
||
v_polylineAngle = polylineAngle;
|
||
}
|
||
`,GOe=`uniform sampler2D u_texture;
|
||
|
||
varying vec2 v_textureCoordinates;
|
||
|
||
void main()
|
||
{
|
||
gl_FragColor = texture2D(u_texture, v_textureCoordinates);
|
||
}
|
||
`,WOe=`attribute vec4 position;
|
||
attribute float webMercatorT;
|
||
|
||
uniform vec2 u_textureDimensions;
|
||
|
||
varying vec2 v_textureCoordinates;
|
||
|
||
void main()
|
||
{
|
||
v_textureCoordinates = vec2(position.x, webMercatorT);
|
||
gl_Position = czm_viewportOrthographic * (position * vec4(u_textureDimensions, 1.0, 1.0));
|
||
}
|
||
`,KK=`#ifdef GL_EXT_frag_depth
|
||
#extension GL_EXT_frag_depth : enable
|
||
#endif
|
||
|
||
#ifdef TEXTURE_COORDINATES
|
||
#ifdef SPHERICAL
|
||
varying vec4 v_sphericalExtents;
|
||
#else // SPHERICAL
|
||
varying vec2 v_inversePlaneExtents;
|
||
varying vec4 v_westPlane;
|
||
varying vec4 v_southPlane;
|
||
#endif // SPHERICAL
|
||
varying vec3 v_uvMinAndSphericalLongitudeRotation;
|
||
varying vec3 v_uMaxAndInverseDistance;
|
||
varying vec3 v_vMaxAndInverseDistance;
|
||
#endif // TEXTURE_COORDINATES
|
||
|
||
#ifdef PER_INSTANCE_COLOR
|
||
varying vec4 v_color;
|
||
#endif
|
||
|
||
#ifdef NORMAL_EC
|
||
vec3 getEyeCoordinate3FromWindowCoordinate(vec2 fragCoord, float logDepthOrDepth) {
|
||
vec4 eyeCoordinate = czm_windowToEyeCoordinates(fragCoord, logDepthOrDepth);
|
||
return eyeCoordinate.xyz / eyeCoordinate.w;
|
||
}
|
||
|
||
vec3 vectorFromOffset(vec4 eyeCoordinate, vec2 positiveOffset) {
|
||
vec2 glFragCoordXY = gl_FragCoord.xy;
|
||
// Sample depths at both offset and negative offset
|
||
float upOrRightLogDepth = czm_unpackDepth(texture2D(czm_globeDepthTexture, (glFragCoordXY + positiveOffset) / czm_viewport.zw));
|
||
float downOrLeftLogDepth = czm_unpackDepth(texture2D(czm_globeDepthTexture, (glFragCoordXY - positiveOffset) / czm_viewport.zw));
|
||
// Explicitly evaluate both paths
|
||
// Necessary for multifrustum and for edges of the screen
|
||
bvec2 upOrRightInBounds = lessThan(glFragCoordXY + positiveOffset, czm_viewport.zw);
|
||
float useUpOrRight = float(upOrRightLogDepth > 0.0 && upOrRightInBounds.x && upOrRightInBounds.y);
|
||
float useDownOrLeft = float(useUpOrRight == 0.0);
|
||
vec3 upOrRightEC = getEyeCoordinate3FromWindowCoordinate(glFragCoordXY + positiveOffset, upOrRightLogDepth);
|
||
vec3 downOrLeftEC = getEyeCoordinate3FromWindowCoordinate(glFragCoordXY - positiveOffset, downOrLeftLogDepth);
|
||
return (upOrRightEC - (eyeCoordinate.xyz / eyeCoordinate.w)) * useUpOrRight + ((eyeCoordinate.xyz / eyeCoordinate.w) - downOrLeftEC) * useDownOrLeft;
|
||
}
|
||
#endif // NORMAL_EC
|
||
|
||
void main(void)
|
||
{
|
||
#ifdef REQUIRES_EC
|
||
float logDepthOrDepth = czm_unpackDepth(texture2D(czm_globeDepthTexture, gl_FragCoord.xy / czm_viewport.zw));
|
||
vec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, logDepthOrDepth);
|
||
#endif
|
||
|
||
#ifdef REQUIRES_WC
|
||
vec4 worldCoordinate4 = czm_inverseView * eyeCoordinate;
|
||
vec3 worldCoordinate = worldCoordinate4.xyz / worldCoordinate4.w;
|
||
#endif
|
||
|
||
#ifdef TEXTURE_COORDINATES
|
||
vec2 uv;
|
||
#ifdef SPHERICAL
|
||
// Treat world coords as a sphere normal for spherical coordinates
|
||
vec2 sphericalLatLong = czm_approximateSphericalCoordinates(worldCoordinate);
|
||
sphericalLatLong.y += v_uvMinAndSphericalLongitudeRotation.z;
|
||
sphericalLatLong.y = czm_branchFreeTernary(sphericalLatLong.y < czm_pi, sphericalLatLong.y, sphericalLatLong.y - czm_twoPi);
|
||
uv.x = (sphericalLatLong.y - v_sphericalExtents.y) * v_sphericalExtents.w;
|
||
uv.y = (sphericalLatLong.x - v_sphericalExtents.x) * v_sphericalExtents.z;
|
||
#else // SPHERICAL
|
||
// Unpack planes and transform to eye space
|
||
uv.x = czm_planeDistance(v_westPlane, eyeCoordinate.xyz / eyeCoordinate.w) * v_inversePlaneExtents.x;
|
||
uv.y = czm_planeDistance(v_southPlane, eyeCoordinate.xyz / eyeCoordinate.w) * v_inversePlaneExtents.y;
|
||
#endif // SPHERICAL
|
||
#endif // TEXTURE_COORDINATES
|
||
|
||
#ifdef PICK
|
||
#ifdef CULL_FRAGMENTS
|
||
// When classifying translucent geometry, logDepthOrDepth == 0.0
|
||
// indicates a region that should not be classified, possibly due to there
|
||
// being opaque pixels there in another buffer.
|
||
// Check for logDepthOrDepth != 0.0 to make sure this should be classified.
|
||
if (0.0 <= uv.x && uv.x <= 1.0 && 0.0 <= uv.y && uv.y <= 1.0 || logDepthOrDepth != 0.0) {
|
||
gl_FragColor.a = 1.0; // 0.0 alpha leads to discard from ShaderSource.createPickFragmentShaderSource
|
||
czm_writeDepthClamp();
|
||
}
|
||
#else // CULL_FRAGMENTS
|
||
gl_FragColor.a = 1.0;
|
||
#endif // CULL_FRAGMENTS
|
||
#else // PICK
|
||
|
||
#ifdef CULL_FRAGMENTS
|
||
// When classifying translucent geometry, logDepthOrDepth == 0.0
|
||
// indicates a region that should not be classified, possibly due to there
|
||
// being opaque pixels there in another buffer.
|
||
if (uv.x <= 0.0 || 1.0 <= uv.x || uv.y <= 0.0 || 1.0 <= uv.y || logDepthOrDepth == 0.0) {
|
||
discard;
|
||
}
|
||
#endif
|
||
|
||
#ifdef NORMAL_EC
|
||
// Compute normal by sampling adjacent pixels in 2x2 block in screen space
|
||
vec3 downUp = vectorFromOffset(eyeCoordinate, vec2(0.0, 1.0));
|
||
vec3 leftRight = vectorFromOffset(eyeCoordinate, vec2(1.0, 0.0));
|
||
vec3 normalEC = normalize(cross(leftRight, downUp));
|
||
#endif
|
||
|
||
|
||
#ifdef PER_INSTANCE_COLOR
|
||
|
||
vec4 color = czm_gammaCorrect(v_color);
|
||
#ifdef FLAT
|
||
gl_FragColor = color;
|
||
#else // FLAT
|
||
czm_materialInput materialInput;
|
||
materialInput.normalEC = normalEC;
|
||
materialInput.positionToEyeEC = -eyeCoordinate.xyz;
|
||
czm_material material = czm_getDefaultMaterial(materialInput);
|
||
material.diffuse = color.rgb;
|
||
material.alpha = color.a;
|
||
|
||
gl_FragColor = czm_phong(normalize(-eyeCoordinate.xyz), material, czm_lightDirectionEC);
|
||
#endif // FLAT
|
||
|
||
// Premultiply alpha. Required for classification primitives on translucent globe.
|
||
gl_FragColor.rgb *= gl_FragColor.a;
|
||
|
||
#else // PER_INSTANCE_COLOR
|
||
|
||
// Material support.
|
||
// USES_ is distinct from REQUIRES_, because some things are dependencies of each other or
|
||
// dependencies for culling but might not actually be used by the material.
|
||
|
||
czm_materialInput materialInput;
|
||
|
||
#ifdef USES_NORMAL_EC
|
||
materialInput.normalEC = normalEC;
|
||
#endif
|
||
|
||
#ifdef USES_POSITION_TO_EYE_EC
|
||
materialInput.positionToEyeEC = -eyeCoordinate.xyz;
|
||
#endif
|
||
|
||
#ifdef USES_TANGENT_TO_EYE
|
||
materialInput.tangentToEyeMatrix = czm_eastNorthUpToEyeCoordinates(worldCoordinate, normalEC);
|
||
#endif
|
||
|
||
#ifdef USES_ST
|
||
// Remap texture coordinates from computed (approximately aligned with cartographic space) to the desired
|
||
// texture coordinate system, which typically forms a tight oriented bounding box around the geometry.
|
||
// Shader is provided a set of reference points for remapping.
|
||
materialInput.st.x = czm_lineDistance(v_uvMinAndSphericalLongitudeRotation.xy, v_uMaxAndInverseDistance.xy, uv) * v_uMaxAndInverseDistance.z;
|
||
materialInput.st.y = czm_lineDistance(v_uvMinAndSphericalLongitudeRotation.xy, v_vMaxAndInverseDistance.xy, uv) * v_vMaxAndInverseDistance.z;
|
||
#endif
|
||
|
||
czm_material material = czm_getMaterial(materialInput);
|
||
|
||
#ifdef FLAT
|
||
gl_FragColor = vec4(material.diffuse + material.emission, material.alpha);
|
||
#else // FLAT
|
||
gl_FragColor = czm_phong(normalize(-eyeCoordinate.xyz), material, czm_lightDirectionEC);
|
||
#endif // FLAT
|
||
|
||
// Premultiply alpha. Required for classification primitives on translucent globe.
|
||
gl_FragColor.rgb *= gl_FragColor.a;
|
||
|
||
#endif // PER_INSTANCE_COLOR
|
||
czm_writeDepthClamp();
|
||
#endif // PICK
|
||
}
|
||
`,qOe=`attribute vec3 position3DHigh;
|
||
attribute vec3 position3DLow;
|
||
attribute float batchId;
|
||
|
||
#ifdef EXTRUDED_GEOMETRY
|
||
attribute vec3 extrudeDirection;
|
||
|
||
uniform float u_globeMinimumAltitude;
|
||
#endif // EXTRUDED_GEOMETRY
|
||
|
||
#ifdef PER_INSTANCE_COLOR
|
||
varying vec4 v_color;
|
||
#endif // PER_INSTANCE_COLOR
|
||
|
||
#ifdef TEXTURE_COORDINATES
|
||
#ifdef SPHERICAL
|
||
varying vec4 v_sphericalExtents;
|
||
#else // SPHERICAL
|
||
varying vec2 v_inversePlaneExtents;
|
||
varying vec4 v_westPlane;
|
||
varying vec4 v_southPlane;
|
||
#endif // SPHERICAL
|
||
varying vec3 v_uvMinAndSphericalLongitudeRotation;
|
||
varying vec3 v_uMaxAndInverseDistance;
|
||
varying vec3 v_vMaxAndInverseDistance;
|
||
#endif // TEXTURE_COORDINATES
|
||
|
||
void main()
|
||
{
|
||
vec4 position = czm_computePosition();
|
||
|
||
#ifdef EXTRUDED_GEOMETRY
|
||
float delta = min(u_globeMinimumAltitude, czm_geometricToleranceOverMeter * length(position.xyz));
|
||
delta *= czm_sceneMode == czm_sceneMode3D ? 1.0 : 0.0;
|
||
|
||
//extrudeDirection is zero for the top layer
|
||
position = position + vec4(extrudeDirection * delta, 0.0);
|
||
#endif
|
||
|
||
#ifdef TEXTURE_COORDINATES
|
||
#ifdef SPHERICAL
|
||
v_sphericalExtents = czm_batchTable_sphericalExtents(batchId);
|
||
v_uvMinAndSphericalLongitudeRotation.z = czm_batchTable_longitudeRotation(batchId);
|
||
#else // SPHERICAL
|
||
#ifdef COLUMBUS_VIEW_2D
|
||
vec4 planes2D_high = czm_batchTable_planes2D_HIGH(batchId);
|
||
vec4 planes2D_low = czm_batchTable_planes2D_LOW(batchId);
|
||
|
||
// If the primitive is split across the IDL (planes2D_high.x > planes2D_high.w):
|
||
// - If this vertex is on the east side of the IDL (position3DLow.y > 0.0, comparison with position3DHigh may produce artifacts)
|
||
// - existing "east" is on the wrong side of the world, far away (planes2D_high/low.w)
|
||
// - so set "east" as beyond the eastmost extent of the projection (idlSplitNewPlaneHiLow)
|
||
vec2 idlSplitNewPlaneHiLow = vec2(EAST_MOST_X_HIGH - (WEST_MOST_X_HIGH - planes2D_high.w), EAST_MOST_X_LOW - (WEST_MOST_X_LOW - planes2D_low.w));
|
||
bool idlSplit = planes2D_high.x > planes2D_high.w && position3DLow.y > 0.0;
|
||
planes2D_high.w = czm_branchFreeTernary(idlSplit, idlSplitNewPlaneHiLow.x, planes2D_high.w);
|
||
planes2D_low.w = czm_branchFreeTernary(idlSplit, idlSplitNewPlaneHiLow.y, planes2D_low.w);
|
||
|
||
// - else, if this vertex is on the west side of the IDL (position3DLow.y < 0.0)
|
||
// - existing "west" is on the wrong side of the world, far away (planes2D_high/low.x)
|
||
// - so set "west" as beyond the westmost extent of the projection (idlSplitNewPlaneHiLow)
|
||
idlSplit = planes2D_high.x > planes2D_high.w && position3DLow.y < 0.0;
|
||
idlSplitNewPlaneHiLow = vec2(WEST_MOST_X_HIGH - (EAST_MOST_X_HIGH - planes2D_high.x), WEST_MOST_X_LOW - (EAST_MOST_X_LOW - planes2D_low.x));
|
||
planes2D_high.x = czm_branchFreeTernary(idlSplit, idlSplitNewPlaneHiLow.x, planes2D_high.x);
|
||
planes2D_low.x = czm_branchFreeTernary(idlSplit, idlSplitNewPlaneHiLow.y, planes2D_low.x);
|
||
|
||
vec3 southWestCorner = (czm_modelViewRelativeToEye * czm_translateRelativeToEye(vec3(0.0, planes2D_high.xy), vec3(0.0, planes2D_low.xy))).xyz;
|
||
vec3 northWestCorner = (czm_modelViewRelativeToEye * czm_translateRelativeToEye(vec3(0.0, planes2D_high.x, planes2D_high.z), vec3(0.0, planes2D_low.x, planes2D_low.z))).xyz;
|
||
vec3 southEastCorner = (czm_modelViewRelativeToEye * czm_translateRelativeToEye(vec3(0.0, planes2D_high.w, planes2D_high.y), vec3(0.0, planes2D_low.w, planes2D_low.y))).xyz;
|
||
#else // COLUMBUS_VIEW_2D
|
||
// 3D case has smaller "plane extents," so planes encoded as a 64 bit position and 2 vec3s for distances/direction
|
||
vec3 southWestCorner = (czm_modelViewRelativeToEye * czm_translateRelativeToEye(czm_batchTable_southWest_HIGH(batchId), czm_batchTable_southWest_LOW(batchId))).xyz;
|
||
vec3 northWestCorner = czm_normal * czm_batchTable_northward(batchId) + southWestCorner;
|
||
vec3 southEastCorner = czm_normal * czm_batchTable_eastward(batchId) + southWestCorner;
|
||
#endif // COLUMBUS_VIEW_2D
|
||
|
||
vec3 eastWard = southEastCorner - southWestCorner;
|
||
float eastExtent = length(eastWard);
|
||
eastWard /= eastExtent;
|
||
|
||
vec3 northWard = northWestCorner - southWestCorner;
|
||
float northExtent = length(northWard);
|
||
northWard /= northExtent;
|
||
|
||
v_westPlane = vec4(eastWard, -dot(eastWard, southWestCorner));
|
||
v_southPlane = vec4(northWard, -dot(northWard, southWestCorner));
|
||
v_inversePlaneExtents = vec2(1.0 / eastExtent, 1.0 / northExtent);
|
||
#endif // SPHERICAL
|
||
vec4 uvMinAndExtents = czm_batchTable_uvMinAndExtents(batchId);
|
||
vec4 uMaxVmax = czm_batchTable_uMaxVmax(batchId);
|
||
|
||
v_uMaxAndInverseDistance = vec3(uMaxVmax.xy, uvMinAndExtents.z);
|
||
v_vMaxAndInverseDistance = vec3(uMaxVmax.zw, uvMinAndExtents.w);
|
||
v_uvMinAndSphericalLongitudeRotation.xy = uvMinAndExtents.xy;
|
||
#endif // TEXTURE_COORDINATES
|
||
|
||
#ifdef PER_INSTANCE_COLOR
|
||
v_color = czm_batchTable_color(batchId);
|
||
#endif
|
||
|
||
gl_Position = czm_depthClamp(czm_modelViewProjectionRelativeToEye * position);
|
||
}
|
||
`,YM=`#ifdef GL_EXT_frag_depth
|
||
#extension GL_EXT_frag_depth : enable
|
||
#endif
|
||
|
||
#ifdef VECTOR_TILE
|
||
uniform vec4 u_highlightColor;
|
||
#endif
|
||
|
||
void main(void)
|
||
{
|
||
#ifdef VECTOR_TILE
|
||
gl_FragColor = czm_gammaCorrect(u_highlightColor);
|
||
#else
|
||
gl_FragColor = vec4(1.0);
|
||
#endif
|
||
czm_writeDepthClamp();
|
||
}
|
||
`,N5=`float interpolateByDistance(vec4 nearFarScalar, float distance)
|
||
{
|
||
float startDistance = nearFarScalar.x;
|
||
float startValue = nearFarScalar.y;
|
||
float endDistance = nearFarScalar.z;
|
||
float endValue = nearFarScalar.w;
|
||
float t = clamp((distance - startDistance) / (endDistance - startDistance), 0.0, 1.0);
|
||
return mix(startValue, endValue, t);
|
||
}
|
||
|
||
vec3 getLightDirection(vec3 positionWC)
|
||
{
|
||
float lightEnum = u_radiiAndDynamicAtmosphereColor.z;
|
||
vec3 lightDirection =
|
||
positionWC * float(lightEnum == 0.0) +
|
||
czm_lightDirectionWC * float(lightEnum == 1.0) +
|
||
czm_sunDirectionWC * float(lightEnum == 2.0);
|
||
return normalize(lightDirection);
|
||
}
|
||
|
||
void computeAtmosphereScattering(vec3 positionWC, vec3 lightDirection, out vec3 rayleighColor, out vec3 mieColor, out float opacity, out float underTranslucentGlobe)
|
||
{
|
||
float ellipsoidRadiiDifference = czm_ellipsoidRadii.x - czm_ellipsoidRadii.z;
|
||
|
||
// Adjustment to the atmosphere radius applied based on the camera height.
|
||
float distanceAdjustMin = czm_ellipsoidRadii.x / 4.0;
|
||
float distanceAdjustMax = czm_ellipsoidRadii.x;
|
||
float distanceAdjustModifier = ellipsoidRadiiDifference / 2.0;
|
||
float distanceAdjust = distanceAdjustModifier * clamp((czm_eyeHeight - distanceAdjustMin) / (distanceAdjustMax - distanceAdjustMin), 0.0, 1.0);
|
||
|
||
// Since atmosphere scattering assumes the atmosphere is a spherical shell, we compute an inner radius of the atmosphere best fit
|
||
// for the position on the ellipsoid.
|
||
float radiusAdjust = (ellipsoidRadiiDifference / 4.0) + distanceAdjust;
|
||
float atmosphereInnerRadius = (length(czm_viewerPositionWC) - czm_eyeHeight) - radiusAdjust;
|
||
|
||
// Setup the primary ray: from the camera position to the vertex position.
|
||
vec3 cameraToPositionWC = positionWC - czm_viewerPositionWC;
|
||
vec3 cameraToPositionWCDirection = normalize(cameraToPositionWC);
|
||
czm_ray primaryRay = czm_ray(czm_viewerPositionWC, cameraToPositionWCDirection);
|
||
|
||
underTranslucentGlobe = 0.0;
|
||
|
||
// Brighten the sky atmosphere under the Earth's atmosphere when translucency is enabled.
|
||
#if defined(GLOBE_TRANSLUCENT)
|
||
|
||
// Check for intersection with the inner radius of the atmopshere.
|
||
czm_raySegment primaryRayEarthIntersect = czm_raySphereIntersectionInterval(primaryRay, vec3(0.0), atmosphereInnerRadius + radiusAdjust);
|
||
if (primaryRayEarthIntersect.start > 0.0 && primaryRayEarthIntersect.stop > 0.0) {
|
||
|
||
// Compute position on globe.
|
||
vec3 direction = normalize(positionWC);
|
||
czm_ray ellipsoidRay = czm_ray(positionWC, -direction);
|
||
czm_raySegment ellipsoidIntersection = czm_rayEllipsoidIntersectionInterval(ellipsoidRay, vec3(0.0), czm_ellipsoidInverseRadii);
|
||
vec3 onEarth = positionWC - (direction * ellipsoidIntersection.start);
|
||
|
||
// Control the color using the camera angle.
|
||
float angle = dot(normalize(czm_viewerPositionWC), normalize(onEarth));
|
||
|
||
// Control the opacity using the distance from Earth.
|
||
opacity = interpolateByDistance(vec4(0.0, 1.0, czm_ellipsoidRadii.x, 0.0), length(czm_viewerPositionWC - onEarth));
|
||
vec3 horizonColor = vec3(0.1, 0.2, 0.3);
|
||
vec3 nearColor = vec3(0.0);
|
||
|
||
rayleighColor = mix(nearColor, horizonColor, exp(-angle) * opacity);
|
||
|
||
// Set the traslucent flag to avoid alpha adjustment in computeFinalColor funciton.
|
||
underTranslucentGlobe = 1.0;
|
||
return;
|
||
}
|
||
#endif
|
||
|
||
computeScattering(
|
||
primaryRay,
|
||
length(cameraToPositionWC),
|
||
lightDirection,
|
||
atmosphereInnerRadius,
|
||
rayleighColor,
|
||
mieColor,
|
||
opacity
|
||
);
|
||
|
||
// Alter the opacity based on how close the viewer is to the ground.
|
||
// (0.0 = At edge of atmosphere, 1.0 = On ground)
|
||
float cameraHeight = czm_eyeHeight + atmosphereInnerRadius;
|
||
float atmosphereOuterRadius = atmosphereInnerRadius + ATMOSPHERE_THICKNESS;
|
||
opacity = clamp((atmosphereOuterRadius - cameraHeight) / (atmosphereOuterRadius - atmosphereInnerRadius), 0.0, 1.0);
|
||
|
||
// Alter alpha based on time of day (0.0 = night , 1.0 = day)
|
||
float nightAlpha = (u_radiiAndDynamicAtmosphereColor.z != 0.0) ? clamp(dot(normalize(positionWC), lightDirection), 0.0, 1.0) : 1.0;
|
||
opacity *= pow(nightAlpha, 0.5);
|
||
}
|
||
`,jOe=`varying vec3 v_outerPositionWC;
|
||
|
||
uniform vec3 u_hsbShift;
|
||
|
||
#ifndef PER_FRAGMENT_ATMOSPHERE
|
||
varying vec3 v_mieColor;
|
||
varying vec3 v_rayleighColor;
|
||
varying float v_opacity;
|
||
varying float v_translucent;
|
||
#endif
|
||
|
||
void main (void)
|
||
{
|
||
vec3 lightDirection = getLightDirection(v_outerPositionWC);
|
||
|
||
vec3 mieColor;
|
||
vec3 rayleighColor;
|
||
float opacity;
|
||
float translucent;
|
||
|
||
#ifdef PER_FRAGMENT_ATMOSPHERE
|
||
computeAtmosphereScattering(
|
||
v_outerPositionWC,
|
||
lightDirection,
|
||
rayleighColor,
|
||
mieColor,
|
||
opacity,
|
||
translucent
|
||
);
|
||
#else
|
||
mieColor = v_mieColor;
|
||
rayleighColor = v_rayleighColor;
|
||
opacity = v_opacity;
|
||
translucent = v_translucent;
|
||
#endif
|
||
|
||
vec4 color = computeAtmosphereColor(v_outerPositionWC, lightDirection, rayleighColor, mieColor, opacity);
|
||
|
||
#ifndef HDR
|
||
color.rgb = czm_acesTonemapping(color.rgb);
|
||
color.rgb = czm_inverseGamma(color.rgb);
|
||
#endif
|
||
|
||
#ifdef COLOR_CORRECT
|
||
// Convert rgb color to hsb
|
||
vec3 hsb = czm_RGBToHSB(color.rgb);
|
||
// Perform hsb shift
|
||
hsb.x += u_hsbShift.x; // hue
|
||
hsb.y = clamp(hsb.y + u_hsbShift.y, 0.0, 1.0); // saturation
|
||
hsb.z = hsb.z > czm_epsilon7 ? hsb.z + u_hsbShift.z : 0.0; // brightness
|
||
// Convert shifted hsb back to rgb
|
||
color.rgb = czm_HSBToRGB(hsb);
|
||
#endif
|
||
|
||
// For the parts of the sky atmosphere that are not behind a translucent globe,
|
||
// we mix in the default opacity so that the sky atmosphere still appears at distance.
|
||
// This is needed because the opacity in the sky atmosphere is initially adjusted based
|
||
// on the camera height.
|
||
if (translucent == 0.0) {
|
||
color.a = mix(color.b, 1.0, color.a) * smoothstep(0.0, 1.0, czm_morphTime);
|
||
}
|
||
|
||
gl_FragColor = color;
|
||
}
|
||
`,YOe=`attribute vec4 position;
|
||
|
||
varying vec3 v_outerPositionWC;
|
||
|
||
#ifndef PER_FRAGMENT_ATMOSPHERE
|
||
varying vec3 v_mieColor;
|
||
varying vec3 v_rayleighColor;
|
||
varying float v_opacity;
|
||
varying float v_translucent;
|
||
#endif
|
||
|
||
void main(void)
|
||
{
|
||
vec4 positionWC = czm_model * position;
|
||
vec3 lightDirection = getLightDirection(positionWC.xyz);
|
||
|
||
#ifndef PER_FRAGMENT_ATMOSPHERE
|
||
computeAtmosphereScattering(
|
||
positionWC.xyz,
|
||
lightDirection,
|
||
v_rayleighColor,
|
||
v_mieColor,
|
||
v_opacity,
|
||
v_translucent
|
||
);
|
||
#endif
|
||
|
||
v_outerPositionWC = positionWC.xyz;
|
||
gl_Position = czm_modelViewProjection * position;
|
||
}
|
||
`,$Oe=`uniform samplerCube u_cubeMap;
|
||
|
||
varying vec3 v_texCoord;
|
||
|
||
void main()
|
||
{
|
||
vec4 color = textureCube(u_cubeMap, normalize(v_texCoord));
|
||
gl_FragColor = vec4(czm_gammaCorrect(color).rgb, czm_morphTime);
|
||
}
|
||
`,XOe=`attribute vec3 position;
|
||
|
||
varying vec3 v_texCoord;
|
||
|
||
void main()
|
||
{
|
||
vec3 p = czm_viewRotation * (czm_temeToPseudoFixed * (czm_entireFrustum.y * position));
|
||
gl_Position = czm_projection * vec4(p, 1.0);
|
||
v_texCoord = position.xyz;
|
||
}
|
||
`,KOe=`uniform sampler2D u_texture;
|
||
|
||
varying vec2 v_textureCoordinates;
|
||
|
||
void main()
|
||
{
|
||
vec4 color = texture2D(u_texture, v_textureCoordinates);
|
||
gl_FragColor = czm_gammaCorrect(color);
|
||
}
|
||
`,JOe=`uniform float u_radiusTS;
|
||
|
||
varying vec2 v_textureCoordinates;
|
||
|
||
vec2 rotate(vec2 p, vec2 direction)
|
||
{
|
||
return vec2(p.x * direction.x - p.y * direction.y, p.x * direction.y + p.y * direction.x);
|
||
}
|
||
|
||
vec4 addBurst(vec2 position, vec2 direction, float lengthScalar)
|
||
{
|
||
vec2 rotatedPosition = rotate(position, direction) * vec2(25.0, 0.75);
|
||
float radius = length(rotatedPosition) * lengthScalar;
|
||
float burst = 1.0 - smoothstep(0.0, 0.55, radius);
|
||
return vec4(burst);
|
||
}
|
||
|
||
void main()
|
||
{
|
||
float lengthScalar = 2.0 / sqrt(2.0);
|
||
vec2 position = v_textureCoordinates - vec2(0.5);
|
||
float radius = length(position) * lengthScalar;
|
||
float surface = step(radius, u_radiusTS);
|
||
vec4 color = vec4(vec2(1.0), surface + 0.2, surface);
|
||
|
||
float glow = 1.0 - smoothstep(0.0, 0.55, radius);
|
||
color.ba += mix(vec2(0.0), vec2(1.0), glow) * 0.75;
|
||
|
||
vec4 burst = vec4(0.0);
|
||
|
||
// The following loop has been manually unrolled for speed, to
|
||
// avoid sin() and cos().
|
||
//
|
||
//for (float i = 0.4; i < 3.2; i += 1.047) {
|
||
// vec2 direction = vec2(sin(i), cos(i));
|
||
// burst += 0.4 * addBurst(position, direction, lengthScalar);
|
||
//
|
||
// direction = vec2(sin(i - 0.08), cos(i - 0.08));
|
||
// burst += 0.3 * addBurst(position, direction, lengthScalar);
|
||
//}
|
||
|
||
burst += 0.4 * addBurst(position, vec2(0.38942, 0.92106), lengthScalar); // angle == 0.4
|
||
burst += 0.4 * addBurst(position, vec2(0.99235, 0.12348), lengthScalar); // angle == 0.4 + 1.047
|
||
burst += 0.4 * addBurst(position, vec2(0.60327, -0.79754), lengthScalar); // angle == 0.4 + 1.047 * 2.0
|
||
|
||
burst += 0.3 * addBurst(position, vec2(0.31457, 0.94924), lengthScalar); // angle == 0.4 - 0.08
|
||
burst += 0.3 * addBurst(position, vec2(0.97931, 0.20239), lengthScalar); // angle == 0.4 + 1.047 - 0.08
|
||
burst += 0.3 * addBurst(position, vec2(0.66507, -0.74678), lengthScalar); // angle == 0.4 + 1.047 * 2.0 - 0.08
|
||
|
||
// End of manual loop unrolling.
|
||
|
||
color += clamp(burst, vec4(0.0), vec4(1.0)) * 0.15;
|
||
|
||
gl_FragColor = clamp(color, vec4(0.0), vec4(1.0));
|
||
}
|
||
`,QOe=`attribute vec2 direction;
|
||
|
||
uniform float u_size;
|
||
|
||
varying vec2 v_textureCoordinates;
|
||
|
||
void main()
|
||
{
|
||
vec4 position;
|
||
if (czm_morphTime == 1.0)
|
||
{
|
||
position = vec4(czm_sunPositionWC, 1.0);
|
||
}
|
||
else
|
||
{
|
||
position = vec4(czm_sunPositionColumbusView.zxy, 1.0);
|
||
}
|
||
|
||
vec4 positionEC = czm_view * position;
|
||
vec4 positionWC = czm_eyeToWindowCoordinates(positionEC);
|
||
|
||
vec2 halfSize = vec2(u_size * 0.5);
|
||
halfSize *= ((direction * 2.0) - 1.0);
|
||
|
||
gl_Position = czm_viewportOrthographic * vec4(positionWC.xy + halfSize, -positionWC.z, 1.0);
|
||
|
||
v_textureCoordinates = direction;
|
||
}
|
||
`,ZOe=`#ifdef GL_EXT_frag_depth
|
||
#extension GL_EXT_frag_depth : enable
|
||
#endif
|
||
|
||
varying vec4 v_startPlaneEC;
|
||
varying vec4 v_endPlaneEC;
|
||
varying vec4 v_rightPlaneEC;
|
||
varying float v_halfWidth;
|
||
varying vec3 v_volumeUpEC;
|
||
|
||
uniform vec4 u_highlightColor;
|
||
void main()
|
||
{
|
||
float logDepthOrDepth = czm_branchFreeTernary(czm_sceneMode == czm_sceneMode2D, gl_FragCoord.z, czm_unpackDepth(texture2D(czm_globeDepthTexture, gl_FragCoord.xy / czm_viewport.zw)));
|
||
|
||
// Discard for sky
|
||
if (logDepthOrDepth == 0.0) {
|
||
#ifdef DEBUG_SHOW_VOLUME
|
||
gl_FragColor = vec4(0.0, 0.0, 1.0, 0.5);
|
||
return;
|
||
#else // DEBUG_SHOW_VOLUME
|
||
discard;
|
||
#endif // DEBUG_SHOW_VOLUME
|
||
}
|
||
|
||
vec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, logDepthOrDepth);
|
||
eyeCoordinate /= eyeCoordinate.w;
|
||
|
||
float halfMaxWidth = v_halfWidth * czm_metersPerPixel(eyeCoordinate);
|
||
|
||
// Expand halfMaxWidth if direction to camera is almost perpendicular with the volume's up direction
|
||
halfMaxWidth += halfMaxWidth * (1.0 - dot(-normalize(eyeCoordinate.xyz), v_volumeUpEC));
|
||
|
||
// Check distance of the eye coordinate against the right-facing plane
|
||
float widthwiseDistance = czm_planeDistance(v_rightPlaneEC, eyeCoordinate.xyz);
|
||
|
||
// Check eye coordinate against the mitering planes
|
||
float distanceFromStart = czm_planeDistance(v_startPlaneEC, eyeCoordinate.xyz);
|
||
float distanceFromEnd = czm_planeDistance(v_endPlaneEC, eyeCoordinate.xyz);
|
||
|
||
if (abs(widthwiseDistance) > halfMaxWidth || distanceFromStart < 0.0 || distanceFromEnd < 0.0) {
|
||
#ifdef DEBUG_SHOW_VOLUME
|
||
gl_FragColor = vec4(logDepthOrDepth, 0.0, 0.0, 0.5);
|
||
return;
|
||
#else // DEBUG_SHOW_VOLUME
|
||
discard;
|
||
#endif // DEBUG_SHOW_VOLUME
|
||
}
|
||
gl_FragColor = u_highlightColor;
|
||
|
||
czm_writeDepthClamp();
|
||
}
|
||
`,eLe=`attribute vec3 startEllipsoidNormal;
|
||
attribute vec3 endEllipsoidNormal;
|
||
attribute vec4 startPositionAndHeight;
|
||
attribute vec4 endPositionAndHeight;
|
||
attribute vec4 startFaceNormalAndVertexCorner;
|
||
attribute vec4 endFaceNormalAndHalfWidth;
|
||
attribute float a_batchId;
|
||
|
||
uniform mat4 u_modifiedModelView;
|
||
uniform vec2 u_minimumMaximumVectorHeights;
|
||
|
||
varying vec4 v_startPlaneEC;
|
||
varying vec4 v_endPlaneEC;
|
||
varying vec4 v_rightPlaneEC;
|
||
varying float v_halfWidth;
|
||
varying vec3 v_volumeUpEC;
|
||
|
||
void main()
|
||
{
|
||
// vertex corner IDs
|
||
// 3-----------7
|
||
// /| left /|
|
||
// / | 1 / |
|
||
// 2-----------6 5 end
|
||
// | / | /
|
||
// start |/ right |/
|
||
// 0-----------4
|
||
//
|
||
float isEnd = floor(startFaceNormalAndVertexCorner.w * 0.251); // 0 for front, 1 for end
|
||
float isTop = floor(startFaceNormalAndVertexCorner.w * mix(0.51, 0.19, isEnd)); // 0 for bottom, 1 for top
|
||
|
||
vec3 forward = endPositionAndHeight.xyz - startPositionAndHeight.xyz;
|
||
vec3 right = normalize(cross(forward, startEllipsoidNormal));
|
||
|
||
vec4 position = vec4(startPositionAndHeight.xyz, 1.0);
|
||
position.xyz += forward * isEnd;
|
||
|
||
v_volumeUpEC = czm_normal * normalize(cross(right, forward));
|
||
|
||
// Push for volume height
|
||
float offset;
|
||
vec3 ellipsoidNormal = mix(startEllipsoidNormal, endEllipsoidNormal, isEnd);
|
||
|
||
// offset height to create volume
|
||
offset = mix(startPositionAndHeight.w, endPositionAndHeight.w, isEnd);
|
||
offset = mix(u_minimumMaximumVectorHeights.y, u_minimumMaximumVectorHeights.x, isTop) - offset;
|
||
position.xyz += offset * ellipsoidNormal;
|
||
|
||
// move from RTC to EC
|
||
position = u_modifiedModelView * position;
|
||
right = czm_normal * right;
|
||
|
||
// Push for width in a direction that is in the start or end plane and in a plane with right
|
||
// N = normalEC ("right-facing" direction for push)
|
||
// R = right
|
||
// p = angle between N and R
|
||
// w = distance to push along R if R == N
|
||
// d = distance to push along N
|
||
//
|
||
// N R
|
||
// { p| } * cos(p) = dot(N, R) = w / d
|
||
// d | |w * d = w / dot(N, R)
|
||
// { | }
|
||
// o---------- polyline segment ---->
|
||
//
|
||
vec3 scratchNormal = mix(-startFaceNormalAndVertexCorner.xyz, endFaceNormalAndHalfWidth.xyz, isEnd);
|
||
scratchNormal = cross(scratchNormal, mix(startEllipsoidNormal, endEllipsoidNormal, isEnd));
|
||
vec3 miterPushNormal = czm_normal * normalize(scratchNormal);
|
||
|
||
offset = 2.0 * endFaceNormalAndHalfWidth.w * max(0.0, czm_metersPerPixel(position)); // offset = widthEC
|
||
offset = offset / dot(miterPushNormal, right);
|
||
position.xyz += miterPushNormal * (offset * sign(0.5 - mod(startFaceNormalAndVertexCorner.w, 2.0)));
|
||
|
||
gl_Position = czm_depthClamp(czm_projection * position);
|
||
|
||
position = u_modifiedModelView * vec4(startPositionAndHeight.xyz, 1.0);
|
||
vec3 startNormalEC = czm_normal * startFaceNormalAndVertexCorner.xyz;
|
||
v_startPlaneEC = vec4(startNormalEC, -dot(startNormalEC, position.xyz));
|
||
v_rightPlaneEC = vec4(right, -dot(right, position.xyz));
|
||
|
||
position = u_modifiedModelView * vec4(endPositionAndHeight.xyz, 1.0);
|
||
vec3 endNormalEC = czm_normal * endFaceNormalAndHalfWidth.xyz;
|
||
v_endPlaneEC = vec4(endNormalEC, -dot(endNormalEC, position.xyz));
|
||
v_halfWidth = endFaceNormalAndHalfWidth.w;
|
||
}
|
||
`,tLe=`attribute vec4 currentPosition;
|
||
attribute vec4 previousPosition;
|
||
attribute vec4 nextPosition;
|
||
attribute vec2 expandAndWidth;
|
||
attribute float a_batchId;
|
||
|
||
uniform mat4 u_modifiedModelView;
|
||
|
||
void main()
|
||
{
|
||
float expandDir = expandAndWidth.x;
|
||
float width = abs(expandAndWidth.y) + 0.5;
|
||
bool usePrev = expandAndWidth.y < 0.0;
|
||
|
||
vec4 p = u_modifiedModelView * currentPosition;
|
||
vec4 prev = u_modifiedModelView * previousPosition;
|
||
vec4 next = u_modifiedModelView * nextPosition;
|
||
|
||
float angle;
|
||
vec4 positionWC = getPolylineWindowCoordinatesEC(p, prev, next, expandDir, width, usePrev, angle);
|
||
gl_Position = czm_viewportOrthographic * positionWC;
|
||
}
|
||
`,M5=`attribute vec3 position;
|
||
attribute float a_batchId;
|
||
|
||
uniform mat4 u_modifiedModelViewProjection;
|
||
|
||
void main()
|
||
{
|
||
gl_Position = czm_depthClamp(u_modifiedModelViewProjection * vec4(position, 1.0));
|
||
}
|
||
`;/*! @license DOMPurify 2.4.1 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/2.4.1/LICENSE */function Tm(e){return Tm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Tm(e)}function $M(e,t){return $M=Object.setPrototypeOf||function(i,o){return i.__proto__=o,i},$M(e,t)}function nLe(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function wD(e,t,n){return nLe()?wD=Reflect.construct:wD=function(o,r,s){var a=[null];a.push.apply(a,r);var c=Function.bind.apply(o,a),u=new c;return s&&$M(u,s.prototype),u},wD.apply(null,arguments)}function ku(e){return iLe(e)||oLe(e)||rLe(e)||sLe()}function iLe(e){if(Array.isArray(e))return XM(e)}function oLe(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function rLe(e,t){if(e){if(typeof e=="string")return XM(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return XM(e,t)}}function XM(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function sLe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
||
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var aLe=Object.hasOwnProperty,F5=Object.setPrototypeOf,cLe=Object.isFrozen,lLe=Object.getPrototypeOf,uLe=Object.getOwnPropertyDescriptor,gc=Object.freeze,mf=Object.seal,fLe=Object.create,JK=typeof Reflect<"u"&&Reflect,LI=JK.apply,KM=JK.construct;LI||(LI=function(t,n,i){return t.apply(n,i)});gc||(gc=function(t){return t});mf||(mf=function(t){return t});KM||(KM=function(t,n){return wD(t,ku(n))});var dLe=mu(Array.prototype.forEach),z5=mu(Array.prototype.pop),TC=mu(Array.prototype.push),SD=mu(String.prototype.toLowerCase),eB=mu(String.prototype.toString),hLe=mu(String.prototype.match),Mu=mu(String.prototype.replace),pLe=mu(String.prototype.indexOf),mLe=mu(String.prototype.trim),rc=mu(RegExp.prototype.test),tB=_Le(TypeError);function mu(e){return function(t){for(var n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];return LI(e,t,i)}}function _Le(e){return function(){for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return KM(e,n)}}function fi(e,t,n){n=n||SD,F5&&F5(e,null);for(var i=t.length;i--;){var o=t[i];if(typeof o=="string"){var r=n(o);r!==o&&(cLe(t)||(t[i]=r),o=r)}e[o]=!0}return e}function Y_(e){var t=fLe(null),n;for(n in e)LI(aLe,e,[n])&&(t[n]=e[n]);return t}function vS(e,t){for(;e!==null;){var n=uLe(e,t);if(n){if(n.get)return mu(n.get);if(typeof n.value=="function")return mu(n.value)}e=lLe(e)}function i(o){return console.warn("fallback value for",o),null}return i}var U5=gc(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),nB=gc(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),iB=gc(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),gLe=gc(["animate","color-profile","cursor","discard","fedropshadow","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),oB=gc(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover"]),yLe=gc(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),H5=gc(["#text"]),V5=gc(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","xmlns","slot"]),rB=gc(["accent-height","accumulate","additive","alignment-baseline","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),k5=gc(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),DS=gc(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),ALe=mf(/\{\{[\w\W]*|[\w\W]*\}\}/gm),TLe=mf(/<%[\w\W]*|[\w\W]*%>/gm),CLe=mf(/\${[\w\W]*}/gm),bLe=mf(/^data-[\-\w.\u00B7-\uFFFF]/),ELe=mf(/^aria-[\-\w]+$/),xLe=mf(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),wLe=mf(/^(?:\w+script|data):/i),SLe=mf(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),vLe=mf(/^html$/i),DLe=function(){return typeof window>"u"?null:window},ILe=function(t,n){if(Tm(t)!=="object"||typeof t.createPolicy!="function")return null;var i=null,o="data-tt-policy-suffix";n.currentScript&&n.currentScript.hasAttribute(o)&&(i=n.currentScript.getAttribute(o));var r="dompurify"+(i?"#"+i:"");try{return t.createPolicy(r,{createHTML:function(a){return a},createScriptURL:function(a){return a}})}catch{return console.warn("TrustedTypes policy "+r+" could not be created."),null}};function QK(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:DLe(),t=function(Oe){return QK(Oe)};if(t.version="2.4.1",t.removed=[],!e||!e.document||e.document.nodeType!==9)return t.isSupported=!1,t;var n=e.document,i=e.document,o=e.DocumentFragment,r=e.HTMLTemplateElement,s=e.Node,a=e.Element,c=e.NodeFilter,u=e.NamedNodeMap,f=u===void 0?e.NamedNodeMap||e.MozNamedAttrMap:u,h=e.HTMLFormElement,_=e.DOMParser,g=e.trustedTypes,p=a.prototype,y=vS(p,"cloneNode"),T=vS(p,"nextSibling"),b=vS(p,"childNodes"),x=vS(p,"parentNode");if(typeof r=="function"){var v=i.createElement("template");v.content&&v.content.ownerDocument&&(i=v.content.ownerDocument)}var D=ILe(g,n),L=D?D.createHTML(""):"",B=i,V=B.implementation,M=B.createNodeIterator,H=B.createDocumentFragment,G=B.getElementsByTagName,I=n.importNode,O={};try{O=Y_(i).documentMode?i.documentMode:{}}catch{}var m={};t.isSupported=typeof x=="function"&&V&&typeof V.createHTMLDocument<"u"&&O!==9;var P=ALe,R=TLe,U=CLe,W=bLe,q=ELe,Y=wLe,j=SLe,ee=xLe,K=null,se=fi({},[].concat(ku(U5),ku(nB),ku(iB),ku(oB),ku(H5))),Q=null,Z=fi({},[].concat(ku(V5),ku(rB),ku(k5),ku(DS))),J=Object.seal(Object.create(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),de=null,_e=null,le=!0,Te=!0,pe=!1,ne=!1,ae=!1,ye=!1,Ce=!1,Be=!1,Le=!1,Ve=!1,Ie=!0,He=!1,Me="user-content-",qe=!0,Ne=!1,ke={},Qe=null,Ge=fi({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),Pt=null,Lt=fi({},["audio","video","img","source","image","track"]),qt=null,zn=fi({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Gn="http://www.w3.org/1998/Math/MathML",Dn="http://www.w3.org/2000/svg",hn="http://www.w3.org/1999/xhtml",jt=hn,In=!1,Rn=null,Jt=fi({},[Gn,Dn,hn],eB),ln,ei=["application/xhtml+xml","text/html"],bi="text/html",pn,Fi=null,Co=i.createElement("form"),Xi=function(Oe){return Oe instanceof RegExp||Oe instanceof Function},gi=function(Oe){Fi&&Fi===Oe||((!Oe||Tm(Oe)!=="object")&&(Oe={}),Oe=Y_(Oe),ln=ei.indexOf(Oe.PARSER_MEDIA_TYPE)===-1?ln=bi:ln=Oe.PARSER_MEDIA_TYPE,pn=ln==="application/xhtml+xml"?eB:SD,K="ALLOWED_TAGS"in Oe?fi({},Oe.ALLOWED_TAGS,pn):se,Q="ALLOWED_ATTR"in Oe?fi({},Oe.ALLOWED_ATTR,pn):Z,Rn="ALLOWED_NAMESPACES"in Oe?fi({},Oe.ALLOWED_NAMESPACES,eB):Jt,qt="ADD_URI_SAFE_ATTR"in Oe?fi(Y_(zn),Oe.ADD_URI_SAFE_ATTR,pn):zn,Pt="ADD_DATA_URI_TAGS"in Oe?fi(Y_(Lt),Oe.ADD_DATA_URI_TAGS,pn):Lt,Qe="FORBID_CONTENTS"in Oe?fi({},Oe.FORBID_CONTENTS,pn):Ge,de="FORBID_TAGS"in Oe?fi({},Oe.FORBID_TAGS,pn):{},_e="FORBID_ATTR"in Oe?fi({},Oe.FORBID_ATTR,pn):{},ke="USE_PROFILES"in Oe?Oe.USE_PROFILES:!1,le=Oe.ALLOW_ARIA_ATTR!==!1,Te=Oe.ALLOW_DATA_ATTR!==!1,pe=Oe.ALLOW_UNKNOWN_PROTOCOLS||!1,ne=Oe.SAFE_FOR_TEMPLATES||!1,ae=Oe.WHOLE_DOCUMENT||!1,Be=Oe.RETURN_DOM||!1,Le=Oe.RETURN_DOM_FRAGMENT||!1,Ve=Oe.RETURN_TRUSTED_TYPE||!1,Ce=Oe.FORCE_BODY||!1,Ie=Oe.SANITIZE_DOM!==!1,He=Oe.SANITIZE_NAMED_PROPS||!1,qe=Oe.KEEP_CONTENT!==!1,Ne=Oe.IN_PLACE||!1,ee=Oe.ALLOWED_URI_REGEXP||ee,jt=Oe.NAMESPACE||hn,Oe.CUSTOM_ELEMENT_HANDLING&&Xi(Oe.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(J.tagNameCheck=Oe.CUSTOM_ELEMENT_HANDLING.tagNameCheck),Oe.CUSTOM_ELEMENT_HANDLING&&Xi(Oe.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(J.attributeNameCheck=Oe.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),Oe.CUSTOM_ELEMENT_HANDLING&&typeof Oe.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(J.allowCustomizedBuiltInElements=Oe.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),ne&&(Te=!1),Le&&(Be=!0),ke&&(K=fi({},ku(H5)),Q=[],ke.html===!0&&(fi(K,U5),fi(Q,V5)),ke.svg===!0&&(fi(K,nB),fi(Q,rB),fi(Q,DS)),ke.svgFilters===!0&&(fi(K,iB),fi(Q,rB),fi(Q,DS)),ke.mathMl===!0&&(fi(K,oB),fi(Q,k5),fi(Q,DS))),Oe.ADD_TAGS&&(K===se&&(K=Y_(K)),fi(K,Oe.ADD_TAGS,pn)),Oe.ADD_ATTR&&(Q===Z&&(Q=Y_(Q)),fi(Q,Oe.ADD_ATTR,pn)),Oe.ADD_URI_SAFE_ATTR&&fi(qt,Oe.ADD_URI_SAFE_ATTR,pn),Oe.FORBID_CONTENTS&&(Qe===Ge&&(Qe=Y_(Qe)),fi(Qe,Oe.FORBID_CONTENTS,pn)),qe&&(K["#text"]=!0),ae&&fi(K,["html","head","body"]),K.table&&(fi(K,["tbody"]),delete de.tbody),gc&&gc(Oe),Fi=Oe)},wn=fi({},["mi","mo","mn","ms","mtext"]),ti=fi({},["foreignobject","desc","title","annotation-xml"]),Jn=fi({},["title","style","font","a","script"]),Tn=fi({},nB);fi(Tn,iB),fi(Tn,gLe);var Rt=fi({},oB);fi(Rt,yLe);var et=function(Oe){var st=x(Oe);(!st||!st.tagName)&&(st={namespaceURI:jt,tagName:"template"});var gt=SD(Oe.tagName),oi=SD(st.tagName);return Rn[Oe.namespaceURI]?Oe.namespaceURI===Dn?st.namespaceURI===hn?gt==="svg":st.namespaceURI===Gn?gt==="svg"&&(oi==="annotation-xml"||wn[oi]):Boolean(Tn[gt]):Oe.namespaceURI===Gn?st.namespaceURI===hn?gt==="math":st.namespaceURI===Dn?gt==="math"&&ti[oi]:Boolean(Rt[gt]):Oe.namespaceURI===hn?st.namespaceURI===Dn&&!ti[oi]||st.namespaceURI===Gn&&!wn[oi]?!1:!Rt[gt]&&(Jn[gt]||!Tn[gt]):!!(ln==="application/xhtml+xml"&&Rn[Oe.namespaceURI]):!1},qn=function(Oe){TC(t.removed,{element:Oe});try{Oe.parentNode.removeChild(Oe)}catch{try{Oe.outerHTML=L}catch{Oe.remove()}}},Sn=function(Oe,st){try{TC(t.removed,{attribute:st.getAttributeNode(Oe),from:st})}catch{TC(t.removed,{attribute:null,from:st})}if(st.removeAttribute(Oe),Oe==="is"&&!Q[Oe])if(Be||Le)try{qn(st)}catch{}else try{st.setAttribute(Oe,"")}catch{}},oo=function(Oe){var st,gt;if(Ce)Oe="<remove></remove>"+Oe;else{var oi=hLe(Oe,/^[\r\n\t ]+/);gt=oi&&oi[0]}ln==="application/xhtml+xml"&&jt===hn&&(Oe='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+Oe+"</body></html>");var br=D?D.createHTML(Oe):Oe;if(jt===hn)try{st=new _().parseFromString(br,ln)}catch{}if(!st||!st.documentElement){st=V.createDocument(jt,"template",null);try{st.documentElement.innerHTML=In?"":br}catch{}}var Nr=st.body||st.documentElement;return Oe&>&&Nr.insertBefore(i.createTextNode(gt),Nr.childNodes[0]||null),jt===hn?G.call(st,ae?"html":"body")[0]:ae?st.documentElement:Nr},jn=function(Oe){return M.call(Oe.ownerDocument||Oe,Oe,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT,null,!1)},Ki=function(Oe){return Oe instanceof h&&(typeof Oe.nodeName!="string"||typeof Oe.textContent!="string"||typeof Oe.removeChild!="function"||!(Oe.attributes instanceof f)||typeof Oe.removeAttribute!="function"||typeof Oe.setAttribute!="function"||typeof Oe.namespaceURI!="string"||typeof Oe.insertBefore!="function"||typeof Oe.hasChildNodes!="function")},zo=function(Oe){return Tm(s)==="object"?Oe instanceof s:Oe&&Tm(Oe)==="object"&&typeof Oe.nodeType=="number"&&typeof Oe.nodeName=="string"},So=function(Oe,st,gt){m[Oe]&&dLe(m[Oe],function(oi){oi.call(t,st,gt,Fi)})},Yr=function(Oe){var st;if(So("beforeSanitizeElements",Oe,null),Ki(Oe)||rc(/[\u0080-\uFFFF]/,Oe.nodeName))return qn(Oe),!0;var gt=pn(Oe.nodeName);if(So("uponSanitizeElement",Oe,{tagName:gt,allowedTags:K}),Oe.hasChildNodes()&&!zo(Oe.firstElementChild)&&(!zo(Oe.content)||!zo(Oe.content.firstElementChild))&&rc(/<[/\w]/g,Oe.innerHTML)&&rc(/<[/\w]/g,Oe.textContent)||gt==="select"&&rc(/<template/i,Oe.innerHTML))return qn(Oe),!0;if(!K[gt]||de[gt]){if(!de[gt]&&Ji(gt)&&(J.tagNameCheck instanceof RegExp&&rc(J.tagNameCheck,gt)||J.tagNameCheck instanceof Function&&J.tagNameCheck(gt)))return!1;if(qe&&!Qe[gt]){var oi=x(Oe)||Oe.parentNode,br=b(Oe)||Oe.childNodes;if(br&&oi)for(var Nr=br.length,Uo=Nr-1;Uo>=0;--Uo)oi.insertBefore(y(br[Uo],!0),T(Oe))}return qn(Oe),!0}return Oe instanceof a&&!et(Oe)||(gt==="noscript"||gt==="noembed")&&rc(/<\/no(script|embed)/i,Oe.innerHTML)?(qn(Oe),!0):(ne&&Oe.nodeType===3&&(st=Oe.textContent,st=Mu(st,P," "),st=Mu(st,R," "),st=Mu(st,U," "),Oe.textContent!==st&&(TC(t.removed,{element:Oe.cloneNode()}),Oe.textContent=st)),So("afterSanitizeElements",Oe,null),!1)},ro=function(Oe,st,gt){if(Ie&&(st==="id"||st==="name")&&(gt in i||gt in Co))return!1;if(!(Te&&!_e[st]&&rc(W,st))){if(!(le&&rc(q,st))){if(!Q[st]||_e[st]){if(!(Ji(Oe)&&(J.tagNameCheck instanceof RegExp&&rc(J.tagNameCheck,Oe)||J.tagNameCheck instanceof Function&&J.tagNameCheck(Oe))&&(J.attributeNameCheck instanceof RegExp&&rc(J.attributeNameCheck,st)||J.attributeNameCheck instanceof Function&&J.attributeNameCheck(st))||st==="is"&&J.allowCustomizedBuiltInElements&&(J.tagNameCheck instanceof RegExp&&rc(J.tagNameCheck,gt)||J.tagNameCheck instanceof Function&&J.tagNameCheck(gt))))return!1}else if(!qt[st]){if(!rc(ee,Mu(gt,j,""))){if(!((st==="src"||st==="xlink:href"||st==="href")&&Oe!=="script"&&pLe(gt,"data:")===0&&Pt[Oe])){if(!(pe&&!rc(Y,Mu(gt,j,"")))){if(gt)return!1}}}}}}return!0},Ji=function(Oe){return Oe.indexOf("-")>0},Rr=function(Oe){var st,gt,oi,br;So("beforeSanitizeAttributes",Oe,null);var Nr=Oe.attributes;if(Nr){var Uo={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Q};for(br=Nr.length;br--;){st=Nr[br];var Uf=st,Ho=Uf.name,Pu=Uf.namespaceURI;if(gt=Ho==="value"?st.value:mLe(st.value),oi=pn(Ho),Uo.attrName=oi,Uo.attrValue=gt,Uo.keepAttr=!0,Uo.forceKeepAttr=void 0,So("uponSanitizeAttribute",Oe,Uo),gt=Uo.attrValue,!Uo.forceKeepAttr&&(Sn(Ho,Oe),!!Uo.keepAttr)){if(rc(/\/>/i,gt)){Sn(Ho,Oe);continue}ne&&(gt=Mu(gt,P," "),gt=Mu(gt,R," "),gt=Mu(gt,U," "));var Xd=pn(Oe.nodeName);if(ro(Xd,oi,gt)){if(He&&(oi==="id"||oi==="name")&&(Sn(Ho,Oe),gt=Me+gt),D&&Tm(g)==="object"&&typeof g.getAttributeType=="function"&&!Pu)switch(g.getAttributeType(Xd,oi)){case"TrustedHTML":gt=D.createHTML(gt);break;case"TrustedScriptURL":gt=D.createScriptURL(gt);break}try{Pu?Oe.setAttributeNS(Pu,Ho,gt):Oe.setAttribute(Ho,gt),z5(t.removed)}catch{}}}}So("afterSanitizeAttributes",Oe,null)}},Zs=function Nt(Oe){var st,gt=jn(Oe);for(So("beforeSanitizeShadowDOM",Oe,null);st=gt.nextNode();)So("uponSanitizeShadowNode",st,null),!Yr(st)&&(st.content instanceof o&&Nt(st.content),Rr(st));So("afterSanitizeShadowDOM",Oe,null)};return t.sanitize=function(Nt){var Oe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},st,gt,oi,br,Nr;if(In=!Nt,In&&(Nt="<!-->"),typeof Nt!="string"&&!zo(Nt)){if(typeof Nt.toString!="function")throw tB("toString is not a function");if(Nt=Nt.toString(),typeof Nt!="string")throw tB("dirty is not a string, aborting")}if(!t.isSupported){if(Tm(e.toStaticHTML)==="object"||typeof e.toStaticHTML=="function"){if(typeof Nt=="string")return e.toStaticHTML(Nt);if(zo(Nt))return e.toStaticHTML(Nt.outerHTML)}return Nt}if(ye||gi(Oe),t.removed=[],typeof Nt=="string"&&(Ne=!1),Ne){if(Nt.nodeName){var Uo=pn(Nt.nodeName);if(!K[Uo]||de[Uo])throw tB("root node is forbidden and cannot be sanitized in-place")}}else if(Nt instanceof s)st=oo("<!---->"),gt=st.ownerDocument.importNode(Nt,!0),gt.nodeType===1&>.nodeName==="BODY"||gt.nodeName==="HTML"?st=gt:st.appendChild(gt);else{if(!Be&&!ne&&!ae&&Nt.indexOf("<")===-1)return D&&Ve?D.createHTML(Nt):Nt;if(st=oo(Nt),!st)return Be?null:Ve?L:""}st&&Ce&&qn(st.firstChild);for(var Uf=jn(Ne?Nt:st);oi=Uf.nextNode();)oi.nodeType===3&&oi===br||Yr(oi)||(oi.content instanceof o&&Zs(oi.content),Rr(oi),br=oi);if(br=null,Ne)return Nt;if(Be){if(Le)for(Nr=H.call(st.ownerDocument);st.firstChild;)Nr.appendChild(st.firstChild);else Nr=st;return Q.shadowroot&&(Nr=I.call(n,Nr,!0)),Nr}var Ho=ae?st.outerHTML:st.innerHTML;return ae&&K["!doctype"]&&st.ownerDocument&&st.ownerDocument.doctype&&st.ownerDocument.doctype.name&&rc(vLe,st.ownerDocument.doctype.name)&&(Ho="<!DOCTYPE "+st.ownerDocument.doctype.name+`>
|
||
`+Ho),ne&&(Ho=Mu(Ho,P," "),Ho=Mu(Ho,R," "),Ho=Mu(Ho,U," ")),D&&Ve?D.createHTML(Ho):Ho},t.setConfig=function(Nt){gi(Nt),ye=!0},t.clearConfig=function(){Fi=null,ye=!1},t.isValidAttribute=function(Nt,Oe,st){Fi||gi({});var gt=pn(Nt),oi=pn(Oe);return ro(gt,oi,st)},t.addHook=function(Nt,Oe){typeof Oe=="function"&&(m[Nt]=m[Nt]||[],TC(m[Nt],Oe))},t.removeHook=function(Nt){if(m[Nt])return z5(m[Nt])},t.removeHooks=function(Nt){m[Nt]&&(m[Nt]=[])},t.removeAllHooks=function(){m={}},t}var PLe=QK();let OLe=0;const sB={};function Si(e,t){E.typeOf.string("html",e);let n;const i=e;l(sB[i])?n=sB[i]:(n=OLe++,sB[i]=n),t=A(t,!1),this._id=n,this._html=e,this._showOnScreen=t,this._element=void 0}Object.defineProperties(Si.prototype,{html:{get:function(){return this._html}},id:{get:function(){return this._id}},showOnScreen:{get:function(){return this._showOnScreen},set:function(e){this._showOnScreen=e}},element:{get:function(){if(!l(this._element)){const e=PLe.sanitize(this._html),t=document.createElement("div");t._creditId=this._id,t.style.display="inline",t.innerHTML=e;const n=t.querySelectorAll("a");for(let i=0;i<n.length;i++)n[i].setAttribute("target","_blank");this._element=t}return this._element}}});Si.equals=function(e,t){return e===t||l(e)&&l(t)&&e._id===t._id&&e._showOnScreen===t._showOnScreen};Si.prototype.equals=function(e){return Si.equals(this,e)};Si.getIonCredit=function(e){const t=l(e.collapsible)&&!e.collapsible,n=new Si(e.html,t);return n._isIon=n.html.indexOf("ion-credit.png")!==-1,n};Si.clone=function(e){if(l(e))return new Si(e.html,e.showOnScreen)};let aB;const ZK="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiIyZTlhMmUzMS1iZjI3LTRhMmQtYjFkZi02MDhlMDZjZDlmNDIiLCJpZCI6MjU5LCJpYXQiOjE2NzI2ODQyMDR9.GfS2oIjtP-hkhYm4g_Y6Vvpdp954z30qPWJnlNBF-co",Y1={};Y1.defaultAccessToken=ZK;Y1.defaultServer=new je({url:"https://api.cesium.com/"});Y1.getDefaultTokenCredit=function(e){if(e===ZK){if(!l(aB)){const t=`<b> This application is using Cesium's default ion access token. Please assign <i>Cesium.Ion.defaultAccessToken</i> with an access token from your ion account before making any Cesium API calls. You can sign up for a free ion account at <a href="https://cesium.com">https://cesium.com</a>.</b>`;aB=new Si(t,!0)}return aB}};const kg=Y1;function qs(e,t){E.defined("endpoint",e),E.defined("endpointResource",t);let n;const i=e.externalType,o=l(i);if(!o)n={url:e.url,retryAttempts:1,retryCallback:LLe};else if(i==="3DTILES"||i==="STK_TERRAIN_SERVER")n={url:e.options.url};else throw new Fe("Ion.createResource does not support external imagery assets; use IonImageryProvider instead.");je.call(this,n),this._ionEndpoint=e,this._ionEndpointDomain=o?void 0:new ha(e.url).authority(),this._ionEndpointResource=t,this._ionRoot=void 0,this._pendingPromise=void 0,this._credits=void 0,this._isExternal=o}l(Object.create)&&(qs.prototype=Object.create(je.prototype),qs.prototype.constructor=qs);qs.fromAssetId=function(e,t){const n=qs._createEndpointResource(e,t);return n.fetchJson().then(function(i){return new qs(i,n)})};Object.defineProperties(qs.prototype,{credits:{get:function(){return l(this._ionRoot)?this._ionRoot.credits:l(this._credits)?this._credits:(this._credits=qs.getCreditsFromEndpoint(this._ionEndpoint,this._ionEndpointResource),this._credits)}}});qs.getCreditsFromEndpoint=function(e,t){const n=e.attributions.map(Si.getIonCredit),i=kg.getDefaultTokenCredit(t.queryParameters.access_token);return l(i)&&n.push(Si.clone(i)),n};qs.prototype.clone=function(e){const t=A(this._ionRoot,this);return l(e)||(e=new qs(t._ionEndpoint,t._ionEndpointResource)),e=je.prototype.clone.call(this,e),e._ionRoot=t,e._isExternal=this._isExternal,e};qs.prototype.fetchImage=function(e){if(!this._isExternal){const t=e;e={preferBlob:!0},l(t)&&(e.flipY=t.flipY,e.preferImageBitmap=t.preferImageBitmap)}return je.prototype.fetchImage.call(this,e)};qs.prototype._makeRequest=function(e){return this._isExternal||new ha(this.url).authority()!==this._ionEndpointDomain?je.prototype._makeRequest.call(this,e):(l(e.headers)||(e.headers={}),e.headers.Authorization=`Bearer ${this._ionEndpoint.accessToken}`,je.prototype._makeRequest.call(this,e))};qs._createEndpointResource=function(e,t){E.defined("assetId",e),t=A(t,A.EMPTY_OBJECT);let n=A(t.server,kg.defaultServer);const i=A(t.accessToken,kg.defaultAccessToken);n=je.createIfNeeded(n);const o={url:`v1/assets/${e}/endpoint`};return l(i)&&(o.queryParameters={access_token:i}),n.getDerivedResource(o)};function LLe(e,t){const n=A(e._ionRoot,e),i=n._ionEndpointResource,o=typeof Image<"u";return!l(t)||t.statusCode!==401&&!(o&&t.target instanceof Image)?Promise.resolve(!1):(l(n._pendingPromise)||(n._pendingPromise=i.fetchJson().then(function(r){return n._ionEndpoint=r,r}).finally(function(r){return n._pendingPromise=void 0,r})),n._pendingPromise.then(function(r){return e._ionEndpoint=r,!0}))}function Ga(e){e=A(e,A.EMPTY_OBJECT),this._ellipsoid=A(e.ellipsoid,be.WGS84),this._rectangle=A(e.rectangle,Ee.MAX_VALUE),this._projection=new Or(this._ellipsoid),this._numberOfLevelZeroTilesX=A(e.numberOfLevelZeroTilesX,2),this._numberOfLevelZeroTilesY=A(e.numberOfLevelZeroTilesY,1)}Object.defineProperties(Ga.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},rectangle:{get:function(){return this._rectangle}},projection:{get:function(){return this._projection}}});Ga.prototype.getNumberOfXTilesAtLevel=function(e){return this._numberOfLevelZeroTilesX<<e};Ga.prototype.getNumberOfYTilesAtLevel=function(e){return this._numberOfLevelZeroTilesY<<e};Ga.prototype.rectangleToNativeRectangle=function(e,t){E.defined("rectangle",e);const n=F.toDegrees(e.west),i=F.toDegrees(e.south),o=F.toDegrees(e.east),r=F.toDegrees(e.north);return l(t)?(t.west=n,t.south=i,t.east=o,t.north=r,t):new Ee(n,i,o,r)};Ga.prototype.tileXYToNativeRectangle=function(e,t,n,i){const o=this.tileXYToRectangle(e,t,n,i);return o.west=F.toDegrees(o.west),o.south=F.toDegrees(o.south),o.east=F.toDegrees(o.east),o.north=F.toDegrees(o.north),o};Ga.prototype.tileXYToRectangle=function(e,t,n,i){const o=this._rectangle,r=this.getNumberOfXTilesAtLevel(n),s=this.getNumberOfYTilesAtLevel(n),a=o.width/r,c=e*a+o.west,u=(e+1)*a+o.west,f=o.height/s,h=o.north-t*f,_=o.north-(t+1)*f;return l(i)||(i=new Ee(c,_,u,h)),i.west=c,i.south=_,i.east=u,i.north=h,i};Ga.prototype.positionToTileXY=function(e,t,n){const i=this._rectangle;if(!Ee.contains(i,e))return;const o=this.getNumberOfXTilesAtLevel(t),r=this.getNumberOfYTilesAtLevel(t),s=i.width/o,a=i.height/r;let c=e.longitude;i.east<i.west&&(c+=F.TWO_PI);let u=(c-i.west)/s|0;u>=o&&(u=o-1);let f=(i.north-e.latitude)/a|0;return f>=r&&(f=r-1),l(n)?(n.x=u,n.y=f,n):new $(u,f)};function JM(e){let t;const n=e.name,i=e.message;l(n)&&l(i)?t=`${n}: ${i}`:t=e.toString();const o=e.stack;return l(o)&&(t+=`
|
||
${o}`),t}function Lo(e,t,n,i,o,r,s){this.provider=e,this.message=t,this.x=n,this.y=i,this.level=o,this.timesRetried=A(r,0),this.retry=!1,this.error=s}Lo.reportError=function(e,t,n,i,o,r,s,a){let c=e;return l(e)?(c.provider=t,c.message=i,c.x=o,c.y=r,c.level=s,c.retry=!1,c.error=a,++c.timesRetried):c=new Lo(t,i,o,r,s,0,a),n.numberOfListeners>0?n.raiseEvent(c):console.log(`An error occurred in "${t.constructor.name}": ${JM(i)}`),c};Lo.reportSuccess=function(e){l(e)&&(e.timesRetried=-1)};function Ii(e){this._ellipsoid=A(e,be.WGS84),this._semimajorAxis=this._ellipsoid.maximumRadius,this._oneOverSemimajorAxis=1/this._semimajorAxis}Object.defineProperties(Ii.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}});Ii.mercatorAngleToGeodeticLatitude=function(e){return F.PI_OVER_TWO-2*Math.atan(Math.exp(-e))};Ii.geodeticLatitudeToMercatorAngle=function(e){e>Ii.MaximumLatitude?e=Ii.MaximumLatitude:e<-Ii.MaximumLatitude&&(e=-Ii.MaximumLatitude);const t=Math.sin(e);return .5*Math.log((1+t)/(1-t))};Ii.MaximumLatitude=Ii.mercatorAngleToGeodeticLatitude(Math.PI);Ii.prototype.project=function(e,t){const n=this._semimajorAxis,i=e.longitude*n,o=Ii.geodeticLatitudeToMercatorAngle(e.latitude)*n,r=e.height;return l(t)?(t.x=i,t.y=o,t.z=r,t):new d(i,o,r)};Ii.prototype.unproject=function(e,t){if(!l(e))throw new w("cartesian is required");const n=this._oneOverSemimajorAxis,i=e.x*n,o=Ii.mercatorAngleToGeodeticLatitude(e.y*n),r=e.z;return l(t)?(t.longitude=i,t.latitude=o,t.height=r,t):new ve(i,o,r)};function Za(e){if(e=A(e,A.EMPTY_OBJECT),this._ellipsoid=A(e.ellipsoid,be.WGS84),this._numberOfLevelZeroTilesX=A(e.numberOfLevelZeroTilesX,1),this._numberOfLevelZeroTilesY=A(e.numberOfLevelZeroTilesY,1),this._projection=new Ii(this._ellipsoid),l(e.rectangleSouthwestInMeters)&&l(e.rectangleNortheastInMeters))this._rectangleSouthwestInMeters=e.rectangleSouthwestInMeters,this._rectangleNortheastInMeters=e.rectangleNortheastInMeters;else{const i=this._ellipsoid.maximumRadius*Math.PI;this._rectangleSouthwestInMeters=new $(-i,-i),this._rectangleNortheastInMeters=new $(i,i)}const t=this._projection.unproject(this._rectangleSouthwestInMeters),n=this._projection.unproject(this._rectangleNortheastInMeters);this._rectangle=new Ee(t.longitude,t.latitude,n.longitude,n.latitude)}Object.defineProperties(Za.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},rectangle:{get:function(){return this._rectangle}},projection:{get:function(){return this._projection}}});Za.prototype.getNumberOfXTilesAtLevel=function(e){return this._numberOfLevelZeroTilesX<<e};Za.prototype.getNumberOfYTilesAtLevel=function(e){return this._numberOfLevelZeroTilesY<<e};Za.prototype.rectangleToNativeRectangle=function(e,t){const n=this._projection,i=n.project(Ee.southwest(e)),o=n.project(Ee.northeast(e));return l(t)?(t.west=i.x,t.south=i.y,t.east=o.x,t.north=o.y,t):new Ee(i.x,i.y,o.x,o.y)};Za.prototype.tileXYToNativeRectangle=function(e,t,n,i){const o=this.getNumberOfXTilesAtLevel(n),r=this.getNumberOfYTilesAtLevel(n),s=(this._rectangleNortheastInMeters.x-this._rectangleSouthwestInMeters.x)/o,a=this._rectangleSouthwestInMeters.x+e*s,c=this._rectangleSouthwestInMeters.x+(e+1)*s,u=(this._rectangleNortheastInMeters.y-this._rectangleSouthwestInMeters.y)/r,f=this._rectangleNortheastInMeters.y-t*u,h=this._rectangleNortheastInMeters.y-(t+1)*u;return l(i)?(i.west=a,i.south=h,i.east=c,i.north=f,i):new Ee(a,h,c,f)};Za.prototype.tileXYToRectangle=function(e,t,n,i){const o=this.tileXYToNativeRectangle(e,t,n,i),r=this._projection,s=r.unproject(new $(o.west,o.south)),a=r.unproject(new $(o.east,o.north));return o.west=s.longitude,o.south=s.latitude,o.east=a.longitude,o.north=a.latitude,o};Za.prototype.positionToTileXY=function(e,t,n){const i=this._rectangle;if(!Ee.contains(i,e))return;const o=this.getNumberOfXTilesAtLevel(t),r=this.getNumberOfYTilesAtLevel(t),a=(this._rectangleNortheastInMeters.x-this._rectangleSouthwestInMeters.x)/o,u=(this._rectangleNortheastInMeters.y-this._rectangleSouthwestInMeters.y)/r,h=this._projection.project(e),_=h.x-this._rectangleSouthwestInMeters.x,g=this._rectangleNortheastInMeters.y-h.y;let p=_/a|0;p>=o&&(p=o-1);let y=g/u|0;return y>=r&&(y=r-1),l(n)?(n.x=p,n.y=y,n):new $(p,y)};function J3(e){if(e=A(e,A.EMPTY_OBJECT),!l(e.missingImageUrl))throw new w("options.missingImageUrl is required.");if(!l(e.pixelsToCheck))throw new w("options.pixelsToCheck is required.");this._pixelsToCheck=e.pixelsToCheck,this._missingImagePixels=void 0,this._missingImageByteLength=void 0,this._isReady=!1;const t=je.createIfNeeded(e.missingImageUrl),n=this;function i(r){l(r.blob)&&(n._missingImageByteLength=r.blob.size);let s=DI(r);if(e.disableCheckIfAllPixelsAreTransparent){let a=!0;const c=r.width,u=e.pixelsToCheck;for(let f=0,h=u.length;a&&f<h;++f){const _=u[f],g=_.x*4+_.y*c;s[g+3]>0&&(a=!1)}a&&(s=void 0)}n._missingImagePixels=s,n._isReady=!0}function o(){n._missingImagePixels=void 0,n._isReady=!0}t.fetchImage({preferBlob:!0,preferImageBitmap:!0,flipY:!0}).then(i).catch(o)}J3.prototype.isReady=function(){return this._isReady};J3.prototype.shouldDiscardImage=function(e){if(!this._isReady)throw new w("shouldDiscardImage must not be called before the discard policy is ready.");const t=this._pixelsToCheck,n=this._missingImagePixels;if(!l(n)||l(e.blob)&&e.blob.size!==this._missingImageByteLength)return!1;const i=DI(e),o=e.width;for(let r=0,s=t.length;r<s;++r){const a=t[r],c=a.x*4+a.y*o;for(let u=0;u<4;++u){const f=c+u;if(i[f]!==n[f])return!1}}return!0};function g_(){this.name=void 0,this.description=void 0,this.position=void 0,this.data=void 0,this.imageryLayer=void 0}g_.prototype.configureNameFromProperties=function(e){let t=10,n;for(const i in e)if(e.hasOwnProperty(i)&&e[i]){const o=i.toLowerCase();t>1&&o==="name"?(t=1,n=i):t>2&&o==="title"?(t=2,n=i):t>3&&/name/i.test(i)?(t=3,n=i):t>4&&/title/i.test(i)&&(t=4,n=i)}l(n)&&(this.name=e[n])};g_.prototype.configureDescriptionFromProperties=function(e){function t(n){let i='<table class="cesium-infoBox-defaultTable">';for(const o in n)if(n.hasOwnProperty(o)){const r=n[o];l(r)&&(typeof r=="object"?i+=`<tr><td>${o}</td><td>${t(r)}</td></tr>`:i+=`<tr><td>${o}</td><td>${r}</td></tr>`)}return i+="</table>",i}this.description=t(e)};function Sf(){this.defaultAlpha=void 0,this.defaultNightAlpha=void 0,this.defaultDayAlpha=void 0,this.defaultBrightness=void 0,this.defaultContrast=void 0,this.defaultHue=void 0,this.defaultSaturation=void 0,this.defaultGamma=void 0,this.defaultMinificationFilter=void 0,this.defaultMagnificationFilter=void 0,w.throwInstantiationError()}Object.defineProperties(Sf.prototype,{ready:{get:w.throwInstantiationError},readyPromise:{get:w.throwInstantiationError},rectangle:{get:w.throwInstantiationError},tileWidth:{get:w.throwInstantiationError},tileHeight:{get:w.throwInstantiationError},maximumLevel:{get:w.throwInstantiationError},minimumLevel:{get:w.throwInstantiationError},tilingScheme:{get:w.throwInstantiationError},tileDiscardPolicy:{get:w.throwInstantiationError},errorEvent:{get:w.throwInstantiationError},credit:{get:w.throwInstantiationError},proxy:{get:w.throwInstantiationError},hasAlphaChannel:{get:w.throwInstantiationError}});Sf.prototype.getTileCredits=function(e,t,n){w.throwInstantiationError()};Sf.prototype.requestImage=function(e,t,n,i){w.throwInstantiationError()};Sf.prototype.pickFeatures=function(e,t,n,i,o){w.throwInstantiationError()};const BLe=/\.ktx2$/i;Sf.loadImage=function(e,t){E.defined("url",t);const n=je.createIfNeeded(t);return BLe.test(n.url)?Sy(n):l(e)&&l(e.tileDiscardPolicy)?n.fetchImage({preferBlob:!0,preferImageBitmap:!0,flipY:!0}):n.fetchImage({preferImageBitmap:!0,flipY:!0})};function Nm(e){if(e=A(e,A.EMPTY_OBJECT),!l(e.url))throw new w("options.url is required.");this.defaultAlpha=void 0,this.defaultNightAlpha=void 0,this.defaultDayAlpha=void 0,this.defaultBrightness=void 0,this.defaultContrast=void 0,this.defaultHue=void 0,this.defaultSaturation=void 0,this.defaultGamma=void 0,this.defaultMinificationFilter=void 0,this.defaultMagnificationFilter=void 0;const t=je.createIfNeeded(e.url);t.appendForwardSlash(),l(e.token)&&t.setQueryParameters({token:e.token}),this._resource=t,this._tileDiscardPolicy=e.tileDiscardPolicy,this._tileWidth=A(e.tileWidth,256),this._tileHeight=A(e.tileHeight,256),this._maximumLevel=e.maximumLevel,this._tilingScheme=A(e.tilingScheme,new Ga({ellipsoid:e.ellipsoid})),this._useTiles=A(e.usePreCachedTilesIfAvailable,!0),this._rectangle=A(e.rectangle,this._tilingScheme.rectangle),this._layers=e.layers;let n=e.credit;typeof n=="string"&&(n=new Si(n)),this._credit=n,this.enablePickFeatures=A(e.enablePickFeatures,!0),this._errorEvent=new lt,this._ready=!1;const i=this;let o;function r(c){const u=c.tileInfo;if(!l(u))i._useTiles=!1;else{if(i._tileWidth=u.rows,i._tileHeight=u.cols,u.spatialReference.wkid===102100||u.spatialReference.wkid===102113)i._tilingScheme=new Za({ellipsoid:e.ellipsoid});else if(c.tileInfo.spatialReference.wkid===4326)i._tilingScheme=new Ga({ellipsoid:e.ellipsoid});else{const f=`Tile spatial reference WKID ${c.tileInfo.spatialReference.wkid} is not supported.`;return o=Lo.reportError(o,i,i._errorEvent,f,void 0,void 0,void 0),o.retry?a():Promise.reject(new Fe(f))}if(i._maximumLevel=c.tileInfo.lods.length-1,l(c.fullExtent)){if(l(c.fullExtent.spatialReference)&&l(c.fullExtent.spatialReference.wkid))if(c.fullExtent.spatialReference.wkid===102100||c.fullExtent.spatialReference.wkid===102113){const f=new Ii,h=c.fullExtent,_=f.unproject(new d(Math.max(h.xmin,-i._tilingScheme.ellipsoid.maximumRadius*Math.PI),Math.max(h.ymin,-i._tilingScheme.ellipsoid.maximumRadius*Math.PI),0)),g=f.unproject(new d(Math.min(h.xmax,i._tilingScheme.ellipsoid.maximumRadius*Math.PI),Math.min(h.ymax,i._tilingScheme.ellipsoid.maximumRadius*Math.PI),0));i._rectangle=new Ee(_.longitude,_.latitude,g.longitude,g.latitude)}else if(c.fullExtent.spatialReference.wkid===4326)i._rectangle=Ee.fromDegrees(c.fullExtent.xmin,c.fullExtent.ymin,c.fullExtent.xmax,c.fullExtent.ymax);else{const f=`fullExtent.spatialReference WKID ${c.fullExtent.spatialReference.wkid} is not supported.`;return o=Lo.reportError(o,i,i._errorEvent,f,void 0,void 0,void 0),o.retry?a():Promise.reject(new Fe(f))}}else i._rectangle=i._tilingScheme.rectangle;l(i._tileDiscardPolicy)||(i._tileDiscardPolicy=new J3({missingImageUrl:eJ(i,0,0,i._maximumLevel).url,pixelsToCheck:[new $(0,0),new $(200,20),new $(20,200),new $(80,110),new $(160,130)],disableCheckIfAllPixelsAreTransparent:!0})),i._useTiles=!0}return l(c.copyrightText)&&c.copyrightText.length>0&&(i._credit=new Si(c.copyrightText)),i._ready=!0,Lo.reportSuccess(o),Promise.resolve(!0)}function s(c){const u=`An error occurred while accessing ${i._resource.url}.`;return o=Lo.reportError(o,i,i._errorEvent,u,void 0,void 0,void 0),Promise.reject(new Fe(u))}function a(){return i._resource.getDerivedResource({queryParameters:{f:"json"}}).fetchJsonp().then(r).catch(s)}this._useTiles?this._readyPromise=a():(this._ready=!0,this._readyPromise=Promise.resolve(!0))}function eJ(e,t,n,i,o){let r;if(e._useTiles)r=e._resource.getDerivedResource({url:`tile/${i}/${n}/${t}`,request:o});else{const s=e._tilingScheme.tileXYToNativeRectangle(t,n,i),c={bbox:`${s.west},${s.south},${s.east},${s.north}`,size:`${e._tileWidth},${e._tileHeight}`,format:"png32",transparent:!0,f:"image"};e._tilingScheme.projection instanceof Or?(c.bboxSR=4326,c.imageSR=4326):(c.bboxSR=3857,c.imageSR=3857),e.layers&&(c.layers=`show:${e.layers}`),r=e._resource.getDerivedResource({url:"export",request:o,queryParameters:c})}return r}Object.defineProperties(Nm.prototype,{url:{get:function(){return this._resource._url}},token:{get:function(){return this._resource.queryParameters.token}},proxy:{get:function(){return this._resource.proxy}},tileWidth:{get:function(){if(!this._ready)throw new w("tileWidth must not be called before the imagery provider is ready.");return this._tileWidth}},tileHeight:{get:function(){if(!this._ready)throw new w("tileHeight must not be called before the imagery provider is ready.");return this._tileHeight}},maximumLevel:{get:function(){if(!this._ready)throw new w("maximumLevel must not be called before the imagery provider is ready.");return this._maximumLevel}},minimumLevel:{get:function(){if(!this._ready)throw new w("minimumLevel must not be called before the imagery provider is ready.");return 0}},tilingScheme:{get:function(){if(!this._ready)throw new w("tilingScheme must not be called before the imagery provider is ready.");return this._tilingScheme}},rectangle:{get:function(){if(!this._ready)throw new w("rectangle must not be called before the imagery provider is ready.");return this._rectangle}},tileDiscardPolicy:{get:function(){if(!this._ready)throw new w("tileDiscardPolicy must not be called before the imagery provider is ready.");return this._tileDiscardPolicy}},errorEvent:{get:function(){return this._errorEvent}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise}},credit:{get:function(){return this._credit}},usingPrecachedTiles:{get:function(){return this._useTiles}},hasAlphaChannel:{get:function(){return!0}},layers:{get:function(){return this._layers}}});Nm.prototype.getTileCredits=function(e,t,n){};Nm.prototype.requestImage=function(e,t,n,i){if(!this._ready)throw new w("requestImage must not be called before the imagery provider is ready.");return Sf.loadImage(this,eJ(this,e,t,n,i))};Nm.prototype.pickFeatures=function(e,t,n,i,o){if(!this._ready)throw new w("pickFeatures must not be called before the imagery provider is ready.");if(!this.enablePickFeatures)return;const r=this._tilingScheme.tileXYToNativeRectangle(e,t,n);let s,a,c;if(this._tilingScheme.projection instanceof Or)s=F.toDegrees(i),a=F.toDegrees(o),c="4326";else{const _=this._tilingScheme.projection.project(new ve(i,o,0));s=_.x,a=_.y,c="3857"}let u="visible";l(this._layers)&&(u+=`:${this._layers}`);const f={f:"json",tolerance:2,geometryType:"esriGeometryPoint",geometry:`${s},${a}`,mapExtent:`${r.west},${r.south},${r.east},${r.north}`,imageDisplay:`${this._tileWidth},${this._tileHeight},96`,sr:c,layers:u};return this._resource.getDerivedResource({url:"identify",queryParameters:f}).fetchJson().then(function(_){const g=[],p=_.results;if(!l(p))return g;for(let y=0;y<p.length;++y){const T=p[y],b=new g_;if(b.data=T,b.name=T.value,b.properties=T.attributes,b.configureDescriptionFromProperties(T.attributes),T.geometryType==="esriGeometryPoint"&&T.geometry){const x=T.geometry.spatialReference&&T.geometry.spatialReference.wkid?T.geometry.spatialReference.wkid:4326;if(x===4326||x===4283)b.position=ve.fromDegrees(T.geometry.x,T.geometry.y,T.geometry.z);else if(x===102100||x===900913||x===3857){const v=new Ii;b.position=v.unproject(new d(T.geometry.x,T.geometry.y,T.geometry.z))}}g.push(b)}return g})};const RLe={AERIAL:"Aerial",AERIAL_WITH_LABELS:"AerialWithLabels",AERIAL_WITH_LABELS_ON_DEMAND:"AerialWithLabelsOnDemand",ROAD:"Road",ROAD_ON_DEMAND:"RoadOnDemand",CANVAS_DARK:"CanvasDark",CANVAS_LIGHT:"CanvasLight",CANVAS_GRAY:"CanvasGray",ORDNANCE_SURVEY:"OrdnanceSurvey",COLLINS_BART:"CollinsBart"},NLe=Object.freeze(RLe);function tT(e){}tT.prototype.isReady=function(){return!0};tT.prototype.shouldDiscardImage=function(e){return tT.EMPTY_IMAGE===e};let IS;Object.defineProperties(tT,{EMPTY_IMAGE:{get:function(){return l(IS)||(IS=new Image,IS.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII="),IS}}});function Ws(e){e=A(e,A.EMPTY_OBJECT);const t=e.key;if(!l(e.url))throw new w("options.url is required.");if(!l(t))throw new w("options.key is required.");this.defaultAlpha=void 0,this.defaultNightAlpha=void 0,this.defaultDayAlpha=void 0,this.defaultBrightness=void 0,this.defaultContrast=void 0,this.defaultHue=void 0,this.defaultSaturation=void 0,this.defaultGamma=1,this.defaultMinificationFilter=void 0,this.defaultMagnificationFilter=void 0,this._key=t,this._resource=je.createIfNeeded(e.url),this._resource.appendForwardSlash(),this._tileProtocol=e.tileProtocol,this._mapStyle=A(e.mapStyle,NLe.AERIAL),this._culture=A(e.culture,""),this._tileDiscardPolicy=e.tileDiscardPolicy,l(this._tileDiscardPolicy)||(this._tileDiscardPolicy=new tT),this._proxy=e.proxy,this._credit=new Si(`<a href="http://www.bing.com"><img src="${Ws.logoUrl}" title="Bing Imagery"/></a>`),this._tilingScheme=new Za({numberOfLevelZeroTilesX:2,numberOfLevelZeroTilesY:2,ellipsoid:e.ellipsoid}),this._tileWidth=void 0,this._tileHeight=void 0,this._maximumLevel=void 0,this._imageUrlTemplate=void 0,this._imageUrlSubdomains=void 0,this._errorEvent=new lt,this._ready=!1;let n=this._tileProtocol;l(n)?n.length>0&&n[n.length-1]===":"&&(n=n.substr(0,n.length-1)):n=document.location.protocol==="http:"?"http":"https";const i=this._resource.getDerivedResource({url:`REST/v1/Imagery/Metadata/${this._mapStyle}`,queryParameters:{incl:"ImageryProviders",key:this._key,uriScheme:n}}),o=this;let r;function s(h){if(h.resourceSets.length!==1)return a();const _=h.resourceSets[0].resources[0];o._tileWidth=_.imageWidth,o._tileHeight=_.imageHeight,o._maximumLevel=_.zoomMax-1,o._imageUrlSubdomains=_.imageUrlSubdomains,o._imageUrlTemplate=_.imageUrl;let g=o._attributionList=_.imageryProviders;g||(g=o._attributionList=[]);for(let p=0,y=g.length;p<y;++p){const T=g[p];if(T.credit instanceof Si)break;T.credit=new Si(T.attribution);const b=T.coverageAreas;for(let x=0,v=T.coverageAreas.length;x<v;++x){const D=b[x],L=D.bbox;D.bbox=new Ee(F.toRadians(L[1]),F.toRadians(L[0]),F.toRadians(L[3]),F.toRadians(L[2]))}}return o._ready=!0,Lo.reportSuccess(r),Promise.resolve(!0)}function a(h){const _=`An error occurred while accessing ${i.url}.`;return r=Lo.reportError(r,o,o._errorEvent,_,void 0,void 0,void 0),r.retry?u():Promise.reject(new Fe(_))}const c=i.url;function u(){const h=i.fetchJsonp("jsonp");return Ws._metadataCache[c]=h,h.then(s).catch(a)}const f=Ws._metadataCache[c];l(f)?this._readyPromise=f.then(s).catch(a):this._readyPromise=u()}Object.defineProperties(Ws.prototype,{url:{get:function(){return this._resource.url}},proxy:{get:function(){return this._resource.proxy}},key:{get:function(){return this._key}},mapStyle:{get:function(){return this._mapStyle}},culture:{get:function(){return this._culture}},tileWidth:{get:function(){if(!this._ready)throw new w("tileWidth must not be called before the imagery provider is ready.");return this._tileWidth}},tileHeight:{get:function(){if(!this._ready)throw new w("tileHeight must not be called before the imagery provider is ready.");return this._tileHeight}},maximumLevel:{get:function(){if(!this._ready)throw new w("maximumLevel must not be called before the imagery provider is ready.");return this._maximumLevel}},minimumLevel:{get:function(){if(!this._ready)throw new w("minimumLevel must not be called before the imagery provider is ready.");return 0}},tilingScheme:{get:function(){if(!this._ready)throw new w("tilingScheme must not be called before the imagery provider is ready.");return this._tilingScheme}},rectangle:{get:function(){if(!this._ready)throw new w("rectangle must not be called before the imagery provider is ready.");return this._tilingScheme.rectangle}},tileDiscardPolicy:{get:function(){if(!this._ready)throw new w("tileDiscardPolicy must not be called before the imagery provider is ready.");return this._tileDiscardPolicy}},errorEvent:{get:function(){return this._errorEvent}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise}},credit:{get:function(){return this._credit}},hasAlphaChannel:{get:function(){return!1}}});const MLe=new Ee;Ws.prototype.getTileCredits=function(e,t,n){if(!this._ready)throw new w("getTileCredits must not be called before the imagery provider is ready.");const i=this._tilingScheme.tileXYToRectangle(e,t,n,MLe);return ULe(this._attributionList,n,i)};Ws.prototype.requestImage=function(e,t,n,i){if(!this._ready)throw new w("requestImage must not be called before the imagery provider is ready.");const o=Sf.loadImage(this,FLe(this,e,t,n,i));if(l(o))return o.catch(function(r){return l(r.blob)&&r.blob.size===0?tT.EMPTY_IMAGE:Promise.reject(r)})};Ws.prototype.pickFeatures=function(e,t,n,i,o){};Ws.tileXYToQuadKey=function(e,t,n){let i="";for(let o=n;o>=0;--o){const r=1<<o;let s=0;e&r&&(s|=1),t&r&&(s|=2),i+=s}return i};Ws.quadKeyToTileXY=function(e){let t=0,n=0;const i=e.length-1;for(let o=i;o>=0;--o){const r=1<<o,s=+e[i-o];s&1&&(t|=r),s&2&&(n|=r)}return{x:t,y:n,level:i}};Ws._logoUrl=void 0;Object.defineProperties(Ws,{logoUrl:{get:function(){return l(Ws._logoUrl)||(Ws._logoUrl=Un("Assets/Images/bing_maps_credit.png")),Ws._logoUrl},set:function(e){E.defined("value",e),Ws._logoUrl=e}}});function FLe(e,t,n,i,o){const r=e._imageUrlTemplate,s=e._imageUrlSubdomains,a=(t+n+i)%s.length;return e._resource.getDerivedResource({url:r,request:o,templateValues:{quadkey:Ws.tileXYToQuadKey(t,n,i),subdomain:s[a],culture:e._culture},queryParameters:{n:"z"}})}const zLe=new Ee;function ULe(e,t,n){++t;const i=[];for(let o=0,r=e.length;o<r;++o){const s=e[o],a=s.coverageAreas;let c=!1;for(let u=0,f=s.coverageAreas.length;!c&&u<f;++u){const h=a[u];if(t>=h.zoomMin&&t<=h.zoomMax){const _=Ee.intersection(n,h.bbox,zLe);l(_)&&(c=!0)}}c&&i.push(s.credit)}return i}Ws._metadataCache={};const tJ=/{[^}]+}/g,nJ={x:GLe,y:qLe,z:$Le,s:XLe,reverseX:WLe,reverseY:jLe,reverseZ:YLe,westDegrees:KLe,southDegrees:JLe,eastDegrees:QLe,northDegrees:ZLe,westProjected:eBe,southProjected:tBe,eastProjected:nBe,northProjected:iBe,width:oBe,height:rBe},HLe=Ln(nJ,{i:sBe,j:aBe,reverseI:cBe,reverseJ:lBe,longitudeDegrees:fBe,latitudeDegrees:dBe,longitudeProjected:hBe,latitudeProjected:pBe,format:_Be});function bu(e){if(!l(e))throw new w("options is required.");if(!l(e.then)&&!l(e.url))throw new w("options is required.");this._errorEvent=new lt,this._resource=void 0,this._urlSchemeZeroPadding=void 0,this._pickFeaturesResource=void 0,this._tileWidth=void 0,this._tileHeight=void 0,this._maximumLevel=void 0,this._minimumLevel=void 0,this._tilingScheme=void 0,this._rectangle=void 0,this._tileDiscardPolicy=void 0,this._credit=void 0,this._hasAlphaChannel=void 0,this._readyPromise=void 0,this._tags=void 0,this._pickFeaturesTags=void 0,this.defaultAlpha=void 0,this.defaultNightAlpha=void 0,this.defaultDayAlpha=void 0,this.defaultBrightness=void 0,this.defaultContrast=void 0,this.defaultHue=void 0,this.defaultSaturation=void 0,this.defaultGamma=void 0,this.defaultMinificationFilter=void 0,this.defaultMagnificationFilter=void 0,this.enablePickFeatures=!0,this.reinitialize(e)}Object.defineProperties(bu.prototype,{url:{get:function(){return this._resource.url}},urlSchemeZeroPadding:{get:function(){return this._urlSchemeZeroPadding}},pickFeaturesUrl:{get:function(){return this._pickFeaturesResource.url}},proxy:{get:function(){return this._resource.proxy}},tileWidth:{get:function(){if(!this.ready)throw new w("tileWidth must not be called before the imagery provider is ready.");return this._tileWidth}},tileHeight:{get:function(){if(!this.ready)throw new w("tileHeight must not be called before the imagery provider is ready.");return this._tileHeight}},maximumLevel:{get:function(){if(!this.ready)throw new w("maximumLevel must not be called before the imagery provider is ready.");return this._maximumLevel}},minimumLevel:{get:function(){if(!this.ready)throw new w("minimumLevel must not be called before the imagery provider is ready.");return this._minimumLevel}},tilingScheme:{get:function(){if(!this.ready)throw new w("tilingScheme must not be called before the imagery provider is ready.");return this._tilingScheme}},rectangle:{get:function(){if(!this.ready)throw new w("rectangle must not be called before the imagery provider is ready.");return this._rectangle}},tileDiscardPolicy:{get:function(){if(!this.ready)throw new w("tileDiscardPolicy must not be called before the imagery provider is ready.");return this._tileDiscardPolicy}},errorEvent:{get:function(){return this._errorEvent}},ready:{get:function(){return l(this._resource)}},readyPromise:{get:function(){return this._readyPromise}},credit:{get:function(){if(!this.ready)throw new w("credit must not be called before the imagery provider is ready.");return this._credit}},hasAlphaChannel:{get:function(){if(!this.ready)throw new w("hasAlphaChannel must not be called before the imagery provider is ready.");return this._hasAlphaChannel}}});bu.prototype.reinitialize=function(e){const t=this;t._readyPromise=Promise.resolve(e).then(function(n){if(!l(n))throw new w("options is required.");if(!l(n.url))throw new w("options.url is required.");const i=n.customTags,o=Ln(nJ,i),r=Ln(HLe,i),s=je.createIfNeeded(n.url),a=je.createIfNeeded(n.pickFeaturesUrl);t.enablePickFeatures=A(n.enablePickFeatures,t.enablePickFeatures),t._urlSchemeZeroPadding=A(n.urlSchemeZeroPadding,t.urlSchemeZeroPadding),t._tileDiscardPolicy=n.tileDiscardPolicy,t._getFeatureInfoFormats=n.getFeatureInfoFormats,t._subdomains=n.subdomains,Array.isArray(t._subdomains)?t._subdomains=t._subdomains.slice():l(t._subdomains)&&t._subdomains.length>0?t._subdomains=t._subdomains.split(""):t._subdomains=["a","b","c"],t._tileWidth=A(n.tileWidth,256),t._tileHeight=A(n.tileHeight,256),t._minimumLevel=A(n.minimumLevel,0),t._maximumLevel=n.maximumLevel,t._tilingScheme=A(n.tilingScheme,new Za({ellipsoid:n.ellipsoid})),t._rectangle=A(n.rectangle,t._tilingScheme.rectangle),t._rectangle=Ee.intersection(t._rectangle,t._tilingScheme.rectangle),t._hasAlphaChannel=A(n.hasAlphaChannel,!0);let c=n.credit;return typeof c=="string"&&(c=new Si(c)),t._credit=c,t._resource=s,t._tags=o,t._pickFeaturesResource=a,t._pickFeaturesTags=r,!0})};bu.prototype.getTileCredits=function(e,t,n){if(!this.ready)throw new w("getTileCredits must not be called before the imagery provider is ready.")};bu.prototype.requestImage=function(e,t,n,i){if(!this.ready)throw new w("requestImage must not be called before the imagery provider is ready.");return Sf.loadImage(this,VLe(this,e,t,n,i))};bu.prototype.pickFeatures=function(e,t,n,i,o){if(!this.ready)throw new w("pickFeatures must not be called before the imagery provider is ready.");if(!this.enablePickFeatures||!l(this._pickFeaturesResource)||this._getFeatureInfoFormats.length===0)return;let r=0;const s=this;function a(u,f){return u.callback(f)}function c(){if(r>=s._getFeatureInfoFormats.length)return Promise.resolve([]);const u=s._getFeatureInfoFormats[r],f=kLe(s,e,t,n,i,o,u.format);return++r,u.type==="json"?f.fetchJson().then(u.callback).catch(c):u.type==="xml"?f.fetchXML().then(u.callback).catch(c):u.type==="text"||u.type==="html"?f.fetchText().then(u.callback).catch(c):f.fetch({responseType:u.format}).then(a.bind(void 0,u)).catch(c)}return c()};let BI=!1;const Jc=new Ee;let RI=!1;const _x=new Ee;function VLe(e,t,n,i,o){BI=!1,RI=!1;const r=e._resource,s=r.getUrlComponent(!0),a=e._tags,c={},u=s.match(tJ);return l(u)&&u.forEach(function(f){const h=f.substring(1,f.length-1);l(a[h])&&(c[h]=a[h](e,t,n,i))}),r.getDerivedResource({request:o,templateValues:c})}let QM=!1;const nT=new $;let ZM=!1;function kLe(e,t,n,i,o,r,s){BI=!1,RI=!1,QM=!1,ZM=!1;const a=e._pickFeaturesResource,c=a.getUrlComponent(!0),u=e._pickFeaturesTags,f={},h=c.match(tJ);return l(h)&&h.forEach(function(_){const g=_.substring(1,_.length-1);l(u[g])&&(f[g]=u[g](e,t,n,i,o,r,s))}),a.getDerivedResource({templateValues:f})}function ET(e,t,n){if(e&&e.urlSchemeZeroPadding&&e.urlSchemeZeroPadding.hasOwnProperty(t)){const i=e.urlSchemeZeroPadding[t];if(typeof i=="string"){const o=i.length;o>1&&(n=n.length>=o?n:new Array(o-n.toString().length+1).join("0")+n)}}return n}function GLe(e,t,n,i){return ET(e,"{x}",t)}function WLe(e,t,n,i){const o=e.tilingScheme.getNumberOfXTilesAtLevel(i)-t-1;return ET(e,"{reverseX}",o)}function qLe(e,t,n,i){return ET(e,"{y}",n)}function jLe(e,t,n,i){const o=e.tilingScheme.getNumberOfYTilesAtLevel(i)-n-1;return ET(e,"{reverseY}",o)}function YLe(e,t,n,i){const o=e.maximumLevel,r=l(o)&&i<o?o-i-1:i;return ET(e,"{reverseZ}",r)}function $Le(e,t,n,i){return ET(e,"{z}",i)}function XLe(e,t,n,i){const o=(t+n+i)%e._subdomains.length;return e._subdomains[o]}function $1(e,t,n,i){BI||(e.tilingScheme.tileXYToRectangle(t,n,i,Jc),Jc.west=F.toDegrees(Jc.west),Jc.south=F.toDegrees(Jc.south),Jc.east=F.toDegrees(Jc.east),Jc.north=F.toDegrees(Jc.north),BI=!0)}function KLe(e,t,n,i){return $1(e,t,n,i),Jc.west}function JLe(e,t,n,i){return $1(e,t,n,i),Jc.south}function QLe(e,t,n,i){return $1(e,t,n,i),Jc.east}function ZLe(e,t,n,i){return $1(e,t,n,i),Jc.north}function X1(e,t,n,i){RI||(e.tilingScheme.tileXYToNativeRectangle(t,n,i,_x),RI=!0)}function eBe(e,t,n,i){return X1(e,t,n,i),_x.west}function tBe(e,t,n,i){return X1(e,t,n,i),_x.south}function nBe(e,t,n,i){return X1(e,t,n,i),_x.east}function iBe(e,t,n,i){return X1(e,t,n,i),_x.north}function oBe(e,t,n,i){return e.tileWidth}function rBe(e,t,n,i){return e.tileHeight}function sBe(e,t,n,i,o,r,s){return K1(e,t,n,i,o,r),nT.x}function aBe(e,t,n,i,o,r,s){return K1(e,t,n,i,o,r),nT.y}function cBe(e,t,n,i,o,r,s){return K1(e,t,n,i,o,r),e.tileWidth-nT.x-1}function lBe(e,t,n,i,o,r,s){return K1(e,t,n,i,o,r),e.tileHeight-nT.y-1}const uBe=new Ee,wA=new d;function K1(e,t,n,i,o,r,s){if(QM)return;Q3(e,t,n,i,o,r);const a=wA,c=e.tilingScheme.tileXYToNativeRectangle(t,n,i,uBe);nT.x=e.tileWidth*(a.x-c.west)/c.width|0,nT.y=e.tileHeight*(c.north-a.y)/c.height|0,QM=!0}function fBe(e,t,n,i,o,r,s){return F.toDegrees(o)}function dBe(e,t,n,i,o,r,s){return F.toDegrees(r)}function hBe(e,t,n,i,o,r,s){return Q3(e,t,n,i,o,r),wA.x}function pBe(e,t,n,i,o,r,s){return Q3(e,t,n,i,o,r),wA.y}const mBe=new ve;function Q3(e,t,n,i,o,r,s){if(!ZM){if(e.tilingScheme.projection instanceof Or)wA.x=F.toDegrees(o),wA.y=F.toDegrees(r);else{const a=mBe;a.longitude=o,a.latitude=r,e.tilingScheme.projection.project(a,wA)}ZM=!0}}function _Be(e,t,n,i,o,r,s){return s}function Nh(e){if(e=A(e,A.EMPTY_OBJECT),!l(e.url))throw new w("options.url is required.");this._tmsResource=void 0,this._xmlResource=void 0,this._options=e,this._metadataError=void 0,this._metadataSuccess=this._metadataSuccess.bind(this),this._metadataFailure=this._metadataFailure.bind(this),this._requestMetadata=this._requestMetadata.bind(this);let t;const n=this,i=Promise.resolve(e.url).then(function(o){return t=je.createIfNeeded(o),t.appendForwardSlash(),n._tmsResource=t,n._xmlResource=t.getDerivedResource({url:"tilemapresource.xml"}),n._requestMetadata()}).catch(o=>Promise.reject(o));bu.call(this,i),this._promise=i}l(Object.create)&&(Nh.prototype=Object.create(bu.prototype),Nh.prototype.constructor=Nh);Nh.prototype._requestMetadata=function(){return this._xmlResource.fetchXML().then(this._metadataSuccess).catch(e=>e instanceof JA?this._metadataFailure():Promise.reject(e))};function iJ(e,t){return e.west<t.rectangle.west&&(e.west=t.rectangle.west),e.east>t.rectangle.east&&(e.east=t.rectangle.east),e.south<t.rectangle.south&&(e.south=t.rectangle.south),e.north>t.rectangle.north&&(e.north=t.rectangle.north),e}function oJ(e,t,n){const i=e.positionToTileXY(Ee.southwest(t),n),o=e.positionToTileXY(Ee.northeast(t),n);return(Math.abs(o.x-i.x)+1)*(Math.abs(o.y-i.y)+1)>4?0:n}Nh.prototype._metadataSuccess=function(e){const t=/tileformat/i,n=/tileset/i,i=/tilesets/i,o=/boundingbox/i;let r,s,a;const c=[],u=this._xmlResource;let f=this._metadataError;const h=this._requestMetadata,_=e.childNodes[0].childNodes;for(let M=0;M<_.length;M++)if(t.test(_.item(M).nodeName))r=_.item(M);else if(i.test(_.item(M).nodeName)){a=_.item(M);const H=_.item(M).childNodes;for(let G=0;G<H.length;G++)n.test(H.item(G).nodeName)&&c.push(H.item(G))}else o.test(_.item(M).nodeName)&&(s=_.item(M));let g;if(!l(a)||!l(s))return g=`Unable to find expected tilesets or bbox attributes in ${u.url}.`,f=Lo.reportError(f,this,this.errorEvent,g),f.retry?(this._metadataError=f,h()):Promise.reject(new Fe(g));const p=this._options,y=A(p.fileExtension,r.getAttribute("extension")),T=A(p.tileWidth,parseInt(r.getAttribute("width"),10)),b=A(p.tileHeight,parseInt(r.getAttribute("height"),10));let x=A(p.minimumLevel,parseInt(c[0].getAttribute("order"),10));const v=A(p.maximumLevel,parseInt(c[c.length-1].getAttribute("order"),10)),D=a.getAttribute("profile");let L=p.tilingScheme;if(!l(L))if(D==="geodetic"||D==="global-geodetic")L=new Ga({ellipsoid:p.ellipsoid});else if(D==="mercator"||D==="global-mercator")L=new Za({ellipsoid:p.ellipsoid});else return g=`${u.url}specifies an unsupported profile attribute, ${D}.`,f=Lo.reportError(f,this,this.errorEvent,g),f.retry?(this._metadataError=f,h()):Promise.reject(new Fe(g));let B=Ee.clone(p.rectangle);if(!l(B)){let M,H,G,I;A(p.flipXY,!1)?(G=new $(parseFloat(s.getAttribute("miny")),parseFloat(s.getAttribute("minx"))),I=new $(parseFloat(s.getAttribute("maxy")),parseFloat(s.getAttribute("maxx")))):(G=new $(parseFloat(s.getAttribute("minx")),parseFloat(s.getAttribute("miny"))),I=new $(parseFloat(s.getAttribute("maxx")),parseFloat(s.getAttribute("maxy"))));const m=D==="geodetic"||D==="mercator";if(L.projection instanceof Or||m)M=ve.fromDegrees(G.x,G.y),H=ve.fromDegrees(I.x,I.y);else{const P=L.projection;M=P.unproject(G),H=P.unproject(I)}B=new Ee(M.longitude,M.latitude,H.longitude,H.latitude)}B=iJ(B,L),x=oJ(L,B,x);const V=this._tmsResource.getDerivedResource({url:`{z}/{x}/{reverseY}.${y}`});return Promise.resolve({url:V,tilingScheme:L,rectangle:B,tileWidth:T,tileHeight:b,minimumLevel:x,maximumLevel:v,tileDiscardPolicy:p.tileDiscardPolicy,credit:p.credit})};Nh.prototype._metadataFailure=function(){const e=this._options,t=A(e.fileExtension,"png"),n=A(e.tileWidth,256),i=A(e.tileHeight,256),o=e.maximumLevel,r=l(e.tilingScheme)?e.tilingScheme:new Za({ellipsoid:e.ellipsoid});let s=A(e.rectangle,r.rectangle);s=iJ(s,r);const a=oJ(r,s,e.minimumLevel),c=this._tmsResource.getDerivedResource({url:`{z}/{x}/{reverseY}.${t}`});return Promise.resolve({url:c,tilingScheme:r,rectangle:s,tileWidth:n,tileHeight:i,minimumLevel:a,maximumLevel:o,tileDiscardPolicy:e.tileDiscardPolicy,credit:e.credit})};function eu(e){if(e=A(e,{}),!l(e.url))throw new w("options.url is required.");if(!l(e.channel))throw new w("options.channel is required.");this.defaultAlpha=void 0,this.defaultNightAlpha=void 0,this.defaultDayAlpha=void 0,this.defaultBrightness=void 0,this.defaultContrast=void 0,this.defaultHue=void 0,this.defaultSaturation=void 0,this.defaultGamma=1.9,this.defaultMinificationFilter=void 0,this.defaultMagnificationFilter=void 0;const t=e.url,n=A(e.path,"/default_map"),i=je.createIfNeeded(t).getDerivedResource({url:n[0]==="/"?n.substring(1):n});i.appendForwardSlash(),this._resource=i,this._url=t,this._path=n,this._tileDiscardPolicy=e.tileDiscardPolicy,this._channel=e.channel,this._requestType="ImageryMaps",this._credit=new Si(`<a href="http://www.google.com/enterprise/mapsearth/products/earthenterprise.html"><img src="${eu.logoUrl}" title="Google Imagery"/></a>`),this._tilingScheme=void 0,this._version=void 0,this._tileWidth=256,this._tileHeight=256,this._maximumLevel=e.maximumLevel,this._errorEvent=new lt,this._ready=!1;const o=i.getDerivedResource({url:"query",queryParameters:{request:"Json",vars:"geeServerDefs",is2d:"t"}}),r=this;let s;function a(f){let h;try{h=JSON.parse(f)}catch{h=JSON.parse(f.replace(/([\[\{,])[\n\r ]*([A-Za-z0-9]+)[\n\r ]*:/g,'$1"$2":'))}let _;for(let p=0;p<h.layers.length;p++)if(h.layers[p].id===r._channel){_=h.layers[p];break}let g;if(!l(_))return g=`Could not find layer with channel (id) of ${r._channel}.`,s=Lo.reportError(s,r,r._errorEvent,g),s.retry?u():Promise.reject(new Fe(g));if(!l(_.version))return g=`Could not find a version in channel (id) ${r._channel}.`,s=Lo.reportError(s,r,r._errorEvent,g),s.retry?u():Promise.reject(new Fe(g));if(r._version=_.version,l(h.projection)&&h.projection==="flat")r._tilingScheme=new Ga({numberOfLevelZeroTilesX:2,numberOfLevelZeroTilesY:2,rectangle:new Ee(-Math.PI,-Math.PI,Math.PI,Math.PI),ellipsoid:e.ellipsoid});else if(!l(h.projection)||h.projection==="mercator")r._tilingScheme=new Za({numberOfLevelZeroTilesX:2,numberOfLevelZeroTilesY:2,ellipsoid:e.ellipsoid});else return g=`Unsupported projection ${h.projection}.`,s=Lo.reportError(s,r,r._errorEvent,g),s.retry?u():Promise.reject(new Fe(g));return r._ready=!0,Lo.reportSuccess(s),Promise.resolve(!0)}function c(f){const h=A(f.message,`An error occurred while accessing ${o.url}.`);return s=Lo.reportError(s,r,r._errorEvent,h),Promise.reject(new Fe(h))}function u(){return o.fetchText().then(a).catch(c)}this._readyPromise=u()}Object.defineProperties(eu.prototype,{url:{get:function(){return this._url}},path:{get:function(){return this._path}},proxy:{get:function(){return this._resource.proxy}},channel:{get:function(){return this._channel}},tileWidth:{get:function(){if(!this._ready)throw new w("tileWidth must not be called before the imagery provider is ready.");return this._tileWidth}},tileHeight:{get:function(){if(!this._ready)throw new w("tileHeight must not be called before the imagery provider is ready.");return this._tileHeight}},maximumLevel:{get:function(){if(!this._ready)throw new w("maximumLevel must not be called before the imagery provider is ready.");return this._maximumLevel}},minimumLevel:{get:function(){if(!this._ready)throw new w("minimumLevel must not be called before the imagery provider is ready.");return 0}},tilingScheme:{get:function(){if(!this._ready)throw new w("tilingScheme must not be called before the imagery provider is ready.");return this._tilingScheme}},version:{get:function(){if(!this._ready)throw new w("version must not be called before the imagery provider is ready.");return this._version}},requestType:{get:function(){if(!this._ready)throw new w("requestType must not be called before the imagery provider is ready.");return this._requestType}},rectangle:{get:function(){if(!this._ready)throw new w("rectangle must not be called before the imagery provider is ready.");return this._tilingScheme.rectangle}},tileDiscardPolicy:{get:function(){if(!this._ready)throw new w("tileDiscardPolicy must not be called before the imagery provider is ready.");return this._tileDiscardPolicy}},errorEvent:{get:function(){return this._errorEvent}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise}},credit:{get:function(){return this._credit}},hasAlphaChannel:{get:function(){return!0}}});eu.prototype.getTileCredits=function(e,t,n){};eu.prototype.requestImage=function(e,t,n,i){if(!this._ready)throw new w("requestImage must not be called before the imagery provider is ready.");const o=this._resource.getDerivedResource({url:"query",request:i,queryParameters:{request:this._requestType,channel:this._channel,version:this._version,x:e,y:t,z:n+1}});return Sf.loadImage(this,o)};eu.prototype.pickFeatures=function(e,t,n,i,o){};eu._logoUrl=void 0;Object.defineProperties(eu,{logoUrl:{get:function(){return l(eu._logoUrl)||(eu._logoUrl=Un("Assets/Images/google_earth_credit.png")),eu._logoUrl},set:function(e){E.defined("value",e),eu._logoUrl=e}}});const gBe=/\/$/,rJ=new Si('© <a href="https://www.mapbox.com/about/maps/">Mapbox</a> © <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> <strong><a href="https://www.mapbox.com/map-feedback/">Improve this map</a></strong>');function Iy(e){e=A(e,A.EMPTY_OBJECT);const t=e.mapId;if(!l(t))throw new w("options.mapId is required.");const n=e.accessToken;if(!l(n))throw new w("options.accessToken is required.");this.defaultAlpha=void 0,this.defaultNightAlpha=void 0,this.defaultDayAlpha=void 0,this.defaultBrightness=void 0,this.defaultContrast=void 0,this.defaultHue=void 0,this.defaultSaturation=void 0,this.defaultGamma=void 0,this.defaultMinificationFilter=void 0,this.defaultMagnificationFilter=void 0;const i=je.createIfNeeded(A(e.url,"https://{s}.tiles.mapbox.com/v4/"));this._mapId=t,this._accessToken=n;let o=A(e.format,"png");/\./.test(o)||(o=`.${o}`),this._format=o;let r=i.getUrlComponent();gBe.test(r)||(r+="/"),r+=`${t}/{z}/{x}/{y}${this._format}`,i.url=r,i.setQueryParameters({access_token:n});let s;l(e.credit)?(s=e.credit,typeof s=="string"&&(s=new Si(s))):s=rJ,this._resource=i,this._imageryProvider=new bu({url:i,credit:s,ellipsoid:e.ellipsoid,minimumLevel:e.minimumLevel,maximumLevel:e.maximumLevel,rectangle:e.rectangle})}Object.defineProperties(Iy.prototype,{url:{get:function(){return this._imageryProvider.url}},ready:{get:function(){return this._imageryProvider.ready}},readyPromise:{get:function(){return this._imageryProvider.readyPromise}},rectangle:{get:function(){return this._imageryProvider.rectangle}},tileWidth:{get:function(){return this._imageryProvider.tileWidth}},tileHeight:{get:function(){return this._imageryProvider.tileHeight}},maximumLevel:{get:function(){return this._imageryProvider.maximumLevel}},minimumLevel:{get:function(){return this._imageryProvider.minimumLevel}},tilingScheme:{get:function(){return this._imageryProvider.tilingScheme}},tileDiscardPolicy:{get:function(){return this._imageryProvider.tileDiscardPolicy}},errorEvent:{get:function(){return this._imageryProvider.errorEvent}},credit:{get:function(){return this._imageryProvider.credit}},proxy:{get:function(){return this._imageryProvider.proxy}},hasAlphaChannel:{get:function(){return this._imageryProvider.hasAlphaChannel}}});Iy.prototype.getTileCredits=function(e,t,n){};Iy.prototype.requestImage=function(e,t,n,i){return this._imageryProvider.requestImage(e,t,n,i)};Iy.prototype.pickFeatures=function(e,t,n,i,o){return this._imageryProvider.pickFeatures(e,t,n,i,o)};Iy._defaultCredit=rJ;function gx(e){if(e=A(e,A.EMPTY_OBJECT),!l(e.url))throw new w("options.url is required.");this.defaultAlpha=void 0,this.defaultNightAlpha=void 0,this.defaultDayAlpha=void 0,this.defaultBrightness=void 0,this.defaultContrast=void 0,this.defaultHue=void 0,this.defaultSaturation=void 0,this.defaultGamma=void 0,this.defaultMinificationFilter=void 0,this.defaultMagnificationFilter=void 0;const t=je.createIfNeeded(e.url),n=A(e.rectangle,Ee.MAX_VALUE),i=new Ga({rectangle:n,numberOfLevelZeroTilesX:1,numberOfLevelZeroTilesY:1,ellipsoid:e.ellipsoid});this._tilingScheme=i,this._resource=t,this._image=void 0,this._texture=void 0,this._tileWidth=0,this._tileHeight=0,this._errorEvent=new lt,this._ready=!1;let o=e.credit;typeof o=="string"&&(o=new Si(o)),this._credit=o;const r=this;let s;function a(f){return r._image=f,r._tileWidth=f.width,r._tileHeight=f.height,r._ready=!0,Lo.reportSuccess(r._errorEvent),Promise.resolve(!0)}function c(f){const h=`Failed to load image ${t.url}.`;return s=Lo.reportError(s,r,r._errorEvent,h,0,0,0),s.retry?u():Promise.reject(new Fe(h))}function u(){return Sf.loadImage(null,t).then(a).catch(c)}this._readyPromise=u()}Object.defineProperties(gx.prototype,{url:{get:function(){return this._resource.url}},proxy:{get:function(){return this._resource.proxy}},tileWidth:{get:function(){if(!this._ready)throw new w("tileWidth must not be called before the imagery provider is ready.");return this._tileWidth}},tileHeight:{get:function(){if(!this._ready)throw new w("tileHeight must not be called before the imagery provider is ready.");return this._tileHeight}},maximumLevel:{get:function(){if(!this._ready)throw new w("maximumLevel must not be called before the imagery provider is ready.");return 0}},minimumLevel:{get:function(){if(!this._ready)throw new w("minimumLevel must not be called before the imagery provider is ready.");return 0}},tilingScheme:{get:function(){if(!this._ready)throw new w("tilingScheme must not be called before the imagery provider is ready.");return this._tilingScheme}},rectangle:{get:function(){return this._tilingScheme.rectangle}},tileDiscardPolicy:{get:function(){if(!this._ready)throw new w("tileDiscardPolicy must not be called before the imagery provider is ready.")}},errorEvent:{get:function(){return this._errorEvent}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise}},credit:{get:function(){return this._credit}},hasAlphaChannel:{get:function(){return!0}}});gx.prototype.getTileCredits=function(e,t,n){};gx.prototype.requestImage=function(e,t,n,i){if(!this._ready)throw new w("requestImage must not be called before the imagery provider is ready.");if(l(this._image))return Promise.resolve(this._image)};gx.prototype.pickFeatures=function(e,t,n,i,o){};function cB(e,t,n){if(!l(e))throw new w("type is required.");if(this.type=e,!l(t))if(e==="json")t="application/json";else if(e==="xml")t="text/xml";else if(e==="html")t="text/html";else if(e==="text")t="text/plain";else throw new w('format is required when type is not "json", "xml", "html", or "text".');if(this.format=t,!l(n))if(e==="json")n=yBe;else if(e==="xml")n=bBe;else if(e==="html")n=G5;else if(e==="text")n=G5;else throw new w('callback is required when type is not "json", "xml", "html", or "text".');this.callback=n}function yBe(e){const t=[],n=e.features;for(let i=0;i<n.length;++i){const o=n[i],r=new g_;if(r.data=o,r.properties=o.properties,r.configureNameFromProperties(o.properties),r.configureDescriptionFromProperties(o.properties),l(o.geometry)&&o.geometry.type==="Point"){const s=o.geometry.coordinates[0],a=o.geometry.coordinates[1];r.position=ve.fromDegrees(s,a)}t.push(r)}return t}const eF="http://www.mapinfo.com/mxp",ABe="http://www.esri.com/wms",TBe="http://www.opengis.net/wfs",CBe="http://www.opengis.net/gml";function bBe(e){const t=e.documentElement;if(t.localName==="MultiFeatureCollection"&&t.namespaceURI===eF)return EBe(e);if(t.localName==="FeatureInfoResponse"&&t.namespaceURI===ABe)return xBe(e);if(t.localName==="FeatureCollection"&&t.namespaceURI===TBe)return wBe(e);if(t.localName==="ServiceExceptionReport")throw new Fe(new XMLSerializer().serializeToString(t));return t.localName==="msGMLOutput"?SBe(e):vBe(e)}function EBe(e){const t=[],i=e.documentElement.getElementsByTagNameNS(eF,"Feature");for(let o=0;o<i.length;++o){const r=i[o],s={},a=r.getElementsByTagNameNS(eF,"Val");for(let u=0;u<a.length;++u){const f=a[u];if(f.hasAttribute("ref")){const h=f.getAttribute("ref"),_=f.textContent.trim();s[h]=_}}const c=new g_;c.data=r,c.properties=s,c.configureNameFromProperties(s),c.configureDescriptionFromProperties(s),t.push(c)}return t}function xBe(e){const t=e.documentElement,n=[];let i;const o=t.getElementsByTagNameNS("*","FIELDS");if(o.length>0)for(let r=0;r<o.length;++r){const s=o[r];i={};const a=s.attributes;for(let c=0;c<a.length;++c){const u=a[c];i[u.name]=u.value}n.push(NI(s,i))}else{const r=t.getElementsByTagNameNS("*","FeatureInfo");for(let s=0;s<r.length;++s){const a=r[s];i={};const c=a.childNodes;for(let u=0;u<c.length;++u){const f=c[u];f.nodeType===Node.ELEMENT_NODE&&(i[f.localName]=f.textContent)}n.push(NI(a,i))}}return n}function wBe(e){const t=[],i=e.documentElement.getElementsByTagNameNS(CBe,"featureMember");for(let o=0;o<i.length;++o){const r=i[o],s={};Z3(r,s),t.push(NI(r,s))}return t}function SBe(e){const t=[];let n;const i=e.documentElement.childNodes;for(let r=0;r<i.length;r++)if(i[r].nodeType===Node.ELEMENT_NODE){n=i[r];break}if(!l(n))throw new Fe("Unable to find first child of the feature info xml document");const o=n.childNodes;for(let r=0;r<o.length;++r){const s=o[r];if(s.nodeType===Node.ELEMENT_NODE){const a={};Z3(s,a),t.push(NI(s,a))}}return t}function Z3(e,t){let n=!0;for(let i=0;i<e.childNodes.length;++i){const o=e.childNodes[i];o.nodeType===Node.ELEMENT_NODE&&(n=!1),!(o.localName==="Point"||o.localName==="LineString"||o.localName==="Polygon"||o.localName==="boundedBy")&&o.hasChildNodes()&&Z3(o,t)&&(t[o.localName]=o.textContent)}return n}function NI(e,t){const n=new g_;return n.data=e,n.properties=t,n.configureNameFromProperties(t),n.configureDescriptionFromProperties(t),n}function vBe(e){const t=new XMLSerializer().serializeToString(e),n=document.createElement("div"),i=document.createElement("pre");i.textContent=t,n.appendChild(i);const o=new g_;return o.data=e,o.description=n.innerHTML,[o]}const DBe=/<body>\s*<\/body>/im,IBe=/<ServiceExceptionReport([\s\S]*)<\/ServiceExceptionReport>/im,PBe=/<title>([\s\S]*)<\/title>/im;function G5(e){if(DBe.test(e)||IBe.test(e))return;let t;const n=PBe.exec(e);n&&n.length>1&&(t=n[1]);const i=new g_;return i.name=t,i.description=e,i.data=e,[i]}function xT(e){e=A(e,A.EMPTY_OBJECT),E.typeOf.object("options.clock",e.clock),E.typeOf.object("options.times",e.times),E.typeOf.func("options.requestImageFunction",e.requestImageFunction),E.typeOf.func("options.reloadFunction",e.reloadFunction),this._tileCache={},this._tilesRequestedForInterval=[];const t=this._clock=e.clock;this._times=e.times,this._requestImageFunction=e.requestImageFunction,this._reloadFunction=e.reloadFunction,this._currentIntervalIndex=-1,t.onTick.addEventListener(this._clockOnTick,this),this._clockOnTick(t)}Object.defineProperties(xT.prototype,{clock:{get:function(){return this._clock},set:function(e){if(!l(e))throw new w("value is required.");this._clock!==e&&(this._clock=e,this._clockOnTick(e),this._reloadFunction())}},times:{get:function(){return this._times},set:function(e){if(!l(e))throw new w("value is required.");this._times!==e&&(this._times=e,this._clockOnTick(this._clock),this._reloadFunction())}},currentInterval:{get:function(){return this._times.get(this._currentIntervalIndex)}}});xT.prototype.getFromCache=function(e,t,n,i){const o=sJ(e,t,n);let r;const s=this._tileCache[this._currentIntervalIndex];if(l(s)&&l(s[o])){const a=s[o];r=a.promise.catch(function(c){throw i.state=a.request.state,c}),delete s[o]}return r};xT.prototype.checkApproachingInterval=function(e,t,n,i){const o=sJ(e,t,n),r=this._tilesRequestedForInterval,s=aJ(this),a={key:o,priorityFunction:i.priorityFunction};(!l(s)||!cJ(this,a,s))&&r.push(a),r.length>=512&&r.splice(0,256)};xT.prototype._clockOnTick=function(e){const t=e.currentTime,i=this._times.indexOf(t),o=this._currentIntervalIndex;if(i!==o){const s=this._tileCache[o];for(const a in s)s.hasOwnProperty(a)&&s[a].request.cancel();delete this._tileCache[o],this._tilesRequestedForInterval=[],this._currentIntervalIndex=i,this._reloadFunction();return}const r=aJ(this);if(l(r)){const s=this._tilesRequestedForInterval;let a=!0;for(;a&&s.length!==0;){const c=s.pop();a=cJ(this,c,r),a||s.push(c)}}};function sJ(e,t,n){return`${e}-${t}-${n}`}function OBe(e){const t=e.split("-");if(t.length===3)return{x:Number(t[0]),y:Number(t[1]),level:Number(t[2])}}function aJ(e){const t=e._times;if(!l(t))return;const n=e._clock,i=n.currentTime,o=n.canAnimate&&n.shouldAnimate,r=n.multiplier;if(!o&&r!==0)return;let s,a=t.indexOf(i);if(a<0)return;const c=t.get(a);return r>0?(s=ce.secondsDifference(c.stop,i),++a):(s=ce.secondsDifference(c.start,i),--a),s/=r,a>=0&&s<=5?t.get(a):void 0}function cJ(e,t,n){const i=e._times.indexOf(n.start),o=e._tileCache;let r=o[i];l(r)||(r=o[i]={});const s=t.key;if(l(r[s]))return!0;const a=OBe(s),c=new Ad({throttle:!1,throttleByServer:!0,type:xy.IMAGERY,priorityFunction:t.priorityFunction}),u=e._requestImageFunction(a.x,a.y,a.level,c,n);return l(u)?(r[s]={promise:u,request:c},!0):!1}const LBe=[3034,3035,3042,3043,3044],BBe=[4471,4559];function of(e){if(e=A(e,A.EMPTY_OBJECT),!l(e.url))throw new w("options.url is required.");if(!l(e.layers))throw new w("options.layers is required.");if(l(e.times)&&!l(e.clock))throw new w("options.times was specified, so options.clock is required.");this.defaultAlpha=void 0,this.defaultNightAlpha=void 0,this.defaultDayAlpha=void 0,this.defaultBrightness=void 0,this.defaultContrast=void 0,this.defaultHue=void 0,this.defaultSaturation=void 0,this.defaultGamma=void 0,this.defaultMinificationFilter=void 0,this.defaultMagnificationFilter=void 0,this._getFeatureInfoUrl=A(e.getFeatureInfoUrl,e.url);const t=je.createIfNeeded(e.url),n=je.createIfNeeded(this._getFeatureInfoUrl);t.setQueryParameters(of.DefaultParameters,!0),n.setQueryParameters(of.GetFeatureInfoDefaultParameters,!0),l(e.parameters)&&t.setQueryParameters(W5(e.parameters)),l(e.getFeatureInfoParameters)&&n.setQueryParameters(W5(e.getFeatureInfoParameters));const i=this;this._reload=void 0,l(e.times)&&(this._timeDynamicImagery=new xT({clock:e.clock,times:e.times,requestImageFunction:function(s,a,c,u,f){return lJ(i,s,a,c,u,f)},reloadFunction:function(){l(i._reload)&&i._reload()}}));const o={};if(o.layers=e.layers,o.bbox="{westProjected},{southProjected},{eastProjected},{northProjected}",o.width="{width}",o.height="{height}",parseFloat(t.queryParameters.version)>=1.3){o.crs=A(e.crs,e.tilingScheme&&e.tilingScheme.projection instanceof Ii?"EPSG:3857":"CRS:84");const s=o.crs.split(":");if(s[0]==="EPSG"&&s.length===2){const a=Number(s[1]);(a>=4e3&&a<5e3&&!BBe.includes(a)||LBe.includes(a))&&(o.bbox="{southProjected},{westProjected},{northProjected},{eastProjected}")}}else o.srs=A(e.srs,e.tilingScheme&&e.tilingScheme.projection instanceof Ii?"EPSG:3857":"EPSG:4326");t.setQueryParameters(o,!0),n.setQueryParameters(o,!0);const r={query_layers:e.layers,info_format:"{format}"};parseFloat(n.queryParameters.version)>=1.3?(r.i="{i}",r.j="{j}"):(r.x="{i}",r.y="{j}"),n.setQueryParameters(r,!0),this._resource=t,this._pickFeaturesResource=n,this._layers=e.layers,this._tileProvider=new bu({url:t,pickFeaturesUrl:n,tilingScheme:A(e.tilingScheme,new Ga({ellipsoid:e.ellipsoid})),rectangle:e.rectangle,tileWidth:e.tileWidth,tileHeight:e.tileHeight,minimumLevel:e.minimumLevel,maximumLevel:e.maximumLevel,subdomains:e.subdomains,tileDiscardPolicy:e.tileDiscardPolicy,credit:e.credit,getFeatureInfoFormats:A(e.getFeatureInfoFormats,of.DefaultGetFeatureInfoFormats),enablePickFeatures:e.enablePickFeatures})}function lJ(e,t,n,i,o,r){const s=l(r)?r.data:void 0,a=e._tileProvider;return l(s)&&a._resource.setQueryParameters(s),a.requestImage(t,n,i,o)}function RBe(e,t,n,i,o,r,s){const a=l(s)?s.data:void 0,c=e._tileProvider;return l(a)&&c._pickFeaturesResource.setQueryParameters(a),c.pickFeatures(t,n,i,o,r)}Object.defineProperties(of.prototype,{url:{get:function(){return this._resource._url}},proxy:{get:function(){return this._resource.proxy}},layers:{get:function(){return this._layers}},tileWidth:{get:function(){return this._tileProvider.tileWidth}},tileHeight:{get:function(){return this._tileProvider.tileHeight}},maximumLevel:{get:function(){return this._tileProvider.maximumLevel}},minimumLevel:{get:function(){return this._tileProvider.minimumLevel}},tilingScheme:{get:function(){return this._tileProvider.tilingScheme}},rectangle:{get:function(){return this._tileProvider.rectangle}},tileDiscardPolicy:{get:function(){return this._tileProvider.tileDiscardPolicy}},errorEvent:{get:function(){return this._tileProvider.errorEvent}},ready:{get:function(){return this._tileProvider.ready}},readyPromise:{get:function(){return this._tileProvider.readyPromise}},credit:{get:function(){return this._tileProvider.credit}},hasAlphaChannel:{get:function(){return this._tileProvider.hasAlphaChannel}},enablePickFeatures:{get:function(){return this._tileProvider.enablePickFeatures},set:function(e){this._tileProvider.enablePickFeatures=e}},clock:{get:function(){return this._timeDynamicImagery.clock},set:function(e){this._timeDynamicImagery.clock=e}},times:{get:function(){return this._timeDynamicImagery.times},set:function(e){this._timeDynamicImagery.times=e}},getFeatureInfoUrl:{get:function(){return this._getFeatureInfoUrl}}});of.prototype.getTileCredits=function(e,t,n){return this._tileProvider.getTileCredits(e,t,n)};of.prototype.requestImage=function(e,t,n,i){let o;const r=this._timeDynamicImagery;let s;return l(r)&&(s=r.currentInterval,o=r.getFromCache(e,t,n,i)),l(o)||(o=lJ(this,e,t,n,i,s)),l(o)&&l(r)&&r.checkApproachingInterval(e,t,n,i),o};of.prototype.pickFeatures=function(e,t,n,i,o){const r=this._timeDynamicImagery,s=l(r)?r.currentInterval:void 0;return RBe(this,e,t,n,i,o,s)};of.DefaultParameters=Object.freeze({service:"WMS",version:"1.1.1",request:"GetMap",styles:"",format:"image/jpeg"});of.GetFeatureInfoDefaultParameters=Object.freeze({service:"WMS",version:"1.1.1",request:"GetFeatureInfo"});of.DefaultGetFeatureInfoFormats=Object.freeze([Object.freeze(new cB("json","application/json")),Object.freeze(new cB("xml","text/xml")),Object.freeze(new cB("text","text/html"))]);function W5(e){const t={};for(const n in e)e.hasOwnProperty(n)&&(t[n.toLowerCase()]=e[n]);return t}const NBe=Object.freeze({service:"WMTS",version:"1.0.0",request:"GetTile"});function yx(e){if(e=A(e,A.EMPTY_OBJECT),!l(e.url))throw new w("options.url is required.");if(!l(e.layer))throw new w("options.layer is required.");if(!l(e.style))throw new w("options.style is required.");if(!l(e.tileMatrixSetID))throw new w("options.tileMatrixSetID is required.");if(l(e.times)&&!l(e.clock))throw new w("options.times was specified, so options.clock is required.");this.defaultAlpha=void 0,this.defaultNightAlpha=void 0,this.defaultDayAlpha=void 0,this.defaultBrightness=void 0,this.defaultContrast=void 0,this.defaultHue=void 0,this.defaultSaturation=void 0,this.defaultGamma=void 0,this.defaultMinificationFilter=void 0,this.defaultMagnificationFilter=void 0;const t=je.createIfNeeded(e.url),n=e.style,i=e.tileMatrixSetID,o=t.url,r=o.match(/{/g);if(!l(r)||r.length===1&&/{s}/.test(o))t.setQueryParameters(NBe),this._useKvp=!0;else{const h={style:n,Style:n,TileMatrixSet:i};t.setTemplateValues(h),this._useKvp=!1}this._resource=t,this._layer=e.layer,this._style=n,this._tileMatrixSetID=i,this._tileMatrixLabels=e.tileMatrixLabels,this._format=A(e.format,"image/jpeg"),this._tileDiscardPolicy=e.tileDiscardPolicy,this._tilingScheme=l(e.tilingScheme)?e.tilingScheme:new Za({ellipsoid:e.ellipsoid}),this._tileWidth=A(e.tileWidth,256),this._tileHeight=A(e.tileHeight,256),this._minimumLevel=A(e.minimumLevel,0),this._maximumLevel=e.maximumLevel,this._rectangle=A(e.rectangle,this._tilingScheme.rectangle),this._dimensions=e.dimensions;const s=this;this._reload=void 0,l(e.times)&&(this._timeDynamicImagery=new xT({clock:e.clock,times:e.times,requestImageFunction:function(h,_,g,p,y){return uJ(s,h,_,g,p,y)},reloadFunction:function(){l(s._reload)&&s._reload()}})),this._readyPromise=Promise.resolve(!0);const a=this._tilingScheme.positionToTileXY(Ee.southwest(this._rectangle),this._minimumLevel),c=this._tilingScheme.positionToTileXY(Ee.northeast(this._rectangle),this._minimumLevel),u=(Math.abs(c.x-a.x)+1)*(Math.abs(c.y-a.y)+1);if(u>4)throw new w(`The imagery provider's rectangle and minimumLevel indicate that there are ${u} tiles at the minimum level. Imagery providers with more than four tiles at the minimum level are not supported.`);this._errorEvent=new lt;const f=e.credit;this._credit=typeof f=="string"?new Si(f):f,this._subdomains=e.subdomains,Array.isArray(this._subdomains)?this._subdomains=this._subdomains.slice():l(this._subdomains)&&this._subdomains.length>0?this._subdomains=this._subdomains.split(""):this._subdomains=["a","b","c"]}function uJ(e,t,n,i,o,r){const s=e._tileMatrixLabels,a=l(s)?s[i]:i.toString(),c=e._subdomains,u=e._dimensions,f=l(r)?r.data:void 0;let h,_;if(!e._useKvp)_={TileMatrix:a,TileRow:n.toString(),TileCol:t.toString(),s:c[(t+n+i)%c.length]},h=e._resource.getDerivedResource({request:o}),h.setTemplateValues(_),l(u)&&h.setTemplateValues(u),l(f)&&h.setTemplateValues(f);else{let g={};g.tilematrix=a,g.layer=e._layer,g.style=e._style,g.tilerow=n,g.tilecol=t,g.tilematrixset=e._tileMatrixSetID,g.format=e._format,l(u)&&(g=Ln(g,u)),l(f)&&(g=Ln(g,f)),_={s:c[(t+n+i)%c.length]},h=e._resource.getDerivedResource({queryParameters:g,request:o}),h.setTemplateValues(_)}return Sf.loadImage(e,h)}Object.defineProperties(yx.prototype,{url:{get:function(){return this._resource.url}},proxy:{get:function(){return this._resource.proxy}},tileWidth:{get:function(){return this._tileWidth}},tileHeight:{get:function(){return this._tileHeight}},maximumLevel:{get:function(){return this._maximumLevel}},minimumLevel:{get:function(){return this._minimumLevel}},tilingScheme:{get:function(){return this._tilingScheme}},rectangle:{get:function(){return this._rectangle}},tileDiscardPolicy:{get:function(){return this._tileDiscardPolicy}},errorEvent:{get:function(){return this._errorEvent}},format:{get:function(){return this._format}},ready:{value:!0},readyPromise:{get:function(){return this._readyPromise}},credit:{get:function(){return this._credit}},hasAlphaChannel:{get:function(){return!0}},clock:{get:function(){return this._timeDynamicImagery.clock},set:function(e){this._timeDynamicImagery.clock=e}},times:{get:function(){return this._timeDynamicImagery.times},set:function(e){this._timeDynamicImagery.times=e}},dimensions:{get:function(){return this._dimensions},set:function(e){this._dimensions!==e&&(this._dimensions=e,l(this._reload)&&this._reload())}}});yx.prototype.getTileCredits=function(e,t,n){};yx.prototype.requestImage=function(e,t,n,i){let o;const r=this._timeDynamicImagery;let s;return l(r)&&(s=r.currentInterval,o=r.getFromCache(e,t,n,i)),l(o)||(o=uJ(this,e,t,n,i,s)),l(o)&&l(r)&&r.checkApproachingInterval(e,t,n,i),o};yx.prototype.pickFeatures=function(e,t,n,i,o){};function fh(e){return function(t){return new e(t)}}const MBe={ARCGIS_MAPSERVER:fh(Nm),BING:fh(Ws),GOOGLE_EARTH:fh(eu),MAPBOX:fh(Iy),SINGLE_TILE:fh(gx),TMS:fh(Nh),URL_TEMPLATE:fh(bu),WMS:fh(of),WMTS:fh(yx)};function rf(e){e=A(e,A.EMPTY_OBJECT);const t=e.assetId;E.typeOf.number("options.assetId",t),this.defaultAlpha=void 0,this.defaultNightAlpha=void 0,this.defaultDayAlpha=void 0,this.defaultBrightness=void 0,this.defaultContrast=void 0,this.defaultHue=void 0,this.defaultSaturation=void 0,this.defaultGamma=void 0,this.defaultMinificationFilter=void 0,this.defaultMagnificationFilter=void 0,this._ready=!1,this._tileCredits=void 0,this._errorEvent=new lt;const n=this,i=qs._createEndpointResource(t,e),o=e.assetId.toString()+e.accessToken+e.server;let r=rf._endpointCache[o];l(r)||(r=i.fetchJson(),rf._endpointCache[o]=r),this._readyPromise=r.then(function(s){if(s.type!=="IMAGERY")return Promise.reject(new Fe(`Cesium ion asset ${t} is not an imagery asset.`));let a;const c=s.externalType;if(!l(c))a=new Nh({url:new qs(s,i)});else{const u=MBe[c];if(!l(u))return Promise.reject(new Fe(`Unrecognized Cesium ion imagery type: ${c}`));a=u(s.options)}return n._tileCredits=qs.getCreditsFromEndpoint(s,i),a.errorEvent.addEventListener(function(u){u.provider=n,n._errorEvent.raiseEvent(u)}),n._imageryProvider=a,a.readyPromise.then(function(){return n._ready=!0,!0})})}Object.defineProperties(rf.prototype,{ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise}},rectangle:{get:function(){if(!this._ready)throw new w("tileHeight must not be called before the imagery provider is ready.");return this._imageryProvider.rectangle}},tileWidth:{get:function(){if(!this._ready)throw new w("tileWidth must not be called before the imagery provider is ready.");return this._imageryProvider.tileWidth}},tileHeight:{get:function(){if(!this._ready)throw new w("tileHeight must not be called before the imagery provider is ready.");return this._imageryProvider.tileHeight}},maximumLevel:{get:function(){if(!this._ready)throw new w("maximumLevel must not be called before the imagery provider is ready.");return this._imageryProvider.maximumLevel}},minimumLevel:{get:function(){if(!this._ready)throw new w("minimumLevel must not be called before the imagery provider is ready.");return this._imageryProvider.minimumLevel}},tilingScheme:{get:function(){if(!this._ready)throw new w("tilingScheme must not be called before the imagery provider is ready.");return this._imageryProvider.tilingScheme}},tileDiscardPolicy:{get:function(){if(!this._ready)throw new w("tileDiscardPolicy must not be called before the imagery provider is ready.");return this._imageryProvider.tileDiscardPolicy}},errorEvent:{get:function(){return this._errorEvent}},credit:{get:function(){if(!this._ready)throw new w("credit must not be called before the imagery provider is ready.");return this._imageryProvider.credit}},hasAlphaChannel:{get:function(){if(!this._ready)throw new w("hasAlphaChannel must not be called before the imagery provider is ready.");return this._imageryProvider.hasAlphaChannel},proxy:{get:function(){}}}});rf.prototype.getTileCredits=function(e,t,n){if(!this._ready)throw new w("getTileCredits must not be called before the imagery provider is ready.");const i=this._imageryProvider.getTileCredits(e,t,n);return l(i)?this._tileCredits.concat(i):this._tileCredits};rf.prototype.requestImage=function(e,t,n,i){if(!this._ready)throw new w("requestImage must not be called before the imagery provider is ready.");return this._imageryProvider.requestImage(e,t,n,i)};rf.prototype.pickFeatures=function(e,t,n,i,o){if(!this._ready)throw new w("pickFeatures must not be called before the imagery provider is ready.");return this._imageryProvider.pickFeatures(e,t,n,i,o)};rf._endpointCache={};const FBe={AERIAL:2,AERIAL_WITH_LABELS:3,ROAD:4},vD=Object.freeze(FBe);function DD(e){e=A(e,A.EMPTY_OBJECT);const t=A(e.style,vD.AERIAL);return new rf({assetId:t})}const zBe={UNBOUNDED:0,CLAMPED:1,LOOP_STOP:2},Mm=Object.freeze(zBe),UBe={TICK_DEPENDENT:0,SYSTEM_CLOCK_MULTIPLIER:1,SYSTEM_CLOCK:2},Pa=Object.freeze(UBe);let tF;typeof performance<"u"&&typeof performance.now=="function"&&isFinite(performance.now())?tF=function(){return performance.now()}:tF=function(){return Date.now()};const Gr=tF;function Ax(e){e=A(e,A.EMPTY_OBJECT);let t=e.currentTime,n=e.startTime,i=e.stopTime;if(l(t)?t=ce.clone(t):l(n)?t=ce.clone(n):l(i)?t=ce.addDays(i,-1,new ce):t=ce.now(),l(n)?n=ce.clone(n):n=ce.clone(t),l(i)?i=ce.clone(i):i=ce.addDays(n,1,new ce),ce.greaterThan(n,i))throw new w("startTime must come before stopTime.");this.startTime=n,this.stopTime=i,this.clockRange=A(e.clockRange,Mm.UNBOUNDED),this.canAnimate=A(e.canAnimate,!0),this.onTick=new lt,this.onStop=new lt,this._currentTime=void 0,this._multiplier=void 0,this._clockStep=void 0,this._shouldAnimate=void 0,this._lastSystemTime=Gr(),this.currentTime=t,this.multiplier=A(e.multiplier,1),this.shouldAnimate=A(e.shouldAnimate,!1),this.clockStep=A(e.clockStep,Pa.SYSTEM_CLOCK_MULTIPLIER)}Object.defineProperties(Ax.prototype,{currentTime:{get:function(){return this._currentTime},set:function(e){ce.equals(this._currentTime,e)||(this._clockStep===Pa.SYSTEM_CLOCK&&(this._clockStep=Pa.SYSTEM_CLOCK_MULTIPLIER),this._currentTime=e)}},multiplier:{get:function(){return this._multiplier},set:function(e){this._multiplier!==e&&(this._clockStep===Pa.SYSTEM_CLOCK&&(this._clockStep=Pa.SYSTEM_CLOCK_MULTIPLIER),this._multiplier=e)}},clockStep:{get:function(){return this._clockStep},set:function(e){e===Pa.SYSTEM_CLOCK&&(this._multiplier=1,this._shouldAnimate=!0,this._currentTime=ce.now()),this._clockStep=e}},shouldAnimate:{get:function(){return this._shouldAnimate},set:function(e){this._shouldAnimate!==e&&(this._clockStep===Pa.SYSTEM_CLOCK&&(this._clockStep=Pa.SYSTEM_CLOCK_MULTIPLIER),this._shouldAnimate=e)}}});Ax.prototype.tick=function(){const e=Gr();let t=ce.clone(this._currentTime);if(this.canAnimate&&this._shouldAnimate){const n=this._clockStep;if(n===Pa.SYSTEM_CLOCK)t=ce.now(t);else{const i=this._multiplier;if(n===Pa.TICK_DEPENDENT)t=ce.addSeconds(t,i,t);else{const a=e-this._lastSystemTime;t=ce.addSeconds(t,i*(a/1e3),t)}const o=this.clockRange,r=this.startTime,s=this.stopTime;if(o===Mm.CLAMPED)ce.lessThan(t,r)?t=ce.clone(r,t):ce.greaterThan(t,s)&&(t=ce.clone(s,t),this.onStop.raiseEvent(this));else if(o===Mm.LOOP_STOP)for(ce.lessThan(t,r)&&(t=ce.clone(r,t));ce.greaterThan(t,s);)t=ce.addSeconds(r,ce.secondsDifference(t,s),t),this.onStop.raiseEvent(this)}}return this._currentTime=t,this._lastSystemTime=e,this.onTick.raiseEvent(this),t};function Zr(e){if(typeof e=="string"){const t=document.getElementById(e);if(t===null)throw new w(`Element with id "${e}" does not exist in the document.`);e=t}return e}function bm(e,t){this.start=A(e,0),this.stop=A(t,0)}function Ae(e,t){this.center=d.clone(A(e,d.ZERO)),this.radius=A(t,0)}const ez=new d,tz=new d,nz=new d,iz=new d,oz=new d,rz=new d,sz=new d,Hs=new d,az=new d,cz=new d,lz=new d,uz=new d,HBe=4/3*F.PI;Ae.fromPoints=function(e,t){if(l(t)||(t=new Ae),!l(e)||e.length===0)return t.center=d.clone(d.ZERO,t.center),t.radius=0,t;const n=d.clone(e[0],sz),i=d.clone(n,ez),o=d.clone(n,tz),r=d.clone(n,nz),s=d.clone(n,iz),a=d.clone(n,oz),c=d.clone(n,rz),u=e.length;let f;for(f=1;f<u;f++){d.clone(e[f],n);const M=n.x,H=n.y,G=n.z;M<i.x&&d.clone(n,i),M>s.x&&d.clone(n,s),H<o.y&&d.clone(n,o),H>a.y&&d.clone(n,a),G<r.z&&d.clone(n,r),G>c.z&&d.clone(n,c)}const h=d.magnitudeSquared(d.subtract(s,i,Hs)),_=d.magnitudeSquared(d.subtract(a,o,Hs)),g=d.magnitudeSquared(d.subtract(c,r,Hs));let p=i,y=s,T=h;_>T&&(T=_,p=o,y=a),g>T&&(T=g,p=r,y=c);const b=az;b.x=(p.x+y.x)*.5,b.y=(p.y+y.y)*.5,b.z=(p.z+y.z)*.5;let x=d.magnitudeSquared(d.subtract(y,b,Hs)),v=Math.sqrt(x);const D=cz;D.x=i.x,D.y=o.y,D.z=r.z;const L=lz;L.x=s.x,L.y=a.y,L.z=c.z;const B=d.midpoint(D,L,uz);let V=0;for(f=0;f<u;f++){d.clone(e[f],n);const M=d.magnitude(d.subtract(n,B,Hs));M>V&&(V=M);const H=d.magnitudeSquared(d.subtract(n,b,Hs));if(H>x){const G=Math.sqrt(H);v=(v+G)*.5,x=v*v;const I=G-v;b.x=(v*b.x+I*n.x)/G,b.y=(v*b.y+I*n.y)/G,b.z=(v*b.z+I*n.z)/G}}return v<V?(d.clone(b,t.center),t.radius=v):(d.clone(B,t.center),t.radius=V),t};const VBe=new Or,kBe=new d,GBe=new d,lB=new ve,uB=new ve;Ae.fromRectangle2D=function(e,t,n){return Ae.fromRectangleWithHeights2D(e,t,0,0,n)};Ae.fromRectangleWithHeights2D=function(e,t,n,i,o){if(l(o)||(o=new Ae),!l(e))return o.center=d.clone(d.ZERO,o.center),o.radius=0,o;t=A(t,VBe),Ee.southwest(e,lB),lB.height=n,Ee.northeast(e,uB),uB.height=i;const r=t.project(lB,kBe),s=t.project(uB,GBe),a=s.x-r.x,c=s.y-r.y,u=s.z-r.z;o.radius=Math.sqrt(a*a+c*c+u*u)*.5;const f=o.center;return f.x=r.x+a*.5,f.y=r.y+c*.5,f.z=r.z+u*.5,o};const WBe=[];Ae.fromRectangle3D=function(e,t,n,i){if(t=A(t,be.WGS84),n=A(n,0),l(i)||(i=new Ae),!l(e))return i.center=d.clone(d.ZERO,i.center),i.radius=0,i;const o=Ee.subsample(e,t,n,WBe);return Ae.fromPoints(o,i)};Ae.fromVertices=function(e,t,n,i){if(l(i)||(i=new Ae),!l(e)||e.length===0)return i.center=d.clone(d.ZERO,i.center),i.radius=0,i;t=A(t,d.ZERO),n=A(n,3),E.typeOf.number.greaterThanOrEquals("stride",n,3);const o=sz;o.x=e[0]+t.x,o.y=e[1]+t.y,o.z=e[2]+t.z;const r=d.clone(o,ez),s=d.clone(o,tz),a=d.clone(o,nz),c=d.clone(o,iz),u=d.clone(o,oz),f=d.clone(o,rz),h=e.length;let _;for(_=0;_<h;_+=n){const G=e[_]+t.x,I=e[_+1]+t.y,O=e[_+2]+t.z;o.x=G,o.y=I,o.z=O,G<r.x&&d.clone(o,r),G>c.x&&d.clone(o,c),I<s.y&&d.clone(o,s),I>u.y&&d.clone(o,u),O<a.z&&d.clone(o,a),O>f.z&&d.clone(o,f)}const g=d.magnitudeSquared(d.subtract(c,r,Hs)),p=d.magnitudeSquared(d.subtract(u,s,Hs)),y=d.magnitudeSquared(d.subtract(f,a,Hs));let T=r,b=c,x=g;p>x&&(x=p,T=s,b=u),y>x&&(x=y,T=a,b=f);const v=az;v.x=(T.x+b.x)*.5,v.y=(T.y+b.y)*.5,v.z=(T.z+b.z)*.5;let D=d.magnitudeSquared(d.subtract(b,v,Hs)),L=Math.sqrt(D);const B=cz;B.x=r.x,B.y=s.y,B.z=a.z;const V=lz;V.x=c.x,V.y=u.y,V.z=f.z;const M=d.midpoint(B,V,uz);let H=0;for(_=0;_<h;_+=n){o.x=e[_]+t.x,o.y=e[_+1]+t.y,o.z=e[_+2]+t.z;const G=d.magnitude(d.subtract(o,M,Hs));G>H&&(H=G);const I=d.magnitudeSquared(d.subtract(o,v,Hs));if(I>D){const O=Math.sqrt(I);L=(L+O)*.5,D=L*L;const m=O-L;v.x=(L*v.x+m*o.x)/O,v.y=(L*v.y+m*o.y)/O,v.z=(L*v.z+m*o.z)/O}}return L<H?(d.clone(v,i.center),i.radius=L):(d.clone(M,i.center),i.radius=H),i};Ae.fromEncodedCartesianVertices=function(e,t,n){if(l(n)||(n=new Ae),!l(e)||!l(t)||e.length!==t.length||e.length===0)return n.center=d.clone(d.ZERO,n.center),n.radius=0,n;const i=sz;i.x=e[0]+t[0],i.y=e[1]+t[1],i.z=e[2]+t[2];const o=d.clone(i,ez),r=d.clone(i,tz),s=d.clone(i,nz),a=d.clone(i,iz),c=d.clone(i,oz),u=d.clone(i,rz),f=e.length;let h;for(h=0;h<f;h+=3){const H=e[h]+t[h],G=e[h+1]+t[h+1],I=e[h+2]+t[h+2];i.x=H,i.y=G,i.z=I,H<o.x&&d.clone(i,o),H>a.x&&d.clone(i,a),G<r.y&&d.clone(i,r),G>c.y&&d.clone(i,c),I<s.z&&d.clone(i,s),I>u.z&&d.clone(i,u)}const _=d.magnitudeSquared(d.subtract(a,o,Hs)),g=d.magnitudeSquared(d.subtract(c,r,Hs)),p=d.magnitudeSquared(d.subtract(u,s,Hs));let y=o,T=a,b=_;g>b&&(b=g,y=r,T=c),p>b&&(b=p,y=s,T=u);const x=az;x.x=(y.x+T.x)*.5,x.y=(y.y+T.y)*.5,x.z=(y.z+T.z)*.5;let v=d.magnitudeSquared(d.subtract(T,x,Hs)),D=Math.sqrt(v);const L=cz;L.x=o.x,L.y=r.y,L.z=s.z;const B=lz;B.x=a.x,B.y=c.y,B.z=u.z;const V=d.midpoint(L,B,uz);let M=0;for(h=0;h<f;h+=3){i.x=e[h]+t[h],i.y=e[h+1]+t[h+1],i.z=e[h+2]+t[h+2];const H=d.magnitude(d.subtract(i,V,Hs));H>M&&(M=H);const G=d.magnitudeSquared(d.subtract(i,x,Hs));if(G>v){const I=Math.sqrt(G);D=(D+I)*.5,v=D*D;const O=I-D;x.x=(D*x.x+O*i.x)/I,x.y=(D*x.y+O*i.y)/I,x.z=(D*x.z+O*i.z)/I}}return D<M?(d.clone(x,n.center),n.radius=D):(d.clone(V,n.center),n.radius=M),n};Ae.fromCornerPoints=function(e,t,n){E.typeOf.object("corner",e),E.typeOf.object("oppositeCorner",t),l(n)||(n=new Ae);const i=d.midpoint(e,t,n.center);return n.radius=d.distance(i,t),n};Ae.fromEllipsoid=function(e,t){return E.typeOf.object("ellipsoid",e),l(t)||(t=new Ae),d.clone(d.ZERO,t.center),t.radius=e.maximumRadius,t};const qBe=new d;Ae.fromBoundingSpheres=function(e,t){if(l(t)||(t=new Ae),!l(e)||e.length===0)return t.center=d.clone(d.ZERO,t.center),t.radius=0,t;const n=e.length;if(n===1)return Ae.clone(e[0],t);if(n===2)return Ae.union(e[0],e[1],t);const i=[];let o;for(o=0;o<n;o++)i.push(e[o].center);t=Ae.fromPoints(i,t);const r=t.center;let s=t.radius;for(o=0;o<n;o++){const a=e[o];s=Math.max(s,d.distance(r,a.center,qBe)+a.radius)}return t.radius=s,t};const jBe=new d,YBe=new d,$Be=new d;Ae.fromOrientedBoundingBox=function(e,t){E.defined("orientedBoundingBox",e),l(t)||(t=new Ae);const n=e.halfAxes,i=te.getColumn(n,0,jBe),o=te.getColumn(n,1,YBe),r=te.getColumn(n,2,$Be);return d.add(i,o,i),d.add(i,r,i),t.center=d.clone(e.center,t.center),t.radius=d.magnitude(i),t};const XBe=new d,KBe=new d;Ae.fromTransformation=function(e,t){E.typeOf.object("transformation",e),l(t)||(t=new Ae);const n=N.getTranslation(e,XBe),i=N.getScale(e,KBe),o=.5*d.magnitude(i);return t.center=d.clone(n,t.center),t.radius=o,t};Ae.clone=function(e,t){if(l(e))return l(t)?(t.center=d.clone(e.center,t.center),t.radius=e.radius,t):new Ae(e.center,e.radius)};Ae.packedLength=4;Ae.pack=function(e,t,n){E.typeOf.object("value",e),E.defined("array",t),n=A(n,0);const i=e.center;return t[n++]=i.x,t[n++]=i.y,t[n++]=i.z,t[n]=e.radius,t};Ae.unpack=function(e,t,n){E.defined("array",e),t=A(t,0),l(n)||(n=new Ae);const i=n.center;return i.x=e[t++],i.y=e[t++],i.z=e[t++],n.radius=e[t],n};const JBe=new d,QBe=new d;Ae.union=function(e,t,n){E.typeOf.object("left",e),E.typeOf.object("right",t),l(n)||(n=new Ae);const i=e.center,o=e.radius,r=t.center,s=t.radius,a=d.subtract(r,i,JBe),c=d.magnitude(a);if(o>=c+s)return e.clone(n),n;if(s>=c+o)return t.clone(n),n;const u=(o+c+s)*.5,f=d.multiplyByScalar(a,(-o+u)/c,QBe);return d.add(f,i,f),d.clone(f,n.center),n.radius=u,n};const ZBe=new d;Ae.expand=function(e,t,n){E.typeOf.object("sphere",e),E.typeOf.object("point",t),n=Ae.clone(e,n);const i=d.magnitude(d.subtract(t,n.center,ZBe));return i>n.radius&&(n.radius=i),n};Ae.intersectPlane=function(e,t){E.typeOf.object("sphere",e),E.typeOf.object("plane",t);const n=e.center,i=e.radius,o=t.normal,r=d.dot(o,n)+t.distance;return r<-i?Vn.OUTSIDE:r<i?Vn.INTERSECTING:Vn.INSIDE};Ae.transform=function(e,t,n){return E.typeOf.object("sphere",e),E.typeOf.object("transform",t),l(n)||(n=new Ae),n.center=N.multiplyByPoint(t,e.center,n.center),n.radius=N.getMaximumScale(t)*e.radius,n};const eRe=new d;Ae.distanceSquaredTo=function(e,t){E.typeOf.object("sphere",e),E.typeOf.object("cartesian",t);const n=d.subtract(e.center,t,eRe),i=d.magnitude(n)-e.radius;return i<=0?0:i*i};Ae.transformWithoutScale=function(e,t,n){return E.typeOf.object("sphere",e),E.typeOf.object("transform",t),l(n)||(n=new Ae),n.center=N.multiplyByPoint(t,e.center,n.center),n.radius=e.radius,n};const tRe=new d;Ae.computePlaneDistances=function(e,t,n,i){E.typeOf.object("sphere",e),E.typeOf.object("position",t),E.typeOf.object("direction",n),l(i)||(i=new bm);const o=d.subtract(e.center,t,tRe),r=d.dot(n,o);return i.start=r-e.radius,i.stop=r+e.radius,i};const q5=new d,nRe=new d,iRe=new d,oRe=new d,rRe=new d,sRe=new ve,fJ=new Array(8);for(let e=0;e<8;++e)fJ[e]=new d;const aRe=new Or;Ae.projectTo2D=function(e,t,n){E.typeOf.object("sphere",e),t=A(t,aRe);const i=t.ellipsoid;let o=e.center;const r=e.radius;let s;d.equals(o,d.ZERO)?s=d.clone(d.UNIT_X,q5):s=i.geodeticSurfaceNormal(o,q5);const a=d.cross(d.UNIT_Z,s,nRe);d.normalize(a,a);const c=d.cross(s,a,iRe);d.normalize(c,c),d.multiplyByScalar(s,r,s),d.multiplyByScalar(c,r,c),d.multiplyByScalar(a,r,a);const u=d.negate(c,rRe),f=d.negate(a,oRe),h=fJ;let _=h[0];d.add(s,c,_),d.add(_,a,_),_=h[1],d.add(s,c,_),d.add(_,f,_),_=h[2],d.add(s,u,_),d.add(_,f,_),_=h[3],d.add(s,u,_),d.add(_,a,_),d.negate(s,s),_=h[4],d.add(s,c,_),d.add(_,a,_),_=h[5],d.add(s,c,_),d.add(_,f,_),_=h[6],d.add(s,u,_),d.add(_,f,_),_=h[7],d.add(s,u,_),d.add(_,a,_);const g=h.length;for(let b=0;b<g;++b){const x=h[b];d.add(o,x,x);const v=i.cartesianToCartographic(x,sRe);t.project(v,x)}n=Ae.fromPoints(h,n),o=n.center;const p=o.x,y=o.y,T=o.z;return o.x=T,o.y=p,o.z=y,n};Ae.isOccluded=function(e,t){return E.typeOf.object("sphere",e),E.typeOf.object("occluder",t),!t.isBoundingSphereVisible(e)};Ae.equals=function(e,t){return e===t||l(e)&&l(t)&&d.equals(e.center,t.center)&&e.radius===t.radius};Ae.prototype.intersectPlane=function(e){return Ae.intersectPlane(this,e)};Ae.prototype.distanceSquaredTo=function(e){return Ae.distanceSquaredTo(this,e)};Ae.prototype.computePlaneDistances=function(e,t,n){return Ae.computePlaneDistances(this,e,t,n)};Ae.prototype.isOccluded=function(e){return Ae.isOccluded(this,e)};Ae.prototype.equals=function(e){return Ae.equals(this,e)};Ae.prototype.clone=function(e){return Ae.clone(this,e)};Ae.prototype.volume=function(){const e=this.radius;return HBe*e*e*e};const cRe={NONE:0,LERC:1},nF=Object.freeze(cRe);function pa(e,t,n){this.minimum=d.clone(A(e,d.ZERO)),this.maximum=d.clone(A(t,d.ZERO)),l(n)?n=d.clone(n):n=d.midpoint(this.minimum,this.maximum,new d),this.center=n}pa.fromCorners=function(e,t,n){return E.defined("minimum",e),E.defined("maximum",t),l(n)||(n=new pa),n.minimum=d.clone(e,n.minimum),n.maximum=d.clone(t,n.maximum),n.center=d.midpoint(e,t,n.center),n};pa.fromPoints=function(e,t){if(l(t)||(t=new pa),!l(e)||e.length===0)return t.minimum=d.clone(d.ZERO,t.minimum),t.maximum=d.clone(d.ZERO,t.maximum),t.center=d.clone(d.ZERO,t.center),t;let n=e[0].x,i=e[0].y,o=e[0].z,r=e[0].x,s=e[0].y,a=e[0].z;const c=e.length;for(let h=1;h<c;h++){const _=e[h],g=_.x,p=_.y,y=_.z;n=Math.min(g,n),r=Math.max(g,r),i=Math.min(p,i),s=Math.max(p,s),o=Math.min(y,o),a=Math.max(y,a)}const u=t.minimum;u.x=n,u.y=i,u.z=o;const f=t.maximum;return f.x=r,f.y=s,f.z=a,t.center=d.midpoint(u,f,t.center),t};pa.clone=function(e,t){if(l(e))return l(t)?(t.minimum=d.clone(e.minimum,t.minimum),t.maximum=d.clone(e.maximum,t.maximum),t.center=d.clone(e.center,t.center),t):new pa(e.minimum,e.maximum,e.center)};pa.equals=function(e,t){return e===t||l(e)&&l(t)&&d.equals(e.center,t.center)&&d.equals(e.minimum,t.minimum)&&d.equals(e.maximum,t.maximum)};let PS=new d;pa.intersectPlane=function(e,t){E.defined("box",e),E.defined("plane",t),PS=d.subtract(e.maximum,e.minimum,PS);const n=d.multiplyByScalar(PS,.5,PS),i=t.normal,o=n.x*Math.abs(i.x)+n.y*Math.abs(i.y)+n.z*Math.abs(i.z),r=d.dot(e.center,i)+t.distance;return r-o>0?Vn.INSIDE:r+o<0?Vn.OUTSIDE:Vn.INTERSECTING};pa.prototype.clone=function(e){return pa.clone(this,e)};pa.prototype.intersectPlane=function(e){return pa.intersectPlane(this,e)};pa.prototype.equals=function(e){return pa.equals(this,e)};function Eu(e,t){E.typeOf.object("ellipsoid",e),this._ellipsoid=e,this._cameraPosition=new d,this._cameraPositionInScaledSpace=new d,this._distanceToLimbInScaledSpaceSquared=0,l(t)&&(this.cameraPosition=t)}Object.defineProperties(Eu.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},cameraPosition:{get:function(){return this._cameraPosition},set:function(e){const n=this._ellipsoid.transformPositionToScaledSpace(e,this._cameraPositionInScaledSpace),i=d.magnitudeSquared(n)-1;d.clone(e,this._cameraPosition),this._cameraPositionInScaledSpace=n,this._distanceToLimbInScaledSpaceSquared=i}}});const dJ=new d;Eu.prototype.isPointVisible=function(e){const n=this._ellipsoid.transformPositionToScaledSpace(e,dJ);return fz(n,this._cameraPositionInScaledSpace,this._distanceToLimbInScaledSpaceSquared)};Eu.prototype.isScaledSpacePointVisible=function(e){return fz(e,this._cameraPositionInScaledSpace,this._distanceToLimbInScaledSpaceSquared)};const lRe=new d;Eu.prototype.isScaledSpacePointVisiblePossiblyUnderEllipsoid=function(e,t){const n=this._ellipsoid;let i,o;return l(t)&&t<0&&n.minimumRadius>-t?(o=lRe,o.x=this._cameraPosition.x/(n.radii.x+t),o.y=this._cameraPosition.y/(n.radii.y+t),o.z=this._cameraPosition.z/(n.radii.z+t),i=o.x*o.x+o.y*o.y+o.z*o.z-1):(o=this._cameraPositionInScaledSpace,i=this._distanceToLimbInScaledSpaceSquared),fz(e,o,i)};Eu.prototype.computeHorizonCullingPoint=function(e,t,n){return mJ(this._ellipsoid,e,t,n)};const hJ=be.clone(be.UNIT_SPHERE);Eu.prototype.computeHorizonCullingPointPossiblyUnderEllipsoid=function(e,t,n,i){const o=pJ(this._ellipsoid,n,hJ);return mJ(o,e,t,i)};Eu.prototype.computeHorizonCullingPointFromVertices=function(e,t,n,i,o){return _J(this._ellipsoid,e,t,n,i,o)};Eu.prototype.computeHorizonCullingPointFromVerticesPossiblyUnderEllipsoid=function(e,t,n,i,o,r){const s=pJ(this._ellipsoid,o,hJ);return _J(s,e,t,n,i,r)};const uRe=[];Eu.prototype.computeHorizonCullingPointFromRectangle=function(e,t,n){E.typeOf.object("rectangle",e);const i=Ee.subsample(e,t,0,uRe),o=Ae.fromPoints(i);if(!(d.magnitude(o.center)<.1*t.minimumRadius))return this.computeHorizonCullingPoint(o.center,i,n)};const fRe=new d;function pJ(e,t,n){if(l(t)&&t<0&&e.minimumRadius>-t){const i=d.fromElements(e.radii.x+t,e.radii.y+t,e.radii.z+t,fRe);e=be.fromCartesian3(i,n)}return e}function mJ(e,t,n,i){E.typeOf.object("directionToPoint",t),E.defined("positions",n),l(i)||(i=new d);const o=AJ(e,t);let r=0;for(let s=0,a=n.length;s<a;++s){const c=n[s],u=gJ(e,c,o);if(u<0)return;r=Math.max(r,u)}return yJ(o,r,i)}const OS=new d;function _J(e,t,n,i,o,r){E.typeOf.object("directionToPoint",t),E.defined("vertices",n),E.typeOf.number("stride",i),l(r)||(r=new d),i=A(i,3),o=A(o,d.ZERO);const s=AJ(e,t);let a=0;for(let c=0,u=n.length;c<u;c+=i){OS.x=n[c]+o.x,OS.y=n[c+1]+o.y,OS.z=n[c+2]+o.z;const f=gJ(e,OS,s);if(f<0)return;a=Math.max(a,f)}return yJ(s,a,r)}function fz(e,t,n){const i=t,o=n,r=d.subtract(e,i,dJ),s=-d.dot(r,i);return!(o<0?s>0:s>o&&s*s/d.magnitudeSquared(r)>o)}const dRe=new d,hRe=new d;function gJ(e,t,n){const i=e.transformPositionToScaledSpace(t,dRe);let o=d.magnitudeSquared(i),r=Math.sqrt(o);const s=d.divideByScalar(i,r,hRe);o=Math.max(1,o),r=Math.max(1,r);const a=d.dot(s,n),c=d.magnitude(d.cross(s,n,s)),u=1/r,f=Math.sqrt(o-1)*u;return 1/(a*u-c*f)}function yJ(e,t,n){if(!(t<=0||t===1/0||t!==t))return d.multiplyByScalar(e,t,n)}const fB=new d;function AJ(e,t){return d.equals(t,d.ZERO)?t:(e.transformPositionToScaledSpace(t,fB),d.normalize(fB,fB))}const dz={};dz.computeDiscriminant=function(e,t,n){if(typeof e!="number")throw new w("a is a required number.");if(typeof t!="number")throw new w("b is a required number.");if(typeof n!="number")throw new w("c is a required number.");return t*t-4*e*n};function j5(e,t,n){const i=e+t;return F.sign(e)!==F.sign(t)&&Math.abs(i/Math.max(Math.abs(e),Math.abs(t)))<n?0:i}dz.computeRealRoots=function(e,t,n){if(typeof e!="number")throw new w("a is a required number.");if(typeof t!="number")throw new w("b is a required number.");if(typeof n!="number")throw new w("c is a required number.");let i;if(e===0)return t===0?[]:[-n/t];if(t===0){if(n===0)return[0,0];const c=Math.abs(n),u=Math.abs(e);if(c<u&&c/u<F.EPSILON14)return[0,0];if(c>u&&u/c<F.EPSILON14)return[];if(i=-n/e,i<0)return[];const f=Math.sqrt(i);return[-f,f]}else if(n===0)return i=-t/e,i<0?[i,0]:[0,i];const o=t*t,r=4*e*n,s=j5(o,-r,F.EPSILON14);if(s<0)return[];const a=-.5*j5(t,F.sign(t)*Math.sqrt(s),F.EPSILON14);return t>0?[a/e,n/a]:[n/a,a/e]};const Mh=dz,hz={};hz.computeDiscriminant=function(e,t,n,i){if(typeof e!="number")throw new w("a is a required number.");if(typeof t!="number")throw new w("b is a required number.");if(typeof n!="number")throw new w("c is a required number.");if(typeof i!="number")throw new w("d is a required number.");const o=e*e,r=t*t,s=n*n,a=i*i;return 18*e*t*n*i+r*s-27*o*a-4*(e*s*n+r*t*i)};function dB(e,t,n,i){const o=e,r=t/3,s=n/3,a=i,c=o*s,u=r*a,f=r*r,h=s*s,_=o*s-f,g=o*a-r*s,p=r*a-h,y=4*_*p-g*g;let T,b;if(y<0){let ee,K,se;f*u>=c*h?(ee=o,K=_,se=-2*r*_+o*g):(ee=a,K=p,se=-a*g+2*s*p);const Z=-(se<0?-1:1)*Math.abs(ee)*Math.sqrt(-y);b=-se+Z;const J=b/2,de=J<0?-Math.pow(-J,1/3):Math.pow(J,1/3),_e=b===Z?-de:-K/de;return T=K<=0?de+_e:-se/(de*de+_e*_e+K),f*u>=c*h?[(T-r)/o]:[-a/(T+s)]}const x=_,v=-2*r*_+o*g,D=p,L=-a*g+2*s*p,B=Math.sqrt(y),V=Math.sqrt(3)/2;let M=Math.abs(Math.atan2(o*B,-v)/3);T=2*Math.sqrt(-x);let H=Math.cos(M);b=T*H;let G=T*(-H/2-V*Math.sin(M));const I=b+G>2*r?b-r:G-r,O=o,m=I/O;M=Math.abs(Math.atan2(a*B,-L)/3),T=2*Math.sqrt(-D),H=Math.cos(M),b=T*H,G=T*(-H/2-V*Math.sin(M));const P=-a,R=b+G<2*s?b+s:G+s,U=P/R,W=O*R,q=-I*R-O*P,Y=I*P,j=(s*q-r*Y)/(-r*q+s*W);return m<=j?m<=U?j<=U?[m,j,U]:[m,U,j]:[U,m,j]:m<=U?[j,m,U]:j<=U?[j,U,m]:[U,j,m]}hz.computeRealRoots=function(e,t,n,i){if(typeof e!="number")throw new w("a is a required number.");if(typeof t!="number")throw new w("b is a required number.");if(typeof n!="number")throw new w("c is a required number.");if(typeof i!="number")throw new w("d is a required number.");let o,r;if(e===0)return Mh.computeRealRoots(t,n,i);if(t===0){if(n===0){if(i===0)return[0,0,0];r=-i/e;const s=r<0?-Math.pow(-r,1/3):Math.pow(r,1/3);return[s,s,s]}else if(i===0)return o=Mh.computeRealRoots(e,0,n),o.Length===0?[0]:[o[0],0,o[1]];return dB(e,0,n,i)}else{if(n===0)return i===0?(r=-t/e,r<0?[r,0,0]:[0,0,r]):dB(e,t,0,i);if(i===0)return o=Mh.computeRealRoots(e,t,n),o.length===0?[0]:o[1]<=0?[o[0],o[1],0]:o[0]>=0?[0,o[0],o[1]]:[o[0],0,o[1]]}return dB(e,t,n,i)};const pz=hz,mz={};mz.computeDiscriminant=function(e,t,n,i,o){if(typeof e!="number")throw new w("a is a required number.");if(typeof t!="number")throw new w("b is a required number.");if(typeof n!="number")throw new w("c is a required number.");if(typeof i!="number")throw new w("d is a required number.");if(typeof o!="number")throw new w("e is a required number.");const r=e*e,s=r*e,a=t*t,c=a*t,u=n*n,f=u*n,h=i*i,_=h*i,g=o*o,p=g*o;return a*u*h-4*c*_-4*e*f*h+18*e*t*n*_-27*r*h*h+256*s*p+o*(18*c*n*i-4*a*f+16*e*u*u-80*e*t*u*i-6*e*a*h+144*r*n*h)+g*(144*e*a*n-27*a*a-128*r*u-192*r*t*i)};function Fu(e,t,n,i){const o=e*e,r=t-3*o/8,s=n-t*e/2+o*e/8,a=i-n*e/4+t*o/16-3*o*o/256,c=pz.computeRealRoots(1,2*r,r*r-4*a,-s*s);if(c.length>0){const u=-e/4,f=c[c.length-1];if(Math.abs(f)<F.EPSILON14){const h=Mh.computeRealRoots(1,r,a);if(h.length===2){const _=h[0],g=h[1];let p;if(_>=0&&g>=0){const y=Math.sqrt(_),T=Math.sqrt(g);return[u-T,u-y,u+y,u+T]}else{if(_>=0&&g<0)return p=Math.sqrt(_),[u-p,u+p];if(_<0&&g>=0)return p=Math.sqrt(g),[u-p,u+p]}}return[]}else if(f>0){const h=Math.sqrt(f),_=(r+f-s/h)/2,g=(r+f+s/h)/2,p=Mh.computeRealRoots(1,h,_),y=Mh.computeRealRoots(1,-h,g);return p.length!==0?(p[0]+=u,p[1]+=u,y.length!==0?(y[0]+=u,y[1]+=u,p[1]<=y[0]?[p[0],p[1],y[0],y[1]]:y[1]<=p[0]?[y[0],y[1],p[0],p[1]]:p[0]>=y[0]&&p[1]<=y[1]?[y[0],p[0],p[1],y[1]]:y[0]>=p[0]&&y[1]<=p[1]?[p[0],y[0],y[1],p[1]]:p[0]>y[0]&&p[0]<y[1]?[y[0],p[0],y[1],p[1]]:[p[0],y[0],p[1],y[1]]):p):y.length!==0?(y[0]+=u,y[1]+=u,y):[]}}return[]}function CC(e,t,n,i){const o=n*n,r=t*t,s=e*e,a=-2*t,c=n*e+r-4*i,u=s*i-n*t*e+o,f=pz.computeRealRoots(1,a,c,u);if(f.length>0){const h=f[0],_=t-h,g=_*_,p=e/2,y=_/2,T=g-4*i,b=g+4*Math.abs(i),x=s-4*h,v=s+4*Math.abs(h);let D,L;if(h<0||T*v<x*b){const O=Math.sqrt(x);D=O/2,L=O===0?0:(e*y-n)/O}else{const O=Math.sqrt(T);D=O===0?0:(e*y-n)/O,L=O/2}let B,V;p===0&&D===0?(B=0,V=0):F.sign(p)===F.sign(D)?(B=p+D,V=h/B):(V=p-D,B=h/V);let M,H;y===0&&L===0?(M=0,H=0):F.sign(y)===F.sign(L)?(M=y+L,H=i/M):(H=y-L,M=i/H);const G=Mh.computeRealRoots(1,B,M),I=Mh.computeRealRoots(1,V,H);if(G.length!==0)return I.length!==0?G[1]<=I[0]?[G[0],G[1],I[0],I[1]]:I[1]<=G[0]?[I[0],I[1],G[0],G[1]]:G[0]>=I[0]&&G[1]<=I[1]?[I[0],G[0],G[1],I[1]]:I[0]>=G[0]&&I[1]<=G[1]?[G[0],I[0],I[1],G[1]]:G[0]>I[0]&&G[0]<I[1]?[I[0],G[0],I[1],G[1]]:[G[0],I[0],G[1],I[1]]:G;if(I.length!==0)return I}return[]}mz.computeRealRoots=function(e,t,n,i,o){if(typeof e!="number")throw new w("a is a required number.");if(typeof t!="number")throw new w("b is a required number.");if(typeof n!="number")throw new w("c is a required number.");if(typeof i!="number")throw new w("d is a required number.");if(typeof o!="number")throw new w("e is a required number.");if(Math.abs(e)<F.EPSILON15)return pz.computeRealRoots(t,n,i,o);const r=t/e,s=n/e,a=i/e,c=o/e;let u=r<0?1:0;switch(u+=s<0?u+1:u,u+=a<0?u+1:u,u+=c<0?u+1:u,u){case 0:return Fu(r,s,a,c);case 1:return CC(r,s,a,c);case 2:return CC(r,s,a,c);case 3:return Fu(r,s,a,c);case 4:return Fu(r,s,a,c);case 5:return CC(r,s,a,c);case 6:return Fu(r,s,a,c);case 7:return Fu(r,s,a,c);case 8:return CC(r,s,a,c);case 9:return Fu(r,s,a,c);case 10:return Fu(r,s,a,c);case 11:return CC(r,s,a,c);case 12:return Fu(r,s,a,c);case 13:return Fu(r,s,a,c);case 14:return Fu(r,s,a,c);case 15:return Fu(r,s,a,c);default:return}};const pRe=mz;function ii(e,t){t=d.clone(A(t,d.ZERO)),d.equals(t,d.ZERO)||d.normalize(t,t),this.origin=d.clone(A(e,d.ZERO)),this.direction=t}ii.clone=function(e,t){if(l(e))return l(t)?(t.origin=d.clone(e.origin),t.direction=d.clone(e.direction),t):new ii(e.origin,e.direction)};ii.getPoint=function(e,t,n){return E.typeOf.object("ray",e),E.typeOf.number("t",t),l(n)||(n=new d),n=d.multiplyByScalar(e.direction,t,n),d.add(e.origin,n,n)};const Jo={};Jo.rayPlane=function(e,t,n){if(!l(e))throw new w("ray is required.");if(!l(t))throw new w("plane is required.");l(n)||(n=new d);const i=e.origin,o=e.direction,r=t.normal,s=d.dot(r,o);if(Math.abs(s)<F.EPSILON15)return;const a=(-t.distance-d.dot(r,i))/s;if(!(a<0))return n=d.multiplyByScalar(o,a,n),d.add(i,n,n)};const mRe=new d,_Re=new d,TJ=new d,Y5=new d,$5=new d;Jo.rayTriangleParametric=function(e,t,n,i,o){if(!l(e))throw new w("ray is required.");if(!l(t))throw new w("p0 is required.");if(!l(n))throw new w("p1 is required.");if(!l(i))throw new w("p2 is required.");o=A(o,!1);const r=e.origin,s=e.direction,a=d.subtract(n,t,mRe),c=d.subtract(i,t,_Re),u=d.cross(s,c,TJ),f=d.dot(a,u);let h,_,g,p,y;if(o){if(f<F.EPSILON6||(h=d.subtract(r,t,Y5),g=d.dot(h,u),g<0||g>f)||(_=d.cross(h,a,$5),p=d.dot(s,_),p<0||g+p>f))return;y=d.dot(c,_)/f}else{if(Math.abs(f)<F.EPSILON6)return;const T=1/f;if(h=d.subtract(r,t,Y5),g=d.dot(h,u)*T,g<0||g>1||(_=d.cross(h,a,$5),p=d.dot(s,_)*T,p<0||g+p>1))return;y=d.dot(c,_)*T}return y};Jo.rayTriangle=function(e,t,n,i,o,r){const s=Jo.rayTriangleParametric(e,t,n,i,o);if(!(!l(s)||s<0))return l(r)||(r=new d),d.multiplyByScalar(e.direction,s,r),d.add(e.origin,r,r)};const gRe=new ii;Jo.lineSegmentTriangle=function(e,t,n,i,o,r,s){if(!l(e))throw new w("v0 is required.");if(!l(t))throw new w("v1 is required.");if(!l(n))throw new w("p0 is required.");if(!l(i))throw new w("p1 is required.");if(!l(o))throw new w("p2 is required.");const a=gRe;d.clone(e,a.origin),d.subtract(t,e,a.direction),d.normalize(a.direction,a.direction);const c=Jo.rayTriangleParametric(a,n,i,o,r);if(!(!l(c)||c<0||c>d.distance(e,t)))return l(s)||(s=new d),d.multiplyByScalar(a.direction,c,s),d.add(a.origin,s,s)};function yRe(e,t,n,i){const o=t*t-4*e*n;if(o<0)return;if(o>0){const s=1/(2*e),a=Math.sqrt(o),c=(-t+a)*s,u=(-t-a)*s;return c<u?(i.root0=c,i.root1=u):(i.root0=u,i.root1=c),i}const r=-t/(2*e);if(r!==0)return i.root0=i.root1=r,i}const ARe={root0:0,root1:0};function CJ(e,t,n){l(n)||(n=new bm);const i=e.origin,o=e.direction,r=t.center,s=t.radius*t.radius,a=d.subtract(i,r,TJ),c=d.dot(o,o),u=2*d.dot(o,a),f=d.magnitudeSquared(a)-s,h=yRe(c,u,f,ARe);if(l(h))return n.start=h.root0,n.stop=h.root1,n}Jo.raySphere=function(e,t,n){if(!l(e))throw new w("ray is required.");if(!l(t))throw new w("sphere is required.");if(n=CJ(e,t,n),!(!l(n)||n.stop<0))return n.start=Math.max(n.start,0),n};const TRe=new ii;Jo.lineSegmentSphere=function(e,t,n,i){if(!l(e))throw new w("p0 is required.");if(!l(t))throw new w("p1 is required.");if(!l(n))throw new w("sphere is required.");const o=TRe;d.clone(e,o.origin);const r=d.subtract(t,e,o.direction),s=d.magnitude(r);if(d.normalize(r,r),i=CJ(o,n,i),!(!l(i)||i.stop<0||i.start>s))return i.start=Math.max(i.start,0),i.stop=Math.min(i.stop,s),i};const CRe=new d,bRe=new d;Jo.rayEllipsoid=function(e,t){if(!l(e))throw new w("ray is required.");if(!l(t))throw new w("ellipsoid is required.");const n=t.oneOverRadii,i=d.multiplyComponents(n,e.origin,CRe),o=d.multiplyComponents(n,e.direction,bRe),r=d.magnitudeSquared(i),s=d.dot(i,o);let a,c,u,f,h;if(r>1){if(s>=0)return;const _=s*s;if(a=r-1,c=d.magnitudeSquared(o),u=c*a,_<u)return;if(_>u){f=s*s-u,h=-s+Math.sqrt(f);const p=h/c,y=a/h;return p<y?new bm(p,y):{start:y,stop:p}}const g=Math.sqrt(a/c);return new bm(g,g)}else if(r<1)return a=r-1,c=d.magnitudeSquared(o),u=c*a,f=s*s-u,h=-s+Math.sqrt(f),new bm(0,h/c);if(s<0)return c=d.magnitudeSquared(o),new bm(0,-s/c)};function $_(e,t,n){const i=e+t;return F.sign(e)!==F.sign(t)&&Math.abs(i/Math.max(Math.abs(e),Math.abs(t)))<n?0:i}function ERe(e,t,n,i,o){const r=i*i,s=o*o,a=(e[te.COLUMN1ROW1]-e[te.COLUMN2ROW2])*s,c=o*(i*$_(e[te.COLUMN1ROW0],e[te.COLUMN0ROW1],F.EPSILON15)+t.y),u=e[te.COLUMN0ROW0]*r+e[te.COLUMN2ROW2]*s+i*t.x+n,f=s*$_(e[te.COLUMN2ROW1],e[te.COLUMN1ROW2],F.EPSILON15),h=o*(i*$_(e[te.COLUMN2ROW0],e[te.COLUMN0ROW2])+t.z);let _;const g=[];if(h===0&&f===0){if(_=Mh.computeRealRoots(a,c,u),_.length===0)return g;const M=_[0],H=Math.sqrt(Math.max(1-M*M,0));if(g.push(new d(i,o*M,o*-H)),g.push(new d(i,o*M,o*H)),_.length===2){const G=_[1],I=Math.sqrt(Math.max(1-G*G,0));g.push(new d(i,o*G,o*-I)),g.push(new d(i,o*G,o*I))}return g}const p=h*h,y=f*f,T=a*a,b=h*f,x=T+y,v=2*(c*a+b),D=2*u*a+c*c-y+p,L=2*(u*c-b),B=u*u-p;if(x===0&&v===0&&D===0&&L===0)return g;_=pRe.computeRealRoots(x,v,D,L,B);const V=_.length;if(V===0)return g;for(let M=0;M<V;++M){const H=_[M],G=H*H,I=Math.max(1-G,0),O=Math.sqrt(I);let m;F.sign(a)===F.sign(u)?m=$_(a*G+u,c*H,F.EPSILON12):F.sign(u)===F.sign(c*H)?m=$_(a*G,c*H+u,F.EPSILON12):m=$_(a*G+c*H,u,F.EPSILON12);const P=$_(f*H,h,F.EPSILON15),R=m*P;R<0?g.push(new d(i,o*H,o*O)):R>0?g.push(new d(i,o*H,o*-O)):O!==0?(g.push(new d(i,o*H,o*-O)),g.push(new d(i,o*H,o*O)),++M):g.push(new d(i,o*H,o*O))}return g}const hB=new d,X5=new d,K5=new d,LS=new d,xRe=new d,wRe=new te,SRe=new te,vRe=new te,DRe=new te,IRe=new te,J5=new te,Q5=new te,Z5=new d,PRe=new d,ORe=new ve;Jo.grazingAltitudeLocation=function(e,t){if(!l(e))throw new w("ray is required.");if(!l(t))throw new w("ellipsoid is required.");const n=e.origin,i=e.direction;if(!d.equals(n,d.ZERO)){const B=t.geodeticSurfaceNormal(n,hB);if(d.dot(i,B)>=0)return n}const o=l(this.rayEllipsoid(e,t)),r=t.transformPositionToScaledSpace(i,hB),s=d.normalize(r,r),a=d.mostOrthogonalAxis(r,LS),c=d.normalize(d.cross(a,s,X5),X5),u=d.normalize(d.cross(s,c,K5),K5),f=wRe;f[0]=s.x,f[1]=s.y,f[2]=s.z,f[3]=c.x,f[4]=c.y,f[5]=c.z,f[6]=u.x,f[7]=u.y,f[8]=u.z;const h=te.transpose(f,SRe),_=te.fromScale(t.radii,vRe),g=te.fromScale(t.oneOverRadii,DRe),p=IRe;p[0]=0,p[1]=-i.z,p[2]=i.y,p[3]=i.z,p[4]=0,p[5]=-i.x,p[6]=-i.y,p[7]=i.x,p[8]=0;const y=te.multiply(te.multiply(h,g,J5),p,J5),T=te.multiply(te.multiply(y,_,Q5),f,Q5),b=te.multiplyByVector(y,n,xRe),x=ERe(T,d.negate(b,hB),0,0,1);let v,D;const L=x.length;if(L>0){let B=d.clone(d.ZERO,PRe),V=Number.NEGATIVE_INFINITY;for(let H=0;H<L;++H){v=te.multiplyByVector(_,te.multiplyByVector(f,x[H],Z5),Z5);const G=d.normalize(d.subtract(v,n,LS),LS),I=d.dot(G,i);I>V&&(V=I,B=d.clone(v,B))}const M=t.cartesianToCartographic(B,ORe);return V=F.clamp(V,0,1),D=d.magnitude(d.subtract(B,n,LS))*Math.sqrt(1-V*V),D=o?-D:D,M.height=D,t.cartographicToCartesian(M,new d)}};const LRe=new d;Jo.lineSegmentPlane=function(e,t,n,i){if(!l(e))throw new w("endPoint0 is required.");if(!l(t))throw new w("endPoint1 is required.");if(!l(n))throw new w("plane is required.");l(i)||(i=new d);const o=d.subtract(t,e,LRe),r=n.normal,s=d.dot(r,o);if(Math.abs(s)<F.EPSILON6)return;const a=d.dot(r,e),c=-(n.distance+a)/s;if(!(c<0||c>1))return d.multiplyByScalar(o,c,i),d.add(e,i,i),i};Jo.trianglePlaneIntersection=function(e,t,n,i){if(!l(e)||!l(t)||!l(n)||!l(i))throw new w("p0, p1, p2, and plane are required.");const o=i.normal,r=i.distance,s=d.dot(o,e)+r<0,a=d.dot(o,t)+r<0,c=d.dot(o,n)+r<0;let u=0;u+=s?1:0,u+=a?1:0,u+=c?1:0;let f,h;if((u===1||u===2)&&(f=new d,h=new d),u===1){if(s)return Jo.lineSegmentPlane(e,t,i,f),Jo.lineSegmentPlane(e,n,i,h),{positions:[e,t,n,f,h],indices:[0,3,4,1,2,4,1,4,3]};if(a)return Jo.lineSegmentPlane(t,n,i,f),Jo.lineSegmentPlane(t,e,i,h),{positions:[e,t,n,f,h],indices:[1,3,4,2,0,4,2,4,3]};if(c)return Jo.lineSegmentPlane(n,e,i,f),Jo.lineSegmentPlane(n,t,i,h),{positions:[e,t,n,f,h],indices:[2,3,4,0,1,4,0,4,3]}}else if(u===2)if(s)if(a){if(!c)return Jo.lineSegmentPlane(e,n,i,f),Jo.lineSegmentPlane(t,n,i,h),{positions:[e,t,n,f,h],indices:[0,1,4,0,4,3,2,3,4]}}else return Jo.lineSegmentPlane(n,t,i,f),Jo.lineSegmentPlane(e,t,i,h),{positions:[e,t,n,f,h],indices:[2,0,4,2,4,3,1,3,4]};else return Jo.lineSegmentPlane(t,e,i,f),Jo.lineSegmentPlane(n,e,i,h),{positions:[e,t,n,f,h],indices:[1,2,4,1,4,3,0,3,4]}};const qr=Jo,pB=new ue;function Ks(e,t){if(E.defined("origin",e),t=A(t,be.WGS84),e=t.scaleToGeodeticSurface(e),!l(e))throw new w("origin must not be at the center of the ellipsoid.");const n=En.eastNorthUpToFixedFrame(e,t);this._ellipsoid=t,this._origin=e,this._xAxis=d.fromCartesian4(N.getColumn(n,0,pB)),this._yAxis=d.fromCartesian4(N.getColumn(n,1,pB));const i=d.fromCartesian4(N.getColumn(n,2,pB));this._plane=Wt.fromPointNormal(e,i)}Object.defineProperties(Ks.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},origin:{get:function(){return this._origin}},plane:{get:function(){return this._plane}},xAxis:{get:function(){return this._xAxis}},yAxis:{get:function(){return this._yAxis}},zAxis:{get:function(){return this._plane.normal}}});const BRe=new pa;Ks.fromPoints=function(e,t){E.defined("cartesians",e);const n=pa.fromPoints(e,BRe);return new Ks(n.center,t)};const bJ=new ii,MI=new d;Ks.prototype.projectPointOntoPlane=function(e,t){E.defined("cartesian",e);const n=bJ;n.origin=e,d.normalize(e,n.direction);let i=qr.rayPlane(n,this._plane,MI);if(l(i)||(d.negate(n.direction,n.direction),i=qr.rayPlane(n,this._plane,MI)),l(i)){const o=d.subtract(i,this._origin,i),r=d.dot(this._xAxis,o),s=d.dot(this._yAxis,o);return l(t)?(t.x=r,t.y=s,t):new $(r,s)}};Ks.prototype.projectPointsOntoPlane=function(e,t){E.defined("cartesians",e),l(t)||(t=[]);let n=0;const i=e.length;for(let o=0;o<i;o++){const r=this.projectPointOntoPlane(e[o],t[n]);l(r)&&(t[n]=r,n++)}return t.length=n,t};Ks.prototype.projectPointToNearestOnPlane=function(e,t){E.defined("cartesian",e),l(t)||(t=new $);const n=bJ;n.origin=e,d.clone(this._plane.normal,n.direction);let i=qr.rayPlane(n,this._plane,MI);l(i)||(d.negate(n.direction,n.direction),i=qr.rayPlane(n,this._plane,MI));const o=d.subtract(i,this._origin,i),r=d.dot(this._xAxis,o),s=d.dot(this._yAxis,o);return t.x=r,t.y=s,t};Ks.prototype.projectPointsToNearestOnPlane=function(e,t){E.defined("cartesians",e),l(t)||(t=[]);const n=e.length;t.length=n;for(let i=0;i<n;i++)t[i]=this.projectPointToNearestOnPlane(e[i],t[i]);return t};const RRe=new d;Ks.prototype.projectPointOntoEllipsoid=function(e,t){E.defined("cartesian",e),l(t)||(t=new d);const n=this._ellipsoid,i=this._origin,o=this._xAxis,r=this._yAxis,s=RRe;return d.multiplyByScalar(o,e.x,s),t=d.add(i,s,t),d.multiplyByScalar(r,e.y,s),d.add(t,s,t),n.scaleToGeocentricSurface(t,t),t};Ks.prototype.projectPointsOntoEllipsoid=function(e,t){E.defined("cartesians",e);const n=e.length;l(t)?t.length=n:t=new Array(n);for(let i=0;i<n;++i)t[i]=this.projectPointOntoEllipsoid(e[i],t[i]);return t};function Zt(e,t){this.center=d.clone(A(e,d.ZERO)),this.halfAxes=te.clone(A(t,te.ZERO))}Zt.packedLength=d.packedLength+te.packedLength;Zt.pack=function(e,t,n){return E.typeOf.object("value",e),E.defined("array",t),n=A(n,0),d.pack(e.center,t,n),te.pack(e.halfAxes,t,n+d.packedLength),t};Zt.unpack=function(e,t,n){return E.defined("array",e),t=A(t,0),l(n)||(n=new Zt),d.unpack(e,t,n.center),te.unpack(e,t+d.packedLength,n.halfAxes),n};const NRe=new d,MRe=new d,FRe=new d,zRe=new d,URe=new d,HRe=new d,VRe=new te,kRe={unitary:new te,diagonal:new te};Zt.fromPoints=function(e,t){if(l(t)||(t=new Zt),!l(e)||e.length===0)return t.halfAxes=te.ZERO,t.center=d.ZERO,t;let n;const i=e.length,o=d.clone(e[0],NRe);for(n=1;n<i;n++)d.add(o,e[n],o);const r=1/i;d.multiplyByScalar(o,r,o);let s=0,a=0,c=0,u=0,f=0,h=0,_;for(n=0;n<i;n++)_=d.subtract(e[n],o,MRe),s+=_.x*_.x,a+=_.x*_.y,c+=_.x*_.z,u+=_.y*_.y,f+=_.y*_.z,h+=_.z*_.z;s*=r,a*=r,c*=r,u*=r,f*=r,h*=r;const g=VRe;g[0]=s,g[1]=a,g[2]=c,g[3]=a,g[4]=u,g[5]=f,g[6]=c,g[7]=f,g[8]=h;const p=te.computeEigenDecomposition(g,kRe),y=te.clone(p.unitary,t.halfAxes);let T=te.getColumn(y,0,zRe),b=te.getColumn(y,1,URe),x=te.getColumn(y,2,HRe),v=-Number.MAX_VALUE,D=-Number.MAX_VALUE,L=-Number.MAX_VALUE,B=Number.MAX_VALUE,V=Number.MAX_VALUE,M=Number.MAX_VALUE;for(n=0;n<i;n++)_=e[n],v=Math.max(d.dot(T,_),v),D=Math.max(d.dot(b,_),D),L=Math.max(d.dot(x,_),L),B=Math.min(d.dot(T,_),B),V=Math.min(d.dot(b,_),V),M=Math.min(d.dot(x,_),M);T=d.multiplyByScalar(T,.5*(B+v),T),b=d.multiplyByScalar(b,.5*(V+D),b),x=d.multiplyByScalar(x,.5*(M+L),x);const H=d.add(T,b,t.center);d.add(H,x,H);const G=FRe;return G.x=v-B,G.y=D-V,G.z=L-M,d.multiplyByScalar(G,.5,G),te.multiplyByScale(t.halfAxes,G,t.halfAxes),t};const EJ=new d,GRe=new d;function e8(e,t,n,i,o,r,s,a,c,u,f){if(!l(o)||!l(r)||!l(s)||!l(a)||!l(c)||!l(u))throw new w("all extents (minimum/maximum X/Y/Z) are required.");l(f)||(f=new Zt);const h=f.halfAxes;te.setColumn(h,0,t,h),te.setColumn(h,1,n,h),te.setColumn(h,2,i,h);let _=EJ;_.x=(o+r)/2,_.y=(s+a)/2,_.z=(c+u)/2;const g=GRe;g.x=(r-o)/2,g.y=(a-s)/2,g.z=(u-c)/2;const p=f.center;return _=te.multiplyByVector(h,_,_),d.add(e,_,p),te.multiplyByScale(h,g,h),f}const t8=new ve,WRe=new d,qRe=new ve,jRe=new ve,YRe=new ve,$Re=new ve,XRe=new ve,KRe=new d,n8=new d,JRe=new d,i8=new d,QRe=new d,ZRe=new $,eNe=new $,tNe=new $,nNe=new $,iNe=new $,oNe=new d,rNe=new d,sNe=new d,aNe=new d,cNe=new $,lNe=new d,uNe=new d,fNe=new d,dNe=new Wt(d.UNIT_X,0);Zt.fromRectangle=function(e,t,n,i,o){if(!l(e))throw new w("rectangle is required");if(e.width<0||e.width>F.TWO_PI)throw new w("Rectangle width must be between 0 and 2 * pi");if(e.height<0||e.height>F.PI)throw new w("Rectangle height must be between 0 and pi");if(l(i)&&!F.equalsEpsilon(i.radii.x,i.radii.y,F.EPSILON15))throw new w("Ellipsoid must be an ellipsoid of revolution (radii.x == radii.y)");t=A(t,0),n=A(n,0),i=A(i,be.WGS84);let r,s,a,c,u,f,h;if(e.width<=F.PI){const V=Ee.center(e,t8),M=i.cartographicToCartesian(V,WRe),H=new Ks(M,i);h=H.plane;const G=V.longitude,I=e.south<0&&e.north>0?0:V.latitude,O=ve.fromRadians(G,e.north,n,qRe),m=ve.fromRadians(e.west,e.north,n,jRe),P=ve.fromRadians(e.west,I,n,YRe),R=ve.fromRadians(e.west,e.south,n,$Re),U=ve.fromRadians(G,e.south,n,XRe),W=i.cartographicToCartesian(O,KRe);let q=i.cartographicToCartesian(m,n8);const Y=i.cartographicToCartesian(P,JRe);let j=i.cartographicToCartesian(R,i8);const ee=i.cartographicToCartesian(U,QRe),K=H.projectPointToNearestOnPlane(W,ZRe),se=H.projectPointToNearestOnPlane(q,eNe),Q=H.projectPointToNearestOnPlane(Y,tNe),Z=H.projectPointToNearestOnPlane(j,nNe),J=H.projectPointToNearestOnPlane(ee,iNe);return r=Math.min(se.x,Q.x,Z.x),s=-r,c=Math.max(se.y,K.y),a=Math.min(Z.y,J.y),m.height=R.height=t,q=i.cartographicToCartesian(m,n8),j=i.cartographicToCartesian(R,i8),u=Math.min(Wt.getPointDistance(h,q),Wt.getPointDistance(h,j)),f=n,e8(H.origin,H.xAxis,H.yAxis,H.zAxis,r,s,a,c,u,f,o)}const _=e.south>0,g=e.north<0,p=_?e.south:g?e.north:0,y=Ee.center(e,t8).longitude,T=d.fromRadians(y,p,n,i,oNe);T.z=0;const x=Math.abs(T.x)<F.EPSILON10&&Math.abs(T.y)<F.EPSILON10?d.UNIT_X:d.normalize(T,rNe),v=d.UNIT_Z,D=d.cross(x,v,sNe);h=Wt.fromPointNormal(T,x,dNe);const L=d.fromRadians(y+F.PI_OVER_TWO,p,n,i,aNe);s=d.dot(Wt.projectPointOntoPlane(h,L,cNe),D),r=-s,c=d.fromRadians(0,e.north,g?t:n,i,lNe).z,a=d.fromRadians(0,e.south,_?t:n,i,uNe).z;const B=d.fromRadians(e.east,p,n,i,fNe);return u=Wt.getPointDistance(h,B),f=0,e8(T,D,v,x,r,s,a,c,u,f,o)};Zt.fromTransformation=function(e,t){return E.typeOf.object("transformation",e),l(t)||(t=new Zt),t.center=N.getTranslation(e,t.center),t.halfAxes=N.getMatrix3(e,t.halfAxes),t.halfAxes=te.multiplyByScalar(t.halfAxes,.5,t.halfAxes),t};Zt.clone=function(e,t){if(l(e))return l(t)?(d.clone(e.center,t.center),te.clone(e.halfAxes,t.halfAxes),t):new Zt(e.center,e.halfAxes)};Zt.intersectPlane=function(e,t){if(!l(e))throw new w("box is required.");if(!l(t))throw new w("plane is required.");const n=e.center,i=t.normal,o=e.halfAxes,r=i.x,s=i.y,a=i.z,c=Math.abs(r*o[te.COLUMN0ROW0]+s*o[te.COLUMN0ROW1]+a*o[te.COLUMN0ROW2])+Math.abs(r*o[te.COLUMN1ROW0]+s*o[te.COLUMN1ROW1]+a*o[te.COLUMN1ROW2])+Math.abs(r*o[te.COLUMN2ROW0]+s*o[te.COLUMN2ROW1]+a*o[te.COLUMN2ROW2]),u=d.dot(i,n)+t.distance;return u<=-c?Vn.OUTSIDE:u>=c?Vn.INSIDE:Vn.INTERSECTING};const xJ=new d,wJ=new d,SJ=new d,hNe=new d,o8=new d,pNe=new d;Zt.distanceSquaredTo=function(e,t){if(!l(e))throw new w("box is required.");if(!l(t))throw new w("cartesian is required.");const n=d.subtract(t,e.center,EJ),i=e.halfAxes;let o=te.getColumn(i,0,xJ),r=te.getColumn(i,1,wJ),s=te.getColumn(i,2,SJ);const a=d.magnitude(o),c=d.magnitude(r),u=d.magnitude(s);let f=!0,h=!0,_=!0;a>0?d.divideByScalar(o,a,o):f=!1,c>0?d.divideByScalar(r,c,r):h=!1,u>0?d.divideByScalar(s,u,s):_=!1;const g=!f+!h+!_;let p,y,T;if(g===1){let D=o;p=r,y=s,h?_||(D=s,y=o):(D=r,p=o),T=d.cross(p,y,o8),D===o?o=T:D===r?r=T:D===s&&(s=T)}else if(g===2){p=o,h?p=r:_&&(p=s);let D=d.UNIT_Y;D.equalsEpsilon(p,F.EPSILON3)&&(D=d.UNIT_X),y=d.cross(p,D,hNe),d.normalize(y,y),T=d.cross(p,y,o8),d.normalize(T,T),p===o?(r=y,s=T):p===r?(s=y,o=T):p===s&&(o=y,r=T)}else g===3&&(o=d.UNIT_X,r=d.UNIT_Y,s=d.UNIT_Z);const b=pNe;b.x=d.dot(n,o),b.y=d.dot(n,r),b.z=d.dot(n,s);let x=0,v;return b.x<-a?(v=b.x+a,x+=v*v):b.x>a&&(v=b.x-a,x+=v*v),b.y<-c?(v=b.y+c,x+=v*v):b.y>c&&(v=b.y-c,x+=v*v),b.z<-u?(v=b.z+u,x+=v*v):b.z>u&&(v=b.z-u,x+=v*v),x};const mNe=new d,_Ne=new d;Zt.computePlaneDistances=function(e,t,n,i){if(!l(e))throw new w("box is required.");if(!l(t))throw new w("position is required.");if(!l(n))throw new w("direction is required.");l(i)||(i=new bm);let o=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY;const s=e.center,a=e.halfAxes,c=te.getColumn(a,0,xJ),u=te.getColumn(a,1,wJ),f=te.getColumn(a,2,SJ),h=d.add(c,u,mNe);d.add(h,f,h),d.add(h,s,h);const _=d.subtract(h,t,_Ne);let g=d.dot(n,_);return o=Math.min(g,o),r=Math.max(g,r),d.add(s,c,h),d.add(h,u,h),d.subtract(h,f,h),d.subtract(h,t,_),g=d.dot(n,_),o=Math.min(g,o),r=Math.max(g,r),d.add(s,c,h),d.subtract(h,u,h),d.add(h,f,h),d.subtract(h,t,_),g=d.dot(n,_),o=Math.min(g,o),r=Math.max(g,r),d.add(s,c,h),d.subtract(h,u,h),d.subtract(h,f,h),d.subtract(h,t,_),g=d.dot(n,_),o=Math.min(g,o),r=Math.max(g,r),d.subtract(s,c,h),d.add(h,u,h),d.add(h,f,h),d.subtract(h,t,_),g=d.dot(n,_),o=Math.min(g,o),r=Math.max(g,r),d.subtract(s,c,h),d.add(h,u,h),d.subtract(h,f,h),d.subtract(h,t,_),g=d.dot(n,_),o=Math.min(g,o),r=Math.max(g,r),d.subtract(s,c,h),d.subtract(h,u,h),d.add(h,f,h),d.subtract(h,t,_),g=d.dot(n,_),o=Math.min(g,o),r=Math.max(g,r),d.subtract(s,c,h),d.subtract(h,u,h),d.subtract(h,f,h),d.subtract(h,t,_),g=d.dot(n,_),o=Math.min(g,o),r=Math.max(g,r),i.start=o,i.stop=r,i};const gNe=new d,yNe=new d,ANe=new d;Zt.computeCorners=function(e,t){E.typeOf.object("box",e),l(t)||(t=[new d,new d,new d,new d,new d,new d,new d,new d]);const n=e.center,i=e.halfAxes,o=te.getColumn(i,0,gNe),r=te.getColumn(i,1,yNe),s=te.getColumn(i,2,ANe);return d.clone(n,t[0]),d.subtract(t[0],o,t[0]),d.subtract(t[0],r,t[0]),d.subtract(t[0],s,t[0]),d.clone(n,t[1]),d.subtract(t[1],o,t[1]),d.subtract(t[1],r,t[1]),d.add(t[1],s,t[1]),d.clone(n,t[2]),d.subtract(t[2],o,t[2]),d.add(t[2],r,t[2]),d.subtract(t[2],s,t[2]),d.clone(n,t[3]),d.subtract(t[3],o,t[3]),d.add(t[3],r,t[3]),d.add(t[3],s,t[3]),d.clone(n,t[4]),d.add(t[4],o,t[4]),d.subtract(t[4],r,t[4]),d.subtract(t[4],s,t[4]),d.clone(n,t[5]),d.add(t[5],o,t[5]),d.subtract(t[5],r,t[5]),d.add(t[5],s,t[5]),d.clone(n,t[6]),d.add(t[6],o,t[6]),d.add(t[6],r,t[6]),d.subtract(t[6],s,t[6]),d.clone(n,t[7]),d.add(t[7],o,t[7]),d.add(t[7],r,t[7]),d.add(t[7],s,t[7]),t};const TNe=new te;Zt.computeTransformation=function(e,t){E.typeOf.object("box",e),l(t)||(t=new N);const n=e.center,i=te.multiplyByUniformScale(e.halfAxes,2,TNe);return N.fromRotationTranslation(i,n,t)};const CNe=new Ae;Zt.isOccluded=function(e,t){if(!l(e))throw new w("box is required.");if(!l(t))throw new w("occluder is required.");const n=Ae.fromOrientedBoundingBox(e,CNe);return!t.isBoundingSphereVisible(n)};Zt.prototype.intersectPlane=function(e){return Zt.intersectPlane(this,e)};Zt.prototype.distanceSquaredTo=function(e){return Zt.distanceSquaredTo(this,e)};Zt.prototype.computePlaneDistances=function(e,t,n){return Zt.computePlaneDistances(this,e,t,n)};Zt.prototype.computeCorners=function(e){return Zt.computeCorners(this,e)};Zt.prototype.computeTransformation=function(e){return Zt.computeTransformation(this,e)};Zt.prototype.isOccluded=function(e){return Zt.isOccluded(this,e)};Zt.equals=function(e,t){return e===t||l(e)&&l(t)&&d.equals(e.center,t.center)&&te.equals(e.halfAxes,t.halfAxes)};Zt.prototype.clone=function(e){return Zt.clone(this,e)};Zt.prototype.equals=function(e){return Zt.equals(this,e)};const qi={SCALAR:"SCALAR",VEC2:"VEC2",VEC3:"VEC3",VEC4:"VEC4",MAT2:"MAT2",MAT3:"MAT3",MAT4:"MAT4"};qi.getMathType=function(e){switch(e){case qi.SCALAR:return Number;case qi.VEC2:return $;case qi.VEC3:return d;case qi.VEC4:return ue;case qi.MAT2:return Et;case qi.MAT3:return te;case qi.MAT4:return N;default:throw new w("attributeType is not a valid value.")}};qi.getNumberOfComponents=function(e){switch(e){case qi.SCALAR:return 1;case qi.VEC2:return 2;case qi.VEC3:return 3;case qi.VEC4:case qi.MAT2:return 4;case qi.MAT3:return 9;case qi.MAT4:return 16;default:throw new w("attributeType is not a valid value.")}};qi.getAttributeLocationCount=function(e){switch(e){case qi.SCALAR:case qi.VEC2:case qi.VEC3:case qi.VEC4:return 1;case qi.MAT2:return 2;case qi.MAT3:return 3;case qi.MAT4:return 4;default:throw new w("attributeType is not a valid value.")}};qi.getGlslType=function(e){switch(E.typeOf.string("attributeType",e),e){case qi.SCALAR:return"float";case qi.VEC2:return"vec2";case qi.VEC3:return"vec3";case qi.VEC4:return"vec4";case qi.MAT2:return"mat2";case qi.MAT3:return"mat3";case qi.MAT4:return"mat4";default:throw new w("attributeType is not a valid value.")}};const Nn=Object.freeze(qi),r8=1/256,s8=256,yo={};yo.octEncodeInRange=function(e,t,n){E.defined("vector",e),E.defined("result",n);const i=d.magnitudeSquared(e);if(Math.abs(i-1)>F.EPSILON6)throw new w("vector must be normalized.");if(n.x=e.x/(Math.abs(e.x)+Math.abs(e.y)+Math.abs(e.z)),n.y=e.y/(Math.abs(e.x)+Math.abs(e.y)+Math.abs(e.z)),e.z<0){const o=n.x,r=n.y;n.x=(1-Math.abs(r))*F.signNotZero(o),n.y=(1-Math.abs(o))*F.signNotZero(r)}return n.x=F.toSNorm(n.x,t),n.y=F.toSNorm(n.y,t),n};yo.octEncode=function(e,t){return yo.octEncodeInRange(e,255,t)};const bC=new $,a8=new Uint8Array(1);function BS(e){return a8[0]=e,a8[0]}yo.octEncodeToCartesian4=function(e,t){return yo.octEncodeInRange(e,65535,bC),t.x=BS(bC.x*r8),t.y=BS(bC.x),t.z=BS(bC.y*r8),t.w=BS(bC.y),t};yo.octDecodeInRange=function(e,t,n,i){if(E.defined("result",i),e<0||e>n||t<0||t>n)throw new w(`x and y must be unsigned normalized integers between 0 and ${n}`);if(i.x=F.fromSNorm(e,n),i.y=F.fromSNorm(t,n),i.z=1-(Math.abs(i.x)+Math.abs(i.y)),i.z<0){const o=i.x;i.x=(1-Math.abs(i.y))*F.signNotZero(o),i.y=(1-Math.abs(o))*F.signNotZero(i.y)}return d.normalize(i,i)};yo.octDecode=function(e,t,n){return yo.octDecodeInRange(e,t,255,n)};yo.octDecodeFromCartesian4=function(e,t){E.typeOf.object("encoded",e),E.typeOf.object("result",t);const n=e.x,i=e.y,o=e.z,r=e.w;if(n<0||n>255||i<0||i>255||o<0||o>255||r<0||r>255)throw new w("x, y, z, and w must be unsigned normalized integers between 0 and 255");const s=n*s8+i,a=o*s8+r;return yo.octDecodeInRange(s,a,65535,t)};yo.octPackFloat=function(e){return E.defined("encoded",e),256*e.x+e.y};const iF=new $;yo.octEncodeFloat=function(e){return yo.octEncode(e,iF),yo.octPackFloat(iF)};yo.octDecodeFloat=function(e,t){E.defined("value",e);const n=e/256,i=Math.floor(n),o=(n-i)*256;return yo.octDecode(i,o,t)};yo.octPack=function(e,t,n,i){E.defined("v1",e),E.defined("v2",t),E.defined("v3",n),E.defined("result",i);const o=yo.octEncodeFloat(e),r=yo.octEncodeFloat(t),s=yo.octEncode(n,iF);return i.x=65536*s.x+o,i.y=65536*s.y+r,i};yo.octUnpack=function(e,t,n,i){E.defined("packed",e),E.defined("v1",t),E.defined("v2",n),E.defined("v3",i);let o=e.x/65536;const r=Math.floor(o),s=(o-r)*65536;o=e.y/65536;const a=Math.floor(o),c=(o-a)*65536;yo.octDecodeFloat(s,t),yo.octDecodeFloat(c,n),yo.octDecode(r,a,i)};yo.compressTextureCoordinates=function(e){E.defined("textureCoordinates",e);const t=e.x*4095|0,n=e.y*4095|0;return 4096*t+n};yo.decompressTextureCoordinates=function(e,t){E.defined("compressed",e),E.defined("result",t);const n=e/4096,i=Math.floor(n);return t.x=i/4095,t.y=(e-i*4096)/4095,t};function mB(e){return e>>1^-(e&1)}yo.zigZagDeltaDecode=function(e,t,n){E.defined("uBuffer",e),E.defined("vBuffer",t),E.typeOf.number.equals("uBuffer.length","vBuffer.length",e.length,t.length),l(n)&&E.typeOf.number.equals("uBuffer.length","heightBuffer.length",e.length,n.length);const i=e.length;let o=0,r=0,s=0;for(let a=0;a<i;++a)o+=mB(e[a]),r+=mB(t[a]),e[a]=o,t[a]=r,l(n)&&(s+=mB(n[a]),n[a]=s)};yo.dequantize=function(e,t,n,i){E.defined("typedArray",e),E.defined("componentDatatype",t),E.defined("type",n),E.defined("count",i);const o=Nn.getNumberOfComponents(n);let r;switch(t){case oe.BYTE:r=127;break;case oe.UNSIGNED_BYTE:r=255;break;case oe.SHORT:r=32767;break;case oe.UNSIGNED_SHORT:r=65535;break;case oe.INT:r=2147483647;break;case oe.UNSIGNED_INT:r=4294967295;break;default:throw new w(`Cannot dequantize component datatype: ${t}`)}const s=new Float32Array(i*o);for(let a=0;a<i;a++)for(let c=0;c<o;c++){const u=a*o+c;s[u]=Math.max(e[u]/r,-1)}return s};yo.decodeRGB565=function(e,t){E.defined("typedArray",e);const n=e.length*3;l(t)&&E.typeOf.number.equals("result.length","typedArray.length * 3",t.length,n);const i=e.length;l(t)||(t=new Float32Array(i*3));const o=(1<<5)-1,r=(1<<6)-1,s=1/31,a=1/63;for(let c=0;c<i;c++){const u=e[c],f=u>>11,h=u>>5&r,_=u&o,g=3*c;t[g]=f*s,t[g+1]=h*a,t[g+2]=_*s}return t};const Ri=yo,FI={};FI.getHeight=function(e,t,n){return(e-n)*t+n};const bNe=new d;FI.getPosition=function(e,t,n,i,o){const r=t.cartesianToCartographic(e,bNe),s=FI.getHeight(r.height,n,i);return d.fromRadians(r.longitude,r.latitude,s,t,o)};const Fm=FI,ENe={NONE:0,BITS12:1},rl=Object.freeze(ENe),Sg=new d,xNe=new d,$l=new $,RS=new N,wNe=new N,SNe=Math.pow(2,12);function ts(e,t,n,i,o,r,s,a,c,u){let f=rl.NONE,h,_;if(l(t)&&l(n)&&l(i)&&l(o)){const g=t.minimum,p=t.maximum,y=d.subtract(p,g,xNe),T=i-n;Math.max(d.maximumComponent(y),T)<SNe-1?f=rl.BITS12:f=rl.NONE,h=N.inverseTransformation(o,new N);const x=d.negate(g,Sg);N.multiply(N.fromTranslation(x,RS),h,h);const v=Sg;v.x=1/y.x,v.y=1/y.y,v.z=1/y.z,N.multiply(N.fromScale(v,RS),h,h),_=N.clone(o),N.setTranslation(_,d.ZERO,_),o=N.clone(o,new N);const D=N.fromTranslation(g,RS),L=N.fromScale(y,wNe),B=N.multiply(D,L,RS);N.multiply(o,B,o),N.multiply(_,B,_)}this.quantization=f,this.minimumHeight=n,this.maximumHeight=i,this.center=d.clone(e),this.toScaledENU=h,this.fromScaledENU=o,this.matrix=_,this.hasVertexNormals=r,this.hasWebMercatorT=A(s,!1),this.hasGeodeticSurfaceNormals=A(a,!1),this.exaggeration=A(c,1),this.exaggerationRelativeHeight=A(u,0),this.stride=0,this._offsetGeodeticSurfaceNormal=0,this._offsetVertexNormal=0,this._calculateStrideAndOffsets()}ts.prototype.encode=function(e,t,n,i,o,r,s,a){const c=i.x,u=i.y;if(this.quantization===rl.BITS12){n=N.multiplyByPoint(this.toScaledENU,n,Sg),n.x=F.clamp(n.x,0,1),n.y=F.clamp(n.y,0,1),n.z=F.clamp(n.z,0,1);const f=this.maximumHeight-this.minimumHeight,h=F.clamp((o-this.minimumHeight)/f,0,1);$.fromElements(n.x,n.y,$l);const _=Ri.compressTextureCoordinates($l);$.fromElements(n.z,h,$l);const g=Ri.compressTextureCoordinates($l);$.fromElements(c,u,$l);const p=Ri.compressTextureCoordinates($l);if(e[t++]=_,e[t++]=g,e[t++]=p,this.hasWebMercatorT){$.fromElements(s,0,$l);const y=Ri.compressTextureCoordinates($l);e[t++]=y}}else d.subtract(n,this.center,Sg),e[t++]=Sg.x,e[t++]=Sg.y,e[t++]=Sg.z,e[t++]=o,e[t++]=c,e[t++]=u,this.hasWebMercatorT&&(e[t++]=s);return this.hasVertexNormals&&(e[t++]=Ri.octPackFloat(r)),this.hasGeodeticSurfaceNormals&&(e[t++]=a.x,e[t++]=a.y,e[t++]=a.z),t};const vNe=new d,vJ=new d;ts.prototype.addGeodeticSurfaceNormals=function(e,t,n){if(this.hasGeodeticSurfaceNormals)return;const i=this.stride,o=e.length/i;this.hasGeodeticSurfaceNormals=!0,this._calculateStrideAndOffsets();const r=this.stride;for(let s=0;s<o;s++){for(let f=0;f<i;f++){const h=s*i+f,_=s*r+f;t[_]=e[h]}const a=this.decodePosition(t,s,vNe),c=n.geodeticSurfaceNormal(a,vJ),u=s*r+this._offsetGeodeticSurfaceNormal;t[u]=c.x,t[u+1]=c.y,t[u+2]=c.z}};ts.prototype.removeGeodeticSurfaceNormals=function(e,t){if(!this.hasGeodeticSurfaceNormals)return;const n=this.stride,i=e.length/n;this.hasGeodeticSurfaceNormals=!1,this._calculateStrideAndOffsets();const o=this.stride;for(let r=0;r<i;r++)for(let s=0;s<o;s++){const a=r*n+s,c=r*o+s;t[c]=e[a]}};ts.prototype.decodePosition=function(e,t,n){if(l(n)||(n=new d),t*=this.stride,this.quantization===rl.BITS12){const i=Ri.decompressTextureCoordinates(e[t],$l);n.x=i.x,n.y=i.y;const o=Ri.decompressTextureCoordinates(e[t+1],$l);return n.z=o.x,N.multiplyByPoint(this.fromScaledENU,n,n)}return n.x=e[t],n.y=e[t+1],n.z=e[t+2],d.add(n,this.center,n)};ts.prototype.getExaggeratedPosition=function(e,t,n){n=this.decodePosition(e,t,n);const i=this.exaggeration,o=this.exaggerationRelativeHeight;if(i!==1&&this.hasGeodeticSurfaceNormals){const s=this.decodeGeodeticSurfaceNormal(e,t,vJ),a=this.decodeHeight(e,t),c=Fm.getHeight(a,i,o)-a;n.x+=s.x*c,n.y+=s.y*c,n.z+=s.z*c}return n};ts.prototype.decodeTextureCoordinates=function(e,t,n){return l(n)||(n=new $),t*=this.stride,this.quantization===rl.BITS12?Ri.decompressTextureCoordinates(e[t+2],n):$.fromElements(e[t+4],e[t+5],n)};ts.prototype.decodeHeight=function(e,t){return t*=this.stride,this.quantization===rl.BITS12?Ri.decompressTextureCoordinates(e[t+1],$l).y*(this.maximumHeight-this.minimumHeight)+this.minimumHeight:e[t+3]};ts.prototype.decodeWebMercatorT=function(e,t){return t*=this.stride,this.quantization===rl.BITS12?Ri.decompressTextureCoordinates(e[t+3],$l).x:e[t+6]};ts.prototype.getOctEncodedNormal=function(e,t,n){t=t*this.stride+this._offsetVertexNormal;const i=e[t]/256,o=Math.floor(i),r=(i-o)*256;return $.fromElements(o,r,n)};ts.prototype.decodeGeodeticSurfaceNormal=function(e,t,n){return t=t*this.stride+this._offsetGeodeticSurfaceNormal,n.x=e[t],n.y=e[t+1],n.z=e[t+2],n};ts.prototype._calculateStrideAndOffsets=function(){let e=0;switch(this.quantization){case rl.BITS12:e+=3;break;default:e+=6}this.hasWebMercatorT&&(e+=1),this.hasVertexNormals&&(this._offsetVertexNormal=e,e+=1),this.hasGeodeticSurfaceNormals&&(this._offsetGeodeticSurfaceNormal=e,e+=3),this.stride=e};const ID={position3DAndHeight:0,textureCoordAndEncodedNormals:1,geodeticSurfaceNormal:2},PD={compressed0:0,compressed1:1,geodeticSurfaceNormal:2};ts.prototype.getAttributes=function(e){const t=oe.FLOAT,n=oe.getSizeInBytes(t),i=this.stride*n;let o=0;const r=[];function s(a,c){r.push({index:a,vertexBuffer:e,componentDatatype:t,componentsPerAttribute:c,offsetInBytes:o,strideInBytes:i}),o+=c*n}if(this.quantization===rl.NONE){s(ID.position3DAndHeight,4);let a=2;a+=this.hasWebMercatorT?1:0,a+=this.hasVertexNormals?1:0,s(ID.textureCoordAndEncodedNormals,a),this.hasGeodeticSurfaceNormals&&s(ID.geodeticSurfaceNormal,3)}else{const a=this.hasWebMercatorT||this.hasVertexNormals,c=this.hasWebMercatorT&&this.hasVertexNormals;s(PD.compressed0,a?4:3),c&&s(PD.compressed1,1),this.hasGeodeticSurfaceNormals&&s(PD.geodeticSurfaceNormal,3)}return r};ts.prototype.getAttributeLocations=function(){return this.quantization===rl.NONE?ID:PD};ts.clone=function(e,t){if(l(e))return l(t)||(t=new ts),t.quantization=e.quantization,t.minimumHeight=e.minimumHeight,t.maximumHeight=e.maximumHeight,t.center=d.clone(e.center),t.toScaledENU=N.clone(e.toScaledENU),t.fromScaledENU=N.clone(e.fromScaledENU),t.matrix=N.clone(e.matrix),t.hasVertexNormals=e.hasVertexNormals,t.hasWebMercatorT=e.hasWebMercatorT,t.hasGeodeticSurfaceNormals=e.hasGeodeticSurfaceNormals,t.exaggeration=e.exaggeration,t.exaggerationRelativeHeight=e.exaggerationRelativeHeight,t._calculateStrideAndOffsets(),t};const Qf={};Qf.DEFAULT_STRUCTURE=Object.freeze({heightScale:1,heightOffset:0,elementsPerHeight:1,stride:1,elementMultiplier:256,isBigEndian:!1});const _B=new d,DNe=new N,INe=new d,PNe=new d;Qf.computeVertices=function(e){if(!l(e)||!l(e.heightmap))throw new w("options.heightmap is required.");if(!l(e.width)||!l(e.height))throw new w("options.width and options.height are required.");if(!l(e.nativeRectangle))throw new w("options.nativeRectangle is required.");if(!l(e.skirtHeight))throw new w("options.skirtHeight is required.");const t=Math.cos,n=Math.sin,i=Math.sqrt,o=Math.atan,r=Math.exp,s=F.PI_OVER_TWO,a=F.toRadians,c=e.heightmap,u=e.width,f=e.height,h=e.skirtHeight,_=h>0,g=A(e.isGeographic,!0),p=A(e.ellipsoid,be.WGS84),y=1/p.maximumRadius,T=Ee.clone(e.nativeRectangle),b=Ee.clone(e.rectangle);let x,v,D,L;l(b)?(x=b.west,v=b.south,D=b.east,L=b.north):g?(x=a(T.west),v=a(T.south),D=a(T.east),L=a(T.north)):(x=T.west*y,v=s-2*o(r(-T.south*y)),D=T.east*y,L=s-2*o(r(-T.north*y)));let B=e.relativeToCenter;const V=l(B);B=V?B:d.ZERO;const M=A(e.includeWebMercatorT,!1),H=A(e.exaggeration,1),G=A(e.exaggerationRelativeHeight,0),O=H!==1,m=A(e.structure,Qf.DEFAULT_STRUCTURE),P=A(m.heightScale,Qf.DEFAULT_STRUCTURE.heightScale),R=A(m.heightOffset,Qf.DEFAULT_STRUCTURE.heightOffset),U=A(m.elementsPerHeight,Qf.DEFAULT_STRUCTURE.elementsPerHeight),W=A(m.stride,Qf.DEFAULT_STRUCTURE.stride),q=A(m.elementMultiplier,Qf.DEFAULT_STRUCTURE.elementMultiplier),Y=A(m.isBigEndian,Qf.DEFAULT_STRUCTURE.isBigEndian);let j=Ee.computeWidth(T),ee=Ee.computeHeight(T);const K=j/(u-1),se=ee/(f-1);g||(j*=y,ee*=y);const Q=p.radiiSquared,Z=Q.x,J=Q.y,de=Q.z;let _e=65536,le=-65536;const Te=En.eastNorthUpToFixedFrame(B,p),pe=N.inverseTransformation(Te,DNe);let ne,ae;M&&(ne=Ii.geodeticLatitudeToMercatorAngle(v),ae=1/(Ii.geodeticLatitudeToMercatorAngle(L)-ne));const ye=INe;ye.x=Number.POSITIVE_INFINITY,ye.y=Number.POSITIVE_INFINITY,ye.z=Number.POSITIVE_INFINITY;const Ce=PNe;Ce.x=Number.NEGATIVE_INFINITY,Ce.y=Number.NEGATIVE_INFINITY,Ce.z=Number.NEGATIVE_INFINITY;let Be=Number.POSITIVE_INFINITY;const Le=u*f,Ve=h>0?u*2+f*2:0,Ie=Le+Ve,He=new Array(Ie),Me=new Array(Ie),qe=new Array(Ie),Ne=M?new Array(Ie):[],ke=O?new Array(Ie):[];let Qe=0,Ge=f,Pt=0,Lt=u;_&&(--Qe,++Ge,--Pt,++Lt);const qt=1e-5;for(let Jt=Qe;Jt<Ge;++Jt){let ln=Jt;ln<0&&(ln=0),ln>=f&&(ln=f-1);let ei=T.north-se*ln;g?ei=a(ei):ei=s-2*o(r(-ei*y));let bi=(ei-v)/(L-v);bi=F.clamp(bi,0,1);const pn=Jt===Qe,Fi=Jt===Ge-1;h>0&&(pn?ei+=qt*ee:Fi&&(ei-=qt*ee));const Co=t(ei),Xi=n(ei),gi=de*Xi;let wn;M&&(wn=(Ii.geodeticLatitudeToMercatorAngle(ei)-ne)*ae);for(let ti=Pt;ti<Lt;++ti){let Jn=ti;Jn<0&&(Jn=0),Jn>=u&&(Jn=u-1);const Tn=ln*(u*W)+Jn*W;let Rt;if(U===1)Rt=c[Tn];else{Rt=0;let Nt;if(Y)for(Nt=0;Nt<U;++Nt)Rt=Rt*q+c[Tn+Nt];else for(Nt=U-1;Nt>=0;--Nt)Rt=Rt*q+c[Tn+Nt]}Rt=Rt*P+R,le=Math.max(le,Rt),_e=Math.min(_e,Rt);let et=T.west+K*Jn;g?et=a(et):et=et*y;let qn=(et-x)/(D-x);qn=F.clamp(qn,0,1);let Sn=ln*u+Jn;if(h>0){const Nt=ti===Pt,Oe=ti===Lt-1,st=pn||Fi||Nt||Oe;if((pn||Fi)&&(Nt||Oe))continue;st&&(Rt-=h,Nt?(Sn=Le+(f-ln-1),et-=qt*j):Fi?Sn=Le+f+(u-Jn-1):Oe?(Sn=Le+f+u+ln,et+=qt*j):pn&&(Sn=Le+f+u+f+Jn))}const oo=Co*t(et),jn=Co*n(et),Ki=Z*oo,zo=J*jn,Yr=1/i(Ki*oo+zo*jn+gi*Xi),ro=Ki*Yr,Ji=zo*Yr,Rr=gi*Yr,Zs=new d;Zs.x=ro+oo*Rt,Zs.y=Ji+jn*Rt,Zs.z=Rr+Xi*Rt,N.multiplyByPoint(pe,Zs,_B),d.minimumByComponent(_B,ye,ye),d.maximumByComponent(_B,Ce,Ce),Be=Math.min(Be,Rt),He[Sn]=Zs,qe[Sn]=new $(qn,bi),Me[Sn]=Rt,M&&(Ne[Sn]=wn),O&&(ke[Sn]=p.geodeticSurfaceNormal(Zs))}}const zn=Ae.fromPoints(He);let Gn;l(b)&&(Gn=Zt.fromRectangle(b,_e,le,p));let Dn;V&&(Dn=new Eu(p).computeHorizonCullingPointPossiblyUnderEllipsoid(B,He,_e));const hn=new pa(ye,Ce,B),jt=new ts(B,hn,Be,le,Te,!1,M,O,H,G),In=new Float32Array(Ie*jt.stride);let Rn=0;for(let Jt=0;Jt<Ie;++Jt)Rn=jt.encode(In,Rn,He[Jt],qe[Jt],Me[Jt],void 0,Ne[Jt],ke[Jt]);return{vertices:In,maximumHeight:le,minimumHeight:_e,encoding:jt,boundingSphere3D:zn,orientedBoundingBox:Gn,occludeePointInScaledSpace:Dn}};const DJ=Qf;function Ld(){w.throwInstantiationError()}Object.defineProperties(Ld.prototype,{credits:{get:w.throwInstantiationError},waterMask:{get:w.throwInstantiationError}});Ld.prototype.interpolateHeight=w.throwInstantiationError;Ld.prototype.isChildAvailable=w.throwInstantiationError;Ld.prototype.createMesh=w.throwInstantiationError;Ld.prototype.upsample=w.throwInstantiationError;Ld.prototype.wasCreatedByUpsampling=w.throwInstantiationError;Ld.maximumAsynchronousTasks=5;function J1(e,t,n,i,o,r,s,a,c,u,f,h,_,g,p,y){this.center=e,this.vertices=t,this.stride=A(u,6),this.indices=n,this.indexCountWithoutSkirts=i,this.vertexCountWithoutSkirts=o,this.minimumHeight=r,this.maximumHeight=s,this.boundingSphere3D=a,this.occludeePointInScaledSpace=c,this.orientedBoundingBox=f,this.encoding=h,this.westIndicesSouthToNorth=_,this.southIndicesEastToWest=g,this.eastIndicesNorthToSouth=p,this.northIndicesWestToEast=y}function Pr(){w.throwInstantiationError()}Object.defineProperties(Pr.prototype,{errorEvent:{get:w.throwInstantiationError},credit:{get:w.throwInstantiationError},tilingScheme:{get:w.throwInstantiationError},ready:{get:w.throwInstantiationError},readyPromise:{get:w.throwInstantiationError},hasWaterMask:{get:w.throwInstantiationError},hasVertexNormals:{get:w.throwInstantiationError},availability:{get:w.throwInstantiationError}});const c8=[];Pr.getRegularGridIndices=function(e,t){if(e*t>=F.FOUR_GIGABYTES)throw new w("The total number of vertices (width * height) must be less than 4,294,967,296.");let n=c8[e];l(n)||(c8[e]=n=[]);let i=n[t];return l(i)||(e*t<F.SIXTY_FOUR_KILOBYTES?i=n[t]=new Uint16Array((e-1)*(t-1)*6):i=n[t]=new Uint32Array((e-1)*(t-1)*6),PJ(e,t,i,0)),i};const l8=[];Pr.getRegularGridIndicesAndEdgeIndices=function(e,t){if(e*t>=F.FOUR_GIGABYTES)throw new w("The total number of vertices (width * height) must be less than 4,294,967,296.");let n=l8[e];l(n)||(l8[e]=n=[]);let i=n[t];if(!l(i)){const o=Pr.getRegularGridIndices(e,t),r=IJ(e,t),s=r.westIndicesSouthToNorth,a=r.southIndicesEastToWest,c=r.eastIndicesNorthToSouth,u=r.northIndicesWestToEast;i=n[t]={indices:o,westIndicesSouthToNorth:s,southIndicesEastToWest:a,eastIndicesNorthToSouth:c,northIndicesWestToEast:u}}return i};const u8=[];Pr.getRegularGridAndSkirtIndicesAndEdgeIndices=function(e,t){if(e*t>=F.FOUR_GIGABYTES)throw new w("The total number of vertices (width * height) must be less than 4,294,967,296.");let n=u8[e];l(n)||(u8[e]=n=[]);let i=n[t];if(!l(i)){const o=e*t,r=(e-1)*(t-1)*6,s=e*2+t*2,a=Math.max(0,s-4)*6,c=o+s,u=r+a,f=IJ(e,t),h=f.westIndicesSouthToNorth,_=f.southIndicesEastToWest,g=f.eastIndicesNorthToSouth,p=f.northIndicesWestToEast,y=At.createTypedArray(c,u);PJ(e,t,y,0),Pr.addSkirtIndices(h,_,g,p,o,y,r),i=n[t]={indices:y,westIndicesSouthToNorth:h,southIndicesEastToWest:_,eastIndicesNorthToSouth:g,northIndicesWestToEast:p,indexCountWithoutSkirts:r}}return i};Pr.addSkirtIndices=function(e,t,n,i,o,r,s){let a=o;s=NS(e,a,r,s),a+=e.length,s=NS(t,a,r,s),a+=t.length,s=NS(n,a,r,s),a+=n.length,NS(i,a,r,s)};function IJ(e,t){const n=new Array(t),i=new Array(e),o=new Array(t),r=new Array(e);let s;for(s=0;s<e;++s)r[s]=s,i[s]=e*t-1-s;for(s=0;s<t;++s)o[s]=(s+1)*e-1,n[s]=(t-s-1)*e;return{westIndicesSouthToNorth:n,southIndicesEastToWest:i,eastIndicesNorthToSouth:o,northIndicesWestToEast:r}}function PJ(e,t,n,i){let o=0;for(let r=0;r<t-1;++r){for(let s=0;s<e-1;++s){const a=o,c=a+e,u=c+1,f=a+1;n[i++]=a,n[i++]=c,n[i++]=f,n[i++]=f,n[i++]=c,n[i++]=u,++o}++o}}function NS(e,t,n,i){let o=e[0];const r=e.length;for(let s=1;s<r;++s){const a=e[s];n[i++]=o,n[i++]=a,n[i++]=t,n[i++]=t,n[i++]=a,n[i++]=t+1,o=a,++t}return i}Pr.heightmapTerrainQuality=.25;Pr.getEstimatedLevelZeroGeometricErrorForAHeightmap=function(e,t,n){return e.maximumRadius*2*Math.PI*Pr.heightmapTerrainQuality/(t*n)};Pr.prototype.requestTileGeometry=w.throwInstantiationError;Pr.prototype.getLevelMaximumGeometricError=w.throwInstantiationError;Pr.prototype.getTileDataAvailable=w.throwInstantiationError;Pr.prototype.loadTileDataAvailability=w.throwInstantiationError;function _f(e){if(!l(e)||!l(e.buffer))throw new w("options.buffer is required.");if(!l(e.width))throw new w("options.width is required.");if(!l(e.height))throw new w("options.height is required.");this._buffer=e.buffer,this._width=e.width,this._height=e.height,this._childTileMask=A(e.childTileMask,15),this._encoding=A(e.encoding,nF.NONE);const t=DJ.DEFAULT_STRUCTURE;let n=e.structure;l(n)?n!==t&&(n.heightScale=A(n.heightScale,t.heightScale),n.heightOffset=A(n.heightOffset,t.heightOffset),n.elementsPerHeight=A(n.elementsPerHeight,t.elementsPerHeight),n.stride=A(n.stride,t.stride),n.elementMultiplier=A(n.elementMultiplier,t.elementMultiplier),n.isBigEndian=A(n.isBigEndian,t.isBigEndian)):n=t,this._structure=n,this._createdByUpsampling=A(e.createdByUpsampling,!1),this._waterMask=e.waterMask,this._skirtHeight=void 0,this._bufferType=this._encoding===nF.LERC?Float32Array:this._buffer.constructor,this._mesh=void 0}Object.defineProperties(_f.prototype,{credits:{get:function(){}},waterMask:{get:function(){return this._waterMask}},childTileMask:{get:function(){return this._childTileMask}}});const OJ="createVerticesFromHeightmap",ONe=new lo(OJ),LNe=new lo(OJ,Ld.maximumAsynchronousTasks);_f.prototype.createMesh=function(e){e=A(e,A.EMPTY_OBJECT),E.typeOf.object("options.tilingScheme",e.tilingScheme),E.typeOf.number("options.x",e.x),E.typeOf.number("options.y",e.y),E.typeOf.number("options.level",e.level);const t=e.tilingScheme,n=e.x,i=e.y,o=e.level,r=A(e.exaggeration,1),s=A(e.exaggerationRelativeHeight,0),a=A(e.throttle,!0),c=t.ellipsoid,u=t.tileXYToNativeRectangle(n,i,o),f=t.tileXYToRectangle(n,i,o),h=c.cartographicToCartesian(Ee.center(f)),_=this._structure,p=Pr.getEstimatedLevelZeroGeometricErrorForAHeightmap(c,this._width,t.getNumberOfXTilesAtLevel(0))/(1<<o);this._skirtHeight=Math.min(p*4,1e3);const T=(a?LNe:ONe).scheduleTask({heightmap:this._buffer,structure:_,includeWebMercatorT:!0,width:this._width,height:this._height,nativeRectangle:u,rectangle:f,relativeToCenter:h,ellipsoid:c,skirtHeight:this._skirtHeight,isGeographic:t.projection instanceof Or,exaggeration:r,exaggerationRelativeHeight:s,encoding:this._encoding});if(!l(T))return;const b=this;return Promise.resolve(T).then(function(x){let v;b._skirtHeight>0?v=Pr.getRegularGridAndSkirtIndicesAndEdgeIndices(x.gridWidth,x.gridHeight):v=Pr.getRegularGridIndicesAndEdgeIndices(x.gridWidth,x.gridHeight);const D=x.gridWidth*x.gridHeight;return b._mesh=new J1(h,new Float32Array(x.vertices),v.indices,v.indexCountWithoutSkirts,D,x.minimumHeight,x.maximumHeight,Ae.clone(x.boundingSphere3D),d.clone(x.occludeePointInScaledSpace),x.numberOfAttributes,Zt.clone(x.orientedBoundingBox),ts.clone(x.encoding),v.westIndicesSouthToNorth,v.southIndicesEastToWest,v.eastIndicesNorthToSouth,v.northIndicesWestToEast),b._buffer=void 0,b._mesh})};_f.prototype._createMeshSync=function(e){E.typeOf.object("options.tilingScheme",e.tilingScheme),E.typeOf.number("options.x",e.x),E.typeOf.number("options.y",e.y),E.typeOf.number("options.level",e.level);const t=e.tilingScheme,n=e.x,i=e.y,o=e.level,r=A(e.exaggeration,1),s=A(e.exaggerationRelativeHeight,0),a=t.ellipsoid,c=t.tileXYToNativeRectangle(n,i,o),u=t.tileXYToRectangle(n,i,o),f=a.cartographicToCartesian(Ee.center(u)),h=this._structure,g=Pr.getEstimatedLevelZeroGeometricErrorForAHeightmap(a,this._width,t.getNumberOfXTilesAtLevel(0))/(1<<o);this._skirtHeight=Math.min(g*4,1e3);const p=DJ.computeVertices({heightmap:this._buffer,structure:h,includeWebMercatorT:!0,width:this._width,height:this._height,nativeRectangle:c,rectangle:u,relativeToCenter:f,ellipsoid:a,skirtHeight:this._skirtHeight,isGeographic:t.projection instanceof Or,exaggeration:r,exaggerationRelativeHeight:s});this._buffer=void 0;let y;this._skirtHeight>0?y=Pr.getRegularGridAndSkirtIndicesAndEdgeIndices(this._width,this._height):y=Pr.getRegularGridIndicesAndEdgeIndices(this._width,this._height);const T=p.gridWidth*p.gridHeight;return this._mesh=new J1(f,p.vertices,y.indices,y.indexCountWithoutSkirts,T,p.minimumHeight,p.maximumHeight,p.boundingSphere3D,p.occludeePointInScaledSpace,p.encoding.stride,p.orientedBoundingBox,p.encoding,y.westIndicesSouthToNorth,y.southIndicesEastToWest,y.eastIndicesNorthToSouth,y.northIndicesWestToEast),this._mesh};_f.prototype.interpolateHeight=function(e,t,n){const i=this._width,o=this._height,r=this._structure,s=r.stride,a=r.elementsPerHeight,c=r.elementMultiplier,u=r.isBigEndian,f=r.heightOffset,h=r.heightScale,_=l(this._mesh),g=this._encoding===nF.LERC;if(!_&&g)return;let y;if(_){const T=this._mesh.vertices,b=this._mesh.encoding;y=LJ(T,b,f,h,e,i,o,t,n)}else y=BNe(this._buffer,a,c,s,u,e,i,o,t,n),y=y*h+f;return y};_f.prototype.upsample=function(e,t,n,i,o,r,s){if(!l(e))throw new w("tilingScheme is required.");if(!l(t))throw new w("thisX is required.");if(!l(n))throw new w("thisY is required.");if(!l(i))throw new w("thisLevel is required.");if(!l(o))throw new w("descendantX is required.");if(!l(r))throw new w("descendantY is required.");if(!l(s))throw new w("descendantLevel is required.");if(s-i>1)throw new w("Upsampling through more than one level at a time is not currently supported.");const c=this._mesh;if(!l(c))return;const u=this._width,f=this._height,h=this._structure,_=h.stride,g=new this._bufferType(u*f*_),p=c.vertices,y=c.encoding,T=e.tileXYToRectangle(t,n,i),b=e.tileXYToRectangle(o,r,s),x=h.heightOffset,v=h.heightScale,D=h.elementsPerHeight,L=h.elementMultiplier,B=h.isBigEndian,V=Math.pow(L,D-1);for(let M=0;M<f;++M){const H=F.lerp(b.north,b.south,M/(f-1));for(let G=0;G<u;++G){const I=F.lerp(b.west,b.east,G/(u-1));let O=LJ(p,y,x,v,T,u,f,I,H);O=O<h.lowestEncodedHeight?h.lowestEncodedHeight:O,O=O>h.highestEncodedHeight?h.highestEncodedHeight:O,RNe(g,D,L,V,_,B,M*u+G,O)}}return Promise.resolve(new _f({buffer:g,width:u,height:f,childTileMask:0,structure:this._structure,createdByUpsampling:!0}))};_f.prototype.isChildAvailable=function(e,t,n,i){if(!l(e))throw new w("thisX is required.");if(!l(t))throw new w("thisY is required.");if(!l(n))throw new w("childX is required.");if(!l(i))throw new w("childY is required.");let o=2;return n!==e*2&&++o,i!==t*2&&(o-=2),(this._childTileMask&1<<o)!==0};_f.prototype.wasCreatedByUpsampling=function(){return this._createdByUpsampling};function BNe(e,t,n,i,o,r,s,a,c,u){const f=(c-r.west)*(s-1)/(r.east-r.west),h=(u-r.south)*(a-1)/(r.north-r.south);let _=f|0,g=_+1;g>=s&&(g=s-1,_=s-2);let p=h|0,y=p+1;y>=a&&(y=a-1,p=a-2);const T=f-_,b=h-p;p=a-1-p,y=a-1-y;const x=MS(e,t,n,i,o,p*s+_),v=MS(e,t,n,i,o,p*s+g),D=MS(e,t,n,i,o,y*s+_),L=MS(e,t,n,i,o,y*s+g);return BJ(T,b,x,v,D,L)}function LJ(e,t,n,i,o,r,s,a,c){const u=(a-o.west)*(r-1)/(o.east-o.west),f=(c-o.south)*(s-1)/(o.north-o.south);let h=u|0,_=h+1;_>=r&&(_=r-1,h=r-2);let g=f|0,p=g+1;p>=s&&(p=s-1,g=s-2);const y=u-h,T=f-g;g=s-1-g,p=s-1-p;const b=(t.decodeHeight(e,g*r+h)-n)/i,x=(t.decodeHeight(e,g*r+_)-n)/i,v=(t.decodeHeight(e,p*r+h)-n)/i,D=(t.decodeHeight(e,p*r+_)-n)/i;return BJ(y,T,b,x,v,D)}function BJ(e,t,n,i,o,r){return t<e?n+e*(i-n)+t*(r-i):n+e*(r-o)+t*(o-n)}function MS(e,t,n,i,o,r){r*=i;let s=0,a;if(o)for(a=0;a<t;++a)s=s*n+e[r+a];else for(a=t-1;a>=0;--a)s=s*n+e[r+a];return s}function RNe(e,t,n,i,o,r,s,a){s*=o;let c;if(r)for(c=0;c<t-1;++c)e[s+c]=a/i|0,a-=e[s+c]*i,i/=n;else for(c=t-1;c>0;--c)e[s+c]=a/i|0,a-=e[s+c]*i,i/=n;e[s+c]=a}function y_(e){e=A(e,A.EMPTY_OBJECT),this._tilingScheme=e.tilingScheme,l(this._tilingScheme)||(this._tilingScheme=new Ga({ellipsoid:A(e.ellipsoid,be.WGS84)})),this._levelZeroMaximumGeometricError=Pr.getEstimatedLevelZeroGeometricErrorForAHeightmap(this._tilingScheme.ellipsoid,64,this._tilingScheme.getNumberOfXTilesAtLevel(0)),this._errorEvent=new lt,this._readyPromise=Promise.resolve(!0)}Object.defineProperties(y_.prototype,{errorEvent:{get:function(){return this._errorEvent}},credit:{get:function(){}},tilingScheme:{get:function(){return this._tilingScheme}},ready:{get:function(){return!0}},readyPromise:{get:function(){return this._readyPromise}},hasWaterMask:{get:function(){return!1}},hasVertexNormals:{get:function(){return!1}},availability:{get:function(){}}});y_.prototype.requestTileGeometry=function(e,t,n,i){return Promise.resolve(new _f({buffer:new Uint8Array(16*16),width:16,height:16}))};y_.prototype.getLevelMaximumGeometricError=function(e){return this._levelZeroMaximumGeometricError/(1<<e)};y_.prototype.getTileDataAvailable=function(e,t,n){};y_.prototype.loadTileDataAvailability=function(e,t,n){};function tn(e,t,n,i){this.near=A(e,0),this.nearValue=A(t,0),this.far=A(n,1),this.farValue=A(i,0)}tn.clone=function(e,t){if(l(e))return l(t)?(t.near=e.near,t.nearValue=e.nearValue,t.far=e.far,t.farValue=e.farValue,t):new tn(e.near,e.nearValue,e.far,e.farValue)};tn.packedLength=4;tn.pack=function(e,t,n){if(!l(e))throw new w("value is required");if(!l(t))throw new w("array is required");return n=A(n,0),t[n++]=e.near,t[n++]=e.nearValue,t[n++]=e.far,t[n]=e.farValue,t};tn.unpack=function(e,t,n){if(!l(e))throw new w("array is required");return t=A(t,0),l(n)||(n=new tn),n.near=e[t++],n.nearValue=e[t++],n.far=e[t++],n.farValue=e[t],n};tn.equals=function(e,t){return e===t||l(e)&&l(t)&&e.near===t.near&&e.nearValue===t.nearValue&&e.far===t.far&&e.farValue===t.farValue};tn.prototype.clone=function(e){return tn.clone(this,e)};tn.prototype.equals=function(e){return tn.equals(this,e)};function Km(e,t){E.typeOf.object("normal",e),E.typeOf.number("distance",t),this._distance=t,this._normal=new RJ(e,this),this.onChangeCallback=void 0,this.index=-1}Object.defineProperties(Km.prototype,{distance:{get:function(){return this._distance},set:function(e){E.typeOf.number("value",e),l(this.onChangeCallback)&&e!==this._distance&&this.onChangeCallback(this.index),this._distance=e}},normal:{get:function(){return this._normal},set:function(e){E.typeOf.object("value",e),l(this.onChangeCallback)&&!d.equals(this._normal._cartesian3,e)&&this.onChangeCallback(this.index),d.clone(e,this._normal._cartesian3)}}});Km.fromPlane=function(e,t){return E.typeOf.object("plane",e),l(t)?(t.normal=e.normal,t.distance=e.distance):t=new Km(e.normal,e.distance),t};Km.clone=function(e,t){return l(t)?(t.normal=e.normal,t.distance=e.distance,t):new Km(e.normal,e.distance)};function RJ(e,t){this._clippingPlane=t,this._cartesian3=d.clone(e)}Object.defineProperties(RJ.prototype,{x:{get:function(){return this._cartesian3.x},set:function(e){E.typeOf.number("value",e),l(this._clippingPlane.onChangeCallback)&&e!==this._cartesian3.x&&this._clippingPlane.onChangeCallback(this._clippingPlane.index),this._cartesian3.x=e}},y:{get:function(){return this._cartesian3.y},set:function(e){E.typeOf.number("value",e),l(this._clippingPlane.onChangeCallback)&&e!==this._cartesian3.y&&this._clippingPlane.onChangeCallback(this._clippingPlane.index),this._cartesian3.y=e}},z:{get:function(){return this._cartesian3.z},set:function(e){E.typeOf.number("value",e),l(this._clippingPlane.onChangeCallback)&&e!==this._cartesian3.z&&this._clippingPlane.onChangeCallback(this._clippingPlane.index),this._cartesian3.z=e}}});function rr(e){e=A(e,A.EMPTY_OBJECT),this._planes=[],this._dirtyIndex=-1,this._multipleDirtyPlanes=!1,this._enabled=A(e.enabled,!0),this.modelMatrix=N.clone(A(e.modelMatrix,N.IDENTITY)),this.edgeColor=k.clone(A(e.edgeColor,k.WHITE)),this.edgeWidth=A(e.edgeWidth,0),this.planeAdded=new lt,this.planeRemoved=new lt,this._owner=void 0;const t=A(e.unionClippingRegions,!1);this._unionClippingRegions=t,this._testIntersection=t?NJ:MJ,this._uint8View=void 0,this._float32View=void 0,this._clippingPlanesTexture=void 0;const n=e.planes;if(l(n)){const i=n.length;for(let o=0;o<i;++o)this.add(n[o])}}function NJ(e){return e===Vn.OUTSIDE}function MJ(e){return e===Vn.INSIDE}Object.defineProperties(rr.prototype,{length:{get:function(){return this._planes.length}},unionClippingRegions:{get:function(){return this._unionClippingRegions},set:function(e){this._unionClippingRegions!==e&&(this._unionClippingRegions=e,this._testIntersection=e?NJ:MJ)}},enabled:{get:function(){return this._enabled},set:function(e){this._enabled!==e&&(this._enabled=e)}},texture:{get:function(){return this._clippingPlanesTexture}},owner:{get:function(){return this._owner}},clippingPlanesState:{get:function(){return this._unionClippingRegions?this._planes.length:-this._planes.length}}});function f8(e,t){e._multipleDirtyPlanes=e._multipleDirtyPlanes||e._dirtyIndex!==-1&&e._dirtyIndex!==t,e._dirtyIndex=t}rr.prototype.add=function(e){const t=this._planes.length,n=this;e.onChangeCallback=function(i){f8(n,i)},e.index=t,f8(this,t),this._planes.push(e),this.planeAdded.raiseEvent(e,t)};rr.prototype.get=function(e){return E.typeOf.number("index",e),this._planes[e]};function FJ(e,t){const n=e.length;for(let i=0;i<n;++i)if(Wt.equals(e[i],t))return i;return-1}rr.prototype.contains=function(e){return FJ(this._planes,e)!==-1};rr.prototype.remove=function(e){const t=this._planes,n=FJ(t,e);if(n===-1)return!1;e instanceof Km&&(e.onChangeCallback=void 0,e.index=-1);const i=t.length-1;for(let o=n;o<i;++o){const r=t[o+1];t[o]=r,r instanceof Km&&(r.index=o)}return this._multipleDirtyPlanes=!0,t.length=i,this.planeRemoved.raiseEvent(e,n),!0};rr.prototype.removeAll=function(){const e=this._planes,t=e.length;for(let n=0;n<t;++n){const i=e[n];i instanceof Km&&(i.onChangeCallback=void 0,i.index=-1),this.planeRemoved.raiseEvent(i,n)}this._multipleDirtyPlanes=!0,this._planes=[]};const NNe=new ue,MNe=new ue;function d8(e,t,n){const i=e._uint8View,o=e._planes;let r=0;for(let s=t;s<n;++s){const a=o[s],c=Ri.octEncodeToCartesian4(a.normal,MNe);i[r]=c.x,i[r+1]=c.y,i[r+2]=c.z,i[r+3]=c.w;const u=ue.packFloat(a.distance,NNe);i[r+4]=u.x,i[r+5]=u.y,i[r+6]=u.z,i[r+7]=u.w,r+=8}}function h8(e,t,n){const i=e._float32View,o=e._planes;let r=0;for(let s=t;s<n;++s){const a=o[s],c=a.normal;i[r]=c.x,i[r+1]=c.y,i[r+2]=c.z,i[r+3]=a.distance,r+=4}}function zJ(e,t){const n=Gt.maximumTextureSize;return t.x=Math.min(e,n),t.y=Math.ceil(e/t.x),t}const FNe=new $;rr.prototype.update=function(e){let t=this._clippingPlanesTexture;const n=e.context,i=rr.useFloatTexture(n),o=i?this.length:this.length*2;if(l(t)){const s=t.width*t.height;(s<o||o<.25*s)&&(t.destroy(),t=void 0,this._clippingPlanesTexture=void 0)}if(this.length===0)return;if(!l(t)){const s=zJ(o,FNe);s.y*=2,i?(t=new rn({context:n,width:s.x,height:s.y,pixelFormat:yt.RGBA,pixelDatatype:ft.FLOAT,sampler:Ci.NEAREST,flipY:!1}),this._float32View=new Float32Array(s.x*s.y*4)):(t=new rn({context:n,width:s.x,height:s.y,pixelFormat:yt.RGBA,pixelDatatype:ft.UNSIGNED_BYTE,sampler:Ci.NEAREST,flipY:!1}),this._uint8View=new Uint8Array(s.x*s.y*4)),this._clippingPlanesTexture=t,this._multipleDirtyPlanes=!0}const r=this._dirtyIndex;if(!(!this._multipleDirtyPlanes&&r===-1)){if(this._multipleDirtyPlanes)i?(h8(this,0,this._planes.length),t.copyFrom({source:{width:t.width,height:t.height,arrayBufferView:this._float32View}})):(d8(this,0,this._planes.length),t.copyFrom({source:{width:t.width,height:t.height,arrayBufferView:this._uint8View}}));else{let s=0,a=0;i?(a=Math.floor(r/t.width),s=Math.floor(r-a*t.width),h8(this,r,r+1),t.copyFrom({source:{width:1,height:1,arrayBufferView:this._float32View},xOffset:s,yOffset:a})):(a=Math.floor(r*2/t.width),s=Math.floor(r*2-a*t.width),d8(this,r,r+1),t.copyFrom({source:{width:2,height:1,arrayBufferView:this._uint8View},xOffset:s,yOffset:a}))}this._multipleDirtyPlanes=!1,this._dirtyIndex=-1}};const zNe=new N,p8=new Wt(d.UNIT_X,0);rr.prototype.computeIntersectionWithBoundingVolume=function(e,t){const n=this._planes,i=n.length;let o=this.modelMatrix;l(t)&&(o=N.multiply(t,o,zNe));let r=Vn.INSIDE;!this.unionClippingRegions&&i>0&&(r=Vn.OUTSIDE);for(let s=0;s<i;++s){const a=n[s];Wt.transform(a,o,p8);const c=e.intersectPlane(p8);if(c===Vn.INTERSECTING)r=c;else if(this._testIntersection(c))return c}return r};rr.setOwner=function(e,t,n){if(e!==t[n]&&(t[n]=t[n]&&t[n].destroy(),l(e))){if(l(e._owner))throw new w("ClippingPlaneCollection should only be assigned to one object");e._owner=t,t[n]=e}};rr.useFloatTexture=function(e){return e.floatingPointTexture};rr.getTextureResolution=function(e,t,n){const i=e.texture;if(l(i))return n.x=i.width,n.y=i.height,n;const o=rr.useFloatTexture(t)?e.length:e.length*2,r=zJ(o,n);return r.y*=2,r};rr.prototype.isDestroyed=function(){return!1};rr.prototype.destroy=function(){return this._clippingPlanesTexture=this._clippingPlanesTexture&&this._clippingPlanesTexture.destroy(),Je(this)};const UNe=new $;function _z(e,t){E.typeOf.object("clippingPlaneCollection",e),E.typeOf.object("context",t);const n=e.unionClippingRegions,i=e.length,o=rr.useFloatTexture(t),r=rr.getTextureResolution(e,t,UNe),s=r.x,a=r.y;let c=o?kNe(s,a):GNe(s,a);return c+=`
|
||
`,c+=n?HNe(i):VNe(i),c}function HNe(e){return`float clip(vec4 fragCoord, sampler2D clippingPlanes, mat4 clippingPlanesMatrix)
|
||
{
|
||
vec4 position = czm_windowToEyeCoordinates(fragCoord);
|
||
vec3 clipNormal = vec3(0.0);
|
||
vec3 clipPosition = vec3(0.0);
|
||
float clipAmount;
|
||
float pixelWidth = czm_metersPerPixel(position);
|
||
bool breakAndDiscard = false;
|
||
for (int i = 0; i < ${e}; ++i)
|
||
{
|
||
vec4 clippingPlane = getClippingPlane(clippingPlanes, i, clippingPlanesMatrix);
|
||
clipNormal = clippingPlane.xyz;
|
||
clipPosition = -clippingPlane.w * clipNormal;
|
||
float amount = dot(clipNormal, (position.xyz - clipPosition)) / pixelWidth;
|
||
clipAmount = czm_branchFreeTernary(i == 0, amount, min(amount, clipAmount));
|
||
if (amount <= 0.0)
|
||
{
|
||
breakAndDiscard = true;
|
||
break;
|
||
}
|
||
}
|
||
if (breakAndDiscard) {
|
||
discard;
|
||
}
|
||
return clipAmount;
|
||
}
|
||
`}function VNe(e){return`float clip(vec4 fragCoord, sampler2D clippingPlanes, mat4 clippingPlanesMatrix)
|
||
{
|
||
bool clipped = true;
|
||
vec4 position = czm_windowToEyeCoordinates(fragCoord);
|
||
vec3 clipNormal = vec3(0.0);
|
||
vec3 clipPosition = vec3(0.0);
|
||
float clipAmount = 0.0;
|
||
float pixelWidth = czm_metersPerPixel(position);
|
||
for (int i = 0; i < ${e}; ++i)
|
||
{
|
||
vec4 clippingPlane = getClippingPlane(clippingPlanes, i, clippingPlanesMatrix);
|
||
clipNormal = clippingPlane.xyz;
|
||
clipPosition = -clippingPlane.w * clipNormal;
|
||
float amount = dot(clipNormal, (position.xyz - clipPosition)) / pixelWidth;
|
||
clipAmount = max(amount, clipAmount);
|
||
clipped = clipped && (amount <= 0.0);
|
||
}
|
||
if (clipped)
|
||
{
|
||
discard;
|
||
}
|
||
return clipAmount;
|
||
}
|
||
`}function kNe(e,t){const n=1/e,i=1/t;let o=`${n}`;o.indexOf(".")===-1&&(o+=".0");let r=`${i}`;return r.indexOf(".")===-1&&(r+=".0"),`vec4 getClippingPlane(highp sampler2D packedClippingPlanes, int clippingPlaneNumber, mat4 transform)
|
||
{
|
||
int pixY = clippingPlaneNumber / ${e};
|
||
int pixX = clippingPlaneNumber - (pixY * ${e});
|
||
float u = (float(pixX) + 0.5) * ${o};
|
||
float v = (float(pixY) + 0.5) * ${r};
|
||
vec4 plane = texture2D(packedClippingPlanes, vec2(u, v));
|
||
return czm_transformPlane(plane, transform);
|
||
}
|
||
`}function GNe(e,t){const n=1/e,i=1/t;let o=`${n}`;o.indexOf(".")===-1&&(o+=".0");let r=`${i}`;return r.indexOf(".")===-1&&(r+=".0"),`vec4 getClippingPlane(highp sampler2D packedClippingPlanes, int clippingPlaneNumber, mat4 transform)
|
||
{
|
||
int clippingPlaneStartIndex = clippingPlaneNumber * 2;
|
||
int pixY = clippingPlaneStartIndex / ${e};
|
||
int pixX = clippingPlaneStartIndex - (pixY * ${e});
|
||
float u = (float(pixX) + 0.5) * ${o};
|
||
float v = (float(pixY) + 0.5) * ${r};
|
||
vec4 oct32 = texture2D(packedClippingPlanes, vec2(u, v)) * 255.0;
|
||
vec2 oct = vec2(oct32.x * 256.0 + oct32.y, oct32.z * 256.0 + oct32.w);
|
||
vec4 plane;
|
||
plane.xyz = czm_octDecode(oct, 65535.0);
|
||
plane.w = czm_unpackFloat(texture2D(packedClippingPlanes, vec2(u + ${o}, v)));
|
||
return czm_transformPlane(plane, transform);
|
||
}
|
||
`}function WNe(e,t,n,i,o){this.numberOfDayTextures=e,this.flags=t,this.material=n,this.shaderProgram=i,this.clippingShaderState=o}function gz(){this.baseVertexShaderSource=void 0,this.baseFragmentShaderSource=void 0,this._shadersByTexturesFlags=[],this.material=void 0}function qNe(e){const t="vec4 getPosition(vec3 position, float height, vec2 textureCoordinates) { return getPosition3DMode(position, height, textureCoordinates); }",n="vec4 getPosition(vec3 position, float height, vec2 textureCoordinates) { return getPositionColumbusViewMode(position, height, textureCoordinates); }",i="vec4 getPosition(vec3 position, float height, vec2 textureCoordinates) { return getPositionMorphingMode(position, height, textureCoordinates); }";let o;switch(e){case me.SCENE3D:o=t;break;case me.SCENE2D:case me.COLUMBUS_VIEW:o=n;break;case me.MORPHING:o=i;break}return o}function jNe(e){return e?"float get2DYPositionFraction(vec2 textureCoordinates) { return get2DMercatorYPositionFraction(textureCoordinates); }":"float get2DYPositionFraction(vec2 textureCoordinates) { return get2DGeographicYPositionFraction(textureCoordinates); }"}gz.prototype.getShaderProgram=function(e){const t=e.frameState,n=e.surfaceTile,i=e.numberOfDayTextures,o=e.applyBrightness,r=e.applyContrast,s=e.applyHue,a=e.applySaturation,c=e.applyGamma,u=e.applyAlpha,f=e.applyDayNightAlpha,h=e.applySplit,_=e.showReflectiveOcean,g=e.showOceanWaves,p=e.enableLighting,y=e.dynamicAtmosphereLighting,T=e.dynamicAtmosphereLightingFromSun,b=e.showGroundAtmosphere,x=e.perFragmentGroundAtmosphere,v=e.hasVertexNormals,D=e.useWebMercatorProjection,L=e.enableFog,B=e.enableClippingPlanes,V=e.clippingPlanes,M=e.clippedByBoundaries,H=e.hasImageryLayerCutout,G=e.colorCorrect,I=e.highlightFillTile,O=e.colorToAlpha,m=e.hasGeodeticSurfaceNormals,P=e.hasExaggeration,R=e.showUndergroundColor,U=e.translucent;let W=0,q="";const j=n.renderedMesh.encoding;j.quantization===rl.BITS12&&(W=1,q="QUANTIZATION_BITS12");let K=0,se="";M&&(K=1,se="TILE_LIMIT_RECTANGLE");let Q=0,Z="";H&&(Q=1,Z="APPLY_IMAGERY_CUTOUT");const J=t.mode,de=J|o<<2|r<<3|s<<4|a<<5|c<<6|u<<7|_<<8|g<<9|p<<10|y<<11|T<<12|b<<13|x<<14|v<<15|D<<16|L<<17|W<<18|h<<19|B<<20|K<<21|Q<<22|G<<23|I<<24|O<<25|m<<26|P<<27|R<<28|U<<29|f<<30;let _e=0;l(V)&&V.length>0&&(_e=B?V.clippingPlanesState:0);let le=n.surfaceShader;if(l(le)&&le.numberOfDayTextures===i&&le.flags===de&&le.material===this.material&&le.clippingShaderState===_e)return le.shaderProgram;let Te=this._shadersByTexturesFlags[i];if(l(Te)||(Te=this._shadersByTexturesFlags[i]=[]),le=Te[de],!l(le)||le.material!==this.material||le.clippingShaderState!==_e){const pe=this.baseVertexShaderSource.clone(),ne=this.baseFragmentShaderSource.clone();_e!==0&&ne.sources.unshift(_z(V,t.context)),pe.defines.push(q),ne.defines.push(`TEXTURE_UNITS ${i}`,se,Z),o&&ne.defines.push("APPLY_BRIGHTNESS"),r&&ne.defines.push("APPLY_CONTRAST"),s&&ne.defines.push("APPLY_HUE"),a&&ne.defines.push("APPLY_SATURATION"),c&&ne.defines.push("APPLY_GAMMA"),u&&ne.defines.push("APPLY_ALPHA"),f&&ne.defines.push("APPLY_DAY_NIGHT_ALPHA"),_&&(ne.defines.push("SHOW_REFLECTIVE_OCEAN"),pe.defines.push("SHOW_REFLECTIVE_OCEAN")),g&&ne.defines.push("SHOW_OCEAN_WAVES"),O&&ne.defines.push("APPLY_COLOR_TO_ALPHA"),R&&(pe.defines.push("UNDERGROUND_COLOR"),ne.defines.push("UNDERGROUND_COLOR")),U&&(pe.defines.push("TRANSLUCENT"),ne.defines.push("TRANSLUCENT")),p&&(v?(pe.defines.push("ENABLE_VERTEX_LIGHTING"),ne.defines.push("ENABLE_VERTEX_LIGHTING")):(pe.defines.push("ENABLE_DAYNIGHT_SHADING"),ne.defines.push("ENABLE_DAYNIGHT_SHADING"))),y&&(pe.defines.push("DYNAMIC_ATMOSPHERE_LIGHTING"),ne.defines.push("DYNAMIC_ATMOSPHERE_LIGHTING"),T&&(pe.defines.push("DYNAMIC_ATMOSPHERE_LIGHTING_FROM_SUN"),ne.defines.push("DYNAMIC_ATMOSPHERE_LIGHTING_FROM_SUN"))),b&&(pe.defines.push("GROUND_ATMOSPHERE"),ne.defines.push("GROUND_ATMOSPHERE"),x&&(pe.defines.push("PER_FRAGMENT_GROUND_ATMOSPHERE"),ne.defines.push("PER_FRAGMENT_GROUND_ATMOSPHERE"))),pe.defines.push("INCLUDE_WEB_MERCATOR_Y"),ne.defines.push("INCLUDE_WEB_MERCATOR_Y"),L&&(pe.defines.push("FOG"),ne.defines.push("FOG")),h&&ne.defines.push("APPLY_SPLIT"),B&&ne.defines.push("ENABLE_CLIPPING_PLANES"),G&&ne.defines.push("COLOR_CORRECT"),I&&ne.defines.push("HIGHLIGHT_FILL_TILE"),m&&pe.defines.push("GEODETIC_SURFACE_NORMALS"),P&&pe.defines.push("EXAGGERATION");let ae=` vec4 computeDayColor(vec4 initialColor, vec3 textureCoordinates, float nightBlend)
|
||
{
|
||
vec4 color = initialColor;
|
||
`;H&&(ae+=` vec4 cutoutAndColorResult;
|
||
bool texelUnclipped;
|
||
`);for(let Ce=0;Ce<i;++Ce)H?ae+=` cutoutAndColorResult = u_dayTextureCutoutRectangles[${Ce}];
|
||
texelUnclipped = v_textureCoordinates.x < cutoutAndColorResult.x || cutoutAndColorResult.z < v_textureCoordinates.x || v_textureCoordinates.y < cutoutAndColorResult.y || cutoutAndColorResult.w < v_textureCoordinates.y;
|
||
cutoutAndColorResult = sampleAndBlend(
|
||
`:ae+=` color = sampleAndBlend(
|
||
`,ae+=` color,
|
||
u_dayTextures[${Ce}],
|
||
u_dayTextureUseWebMercatorT[${Ce}] ? textureCoordinates.xz : textureCoordinates.xy,
|
||
u_dayTextureTexCoordsRectangle[${Ce}],
|
||
u_dayTextureTranslationAndScale[${Ce}],
|
||
${u?`u_dayTextureAlpha[${Ce}]`:"1.0"},
|
||
${f?`u_dayTextureNightAlpha[${Ce}]`:"1.0"},
|
||
${f?`u_dayTextureDayAlpha[${Ce}]`:"1.0"},
|
||
${o?`u_dayTextureBrightness[${Ce}]`:"0.0"},
|
||
${r?`u_dayTextureContrast[${Ce}]`:"0.0"},
|
||
${s?`u_dayTextureHue[${Ce}]`:"0.0"},
|
||
${a?`u_dayTextureSaturation[${Ce}]`:"0.0"},
|
||
${c?`u_dayTextureOneOverGamma[${Ce}]`:"0.0"},
|
||
${h?`u_dayTextureSplit[${Ce}]`:"0.0"},
|
||
${O?`u_colorsToAlpha[${Ce}]`:"vec4(0.0)"},
|
||
nightBlend );
|
||
`,H&&(ae+=` color = czm_branchFreeTernary(texelUnclipped, cutoutAndColorResult, color);
|
||
`);ae+=` return color;
|
||
}`,ne.sources.push(ae),pe.sources.push(qNe(J)),pe.sources.push(jNe(D));const ye=Hn.fromCache({context:t.context,vertexShaderSource:pe,fragmentShaderSource:ne,attributeLocations:j.getAttributeLocations()});le=Te[de]=new WNe(i,de,this.material,ye,_e)}return n.surfaceShader=le,le.shaderProgram};gz.prototype.destroy=function(){let e,t;const n=this._shadersByTexturesFlags;for(const i in n)if(n.hasOwnProperty(i)){const o=n[i];if(!l(o))continue;for(e in o)o.hasOwnProperty(e)&&(t=o[e],l(t)&&t.shaderProgram.destroy())}return Je(this)};function To(e){e=A(e,A.EMPTY_OBJECT),this.position=e.position,this.normal=e.normal,this.st=e.st,this.bitangent=e.bitangent,this.tangent=e.tangent,this.color=e.color}const YNe={NONE:0,TOP:1,ALL:2},Fn=Object.freeze(YNe),$Ne=new d;function pl(e){e=A(e,A.EMPTY_OBJECT);const t=e.minimum,n=e.maximum;if(E.typeOf.object("min",t),E.typeOf.object("max",n),l(e.offsetAttribute)&&e.offsetAttribute===Fn.TOP)throw new w("GeometryOffsetAttribute.TOP is not a supported options.offsetAttribute for this geometry.");this._min=d.clone(t),this._max=d.clone(n),this._offsetAttribute=e.offsetAttribute,this._workerName="createBoxOutlineGeometry"}pl.fromDimensions=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.dimensions;E.typeOf.object("dimensions",t),E.typeOf.number.greaterThanOrEquals("dimensions.x",t.x,0),E.typeOf.number.greaterThanOrEquals("dimensions.y",t.y,0),E.typeOf.number.greaterThanOrEquals("dimensions.z",t.z,0);const n=d.multiplyByScalar(t,.5,new d);return new pl({minimum:d.negate(n,new d),maximum:n,offsetAttribute:e.offsetAttribute})};pl.fromAxisAlignedBoundingBox=function(e){return E.typeOf.object("boundindBox",e),new pl({minimum:e.minimum,maximum:e.maximum})};pl.packedLength=2*d.packedLength+1;pl.pack=function(e,t,n){return E.typeOf.object("value",e),E.defined("array",t),n=A(n,0),d.pack(e._min,t,n),d.pack(e._max,t,n+d.packedLength),t[n+d.packedLength*2]=A(e._offsetAttribute,-1),t};const UJ=new d,HJ=new d,m8={minimum:UJ,maximum:HJ,offsetAttribute:void 0};pl.unpack=function(e,t,n){E.defined("array",e),t=A(t,0);const i=d.unpack(e,t,UJ),o=d.unpack(e,t+d.packedLength,HJ),r=e[t+d.packedLength*2];return l(n)?(n._min=d.clone(i,n._min),n._max=d.clone(o,n._max),n._offsetAttribute=r===-1?void 0:r,n):(m8.offsetAttribute=r===-1?void 0:r,new pl(m8))};pl.createGeometry=function(e){const t=e._min,n=e._max;if(d.equals(t,n))return;const i=new To,o=new Uint16Array(12*2),r=new Float64Array(8*3);r[0]=t.x,r[1]=t.y,r[2]=t.z,r[3]=n.x,r[4]=t.y,r[5]=t.z,r[6]=n.x,r[7]=n.y,r[8]=t.z,r[9]=t.x,r[10]=n.y,r[11]=t.z,r[12]=t.x,r[13]=t.y,r[14]=n.z,r[15]=n.x,r[16]=t.y,r[17]=n.z,r[18]=n.x,r[19]=n.y,r[20]=n.z,r[21]=t.x,r[22]=n.y,r[23]=n.z,i.position=new Xe({componentDatatype:oe.DOUBLE,componentsPerAttribute:3,values:r}),o[0]=4,o[1]=5,o[2]=5,o[3]=6,o[4]=6,o[5]=7,o[6]=7,o[7]=4,o[8]=0,o[9]=1,o[10]=1,o[11]=2,o[12]=2,o[13]=3,o[14]=3,o[15]=0,o[16]=0,o[17]=4,o[18]=1,o[19]=5,o[20]=2,o[21]=6,o[22]=3,o[23]=7;const s=d.subtract(n,t,$Ne),a=d.magnitude(s)*.5;if(l(e._offsetAttribute)){const c=r.length,u=e._offsetAttribute===Fn.NONE?0:1,f=new Uint8Array(c/3).fill(u);i.applyOffset=new Xe({componentDatatype:oe.UNSIGNED_BYTE,componentsPerAttribute:1,values:f})}return new $t({attributes:i,indices:o,primitiveType:dt.LINES,boundingSphere:new Ae(d.ZERO,a),offsetAttribute:e._offsetAttribute})};function Bn(e,t,n,i){e=A(e,1),t=A(t,1),n=A(n,1),i=A(i,1),this.value=new Uint8Array([k.floatToByte(e),k.floatToByte(t),k.floatToByte(n),k.floatToByte(i)])}Object.defineProperties(Bn.prototype,{componentDatatype:{get:function(){return oe.UNSIGNED_BYTE}},componentsPerAttribute:{get:function(){return 4}},normalize:{get:function(){return!0}}});Bn.fromColor=function(e){if(!l(e))throw new w("color is required.");return new Bn(e.red,e.green,e.blue,e.alpha)};Bn.toValue=function(e,t){if(!l(e))throw new w("color is required.");return l(t)?e.toBytes(t):new Uint8Array(e.toBytes())};Bn.equals=function(e,t){return e===t||l(e)&&l(t)&&e.value[0]===t.value[0]&&e.value[1]===t.value[1]&&e.value[2]===t.value[2]&&e.value[3]===t.value[3]};function xn(e){if(e=A(e,A.EMPTY_OBJECT),!l(e.geometry))throw new w("options.geometry is required.");this.geometry=e.geometry,this.modelMatrix=N.clone(A(e.modelMatrix,N.IDENTITY)),this.id=e.id,this.pickPrimitive=e.pickPrimitive,this.attributes=A(e.attributes,{}),this.westHemisphereGeometry=void 0,this.eastHemisphereGeometry=void 0}const _8=new d,g8=new d,y8=new d;function XNe(e,t,n,i,o){E.defined("point",e),E.defined("p0",t),E.defined("p1",n),E.defined("p2",i),l(o)||(o=new d);let r,s,a,c,u,f,h,_;if(l(t.z)){if(d.equalsEpsilon(e,t,F.EPSILON14))return d.clone(d.UNIT_X,o);if(d.equalsEpsilon(e,n,F.EPSILON14))return d.clone(d.UNIT_Y,o);if(d.equalsEpsilon(e,i,F.EPSILON14))return d.clone(d.UNIT_Z,o);r=d.subtract(n,t,_8),s=d.subtract(i,t,g8),a=d.subtract(e,t,y8),c=d.dot(r,r),u=d.dot(r,s),f=d.dot(r,a),h=d.dot(s,s),_=d.dot(s,a)}else{if($.equalsEpsilon(e,t,F.EPSILON14))return d.clone(d.UNIT_X,o);if($.equalsEpsilon(e,n,F.EPSILON14))return d.clone(d.UNIT_Y,o);if($.equalsEpsilon(e,i,F.EPSILON14))return d.clone(d.UNIT_Z,o);r=$.subtract(n,t,_8),s=$.subtract(i,t,g8),a=$.subtract(e,t,y8),c=$.dot(r,r),u=$.dot(r,s),f=$.dot(r,a),h=$.dot(s,s),_=$.dot(s,a)}o.y=h*f-u*_,o.z=c*_-u*f;const g=c*h-u*u;if(g!==0)return o.y/=g,o.z/=g,o.x=1-o.y-o.z,o}const yz={};yz.calculateACMR=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.indices;let n=e.maximumIndex;const i=A(e.cacheSize,24);if(!l(t))throw new w("indices is required.");const o=t.length;if(o<3||o%3!==0)throw new w("indices length must be a multiple of three.");if(n<=0)throw new w("maximumIndex must be greater than zero.");if(i<3)throw new w("cacheSize must be greater than two.");if(!l(n)){n=0;let a=0,c=t[a];for(;a<o;)c>n&&(n=c),++a,c=t[a]}const r=[];for(let a=0;a<n+1;a++)r[a]=0;let s=i+1;for(let a=0;a<o;++a)s-r[t[a]]>i&&(r[t[a]]=s,++s);return(s-i+1)/(o/3)};yz.tipsify=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.indices,n=e.maximumIndex,i=A(e.cacheSize,24);let o;function r(I,O,m,P){for(;O.length>=1;){const R=O[O.length-1];if(O.splice(O.length-1,1),I[R].numLiveTriangles>0)return R}for(;o<P;){if(I[o].numLiveTriangles>0)return++o,o-1;++o}return-1}function s(I,O,m,P,R,U,W){let q=-1,Y,j=-1,ee=0;for(;ee<m.length;){const K=m[ee];P[K].numLiveTriangles&&(Y=0,R-P[K].timeStamp+2*P[K].numLiveTriangles<=O&&(Y=R-P[K].timeStamp),(Y>j||j===-1)&&(j=Y,q=K)),++ee}return q===-1?r(P,U,I,W):q}if(!l(t))throw new w("indices is required.");const a=t.length;if(a<3||a%3!==0)throw new w("indices length must be a multiple of three.");if(n<=0)throw new w("maximumIndex must be greater than zero.");if(i<3)throw new w("cacheSize must be greater than two.");let c=0,u=0,f=t[u];const h=a;if(l(n))c=n+1;else{for(;u<h;)f>c&&(c=f),++u,f=t[u];if(c===-1)return 0;++c}const _=[];let g;for(g=0;g<c;g++)_[g]={numLiveTriangles:0,timeStamp:0,vertexTriangles:[]};u=0;let p=0;for(;u<h;)_[t[u]].vertexTriangles.push(p),++_[t[u]].numLiveTriangles,_[t[u+1]].vertexTriangles.push(p),++_[t[u+1]].numLiveTriangles,_[t[u+2]].vertexTriangles.push(p),++_[t[u+2]].numLiveTriangles,++p,u+=3;let y=0,T=i+1;o=1;let b=[];const x=[];let v,D,L=0;const B=[],V=a/3,M=[];for(g=0;g<V;g++)M[g]=!1;let H,G;for(;y!==-1;){b=[],D=_[y],G=D.vertexTriangles.length;for(let I=0;I<G;++I)if(p=D.vertexTriangles[I],!M[p]){M[p]=!0,u=p+p+p;for(let O=0;O<3;++O)H=t[u],b.push(H),x.push(H),B[L]=H,++L,v=_[H],--v.numLiveTriangles,T-v.timeStamp>i&&(v.timeStamp=T,++T),++u}y=s(t,i,b,_,T,x,c)}return B};const KNe=yz,Tc={};function zI(e,t,n,i,o){e[t++]=n,e[t++]=i,e[t++]=i,e[t++]=o,e[t++]=o,e[t]=n}function JNe(e){const t=e.length,n=t/3*6,i=At.createTypedArray(t,n);let o=0;for(let r=0;r<t;r+=3,o+=6)zI(i,o,e[r],e[r+1],e[r+2]);return i}function QNe(e){const t=e.length;if(t>=3){const n=(t-2)*6,i=At.createTypedArray(t,n);zI(i,0,e[0],e[1],e[2]);let o=6;for(let r=3;r<t;++r,o+=6)zI(i,o,e[r-1],e[r],e[r-2]);return i}return new Uint16Array}function ZNe(e){if(e.length>0){const t=e.length-1,n=(t-1)*6,i=At.createTypedArray(t,n),o=e[0];let r=0;for(let s=1;s<t;++s,r+=6)zI(i,r,o,e[s],e[s+1]);return i}return new Uint16Array}Tc.toWireframe=function(e){if(!l(e))throw new w("geometry is required.");const t=e.indices;if(l(t)){switch(e.primitiveType){case dt.TRIANGLES:e.indices=JNe(t);break;case dt.TRIANGLE_STRIP:e.indices=QNe(t);break;case dt.TRIANGLE_FAN:e.indices=ZNe(t);break;default:throw new w("geometry.primitiveType must be TRIANGLES, TRIANGLE_STRIP, or TRIANGLE_FAN.")}e.primitiveType=dt.LINES}return e};Tc.createLineSegmentsForVectors=function(e,t,n){if(t=A(t,"normal"),!l(e))throw new w("geometry is required.");if(!l(e.attributes.position))throw new w("geometry.attributes.position is required.");if(!l(e.attributes[t]))throw new w(`geometry.attributes must have an attribute with the same name as the attributeName parameter, ${t}.`);n=A(n,1e4);const i=e.attributes.position.values,o=e.attributes[t].values,r=i.length,s=new Float64Array(2*r);let a=0;for(let f=0;f<r;f+=3)s[a++]=i[f],s[a++]=i[f+1],s[a++]=i[f+2],s[a++]=i[f]+o[f]*n,s[a++]=i[f+1]+o[f+1]*n,s[a++]=i[f+2]+o[f+2]*n;let c;const u=e.boundingSphere;return l(u)&&(c=new Ae(u.center,u.radius+n)),new $t({attributes:{position:new Xe({componentDatatype:oe.DOUBLE,componentsPerAttribute:3,values:s})},primitiveType:dt.LINES,boundingSphere:c})};Tc.createAttributeLocations=function(e){if(!l(e))throw new w("geometry is required.");const t=["position","positionHigh","positionLow","position3DHigh","position3DLow","position2DHigh","position2DLow","pickColor","normal","st","tangent","bitangent","extrudeDirection","compressedAttributes"],n=e.attributes,i={};let o=0,r;const s=t.length;for(r=0;r<s;++r){const a=t[r];l(n[a])&&(i[a]=o++)}for(const a in n)n.hasOwnProperty(a)&&!l(i[a])&&(i[a]=o++);return i};Tc.reorderForPreVertexCache=function(e){if(!l(e))throw new w("geometry is required.");const t=$t.computeNumberOfVertices(e),n=e.indices;if(l(n)){const i=new Int32Array(t);for(let _=0;_<t;_++)i[_]=-1;const o=n,r=o.length,s=At.createTypedArray(t,r);let a=0,c=0,u=0,f;for(;a<r;)f=i[o[a]],f!==-1?s[c]=f:(f=o[a],i[f]=u,s[c]=u,++u),++a,++c;e.indices=s;const h=e.attributes;for(const _ in h)if(h.hasOwnProperty(_)&&l(h[_])&&l(h[_].values)){const g=h[_],p=g.values;let y=0;const T=g.componentsPerAttribute,b=oe.createTypedArray(g.componentDatatype,u*T);for(;y<t;){const x=i[y];if(x!==-1)for(let v=0;v<T;v++)b[T*x+v]=p[T*y+v];++y}g.values=b}}return e};Tc.reorderForPostVertexCache=function(e,t){if(!l(e))throw new w("geometry is required.");const n=e.indices;if(e.primitiveType===dt.TRIANGLES&&l(n)){const i=n.length;let o=0;for(let r=0;r<i;r++)n[r]>o&&(o=n[r]);e.indices=KNe.tipsify({indices:n,maximumIndex:o,cacheSize:t})}return e};function A8(e){const t={};for(const n in e)if(e.hasOwnProperty(n)&&l(e[n])&&l(e[n].values)){const i=e[n];t[n]=new Xe({componentDatatype:i.componentDatatype,componentsPerAttribute:i.componentsPerAttribute,normalize:i.normalize,values:[]})}return t}function eMe(e,t,n){for(const i in t)if(t.hasOwnProperty(i)&&l(t[i])&&l(t[i].values)){const o=t[i];for(let r=0;r<o.componentsPerAttribute;++r)e[i].values.push(o.values[n*o.componentsPerAttribute+r])}}Tc.fitToUnsignedShortIndices=function(e){if(!l(e))throw new w("geometry is required.");if(l(e.indices)&&e.primitiveType!==dt.TRIANGLES&&e.primitiveType!==dt.LINES&&e.primitiveType!==dt.POINTS)throw new w("geometry.primitiveType must equal to PrimitiveType.TRIANGLES, PrimitiveType.LINES, or PrimitiveType.POINTS.");const t=[],n=$t.computeNumberOfVertices(e);if(l(e.indices)&&n>=F.SIXTY_FOUR_KILOBYTES){let i=[],o=[],r=0,s=A8(e.attributes);const a=e.indices,c=a.length;let u;e.primitiveType===dt.TRIANGLES?u=3:e.primitiveType===dt.LINES?u=2:e.primitiveType===dt.POINTS&&(u=1);for(let f=0;f<c;f+=u){for(let h=0;h<u;++h){const _=a[f+h];let g=i[_];l(g)||(g=r++,i[_]=g,eMe(s,e.attributes,_)),o.push(g)}r+u>=F.SIXTY_FOUR_KILOBYTES&&(t.push(new $t({attributes:s,indices:o,primitiveType:e.primitiveType,boundingSphere:e.boundingSphere,boundingSphereCV:e.boundingSphereCV})),i=[],o=[],r=0,s=A8(e.attributes))}o.length!==0&&t.push(new $t({attributes:s,indices:o,primitiveType:e.primitiveType,boundingSphere:e.boundingSphere,boundingSphereCV:e.boundingSphereCV}))}else t.push(e);return t};const T8=new d,tMe=new ve;Tc.projectTo2D=function(e,t,n,i,o){if(!l(e))throw new w("geometry is required.");if(!l(t))throw new w("attributeName is required.");if(!l(n))throw new w("attributeName3D is required.");if(!l(i))throw new w("attributeName2D is required.");if(!l(e.attributes[t]))throw new w(`geometry must have attribute matching the attributeName argument: ${t}.`);if(e.attributes[t].componentDatatype!==oe.DOUBLE)throw new w("The attribute componentDatatype must be ComponentDatatype.DOUBLE.");const r=e.attributes[t];o=l(o)?o:new Or;const s=o.ellipsoid,a=r.values,c=new Float64Array(a.length);let u=0;for(let f=0;f<a.length;f+=3){const h=d.fromArray(a,f,T8),_=s.cartesianToCartographic(h,tMe);if(!l(_))throw new w(`Could not project point (${h.x}, ${h.y}, ${h.z}) to 2D.`);const g=o.project(_,T8);c[u++]=g.x,c[u++]=g.y,c[u++]=g.z}return e.attributes[n]=r,e.attributes[i]=new Xe({componentDatatype:oe.DOUBLE,componentsPerAttribute:3,values:c}),delete e.attributes[t],e};const gB={high:0,low:0};Tc.encodeAttribute=function(e,t,n,i){if(!l(e))throw new w("geometry is required.");if(!l(t))throw new w("attributeName is required.");if(!l(n))throw new w("attributeHighName is required.");if(!l(i))throw new w("attributeLowName is required.");if(!l(e.attributes[t]))throw new w(`geometry must have attribute matching the attributeName argument: ${t}.`);if(e.attributes[t].componentDatatype!==oe.DOUBLE)throw new w("The attribute componentDatatype must be ComponentDatatype.DOUBLE.");const o=e.attributes[t],r=o.values,s=r.length,a=new Float32Array(s),c=new Float32Array(s);for(let f=0;f<s;++f)Zn.encode(r[f],gB),a[f]=gB.high,c[f]=gB.low;const u=o.componentsPerAttribute;return e.attributes[n]=new Xe({componentDatatype:oe.FLOAT,componentsPerAttribute:u,values:a}),e.attributes[i]=new Xe({componentDatatype:oe.FLOAT,componentsPerAttribute:u,values:c}),delete e.attributes[t],e};let Yu=new d;function yB(e,t){if(l(t)){const n=t.values,i=n.length;for(let o=0;o<i;o+=3)d.unpack(n,o,Yu),N.multiplyByPoint(e,Yu,Yu),d.pack(Yu,n,o)}}function AB(e,t){if(l(t)){const n=t.values,i=n.length;for(let o=0;o<i;o+=3)d.unpack(n,o,Yu),te.multiplyByVector(e,Yu,Yu),Yu=d.normalize(Yu,Yu),d.pack(Yu,n,o)}}const FS=new N,zS=new te;Tc.transformToWorldCoordinates=function(e){if(!l(e))throw new w("instance is required.");const t=e.modelMatrix;if(N.equals(t,N.IDENTITY))return e;const n=e.geometry.attributes;yB(t,n.position),yB(t,n.prevPosition),yB(t,n.nextPosition),(l(n.normal)||l(n.tangent)||l(n.bitangent))&&(N.inverse(t,FS),N.transpose(FS,FS),N.getMatrix3(FS,zS),AB(zS,n.normal),AB(zS,n.tangent),AB(zS,n.bitangent));const i=e.geometry.boundingSphere;return l(i)&&(e.geometry.boundingSphere=Ae.transform(i,t,i)),e.modelMatrix=N.clone(N.IDENTITY),e};function nMe(e,t){const n=e.length,i={},o=e[0][t].attributes;let r;for(r in o)if(o.hasOwnProperty(r)&&l(o[r])&&l(o[r].values)){const s=o[r];let a=s.values.length,c=!0;for(let u=1;u<n;++u){const f=e[u][t].attributes[r];if(!l(f)||s.componentDatatype!==f.componentDatatype||s.componentsPerAttribute!==f.componentsPerAttribute||s.normalize!==f.normalize){c=!1;break}a+=f.values.length}c&&(i[r]=new Xe({componentDatatype:s.componentDatatype,componentsPerAttribute:s.componentsPerAttribute,normalize:s.normalize,values:oe.createTypedArray(s.componentDatatype,a)}))}return i}const iMe=new d;function TB(e,t){const n=e.length;let i,o,r,s;const a=e[0].modelMatrix,c=l(e[0][t].indices),u=e[0][t].primitiveType;for(o=1;o<n;++o){if(!N.equals(e[o].modelMatrix,a))throw new w("All instances must have the same modelMatrix.");if(l(e[o][t].indices)!==c)throw new w("All instance geometries must have an indices or not have one.");if(e[o][t].primitiveType!==u)throw new w("All instance geometries must have the same primitiveType.")}const f=nMe(e,t);let h,_,g;for(i in f)if(f.hasOwnProperty(i))for(h=f[i].values,s=0,o=0;o<n;++o)for(_=e[o][t].attributes[i].values,g=_.length,r=0;r<g;++r)h[s++]=_[r];let p;if(c){let x=0;for(o=0;o<n;++o)x+=e[o][t].indices.length;const v=$t.computeNumberOfVertices(new $t({attributes:f,primitiveType:dt.POINTS})),D=At.createTypedArray(v,x);let L=0,B=0;for(o=0;o<n;++o){const V=e[o][t].indices,M=V.length;for(s=0;s<M;++s)D[L++]=B+V[s];B+=$t.computeNumberOfVertices(e[o][t])}p=D}let y=new d,T=0,b;for(o=0;o<n;++o){if(b=e[o][t].boundingSphere,!l(b)){y=void 0;break}d.add(b.center,y,y)}if(l(y))for(d.divideByScalar(y,n,y),o=0;o<n;++o){b=e[o][t].boundingSphere;const x=d.magnitude(d.subtract(b.center,y,iMe))+b.radius;x>T&&(T=x)}return new $t({attributes:f,indices:p,primitiveType:u,boundingSphere:l(y)?new Ae(y,T):void 0})}Tc.combineInstances=function(e){if(!l(e)||e.length<1)throw new w("instances is required and must have length greater than zero.");const t=[],n=[],i=e.length;for(let r=0;r<i;++r){const s=e[r];l(s.geometry)?t.push(s):l(s.westHemisphereGeometry)&&l(s.eastHemisphereGeometry)&&n.push(s)}const o=[];return t.length>0&&o.push(TB(t,"geometry")),n.length>0&&(o.push(TB(n,"westHemisphereGeometry")),o.push(TB(n,"eastHemisphereGeometry"))),o};const zl=new d,EC=new d,T0=new d,C0=new d;Tc.computeNormal=function(e){if(!l(e))throw new w("geometry is required.");if(!l(e.attributes.position)||!l(e.attributes.position.values))throw new w("geometry.attributes.position.values is required.");if(!l(e.indices))throw new w("geometry.indices is required.");if(e.indices.length<2||e.indices.length%3!==0)throw new w("geometry.indices length must be greater than 0 and be a multiple of 3.");if(e.primitiveType!==dt.TRIANGLES)throw new w("geometry.primitiveType must be PrimitiveType.TRIANGLES.");const t=e.indices,n=e.attributes,i=n.position.values,o=n.position.values.length/3,r=t.length,s=new Array(o),a=new Array(r/3),c=new Array(r);let u;for(u=0;u<o;u++)s[u]={indexOffset:0,count:0,currentCount:0};let f=0;for(u=0;u<r;u+=3){const p=t[u],y=t[u+1],T=t[u+2],b=p*3,x=y*3,v=T*3;EC.x=i[b],EC.y=i[b+1],EC.z=i[b+2],T0.x=i[x],T0.y=i[x+1],T0.z=i[x+2],C0.x=i[v],C0.y=i[v+1],C0.z=i[v+2],s[p].count++,s[y].count++,s[T].count++,d.subtract(T0,EC,T0),d.subtract(C0,EC,C0),a[f]=d.cross(T0,C0,new d),f++}let h=0;for(u=0;u<o;u++)s[u].indexOffset+=h,h+=s[u].count;f=0;let _;for(u=0;u<r;u+=3){_=s[t[u]];let p=_.indexOffset+_.currentCount;c[p]=f,_.currentCount++,_=s[t[u+1]],p=_.indexOffset+_.currentCount,c[p]=f,_.currentCount++,_=s[t[u+2]],p=_.indexOffset+_.currentCount,c[p]=f,_.currentCount++,f++}const g=new Float32Array(o*3);for(u=0;u<o;u++){const p=u*3;if(_=s[u],d.clone(d.ZERO,zl),_.count>0){for(f=0;f<_.count;f++)d.add(zl,a[c[_.indexOffset+f]],zl);d.equalsEpsilon(d.ZERO,zl,F.EPSILON10)&&d.clone(a[c[_.indexOffset]],zl)}d.equalsEpsilon(d.ZERO,zl,F.EPSILON10)&&(zl.z=1),d.normalize(zl,zl),g[p]=zl.x,g[p+1]=zl.y,g[p+2]=zl.z}return e.attributes.normal=new Xe({componentDatatype:oe.FLOAT,componentsPerAttribute:3,values:g}),e};const oMe=new d,C8=new d,rMe=new d;Tc.computeTangentAndBitangent=function(e){if(!l(e))throw new w("geometry is required.");const t=e.attributes,n=e.indices;if(!l(t.position)||!l(t.position.values))throw new w("geometry.attributes.position.values is required.");if(!l(t.normal)||!l(t.normal.values))throw new w("geometry.attributes.normal.values is required.");if(!l(t.st)||!l(t.st.values))throw new w("geometry.attributes.st.values is required.");if(!l(n))throw new w("geometry.indices is required.");if(n.length<2||n.length%3!==0)throw new w("geometry.indices length must be greater than 0 and be a multiple of 3.");if(e.primitiveType!==dt.TRIANGLES)throw new w("geometry.primitiveType must be PrimitiveType.TRIANGLES.");const i=e.attributes.position.values,o=e.attributes.normal.values,r=e.attributes.st.values,s=e.attributes.position.values.length/3,a=n.length,c=new Array(s*3);let u;for(u=0;u<c.length;u++)c[u]=0;let f,h,_;for(u=0;u<a;u+=3){const y=n[u],T=n[u+1],b=n[u+2];f=y*3,h=T*3,_=b*3;const x=y*2,v=T*2,D=b*2,L=i[f],B=i[f+1],V=i[f+2],M=r[x],H=r[x+1],G=r[v+1]-H,I=r[D+1]-H,O=1/((r[v]-M)*I-(r[D]-M)*G),m=(I*(i[h]-L)-G*(i[_]-L))*O,P=(I*(i[h+1]-B)-G*(i[_+1]-B))*O,R=(I*(i[h+2]-V)-G*(i[_+2]-V))*O;c[f]+=m,c[f+1]+=P,c[f+2]+=R,c[h]+=m,c[h+1]+=P,c[h+2]+=R,c[_]+=m,c[_+1]+=P,c[_+2]+=R}const g=new Float32Array(s*3),p=new Float32Array(s*3);for(u=0;u<s;u++){f=u*3,h=f+1,_=f+2;const y=d.fromArray(o,f,oMe),T=d.fromArray(c,f,rMe),b=d.dot(y,T);d.multiplyByScalar(y,b,C8),d.normalize(d.subtract(T,C8,T),T),g[f]=T.x,g[h]=T.y,g[_]=T.z,d.normalize(d.cross(y,T,T),T),p[f]=T.x,p[h]=T.y,p[_]=T.z}return e.attributes.tangent=new Xe({componentDatatype:oe.FLOAT,componentsPerAttribute:3,values:g}),e.attributes.bitangent=new Xe({componentDatatype:oe.FLOAT,componentsPerAttribute:3,values:p}),e};const xC=new $,zu=new d,b8=new d,E8=new d;let US=new $;Tc.compressVertices=function(e){if(!l(e))throw new w("geometry is required.");const t=e.attributes.extrudeDirection;let n,i;if(l(t)){const B=t.values;i=B.length/3;const V=new Float32Array(i*2);let M=0;for(n=0;n<i;++n){if(d.fromArray(B,n*3,zu),d.equals(zu,d.ZERO)){M+=2;continue}US=Ri.octEncodeInRange(zu,65535,US),V[M++]=US.x,V[M++]=US.y}return e.attributes.compressedAttributes=new Xe({componentDatatype:oe.FLOAT,componentsPerAttribute:2,values:V}),delete e.attributes.extrudeDirection,e}const o=e.attributes.normal,r=e.attributes.st,s=l(o),a=l(r);if(!s&&!a)return e;const c=e.attributes.tangent,u=e.attributes.bitangent,f=l(c),h=l(u);let _,g,p,y;s&&(_=o.values),a&&(g=r.values),f&&(p=c.values),h&&(y=u.values),i=(s?_.length:g.length)/(s?3:2);let x=i,v=a&&s?2:1;v+=f||h?1:0,x*=v;const D=new Float32Array(x);let L=0;for(n=0;n<i;++n){a&&($.fromArray(g,n*2,xC),D[L++]=Ri.compressTextureCoordinates(xC));const B=n*3;s&&l(p)&&l(y)?(d.fromArray(_,B,zu),d.fromArray(p,B,b8),d.fromArray(y,B,E8),Ri.octPack(zu,b8,E8,xC),D[L++]=xC.x,D[L++]=xC.y):(s&&(d.fromArray(_,B,zu),D[L++]=Ri.octEncodeFloat(zu)),f&&(d.fromArray(p,B,zu),D[L++]=Ri.octEncodeFloat(zu)),h&&(d.fromArray(y,B,zu),D[L++]=Ri.octEncodeFloat(zu)))}return e.attributes.compressedAttributes=new Xe({componentDatatype:oe.FLOAT,componentsPerAttribute:v,values:D}),s&&delete e.attributes.normal,a&&delete e.attributes.st,h&&delete e.attributes.bitangent,f&&delete e.attributes.tangent,e};function sMe(e){if(l(e.indices))return e;const t=$t.computeNumberOfVertices(e);if(t<3)throw new w("The number of vertices must be at least three.");if(t%3!==0)throw new w("The number of vertices must be a multiple of three.");const n=At.createTypedArray(t,t);for(let i=0;i<t;++i)n[i]=i;return e.indices=n,e}function aMe(e){const t=$t.computeNumberOfVertices(e);if(t<3)throw new w("The number of vertices must be at least three.");const n=At.createTypedArray(t,(t-2)*3);n[0]=1,n[1]=0,n[2]=2;let i=3;for(let o=3;o<t;++o)n[i++]=o-1,n[i++]=0,n[i++]=o;return e.indices=n,e.primitiveType=dt.TRIANGLES,e}function cMe(e){const t=$t.computeNumberOfVertices(e);if(t<3)throw new w("The number of vertices must be at least 3.");const n=At.createTypedArray(t,(t-2)*3);n[0]=0,n[1]=1,n[2]=2,t>3&&(n[3]=0,n[4]=2,n[5]=3);let i=6;for(let o=3;o<t-1;o+=2)n[i++]=o,n[i++]=o-1,n[i++]=o+1,o+2<t&&(n[i++]=o,n[i++]=o+1,n[i++]=o+2);return e.indices=n,e.primitiveType=dt.TRIANGLES,e}function lMe(e){if(l(e.indices))return e;const t=$t.computeNumberOfVertices(e);if(t<2)throw new w("The number of vertices must be at least two.");if(t%2!==0)throw new w("The number of vertices must be a multiple of 2.");const n=At.createTypedArray(t,t);for(let i=0;i<t;++i)n[i]=i;return e.indices=n,e}function uMe(e){const t=$t.computeNumberOfVertices(e);if(t<2)throw new w("The number of vertices must be at least two.");const n=At.createTypedArray(t,(t-1)*2);n[0]=0,n[1]=1;let i=2;for(let o=2;o<t;++o)n[i++]=o-1,n[i++]=o;return e.indices=n,e.primitiveType=dt.LINES,e}function fMe(e){const t=$t.computeNumberOfVertices(e);if(t<2)throw new w("The number of vertices must be at least two.");const n=At.createTypedArray(t,t*2);n[0]=0,n[1]=1;let i=2;for(let o=2;o<t;++o)n[i++]=o-1,n[i++]=o;return n[i++]=t-1,n[i]=0,e.indices=n,e.primitiveType=dt.LINES,e}function dMe(e){switch(e.primitiveType){case dt.TRIANGLE_FAN:return aMe(e);case dt.TRIANGLE_STRIP:return cMe(e);case dt.TRIANGLES:return sMe(e);case dt.LINE_STRIP:return uMe(e);case dt.LINE_LOOP:return fMe(e);case dt.LINES:return lMe(e)}return e}function gm(e,t){Math.abs(e.y)<F.EPSILON6&&(t?e.y=-F.EPSILON6:e.y=F.EPSILON6)}function hMe(e,t,n){if(e.y!==0&&t.y!==0&&n.y!==0){gm(e,e.y<0),gm(t,t.y<0),gm(n,n.y<0);return}const i=Math.abs(e.y),o=Math.abs(t.y),r=Math.abs(n.y);let s;i>o?i>r?s=F.sign(e.y):s=F.sign(n.y):o>r?s=F.sign(t.y):s=F.sign(n.y);const a=s<0;gm(e,a),gm(t,a),gm(n,a)}const x8=new d;function Ul(e,t,n,i){d.add(e,d.multiplyByScalar(d.subtract(t,e,x8),e.y/(e.y-t.y),x8),n),d.clone(n,i),gm(n,!0),gm(i,!1)}const X_=new d,K_=new d,J_=new d,Q_=new d,CB={positions:new Array(7),indices:new Array(3*3)};function pMe(e,t,n){if(e.x>=0||t.x>=0||n.x>=0)return;hMe(e,t,n);const i=e.y<0,o=t.y<0,r=n.y<0;let s=0;s+=i?1:0,s+=o?1:0,s+=r?1:0;const a=CB.indices;s===1?(a[1]=3,a[2]=4,a[5]=6,a[7]=6,a[8]=5,i?(Ul(e,t,X_,J_),Ul(e,n,K_,Q_),a[0]=0,a[3]=1,a[4]=2,a[6]=1):o?(Ul(t,n,X_,J_),Ul(t,e,K_,Q_),a[0]=1,a[3]=2,a[4]=0,a[6]=2):r&&(Ul(n,e,X_,J_),Ul(n,t,K_,Q_),a[0]=2,a[3]=0,a[4]=1,a[6]=0)):s===2&&(a[2]=4,a[4]=4,a[5]=3,a[7]=5,a[8]=6,i?o?r||(Ul(n,e,X_,J_),Ul(n,t,K_,Q_),a[0]=0,a[1]=1,a[3]=0,a[6]=2):(Ul(t,n,X_,J_),Ul(t,e,K_,Q_),a[0]=2,a[1]=0,a[3]=2,a[6]=1):(Ul(e,t,X_,J_),Ul(e,n,K_,Q_),a[0]=1,a[1]=2,a[3]=1,a[6]=0));const c=CB.positions;return c[0]=e,c[1]=t,c[2]=n,c.length=3,(s===1||s===2)&&(c[3]=X_,c[4]=K_,c[5]=J_,c[6]=Q_,c.length=7),CB}function w8(e,t){const n=e.attributes;if(n.position.values.length===0)return;for(const o in n)if(n.hasOwnProperty(o)&&l(n[o])&&l(n[o].values)){const r=n[o];r.values=oe.createTypedArray(r.componentDatatype,r.values)}const i=$t.computeNumberOfVertices(e);return e.indices=At.createTypedArray(i,e.indices),t&&(e.boundingSphere=Ae.fromVertices(n.position.values)),e}function iT(e){const t=e.attributes,n={};for(const i in t)if(t.hasOwnProperty(i)&&l(t[i])&&l(t[i].values)){const o=t[i];n[i]=new Xe({componentDatatype:o.componentDatatype,componentsPerAttribute:o.componentsPerAttribute,normalize:o.normalize,values:[]})}return new $t({attributes:n,indices:[],primitiveType:e.primitiveType})}function Az(e,t,n){const i=l(e.geometry.boundingSphere);t=w8(t,i),n=w8(n,i),l(n)&&!l(t)?e.geometry=n:!l(n)&&l(t)?e.geometry=t:(e.westHemisphereGeometry=t,e.eastHemisphereGeometry=n,e.geometry=void 0)}function Tz(e,t){const n=new e,i=new e,o=new e;return function(r,s,a,c,u,f,h,_){const g=e.fromArray(u,r*t,n),p=e.fromArray(u,s*t,i),y=e.fromArray(u,a*t,o);e.multiplyByScalar(g,c.x,g),e.multiplyByScalar(p,c.y,p),e.multiplyByScalar(y,c.z,y);const T=e.add(g,p,g);e.add(T,y,T),_&&e.normalize(T,T),e.pack(T,f,h*t)}}const mMe=Tz(ue,4),OD=Tz(d,3),VJ=Tz($,2),_Me=function(e,t,n,i,o,r,s){const a=o[e]*i.x,c=o[t]*i.y,u=o[n]*i.z;r[s]=a+c+u>F.EPSILON6?1:0},Gb=new d,oF=new d,rF=new d,gMe=new d;function HS(e,t,n,i,o,r,s,a,c,u,f,h,_,g,p,y){if(!l(r)&&!l(s)&&!l(a)&&!l(c)&&!l(u)&&g===0)return;const T=d.fromArray(o,e*3,Gb),b=d.fromArray(o,t*3,oF),x=d.fromArray(o,n*3,rF),v=XNe(i,T,b,x,gMe);if(l(v)){if(l(r)&&OD(e,t,n,v,r,h.normal.values,y,!0),l(u)){const D=d.fromArray(u,e*3,Gb),L=d.fromArray(u,t*3,oF),B=d.fromArray(u,n*3,rF);d.multiplyByScalar(D,v.x,D),d.multiplyByScalar(L,v.y,L),d.multiplyByScalar(B,v.z,B);let V;!d.equals(D,d.ZERO)||!d.equals(L,d.ZERO)||!d.equals(B,d.ZERO)?(V=d.add(D,L,D),d.add(V,B,V),d.normalize(V,V)):(V=Gb,V.x=0,V.y=0,V.z=0),d.pack(V,h.extrudeDirection.values,y*3)}if(l(f)&&_Me(e,t,n,v,f,h.applyOffset.values,y),l(s)&&OD(e,t,n,v,s,h.tangent.values,y,!0),l(a)&&OD(e,t,n,v,a,h.bitangent.values,y,!0),l(c)&&VJ(e,t,n,v,c,h.st.values,y),g>0)for(let D=0;D<g;D++){const L=_[D];yMe(e,t,n,v,y,p[L],h[L])}}}function yMe(e,t,n,i,o,r,s){const a=r.componentsPerAttribute,c=r.values,u=s.values;switch(a){case 4:mMe(e,t,n,i,c,u,o,!1);break;case 3:OD(e,t,n,i,c,u,o,!1);break;case 2:VJ(e,t,n,i,c,u,o,!1);break;default:u[o]=c[e]*i.x+c[t]*i.y+c[n]*i.z}}function td(e,t,n,i,o,r){const s=e.position.values.length/3;if(o!==-1){const a=i[o],c=n[a];return c===-1?(n[a]=s,e.position.values.push(r.x,r.y,r.z),t.push(s),s):(t.push(c),c)}return e.position.values.push(r.x,r.y,r.z),t.push(s),s}const AMe={position:!0,normal:!0,bitangent:!0,tangent:!0,st:!0,extrudeDirection:!0,applyOffset:!0};function S8(e){const t=e.geometry,n=t.attributes,i=n.position.values,o=l(n.normal)?n.normal.values:void 0,r=l(n.bitangent)?n.bitangent.values:void 0,s=l(n.tangent)?n.tangent.values:void 0,a=l(n.st)?n.st.values:void 0,c=l(n.extrudeDirection)?n.extrudeDirection.values:void 0,u=l(n.applyOffset)?n.applyOffset.values:void 0,f=t.indices,h=[];for(const V in n)n.hasOwnProperty(V)&&!AMe[V]&&l(n[V])&&h.push(V);const _=h.length,g=iT(t),p=iT(t);let y,T,b,x,v;const D=[];D.length=i.length/3;const L=[];for(L.length=i.length/3,v=0;v<D.length;++v)D[v]=-1,L[v]=-1;const B=f.length;for(v=0;v<B;v+=3){const V=f[v],M=f[v+1],H=f[v+2];let G=d.fromArray(i,V*3),I=d.fromArray(i,M*3),O=d.fromArray(i,H*3);const m=pMe(G,I,O);if(l(m)&&m.positions.length>3){const P=m.positions,R=m.indices,U=R.length;for(let W=0;W<U;++W){const q=R[W],Y=P[q];Y.y<0?(y=p.attributes,T=p.indices,b=D):(y=g.attributes,T=g.indices,b=L),x=td(y,T,b,f,q<3?v+q:-1,Y),HS(V,M,H,Y,i,o,s,r,a,c,u,y,h,_,n,x)}}else l(m)&&(G=m.positions[0],I=m.positions[1],O=m.positions[2]),G.y<0?(y=p.attributes,T=p.indices,b=D):(y=g.attributes,T=g.indices,b=L),x=td(y,T,b,f,v,G),HS(V,M,H,G,i,o,s,r,a,c,u,y,h,_,n,x),x=td(y,T,b,f,v+1,I),HS(V,M,H,I,i,o,s,r,a,c,u,y,h,_,n,x),x=td(y,T,b,f,v+2,O),HS(V,M,H,O,i,o,s,r,a,c,u,y,h,_,n,x)}Az(e,p,g)}const kJ=Wt.fromPointNormal(d.ZERO,d.UNIT_Y),TMe=new d,CMe=new d;function b0(e,t,n,i,o,r,s){if(!l(s))return;const a=d.fromArray(i,e*3,Gb);d.equalsEpsilon(a,n,F.EPSILON10)?r.applyOffset.values[o]=s[e]:r.applyOffset.values[o]=s[t]}function v8(e){const t=e.geometry,n=t.attributes,i=n.position.values,o=l(n.applyOffset)?n.applyOffset.values:void 0,r=t.indices,s=iT(t),a=iT(t);let c;const u=r.length,f=[];f.length=i.length/3;const h=[];for(h.length=i.length/3,c=0;c<f.length;++c)f[c]=-1,h[c]=-1;for(c=0;c<u;c+=2){const _=r[c],g=r[c+1],p=d.fromArray(i,_*3,Gb),y=d.fromArray(i,g*3,oF);let T;Math.abs(p.y)<F.EPSILON6&&(p.y<0?p.y=-F.EPSILON6:p.y=F.EPSILON6),Math.abs(y.y)<F.EPSILON6&&(y.y<0?y.y=-F.EPSILON6:y.y=F.EPSILON6);let b=s.attributes,x=s.indices,v=h,D=a.attributes,L=a.indices,B=f;const V=qr.lineSegmentPlane(p,y,kJ,rF);if(l(V)){const M=d.multiplyByScalar(d.UNIT_Y,5*F.EPSILON9,TMe);p.y<0&&(d.negate(M,M),b=a.attributes,x=a.indices,v=f,D=s.attributes,L=s.indices,B=h);const H=d.add(V,M,CMe);T=td(b,x,v,r,c,p),b0(_,g,p,i,T,b,o),T=td(b,x,v,r,-1,H),b0(_,g,H,i,T,b,o),d.negate(M,M),d.add(V,M,H),T=td(D,L,B,r,-1,H),b0(_,g,H,i,T,D,o),T=td(D,L,B,r,c+1,y),b0(_,g,y,i,T,D,o)}else{let M,H,G;p.y<0?(M=a.attributes,H=a.indices,G=f):(M=s.attributes,H=s.indices,G=h),T=td(M,H,G,r,c,p),b0(_,g,p,i,T,M,o),T=td(M,H,G,r,c+1,y),b0(_,g,y,i,T,M,o)}}Az(e,a,s)}const D8=new $,bMe=new $,GJ=new d,WJ=new d,sF=new d,EMe=new d,xMe=new d,wMe=new d,I8=new ue;function P8(e){const t=e.attributes,n=t.position.values,i=t.prevPosition.values,o=t.nextPosition.values,r=n.length;for(let s=0;s<r;s+=3){const a=d.unpack(n,s,GJ);if(a.x>0)continue;const c=d.unpack(i,s,WJ);(a.y<0&&c.y>0||a.y>0&&c.y<0)&&(s-3>0?(i[s]=n[s-3],i[s+1]=n[s-2],i[s+2]=n[s-1]):d.pack(a,i,s));const u=d.unpack(o,s,sF);(a.y<0&&u.y>0||a.y>0&&u.y<0)&&(s+3<r?(o[s]=n[s+3],o[s+1]=n[s+4],o[s+2]=n[s+5]):d.pack(a,o,s))}}const SMe=5*F.EPSILON9,VS=F.EPSILON6;function vMe(e){const t=e.geometry,n=t.attributes,i=n.position.values,o=n.prevPosition.values,r=n.nextPosition.values,s=n.expandAndWidth.values,a=l(n.st)?n.st.values:void 0,c=l(n.color)?n.color.values:void 0,u=iT(t),f=iT(t);let h,_,g,p=!1;const y=i.length/3;for(h=0;h<y;h+=4){const T=h,b=h+2,x=d.fromArray(i,T*3,GJ),v=d.fromArray(i,b*3,WJ);if(Math.abs(x.y)<VS)for(x.y=VS*(v.y<0?-1:1),i[h*3+1]=x.y,i[(h+1)*3+1]=x.y,_=T*3;_<T*3+4*3;_+=3)o[_]=i[h*3],o[_+1]=i[h*3+1],o[_+2]=i[h*3+2];if(Math.abs(v.y)<VS)for(v.y=VS*(x.y<0?-1:1),i[(h+2)*3+1]=v.y,i[(h+3)*3+1]=v.y,_=T*3;_<T*3+4*3;_+=3)r[_]=i[(h+2)*3],r[_+1]=i[(h+2)*3+1],r[_+2]=i[(h+2)*3+2];let D=u.attributes,L=u.indices,B=f.attributes,V=f.indices;const M=qr.lineSegmentPlane(x,v,kJ,EMe);if(l(M)){p=!0;const H=d.multiplyByScalar(d.UNIT_Y,SMe,xMe);x.y<0&&(d.negate(H,H),D=f.attributes,L=f.indices,B=u.attributes,V=u.indices);const G=d.add(M,H,wMe);D.position.values.push(x.x,x.y,x.z,x.x,x.y,x.z),D.position.values.push(G.x,G.y,G.z),D.position.values.push(G.x,G.y,G.z),D.prevPosition.values.push(o[T*3],o[T*3+1],o[T*3+2]),D.prevPosition.values.push(o[T*3+3],o[T*3+4],o[T*3+5]),D.prevPosition.values.push(x.x,x.y,x.z,x.x,x.y,x.z),D.nextPosition.values.push(G.x,G.y,G.z),D.nextPosition.values.push(G.x,G.y,G.z),D.nextPosition.values.push(G.x,G.y,G.z),D.nextPosition.values.push(G.x,G.y,G.z),d.negate(H,H),d.add(M,H,G),B.position.values.push(G.x,G.y,G.z),B.position.values.push(G.x,G.y,G.z),B.position.values.push(v.x,v.y,v.z,v.x,v.y,v.z),B.prevPosition.values.push(G.x,G.y,G.z),B.prevPosition.values.push(G.x,G.y,G.z),B.prevPosition.values.push(G.x,G.y,G.z),B.prevPosition.values.push(G.x,G.y,G.z),B.nextPosition.values.push(v.x,v.y,v.z,v.x,v.y,v.z),B.nextPosition.values.push(r[b*3],r[b*3+1],r[b*3+2]),B.nextPosition.values.push(r[b*3+3],r[b*3+4],r[b*3+5]);const I=$.fromArray(s,T*2,D8),O=Math.abs(I.y);D.expandAndWidth.values.push(-1,O,1,O),D.expandAndWidth.values.push(-1,-O,1,-O),B.expandAndWidth.values.push(-1,O,1,O),B.expandAndWidth.values.push(-1,-O,1,-O);let m=d.magnitudeSquared(d.subtract(M,x,sF));if(m/=d.magnitudeSquared(d.subtract(v,x,sF)),l(c)){const P=ue.fromArray(c,T*4,I8),R=ue.fromArray(c,b*4,I8),U=F.lerp(P.x,R.x,m),W=F.lerp(P.y,R.y,m),q=F.lerp(P.z,R.z,m),Y=F.lerp(P.w,R.w,m);for(_=T*4;_<T*4+2*4;++_)D.color.values.push(c[_]);for(D.color.values.push(U,W,q,Y),D.color.values.push(U,W,q,Y),B.color.values.push(U,W,q,Y),B.color.values.push(U,W,q,Y),_=b*4;_<b*4+2*4;++_)B.color.values.push(c[_])}if(l(a)){const P=$.fromArray(a,T*2,D8),R=$.fromArray(a,(h+3)*2,bMe),U=F.lerp(P.x,R.x,m);for(_=T*2;_<T*2+2*2;++_)D.st.values.push(a[_]);for(D.st.values.push(U,P.y),D.st.values.push(U,R.y),B.st.values.push(U,P.y),B.st.values.push(U,R.y),_=b*2;_<b*2+2*2;++_)B.st.values.push(a[_])}g=D.position.values.length/3-4,L.push(g,g+2,g+1),L.push(g+1,g+2,g+3),g=B.position.values.length/3-4,V.push(g,g+2,g+1),V.push(g+1,g+2,g+3)}else{let H,G;for(x.y<0?(H=f.attributes,G=f.indices):(H=u.attributes,G=u.indices),H.position.values.push(x.x,x.y,x.z),H.position.values.push(x.x,x.y,x.z),H.position.values.push(v.x,v.y,v.z),H.position.values.push(v.x,v.y,v.z),_=h*3;_<h*3+4*3;++_)H.prevPosition.values.push(o[_]),H.nextPosition.values.push(r[_]);for(_=h*2;_<h*2+4*2;++_)H.expandAndWidth.values.push(s[_]),l(a)&&H.st.values.push(a[_]);if(l(c))for(_=h*4;_<h*4+4*4;++_)H.color.values.push(c[_]);g=H.position.values.length/3-4,G.push(g,g+2,g+1),G.push(g+1,g+2,g+3)}}p&&(P8(f),P8(u)),Az(e,f,u)}Tc.splitLongitude=function(e){if(!l(e))throw new w("instance is required.");const t=e.geometry,n=t.boundingSphere;if(l(n)&&(n.center.x-n.radius>0||Ae.intersectPlane(n,Wt.ORIGIN_ZX_PLANE)!==Vn.INTERSECTING))return e;if(t.geometryType!==fA.NONE)switch(t.geometryType){case fA.POLYLINES:vMe(e);break;case fA.TRIANGLES:S8(e);break;case fA.LINES:v8(e);break}else dMe(t),t.primitiveType===dt.TRIANGLES?S8(e):t.primitiveType===dt.LINES&&v8(e);return e};const mo=Tc,DMe=new d(1,1,1),kS=Math.cos,GS=Math.sin;function ml(e){e=A(e,A.EMPTY_OBJECT);const t=A(e.radii,DMe),n=A(e.innerRadii,t),i=A(e.minimumClock,0),o=A(e.maximumClock,F.TWO_PI),r=A(e.minimumCone,0),s=A(e.maximumCone,F.PI),a=Math.round(A(e.stackPartitions,10)),c=Math.round(A(e.slicePartitions,8)),u=Math.round(A(e.subdivisions,128));if(a<1)throw new w("options.stackPartitions cannot be less than 1");if(c<0)throw new w("options.slicePartitions cannot be less than 0");if(u<0)throw new w("options.subdivisions must be greater than or equal to zero.");if(l(e.offsetAttribute)&&e.offsetAttribute===Fn.TOP)throw new w("GeometryOffsetAttribute.TOP is not a supported options.offsetAttribute for this geometry.");this._radii=d.clone(t),this._innerRadii=d.clone(n),this._minimumClock=i,this._maximumClock=o,this._minimumCone=r,this._maximumCone=s,this._stackPartitions=a,this._slicePartitions=c,this._subdivisions=u,this._offsetAttribute=e.offsetAttribute,this._workerName="createEllipsoidOutlineGeometry"}ml.packedLength=2*d.packedLength+8;ml.pack=function(e,t,n){if(!l(e))throw new w("value is required");if(!l(t))throw new w("array is required");return n=A(n,0),d.pack(e._radii,t,n),n+=d.packedLength,d.pack(e._innerRadii,t,n),n+=d.packedLength,t[n++]=e._minimumClock,t[n++]=e._maximumClock,t[n++]=e._minimumCone,t[n++]=e._maximumCone,t[n++]=e._stackPartitions,t[n++]=e._slicePartitions,t[n++]=e._subdivisions,t[n]=A(e._offsetAttribute,-1),t};const qJ=new d,jJ=new d,dh={radii:qJ,innerRadii:jJ,minimumClock:void 0,maximumClock:void 0,minimumCone:void 0,maximumCone:void 0,stackPartitions:void 0,slicePartitions:void 0,subdivisions:void 0,offsetAttribute:void 0};ml.unpack=function(e,t,n){if(!l(e))throw new w("array is required");t=A(t,0);const i=d.unpack(e,t,qJ);t+=d.packedLength;const o=d.unpack(e,t,jJ);t+=d.packedLength;const r=e[t++],s=e[t++],a=e[t++],c=e[t++],u=e[t++],f=e[t++],h=e[t++],_=e[t];return l(n)?(n._radii=d.clone(i,n._radii),n._innerRadii=d.clone(o,n._innerRadii),n._minimumClock=r,n._maximumClock=s,n._minimumCone=a,n._maximumCone=c,n._stackPartitions=u,n._slicePartitions=f,n._subdivisions=h,n._offsetAttribute=_===-1?void 0:_,n):(dh.minimumClock=r,dh.maximumClock=s,dh.minimumCone=a,dh.maximumCone=c,dh.stackPartitions=u,dh.slicePartitions=f,dh.subdivisions=h,dh.offsetAttribute=_===-1?void 0:_,new ml(dh))};ml.createGeometry=function(e){const t=e._radii;if(t.x<=0||t.y<=0||t.z<=0)return;const n=e._innerRadii;if(n.x<=0||n.y<=0||n.z<=0)return;const i=e._minimumClock,o=e._maximumClock,r=e._minimumCone,s=e._maximumCone,a=e._subdivisions,c=be.fromCartesian3(t);let u=e._slicePartitions+1,f=e._stackPartitions+1;u=Math.round(u*Math.abs(o-i)/F.TWO_PI),f=Math.round(f*Math.abs(s-r)/F.PI),u<2&&(u=2),f<2&&(f=2);let h=0,_=1;const g=n.x!==t.x||n.y!==t.y||n.z!==t.z;let p=!1,y=!1;g&&(_=2,r>0&&(p=!0,h+=u),s<Math.PI&&(y=!0,h+=u));const T=a*_*(f+u),b=new Float64Array(T*3),x=2*(T+h-(u+f)*_),v=At.createTypedArray(T,x);let D,L,B,V,M=0;const H=new Array(f),G=new Array(f);for(D=0;D<f;D++)V=r+D*(s-r)/(f-1),H[D]=GS(V),G[D]=kS(V);const I=new Array(a),O=new Array(a);for(D=0;D<a;D++)B=i+D*(o-i)/(a-1),I[D]=GS(B),O[D]=kS(B);for(D=0;D<f;D++)for(L=0;L<a;L++)b[M++]=t.x*H[D]*O[L],b[M++]=t.y*H[D]*I[L],b[M++]=t.z*G[D];if(g)for(D=0;D<f;D++)for(L=0;L<a;L++)b[M++]=n.x*H[D]*O[L],b[M++]=n.y*H[D]*I[L],b[M++]=n.z*G[D];for(H.length=a,G.length=a,D=0;D<a;D++)V=r+D*(s-r)/(a-1),H[D]=GS(V),G[D]=kS(V);for(I.length=u,O.length=u,D=0;D<u;D++)B=i+D*(o-i)/(u-1),I[D]=GS(B),O[D]=kS(B);for(D=0;D<a;D++)for(L=0;L<u;L++)b[M++]=t.x*H[D]*O[L],b[M++]=t.y*H[D]*I[L],b[M++]=t.z*G[D];if(g)for(D=0;D<a;D++)for(L=0;L<u;L++)b[M++]=n.x*H[D]*O[L],b[M++]=n.y*H[D]*I[L],b[M++]=n.z*G[D];for(M=0,D=0;D<f*_;D++){const R=D*a;for(L=0;L<a-1;L++)v[M++]=R+L,v[M++]=R+L+1}let m=f*a*_;for(D=0;D<u;D++)for(L=0;L<a-1;L++)v[M++]=m+D+L*u,v[M++]=m+D+(L+1)*u;if(g)for(m=f*a*_+u*a,D=0;D<u;D++)for(L=0;L<a-1;L++)v[M++]=m+D+L*u,v[M++]=m+D+(L+1)*u;if(g){let R=f*a*_,U=R+a*u;if(p)for(D=0;D<u;D++)v[M++]=R+D,v[M++]=U+D;if(y)for(R+=a*u-u,U+=a*u-u,D=0;D<u;D++)v[M++]=R+D,v[M++]=U+D}const P=new To({position:new Xe({componentDatatype:oe.DOUBLE,componentsPerAttribute:3,values:b})});if(l(e._offsetAttribute)){const R=b.length,U=e._offsetAttribute===Fn.NONE?0:1,W=new Uint8Array(R/3).fill(U);P.applyOffset=new Xe({componentDatatype:oe.UNSIGNED_BYTE,componentsPerAttribute:1,values:W})}return new $t({attributes:P,indices:v,primitiveType:dt.LINES,boundingSphere:Ae.fromEllipsoid(c),offsetAttribute:e._offsetAttribute})};function Jm(e){const t=A(e.radius,1),i={radii:new d(t,t,t),stackPartitions:e.stackPartitions,slicePartitions:e.slicePartitions,subdivisions:e.subdivisions};this._ellipsoidGeometry=new ml(i),this._workerName="createSphereOutlineGeometry"}Jm.packedLength=ml.packedLength;Jm.pack=function(e,t,n){return E.typeOf.object("value",e),ml.pack(e._ellipsoidGeometry,t,n)};const IMe=new ml,Z_={radius:void 0,radii:new d,stackPartitions:void 0,slicePartitions:void 0,subdivisions:void 0};Jm.unpack=function(e,t,n){const i=ml.unpack(e,t,IMe);return Z_.stackPartitions=i._stackPartitions,Z_.slicePartitions=i._slicePartitions,Z_.subdivisions=i._subdivisions,l(n)?(d.clone(i._radii,Z_.radii),n._ellipsoidGeometry=new ml(Z_),n):(Z_.radius=i._radii.x,new Jm(Z_))};Jm.createGeometry=function(e){return ml.createGeometry(e._ellipsoidGeometry)};const PMe={NONE:-1,PARTIAL:0,FULL:1},Es=Object.freeze(PMe),OMe={ADD:fe.FUNC_ADD,SUBTRACT:fe.FUNC_SUBTRACT,REVERSE_SUBTRACT:fe.FUNC_REVERSE_SUBTRACT,MIN:fe.MIN,MAX:fe.MAX},Xl=Object.freeze(OMe),LMe={ZERO:fe.ZERO,ONE:fe.ONE,SOURCE_COLOR:fe.SRC_COLOR,ONE_MINUS_SOURCE_COLOR:fe.ONE_MINUS_SRC_COLOR,DESTINATION_COLOR:fe.DST_COLOR,ONE_MINUS_DESTINATION_COLOR:fe.ONE_MINUS_DST_COLOR,SOURCE_ALPHA:fe.SRC_ALPHA,ONE_MINUS_SOURCE_ALPHA:fe.ONE_MINUS_SRC_ALPHA,DESTINATION_ALPHA:fe.DST_ALPHA,ONE_MINUS_DESTINATION_ALPHA:fe.ONE_MINUS_DST_ALPHA,CONSTANT_COLOR:fe.CONSTANT_COLOR,ONE_MINUS_CONSTANT_COLOR:fe.ONE_MINUS_CONSTANT_COLOR,CONSTANT_ALPHA:fe.CONSTANT_ALPHA,ONE_MINUS_CONSTANT_ALPHA:fe.ONE_MINUS_CONSTANT_ALPHA,SOURCE_ALPHA_SATURATE:fe.SRC_ALPHA_SATURATE},fr=Object.freeze(LMe),BMe={DISABLED:Object.freeze({enabled:!1}),ALPHA_BLEND:Object.freeze({enabled:!0,equationRgb:Xl.ADD,equationAlpha:Xl.ADD,functionSourceRgb:fr.SOURCE_ALPHA,functionSourceAlpha:fr.ONE,functionDestinationRgb:fr.ONE_MINUS_SOURCE_ALPHA,functionDestinationAlpha:fr.ONE_MINUS_SOURCE_ALPHA}),PRE_MULTIPLIED_ALPHA_BLEND:Object.freeze({enabled:!0,equationRgb:Xl.ADD,equationAlpha:Xl.ADD,functionSourceRgb:fr.ONE,functionSourceAlpha:fr.ONE,functionDestinationRgb:fr.ONE_MINUS_SOURCE_ALPHA,functionDestinationAlpha:fr.ONE_MINUS_SOURCE_ALPHA}),ADDITIVE_BLEND:Object.freeze({enabled:!0,equationRgb:Xl.ADD,equationAlpha:Xl.ADD,functionSourceRgb:fr.SOURCE_ALPHA,functionSourceAlpha:fr.ONE,functionDestinationRgb:fr.ONE,functionDestinationAlpha:fr.ONE})},fo=Object.freeze(BMe),RMe={NEVER:fe.NEVER,LESS:fe.LESS,EQUAL:fe.EQUAL,LESS_OR_EQUAL:fe.LEQUAL,GREATER:fe.GREATER,NOT_EQUAL:fe.NOTEQUAL,GREATER_OR_EQUAL:fe.GEQUAL,ALWAYS:fe.ALWAYS},ty=Object.freeze(RMe),NMe={UNLOADED:0,TRANSITIONING:1,RECEIVED:2,TEXTURE_LOADED:3,READY:4,FAILED:5,INVALID:6,PLACEHOLDER:7},zi=Object.freeze(NMe),MMe={START:0,LOADING:1,DONE:2,FAILED:3},_u=Object.freeze(MMe),FMe={FAILED:0,UNLOADED:1,RECEIVING:2,RECEIVED:3,TRANSFORMING:4,TRANSFORMED:5,READY:6},Go=Object.freeze(FMe);function no(){this.imagery=[],this.waterMaskTexture=void 0,this.waterMaskTranslationAndScale=new ue(0,0,1,1),this.terrainData=void 0,this.vertexArray=void 0,this.tileBoundingRegion=void 0,this.occludeePointInScaledSpace=new d,this.boundingVolumeSourceTile=void 0,this.boundingVolumeIsFromMesh=!1,this.terrainState=Go.UNLOADED,this.mesh=void 0,this.fill=void 0,this.pickBoundingSphere=new Ae,this.surfaceShader=void 0,this.isClipped=!0,this.clippedByBoundaries=!1}Object.defineProperties(no.prototype,{eligibleForUnloading:{get:function(){const e=this.terrainState;let n=!(e===Go.RECEIVING||e===Go.TRANSFORMING);const i=this.imagery;for(let o=0,r=i.length;n&&o<r;++o){const s=i[o];n=!l(s.loadingImagery)||s.loadingImagery.state!==zi.TRANSITIONING}return n}},renderedMesh:{get:function(){if(l(this.vertexArray))return this.mesh;if(l(this.fill))return this.fill.mesh}}});const zMe=new ve;function bB(e,t,n,i,o,r){let s=e.getExaggeratedPosition(i,o,r);if(l(t)&&t!==me.SCENE3D){const c=n.ellipsoid.cartesianToCartographic(s,zMe);s=n.project(c,r),s=d.fromElements(s.z,s.x,s.y,r)}return s}const UMe=new d,HMe=new d,VMe=new d;no.prototype.pick=function(e,t,n,i,o){const r=this.renderedMesh;if(!l(r))return;const s=r.vertices,a=r.indices,c=r.encoding,u=a.length;let f=Number.MAX_VALUE;for(let h=0;h<u;h+=3){const _=a[h],g=a[h+1],p=a[h+2],y=bB(c,t,n,s,_,UMe),T=bB(c,t,n,s,g,HMe),b=bB(c,t,n,s,p,VMe),x=qr.rayTriangleParametric(e,y,T,b,i);l(x)&&x<f&&x>=0&&(f=x)}return f!==Number.MAX_VALUE?ii.getPoint(e,f,o):void 0};no.prototype.freeResources=function(){l(this.waterMaskTexture)&&(--this.waterMaskTexture.referenceCount,this.waterMaskTexture.referenceCount===0&&this.waterMaskTexture.destroy(),this.waterMaskTexture=void 0),this.terrainData=void 0,this.terrainState=Go.UNLOADED,this.mesh=void 0,this.fill=this.fill&&this.fill.destroy();const e=this.imagery;for(let t=0,n=e.length;t<n;++t)e[t].freeResources();this.imagery.length=0,this.freeVertexArray()};no.prototype.freeVertexArray=function(){no._freeVertexArray(this.vertexArray),this.vertexArray=void 0,no._freeVertexArray(this.wireframeVertexArray),this.wireframeVertexArray=void 0};no.initialize=function(e,t,n){let i=e.data;l(i)||(i=e.data=new no),e.state===_u.START&&(kMe(e,t,n),e.state=_u.LOADING)};no.processStateMachine=function(e,t,n,i,o,r,s){no.initialize(e,n,i);const a=e.data;if(e.state===_u.LOADING&&GMe(e,t,n,i,o,r),s)return;const c=e.renderable;e.renderable=l(a.vertexArray);const u=a.terrainState===Go.READY;e.upsampledFromParent=l(a.terrainData)&&a.terrainData.wasCreatedByUpsampling();const f=a.processImagery(e,n,t);if(u&&f){const h=e._loadedCallbacks,_={};for(const g in h)h.hasOwnProperty(g)&&(h[g](e)||(_[g]=h[g]));e._loadedCallbacks=_,e.state=_u.DONE}c&&(e.renderable=!0)};no.prototype.processImagery=function(e,t,n,i){const o=e.data;let r=e.upsampledFromParent,s=!1,a=!0;const c=o.imagery;let u,f;for(u=0,f=c.length;u<f;++u){const h=c[u];if(!l(h.loadingImagery)){r=!1;continue}if(h.loadingImagery.state===zi.PLACEHOLDER){const g=h.loadingImagery.imageryLayer;if(g.imageryProvider.ready){h.freeResources(),c.splice(u,1),g._createTileImagerySkeletons(e,t,u),--u,f=c.length;continue}else r=!1}const _=h.processStateMachine(e,n,i);a=a&&_,s=s||_||l(h.readyImagery),r=r&&l(h.loadingImagery)&&(h.loadingImagery.state===zi.FAILED||h.loadingImagery.state===zi.INVALID)}return e.upsampledFromParent=r,e.renderable=e.renderable&&(s||a),a};function YJ(e,t,n,i){const o=e.renderedMesh,r=o.vertices,s=o.encoding,a=r.length/s.stride;let c=ts.clone(s);c.hasGeodeticSurfaceNormals=t,c=ts.clone(c);const u=c.stride,f=new Float32Array(a*u);t?s.addGeodeticSurfaceNormals(r,f,n):s.removeGeodeticSurfaceNormals(r,f),o.vertices=f,o.stride=u,o!==e.mesh?(no._freeVertexArray(e.fill.vertexArray),e.fill.vertexArray=no._createVertexArrayForMesh(i.context,o)):(no._freeVertexArray(e.vertexArray),e.vertexArray=no._createVertexArrayForMesh(i.context,o)),no._freeVertexArray(e.wireframeVertexArray),e.wireframeVertexArray=void 0}no.prototype.addGeodeticSurfaceNormals=function(e,t){YJ(this,!0,e,t)};no.prototype.removeGeodeticSurfaceNormals=function(e){YJ(this,!1,void 0,e)};no.prototype.updateExaggeration=function(e,t,n){const i=this,o=i.renderedMesh;if(o===void 0)return;const r=t.terrainExaggeration,s=t.terrainExaggerationRelativeHeight,a=r!==1,c=o.encoding,u=c.exaggeration!==r,f=c.exaggerationRelativeHeight!==s;if(u||f){if(u)if(a&&!c.hasGeodeticSurfaceNormals){const h=e.tilingScheme.ellipsoid;i.addGeodeticSurfaceNormals(h,t)}else!a&&c.hasGeodeticSurfaceNormals&&i.removeGeodeticSurfaceNormals(t);if(c.exaggeration=r,c.exaggerationRelativeHeight=s,n!==void 0){n._tileToUpdateHeights.push(e);const h=e.customData,_=h.length;for(let g=0;g<_;g++){const p=h[g];p.level=-1}}}};function kMe(e,t,n){let i=t.getTileDataAvailable(e.x,e.y,e.level);if(!l(i)&&l(e.parent)){const o=e.parent,r=o.data;l(r)&&l(r.terrainData)&&(i=r.terrainData.isChildAvailable(o.x,o.y,e.x,e.y))}i===!1&&(e.data.terrainState=Go.FAILED);for(let o=0,r=n.length;o<r;++o){const s=n.get(o);s.show&&s._createTileImagerySkeletons(e,t)}}function GMe(e,t,n,i,o,r){const s=e.data,a=e.parent;if(s.terrainState===Go.FAILED&&a!==void 0&&(a.data!==void 0&&a.data.terrainData!==void 0&&a.data.terrainData.canUpsample!==!1||no.processStateMachine(a,t,n,i,o,r,!0)),s.terrainState===Go.FAILED&&WMe(s,e,t,n,e.x,e.y,e.level),s.terrainState===Go.UNLOADED&&qMe(s,n,e.x,e.y,e.level),s.terrainState===Go.RECEIVED&&YMe(s,t,n,e.x,e.y,e.level),s.terrainState===Go.TRANSFORMED&&($Me(s,t.context,n,e.x,e.y,e.level,r),s.updateExaggeration(e,t,o)),s.terrainState>=Go.RECEIVED&&s.waterMaskTexture===void 0&&n.hasWaterMask)if(s.terrainData.waterMask!==void 0)KMe(t.context,s);else{const u=s._findAncestorTileWithTerrainData(e);l(u)&&l(u.data.waterMaskTexture)&&(s.waterMaskTexture=u.data.waterMaskTexture,++s.waterMaskTexture.referenceCount,s._computeWaterMaskTranslationAndScale(e,u,s.waterMaskTranslationAndScale))}}function WMe(e,t,n,i,o,r,s){const a=t.parent;if(!a){t.state=_u.FAILED;return}const c=a.data.terrainData,u=a.x,f=a.y,h=a.level;if(!l(c))return;const _=c.upsample(i.tilingScheme,u,f,h,o,r,s);l(_)&&(e.terrainState=Go.RECEIVING,Promise.resolve(_).then(function(g){e.terrainData=g,e.terrainState=Go.RECEIVED}).catch(function(){e.terrainState=Go.FAILED}))}function qMe(e,t,n,i,o){function r(c){e.terrainData=c,e.terrainState=Go.RECEIVED,e.request=void 0}function s(c){if(e.request.state===or.CANCELLED){e.terrainData=void 0,e.terrainState=Go.UNLOADED,e.request=void 0;return}e.terrainState=Go.FAILED,e.request=void 0;const u=`Failed to obtain terrain tile X: ${n} Y: ${i} Level: ${o}. Error message: "${c}"`;t._requestError=Lo.reportError(t._requestError,t,t.errorEvent,u,n,i,o),t._requestError.retry&&a()}function a(){const c=new Ad({throttle:!1,throttleByServer:!0,type:xy.TERRAIN});e.request=c;const u=t.requestTileGeometry(n,i,o,c);l(u)?(e.terrainState=Go.RECEIVING,Promise.resolve(u).then(function(f){r(f)}).catch(function(f){s(f)})):(e.terrainState=Go.UNLOADED,e.request=void 0)}a()}const jMe={tilingScheme:void 0,x:0,y:0,level:0,exaggeration:1,exaggerationRelativeHeight:0,throttle:!0};function YMe(e,t,n,i,o,r){const s=n.tilingScheme,a=jMe;a.tilingScheme=s,a.x=i,a.y=o,a.level=r,a.exaggeration=t.terrainExaggeration,a.exaggerationRelativeHeight=t.terrainExaggerationRelativeHeight,a.throttle=!0;const u=e.terrainData.createMesh(a);l(u)&&(e.terrainState=Go.TRANSFORMING,Promise.resolve(u).then(function(f){e.mesh=f,e.terrainState=Go.TRANSFORMED}).catch(function(){e.terrainState=Go.FAILED}))}no._createVertexArrayForMesh=function(e,t){const n=t.vertices,i=Mt.createVertexBuffer({context:e,typedArray:n,usage:mt.STATIC_DRAW}),o=t.encoding.getAttributes(i),r=t.indices.indexBuffers||{};let s=r[e.id];if(!l(s)||s.isDestroyed()){const a=t.indices;s=Mt.createIndexBuffer({context:e,typedArray:a,usage:mt.STATIC_DRAW,indexDatatype:At.fromSizeInBytes(a.BYTES_PER_ELEMENT)}),s.vertexArrayDestroyable=!1,s.referenceCount=1,r[e.id]=s,t.indices.indexBuffers=r}else++s.referenceCount;return new Fo({context:e,attributes:o,indexBuffer:s})};no._freeVertexArray=function(e){if(l(e)){const t=e.indexBuffer;e.isDestroyed()||e.destroy(),l(t)&&!t.isDestroyed()&&l(t.referenceCount)&&(--t.referenceCount,t.referenceCount===0&&t.destroy())}};function $Me(e,t,n,i,o,r,s){e.vertexArray=no._createVertexArrayForMesh(t,e.mesh),e.terrainState=Go.READY,e.fill=e.fill&&e.fill.destroy(s)}function XMe(e){let t=e.cache.tile_waterMaskData;if(!l(t)){const n=rn.create({context:e,pixelFormat:yt.LUMINANCE,pixelDatatype:ft.UNSIGNED_BYTE,source:{arrayBufferView:new Uint8Array([255]),width:1,height:1}});n.referenceCount=1;const i=new Ci({wrapS:io.CLAMP_TO_EDGE,wrapT:io.CLAMP_TO_EDGE,minificationFilter:Wn.LINEAR,magnificationFilter:Ps.LINEAR});t={allWaterTexture:n,sampler:i,destroy:function(){this.allWaterTexture.destroy()}},e.cache.tile_waterMaskData=t}return t}function KMe(e,t){const n=t.terrainData.waterMask,i=XMe(e);let o;const r=n.length;if(r===1)if(n[0]!==0)o=i.allWaterTexture;else return;else{const s=Math.sqrt(r);o=rn.create({context:e,pixelFormat:yt.LUMINANCE,pixelDatatype:ft.UNSIGNED_BYTE,source:{width:s,height:s,arrayBufferView:n},sampler:i.sampler,flipY:!1}),o.referenceCount=0}++o.referenceCount,t.waterMaskTexture=o,ue.fromElements(0,0,1,1,t.waterMaskTranslationAndScale)}no.prototype._findAncestorTileWithTerrainData=function(e){let t=e.parent;for(;l(t)&&(!l(t.data)||!l(t.data.terrainData)||t.data.terrainData.wasCreatedByUpsampling());)t=t.parent;return t};no.prototype._computeWaterMaskTranslationAndScale=function(e,t,n){const i=t.rectangle,o=e.rectangle,r=o.width,s=o.height,a=r/i.width,c=s/i.height;return n.x=a*(o.west-i.west)/r,n.y=c*(o.south-i.south)/s,n.z=a,n.w=c,n};function ny(e,t,n,i,o){if(this.imageryLayer=e,this.x=t,this.y=n,this.level=i,this.request=void 0,i!==0){const r=t/2|0,s=n/2|0,a=i-1;this.parent=e.getImageryFromCache(r,s,a)}this.state=zi.UNLOADED,this.imageUrl=void 0,this.image=void 0,this.texture=void 0,this.textureWebMercator=void 0,this.credits=void 0,this.referenceCount=0,!l(o)&&e.imageryProvider.ready&&(o=e.imageryProvider.tilingScheme.tileXYToRectangle(t,n,i)),this.rectangle=o}ny.createPlaceholder=function(e){const t=new ny(e,0,0,0);return t.addReference(),t.state=zi.PLACEHOLDER,t};ny.prototype.addReference=function(){++this.referenceCount};ny.prototype.releaseReference=function(){return--this.referenceCount,this.referenceCount===0?(this.imageryLayer.removeImageryFromCache(this),l(this.parent)&&this.parent.releaseReference(),l(this.image)&&l(this.image.destroy)&&this.image.destroy(),l(this.texture)&&this.texture.destroy(),l(this.textureWebMercator)&&this.texture!==this.textureWebMercator&&this.textureWebMercator.destroy(),Je(this),0):this.referenceCount};ny.prototype.processStateMachine=function(e,t,n){this.state===zi.UNLOADED&&!n&&(this.state=zi.TRANSITIONING,this.imageryLayer._requestImagery(this)),this.state===zi.RECEIVED&&(this.state=zi.TRANSITIONING,this.imageryLayer._createTexture(e.context,this));const i=this.state===zi.READY&&t&&!this.texture;(this.state===zi.TEXTURE_LOADED||i)&&(this.state=zi.TRANSITIONING,this.imageryLayer._reprojectTexture(e,this,t))};const JMe={LEFT:-1,NONE:0,RIGHT:1},Py=Object.freeze(JMe);function Q1(e,t,n){this.readyImagery=void 0,this.loadingImagery=e,this.textureCoordinateRectangle=t,this.textureTranslationAndScale=void 0,this.useWebMercatorT=n}Q1.prototype.freeResources=function(){l(this.readyImagery)&&this.readyImagery.releaseReference(),l(this.loadingImagery)&&this.loadingImagery.releaseReference()};Q1.prototype.processStateMachine=function(e,t,n){const i=this.loadingImagery,o=i.imageryLayer;if(i.processStateMachine(t,!this.useWebMercatorT,n),i.state===zi.READY)return l(this.readyImagery)&&this.readyImagery.releaseReference(),this.readyImagery=this.loadingImagery,this.loadingImagery=void 0,this.textureTranslationAndScale=o._calculateTextureTranslationAndScale(e,this),!0;let r=i.parent,s;for(;l(r)&&(r.state!==zi.READY||!this.useWebMercatorT&&!l(r.texture));)r.state!==zi.FAILED&&r.state!==zi.INVALID&&(s=s||r),r=r.parent;return this.readyImagery!==r&&(l(this.readyImagery)&&this.readyImagery.releaseReference(),this.readyImagery=r,l(r)&&(r.addReference(),this.textureTranslationAndScale=o._calculateTextureTranslationAndScale(e,this))),i.state===zi.FAILED||i.state===zi.INVALID?l(s)?(s.processStateMachine(t,!this.useWebMercatorT,n),!1):!0:!1};function si(e,t){this._imageryProvider=e,t=A(t,A.EMPTY_OBJECT),this.alpha=A(t.alpha,A(e.defaultAlpha,1)),this.nightAlpha=A(t.nightAlpha,A(e.defaultNightAlpha,1)),this.dayAlpha=A(t.dayAlpha,A(e.defaultDayAlpha,1)),this.brightness=A(t.brightness,A(e.defaultBrightness,si.DEFAULT_BRIGHTNESS)),this.contrast=A(t.contrast,A(e.defaultContrast,si.DEFAULT_CONTRAST)),this.hue=A(t.hue,A(e.defaultHue,si.DEFAULT_HUE)),this.saturation=A(t.saturation,A(e.defaultSaturation,si.DEFAULT_SATURATION)),this.gamma=A(t.gamma,A(e.defaultGamma,si.DEFAULT_GAMMA)),this.splitDirection=A(t.splitDirection,A(e.defaultSplit,si.DEFAULT_SPLIT)),this.minificationFilter=A(t.minificationFilter,A(e.defaultMinificationFilter,si.DEFAULT_MINIFICATION_FILTER)),this.magnificationFilter=A(t.magnificationFilter,A(e.defaultMagnificationFilter,si.DEFAULT_MAGNIFICATION_FILTER)),this.show=A(t.show,!0),this._minimumTerrainLevel=t.minimumTerrainLevel,this._maximumTerrainLevel=t.maximumTerrainLevel,this._rectangle=A(t.rectangle,Ee.MAX_VALUE),this._maximumAnisotropy=t.maximumAnisotropy,this._imageryCache={},this._skeletonPlaceholder=new Q1(ny.createPlaceholder(this)),this._show=!0,this._layerIndex=-1,this._isBaseLayer=!1,this._requestImageError=void 0,this._reprojectComputeCommands=[],this.cutoutRectangle=t.cutoutRectangle,this.colorToAlpha=t.colorToAlpha,this.colorToAlphaThreshold=A(t.colorToAlphaThreshold,si.DEFAULT_APPLY_COLOR_TO_ALPHA_THRESHOLD)}Object.defineProperties(si.prototype,{imageryProvider:{get:function(){return this._imageryProvider}},rectangle:{get:function(){return this._rectangle}}});si.DEFAULT_BRIGHTNESS=1;si.DEFAULT_CONTRAST=1;si.DEFAULT_HUE=0;si.DEFAULT_SATURATION=1;si.DEFAULT_GAMMA=1;si.DEFAULT_SPLIT=Py.NONE;si.DEFAULT_MINIFICATION_FILTER=Wn.LINEAR;si.DEFAULT_MAGNIFICATION_FILTER=Ps.LINEAR;si.DEFAULT_APPLY_COLOR_TO_ALPHA_THRESHOLD=.004;si.prototype.isBaseLayer=function(){return this._isBaseLayer};si.prototype.isDestroyed=function(){return!1};si.prototype.destroy=function(){return Je(this)};const $J=new Ee,O8=new Ee,EB=new Ee,XJ=new Ee;si.prototype.getViewableRectangle=function(){const e=this._imageryProvider,t=this._rectangle;return e.readyPromise.then(function(){return Ee.intersection(e.rectangle,t)})};si.prototype._createTileImagerySkeletons=function(e,t,n){const i=e.data;if(l(this._minimumTerrainLevel)&&e.level<this._minimumTerrainLevel||l(this._maximumTerrainLevel)&&e.level>this._maximumTerrainLevel)return!1;const o=this._imageryProvider;if(l(n)||(n=i.imagery.length),!o.ready)return this._skeletonPlaceholder.loadingImagery.addReference(),i.imagery.splice(n,0,this._skeletonPlaceholder),!0;const r=o.tilingScheme.projection instanceof Ii&&e.rectangle.north<Ii.MaximumLatitude&&e.rectangle.south>-Ii.MaximumLatitude,s=Ee.intersection(o.rectangle,this._rectangle,$J);let a=Ee.intersection(e.rectangle,s,O8);if(!l(a)){if(!this.isBaseLayer())return!1;const m=s,P=e.rectangle;a=O8,P.south>=m.north?a.north=a.south=m.north:P.north<=m.south?a.north=a.south=m.south:(a.south=Math.max(P.south,m.south),a.north=Math.min(P.north,m.north)),P.west>=m.east?a.west=a.east=m.east:P.east<=m.west?a.west=a.east=m.west:(a.west=Math.max(P.west,m.west),a.east=Math.min(P.east,m.east))}let c=0;a.south>0?c=a.south:a.north<0&&(c=a.north);const f=1*t.getLevelMaximumGeometricError(e.level);let h=eFe(this,f,c);h=Math.max(0,h);const _=o.maximumLevel;if(h>_&&(h=_),l(o.minimumLevel)){const m=o.minimumLevel;h<m&&(h=m)}const g=o.tilingScheme,p=g.positionToTileXY(Ee.northwest(a),h),y=g.positionToTileXY(Ee.southeast(a),h);let T=e.rectangle.width/512,b=e.rectangle.height/512;const x=g.tileXYToRectangle(p.x,p.y,h);Math.abs(x.south-e.rectangle.north)<b&&p.y<y.y&&++p.y,Math.abs(x.east-e.rectangle.west)<T&&p.x<y.x&&++p.x;const v=g.tileXYToRectangle(y.x,y.y,h);Math.abs(v.north-e.rectangle.south)<b&&y.y>p.y&&--y.y,Math.abs(v.west-e.rectangle.east)<T&&y.x>p.x&&--y.x;const D=Ee.clone(e.rectangle,XJ);let L=g.tileXYToRectangle(p.x,p.y,h),B=Ee.intersection(L,s,EB),V;r?(g.rectangleToNativeRectangle(D,D),g.rectangleToNativeRectangle(L,L),g.rectangleToNativeRectangle(B,B),g.rectangleToNativeRectangle(s,s),V=g.tileXYToNativeRectangle.bind(g),T=D.width/512,b=D.height/512):V=g.tileXYToRectangle.bind(g);let M,H=0,G=1,I;!this.isBaseLayer()&&Math.abs(B.west-D.west)>=T&&(H=Math.min(1,(B.west-D.west)/D.width)),!this.isBaseLayer()&&Math.abs(B.north-D.north)>=b&&(G=Math.max(0,(B.north-D.south)/D.height));const O=G;for(let m=p.x;m<=y.x;m++)if(M=H,L=V(m,p.y,h),B=Ee.simpleIntersection(L,s,EB),!!l(B)){H=Math.min(1,(B.east-D.west)/D.width),m===y.x&&(this.isBaseLayer()||Math.abs(B.east-D.east)<T)&&(H=1),G=O;for(let P=p.y;P<=y.y;P++){if(I=G,L=V(m,P,h),B=Ee.simpleIntersection(L,s,EB),!l(B))continue;G=Math.max(0,(B.south-D.south)/D.height),P===y.y&&(this.isBaseLayer()||Math.abs(B.south-D.south)<b)&&(G=0);const R=new ue(M,G,H,I),U=this.getImageryFromCache(m,P,h);i.imagery.splice(n,0,new Q1(U,R,r)),++n}}return!0};si.prototype._calculateTextureTranslationAndScale=function(e,t){let n=t.readyImagery.rectangle,i=e.rectangle;if(t.useWebMercatorT){const c=t.readyImagery.imageryLayer.imageryProvider.tilingScheme;n=c.rectangleToNativeRectangle(n,$J),i=c.rectangleToNativeRectangle(i,XJ)}const o=i.width,r=i.height,s=o/n.width,a=r/n.height;return new ue(s*(i.west-n.west)/o,a*(i.south-n.south)/r,s,a)};si.prototype._requestImagery=function(e){const t=this._imageryProvider,n=this;function i(s){if(!l(s))return o();e.image=s,e.state=zi.RECEIVED,e.request=void 0,Lo.reportSuccess(n._requestImageError)}function o(s){if(e.request.state===or.CANCELLED){e.state=zi.UNLOADED,e.request=void 0;return}e.state=zi.FAILED,e.request=void 0;const a=`Failed to obtain image tile X: ${e.x} Y: ${e.y} Level: ${e.level}.`;n._requestImageError=Lo.reportError(n._requestImageError,t,t.errorEvent,a,e.x,e.y,e.level,s),n._requestImageError.retry&&r()}function r(){const s=new Ad({throttle:!1,throttleByServer:!0,type:xy.IMAGERY});e.request=s,e.state=zi.TRANSITIONING;const a=t.requestImage(e.x,e.y,e.level,s);if(!l(a)){e.state=zi.UNLOADED,e.request=void 0;return}l(t.getTileCredits)&&(e.credits=t.getTileCredits(e.x,e.y,e.level)),a.then(function(c){i(c)}).catch(function(c){o(c)})}r()};si.prototype._createTextureWebGL=function(e,t){const n=new Ci({minificationFilter:this.minificationFilter,magnificationFilter:this.magnificationFilter}),i=t.image;return l(i.internalFormat)?new rn({context:e,pixelFormat:i.internalFormat,width:i.width,height:i.height,source:{arrayBufferView:i.bufferView},sampler:n}):new rn({context:e,source:i,pixelFormat:this._imageryProvider.hasAlphaChannel?yt.RGBA:yt.RGB,sampler:n})};si.prototype._createTexture=function(e,t){const n=this._imageryProvider,i=t.image;if(l(n.tileDiscardPolicy)){const r=n.tileDiscardPolicy;if(l(r)){if(!r.isReady()){t.state=zi.RECEIVED;return}if(r.shouldDiscardImage(i)){t.state=zi.INVALID;return}}}if(this.minificationFilter!==Wn.NEAREST&&this.minificationFilter!==Wn.LINEAR)throw new w("ImageryLayer minification filter must be NEAREST or LINEAR");const o=this._createTextureWebGL(e,t);n.tilingScheme.projection instanceof Ii?t.textureWebMercator=o:t.texture=o,t.image=void 0,t.state=zi.TEXTURE_LOADED};function L8(e,t,n){return`${e}:${t}:${n}`}si.prototype._finalizeReprojectTexture=function(e,t){let n=this.minificationFilter;const i=this.magnificationFilter;if(n===Wn.LINEAR&&i===Ps.LINEAR&&!yt.isCompressedFormat(t.pixelFormat)&&F.isPowerOfTwo(t.width)&&F.isPowerOfTwo(t.height)){n=Wn.LINEAR_MIPMAP_LINEAR;const r=Gt.maximumTextureFilterAnisotropy,s=Math.min(r,A(this._maximumAnisotropy,r)),a=L8(n,i,s);let c=e.cache.imageryLayerMipmapSamplers;l(c)||(c={},e.cache.imageryLayerMipmapSamplers=c);let u=c[a];l(u)||(u=c[a]=new Ci({wrapS:io.CLAMP_TO_EDGE,wrapT:io.CLAMP_TO_EDGE,minificationFilter:n,magnificationFilter:i,maximumAnisotropy:s})),t.generateMipmap(eT.NICEST),t.sampler=u}else{const r=L8(n,i,0);let s=e.cache.imageryLayerNonMipmapSamplers;l(s)||(s={},e.cache.imageryLayerNonMipmapSamplers=s);let a=s[r];l(a)||(a=s[r]=new Ci({wrapS:io.CLAMP_TO_EDGE,wrapT:io.CLAMP_TO_EDGE,minificationFilter:n,magnificationFilter:i})),t.sampler=a}};si.prototype._reprojectTexture=function(e,t,n){const i=t.textureWebMercator||t.texture,o=t.rectangle,r=e.context;if(n=A(n,!0),n&&!(this._imageryProvider.tilingScheme.projection instanceof Or)&&o.width/i.width>1e-5){const s=this;t.addReference();const a=new AE({persists:!0,owner:this,preExecute:function(c){ZMe(c,r,i,t.rectangle)},postExecute:function(c){t.texture=c,s._finalizeReprojectTexture(r,c),t.state=zi.READY,t.releaseReference()},canceled:function(){t.state=zi.TEXTURE_LOADED,t.releaseReference()}});this._reprojectComputeCommands.push(a)}else n&&(t.texture=i),this._finalizeReprojectTexture(r,i),t.state=zi.READY};si.prototype.queueReprojectionCommands=function(e){const t=this._reprojectComputeCommands,n=t.length;for(let i=0;i<n;++i)e.commandList.push(t[i]);t.length=0};si.prototype.cancelReprojections=function(){this._reprojectComputeCommands.forEach(function(e){l(e.canceled)&&e.canceled()}),this._reprojectComputeCommands.length=0};si.prototype.getImageryFromCache=function(e,t,n,i){const o=KJ(e,t,n);let r=this._imageryCache[o];return l(r)||(r=new ny(this,e,t,n,i),this._imageryCache[o]=r),r.addReference(),r};si.prototype.removeImageryFromCache=function(e){const t=KJ(e.x,e.y,e.level);delete this._imageryCache[t]};function KJ(e,t,n){return JSON.stringify([e,t,n])}const WS={u_textureDimensions:function(){return this.textureDimensions},u_texture:function(){return this.texture},textureDimensions:new $,texture:void 0},QMe=Mn.supportsTypedArrays()?new Float32Array(2*64):void 0;function ZMe(e,t,n,i){let o=t.cache.imageryLayer_reproject;if(!l(o)){o=t.cache.imageryLayer_reproject={vertexArray:void 0,shaderProgram:void 0,sampler:void 0,destroy:function(){l(this.framebuffer)&&this.framebuffer.destroy(),l(this.vertexArray)&&this.vertexArray.destroy(),l(this.shaderProgram)&&this.shaderProgram.destroy()}};const T=new Float32Array(2*64*2);let b=0;for(let B=0;B<64;++B){const V=B/63;T[b++]=0,T[b++]=V,T[b++]=1,T[b++]=V}const x={position:0,webMercatorT:1},v=Pr.getRegularGridIndices(2,64),D=Mt.createIndexBuffer({context:t,typedArray:v,usage:mt.STATIC_DRAW,indexDatatype:At.UNSIGNED_SHORT});o.vertexArray=new Fo({context:t,attributes:[{index:x.position,vertexBuffer:Mt.createVertexBuffer({context:t,typedArray:T,usage:mt.STATIC_DRAW}),componentsPerAttribute:2},{index:x.webMercatorT,vertexBuffer:Mt.createVertexBuffer({context:t,sizeInBytes:64*2*4,usage:mt.STREAM_DRAW}),componentsPerAttribute:1}],indexBuffer:D});const L=new nt({sources:[WOe]});o.shaderProgram=Hn.fromCache({context:t,vertexShaderSource:L,fragmentShaderSource:GOe,attributeLocations:x}),o.sampler=new Ci({wrapS:io.CLAMP_TO_EDGE,wrapT:io.CLAMP_TO_EDGE,minificationFilter:Wn.LINEAR,magnificationFilter:Ps.LINEAR})}n.sampler=o.sampler;const r=n.width,s=n.height;WS.textureDimensions.x=r,WS.textureDimensions.y=s,WS.texture=n;let a=Math.sin(i.south);const c=.5*Math.log((1+a)/(1-a));a=Math.sin(i.north);const f=1/(.5*Math.log((1+a)/(1-a))-c),h=new rn({context:t,width:r,height:s,pixelFormat:n.pixelFormat,pixelDatatype:n.pixelDatatype,preMultiplyAlpha:n.preMultiplyAlpha});F.isPowerOfTwo(r)&&F.isPowerOfTwo(s)&&h.generateMipmap(eT.NICEST);const _=i.south,g=i.north,p=QMe;let y=0;for(let T=0;T<64;++T){const b=T/63,x=F.lerp(_,g,b);a=Math.sin(x);const D=(.5*Math.log((1+a)/(1-a))-c)*f;p[y++]=D,p[y++]=D}o.vertexArray.getAttribute(1).vertexBuffer.copyFromArrayView(p),e.shaderProgram=o.shaderProgram,e.outputTexture=h,e.uniformMap=WS,e.vertexArray=o.vertexArray}function eFe(e,t,n){const i=e._imageryProvider,o=i.tilingScheme,r=o.ellipsoid,s=e._imageryProvider.tilingScheme.projection instanceof Or?1:Math.cos(n),a=o.rectangle,u=r.maximumRadius*a.width*s/(i.tileWidth*o.getNumberOfXTilesAtLevel(0))/t,f=Math.log(u)/Math.log(2);return Math.round(f)|0}function Ye(e){e=A(e,A.EMPTY_OBJECT),this.position=A(e.position,!1),this.normal=A(e.normal,!1),this.st=A(e.st,!1),this.bitangent=A(e.bitangent,!1),this.tangent=A(e.tangent,!1),this.color=A(e.color,!1)}Ye.POSITION_ONLY=Object.freeze(new Ye({position:!0}));Ye.POSITION_AND_NORMAL=Object.freeze(new Ye({position:!0,normal:!0}));Ye.POSITION_NORMAL_AND_ST=Object.freeze(new Ye({position:!0,normal:!0,st:!0}));Ye.POSITION_AND_ST=Object.freeze(new Ye({position:!0,st:!0}));Ye.POSITION_AND_COLOR=Object.freeze(new Ye({position:!0,color:!0}));Ye.ALL=Object.freeze(new Ye({position:!0,normal:!0,st:!0,tangent:!0,bitangent:!0}));Ye.DEFAULT=Ye.POSITION_NORMAL_AND_ST;Ye.packedLength=6;Ye.pack=function(e,t,n){if(!l(e))throw new w("value is required");if(!l(t))throw new w("array is required");return n=A(n,0),t[n++]=e.position?1:0,t[n++]=e.normal?1:0,t[n++]=e.st?1:0,t[n++]=e.tangent?1:0,t[n++]=e.bitangent?1:0,t[n]=e.color?1:0,t};Ye.unpack=function(e,t,n){if(!l(e))throw new w("array is required");return t=A(t,0),l(n)||(n=new Ye),n.position=e[t++]===1,n.normal=e[t++]===1,n.st=e[t++]===1,n.tangent=e[t++]===1,n.bitangent=e[t++]===1,n.color=e[t]===1,n};Ye.clone=function(e,t){if(l(e))return l(t)||(t=new Ye),t.position=e.position,t.normal=e.normal,t.st=e.st,t.tangent=e.tangent,t.bitangent=e.bitangent,t.color=e.color,t};const tFe=`varying vec3 v_positionEC;
|
||
varying vec3 v_normalEC;
|
||
varying vec4 v_color;
|
||
|
||
void main()
|
||
{
|
||
vec3 positionToEyeEC = -v_positionEC;
|
||
|
||
vec3 normalEC = normalize(v_normalEC);
|
||
#ifdef FACE_FORWARD
|
||
normalEC = faceforward(normalEC, vec3(0.0, 0.0, 1.0), -normalEC);
|
||
#endif
|
||
|
||
vec4 color = czm_gammaCorrect(v_color);
|
||
|
||
czm_materialInput materialInput;
|
||
materialInput.normalEC = normalEC;
|
||
materialInput.positionToEyeEC = positionToEyeEC;
|
||
czm_material material = czm_getDefaultMaterial(materialInput);
|
||
material.diffuse = color.rgb;
|
||
material.alpha = color.a;
|
||
|
||
gl_FragColor = czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC);
|
||
}
|
||
`,nFe=`attribute vec3 position3DHigh;
|
||
attribute vec3 position3DLow;
|
||
attribute vec3 normal;
|
||
attribute vec4 color;
|
||
attribute float batchId;
|
||
|
||
varying vec3 v_positionEC;
|
||
varying vec3 v_normalEC;
|
||
varying vec4 v_color;
|
||
|
||
void main()
|
||
{
|
||
vec4 p = czm_computePosition();
|
||
|
||
v_positionEC = (czm_modelViewRelativeToEye * p).xyz; // position in eye coordinates
|
||
v_normalEC = czm_normal * normal; // normal in eye coordinates
|
||
v_color = color;
|
||
|
||
gl_Position = czm_modelViewProjectionRelativeToEye * p;
|
||
}
|
||
`,JJ=`varying vec4 v_color;
|
||
|
||
void main()
|
||
{
|
||
gl_FragColor = czm_gammaCorrect(v_color);
|
||
}
|
||
`,iFe=`attribute vec3 position3DHigh;
|
||
attribute vec3 position3DLow;
|
||
attribute vec4 color;
|
||
attribute float batchId;
|
||
|
||
varying vec4 v_color;
|
||
|
||
void main()
|
||
{
|
||
vec4 p = czm_computePosition();
|
||
|
||
v_color = color;
|
||
|
||
gl_Position = czm_modelViewProjectionRelativeToEye * p;
|
||
}
|
||
`,oFe={FRONT:fe.FRONT,BACK:fe.BACK,FRONT_AND_BACK:fe.FRONT_AND_BACK},mr=Object.freeze(oFe);function ns(e){e=A(e,A.EMPTY_OBJECT),this.material=e.material,this.translucent=A(e.translucent,!0),this._vertexShaderSource=e.vertexShaderSource,this._fragmentShaderSource=e.fragmentShaderSource,this._renderState=e.renderState,this._closed=A(e.closed,!1)}Object.defineProperties(ns.prototype,{vertexShaderSource:{get:function(){return this._vertexShaderSource}},fragmentShaderSource:{get:function(){return this._fragmentShaderSource}},renderState:{get:function(){return this._renderState}},closed:{get:function(){return this._closed}}});ns.prototype.getFragmentShaderSource=function(){const e=[];return this.flat&&e.push("#define FLAT"),this.faceForward&&e.push("#define FACE_FORWARD"),l(this.material)&&e.push(this.material.shaderSource),e.push(this.fragmentShaderSource),e.join(`
|
||
`)};ns.prototype.isTranslucent=function(){return l(this.material)&&this.material.isTranslucent()||!l(this.material)&&this.translucent};ns.prototype.getRenderState=function(){const e=this.isTranslucent(),t=St(this.renderState,!1);return e?(t.depthMask=!1,t.blending=fo.ALPHA_BLEND):t.depthMask=!0,t};ns.getDefaultRenderState=function(e,t,n){let i={depthTest:{enabled:!0}};return e&&(i.depthMask=!1,i.blending=fo.ALPHA_BLEND),t&&(i.cull={enabled:!0,face:mr.BACK}),l(n)&&(i=Ln(n,i,!0)),i};function kn(e){e=A(e,A.EMPTY_OBJECT);const t=A(e.translucent,!0),n=A(e.closed,!1),i=A(e.flat,!1),o=i?iFe:nFe,r=i?JJ:tFe,s=i?kn.FLAT_VERTEX_FORMAT:kn.VERTEX_FORMAT;this.material=void 0,this.translucent=t,this._vertexShaderSource=A(e.vertexShaderSource,o),this._fragmentShaderSource=A(e.fragmentShaderSource,r),this._renderState=ns.getDefaultRenderState(t,n,e.renderState),this._closed=n,this._vertexFormat=s,this._flat=i,this._faceForward=A(e.faceForward,!n)}Object.defineProperties(kn.prototype,{vertexShaderSource:{get:function(){return this._vertexShaderSource}},fragmentShaderSource:{get:function(){return this._fragmentShaderSource}},renderState:{get:function(){return this._renderState}},closed:{get:function(){return this._closed}},vertexFormat:{get:function(){return this._vertexFormat}},flat:{get:function(){return this._flat}},faceForward:{get:function(){return this._faceForward}}});kn.VERTEX_FORMAT=Ye.POSITION_AND_NORMAL;kn.FLAT_VERTEX_FORMAT=Ye.POSITION_ONLY;kn.prototype.getFragmentShaderSource=ns.prototype.getFragmentShaderSource;kn.prototype.isTranslucent=ns.prototype.isTranslucent;kn.prototype.getRenderState=ns.prototype.getRenderState;function rFe(e,t){if(!l(e))throw new w("array is required.");if(!l(t)||t<1)throw new w("numberOfArrays must be greater than 0.");const n=[],i=e.length;let o=0;for(;o<i;){const r=Math.ceil((i-o)/t--);n.push(e.slice(o,o+r)),o+=r}return n}function Bd(e,t,n){if(!l(e))throw new w("context is required");if(!l(t))throw new w("attributes is required");if(!l(n))throw new w("numberOfInstances is required");if(this._attributes=t,this._numberOfInstances=n,t.length===0)return;const i=sFe(t),o=e.floatingPointTexture,r=i===ft.FLOAT&&!o,s=aFe(t,r),a=cFe(s,t,r),c=Math.floor(Gt.maximumTextureSize/a),u=Math.min(n,c),f=a*u,h=Math.ceil(n/u),_=1/f,g=_*.5,p=1/h,y=p*.5;this._textureDimensions=new $(f,h),this._textureStep=new ue(_,g,p,y),this._pixelDatatype=r?ft.UNSIGNED_BYTE:i,this._packFloats=r,this._offsets=s,this._stride=a,this._texture=void 0;const T=4*f*h;this._batchValues=i===ft.FLOAT&&!r?new Float32Array(T):new Uint8Array(T),this._batchValuesDirty=!1}Object.defineProperties(Bd.prototype,{attributes:{get:function(){return this._attributes}},numberOfInstances:{get:function(){return this._numberOfInstances}}});function sFe(e){let t=!1;const n=e.length;for(let i=0;i<n;++i)if(e[i].componentDatatype!==oe.UNSIGNED_BYTE){t=!0;break}return t?ft.FLOAT:ft.UNSIGNED_BYTE}function QJ(e,t){const n=e[t].componentsPerAttribute;return n===2?$:n===3?d:n===4?ue:Number}function aFe(e,t){const n=new Array(e.length);let i=0;const o=e.length;for(let r=0;r<o;++r){const a=e[r].componentDatatype;n[r]=i,a!==oe.UNSIGNED_BYTE&&t?i+=4:++i}return n}function cFe(e,t,n){const i=e.length,o=e[i-1];return t[i-1].componentDatatype!==oe.UNSIGNED_BYTE&&n?o+4:o+1}const hb=new ue;function lFe(e,t,n){let i=ue.unpack(e,t,hb);const o=ue.unpackFloat(i);i=ue.unpack(e,t+4,hb);const r=ue.unpackFloat(i);i=ue.unpack(e,t+8,hb);const s=ue.unpackFloat(i);i=ue.unpack(e,t+12,hb);const a=ue.unpackFloat(i);return ue.fromElements(o,r,s,a,n)}function uFe(e,t,n){let i=ue.packFloat(e.x,hb);ue.pack(i,t,n),i=ue.packFloat(e.y,i),ue.pack(i,t,n+4),i=ue.packFloat(e.z,i),ue.pack(i,t,n+8),i=ue.packFloat(e.w,i),ue.pack(i,t,n+12)}const B8=new ue;Bd.prototype.getBatchedAttribute=function(e,t,n){if(e<0||e>=this._numberOfInstances)throw new w("instanceIndex is out of range.");if(t<0||t>=this._attributes.length)throw new w("attributeIndex is out of range");const i=this._attributes,o=this._offsets[t],s=4*this._stride*e+4*o;let a;this._packFloats&&i[t].componentDatatype!==ft.UNSIGNED_BYTE?a=lFe(this._batchValues,s,B8):a=ue.unpack(this._batchValues,s,B8);const c=QJ(i,t);return l(c.fromCartesian4)?c.fromCartesian4(a,n):l(c.clone)?c.clone(a,n):a.x};const fFe=[void 0,void 0,new $,new d,new ue],dFe=new ue;Bd.prototype.setBatchedAttribute=function(e,t,n){if(e<0||e>=this._numberOfInstances)throw new w("instanceIndex is out of range.");if(t<0||t>=this._attributes.length)throw new w("attributeIndex is out of range");if(!l(n))throw new w("value is required.");const i=this._attributes,o=fFe[i[t].componentsPerAttribute],r=this.getBatchedAttribute(e,t,o),s=QJ(this._attributes,t);if(l(s.equals)?s.equals(r,n):r===n)return;const c=dFe;c.x=l(n.x)?n.x:n,c.y=l(n.y)?n.y:0,c.z=l(n.z)?n.z:0,c.w=l(n.w)?n.w:0;const u=this._offsets[t],h=4*this._stride*e+4*u;this._packFloats&&i[t].componentDatatype!==ft.UNSIGNED_BYTE?uFe(c,this._batchValues,h):ue.pack(c,this._batchValues,h),this._batchValuesDirty=!0};function hFe(e,t){const n=e._textureDimensions;e._texture=new rn({context:t,pixelFormat:yt.RGBA,pixelDatatype:e._pixelDatatype,width:n.x,height:n.y,sampler:Ci.NEAREST,flipY:!1})}function pFe(e){const t=e._textureDimensions;e._texture.copyFrom({source:{width:t.x,height:t.y,arrayBufferView:e._batchValues}})}Bd.prototype.update=function(e){l(this._texture)&&!this._batchValuesDirty||this._attributes.length===0||(this._batchValuesDirty=!1,l(this._texture)||hFe(this,e.context),pFe(this))};Bd.prototype.getUniformMapCallback=function(){const e=this;return function(t){return e._attributes.length===0?t:Ln(t,{batchTexture:function(){return e._texture},batchTextureDimensions:function(){return e._textureDimensions},batchTextureStep:function(){return e._textureStep}})}};function mFe(e){const t=e._stride;return e._textureDimensions.y===1?`uniform vec4 batchTextureStep;
|
||
vec2 computeSt(float batchId)
|
||
{
|
||
float stepX = batchTextureStep.x;
|
||
float centerX = batchTextureStep.y;
|
||
float numberOfAttributes = float(${t});
|
||
return vec2(centerX + (batchId * numberOfAttributes * stepX), 0.5);
|
||
}
|
||
`:`uniform vec4 batchTextureStep;
|
||
uniform vec2 batchTextureDimensions;
|
||
vec2 computeSt(float batchId)
|
||
{
|
||
float stepX = batchTextureStep.x;
|
||
float centerX = batchTextureStep.y;
|
||
float stepY = batchTextureStep.z;
|
||
float centerY = batchTextureStep.w;
|
||
float numberOfAttributes = float(${t});
|
||
float xId = mod(batchId * numberOfAttributes, batchTextureDimensions.x);
|
||
float yId = floor(batchId * numberOfAttributes / batchTextureDimensions.x);
|
||
return vec2(centerX + (xId * stepX), centerY + (yId * stepY));
|
||
}
|
||
`}function _Fe(e){return e===1?"float":`vec${e}`}function gFe(e){return e===1?".x":e===2?".xy":e===3?".xyz":""}function yFe(e,t){const i=e._attributes[t],o=i.componentsPerAttribute,r=i.functionName,s=_Fe(o),a=gFe(o),c=e._offsets[t];let u=`${s} ${r}(float batchId)
|
||
{
|
||
vec2 st = computeSt(batchId);
|
||
st.x += batchTextureStep.x * float(${c});
|
||
`;return e._packFloats&&i.componentDatatype!==ft.UNSIGNED_BYTE?u+=`vec4 textureValue;
|
||
textureValue.x = czm_unpackFloat(texture2D(batchTexture, st));
|
||
textureValue.y = czm_unpackFloat(texture2D(batchTexture, st + vec2(batchTextureStep.x, 0.0)));
|
||
textureValue.z = czm_unpackFloat(texture2D(batchTexture, st + vec2(batchTextureStep.x * 2.0, 0.0)));
|
||
textureValue.w = czm_unpackFloat(texture2D(batchTexture, st + vec2(batchTextureStep.x * 3.0, 0.0)));
|
||
`:u+=` vec4 textureValue = texture2D(batchTexture, st);
|
||
`,u+=` ${s} value = textureValue${a};
|
||
`,e._pixelDatatype===ft.UNSIGNED_BYTE&&i.componentDatatype===oe.UNSIGNED_BYTE&&!i.normalize?u+=`value *= 255.0;
|
||
`:e._pixelDatatype===ft.FLOAT&&i.componentDatatype===oe.UNSIGNED_BYTE&&i.normalize&&(u+=`value /= 255.0;
|
||
`),u+=` return value;
|
||
}
|
||
`,u}Bd.prototype.getVertexShaderCallback=function(){const e=this._attributes;if(e.length===0)return function(i){return i};let t=`uniform highp sampler2D batchTexture;
|
||
`;t+=`${mFe(this)}
|
||
`;const n=e.length;for(let i=0;i<n;++i)t+=yFe(this,i);return function(i){const o=i.indexOf("void main"),r=i.substring(0,o),s=i.substring(o);return`${r}
|
||
${t}
|
||
${s}`}};Bd.prototype.isDestroyed=function(){return!1};Bd.prototype.destroy=function(){return this._texture=this._texture&&this._texture.destroy(),Je(this)};function Ar(e,t,n){e=A(e,0),t=A(t,0),n=A(n,0),this.value=new Float32Array([e,t,n])}Object.defineProperties(Ar.prototype,{componentDatatype:{get:function(){return oe.FLOAT}},componentsPerAttribute:{get:function(){return 3}},normalize:{get:function(){return!1}}});Ar.fromCartesian3=function(e){return E.defined("offset",e),new Ar(e.x,e.y,e.z)};Ar.toValue=function(e,t){return E.defined("offset",e),l(t)||(t=new Float32Array([e.x,e.y,e.z])),t[0]=e.x,t[1]=e.y,t[2]=e.z,t};function AFe(e,t,n){let i=!n;const o=e.length;let r;if(!i&&o>1){const s=e[0].modelMatrix;for(r=1;r<o;++r)if(!N.equals(s,e[r].modelMatrix)){i=!0;break}}if(i)for(r=0;r<o;++r)l(e[r].geometry)&&mo.transformToWorldCoordinates(e[r]);else N.multiplyTransformation(t,e[0].modelMatrix,t)}function xB(e,t){const n=e.attributes,i=n.position,o=i.values.length/i.componentsPerAttribute;n.batchId=new Xe({componentDatatype:oe.FLOAT,componentsPerAttribute:1,values:new Float32Array(o)});const r=n.batchId.values;for(let s=0;s<o;++s)r[s]=t}function TFe(e){const t=e.length;for(let n=0;n<t;++n){const i=e[n];l(i.geometry)?xB(i.geometry,n):l(i.westHemisphereGeometry)&&l(i.eastHemisphereGeometry)&&(xB(i.westHemisphereGeometry,n),xB(i.eastHemisphereGeometry,n))}}function CFe(e){const t=e.instances,n=e.projection,i=e.elementIndexUintSupported,o=e.scene3DOnly,r=e.vertexCacheOptimize,s=e.compressVertices,a=e.modelMatrix;let c,u,f,h=t.length;for(c=0;c<h;++c)if(l(t[c].geometry)){f=t[c].geometry.primitiveType;break}for(c=1;c<h;++c)if(l(t[c].geometry)&&t[c].geometry.primitiveType!==f)throw new w("All instance geometries must have the same primitiveType.");if(AFe(t,a,o),!o)for(c=0;c<h;++c)l(t[c].geometry)&&mo.splitLongitude(t[c]);if(TFe(t),r)for(c=0;c<h;++c){const g=t[c];l(g.geometry)?(mo.reorderForPostVertexCache(g.geometry),mo.reorderForPreVertexCache(g.geometry)):l(g.westHemisphereGeometry)&&l(g.eastHemisphereGeometry)&&(mo.reorderForPostVertexCache(g.westHemisphereGeometry),mo.reorderForPreVertexCache(g.westHemisphereGeometry),mo.reorderForPostVertexCache(g.eastHemisphereGeometry),mo.reorderForPreVertexCache(g.eastHemisphereGeometry))}let _=mo.combineInstances(t);for(h=_.length,c=0;c<h;++c){u=_[c];const g=u.attributes;if(o)for(const p in g)g.hasOwnProperty(p)&&g[p].componentDatatype===oe.DOUBLE&&mo.encodeAttribute(u,p,`${p}3DHigh`,`${p}3DLow`);else for(const p in g)if(g.hasOwnProperty(p)&&g[p].componentDatatype===oe.DOUBLE){const y=`${p}3D`,T=`${p}2D`;mo.projectTo2D(u,p,y,T,n),l(u.boundingSphere)&&p==="position"&&(u.boundingSphereCV=Ae.fromVertices(u.attributes.position2D.values)),mo.encodeAttribute(u,y,`${y}High`,`${y}Low`),mo.encodeAttribute(u,T,`${T}High`,`${T}Low`)}s&&mo.compressVertices(u)}if(!i){let g=[];for(h=_.length,c=0;c<h;++c)u=_[c],g=g.concat(mo.fitToUnsignedShortIndices(u));_=g}return _}function wB(e,t,n,i){let o,r,s;const a=i.length-1;if(a>=0){const u=i[a];o=u.offset+u.count,s=u.index,r=n[s].indices.length}else o=0,s=0,r=n[s].indices.length;const c=e.length;for(let u=0;u<c;++u){const h=e[u][t];if(!l(h))continue;const _=h.indices.length;o+_>r&&(o=0,r=n[++s].indices.length),i.push({index:s,offset:o,count:_}),o+=_}}function bFe(e,t){const n=[];return wB(e,"geometry",t,n),wB(e,"westHemisphereGeometry",t,n),wB(e,"eastHemisphereGeometry",t,n),n}const Kh={};Kh.combineGeometry=function(e){let t,n;const i=e.instances,o=i.length;let r,s,a=!1;o>0&&(t=CFe(e),t.length>0&&(n=mo.createAttributeLocations(t[0]),e.createPickOffsets&&(r=bFe(i,t))),l(i[0].attributes)&&l(i[0].attributes.offset)&&(s=new Array(o),a=!0));const c=new Array(o),u=new Array(o);for(let f=0;f<o;++f){const h=i[f],_=h.geometry;l(_)&&(c[f]=_.boundingSphere,u[f]=_.boundingSphereCV,a&&(s[f]=h.geometry.offsetAttribute));const g=h.eastHemisphereGeometry,p=h.westHemisphereGeometry;l(g)&&l(p)&&(l(g.boundingSphere)&&l(p.boundingSphere)&&(c[f]=Ae.union(g.boundingSphere,p.boundingSphere)),l(g.boundingSphereCV)&&l(p.boundingSphereCV)&&(u[f]=Ae.union(g.boundingSphereCV,p.boundingSphereCV)))}return{geometries:t,modelMatrix:e.modelMatrix,attributeLocations:n,pickOffsets:r,offsetInstanceExtend:s,boundingSpheres:c,boundingSpheresCV:u}};function EFe(e,t){const n=e.attributes;for(const i in n)if(n.hasOwnProperty(i)){const o=n[i];l(o)&&l(o.values)&&t.push(o.values.buffer)}l(e.indices)&&t.push(e.indices.buffer)}function xFe(e,t){const n=e.length;for(let i=0;i<n;++i)EFe(e[i],t)}function wFe(e){let t=1;const n=e.length;for(let i=0;i<n;i++){const o=e[i];if(++t,!l(o))continue;const r=o.attributes;t+=7+2*Ae.packedLength+(l(o.indices)?o.indices.length:0);for(const s in r)if(r.hasOwnProperty(s)&&l(r[s])){const a=r[s];t+=5+a.values.length}}return t}Kh.packCreateGeometryResults=function(e,t){const n=new Float64Array(wFe(e)),i=[],o={},r=e.length;let s=0;n[s++]=r;for(let a=0;a<r;a++){const c=e[a],u=l(c);if(n[s++]=u?1:0,!u)continue;n[s++]=c.primitiveType,n[s++]=c.geometryType,n[s++]=A(c.offsetAttribute,-1);const f=l(c.boundingSphere)?1:0;n[s++]=f,f&&Ae.pack(c.boundingSphere,n,s),s+=Ae.packedLength;const h=l(c.boundingSphereCV)?1:0;n[s++]=h,h&&Ae.pack(c.boundingSphereCV,n,s),s+=Ae.packedLength;const _=c.attributes,g=[];for(const y in _)_.hasOwnProperty(y)&&l(_[y])&&(g.push(y),l(o[y])||(o[y]=i.length,i.push(y)));n[s++]=g.length;for(let y=0;y<g.length;y++){const T=g[y],b=_[T];n[s++]=o[T],n[s++]=b.componentDatatype,n[s++]=b.componentsPerAttribute,n[s++]=b.normalize?1:0,n[s++]=b.values.length,n.set(b.values,s),s+=b.values.length}const p=l(c.indices)?c.indices.length:0;n[s++]=p,p>0&&(n.set(c.indices,s),s+=p)}return t.push(n.buffer),{stringTable:i,packedData:n}};Kh.unpackCreateGeometryResults=function(e){const t=e.stringTable,n=e.packedData;let i;const o=new Array(n[0]);let r=0,s=1;for(;s<n.length;){if(!(n[s++]===1)){o[r++]=void 0;continue}const c=n[s++],u=n[s++];let f=n[s++];f===-1&&(f=void 0);let h,_;n[s++]===1&&(h=Ae.unpack(n,s)),s+=Ae.packedLength,n[s++]===1&&(_=Ae.unpack(n,s)),s+=Ae.packedLength;let y,T,b;const x=new To,v=n[s++];for(i=0;i<v;i++){const L=t[n[s++]],B=n[s++];b=n[s++];const V=n[s++]!==0;y=n[s++],T=oe.createTypedArray(B,y);for(let M=0;M<y;M++)T[M]=n[s++];x[L]=new Xe({componentDatatype:B,componentsPerAttribute:b,normalize:V,values:T})}let D;if(y=n[s++],y>0){const L=T.length/b;for(D=At.createTypedArray(L,y),i=0;i<y;i++)D[i]=n[s++]}o[r++]=new $t({primitiveType:c,geometryType:u,boundingSphere:h,boundingSphereCV:_,indices:D,attributes:x,offsetAttribute:f})}return o};function SFe(e,t){const n=e.length,i=new Float64Array(1+n*19);let o=0;i[o++]=n;for(let r=0;r<n;r++){const s=e[r];if(N.pack(s.modelMatrix,i,o),o+=N.packedLength,l(s.attributes)&&l(s.attributes.offset)){const a=s.attributes.offset.value;i[o]=a[0],i[o+1]=a[1],i[o+2]=a[2]}o+=3}return t.push(i.buffer),i}function vFe(e){const t=e,n=new Array(t[0]);let i=0,o=1;for(;o<t.length;){const r=N.unpack(t,o);let s;o+=N.packedLength,l(t[o])&&(s={offset:new Ar(t[o],t[o+1],t[o+2])}),o+=3,n[i++]={modelMatrix:r,attributes:s}}return n}Kh.packCombineGeometryParameters=function(e,t){const n=e.createGeometryResults,i=n.length;for(let o=0;o<i;o++)t.push(n[o].packedData.buffer);return{createGeometryResults:e.createGeometryResults,packedInstances:SFe(e.instances,t),ellipsoid:e.ellipsoid,isGeographic:e.projection instanceof Or,elementIndexUintSupported:e.elementIndexUintSupported,scene3DOnly:e.scene3DOnly,vertexCacheOptimize:e.vertexCacheOptimize,compressVertices:e.compressVertices,modelMatrix:e.modelMatrix,createPickOffsets:e.createPickOffsets}};Kh.unpackCombineGeometryParameters=function(e){const t=vFe(e.packedInstances),n=e.createGeometryResults,i=n.length;let o=0;for(let a=0;a<i;a++){const c=Kh.unpackCreateGeometryResults(n[a]),u=c.length;for(let f=0;f<u;f++){const h=c[f],_=t[o];_.geometry=h,++o}}const r=be.clone(e.ellipsoid),s=e.isGeographic?new Or(r):new Ii(r);return{instances:t,ellipsoid:r,projection:s,elementIndexUintSupported:e.elementIndexUintSupported,scene3DOnly:e.scene3DOnly,vertexCacheOptimize:e.vertexCacheOptimize,compressVertices:e.compressVertices,modelMatrix:N.clone(e.modelMatrix),createPickOffsets:e.createPickOffsets}};function R8(e){const t=e.length,n=1+(Ae.packedLength+1)*t,i=new Float32Array(n);let o=0;i[o++]=t;for(let r=0;r<t;++r){const s=e[r];l(s)?(i[o++]=1,Ae.pack(e[r],i,o)):i[o++]=0,o+=Ae.packedLength}return i}function N8(e){const t=new Array(e[0]);let n=0,i=1;for(;i<e.length;)e[i++]===1&&(t[n]=Ae.unpack(e,i)),++n,i+=Ae.packedLength;return t}Kh.packCombineGeometryResults=function(e,t){l(e.geometries)&&xFe(e.geometries,t);const n=R8(e.boundingSpheres),i=R8(e.boundingSpheresCV);return t.push(n.buffer,i.buffer),{geometries:e.geometries,attributeLocations:e.attributeLocations,modelMatrix:e.modelMatrix,pickOffsets:e.pickOffsets,offsetInstanceExtend:e.offsetInstanceExtend,boundingSpheres:n,boundingSpheresCV:i}};Kh.unpackCombineGeometryResults=function(e){return{geometries:e.geometries,attributeLocations:e.attributeLocations,modelMatrix:e.modelMatrix,pickOffsets:e.pickOffsets,offsetInstanceExtend:e.offsetInstanceExtend,boundingSpheres:N8(e.boundingSpheres),boundingSpheresCV:N8(e.boundingSpheresCV)}};const aF=Kh,DFe={READY:0,CREATING:1,CREATED:2,COMBINING:3,COMBINED:4,COMPLETE:5,FAILED:6},as=Object.freeze(DFe),tl={DISABLED:0,ENABLED:1,CAST_ONLY:2,RECEIVE_ONLY:3};tl.NUMBER_OF_SHADOW_MODES=4;tl.castShadows=function(e){return e===tl.ENABLED||e===tl.CAST_ONLY};tl.receiveShadows=function(e){return e===tl.ENABLED||e===tl.RECEIVE_ONLY};tl.fromCastReceive=function(e,t){return e&&t?tl.ENABLED:e?tl.CAST_ONLY:t?tl.RECEIVE_ONLY:tl.DISABLED};const sr=Object.freeze(tl);function fn(e){if(e=A(e,A.EMPTY_OBJECT),this.geometryInstances=e.geometryInstances,this.appearance=e.appearance,this._appearance=void 0,this._material=void 0,this.depthFailAppearance=e.depthFailAppearance,this._depthFailAppearance=void 0,this._depthFailMaterial=void 0,this.modelMatrix=N.clone(A(e.modelMatrix,N.IDENTITY)),this._modelMatrix=new N,this.show=A(e.show,!0),this._vertexCacheOptimize=A(e.vertexCacheOptimize,!1),this._interleave=A(e.interleave,!1),this._releaseGeometryInstances=A(e.releaseGeometryInstances,!0),this._allowPicking=A(e.allowPicking,!0),this._asynchronous=A(e.asynchronous,!0),this._compressVertices=A(e.compressVertices,!0),this.cull=A(e.cull,!0),this.debugShowBoundingVolume=A(e.debugShowBoundingVolume,!1),this.rtcCenter=e.rtcCenter,l(this.rtcCenter)&&(!l(this.geometryInstances)||Array.isArray(this.geometryInstances)&&this.geometryInstances.length!==1))throw new w("Relative-to-center rendering only supports one geometry instance.");this.shadows=A(e.shadows,sr.DISABLED),this._translucent=void 0,this._state=as.READY,this._geometries=[],this._error=void 0,this._numberOfInstances=0,this._boundingSpheres=[],this._boundingSphereWC=[],this._boundingSphereCV=[],this._boundingSphere2D=[],this._boundingSphereMorph=[],this._perInstanceAttributeCache=[],this._instanceIds=[],this._lastPerInstanceAttributeIndex=0,this._va=[],this._attributeLocations=void 0,this._primitiveType=void 0,this._frontFaceRS=void 0,this._backFaceRS=void 0,this._sp=void 0,this._depthFailAppearance=void 0,this._spDepthFail=void 0,this._frontFaceDepthFailRS=void 0,this._backFaceDepthFailRS=void 0,this._pickIds=[],this._colorCommands=[],this._pickCommands=[],this._createBoundingVolumeFunction=e._createBoundingVolumeFunction,this._createRenderStatesFunction=e._createRenderStatesFunction,this._createShaderProgramFunction=e._createShaderProgramFunction,this._createCommandsFunction=e._createCommandsFunction,this._updateAndQueueCommandsFunction=e._updateAndQueueCommandsFunction,this._createPickOffsets=e._createPickOffsets,this._pickOffsets=void 0,this._createGeometryResults=void 0,this._ready=!1;const t=this;this._readyPromise=new Promise((n,i)=>{t._completeLoad=(o,r,s)=>{this._error=s,this._state=r,o.afterRender.push(function(){if(t._ready=t._state===as.COMPLETE||t._state===as.FAILED,!l(s))return n(t),!0;i(s)})}}),this._batchTable=void 0,this._batchTableAttributeIndices=void 0,this._offsetInstanceExtend=void 0,this._batchTableOffsetAttribute2DIndex=void 0,this._batchTableOffsetsUpdated=!1,this._instanceBoundingSpheres=void 0,this._instanceBoundingSpheresCV=void 0,this._tempBoundingSpheres=void 0,this._recomputeBoundingSpheres=!1,this._batchTableBoundingSpheresUpdated=!1,this._batchTableBoundingSphereAttributeIndices=void 0}Object.defineProperties(fn.prototype,{vertexCacheOptimize:{get:function(){return this._vertexCacheOptimize}},interleave:{get:function(){return this._interleave}},releaseGeometryInstances:{get:function(){return this._releaseGeometryInstances}},allowPicking:{get:function(){return this._allowPicking}},asynchronous:{get:function(){return this._asynchronous}},compressVertices:{get:function(){return this._compressVertices}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise}}});function IFe(e){const t=e.length,n=[],i=e[0].attributes;let o;for(o in i)if(i.hasOwnProperty(o)&&l(i[o])){const r=i[o];let s=!0;for(let a=1;a<t;++a){const c=e[a].attributes[o];if(!l(c)||r.componentDatatype!==c.componentDatatype||r.componentsPerAttribute!==c.componentsPerAttribute||r.normalize!==c.normalize){s=!1;break}}s&&n.push(o)}return n}const PFe=new $,OFe=new d,ZJ=new ue;function eQ(e){const t=e.length;if(t===1)return e[0];if(t===2)return $.unpack(e,0,PFe);if(t===3)return d.unpack(e,0,OFe);if(t===4)return ue.unpack(e,0,ZJ)}function LFe(e,t){const n=e.geometryInstances,i=Array.isArray(n)?n:[n],o=i.length;if(o===0)return;const r=IFe(i),s=r.length,a=[],c={},u={};let f,_=i[0].attributes,g,p,y;for(g=0;g<s;++g)p=r[g],y=_[p],c[p]=g,a.push({functionName:`czm_batchTable_${p}`,componentDatatype:y.componentDatatype,componentsPerAttribute:y.componentsPerAttribute,normalize:y.normalize});r.indexOf("distanceDisplayCondition")!==-1&&(a.push({functionName:"czm_batchTable_boundingSphereCenter3DHigh",componentDatatype:oe.FLOAT,componentsPerAttribute:3},{functionName:"czm_batchTable_boundingSphereCenter3DLow",componentDatatype:oe.FLOAT,componentsPerAttribute:3},{functionName:"czm_batchTable_boundingSphereCenter2DHigh",componentDatatype:oe.FLOAT,componentsPerAttribute:3},{functionName:"czm_batchTable_boundingSphereCenter2DLow",componentDatatype:oe.FLOAT,componentsPerAttribute:3},{functionName:"czm_batchTable_boundingSphereRadius",componentDatatype:oe.FLOAT,componentsPerAttribute:1}),u.center3DHigh=a.length-5,u.center3DLow=a.length-4,u.center2DHigh=a.length-3,u.center2DLow=a.length-2,u.radius=a.length-1),r.indexOf("offset")!==-1&&(a.push({functionName:"czm_batchTable_offset2D",componentDatatype:oe.FLOAT,componentsPerAttribute:3}),f=a.length-1),a.push({functionName:"czm_batchTable_pickColor",componentDatatype:oe.UNSIGNED_BYTE,componentsPerAttribute:4,normalize:!0});const T=a.length,b=new Bd(t,a,o);for(g=0;g<o;++g){const x=i[g];_=x.attributes;for(let V=0;V<s;++V){p=r[V],y=_[p];const M=eQ(y.value),H=c[p];b.setBatchedAttribute(g,H,M)}const v={primitive:A(x.pickPrimitive,e)};l(x.id)&&(v.id=x.id);const D=t.createPickId(v);e._pickIds.push(D);const L=D.color,B=ZJ;B.x=k.floatToByte(L.red),B.y=k.floatToByte(L.green),B.z=k.floatToByte(L.blue),B.w=k.floatToByte(L.alpha),b.setBatchedAttribute(g,T-1,B)}e._batchTable=b,e._batchTableAttributeIndices=c,e._batchTableBoundingSphereAttributeIndices=u,e._batchTableOffsetAttribute2DIndex=f}function BFe(e){let t;return Array.isArray(e.values)?t=e.values.slice(0):t=new e.values.constructor(e.values),new Xe({componentDatatype:e.componentDatatype,componentsPerAttribute:e.componentsPerAttribute,normalize:e.normalize,values:t})}function RFe(e){const t=e.attributes,n=new To;for(const o in t)t.hasOwnProperty(o)&&l(t[o])&&(n[o]=BFe(t[o]));let i;if(l(e.indices)){const o=e.indices;Array.isArray(o)?i=o.slice(0):i=new o.constructor(o)}return new $t({attributes:n,indices:i,primitiveType:e.primitiveType,boundingSphere:Ae.clone(e.boundingSphere)})}function NFe(e,t){return{geometry:t,attributes:e.attributes,modelMatrix:N.clone(e.modelMatrix),pickPrimitive:e.pickPrimitive,id:e.id}}const MFe=/attribute\s+vec(?:3|4)\s+(.*)3DHigh;/g;fn._modifyShaderPosition=function(e,t,n){let i,o="",r="",s="";for(;(i=MFe.exec(t))!==null;){const a=i[1],c=`vec4 czm_compute${a[0].toUpperCase()}${a.substr(1)}()`;c!=="vec4 czm_computePosition()"&&(o+=`${c};
|
||
`),l(e.rtcCenter)?(t=t.replace(/attribute\s+vec(?:3|4)\s+position3DHigh;/g,""),t=t.replace(/attribute\s+vec(?:3|4)\s+position3DLow;/g,""),o+=`uniform mat4 u_modifiedModelView;
|
||
`,r+=`attribute vec4 position;
|
||
`,s+=`${c}
|
||
{
|
||
return u_modifiedModelView * position;
|
||
}
|
||
|
||
`,t=t.replace(/czm_modelViewRelativeToEye\s+\*\s+/g,""),t=t.replace(/czm_modelViewProjectionRelativeToEye/g,"czm_projection")):n?s+=`${c}
|
||
{
|
||
return czm_translateRelativeToEye(${a}3DHigh, ${a}3DLow);
|
||
}
|
||
|
||
`:(r+=`attribute vec3 ${a}2DHigh;
|
||
attribute vec3 ${a}2DLow;
|
||
`,s+=`${c}
|
||
{
|
||
vec4 p;
|
||
if (czm_morphTime == 1.0)
|
||
{
|
||
p = czm_translateRelativeToEye(${a}3DHigh, ${a}3DLow);
|
||
}
|
||
else if (czm_morphTime == 0.0)
|
||
{
|
||
p = czm_translateRelativeToEye(${a}2DHigh.zxy, ${a}2DLow.zxy);
|
||
}
|
||
else
|
||
{
|
||
p = czm_columbusViewMorph(
|
||
czm_translateRelativeToEye(${a}2DHigh.zxy, ${a}2DLow.zxy),
|
||
czm_translateRelativeToEye(${a}3DHigh, ${a}3DLow),
|
||
czm_morphTime);
|
||
}
|
||
return p;
|
||
}
|
||
|
||
`)}return[o,r,t,s].join(`
|
||
`)};fn._appendShowToShader=function(e,t){return l(e._batchTableAttributeIndices.show)?`${nt.replaceMain(t,"czm_non_show_main")}
|
||
void main()
|
||
{
|
||
czm_non_show_main();
|
||
gl_Position *= czm_batchTable_show(batchId);
|
||
}`:t};fn._updateColorAttribute=function(e,t,n){if(!l(e._batchTableAttributeIndices.color)&&!l(e._batchTableAttributeIndices.depthFailColor)||t.search(/attribute\s+vec4\s+color;/g)===-1)return t;if(n&&!l(e._batchTableAttributeIndices.depthFailColor))throw new w("A depthFailColor per-instance attribute is required when using a depth fail appearance that uses a color attribute.");let i=t;return i=i.replace(/attribute\s+vec4\s+color;/g,""),n?i=i.replace(/(\b)color(\b)/g,"$1czm_batchTable_depthFailColor(batchId)$2"):i=i.replace(/(\b)color(\b)/g,"$1czm_batchTable_color(batchId)$2"),i};function M8(e){return`${nt.replaceMain(e,"czm_non_pick_main")}
|
||
varying vec4 v_pickColor;
|
||
void main()
|
||
{
|
||
czm_non_pick_main();
|
||
v_pickColor = czm_batchTable_pickColor(batchId);
|
||
}`}function F8(e){return`varying vec4 v_pickColor;
|
||
${e}`}fn._updatePickColorAttribute=function(e){let t=e.replace(/attribute\s+vec4\s+pickColor;/g,"");return t=t.replace(/(\b)pickColor(\b)/g,"$1czm_batchTable_pickColor(batchId)$2"),t};fn._appendOffsetToShader=function(e,t){if(!l(e._batchTableAttributeIndices.offset))return t;let n=`attribute float batchId;
|
||
`;n+="attribute float applyOffset;";let i=t.replace(/attribute\s+float\s+batchId;/g,n),o=`vec4 $1 = czm_computePosition();
|
||
`;return o+=` if (czm_sceneMode == czm_sceneMode3D)
|
||
`,o+=` {
|
||
`,o+=" $1 = $1 + vec4(czm_batchTable_offset(batchId) * applyOffset, 0.0);",o+=` }
|
||
`,o+=` else
|
||
`,o+=` {
|
||
`,o+=" $1 = $1 + vec4(czm_batchTable_offset2D(batchId) * applyOffset, 0.0);",o+=` }
|
||
`,i=i.replace(/vec4\s+([A-Za-z0-9_]+)\s+=\s+czm_computePosition\(\);/g,o),i};fn._appendDistanceDisplayConditionToShader=function(e,t,n){if(!l(e._batchTableAttributeIndices.distanceDisplayCondition))return t;const i=nt.replaceMain(t,"czm_non_distanceDisplayCondition_main");let o=`void main()
|
||
{
|
||
czm_non_distanceDisplayCondition_main();
|
||
vec2 distanceDisplayCondition = czm_batchTable_distanceDisplayCondition(batchId);
|
||
vec3 boundingSphereCenter3DHigh = czm_batchTable_boundingSphereCenter3DHigh(batchId);
|
||
vec3 boundingSphereCenter3DLow = czm_batchTable_boundingSphereCenter3DLow(batchId);
|
||
float boundingSphereRadius = czm_batchTable_boundingSphereRadius(batchId);
|
||
`;return n?o+=` vec4 centerRTE = czm_translateRelativeToEye(boundingSphereCenter3DHigh, boundingSphereCenter3DLow);
|
||
`:o+=` vec3 boundingSphereCenter2DHigh = czm_batchTable_boundingSphereCenter2DHigh(batchId);
|
||
vec3 boundingSphereCenter2DLow = czm_batchTable_boundingSphereCenter2DLow(batchId);
|
||
vec4 centerRTE;
|
||
if (czm_morphTime == 1.0)
|
||
{
|
||
centerRTE = czm_translateRelativeToEye(boundingSphereCenter3DHigh, boundingSphereCenter3DLow);
|
||
}
|
||
else if (czm_morphTime == 0.0)
|
||
{
|
||
centerRTE = czm_translateRelativeToEye(boundingSphereCenter2DHigh.zxy, boundingSphereCenter2DLow.zxy);
|
||
}
|
||
else
|
||
{
|
||
centerRTE = czm_columbusViewMorph(
|
||
czm_translateRelativeToEye(boundingSphereCenter2DHigh.zxy, boundingSphereCenter2DLow.zxy),
|
||
czm_translateRelativeToEye(boundingSphereCenter3DHigh, boundingSphereCenter3DLow),
|
||
czm_morphTime);
|
||
}
|
||
`,o+=` float radiusSq = boundingSphereRadius * boundingSphereRadius;
|
||
float distanceSq;
|
||
if (czm_sceneMode == czm_sceneMode2D)
|
||
{
|
||
distanceSq = czm_eyeHeight2D.y - radiusSq;
|
||
}
|
||
else
|
||
{
|
||
distanceSq = dot(centerRTE.xyz, centerRTE.xyz) - radiusSq;
|
||
}
|
||
distanceSq = max(distanceSq, 0.0);
|
||
float nearSq = distanceDisplayCondition.x * distanceDisplayCondition.x;
|
||
float farSq = distanceDisplayCondition.y * distanceDisplayCondition.y;
|
||
float show = (distanceSq >= nearSq && distanceSq <= farSq) ? 1.0 : 0.0;
|
||
gl_Position *= show;
|
||
}`,`${i}
|
||
${o}`};function z8(e,t){if(!e.compressVertices)return t;const n=t.search(/attribute\s+vec3\s+normal;/g)!==-1,i=t.search(/attribute\s+vec2\s+st;/g)!==-1;if(!n&&!i)return t;const o=t.search(/attribute\s+vec3\s+tangent;/g)!==-1,r=t.search(/attribute\s+vec3\s+bitangent;/g)!==-1;let s=i&&n?2:1;s+=o||r?1:0;const a=s>1?`vec${s}`:"float",c="compressedAttributes",u=`attribute ${a} ${c};`;let f="",h="";if(i){f+=`vec2 st;
|
||
`;const p=s>1?`${c}.x`:c;h+=` st = czm_decompressTextureCoordinates(${p});
|
||
`}n&&o&&r?(f+=`vec3 normal;
|
||
vec3 tangent;
|
||
vec3 bitangent;
|
||
`,h+=` czm_octDecode(${c}.${i?"yz":"xy"}, normal, tangent, bitangent);
|
||
`):(n&&(f+=`vec3 normal;
|
||
`,h+=` normal = czm_octDecode(${c}${s>1?`.${i?"y":"x"}`:""});
|
||
`),o&&(f+=`vec3 tangent;
|
||
`,h+=` tangent = czm_octDecode(${c}.${i&&n?"z":"y"});
|
||
`),r&&(f+=`vec3 bitangent;
|
||
`,h+=` bitangent = czm_octDecode(${c}.${i&&n?"z":"y"});
|
||
`));let _=t;_=_.replace(/attribute\s+vec3\s+normal;/g,""),_=_.replace(/attribute\s+vec2\s+st;/g,""),_=_.replace(/attribute\s+vec3\s+tangent;/g,""),_=_.replace(/attribute\s+vec3\s+bitangent;/g,""),_=nt.replaceMain(_,"czm_non_compressed_main");const g=`void main()
|
||
{
|
||
${h} czm_non_compressed_main();
|
||
}`;return[u,f,_,g].join(`
|
||
`)}function FFe(e){let t=nt.replaceMain(e,"czm_non_depth_clamp_main");return t+=`void main() {
|
||
czm_non_depth_clamp_main();
|
||
gl_Position = czm_depthClamp(gl_Position);}
|
||
`,t}function zFe(e){let t=nt.replaceMain(e,"czm_non_depth_clamp_main");return t+=`void main() {
|
||
czm_non_depth_clamp_main();
|
||
#if defined(GL_EXT_frag_depth)
|
||
#if defined(LOG_DEPTH)
|
||
czm_writeLogDepth();
|
||
#else
|
||
czm_writeDepthClamp();
|
||
#endif
|
||
#endif
|
||
}
|
||
`,t=`#ifdef GL_EXT_frag_depth
|
||
#extension GL_EXT_frag_depth : enable
|
||
#endif
|
||
${t}`,t}function U8(e,t){const n=e.vertexAttributes;for(const i in n)if(n.hasOwnProperty(i)&&!l(t[i]))throw new w(`Appearance/Geometry mismatch. The appearance requires vertex shader attribute input '${i}', which was not computed as part of the Geometry. Use the appearance's vertexFormat property when constructing the geometry.`)}function UFe(e,t){return function(){return e[t]}}const SB=Math.max(Mn.hardwareConcurrency-1,1);let qS;const HFe=new lo("combineGeometry");function VFe(e,t){let n,i,o,r;const s=e._instanceIds;if(e._state===as.READY){n=Array.isArray(e.geometryInstances)?e.geometryInstances:[e.geometryInstances];const a=e._numberOfInstances=n.length,c=[];let u=[];for(o=0;o<a;++o){if(i=n[o].geometry,s.push(n[o].id),!l(i._workerName))throw new w("_workerName must be defined for asynchronous geometry.");u.push({moduleName:i._workerName,geometry:i})}if(!l(qS))for(qS=new Array(SB),o=0;o<SB;o++)qS[o]=new lo("createGeometry");let f;for(u=rFe(u,SB),o=0;o<u.length;o++){let h=0;const _=u[o],g=_.length;for(r=0;r<g;++r)f=_[r],i=f.geometry,l(i.constructor.pack)&&(f.offset=h,h+=A(i.constructor.packedLength,i.packedLength));let p;if(h>0){const y=new Float64Array(h);for(p=[y.buffer],r=0;r<g;++r)f=_[r],i=f.geometry,l(i.constructor.pack)&&(i.constructor.pack(i,y,f.offset),f.geometry=y)}c.push(qS[o].scheduleTask({subTasks:u[o]},p))}e._state=as.CREATING,Promise.all(c).then(function(h){e._createGeometryResults=h,e._state=as.CREATED}).catch(function(h){Wb(e,t,as.FAILED,h)})}else if(e._state===as.CREATED){const a=[];n=Array.isArray(e.geometryInstances)?e.geometryInstances:[e.geometryInstances];const c=t.scene3DOnly,u=t.mapProjection,f=HFe.scheduleTask(aF.packCombineGeometryParameters({createGeometryResults:e._createGeometryResults,instances:n,ellipsoid:u.ellipsoid,projection:u,elementIndexUintSupported:t.context.elementIndexUint,scene3DOnly:c,vertexCacheOptimize:e.vertexCacheOptimize,compressVertices:e.compressVertices,modelMatrix:e.modelMatrix,createPickOffsets:e._createPickOffsets},a),a);e._createGeometryResults=void 0,e._state=as.COMBINING,Promise.resolve(f).then(function(h){const _=aF.unpackCombineGeometryResults(h);e._geometries=_.geometries,e._attributeLocations=_.attributeLocations,e.modelMatrix=N.clone(_.modelMatrix,e.modelMatrix),e._pickOffsets=_.pickOffsets,e._offsetInstanceExtend=_.offsetInstanceExtend,e._instanceBoundingSpheres=_.boundingSpheres,e._instanceBoundingSpheresCV=_.boundingSpheresCV,l(e._geometries)&&e._geometries.length>0?(e._recomputeBoundingSpheres=!0,e._state=as.COMBINED):Wb(e,t,as.FAILED,void 0)}).catch(function(h){Wb(e,t,as.FAILED,h)})}}function kFe(e,t){const n=Array.isArray(e.geometryInstances)?e.geometryInstances:[e.geometryInstances],i=e._numberOfInstances=n.length,o=new Array(i),r=e._instanceIds;let s,a,c=0;for(a=0;a<i;a++){s=n[a];const _=s.geometry;let g;l(_.attributes)&&l(_.primitiveType)?g=RFe(_):g=_.constructor.createGeometry(_),o[c++]=NFe(s,g),r.push(s.id)}o.length=c;const u=t.scene3DOnly,f=t.mapProjection,h=aF.combineGeometry({instances:o,ellipsoid:f.ellipsoid,projection:f,elementIndexUintSupported:t.context.elementIndexUint,scene3DOnly:u,vertexCacheOptimize:e.vertexCacheOptimize,compressVertices:e.compressVertices,modelMatrix:e.modelMatrix,createPickOffsets:e._createPickOffsets});e._geometries=h.geometries,e._attributeLocations=h.attributeLocations,e.modelMatrix=N.clone(h.modelMatrix,e.modelMatrix),e._pickOffsets=h.pickOffsets,e._offsetInstanceExtend=h.offsetInstanceExtend,e._instanceBoundingSpheres=h.boundingSpheres,e._instanceBoundingSpheresCV=h.boundingSpheresCV,l(e._geometries)&&e._geometries.length>0?(e._recomputeBoundingSpheres=!0,e._state=as.COMBINED):Wb(e,t,as.FAILED,void 0)}function GFe(e,t){const n=e._batchTableAttributeIndices.offset;if(!e._recomputeBoundingSpheres||!l(n)){e._recomputeBoundingSpheres=!1;return}let i;const o=e._offsetInstanceExtend,r=e._instanceBoundingSpheres,s=r.length;let a=e._tempBoundingSpheres;if(!l(a)){for(a=new Array(s),i=0;i<s;i++)a[i]=new Ae;e._tempBoundingSpheres=a}for(i=0;i<s;++i){let y=a[i];const T=e._batchTable.getBatchedAttribute(i,n,new d);y=r[i].clone(y),oQ(y,T,o[i])}const c=[],u=[],f=[];for(i=0;i<s;++i){const y=a[i];y.center.x-y.radius>0||Ae.intersectPlane(y,Wt.ORIGIN_ZX_PLANE)!==Vn.INTERSECTING?c.push(y):(u.push(y),f.push(y))}let h=c[0],_=f[0],g=u[0];for(i=1;i<c.length;i++)h=Ae.union(h,c[i]);for(i=1;i<f.length;i++)_=Ae.union(_,f[i]);for(i=1;i<u.length;i++)g=Ae.union(g,u[i]);const p=[];for(l(h)&&p.push(h),l(_)&&p.push(_),l(g)&&p.push(g),i=0;i<p.length;i++){const y=p[i].clone(e._boundingSpheres[i]);e._boundingSpheres[i]=y,e._boundingSphereCV[i]=Ae.projectTo2D(y,t.mapProjection,e._boundingSphereCV[i])}fn._updateBoundingVolumes(e,t,e.modelMatrix,!0),e._recomputeBoundingSpheres=!1}const H8=new Zn,tQ=new ve,nQ=new d,iQ=new Ae;function WFe(e,t){if(!l(e._batchTableAttributeIndices.distanceDisplayCondition)||e._batchTableBoundingSpheresUpdated)return;const i=e._batchTableBoundingSphereAttributeIndices,o=i.center3DHigh,r=i.center3DLow,s=i.center2DHigh,a=i.center2DLow,c=i.radius,u=t.mapProjection,f=u.ellipsoid,h=e._batchTable,_=e._instanceBoundingSpheres,g=_.length;for(let p=0;p<g;++p){let y=_[p];if(!l(y))continue;const T=e.modelMatrix;l(T)&&(y=Ae.transform(y,T,iQ));const b=y.center,x=y.radius;let v=Zn.fromCartesian(b,H8);if(h.setBatchedAttribute(p,o,v.high),h.setBatchedAttribute(p,r,v.low),!t.scene3DOnly){const D=f.cartesianToCartographic(b,tQ),L=u.project(D,nQ);v=Zn.fromCartesian(L,H8),h.setBatchedAttribute(p,s,v.high),h.setBatchedAttribute(p,a,v.low)}h.setBatchedAttribute(p,c,x)}e._batchTableBoundingSpheresUpdated=!0}const vB=new d,qFe=new d;function V8(e,t){if(!l(e._batchTableAttributeIndices.offset)||e._batchTableOffsetsUpdated||t.scene3DOnly)return;const i=e._batchTableOffsetAttribute2DIndex,o=t.mapProjection,r=o.ellipsoid,s=e._batchTable,a=e._instanceBoundingSpheres,c=a.length;for(let u=0;u<c;++u){let f=a[u];if(!l(f))continue;const h=s.getBatchedAttribute(u,e._batchTableAttributeIndices.offset);if(d.equals(h,d.ZERO)){s.setBatchedAttribute(u,i,d.ZERO);continue}const _=e.modelMatrix;l(_)&&(f=Ae.transform(f,_,iQ));let g=f.center;g=r.scaleToGeodeticSurface(g,qFe);let p=r.cartesianToCartographic(g,tQ);const y=o.project(p,nQ),T=d.add(h,g,vB);p=r.cartesianToCartographic(T,p);const b=o.project(p,vB),x=d.subtract(b,y,vB),v=x.x;x.x=x.z,x.z=x.y,x.y=v,s.setBatchedAttribute(u,i,x)}e._batchTableOffsetsUpdated=!0}function jFe(e,t){const n=e._attributeLocations,i=e._geometries,o=t.scene3DOnly,r=t.context,s=[],a=i.length;for(let c=0;c<a;++c){const u=i[c];if(s.push(Fo.fromGeometry({context:r,geometry:u,attributeLocations:n,bufferUsage:mt.STATIC_DRAW,interleave:e._interleave})),l(e._createBoundingVolumeFunction))e._createBoundingVolumeFunction(t,u);else if(e._boundingSpheres.push(Ae.clone(u.boundingSphere)),e._boundingSphereWC.push(new Ae),!o){const f=u.boundingSphereCV.center,h=f.x,_=f.y,g=f.z;f.x=g,f.y=h,f.z=_,e._boundingSphereCV.push(Ae.clone(u.boundingSphereCV)),e._boundingSphere2D.push(new Ae),e._boundingSphereMorph.push(new Ae)}}e._va=s,e._primitiveType=i[0].primitiveType,e.releaseGeometryInstances&&(e.geometryInstances=void 0),e._geometries=void 0,Wb(e,t,as.COMPLETE,void 0)}function YFe(e,t,n,i){let o=n.getRenderState(),r;i?(r=St(o,!1),r.cull={enabled:!0,face:mr.BACK},e._frontFaceRS=ht.fromCache(r),r.cull.face=mr.FRONT,e._backFaceRS=ht.fromCache(r)):(e._frontFaceRS=ht.fromCache(o),e._backFaceRS=e._frontFaceRS),r=St(o,!1),l(e._depthFailAppearance)&&(r.depthTest.enabled=!1),l(e._depthFailAppearance)&&(o=e._depthFailAppearance.getRenderState(),r=St(o,!1),r.depthTest.func=ty.GREATER,i?(r.cull={enabled:!0,face:mr.BACK},e._frontFaceDepthFailRS=ht.fromCache(r),r.cull.face=mr.FRONT,e._backFaceDepthFailRS=ht.fromCache(r)):(e._frontFaceDepthFailRS=ht.fromCache(r),e._backFaceDepthFailRS=e._frontFaceRS))}function $Fe(e,t,n){const i=t.context,o=e._attributeLocations;let r=e._batchTable.getVertexShaderCallback()(n.vertexShaderSource);r=fn._appendOffsetToShader(e,r),r=fn._appendShowToShader(e,r),r=fn._appendDistanceDisplayConditionToShader(e,r,t.scene3DOnly),r=M8(r),r=fn._updateColorAttribute(e,r,!1),r=z8(e,r),r=fn._modifyShaderPosition(e,r,t.scene3DOnly);let s=n.getFragmentShaderSource();s=F8(s),e._sp=Hn.replaceCache({context:i,shaderProgram:e._sp,vertexShaderSource:r,fragmentShaderSource:s,attributeLocations:o}),U8(e._sp,o),l(e._depthFailAppearance)&&(r=e._batchTable.getVertexShaderCallback()(e._depthFailAppearance.vertexShaderSource),r=fn._appendShowToShader(e,r),r=fn._appendDistanceDisplayConditionToShader(e,r,t.scene3DOnly),r=M8(r),r=fn._updateColorAttribute(e,r,!0),r=z8(e,r),r=fn._modifyShaderPosition(e,r,t.scene3DOnly),r=FFe(r),s=e._depthFailAppearance.getFragmentShaderSource(),s=F8(s),s=zFe(s),e._spDepthFail=Hn.replaceCache({context:i,shaderProgram:e._spDepthFail,vertexShaderSource:r,fragmentShaderSource:s,attributeLocations:o}),U8(e._spDepthFail,o))}const wC=new N,k8=new d;function G8(e,t,n,i){const o=l(n)?n._uniforms:void 0,r={},s=t.uniforms;if(l(s)){for(const c in s)if(s.hasOwnProperty(c)){if(l(o)&&l(o[c]))throw new w(`Appearance and material have a uniform with the same name: ${c}`);r[c]=UFe(s,c)}}let a=Ln(r,o);return a=e._batchTable.getUniformMapCallback()(a),l(e.rtcCenter)&&(a.u_modifiedModelView=function(){const c=i.context.uniformState.view;return N.multiply(c,e._modelMatrix,wC),N.multiplyByPoint(wC,e.rtcCenter,k8),N.setTranslation(wC,k8,wC),wC}),a}function XFe(e,t,n,i,o,r,s,a){const c=G8(e,t,n,a);let u;l(e._depthFailAppearance)&&(u=G8(e,e._depthFailAppearance,e._depthFailAppearance.material,a));const f=i?We.TRANSLUCENT:We.OPAQUE;let h=o?2:1;h*=l(e._depthFailAppearance)?2:1,r.length=e._va.length*h;const _=r.length;let g=0;for(let p=0;p<_;++p){let y;o&&(y=r[p],l(y)||(y=r[p]=new Dt({owner:e,primitiveType:e._primitiveType})),y.vertexArray=e._va[g],y.renderState=e._backFaceRS,y.shaderProgram=e._sp,y.uniformMap=c,y.pass=f,++p),y=r[p],l(y)||(y=r[p]=new Dt({owner:e,primitiveType:e._primitiveType})),y.vertexArray=e._va[g],y.renderState=e._frontFaceRS,y.shaderProgram=e._sp,y.uniformMap=c,y.pass=f,l(e._depthFailAppearance)&&(o&&(++p,y=r[p],l(y)||(y=r[p]=new Dt({owner:e,primitiveType:e._primitiveType})),y.vertexArray=e._va[g],y.renderState=e._backFaceDepthFailRS,y.shaderProgram=e._spDepthFail,y.uniformMap=u,y.pass=f),++p,y=r[p],l(y)||(y=r[p]=new Dt({owner:e,primitiveType:e._primitiveType})),y.vertexArray=e._va[g],y.renderState=e._frontFaceDepthFailRS,y.shaderProgram=e._spDepthFail,y.uniformMap=u,y.pass=f),++g}}fn._updateBoundingVolumes=function(e,t,n,i){let o,r,s;if(i||!N.equals(n,e._modelMatrix))for(N.clone(n,e._modelMatrix),r=e._boundingSpheres.length,o=0;o<r;++o)s=e._boundingSpheres[o],l(s)&&(e._boundingSphereWC[o]=Ae.transform(s,n,e._boundingSphereWC[o]),t.scene3DOnly||(e._boundingSphere2D[o]=Ae.clone(e._boundingSphereCV[o],e._boundingSphere2D[o]),e._boundingSphere2D[o].center.x=0,e._boundingSphereMorph[o]=Ae.union(e._boundingSphereWC[o],e._boundingSphereCV[o])));const a=e.appearance.pixelSize;if(l(a))for(r=e._boundingSpheres.length,o=0;o<r;++o){s=e._boundingSpheres[o];const c=e._boundingSphereWC[o],f=t.camera.getPixelSize(s,t.context.drawingBufferWidth,t.context.drawingBufferHeight)*a;c.radius=s.radius+f}};function KFe(e,t,n,i,o,r,s,a){if(t.mode!==me.SCENE3D&&!N.equals(o,N.IDENTITY))throw new w("Primitive.modelMatrix is only supported in 3D mode.");fn._updateBoundingVolumes(e,t,o);let c;t.mode===me.SCENE3D?c=e._boundingSphereWC:t.mode===me.COLUMBUS_VIEW?c=e._boundingSphereCV:t.mode===me.SCENE2D&&l(e._boundingSphere2D)?c=e._boundingSphere2D:l(e._boundingSphereMorph)&&(c=e._boundingSphereMorph);const u=t.commandList,f=t.passes;if(f.render||f.pick){const h=e.allowPicking,_=sr.castShadows(e.shadows),g=sr.receiveShadows(e.shadows),p=n.length;let y=a?2:1;y*=l(e._depthFailAppearance)?2:1;for(let T=0;T<p;++T){const b=Math.floor(T/y),x=n[T];x.modelMatrix=o,x.boundingVolume=c[b],x.cull=r,x.debugShowBoundingVolume=s,x.castShadows=_,x.receiveShadows=g,h?x.pickId="v_pickColor":x.pickId=void 0,u.push(x)}}}fn.prototype.update=function(e){if(!l(this.geometryInstances)&&this._va.length===0||l(this.geometryInstances)&&Array.isArray(this.geometryInstances)&&this.geometryInstances.length===0||!l(this.appearance)||e.mode!==me.SCENE3D&&e.scene3DOnly||!e.passes.render&&!e.passes.pick)return;if(l(this._error))throw this._error;if(l(this.rtcCenter)&&!e.scene3DOnly)throw new w("RTC rendering is only available for 3D only scenes.");if(this._state===as.FAILED)return;const t=e.context;if(l(this._batchTable)||LFe(this,t),this._batchTable.attributes.length>0){if(Gt.maximumVertexTextureImageUnits===0)throw new Fe("Vertex texture fetch support is required to render primitives with per-instance attributes. The maximum number of vertex texture image units must be greater than zero.");this._batchTable.update(e)}if(this._state!==as.COMPLETE&&this._state!==as.COMBINED&&(this.asynchronous?VFe(this,e):kFe(this,e)),this._state===as.COMBINED&&(WFe(this,e),V8(this,e),jFe(this,e)),!this.show||this._state!==as.COMPLETE)return;this._batchTableOffsetsUpdated||V8(this,e),this._recomputeBoundingSpheres&&GFe(this,e);const n=this.appearance,i=n.material;let o=!1,r=!1;this._appearance!==n?(this._appearance=n,this._material=i,o=!0,r=!0):this._material!==i&&(this._material=i,r=!0);const s=this.depthFailAppearance,a=l(s)?s.material:void 0;this._depthFailAppearance!==s?(this._depthFailAppearance=s,this._depthFailMaterial=a,o=!0,r=!0):this._depthFailMaterial!==a&&(this._depthFailMaterial=a,r=!0);const c=this._appearance.isTranslucent();this._translucent!==c&&(this._translucent=c,o=!0),l(this._material)&&this._material.update(t);const u=n.closed&&c;o&&A(this._createRenderStatesFunction,YFe)(this,t,n,u),r&&A(this._createShaderProgramFunction,$Fe)(this,e,n),(o||r)&&A(this._createCommandsFunction,XFe)(this,n,i,c,u,this._colorCommands,this._pickCommands,e),A(this._updateAndQueueCommandsFunction,KFe)(this,e,this._colorCommands,this._pickCommands,this.modelMatrix,this.cull,this.debugShowBoundingVolume,u)};const JFe=new Ae,QFe=new Ae;function oQ(e,t,n){if(n===Fn.TOP){const i=Ae.clone(e,JFe),o=Ae.clone(e,QFe);o.center=d.add(o.center,t,o.center),e=Ae.union(i,o,e)}else n===Fn.ALL&&(e.center=d.add(e.center,t,e.center));return e}function ZFe(e,t,n){return function(){const i=e.getBatchedAttribute(t,n),o=e.attributes[n],r=o.componentsPerAttribute,s=oe.createTypedArray(o.componentDatatype,r);return l(i.constructor.pack)?i.constructor.pack(i,s,0):s[0]=i,s}}function e2e(e,t,n,i,o){return function(r){if(!l(r)||!l(r.length)||r.length<1||r.length>4)throw new w("value must be and array with length between 1 and 4.");const s=eQ(r);e.setBatchedAttribute(t,n,s),o==="offset"&&(i._recomputeBoundingSpheres=!0,i._batchTableOffsetsUpdated=!1)}}const t2e=new d;function n2e(e,t,n){t.boundingSphere={get:function(){let i=e._instanceBoundingSpheres[n];if(l(i)){i=i.clone();const o=e.modelMatrix,r=t.offset;l(r)&&oQ(i,d.fromArray(r.get(),0,t2e),e._offsetInstanceExtend[n]),l(o)&&(i=Ae.transform(i,o))}return i}},t.boundingSphereCV={get:function(){return e._instanceBoundingSpheresCV[n]}}}function i2e(e,t,n){t.pickId={get:function(){return e._pickIds[n]}}}fn.prototype.getGeometryInstanceAttributes=function(e){if(!l(e))throw new w("id is required");if(!l(this._batchTable))throw new w("must call update before calling getGeometryInstanceAttributes");let t=-1;const n=this._lastPerInstanceAttributeIndex,i=this._instanceIds,o=i.length;for(let u=0;u<o;++u){const f=(n+u)%o;if(e===i[f]){t=f;break}}if(t===-1)return;let r=this._perInstanceAttributeCache[t];if(l(r))return r;const s=this._batchTable,a=this._batchTableAttributeIndices;r={};const c={};for(const u in a)if(a.hasOwnProperty(u)){const f=a[u];c[u]={get:ZFe(s,t,f),set:e2e(s,t,f,this,u)}}return n2e(this,c,t),i2e(this,c,t),Object.defineProperties(r,c),this._lastPerInstanceAttributeIndex=t,this._perInstanceAttributeCache[t]=r,r};fn.prototype.isDestroyed=function(){return!1};fn.prototype.destroy=function(){let e,t;this._sp=this._sp&&this._sp.destroy(),this._spDepthFail=this._spDepthFail&&this._spDepthFail.destroy();const n=this._va;for(e=n.length,t=0;t<e;++t)n[t].destroy();this._va=void 0;const i=this._pickIds;for(e=i.length,t=0;t<e;++t)i[t].destroy();return this._pickIds=void 0,this._batchTable=this._batchTable&&this._batchTable.destroy(),this._instanceIds=void 0,this._perInstanceAttributeCache=void 0,this._attributeLocations=void 0,Je(this)};function Wb(e,t,n,i){e._completeLoad(t,n,i)}function Rd(){this._array=[],this._offset=0,this._length=0}Object.defineProperties(Rd.prototype,{length:{get:function(){return this._length}}});Rd.prototype.enqueue=function(e){this._array.push(e),this._length++};Rd.prototype.dequeue=function(){if(this._length===0)return;const e=this._array;let t=this._offset;const n=e[t];return e[t]=void 0,t++,t>10&&t*2>e.length&&(this._array=e.slice(t),t=0),this._offset=t,this._length--,n};Rd.prototype.peek=function(){if(this._length!==0)return this._array[this._offset]};Rd.prototype.contains=function(e){return this._array.indexOf(e)!==-1};Rd.prototype.clear=function(){this._array.length=this._offset=this._length=0};Rd.prototype.sort=function(e){this._offset>0&&(this._array=this._array.slice(this._offset),this._offset=0),this._array.sort(e)};const o2e={WEST:0,NORTH:1,EAST:2,SOUTH:3,NORTHWEST:4,NORTHEAST:5,SOUTHWEST:6,SOUTHEAST:7},mn=o2e,rQ={NONE:0,CULLED:1,RENDERED:2,REFINED:3,RENDERED_AND_KICKED:6,REFINED_AND_KICKED:7,CULLED_BUT_NEEDED:9,wasKicked:function(e){return e>=rQ.RENDERED_AND_KICKED},originalResult:function(e){return e&3},kick:function(e){return e|4}},Ti=rQ;function Oy(e){this.tile=e,this.frameLastUpdated=void 0,this.westMeshes=[],this.westTiles=[],this.southMeshes=[],this.southTiles=[],this.eastMeshes=[],this.eastTiles=[],this.northMeshes=[],this.northTiles=[],this.southwestMesh=void 0,this.southwestTile=void 0,this.southeastMesh=void 0,this.southeastTile=void 0,this.northwestMesh=void 0,this.northwestTile=void 0,this.northeastMesh=void 0,this.northeastTile=void 0,this.changedThisFrame=!0,this.visitedFrame=void 0,this.enqueuedFrame=void 0,this.mesh=void 0,this.vertexArray=void 0,this.waterMaskTexture=void 0,this.waterMaskTranslationAndScale=new ue}Oy.prototype.update=function(e,t,n){this.changedThisFrame&&(sQ(e,t,this.tile,n),this.changedThisFrame=!1)};Oy.prototype.destroy=function(e){this._destroyVertexArray(e),l(this.waterMaskTexture)&&(--this.waterMaskTexture.referenceCount,this.waterMaskTexture.referenceCount===0&&this.waterMaskTexture.destroy(),this.waterMaskTexture=void 0)};Oy.prototype._destroyVertexArray=function(e){l(this.vertexArray)&&(l(e)?e.push(this.vertexArray):no._freeVertexArray(this.vertexArray),this.vertexArray=void 0)};const r2e=new Rd;Oy.updateFillTiles=function(e,t,n,i){const o=e._quadtree,r=o._levelZeroTiles,s=o._lastSelectionFrameNumber,a=r2e;a.clear();for(let u=0;u<t.length;++u){const f=t[u];l(f.data.vertexArray)&&a.enqueue(t[u])}let c=a.dequeue();for(;c!==void 0;){const u=c.findTileToWest(r),f=c.findTileToSouth(r),h=c.findTileToEast(r),_=c.findTileToNorth(r);os(e,n,c,u,s,mn.EAST,!1,a,i),os(e,n,c,f,s,mn.NORTH,!1,a,i),os(e,n,c,h,s,mn.WEST,!1,a,i),os(e,n,c,_,s,mn.SOUTH,!1,a,i);const g=u.findTileToNorth(r),p=u.findTileToSouth(r),y=h.findTileToNorth(r),T=h.findTileToSouth(r);os(e,n,c,g,s,mn.SOUTHEAST,!1,a,i),os(e,n,c,y,s,mn.SOUTHWEST,!1,a,i),os(e,n,c,p,s,mn.NORTHEAST,!1,a,i),os(e,n,c,T,s,mn.NORTHWEST,!1,a,i),c=a.dequeue()}};function os(e,t,n,i,o,r,s,a,c){if(i===void 0)return;let u=i;for(;u&&(u._lastSelectionResultFrame!==o||Ti.wasKicked(u._lastSelectionResult)||Ti.originalResult(u._lastSelectionResult)===Ti.CULLED);){if(s)return;const f=u.parent;if(r>=mn.NORTHWEST&&f!==void 0)switch(r){case mn.NORTHWEST:u=u===f.northwestChild?f:void 0;break;case mn.NORTHEAST:u=u===f.northeastChild?f:void 0;break;case mn.SOUTHWEST:u=u===f.southwestChild?f:void 0;break;case mn.SOUTHEAST:u=u===f.southeastChild?f:void 0;break}else u=f}if(u!==void 0){if(u._lastSelectionResult===Ti.RENDERED){if(l(u.data.vertexArray))return;s2e(e,t,n,u,r,o,a,c);return}if(Ti.originalResult(i._lastSelectionResult)!==Ti.CULLED)switch(r){case mn.WEST:os(e,t,n,i.northwestChild,o,r,!0,a,c),os(e,t,n,i.southwestChild,o,r,!0,a,c);break;case mn.EAST:os(e,t,n,i.southeastChild,o,r,!0,a,c),os(e,t,n,i.northeastChild,o,r,!0,a,c);break;case mn.SOUTH:os(e,t,n,i.southwestChild,o,r,!0,a,c),os(e,t,n,i.southeastChild,o,r,!0,a,c);break;case mn.NORTH:os(e,t,n,i.northeastChild,o,r,!0,a,c),os(e,t,n,i.northwestChild,o,r,!0,a,c);break;case mn.NORTHWEST:os(e,t,n,i.northwestChild,o,r,!0,a,c);break;case mn.NORTHEAST:os(e,t,n,i.northeastChild,o,r,!0,a,c);break;case mn.SOUTHWEST:os(e,t,n,i.southwestChild,o,r,!0,a,c);break;case mn.SOUTHEAST:os(e,t,n,i.southeastChild,o,r,!0,a,c);break;default:throw new w("Invalid edge")}}}function s2e(e,t,n,i,o,r,s,a){const c=i.data;if(c.fill===void 0)c.fill=new Oy(i);else if(c.fill.visitedFrame===r)return;c.fill.enqueuedFrame!==r&&(c.fill.enqueuedFrame=r,c.fill.changedThisFrame=!1,s.enqueue(i)),a2e(e,t,n,i,o,a)}function a2e(e,t,n,i,o,r){const s=i.data.fill;let a;const c=n.data.fill;l(c)?(c.visitedFrame=t.frameNumber,c.changedThisFrame&&(sQ(e,t,n,r),c.changedThisFrame=!1),a=n.data.fill.mesh):a=n.data.mesh;let u,f;switch(o){case mn.WEST:u=s.westMeshes,f=s.westTiles;break;case mn.SOUTH:u=s.southMeshes,f=s.southTiles;break;case mn.EAST:u=s.eastMeshes,f=s.eastTiles;break;case mn.NORTH:u=s.northMeshes,f=s.northTiles;break;case mn.NORTHWEST:s.changedThisFrame=s.changedThisFrame||s.northwestMesh!==a,s.northwestMesh=a,s.northwestTile=n;return;case mn.NORTHEAST:s.changedThisFrame=s.changedThisFrame||s.northeastMesh!==a,s.northeastMesh=a,s.northeastTile=n;return;case mn.SOUTHWEST:s.changedThisFrame=s.changedThisFrame||s.southwestMesh!==a,s.southwestMesh=a,s.southwestTile=n;return;case mn.SOUTHEAST:s.changedThisFrame=s.changedThisFrame||s.southeastMesh!==a,s.southeastMesh=a,s.southeastTile=n;return}if(n.level<=i.level){s.changedThisFrame=s.changedThisFrame||u[0]!==a||u.length!==1,u[0]=a,f[0]=n,u.length=1,f.length=1;return}let h,_,g,p;const y=n.rectangle;let T;const b=i.rectangle;switch(o){case mn.WEST:for(T=(b.north-b.south)*F.EPSILON5,h=0;h<f.length&&(g=f[h],p=g.rectangle,!F.greaterThan(y.north,p.south,T));++h);for(_=h;_<f.length&&(g=f[_],p=g.rectangle,!F.greaterThanOrEquals(y.south,p.north,T));++_);break;case mn.SOUTH:for(T=(b.east-b.west)*F.EPSILON5,h=0;h<f.length&&(g=f[h],p=g.rectangle,!F.lessThan(y.west,p.east,T));++h);for(_=h;_<f.length&&(g=f[_],p=g.rectangle,!F.lessThanOrEquals(y.east,p.west,T));++_);break;case mn.EAST:for(T=(b.north-b.south)*F.EPSILON5,h=0;h<f.length&&(g=f[h],p=g.rectangle,!F.lessThan(y.south,p.north,T));++h);for(_=h;_<f.length&&(g=f[_],p=g.rectangle,!F.lessThanOrEquals(y.north,p.south,T));++_);break;case mn.NORTH:for(T=(b.east-b.west)*F.EPSILON5,h=0;h<f.length&&(g=f[h],p=g.rectangle,!F.greaterThan(y.east,p.west,T));++h);for(_=h;_<f.length&&(g=f[_],p=g.rectangle,!F.greaterThanOrEquals(y.west,p.east,T));++_);break}_-h===1?(s.changedThisFrame=s.changedThisFrame||u[h]!==a,u[h]=a,f[h]=n):(s.changedThisFrame=!0,u.splice(h,_-h,a),f.splice(h,_-h,n))}const Lg=new ve,c2e=new ve,SA=new d,Cz=new d,cF=new $,lF=new $,Qc=new $;function Z1(){this.height=0,this.encodedNormal=new $}function jS(e,t,n,i,o,r,s,a,c){if(l(o))return o;let u;if(l(r)&&l(s))u=(r.height+s.height)*.5;else if(l(r))u=r.height;else if(l(s))u=s.height;else if(l(a))u=a.height;else{const h=e.tile.data.tileBoundingRegion;let _=0,g=0;l(h)&&(_=h.minimumHeight,g=h.maximumHeight),u=(_+g)*.5}return aQ(e,t,n,i,u,c),c}const l2e={minimumHeight:0,maximumHeight:0},u2e=new d,W8=new Z1,q8=new Z1,j8=new Z1,Y8=new Z1,f2e=typeof Uint8Array<"u"?new Uint8Array(9*9):void 0,d2e={tilingScheme:void 0,x:0,y:0,level:0,exaggeration:1,exaggerationRelativeHeight:0};function sQ(e,t,n,i){no.initialize(n,e.terrainProvider,e._imageryLayers);const o=n.data,r=o.fill,s=n.rectangle,a=t.terrainExaggeration,c=t.terrainExaggerationRelativeHeight,u=a!==1,f=n.tilingScheme.ellipsoid;let h=$S(r,f,0,1,r.northwestTile,r.northwestMesh,r.northTiles,r.northMeshes,r.westTiles,r.westMeshes,j8),_=$S(r,f,0,0,r.southwestTile,r.southwestMesh,r.westTiles,r.westMeshes,r.southTiles,r.southMeshes,W8),g=$S(r,f,1,0,r.southeastTile,r.southeastMesh,r.southTiles,r.southMeshes,r.eastTiles,r.eastMeshes,q8),p=$S(r,f,1,1,r.northeastTile,r.northeastMesh,r.eastTiles,r.eastMeshes,r.northTiles,r.northMeshes,Y8);h=jS(r,f,0,1,h,_,p,g,j8),_=jS(r,f,0,0,_,h,g,p,W8),g=jS(r,f,1,1,g,_,p,h,q8),p=jS(r,f,1,1,p,g,h,_,Y8);const y=_.height,T=g.height,b=h.height,x=p.height;let v=Math.min(y,T,b,x),D=Math.max(y,T,b,x);const L=(v+D)*.5;let B,V;const M=e.getLevelMaximumGeometricError(n.level),H=f.maximumRadius-M;let G=Math.acos(H/f.maximumRadius)*4;if(G*=1.5,s.width>G&&D-v<=M){const m=new _f({width:9,height:9,buffer:f2e,structure:{heightOffset:D}}),P=d2e;P.tilingScheme=n.tilingScheme,P.x=n.x,P.y=n.y,P.level=n.level,P.exaggeration=a,P.exaggerationRelativeHeight=c,r.mesh=m._createMeshSync(P)}else{const m=u,P=Ee.center(s,c2e);P.height=L;const R=f.cartographicToCartesian(P,u2e),U=new ts(R,void 0,void 0,void 0,void 0,!0,!0,m,a,c);let W=5,q;for(q=r.westMeshes,B=0,V=q.length;B<V;++B)W+=q[B].eastIndicesNorthToSouth.length;for(q=r.southMeshes,B=0,V=q.length;B<V;++B)W+=q[B].northIndicesWestToEast.length;for(q=r.eastMeshes,B=0,V=q.length;B<V;++B)W+=q[B].westIndicesSouthToNorth.length;for(q=r.northMeshes,B=0,V=q.length;B<V;++B)W+=q[B].southIndicesEastToWest.length;const Y=l2e;Y.minimumHeight=v,Y.maximumHeight=D;const j=U.stride;let ee=new Float32Array(W*j),K=0;const se=K;K=YS(f,s,U,ee,K,0,1,h.height,h.encodedNormal,1,Y),K=KS(r,f,U,ee,K,r.westTiles,r.westMeshes,mn.EAST,Y);const Q=K;K=YS(f,s,U,ee,K,0,0,_.height,_.encodedNormal,0,Y),K=KS(r,f,U,ee,K,r.southTiles,r.southMeshes,mn.NORTH,Y);const Z=K;K=YS(f,s,U,ee,K,1,0,g.height,g.encodedNormal,0,Y),K=KS(r,f,U,ee,K,r.eastTiles,r.eastMeshes,mn.WEST,Y);const J=K;K=YS(f,s,U,ee,K,1,1,p.height,p.encodedNormal,1,Y),K=KS(r,f,U,ee,K,r.northTiles,r.northMeshes,mn.SOUTH,Y),v=Y.minimumHeight,D=Y.maximumHeight;const de=Zt.fromRectangle(s,v,D,n.tilingScheme.ellipsoid),_e=Ii.geodeticLatitudeToMercatorAngle(s.south),le=1/(Ii.geodeticLatitudeToMercatorAngle(s.north)-_e),Te=(Ii.geodeticLatitudeToMercatorAngle(P.latitude)-_e)*le,pe=f.geodeticSurfaceNormalCartographic(Lg,Cz),ne=Ri.octEncode(pe,cF),ae=K;U.encode(ee,K*j,de.center,$.fromElements(.5,.5,Qc),L,ne,Te,pe),++K;const ye=K,Ce=ye<256?1:2,Be=(ye-1)*3,Le=Be*Ce,Ve=(ee.length-ye*j)*Float32Array.BYTES_PER_ELEMENT;let Ie;if(Ve>=Le){const Qe=ye*j*Float32Array.BYTES_PER_ELEMENT;Ie=ye<256?new Uint8Array(ee.buffer,Qe,Be):new Uint16Array(ee.buffer,Qe,Be)}else Ie=ye<256?new Uint8Array(Be):new Uint16Array(Be);ee=new Float32Array(ee.buffer,0,ye*j);let He=0;for(B=0;B<ye-2;++B)Ie[He++]=ae,Ie[He++]=B,Ie[He++]=B+1;Ie[He++]=ae,Ie[He++]=B,Ie[He++]=0;const Me=[];for(B=Q;B>=se;--B)Me.push(B);const qe=[];for(B=Z;B>=Q;--B)qe.push(B);const Ne=[];for(B=J;B>=Z;--B)Ne.push(B);const ke=[];for(ke.push(0),B=ae-1;B>=J;--B)ke.push(B);r.mesh=new J1(U.center,ee,Ie,Be,ye,v,D,Ae.fromOrientedBoundingBox(de),A2e(e,de.center,s,v,D),U.stride,de,U,Me,qe,Ne,ke)}const I=t.context;r._destroyVertexArray(i),r.vertexArray=no._createVertexArrayForMesh(I,r.mesh),o.processImagery(n,e.terrainProvider,t,!0);const O=r.waterMaskTexture;if(r.waterMaskTexture=void 0,e.terrainProvider.hasWaterMask){const m=o._findAncestorTileWithTerrainData(n);l(m)&&l(m.data.waterMaskTexture)&&(r.waterMaskTexture=m.data.waterMaskTexture,++r.waterMaskTexture.referenceCount,o._computeWaterMaskTranslationAndScale(n,m,r.waterMaskTranslationAndScale))}l(O)&&(--O.referenceCount,O.referenceCount===0&&O.destroy())}function YS(e,t,n,i,o,r,s,a,c,u,f){const h=Lg;h.longitude=F.lerp(t.west,t.east,r),h.latitude=F.lerp(t.south,t.north,s),h.height=a;const _=e.cartographicToCartesian(h,SA);let g;n.hasGeodeticSurfaceNormals&&(g=e.geodeticSurfaceNormal(_,Cz));const p=lF;return p.x=r,p.y=s,n.encode(i,o*n.stride,_,p,a,c,u,g),f.minimumHeight=Math.min(f.minimumHeight,a),f.maximumHeight=Math.max(f.maximumHeight,a),o+1}const UI=new Ee;function bE(e,t,n,i){let o=e.rectangle;const r=t.rectangle;t.x===0&&n.x===1&&e.x===e.tilingScheme.getNumberOfXTilesAtLevel(e.level)-1?(o=Ee.clone(e.rectangle,UI),o.west-=F.TWO_PI,o.east-=F.TWO_PI):e.x===0&&n.x===0&&t.x===t.tilingScheme.getNumberOfXTilesAtLevel(t.level)-1&&(o=Ee.clone(e.rectangle,UI),o.west+=F.TWO_PI,o.east+=F.TWO_PI);const s=o.east-o.west,a=(r.west-o.west)/s,c=(r.east-o.west)/s,u=o.north-o.south,f=(r.south-o.south)/u,h=(r.north-o.south)/u;let _=(n.x-a)/(c-a),g=(n.y-f)/(h-f);return Math.abs(_)<Math.EPSILON5?_=0:Math.abs(_-1)<Math.EPSILON5&&(_=1),Math.abs(g)<Math.EPSILON5?g=0:Math.abs(g-1)<Math.EPSILON5&&(g=1),i.x=_,i.y=g,i}const h2e=new $;function uF(e,t,n,i,o){const r=e.encoding,s=e.vertices;if(o.height=r.decodeHeight(s,t),r.hasVertexNormals)r.getOctEncodedNormal(s,t,o.encodedNormal);else{const a=o.encodedNormal;a.x=0,a.y=0}}const p2e=new $,m2e=new d;function _2e(e,t,n,i,o,r,s,a,c,u){const f=i.encoding,h=i.vertices,_=bE(t,n,f.decodeTextureCoordinates(h,o,Qc),Qc),g=bE(t,n,f.decodeTextureCoordinates(h,r,lF),lF);let p;c?p=(s-_.x)/(g.x-_.x):p=(a-_.y)/(g.y-_.y);const y=f.decodeHeight(h,o),T=f.decodeHeight(h,r),b=n.rectangle;Lg.longitude=F.lerp(b.west,b.east,s),Lg.latitude=F.lerp(b.south,b.north,a),u.height=Lg.height=F.lerp(y,T,p);let x;if(f.hasVertexNormals){const v=f.getOctEncodedNormal(h,o,h2e),D=f.getOctEncodedNormal(h,r,p2e),L=Ri.octDecode(v.x,v.y,SA),B=Ri.octDecode(D.x,D.y,m2e);x=d.lerp(L,B,p,SA),d.normalize(x,x),Ri.octEncode(x,u.encodedNormal)}else x=e.geodeticSurfaceNormalCartographic(Lg,SA),Ri.octEncode(x,u.encodedNormal)}function aQ(e,t,n,i,o,r){r.height=o;const s=t.geodeticSurfaceNormalCartographic(Lg,SA);Ri.octEncode(s,r.encodedNormal)}function $S(e,t,n,i,o,r,s,a,c,u,f){if(X8(e,t,a,s,!1,n,i,f)||X8(e,t,u,c,!0,n,i,f))return f;let _;if(bz(o,r))return n===0?i===0?_=r.eastIndicesNorthToSouth[0]:_=r.southIndicesEastToWest[0]:i===0?_=r.northIndicesWestToEast[0]:_=r.westIndicesSouthToNorth[0],uF(r,_,n,i,f),f;let g;if(n===0?i===0?g=XS(e.westMeshes,e.westTiles,mn.EAST,e.southMeshes,e.southTiles,mn.NORTH):g=XS(e.northMeshes,e.northTiles,mn.SOUTH,e.westMeshes,e.westTiles,mn.EAST):i===0?g=XS(e.southMeshes,e.southTiles,mn.NORTH,e.eastMeshes,e.eastTiles,mn.WEST):g=XS(e.eastMeshes,e.eastTiles,mn.WEST,e.northMeshes,e.northTiles,mn.SOUTH),l(g))return aQ(e,t,n,i,g,f),f}function XS(e,t,n,i,o,r,s,a){const c=$8(e,t,!1,n),u=$8(i,o,!0,r);return l(c)&&l(u)?(c+u)*.5:l(c)?c:u}function KS(e,t,n,i,o,r,s,a,c){for(let u=0;u<r.length;++u)o=g2e(e,t,n,i,o,r[u],s[u],a,c);return o}function g2e(e,t,n,i,o,r,s,a,c){let u=r.rectangle;a===mn.EAST&&e.tile.x===0?(u=Ee.clone(r.rectangle,UI),u.west-=F.TWO_PI,u.east-=F.TWO_PI):a===mn.WEST&&r.x===0&&(u=Ee.clone(r.rectangle,UI),u.west+=F.TWO_PI,u.east+=F.TWO_PI);const f=e.tile.rectangle;let h,_;o>0&&(n.decodeTextureCoordinates(i,o-1,Qc),h=Qc.x,_=Qc.y);let g,p;switch(a){case mn.WEST:g=s.westIndicesSouthToNorth,p=!1;break;case mn.NORTH:g=s.northIndicesWestToEast,p=!0;break;case mn.EAST:g=s.eastIndicesNorthToSouth,p=!1;break;case mn.SOUTH:g=s.southIndicesEastToWest,p=!0;break}const y=r,T=e.tile,b=s.encoding,x=s.vertices,v=n.stride;let D,L;b.hasWebMercatorT&&(D=Ii.geodeticLatitudeToMercatorAngle(f.south),L=1/(Ii.geodeticLatitudeToMercatorAngle(f.north)-D));for(let B=0;B<g.length;++B){const V=g[B],M=b.decodeTextureCoordinates(x,V,Qc);bE(y,T,M,M);const H=M.x,G=M.y,I=p?H:G;if(I<0||I>1||Math.abs(H-h)<F.EPSILON5&&Math.abs(G-_)<F.EPSILON5)continue;const O=Math.abs(H)<F.EPSILON5||Math.abs(H-1)<F.EPSILON5,m=Math.abs(G)<F.EPSILON5||Math.abs(G-1)<F.EPSILON5;if(O&&m)continue;const P=b.decodePosition(x,V,SA),R=b.decodeHeight(x,V);let U;b.hasVertexNormals?U=b.getOctEncodedNormal(x,V,cF):(U=cF,U.x=0,U.y=0);let W=G;if(b.hasWebMercatorT){const Y=F.lerp(f.south,f.north,G);W=(Ii.geodeticLatitudeToMercatorAngle(Y)-D)*L}let q;n.hasGeodeticSurfaceNormals&&(q=t.geodeticSurfaceNormal(P,Cz)),n.encode(i,o*v,P,M,R,U,W,q),c.minimumHeight=Math.min(c.minimumHeight,R),c.maximumHeight=Math.max(c.maximumHeight,R),++o}return o}function $8(e,t,n,i,o,r){let s,a,c;n?(s=0,a=e.length,c=1):(s=e.length-1,a=-1,c=-1);for(let u=s;u!==a;u+=c){const f=e[u],h=t[u];if(!bz(h,f))continue;let _;switch(i){case mn.WEST:_=f.westIndicesSouthToNorth;break;case mn.SOUTH:_=f.southIndicesEastToWest;break;case mn.EAST:_=f.eastIndicesNorthToSouth;break;case mn.NORTH:_=f.northIndicesWestToEast;break}const g=_[n?0:_.length-1];if(l(g))return f.encoding.decodeHeight(f.vertices,g)}}function bz(e,t){return l(t)&&(!l(e.data.fill)||!e.data.fill.changedThisFrame)}function X8(e,t,n,i,o,r,s,a){let c,u,f,h,_;const g=i[o?0:n.length-1],p=n[o?0:n.length-1];if(bz(g,p)&&(r===0?s===0?(c=o?p.northIndicesWestToEast:p.eastIndicesNorthToSouth,u=o,f=o):(c=o?p.eastIndicesNorthToSouth:p.southIndicesEastToWest,u=!o,f=!1):s===0?(c=o?p.westIndicesSouthToNorth:p.northIndicesWestToEast,u=!o,f=!0):(c=o?p.southIndicesEastToWest:p.westIndicesSouthToNorth,u=o,f=!o),c.length>0)){h=o?0:c.length-1,_=c[h],p.encoding.decodeTextureCoordinates(p.vertices,_,Qc);const y=bE(g,e.tile,Qc,Qc);if(y.x===r&&y.y===s)return uF(p,_,r,s,a),!0;if(h=da(c,u?r:s,function(T,b){p.encoding.decodeTextureCoordinates(p.vertices,T,Qc);const x=bE(g,e.tile,Qc,Qc);return f?u?x.x-r:x.y-s:u?r-x.x:s-x.y}),h<0){if(h=~h,h>0&&h<c.length)return _2e(t,g,e.tile,p,c[h-1],c[h],r,s,u,a),!0}else return uF(p,c[h],r,s,a),!0}return!1}const y2e=[new d,new d,new d,new d];function A2e(e,t,n,i,o,r){const s=e.quadtree._occluders.ellipsoid,a=s.ellipsoid,c=y2e;return d.fromRadians(n.west,n.south,o,a,c[0]),d.fromRadians(n.east,n.south,o,a,c[1]),d.fromRadians(n.west,n.north,o,a,c[2]),d.fromRadians(n.east,n.north,o,a,c[3]),s.computeHorizonCullingPointPossiblyUnderEllipsoid(t,c,i,r)}var HI={},T2e={get exports(){return HI},set exports(e){HI=e}};T2e.exports=eP;HI.default=eP;function eP(e,t,n){n=n||2;var i=t&&t.length,o=i?t[0]*n:e.length,r=cQ(e,0,o,n,!0),s=[];if(!r||r.next===r.prev)return s;var a,c,u,f,h,_,g;if(i&&(r=w2e(e,t,r,n)),e.length>80*n){a=u=e[0],c=f=e[1];for(var p=n;p<o;p+=n)h=e[p],_=e[p+1],h<a&&(a=h),_<c&&(c=_),h>u&&(u=h),_>f&&(f=_);g=Math.max(u-a,f-c),g=g!==0?32767/g:0}return EE(r,s,n,a,c,g,0),s}function cQ(e,t,n,i,o){var r,s;if(o===hF(e,t,n,i)>0)for(r=t;r<n;r+=i)s=K8(r,e[r],e[r+1],s);else for(r=n-i;r>=t;r-=i)s=K8(r,e[r],e[r+1],s);return s&&tP(s,s.next)&&(wE(s),s=s.next),s}function iy(e,t){if(!e)return e;t||(t=e);var n=e,i;do if(i=!1,!n.steiner&&(tP(n,n.next)||vr(n.prev,n,n.next)===0)){if(wE(n),n=t=n.prev,n===n.next)break;i=!0}else n=n.next;while(i||n!==t);return t}function EE(e,t,n,i,o,r,s){if(e){!s&&r&&P2e(e,i,o,r);for(var a=e,c,u;e.prev!==e.next;){if(c=e.prev,u=e.next,r?b2e(e,i,o,r):C2e(e)){t.push(c.i/n|0),t.push(e.i/n|0),t.push(u.i/n|0),wE(e),e=u.next,a=u.next;continue}if(e=u,e===a){s?s===1?(e=E2e(iy(e),t,n),EE(e,t,n,i,o,r,2)):s===2&&x2e(e,t,n,i,o,r):EE(iy(e),t,n,i,o,r,1);break}}}}function C2e(e){var t=e.prev,n=e,i=e.next;if(vr(t,n,i)>=0)return!1;for(var o=t.x,r=n.x,s=i.x,a=t.y,c=n.y,u=i.y,f=o<r?o<s?o:s:r<s?r:s,h=a<c?a<u?a:u:c<u?c:u,_=o>r?o>s?o:s:r>s?r:s,g=a>c?a>u?a:u:c>u?c:u,p=i.next;p!==t;){if(p.x>=f&&p.x<=_&&p.y>=h&&p.y<=g&&hA(o,a,r,c,s,u,p.x,p.y)&&vr(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function b2e(e,t,n,i){var o=e.prev,r=e,s=e.next;if(vr(o,r,s)>=0)return!1;for(var a=o.x,c=r.x,u=s.x,f=o.y,h=r.y,_=s.y,g=a<c?a<u?a:u:c<u?c:u,p=f<h?f<_?f:_:h<_?h:_,y=a>c?a>u?a:u:c>u?c:u,T=f>h?f>_?f:_:h>_?h:_,b=fF(g,p,t,n,i),x=fF(y,T,t,n,i),v=e.prevZ,D=e.nextZ;v&&v.z>=b&&D&&D.z<=x;){if(v.x>=g&&v.x<=y&&v.y>=p&&v.y<=T&&v!==o&&v!==s&&hA(a,f,c,h,u,_,v.x,v.y)&&vr(v.prev,v,v.next)>=0||(v=v.prevZ,D.x>=g&&D.x<=y&&D.y>=p&&D.y<=T&&D!==o&&D!==s&&hA(a,f,c,h,u,_,D.x,D.y)&&vr(D.prev,D,D.next)>=0))return!1;D=D.nextZ}for(;v&&v.z>=b;){if(v.x>=g&&v.x<=y&&v.y>=p&&v.y<=T&&v!==o&&v!==s&&hA(a,f,c,h,u,_,v.x,v.y)&&vr(v.prev,v,v.next)>=0)return!1;v=v.prevZ}for(;D&&D.z<=x;){if(D.x>=g&&D.x<=y&&D.y>=p&&D.y<=T&&D!==o&&D!==s&&hA(a,f,c,h,u,_,D.x,D.y)&&vr(D.prev,D,D.next)>=0)return!1;D=D.nextZ}return!0}function E2e(e,t,n){var i=e;do{var o=i.prev,r=i.next.next;!tP(o,r)&&lQ(o,i,i.next,r)&&xE(o,r)&&xE(r,o)&&(t.push(o.i/n|0),t.push(i.i/n|0),t.push(r.i/n|0),wE(i),wE(i.next),i=e=r),i=i.next}while(i!==e);return iy(i)}function x2e(e,t,n,i,o,r){var s=e;do{for(var a=s.next.next;a!==s.prev;){if(s.i!==a.i&&B2e(s,a)){var c=uQ(s,a);s=iy(s,s.next),c=iy(c,c.next),EE(s,t,n,i,o,r,0),EE(c,t,n,i,o,r,0);return}a=a.next}s=s.next}while(s!==e)}function w2e(e,t,n,i){var o=[],r,s,a,c,u;for(r=0,s=t.length;r<s;r++)a=t[r]*i,c=r<s-1?t[r+1]*i:e.length,u=cQ(e,a,c,i,!1),u===u.next&&(u.steiner=!0),o.push(L2e(u));for(o.sort(S2e),r=0;r<o.length;r++)n=v2e(o[r],n);return n}function S2e(e,t){return e.x-t.x}function v2e(e,t){var n=D2e(e,t);if(!n)return t;var i=uQ(n,e);return iy(i,i.next),iy(n,n.next)}function D2e(e,t){var n=t,i=e.x,o=e.y,r=-1/0,s;do{if(o<=n.y&&o>=n.next.y&&n.next.y!==n.y){var a=n.x+(o-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(a<=i&&a>r&&(r=a,s=n.x<n.next.x?n:n.next,a===i))return s}n=n.next}while(n!==t);if(!s)return null;var c=s,u=s.x,f=s.y,h=1/0,_;n=s;do i>=n.x&&n.x>=u&&i!==n.x&&hA(o<f?i:r,o,u,f,o<f?r:i,o,n.x,n.y)&&(_=Math.abs(o-n.y)/(i-n.x),xE(n,e)&&(_<h||_===h&&(n.x>s.x||n.x===s.x&&I2e(s,n)))&&(s=n,h=_)),n=n.next;while(n!==c);return s}function I2e(e,t){return vr(e.prev,e,t.prev)<0&&vr(t.next,e,e.next)<0}function P2e(e,t,n,i){var o=e;do o.z===0&&(o.z=fF(o.x,o.y,t,n,i)),o.prevZ=o.prev,o.nextZ=o.next,o=o.next;while(o!==e);o.prevZ.nextZ=null,o.prevZ=null,O2e(o)}function O2e(e){var t,n,i,o,r,s,a,c,u=1;do{for(n=e,e=null,r=null,s=0;n;){for(s++,i=n,a=0,t=0;t<u&&(a++,i=i.nextZ,!!i);t++);for(c=u;a>0||c>0&&i;)a!==0&&(c===0||!i||n.z<=i.z)?(o=n,n=n.nextZ,a--):(o=i,i=i.nextZ,c--),r?r.nextZ=o:e=o,o.prevZ=r,r=o;n=i}r.nextZ=null,u*=2}while(s>1);return e}function fF(e,t,n,i,o){return e=(e-n)*o|0,t=(t-i)*o|0,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e|t<<1}function L2e(e){var t=e,n=e;do(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next;while(t!==e);return n}function hA(e,t,n,i,o,r,s,a){return(o-s)*(t-a)>=(e-s)*(r-a)&&(e-s)*(i-a)>=(n-s)*(t-a)&&(n-s)*(r-a)>=(o-s)*(i-a)}function B2e(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!R2e(e,t)&&(xE(e,t)&&xE(t,e)&&N2e(e,t)&&(vr(e.prev,e,t.prev)||vr(e,t.prev,t))||tP(e,t)&&vr(e.prev,e,e.next)>0&&vr(t.prev,t,t.next)>0)}function vr(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function tP(e,t){return e.x===t.x&&e.y===t.y}function lQ(e,t,n,i){var o=QS(vr(e,t,n)),r=QS(vr(e,t,i)),s=QS(vr(n,i,e)),a=QS(vr(n,i,t));return!!(o!==r&&s!==a||o===0&&JS(e,n,t)||r===0&&JS(e,i,t)||s===0&&JS(n,e,i)||a===0&&JS(n,t,i))}function JS(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function QS(e){return e>0?1:e<0?-1:0}function R2e(e,t){var n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&lQ(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}function xE(e,t){return vr(e.prev,e,e.next)<0?vr(e,t,e.next)>=0&&vr(e,e.prev,t)>=0:vr(e,t,e.prev)<0||vr(e,e.next,t)<0}function N2e(e,t){var n=e,i=!1,o=(e.x+t.x)/2,r=(e.y+t.y)/2;do n.y>r!=n.next.y>r&&n.next.y!==n.y&&o<(n.next.x-n.x)*(r-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next;while(n!==e);return i}function uQ(e,t){var n=new dF(e.i,e.x,e.y),i=new dF(t.i,t.x,t.y),o=e.next,r=t.prev;return e.next=t,t.prev=e,n.next=o,o.prev=n,i.next=n,n.prev=i,r.next=i,i.prev=r,i}function K8(e,t,n,i){var o=new dF(e,t,n);return i?(o.next=i.next,o.prev=i,i.next.prev=o,i.next=o):(o.prev=o,o.next=o),o}function wE(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function dF(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}eP.deviation=function(e,t,n,i){var o=t&&t.length,r=o?t[0]*n:e.length,s=Math.abs(hF(e,0,r,n));if(o)for(var a=0,c=t.length;a<c;a++){var u=t[a]*n,f=a<c-1?t[a+1]*n:e.length;s-=Math.abs(hF(e,u,f,n))}var h=0;for(a=0;a<i.length;a+=3){var _=i[a]*n,g=i[a+1]*n,p=i[a+2]*n;h+=Math.abs((e[_]-e[p])*(e[g+1]-e[_+1])-(e[_]-e[g])*(e[p+1]-e[_+1]))}return s===0&&h===0?0:Math.abs((h-s)/s)};function hF(e,t,n,i){for(var o=0,r=t,s=n-i;r<n;r+=i)o+=(e[s]-e[r])*(e[r+1]+e[s+1]),s=r;return o}eP.flatten=function(e){for(var t=e[0][0].length,n={vertices:[],holes:[],dimensions:t},i=0,o=0;o<e.length;o++){for(var r=0;r<e[o].length;r++)for(var s=0;s<t;s++)n.vertices.push(e[o][r][s]);o>0&&(i+=e[o-1].length,n.holes.push(i))}return n};function pF(e,t,n){if(e===0)return t*n;const i=e*e,o=i*i,r=o*i,s=r*i,a=s*i,c=a*i,u=n,f=Math.sin(2*u),h=Math.sin(4*u),_=Math.sin(6*u),g=Math.sin(8*u),p=Math.sin(10*u),y=Math.sin(12*u);return t*((1-i/4-3*o/64-5*r/256-175*s/16384-441*a/65536-4851*c/1048576)*u-(3*i/8+3*o/32+45*r/1024+105*s/4096+2205*a/131072+6237*c/524288)*f+(15*o/256+45*r/1024+525*s/16384+1575*a/65536+155925*c/8388608)*h-(35*r/3072+175*s/12288+3675*a/262144+13475*c/1048576)*_+(315*s/131072+2205*a/524288+43659*c/8388608)*g-(693*a/1310720+6237*c/5242880)*p+1001*c/8388608*y)}function M2e(e,t,n){const i=e/n;if(t===0)return i;const o=i*i,r=o*i,s=r*i,a=t,c=a*a,u=c*c,f=u*c,h=f*c,_=h*c,g=_*c,p=Math.sin(2*i),y=Math.cos(2*i),T=Math.sin(4*i),b=Math.cos(4*i),x=Math.sin(6*i),v=Math.cos(6*i),D=Math.sin(8*i),L=Math.cos(8*i),B=Math.sin(10*i),V=Math.cos(10*i),M=Math.sin(12*i);return i+i*c/4+7*i*u/64+15*i*f/256+579*i*h/16384+1515*i*_/65536+16837*i*g/1048576+(3*i*u/16+45*i*f/256-i*(32*o-561)*h/4096-i*(232*o-1677)*_/16384+i*(399985-90560*o+512*s)*g/5242880)*y+(21*i*f/256+483*i*h/4096-i*(224*o-1969)*_/16384-i*(33152*o-112599)*g/1048576)*b+(151*i*h/4096+4681*i*_/65536+1479*i*g/16384-453*r*g/32768)*v+(1097*i*_/65536+42783*i*g/1048576)*L+8011*i*g/1048576*V+(3*c/8+3*u/16+213*f/2048-3*o*f/64+255*h/4096-33*o*h/512+20861*_/524288-33*o*_/512+s*_/1024+28273*g/1048576-471*o*g/8192+9*s*g/4096)*p+(21*u/256+21*f/256+533*h/8192-21*o*h/512+197*_/4096-315*o*_/4096+584039*g/16777216-12517*o*g/131072+7*s*g/2048)*T+(151*f/6144+151*h/4096+5019*_/131072-453*o*_/16384+26965*g/786432-8607*o*g/131072)*x+(1097*h/131072+1097*_/65536+225797*g/10485760-1097*o*g/65536)*D+(8011*_/2621440+8011*g/1048576)*B+293393*g/251658240*M}function oT(e,t){if(e===0)return Math.log(Math.tan(.5*(F.PI_OVER_TWO+t)));const n=e*Math.sin(t);return Math.log(Math.tan(.5*(F.PI_OVER_TWO+t)))-e/2*Math.log((1+n)/(1-n))}function F2e(e,t,n,i,o){const r=oT(e._ellipticity,n),s=oT(e._ellipticity,o);return Math.atan2(F.negativePiToPi(i-t),s-r)}function z2e(e,t,n,i,o,r,s){const a=e._heading,c=r-i;let u=0;if(F.equalsEpsilon(Math.abs(a),F.PI_OVER_TWO,F.EPSILON8))if(t===n)u=t*Math.cos(o)*F.negativePiToPi(c);else{const f=Math.sin(o);u=t*Math.cos(o)*F.negativePiToPi(c)/Math.sqrt(1-e._ellipticitySquared*f*f)}else{const f=pF(e._ellipticity,t,o);u=(pF(e._ellipticity,t,s)-f)/Math.cos(a)}return Math.abs(u)}const U2e=new d,DB=new d;function fQ(e,t,n,i){const o=d.normalize(i.cartographicToCartesian(t,DB),U2e),r=d.normalize(i.cartographicToCartesian(n,DB),DB);E.typeOf.number.greaterThanOrEquals("value",Math.abs(Math.abs(d.angleBetween(o,r))-Math.PI),.0125);const s=i.maximumRadius,a=i.minimumRadius,c=s*s,u=a*a;e._ellipticitySquared=(c-u)/c,e._ellipticity=Math.sqrt(e._ellipticitySquared),e._start=ve.clone(t,e._start),e._start.height=0,e._end=ve.clone(n,e._end),e._end.height=0,e._heading=F2e(e,t.longitude,t.latitude,n.longitude,n.latitude),e._distance=z2e(e,i.maximumRadius,i.minimumRadius,t.longitude,t.latitude,n.longitude,n.latitude)}function dQ(e,t,n,i,o,r){if(n===0)return ve.clone(e,r);const s=o*o;let a,c,u;if(Math.abs(F.PI_OVER_TWO-Math.abs(t))>F.EPSILON8){const f=pF(o,i,e.latitude),h=n*Math.cos(t),_=f+h;c=M2e(_,o,i);const g=oT(o,e.latitude),p=oT(o,c);u=Math.tan(t)*(p-g),a=F.negativePiToPi(e.longitude+u)}else{c=e.latitude;let f;if(o===0)f=i*Math.cos(e.latitude);else{const h=Math.sin(e.latitude);f=i*Math.cos(e.latitude)/Math.sqrt(1-s*h*h)}u=n/f,t>0?a=F.negativePiToPi(e.longitude+u):a=F.negativePiToPi(e.longitude-u)}return l(r)?(r.longitude=a,r.latitude=c,r.height=0,r):new ve(a,c,0)}function js(e,t,n){const i=A(n,be.WGS84);this._ellipsoid=i,this._start=new ve,this._end=new ve,this._heading=void 0,this._distance=void 0,this._ellipticity=void 0,this._ellipticitySquared=void 0,l(e)&&l(t)&&fQ(this,e,t,i)}Object.defineProperties(js.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},surfaceDistance:{get:function(){return E.defined("distance",this._distance),this._distance}},start:{get:function(){return this._start}},end:{get:function(){return this._end}},heading:{get:function(){return E.defined("distance",this._distance),this._heading}}});js.fromStartHeadingDistance=function(e,t,n,i,o){E.defined("start",e),E.defined("heading",t),E.defined("distance",n),E.typeOf.number.greaterThan("distance",n,0);const r=A(i,be.WGS84),s=r.maximumRadius,a=r.minimumRadius,c=s*s,u=a*a,f=Math.sqrt((c-u)/c);t=F.negativePiToPi(t);const h=dQ(e,t,n,r.maximumRadius,f);return!l(o)||l(i)&&!i.equals(o.ellipsoid)?new js(e,h,r):(o.setEndPoints(e,h),o)};js.prototype.setEndPoints=function(e,t){E.defined("start",e),E.defined("end",t),fQ(this,e,t,this._ellipsoid)};js.prototype.interpolateUsingFraction=function(e,t){return this.interpolateUsingSurfaceDistance(e*this._distance,t)};js.prototype.interpolateUsingSurfaceDistance=function(e,t){if(E.typeOf.number("distance",e),!l(this._distance)||this._distance===0)throw new w("EllipsoidRhumbLine must have distinct start and end set.");return dQ(this._start,this._heading,e,this._ellipsoid.maximumRadius,this._ellipticity,t)};js.prototype.findIntersectionWithLongitude=function(e,t){if(E.typeOf.number("intersectionLongitude",e),!l(this._distance)||this._distance===0)throw new w("EllipsoidRhumbLine must have distinct start and end set.");const n=this._ellipticity,i=this._heading,o=Math.abs(i),r=this._start;if(e=F.negativePiToPi(e),F.equalsEpsilon(Math.abs(e),Math.PI,F.EPSILON14)&&(e=F.sign(r.longitude)*Math.PI),l(t)||(t=new ve),Math.abs(F.PI_OVER_TWO-o)<=F.EPSILON8)return t.longitude=e,t.latitude=r.latitude,t.height=0,t;if(F.equalsEpsilon(Math.abs(F.PI_OVER_TWO-o),F.PI_OVER_TWO,F.EPSILON8))return F.equalsEpsilon(e,r.longitude,F.EPSILON12)?void 0:(t.longitude=e,t.latitude=F.PI_OVER_TWO*F.sign(F.PI_OVER_TWO-i),t.height=0,t);const s=r.latitude,a=n*Math.sin(s),c=Math.tan(.5*(F.PI_OVER_TWO+s))*Math.exp((e-r.longitude)/Math.tan(i)),u=(1+a)/(1-a);let f=r.latitude,h;do{h=f;const _=n*Math.sin(h),g=(1+_)/(1-_);f=2*Math.atan(c*Math.pow(g/u,n/2))-F.PI_OVER_TWO}while(!F.equalsEpsilon(f,h,F.EPSILON12));return t.longitude=e,t.latitude=f,t.height=0,t};js.prototype.findIntersectionWithLatitude=function(e,t){if(E.typeOf.number("intersectionLatitude",e),!l(this._distance)||this._distance===0)throw new w("EllipsoidRhumbLine must have distinct start and end set.");const n=this._ellipticity,i=this._heading,o=this._start;if(F.equalsEpsilon(Math.abs(i),F.PI_OVER_TWO,F.EPSILON8))return;const r=oT(n,o.latitude),s=oT(n,e),a=Math.tan(i)*(s-r),c=F.negativePiToPi(o.longitude+a);return l(t)?(t.longitude=c,t.latitude=e,t.height=0,t):new ve(c,e,0)};const H2e=new d,V2e=new d,Qm={};Qm.computeArea2D=function(e){E.defined("positions",e),E.typeOf.number.greaterThanOrEquals("positions.length",e.length,3);const t=e.length;let n=0;for(let i=t-1,o=0;o<t;i=o++){const r=e[i],s=e[o];n+=r.x*s.y-s.x*r.y}return n*.5};Qm.computeWindingOrder2D=function(e){return Qm.computeArea2D(e)>0?pu.COUNTER_CLOCKWISE:pu.CLOCKWISE};Qm.triangulate=function(e,t){E.defined("positions",e);const n=$.packArray(e);return HI(n,t,2)};const hQ=new d,pQ=new d,mQ=new d,J8=new d,Q8=new d,Z8=new d,Ch=new d,_Q=new $,gQ=new $,yQ=new $,vA=new $;Qm.computeSubdivision=function(e,t,n,i,o){o=A(o,F.RADIANS_PER_DEGREE);const r=l(i);E.typeOf.object("ellipsoid",e),E.defined("positions",t),E.defined("indices",n),E.typeOf.number.greaterThanOrEquals("indices.length",n.length,3),E.typeOf.number.equals("indices.length % 3","0",n.length%3,0),E.typeOf.number.greaterThan("granularity",o,0);const s=n.slice(0);let a;const c=t.length,u=new Array(c*3),f=new Array(c*2);let h=0,_=0;for(a=0;a<c;a++){const v=t[a];if(u[h++]=v.x,u[h++]=v.y,u[h++]=v.z,r){const D=i[a];f[_++]=D.x,f[_++]=D.y}}const g=[],p={},y=e.maximumRadius,T=F.chordLength(o,y),b=T*T;for(;s.length>0;){const v=s.pop(),D=s.pop(),L=s.pop(),B=d.fromArray(u,L*3,hQ),V=d.fromArray(u,D*3,pQ),M=d.fromArray(u,v*3,mQ);let H,G,I;r&&(H=$.fromArray(f,L*2,_Q),G=$.fromArray(f,D*2,gQ),I=$.fromArray(f,v*2,yQ));const O=d.multiplyByScalar(d.normalize(B,J8),y,J8),m=d.multiplyByScalar(d.normalize(V,Q8),y,Q8),P=d.multiplyByScalar(d.normalize(M,Z8),y,Z8),R=d.magnitudeSquared(d.subtract(O,m,Ch)),U=d.magnitudeSquared(d.subtract(m,P,Ch)),W=d.magnitudeSquared(d.subtract(P,O,Ch)),q=Math.max(R,U,W);let Y,j,ee;q>b?R===q?(Y=`${Math.min(L,D)} ${Math.max(L,D)}`,a=p[Y],l(a)||(j=d.add(B,V,Ch),d.multiplyByScalar(j,.5,j),u.push(j.x,j.y,j.z),a=u.length/3-1,p[Y]=a,r&&(ee=$.add(H,G,vA),$.multiplyByScalar(ee,.5,ee),f.push(ee.x,ee.y))),s.push(L,a,v),s.push(a,D,v)):U===q?(Y=`${Math.min(D,v)} ${Math.max(D,v)}`,a=p[Y],l(a)||(j=d.add(V,M,Ch),d.multiplyByScalar(j,.5,j),u.push(j.x,j.y,j.z),a=u.length/3-1,p[Y]=a,r&&(ee=$.add(G,I,vA),$.multiplyByScalar(ee,.5,ee),f.push(ee.x,ee.y))),s.push(D,a,L),s.push(a,v,L)):W===q&&(Y=`${Math.min(v,L)} ${Math.max(v,L)}`,a=p[Y],l(a)||(j=d.add(M,B,Ch),d.multiplyByScalar(j,.5,j),u.push(j.x,j.y,j.z),a=u.length/3-1,p[Y]=a,r&&(ee=$.add(I,H,vA),$.multiplyByScalar(ee,.5,ee),f.push(ee.x,ee.y))),s.push(v,a,D),s.push(a,L,D)):(g.push(L),g.push(D),g.push(v))}const x={attributes:{position:new Xe({componentDatatype:oe.DOUBLE,componentsPerAttribute:3,values:u})},indices:g,primitiveType:dt.TRIANGLES};return r&&(x.attributes.st=new Xe({componentDatatype:oe.FLOAT,componentsPerAttribute:2,values:f})),new $t(x)};const k2e=new ve,G2e=new ve,W2e=new ve,IB=new ve;Qm.computeRhumbLineSubdivision=function(e,t,n,i,o){o=A(o,F.RADIANS_PER_DEGREE);const r=l(i);E.typeOf.object("ellipsoid",e),E.defined("positions",t),E.defined("indices",n),E.typeOf.number.greaterThanOrEquals("indices.length",n.length,3),E.typeOf.number.equals("indices.length % 3","0",n.length%3,0),E.typeOf.number.greaterThan("granularity",o,0);const s=n.slice(0);let a;const c=t.length,u=new Array(c*3),f=new Array(c*2);let h=0,_=0;for(a=0;a<c;a++){const L=t[a];if(u[h++]=L.x,u[h++]=L.y,u[h++]=L.z,r){const B=i[a];f[_++]=B.x,f[_++]=B.y}}const g=[],p={},y=e.maximumRadius,T=F.chordLength(o,y),b=new js(void 0,void 0,e),x=new js(void 0,void 0,e),v=new js(void 0,void 0,e);for(;s.length>0;){const L=s.pop(),B=s.pop(),V=s.pop(),M=d.fromArray(u,V*3,hQ),H=d.fromArray(u,B*3,pQ),G=d.fromArray(u,L*3,mQ);let I,O,m;r&&(I=$.fromArray(f,V*2,_Q),O=$.fromArray(f,B*2,gQ),m=$.fromArray(f,L*2,yQ));const P=e.cartesianToCartographic(M,k2e),R=e.cartesianToCartographic(H,G2e),U=e.cartesianToCartographic(G,W2e);b.setEndPoints(P,R);const W=b.surfaceDistance;x.setEndPoints(R,U);const q=x.surfaceDistance;v.setEndPoints(U,P);const Y=v.surfaceDistance,j=Math.max(W,q,Y);let ee,K,se,Q,Z;j>T?W===j?(ee=`${Math.min(V,B)} ${Math.max(V,B)}`,a=p[ee],l(a)||(K=b.interpolateUsingFraction(.5,IB),se=(P.height+R.height)*.5,Q=d.fromRadians(K.longitude,K.latitude,se,e,Ch),u.push(Q.x,Q.y,Q.z),a=u.length/3-1,p[ee]=a,r&&(Z=$.add(I,O,vA),$.multiplyByScalar(Z,.5,Z),f.push(Z.x,Z.y))),s.push(V,a,L),s.push(a,B,L)):q===j?(ee=`${Math.min(B,L)} ${Math.max(B,L)}`,a=p[ee],l(a)||(K=x.interpolateUsingFraction(.5,IB),se=(R.height+U.height)*.5,Q=d.fromRadians(K.longitude,K.latitude,se,e,Ch),u.push(Q.x,Q.y,Q.z),a=u.length/3-1,p[ee]=a,r&&(Z=$.add(O,m,vA),$.multiplyByScalar(Z,.5,Z),f.push(Z.x,Z.y))),s.push(B,a,V),s.push(a,L,V)):Y===j&&(ee=`${Math.min(L,V)} ${Math.max(L,V)}`,a=p[ee],l(a)||(K=v.interpolateUsingFraction(.5,IB),se=(U.height+P.height)*.5,Q=d.fromRadians(K.longitude,K.latitude,se,e,Ch),u.push(Q.x,Q.y,Q.z),a=u.length/3-1,p[ee]=a,r&&(Z=$.add(m,I,vA),$.multiplyByScalar(Z,.5,Z),f.push(Z.x,Z.y))),s.push(L,a,B),s.push(a,V,B)):(g.push(V),g.push(B),g.push(L))}const D={attributes:{position:new Xe({componentDatatype:oe.DOUBLE,componentsPerAttribute:3,values:u})},indices:g,primitiveType:dt.TRIANGLES};return r&&(D.attributes.st=new Xe({componentDatatype:oe.FLOAT,componentsPerAttribute:2,values:f})),new $t(D)};Qm.scaleToGeodeticHeight=function(e,t,n,i){n=A(n,be.WGS84);let o=H2e,r=V2e;if(t=A(t,0),i=A(i,!0),l(e)){const s=e.length;for(let a=0;a<s;a+=3)d.fromArray(e,a,r),i&&(r=n.scaleToGeodeticSurface(r,r)),t!==0&&(o=n.geodeticSurfaceNormal(r,o),d.multiplyByScalar(o,t,o),d.add(r,o,r)),e[a]=r.x,e[a+1]=r.y,e[a+2]=r.z}return e};const wo=Qm,e6=Math.cos,t6=Math.sin,q2e=Math.sqrt,Ez={};Ez.computePosition=function(e,t,n,i,o,r,s){const a=t.radiiSquared,c=e.nwCorner,u=e.boundingRectangle;let f=c.latitude-e.granYCos*i+o*e.granXSin;const h=e6(f),_=t6(f),g=a.z*_;let p=c.longitude+i*e.granYSin+o*e.granXCos;const y=h*e6(p),T=h*t6(p),b=a.x*y,x=a.y*T,v=q2e(b*y+x*T+g*_);if(r.x=b/v,r.y=x/v,r.z=g/v,n){const D=e.stNwCorner;l(D)?(f=D.latitude-e.stGranYCos*i+o*e.stGranXSin,p=D.longitude+i*e.stGranYSin+o*e.stGranXCos,s.x=(p-e.stWest)*e.lonScalar,s.y=(f-e.stSouth)*e.latScalar):(s.x=(p-u.west)*e.lonScalar,s.y=(f-u.south)*e.latScalar)}};const j2e=new Et;let Hl=new d;const Y2e=new ve;let VI=new d;const mF=new Or;function n6(e,t,n,i,o,r,s){const a=Math.cos(t),c=i*a,u=n*a,f=Math.sin(t),h=i*f,_=n*f;Hl=mF.project(e,Hl),Hl=d.subtract(Hl,VI,Hl);const g=Et.fromRotation(t,j2e);Hl=Et.multiplyByVector(g,Hl,Hl),Hl=d.add(Hl,VI,Hl),e=mF.unproject(Hl,e),r-=1,s-=1;const p=e.latitude,y=p+r*_,T=p-c*s,b=p-c*s+r*_,x=Math.max(p,y,T,b),v=Math.min(p,y,T,b),D=e.longitude,L=D+r*u,B=D+s*h,V=D+s*h+r*u,M=Math.max(D,L,B,V),H=Math.min(D,L,B,V);return{north:x,south:v,east:M,west:H,granYCos:c,granYSin:h,granXCos:u,granXSin:_,nwCorner:e}}Ez.computeOptions=function(e,t,n,i,o,r,s){let a=e.east,c=e.west,u=e.north,f=e.south,h=!1,_=!1;u===F.PI_OVER_TWO&&(h=!0),f===-F.PI_OVER_TWO&&(_=!0);let g;const p=u-f;c>a?g=F.TWO_PI-c+a:g=a-c;const y=Math.ceil(g/t)+1,T=Math.ceil(p/t)+1,b=g/(y-1),x=p/(T-1),v=Ee.northwest(e,r),D=Ee.center(e,Y2e);(n!==0||i!==0)&&(D.longitude<v.longitude&&(D.longitude+=F.TWO_PI),VI=mF.project(D,VI));const L=x,B=b,V=0,M=0,H=Ee.clone(e,o),G={granYCos:L,granYSin:V,granXCos:B,granXSin:M,nwCorner:v,boundingRectangle:H,width:y,height:T,northCap:h,southCap:_};if(n!==0){const I=n6(v,n,b,x,D,y,T);if(u=I.north,f=I.south,a=I.east,c=I.west,u<-F.PI_OVER_TWO||u>F.PI_OVER_TWO||f<-F.PI_OVER_TWO||f>F.PI_OVER_TWO)throw new w("Rotated rectangle is invalid. It crosses over either the north or south pole.");G.granYCos=I.granYCos,G.granYSin=I.granYSin,G.granXCos=I.granXCos,G.granXSin=I.granXSin,H.north=u,H.south=f,H.east=a,H.west=c}if(i!==0){n=n-i;const I=Ee.northwest(H,s),O=n6(I,n,b,x,D,y,T);G.stGranYCos=O.granYCos,G.stGranXCos=O.granXCos,G.stGranYSin=O.granYSin,G.stGranXSin=O.granXSin,G.stNwCorner=I,G.stWest=O.west,G.stSouth=O.south}return G};const dc=Ez,$2e=new Ae,X2e=new Ae,K2e=new d,J2e=new Ee;function AQ(e,t){const n=e._ellipsoid,i=t.height,o=t.width,r=t.northCap,s=t.southCap;let a=i,c=2,u=0,f=4;r&&(c-=1,a-=1,u+=1,f-=2),s&&(c-=1,a-=1,u+=1,f-=2),u+=c*o+2*a-f;const h=new Float64Array(u*3);let _=0,g=0,p;const y=K2e;if(r)dc.computePosition(t,n,!1,g,0,y),h[_++]=y.x,h[_++]=y.y,h[_++]=y.z;else for(p=0;p<o;p++)dc.computePosition(t,n,!1,g,p,y),h[_++]=y.x,h[_++]=y.y,h[_++]=y.z;for(p=o-1,g=1;g<i;g++)dc.computePosition(t,n,!1,g,p,y),h[_++]=y.x,h[_++]=y.y,h[_++]=y.z;if(g=i-1,!s)for(p=o-2;p>=0;p--)dc.computePosition(t,n,!1,g,p,y),h[_++]=y.x,h[_++]=y.y,h[_++]=y.z;for(p=0,g=i-2;g>0;g--)dc.computePosition(t,n,!1,g,p,y),h[_++]=y.x,h[_++]=y.y,h[_++]=y.z;const T=h.length/3*2,b=At.createTypedArray(h.length/3,T);let x=0;for(let D=0;D<h.length/3-1;D++)b[x++]=D,b[x++]=D+1;b[x++]=h.length/3-1,b[x++]=0;const v=new $t({attributes:new To,primitiveType:dt.LINES});return v.attributes.position=new Xe({componentDatatype:oe.DOUBLE,componentsPerAttribute:3,values:h}),v.indices=b,v}function Q2e(e,t){const n=e._surfaceHeight,i=e._extrudedHeight,o=e._ellipsoid,r=i,s=n,a=AQ(e,t),c=t.height,u=t.width,f=wo.scaleToGeodeticHeight(a.attributes.position.values,s,o,!1);let h=f.length;const _=new Float64Array(h*2);_.set(f);const g=wo.scaleToGeodeticHeight(a.attributes.position.values,r,o);_.set(g,h),a.attributes.position.values=_;const p=t.northCap,y=t.southCap;let T=4;p&&(T-=1),y&&(T-=1);const b=(_.length/3+T)*2,x=At.createTypedArray(_.length/3,b);h=_.length/6;let v=0;for(let L=0;L<h-1;L++)x[v++]=L,x[v++]=L+1,x[v++]=L+h,x[v++]=L+h+1;x[v++]=h-1,x[v++]=0,x[v++]=h+h-1,x[v++]=h,x[v++]=0,x[v++]=h;let D;if(p)D=c-1;else{const L=u-1;x[v++]=L,x[v++]=L+h,D=u+c-2}if(x[v++]=D,x[v++]=D+h,!y){const L=u+D-1;x[v++]=L,x[v]=L+h}return a.indices=x,a}function oy(e){e=A(e,A.EMPTY_OBJECT);const t=e.rectangle,n=A(e.granularity,F.RADIANS_PER_DEGREE),i=A(e.ellipsoid,be.WGS84),o=A(e.rotation,0);if(!l(t))throw new w("rectangle is required.");if(Ee.validate(t),t.north<t.south)throw new w("options.rectangle.north must be greater than options.rectangle.south");const r=A(e.height,0),s=A(e.extrudedHeight,r);this._rectangle=Ee.clone(t),this._granularity=n,this._ellipsoid=i,this._surfaceHeight=Math.max(r,s),this._rotation=o,this._extrudedHeight=Math.min(r,s),this._offsetAttribute=e.offsetAttribute,this._workerName="createRectangleOutlineGeometry"}oy.packedLength=Ee.packedLength+be.packedLength+5;oy.pack=function(e,t,n){if(!l(e))throw new w("value is required");if(!l(t))throw new w("array is required");return n=A(n,0),Ee.pack(e._rectangle,t,n),n+=Ee.packedLength,be.pack(e._ellipsoid,t,n),n+=be.packedLength,t[n++]=e._granularity,t[n++]=e._surfaceHeight,t[n++]=e._rotation,t[n++]=e._extrudedHeight,t[n]=A(e._offsetAttribute,-1),t};const TQ=new Ee,CQ=be.clone(be.UNIT_SPHERE),E0={rectangle:TQ,ellipsoid:CQ,granularity:void 0,height:void 0,rotation:void 0,extrudedHeight:void 0,offsetAttribute:void 0};oy.unpack=function(e,t,n){if(!l(e))throw new w("array is required");t=A(t,0);const i=Ee.unpack(e,t,TQ);t+=Ee.packedLength;const o=be.unpack(e,t,CQ);t+=be.packedLength;const r=e[t++],s=e[t++],a=e[t++],c=e[t++],u=e[t];return l(n)?(n._rectangle=Ee.clone(i,n._rectangle),n._ellipsoid=be.clone(o,n._ellipsoid),n._surfaceHeight=s,n._rotation=a,n._extrudedHeight=c,n._offsetAttribute=u===-1?void 0:u,n):(E0.granularity=r,E0.height=s,E0.rotation=a,E0.extrudedHeight=c,E0.offsetAttribute=u===-1?void 0:u,new oy(E0))};const Z2e=new ve;oy.createGeometry=function(e){const t=e._rectangle,n=e._ellipsoid,i=dc.computeOptions(t,e._granularity,e._rotation,0,J2e,Z2e);let o,r;if(F.equalsEpsilon(t.north,t.south,F.EPSILON10)||F.equalsEpsilon(t.east,t.west,F.EPSILON10))return;const s=e._surfaceHeight,a=e._extrudedHeight,c=!F.equalsEpsilon(s,a,0,F.EPSILON2);let u;if(c){if(o=Q2e(e,i),l(e._offsetAttribute)){const _=o.attributes.position.values.length/3;let g=new Uint8Array(_);e._offsetAttribute===Fn.TOP?g=g.fill(1,0,_/2):(u=e._offsetAttribute===Fn.NONE?0:1,g=g.fill(u)),o.attributes.applyOffset=new Xe({componentDatatype:oe.UNSIGNED_BYTE,componentsPerAttribute:1,values:g})}const f=Ae.fromRectangle3D(t,n,s,X2e),h=Ae.fromRectangle3D(t,n,a,$2e);r=Ae.union(f,h)}else{if(o=AQ(e,i),o.attributes.position.values=wo.scaleToGeodeticHeight(o.attributes.position.values,s,n,!1),l(e._offsetAttribute)){const f=o.attributes.position.values.length;u=e._offsetAttribute===Fn.NONE?0:1;const h=new Uint8Array(f/3).fill(u);o.attributes.applyOffset=new Xe({componentDatatype:oe.UNSIGNED_BYTE,componentsPerAttribute:1,values:h})}r=Ae.fromRectangle3D(t,n,s)}return new $t({attributes:o.attributes,indices:o.indices,primitiveType:dt.LINES,boundingSphere:r,offsetAttribute:e._offsetAttribute})};function Td(e){E.typeOf.object("options",e),E.typeOf.object("options.rectangle",e.rectangle),this.rectangle=Ee.clone(e.rectangle),this.minimumHeight=A(e.minimumHeight,0),this.maximumHeight=A(e.maximumHeight,0),this.southwestCornerCartesian=new d,this.northeastCornerCartesian=new d,this.westNormal=new d,this.southNormal=new d,this.eastNormal=new d,this.northNormal=new d;const t=A(e.ellipsoid,be.WGS84);o3e(this,e.rectangle,t),this._orientedBoundingBox=void 0,this._boundingSphere=void 0,A(e.computeBoundingVolumes,!0)&&this.computeBoundingVolumes(t)}Object.defineProperties(Td.prototype,{boundingVolume:{get:function(){return this._orientedBoundingBox}},boundingSphere:{get:function(){return this._boundingSphere}}});Td.prototype.computeBoundingVolumes=function(e){this._orientedBoundingBox=Zt.fromRectangle(this.rectangle,this.minimumHeight,this.maximumHeight,e),this._boundingSphere=Ae.fromOrientedBoundingBox(this._orientedBoundingBox)};const i6=new d,ZS=new d,o6=new d,e3e=new d,t3e=new d,n3e=new d,i3e=new d,Vl=new ve,r6=new Wt(d.UNIT_X,0),x0=new ii;function o3e(e,t,n){n.cartographicToCartesian(Ee.southwest(t),e.southwestCornerCartesian),n.cartographicToCartesian(Ee.northeast(t),e.northeastCornerCartesian),Vl.longitude=t.west,Vl.latitude=(t.south+t.north)*.5,Vl.height=0;const i=n.cartographicToCartesian(Vl,n3e),o=d.cross(i,d.UNIT_Z,e3e);d.normalize(o,e.westNormal),Vl.longitude=t.east;const r=n.cartographicToCartesian(Vl,i3e),s=d.cross(d.UNIT_Z,r,i6);d.normalize(s,e.eastNormal);let a=d.subtract(i,r,i6);d.magnitude(a)===0&&(a=d.clone(o,a));const c=d.normalize(a,t3e),u=t.south;let f;if(u>0){Vl.longitude=(t.west+t.east)*.5,Vl.latitude=u;const y=n.cartographicToCartesian(Vl,x0.origin);d.clone(c,x0.direction);const T=Wt.fromPointNormal(e.southwestCornerCartesian,e.westNormal,r6);qr.rayPlane(x0,T,e.southwestCornerCartesian),f=n.geodeticSurfaceNormal(y,ZS)}else f=n.geodeticSurfaceNormalCartographic(Ee.southeast(t),ZS);const h=d.cross(f,a,o6);d.normalize(h,e.southNormal);const _=t.north;let g;if(_<0){Vl.longitude=(t.west+t.east)*.5,Vl.latitude=_;const y=n.cartographicToCartesian(Vl,x0.origin);d.negate(c,x0.direction);const T=Wt.fromPointNormal(e.northeastCornerCartesian,e.eastNormal,r6);qr.rayPlane(x0,T,e.northeastCornerCartesian),g=n.geodeticSurfaceNormal(y,ZS)}else g=n.geodeticSurfaceNormalCartographic(Ee.northwest(t),ZS);const p=d.cross(a,g,o6);d.normalize(p,e.northNormal)}const r3e=new d,s3e=new d,a3e=new d(0,-1,0),c3e=new d(0,0,-1),s6=new d;function l3e(e,t){const n=t.camera,i=n.positionWC,o=n.positionCartographic;let r=0;if(!Ee.contains(e.rectangle,o)){let u=e.southwestCornerCartesian,f=e.northeastCornerCartesian,h=e.westNormal,_=e.southNormal,g=e.eastNormal,p=e.northNormal;t.mode!==me.SCENE3D&&(u=t.mapProjection.project(Ee.southwest(e.rectangle),r3e),u.z=u.y,u.y=u.x,u.x=0,f=t.mapProjection.project(Ee.northeast(e.rectangle),s3e),f.z=f.y,f.y=f.x,f.x=0,h=a3e,g=d.UNIT_Y,_=c3e,p=d.UNIT_Z);const y=d.subtract(i,u,s6),T=d.dot(y,h),b=d.dot(y,_),x=d.subtract(i,f,s6),v=d.dot(x,g),D=d.dot(x,p);T>0?r+=T*T:v>0&&(r+=v*v),b>0?r+=b*b:D>0&&(r+=D*D)}let s,a,c;if(t.mode===me.SCENE3D?(s=o.height,a=e.minimumHeight,c=e.maximumHeight):(s=i.x,a=0,c=0),s>c){const u=s-c;r+=u*u}else if(s<a){const u=a-s;r+=u*u}return Math.sqrt(r)}Td.prototype.distanceToCamera=function(e){E.defined("frameState",e);const t=l3e(this,e);if(e.mode===me.SCENE3D&&l(this._orientedBoundingBox)){const n=Math.sqrt(this._orientedBoundingBox.distanceSquaredTo(e.camera.positionWC));return Math.max(t,n)}return t};Td.prototype.intersectPlane=function(e){return E.defined("plane",e),this._orientedBoundingBox.intersectPlane(e)};Td.prototype.createDebugVolume=function(e){E.defined("color",e);const t=new N.clone(N.IDENTITY),n=new oy({rectangle:this.rectangle,height:this.minimumHeight,extrudedHeight:this.maximumHeight}),i=new xn({geometry:n,id:"outline",modelMatrix:t,attributes:{color:Bn.fromColor(e)}});return new fn({geometryInstances:i,appearance:new kn({translucent:!1,flat:!0}),asynchronous:!1})};function Wo(e){if(!l(e))throw new w("options is required.");if(l(e.terrainProvider))if(l(e.imageryLayers)){if(!l(e.surfaceShaderSet))throw new w("options.surfaceShaderSet is required.")}else throw new w("options.imageryLayers is required.");else throw new w("options.terrainProvider is required.");this.lightingFadeOutDistance=65e5,this.lightingFadeInDistance=9e6,this.hasWaterMask=!1,this.oceanNormalMap=void 0,this.zoomedOutOceanSpecularIntensity=.5,this.enableLighting=!1,this.dynamicAtmosphereLighting=!1,this.dynamicAtmosphereLightingFromSun=!1,this.showGroundAtmosphere=!1,this.shadows=sr.RECEIVE_ONLY,this.vertexShadowDarkness=.3,this.fillHighlightColor=void 0,this.hueShift=0,this.saturationShift=0,this.brightnessShift=0,this.showSkirts=!0,this.backFaceCulling=!0,this.undergroundColor=void 0,this.undergroundColorAlphaByDistance=void 0,this.lambertDiffuseMultiplier=0,this.materialUniformMap=void 0,this._materialUniformMap=void 0,this._quadtree=void 0,this._terrainProvider=e.terrainProvider,this._imageryLayers=e.imageryLayers,this._surfaceShaderSet=e.surfaceShaderSet,this._renderState=void 0,this._blendRenderState=void 0,this._disableCullingRenderState=void 0,this._disableCullingBlendRenderState=void 0,this._errorEvent=new lt,this._imageryLayers.layerAdded.addEventListener(Wo.prototype._onLayerAdded,this),this._imageryLayers.layerRemoved.addEventListener(Wo.prototype._onLayerRemoved,this),this._imageryLayers.layerMoved.addEventListener(Wo.prototype._onLayerMoved,this),this._imageryLayers.layerShownOrHidden.addEventListener(Wo.prototype._onLayerShownOrHidden,this),this._imageryLayersUpdatedEvent=new lt,this._layerOrderChanged=!1,this._tilesToRenderByTextureCount=[],this._drawCommands=[],this._uniformMaps=[],this._usedDrawCommands=0,this._vertexArraysToDestroy=[],this._debug={wireframe:!1,boundingSphereTile:void 0},this._baseColor=void 0,this._firstPassInitialColor=void 0,this.baseColor=new k(0,0,.5,1),this._clippingPlanes=void 0,this.cartographicLimitRectangle=Ee.clone(Ee.MAX_VALUE),this._hasLoadedTilesThisFrame=!1,this._hasFillTilesThisFrame=!1,this._oldTerrainExaggeration=void 0,this._oldTerrainExaggerationRelativeHeight=void 0}Object.defineProperties(Wo.prototype,{baseColor:{get:function(){return this._baseColor},set:function(e){if(!l(e))throw new w("value is required.");this._baseColor=e,this._firstPassInitialColor=ue.fromColor(e,this._firstPassInitialColor)}},quadtree:{get:function(){return this._quadtree},set:function(e){if(!l(e))throw new w("value is required.");this._quadtree=e}},ready:{get:function(){return this._terrainProvider.ready&&(this._imageryLayers.length===0||this._imageryLayers.get(0).imageryProvider.ready)}},tilingScheme:{get:function(){return this._terrainProvider.tilingScheme}},errorEvent:{get:function(){return this._errorEvent}},imageryLayersUpdatedEvent:{get:function(){return this._imageryLayersUpdatedEvent}},terrainProvider:{get:function(){return this._terrainProvider},set:function(e){if(this._terrainProvider!==e){if(!l(e))throw new w("terrainProvider is required.");this._terrainProvider=e,l(this._quadtree)&&this._quadtree.invalidateAllTiles()}}},clippingPlanes:{get:function(){return this._clippingPlanes},set:function(e){rr.setOwner(e,this,"_clippingPlanes")}}});function u3e(e,t){let n=e.loadingImagery;l(n)||(n=e.readyImagery);let i=t.loadingImagery;return l(i)||(i=t.readyImagery),n.imageryLayer._layerIndex-i.imageryLayer._layerIndex}Wo.prototype.update=function(e){this._imageryLayers._update()};function f3e(e,t){const n=t.creditDisplay;e._terrainProvider.ready&&l(e._terrainProvider.credit)&&n.addCredit(e._terrainProvider.credit);const i=e._imageryLayers;for(let o=0,r=i.length;o<r;++o){const s=i.get(o).imageryProvider;s.ready&&l(s.credit)&&n.addCredit(s.credit)}}Wo.prototype.initialize=function(e){this._imageryLayers.queueReprojectionCommands(e),this._layerOrderChanged&&(this._layerOrderChanged=!1,this._quadtree.forEachLoadedTile(function(i){i.data.imagery.sort(u3e)})),f3e(this,e);const t=this._vertexArraysToDestroy,n=t.length;for(let i=0;i<n;++i)no._freeVertexArray(t[i]);t.length=0};Wo.prototype.beginUpdate=function(e){const t=this._tilesToRenderByTextureCount;for(let i=0,o=t.length;i<o;++i){const r=t[i];l(r)&&(r.length=0)}const n=this._clippingPlanes;l(n)&&n.enabled&&n.update(e),this._usedDrawCommands=0,this._hasLoadedTilesThisFrame=!1,this._hasFillTilesThisFrame=!1};Wo.prototype.endUpdate=function(e){if(!l(this._renderState)){this._renderState=ht.fromCache({cull:{enabled:!0},depthTest:{enabled:!0,func:ty.LESS}}),this._blendRenderState=ht.fromCache({cull:{enabled:!0},depthTest:{enabled:!0,func:ty.LESS_OR_EQUAL},blending:fo.ALPHA_BLEND});let s=St(this._renderState,!0);s.cull.enabled=!1,this._disableCullingRenderState=ht.fromCache(s),s=St(this._blendRenderState,!0),s.cull.enabled=!1,this._disableCullingBlendRenderState=ht.fromCache(s)}this._hasFillTilesThisFrame&&this._hasLoadedTilesThisFrame&&Oy.updateFillTiles(this,this._quadtree._tilesToRender,e,this._vertexArraysToDestroy);const t=this.quadtree,n=e.terrainExaggeration,i=e.terrainExaggerationRelativeHeight,o=this._oldTerrainExaggeration!==n||this._oldTerrainExaggerationRelativeHeight!==i;this._oldTerrainExaggeration=n,this._oldTerrainExaggerationRelativeHeight=i,o&&t.forEachLoadedTile(function(s){s.data.updateExaggeration(s,e,t)});const r=this._tilesToRenderByTextureCount;for(let s=0,a=r.length;s<a;++s){const c=r[s];if(l(c))for(let u=0,f=c.length;u<f;++u){const h=c[u],_=h.data.tileBoundingRegion;N3e(this,h,e),e.minimumTerrainHeight=Math.min(e.minimumTerrainHeight,_.minimumHeight)}}};function bQ(e,t){const n=t.globeTranslucencyState;if(n.translucent){const i=e.renderState.blending.enabled;n.pushDerivedCommands(e,i,t)}else t.commandList.push(e)}Wo.prototype.updateForPick=function(e){const t=this._drawCommands;for(let n=0,i=this._usedDrawCommands;n<i;++n)bQ(t[n],e)};Wo.prototype.cancelReprojections=function(){this._imageryLayers.cancelReprojections()};Wo.prototype.getLevelMaximumGeometricError=function(e){return this._terrainProvider.getLevelMaximumGeometricError(e)};Wo.prototype.loadTile=function(e,t){let n=t.data,i=!0,o;l(n)&&(i=n.boundingVolumeSourceTile!==t||t._lastSelectionResult===Ti.CULLED_BUT_NEEDED,o=n.terrainState),no.processStateMachine(t,e,this.terrainProvider,this._imageryLayers,this.quadtree,this._vertexArraysToDestroy,i),n=t.data,i&&o!==t.data.terrainState&&this.computeTileVisibility(t,e,this.quadtree.occluders)!==Es.NONE&&n.boundingVolumeSourceTile===t&&(i=!1,no.processStateMachine(t,e,this.terrainProvider,this._imageryLayers,this.quadtree,this._vertexArraysToDestroy,i))};const d3e=new Ae,EQ=new Ee,h3e=new Ee,p3e=new ve;function LD(e,t){if(t.west<t.east)return t;const n=Ee.clone(t,h3e);return Ee.center(e,p3e).longitude>0?n.east=F.PI:n.west=-F.PI,n}function xQ(e,t){if(t.cameraUnderground||t.globeTranslucencyState.translucent)return!0;if(e.backFaceCulling)return!1;const n=e._clippingPlanes;return!!(l(n)&&n.enabled||!Ee.equals(e.cartographicLimitRectangle,Ee.MAX_VALUE))}Wo.prototype.computeTileVisibility=function(e,t,n){const i=this.computeDistanceToTile(e,t);e._distance=i;const o=xQ(this,t);if(t.fog.enabled&&!o&&F.fog(i,t.fog.density)>=1)return Es.NONE;const r=e.data,s=r.tileBoundingRegion;if(r.boundingVolumeSourceTile===void 0)return Es.PARTIAL;const a=t.cullingVolume;let c=s.boundingVolume;l(c)||(c=s.boundingSphere),r.clippedByBoundaries=!1;const u=LD(e.rectangle,this.cartographicLimitRectangle),f=Ee.simpleIntersection(u,e.rectangle,EQ);if(!l(f))return Es.NONE;if(Ee.equals(f,e.rectangle)||(r.clippedByBoundaries=!0),t.mode!==me.SCENE3D&&(c=d3e,Ae.fromRectangleWithHeights2D(e.rectangle,t.mapProjection,s.minimumHeight,s.maximumHeight,c),d.fromElements(c.center.z,c.center.x,c.center.y,c.center),t.mode===me.MORPHING&&l(r.renderedMesh)&&(c=Ae.union(s.boundingSphere,c,c))),!l(c))return Es.PARTIAL;const h=this._clippingPlanes;if(l(h)&&h.enabled){const y=h.computeIntersectionWithBoundingVolume(c);if(e.isClipped=y!==Vn.INSIDE,y===Vn.OUTSIDE)return Es.NONE}let _;const g=a.computeVisibility(c);if(g===Vn.OUTSIDE?_=Es.NONE:g===Vn.INTERSECTING?_=Es.PARTIAL:g===Vn.INSIDE&&(_=Es.FULL),_===Es.NONE)return _;const p=t.mode===me.SCENE3D&&t.camera.frustum instanceof nn;if(t.mode===me.SCENE3D&&!p&&l(n)&&!o){const y=r.occludeePointInScaledSpace;return!l(y)||n.ellipsoid.isScaledSpacePointVisiblePossiblyUnderEllipsoid(y,s.minimumHeight)?_:Es.NONE}return _};Wo.prototype.canRefine=function(e){return l(e.data.terrainData)?!0:this.terrainProvider.getTileDataAvailable(e.x*2,e.y*2,e.level+1)!==void 0};const m3e=[],_3e=[];Wo.prototype.canRenderWithoutLosingDetail=function(e,t){const n=e.data,i=m3e;i.length=this._imageryLayers.length;let o=!1,r=!1,s;l(n)&&(o=n.terrainState===Go.READY,r=!0,s=n.imagery);let a,c;for(a=0,c=i.length;a<c;++a)i[a]=r;if(l(s))for(a=0,c=s.length;a<c;++a){const h=s[a],_=h.loadingImagery,g=!l(_)||_.state===zi.FAILED||_.state===zi.INVALID,p=(h.loadingImagery||h.readyImagery).imageryLayer._layerIndex;i[p]=g&&i[p]}const u=this.quadtree._lastSelectionFrameNumber,f=_3e;for(f.length=0,f.push(e.southwestChild,e.southeastChild,e.northwestChild,e.northeastChild);f.length>0;){const h=f.pop(),_=h._lastSelectionResultFrame===u?h._lastSelectionResult:Ti.NONE;if(_===Ti.RENDERED){const g=h.data;if(!l(g))continue;if(!o&&h.data.terrainState===Go.READY)return!1;const p=h.data.imagery;for(a=0,c=p.length;a<c;++a){const y=p[a],T=y.loadingImagery,b=!l(T)||T.state===zi.FAILED||T.state===zi.INVALID,x=(y.loadingImagery||y.readyImagery).imageryLayer._layerIndex;if(b&&!i[x])return!1}}else _===Ti.REFINED&&f.push(h.southwestChild,h.southeastChild,h.northwestChild,h.northeastChild)}return!0};const g3e=new d;Wo.prototype.computeTileLoadPriority=function(e,t){const n=e.data;if(n===void 0)return 0;const i=n.tileBoundingRegion.boundingVolume;if(i===void 0)return 0;const o=t.camera.positionWC,r=t.camera.directionWC,s=d.subtract(i.center,o,g3e),a=d.magnitude(s);return a<F.EPSILON5?0:(d.divideByScalar(s,a,s),(1-d.dot(s,r))*e._distance)};const a6=new N,ev=new N,y3e=new ue,A3e=new ue,T3e=new ue,C3e=new d,c6=new d,b3e=new d,E3e=new d;Wo.prototype.showTileThisFrame=function(e,t){let n=0;const i=e.data.imagery;for(let a=0,c=i.length;a<c;++a){const u=i[a];l(u.readyImagery)&&u.readyImagery.imageryLayer.alpha!==0&&++n}let o=this._tilesToRenderByTextureCount[n];l(o)||(o=[],this._tilesToRenderByTextureCount[n]=o),o.push(e);const r=e.data;l(r.vertexArray)?this._hasLoadedTilesThisFrame=!0:this._hasFillTilesThisFrame=!0;const s=this._debug;++s.tilesRendered,s.texturesRendered+=n};const x3e=[new d,new d,new d,new d];function l6(e,t,n,i,o,r){const s=e.quadtree._occluders.ellipsoid,a=s.ellipsoid,c=x3e;return d.fromRadians(n.west,n.south,o,a,c[0]),d.fromRadians(n.east,n.south,o,a,c[1]),d.fromRadians(n.west,n.north,o,a,c[2]),d.fromRadians(n.east,n.north,o,a,c[3]),s.computeHorizonCullingPointPossiblyUnderEllipsoid(t,c,i,r)}Wo.prototype.computeDistanceToTile=function(e,t){w3e(e,this,t);const n=e.data;if(n.boundingVolumeSourceTile===void 0)return 9999999999;const o=n.tileBoundingRegion,r=o.minimumHeight,s=o.maximumHeight;if(n.boundingVolumeSourceTile!==e){const c=t.camera.positionCartographic.height,u=Math.abs(c-r),f=Math.abs(c-s);u>f?(o.minimumHeight=r,o.maximumHeight=r):(o.minimumHeight=s,o.maximumHeight=s)}const a=o.distanceToCamera(t);return o.minimumHeight=r,o.maximumHeight=s,a};function w3e(e,t,n){let i=e.data;i===void 0&&(i=e.data=new no);const o=e.tilingScheme.ellipsoid;i.tileBoundingRegion===void 0&&(i.tileBoundingRegion=new Td({computeBoundingVolumes:!1,rectangle:e.rectangle,ellipsoid:o,minimumHeight:0,maximumHeight:0}));const r=i.tileBoundingRegion,s=r.minimumHeight,a=r.maximumHeight;let c=!1,u=e;const f=i.mesh,h=i.terrainData;if(f!==void 0&&f.minimumHeight!==void 0&&f.maximumHeight!==void 0)r.minimumHeight=f.minimumHeight,r.maximumHeight=f.maximumHeight,c=!0;else if(h!==void 0&&h._minimumHeight!==void 0&&h._maximumHeight!==void 0)r.minimumHeight=h._minimumHeight,r.maximumHeight=h._maximumHeight;else{r.minimumHeight=Number.NaN,r.maximumHeight=Number.NaN;let _=e.parent;for(;_!==void 0;){const g=_.data;if(g!==void 0){const p=g.mesh,y=g.terrainData;if(p!==void 0&&p.minimumHeight!==void 0&&p.maximumHeight!==void 0){r.minimumHeight=p.minimumHeight,r.maximumHeight=p.maximumHeight;break}else if(y!==void 0&&y._minimumHeight!==void 0&&y._maximumHeight!==void 0){r.minimumHeight=y._minimumHeight,r.maximumHeight=y._maximumHeight;break}}_=_.parent}u=_}if(u!==void 0){const _=n.terrainExaggeration,g=n.terrainExaggerationRelativeHeight;if(_!==1&&(c=!1,r.minimumHeight=Fm.getHeight(r.minimumHeight,_,g),r.maximumHeight=Fm.getHeight(r.maximumHeight,_,g)),c)i.boundingVolumeIsFromMesh||(r._orientedBoundingBox=Zt.clone(f.orientedBoundingBox,r._orientedBoundingBox),r._boundingSphere=Ae.clone(f.boundingSphere3D,r._boundingSphere),i.occludeePointInScaledSpace=d.clone(f.occludeePointInScaledSpace,i.occludeePointInScaledSpace),l(i.occludeePointInScaledSpace)||(i.occludeePointInScaledSpace=l6(t,r._orientedBoundingBox.center,e.rectangle,r.minimumHeight,r.maximumHeight,i.occludeePointInScaledSpace)));else{const y=r._orientedBoundingBox===void 0||r._boundingSphere===void 0;(r.minimumHeight!==s||r.maximumHeight!==a||y)&&(r.computeBoundingVolumes(o),i.occludeePointInScaledSpace=l6(t,r._orientedBoundingBox.center,e.rectangle,r.minimumHeight,r.maximumHeight,i.occludeePointInScaledSpace))}i.boundingVolumeSourceTile=u,i.boundingVolumeIsFromMesh=c}else i.boundingVolumeSourceTile=void 0,i.boundingVolumeIsFromMesh=!1}Wo.prototype.isDestroyed=function(){return!1};Wo.prototype.destroy=function(){return this._tileProvider=this._tileProvider&&this._tileProvider.destroy(),this._clippingPlanes=this._clippingPlanes&&this._clippingPlanes.destroy(),Je(this)};function S3e(e,t,n){return function(i){let o,r,s=-1;const a=i.data.imagery,c=a.length;let u;for(u=0;u<c;++u)if(o=a[u],r=A(o.readyImagery,o.loadingImagery),r.imageryLayer===t){s=u;break}if(s!==-1){const f=s+e;if(o=a[f],r=l(o)?A(o.readyImagery,o.loadingImagery):void 0,!l(r)||r.imageryLayer!==t)return!t._createTileImagerySkeletons(i,n,f);for(u=s;u<f;++u)a[u].freeResources();a.splice(s,e)}return!0}}Wo.prototype._onLayerAdded=function(e,t){if(e.show){const n=this._terrainProvider,i=this,o=e.imageryProvider,r=this._imageryLayersUpdatedEvent;o._reload=function(){e._imageryCache={},i._quadtree.forEachLoadedTile(function(s){if(l(s._loadedCallbacks[e._layerIndex]))return;let a;const c=s.data.imagery,u=c.length;let f=-1,h=0;for(a=0;a<u;++a){const g=c[a];if(A(g.readyImagery,g.loadingImagery).imageryLayer===e)f===-1&&(f=a),++h;else if(f!==-1)break}if(f===-1)return;const _=f+h;e._createTileImagerySkeletons(s,n,_)&&(s._loadedCallbacks[e._layerIndex]=S3e(h,e,n),s.state=_u.LOADING)})},this._quadtree.forEachLoadedTile(function(s){e._createTileImagerySkeletons(s,n)&&(s.state=_u.LOADING,s.level!==0&&(s._lastSelectionResultFrame!==i.quadtree._lastSelectionFrameNumber||s._lastSelectionResult!==Ti.RENDERED)&&(s.renderable=!1))}),this._layerOrderChanged=!0,r.raiseEvent()}};Wo.prototype._onLayerRemoved=function(e,t){this._quadtree.forEachLoadedTile(function(n){const i=n.data.imagery;let o=-1,r=0;for(let s=0,a=i.length;s<a;++s){const c=i[s];let u=c.loadingImagery;if(l(u)||(u=c.readyImagery),u.imageryLayer===e)o===-1&&(o=s),c.freeResources(),++r;else if(o!==-1)break}o!==-1&&i.splice(o,r)}),l(e.imageryProvider)&&(e.imageryProvider._reload=void 0),this._imageryLayersUpdatedEvent.raiseEvent()};Wo.prototype._onLayerMoved=function(e,t,n){this._layerOrderChanged=!0,this._imageryLayersUpdatedEvent.raiseEvent()};Wo.prototype._onLayerShownOrHidden=function(e,t,n){n?this._onLayerAdded(e,t):this._onLayerRemoved(e,t)};const v3e=new N,D3e=new N;function u6(e,t){const n={u_initialColor:function(){return this.properties.initialColor},u_fillHighlightColor:function(){return this.properties.fillHighlightColor},u_zoomedOutOceanSpecularIntensity:function(){return this.properties.zoomedOutOceanSpecularIntensity},u_oceanNormalMap:function(){return this.properties.oceanNormalMap},u_atmosphereLightIntensity:function(){return this.properties.atmosphereLightIntensity},u_atmosphereRayleighCoefficient:function(){return this.properties.atmosphereRayleighCoefficient},u_atmosphereMieCoefficient:function(){return this.properties.atmosphereMieCoefficient},u_atmosphereRayleighScaleHeight:function(){return this.properties.atmosphereRayleighScaleHeight},u_atmosphereMieScaleHeight:function(){return this.properties.atmosphereMieScaleHeight},u_atmosphereMieAnisotropy:function(){return this.properties.atmosphereMieAnisotropy},u_lightingFadeDistance:function(){return this.properties.lightingFadeDistance},u_nightFadeDistance:function(){return this.properties.nightFadeDistance},u_center3D:function(){return this.properties.center3D},u_terrainExaggerationAndRelativeHeight:function(){return this.properties.terrainExaggerationAndRelativeHeight},u_tileRectangle:function(){return this.properties.tileRectangle},u_modifiedModelView:function(){const i=e.context.uniformState.view,o=N.multiplyByPoint(i,this.properties.rtc,c6);return N.setTranslation(i,o,a6),a6},u_modifiedModelViewProjection:function(){const i=e.context.uniformState.view,o=e.context.uniformState.projection,r=N.multiplyByPoint(i,this.properties.rtc,c6);return N.setTranslation(i,r,ev),N.multiply(o,ev,ev),ev},u_dayTextures:function(){return this.properties.dayTextures},u_dayTextureTranslationAndScale:function(){return this.properties.dayTextureTranslationAndScale},u_dayTextureTexCoordsRectangle:function(){return this.properties.dayTextureTexCoordsRectangle},u_dayTextureUseWebMercatorT:function(){return this.properties.dayTextureUseWebMercatorT},u_dayTextureAlpha:function(){return this.properties.dayTextureAlpha},u_dayTextureNightAlpha:function(){return this.properties.dayTextureNightAlpha},u_dayTextureDayAlpha:function(){return this.properties.dayTextureDayAlpha},u_dayTextureBrightness:function(){return this.properties.dayTextureBrightness},u_dayTextureContrast:function(){return this.properties.dayTextureContrast},u_dayTextureHue:function(){return this.properties.dayTextureHue},u_dayTextureSaturation:function(){return this.properties.dayTextureSaturation},u_dayTextureOneOverGamma:function(){return this.properties.dayTextureOneOverGamma},u_dayIntensity:function(){return this.properties.dayIntensity},u_southAndNorthLatitude:function(){return this.properties.southAndNorthLatitude},u_southMercatorYAndOneOverHeight:function(){return this.properties.southMercatorYAndOneOverHeight},u_waterMask:function(){return this.properties.waterMask},u_waterMaskTranslationAndScale:function(){return this.properties.waterMaskTranslationAndScale},u_minMaxHeight:function(){return this.properties.minMaxHeight},u_scaleAndBias:function(){return this.properties.scaleAndBias},u_dayTextureSplit:function(){return this.properties.dayTextureSplit},u_dayTextureCutoutRectangles:function(){return this.properties.dayTextureCutoutRectangles},u_clippingPlanes:function(){const i=t._clippingPlanes;return l(i)&&l(i.texture)?i.texture:e.context.defaultTexture},u_cartographicLimitRectangle:function(){return this.properties.localizedCartographicLimitRectangle},u_clippingPlanesMatrix:function(){const i=t._clippingPlanes,o=l(i)?N.multiply(e.context.uniformState.view,i.modelMatrix,v3e):N.IDENTITY;return N.inverseTranspose(o,D3e)},u_clippingPlanesEdgeStyle:function(){const i=this.properties.clippingPlanesEdgeColor;return i.alpha=this.properties.clippingPlanesEdgeWidth,i},u_minimumBrightness:function(){return e.fog.minimumBrightness},u_hsbShift:function(){return this.properties.hsbShift},u_colorsToAlpha:function(){return this.properties.colorsToAlpha},u_frontFaceAlphaByDistance:function(){return this.properties.frontFaceAlphaByDistance},u_backFaceAlphaByDistance:function(){return this.properties.backFaceAlphaByDistance},u_translucencyRectangle:function(){return this.properties.localizedTranslucencyRectangle},u_undergroundColor:function(){return this.properties.undergroundColor},u_undergroundColorAlphaByDistance:function(){return this.properties.undergroundColorAlphaByDistance},u_lambertDiffuseMultiplier:function(){return this.properties.lambertDiffuseMultiplier},u_vertexShadowDarkness:function(){return this.properties.vertexShadowDarkness},properties:{initialColor:new ue(0,0,.5,1),fillHighlightColor:new k(0,0,0,0),zoomedOutOceanSpecularIntensity:.5,oceanNormalMap:void 0,lightingFadeDistance:new $(65e5,9e6),nightFadeDistance:new $(1e7,4e7),atmosphereLightIntensity:10,atmosphereRayleighCoefficient:new d(55e-7,13e-6,284e-7),atmosphereMieCoefficient:new d(21e-6,21e-6,21e-6),atmosphereRayleighScaleHeight:1e4,atmosphereMieScaleHeight:3200,atmosphereMieAnisotropy:.9,hsbShift:new d,center3D:void 0,rtc:new d,modifiedModelView:new N,tileRectangle:new ue,terrainExaggerationAndRelativeHeight:new $(1,0),dayTextures:[],dayTextureTranslationAndScale:[],dayTextureTexCoordsRectangle:[],dayTextureUseWebMercatorT:[],dayTextureAlpha:[],dayTextureNightAlpha:[],dayTextureDayAlpha:[],dayTextureBrightness:[],dayTextureContrast:[],dayTextureHue:[],dayTextureSaturation:[],dayTextureOneOverGamma:[],dayTextureSplit:[],dayTextureCutoutRectangles:[],dayIntensity:0,colorsToAlpha:[],southAndNorthLatitude:new $,southMercatorYAndOneOverHeight:new $,waterMask:void 0,waterMaskTranslationAndScale:new ue,minMaxHeight:new $,scaleAndBias:new N,clippingPlanesEdgeColor:k.clone(k.WHITE),clippingPlanesEdgeWidth:0,localizedCartographicLimitRectangle:new ue,frontFaceAlphaByDistance:new ue,backFaceAlphaByDistance:new ue,localizedTranslucencyRectangle:new ue,undergroundColor:k.clone(k.TRANSPARENT),undergroundColorAlphaByDistance:new ue,lambertDiffuseMultiplier:0,vertexShadowDarkness:0}};return l(t.materialUniformMap)?Ln(n,t.materialUniformMap):n}function I3e(e,t,n){const i=n.data;let o,r;if(l(i.vertexArray)?(o=i.mesh,r=i.vertexArray):l(i.fill)&&l(i.fill.vertexArray)&&(o=i.fill.mesh,r=i.fill.vertexArray),!(!l(o)||!l(r))){if(l(i.wireframeVertexArray)){if(i.wireframeVertexArray.mesh===o)return;i.wireframeVertexArray.destroy(),i.wireframeVertexArray=void 0}i.wireframeVertexArray=P3e(e,r,o),i.wireframeVertexArray.mesh=o}}function P3e(e,t,n){const o={indices:n.indices,primitiveType:dt.TRIANGLES};mo.toWireframe(o);const r=o.indices,s=Mt.createIndexBuffer({context:e,typedArray:r,usage:mt.STATIC_DRAW,indexDatatype:At.fromSizeInBytes(r.BYTES_PER_ELEMENT)});return new Fo({context:e,attributes:t._attributes,indexBuffer:s})}let wQ,SQ,BD;(function(){const e=new xn({geometry:pl.fromDimensions({dimensions:new d(2,2,2)})}),t=new xn({geometry:new Jm({radius:1})});let n=new N,i,o;function r(s){return new fn({geometryInstances:s,appearance:new kn({translucent:!1,flat:!0}),asynchronous:!1})}wQ=function(s,a){return s===i||(BD(),i=s,n=N.fromRotationTranslation(s.halfAxes,s.center,n),e.modelMatrix=n,e.attributes.color=Bn.fromColor(a),o=r(e)),o},SQ=function(s,a){return s===i||(BD(),i=s,n=N.fromTranslation(s.center,n),n=N.multiplyByUniformScale(n,s.radius,n),t.modelMatrix=n,t.attributes.color=Bn.fromColor(a),o=r(t)),o},BD=function(){l(o)&&(o.destroy(),o=void 0,i=void 0)}})();const O3e=new ue(0,0,0,0),L3e={frameState:void 0,surfaceTile:void 0,numberOfDayTextures:void 0,applyBrightness:void 0,applyContrast:void 0,applyHue:void 0,applySaturation:void 0,applyGamma:void 0,applyAlpha:void 0,applyDayNightAlpha:void 0,applySplit:void 0,showReflectiveOcean:void 0,showOceanWaves:void 0,enableLighting:void 0,dynamicAtmosphereLighting:void 0,dynamicAtmosphereLightingFromSun:void 0,showGroundAtmosphere:void 0,perFragmentGroundAtmosphere:void 0,hasVertexNormals:void 0,useWebMercatorProjection:void 0,enableFog:void 0,enableClippingPlanes:void 0,clippingPlanes:void 0,clippedByBoundaries:void 0,hasImageryLayerCutout:void 0,colorCorrect:void 0,colorToAlpha:void 0,hasGeodeticSurfaceNormals:void 0,hasExaggeration:void 0},B3e=k.TRANSPARENT,R3e=new tn;function N3e(e,t,n){const i=t.data;l(i.vertexArray)||(i.fill===void 0&&(i.fill=new Oy(t)),i.fill.update(e,n));const o=n.creditDisplay,r=i.terrainData;if(l(r)&&l(r.credits)){const Ne=r.credits;for(let ke=0,Qe=Ne.length;ke<Qe;++ke)o.addCredit(Ne[ke])}let s=Gt.maximumTextureImageUnits,a=i.waterMaskTexture,c=i.waterMaskTranslationAndScale;!l(a)&&l(i.fill)&&(a=i.fill.waterMaskTexture,c=i.fill.waterMaskTranslationAndScale);const u=n.cameraUnderground,f=n.globeTranslucencyState,h=f.translucent,_=f.frontFaceAlphaByDistance,g=f.backFaceAlphaByDistance,p=f.rectangle,y=A(e.undergroundColor,B3e),T=A(e.undergroundColorAlphaByDistance,R3e),b=xQ(e,n)&&n.mode===me.SCENE3D&&y.alpha>0&&(T.nearValue>0||T.farValue>0),x=e.lambertDiffuseMultiplier,v=e.vertexShadowDarkness,D=e.hasWaterMask&&l(a),L=e.oceanNormalMap,B=D&&l(L),V=e.terrainProvider.ready&&e.terrainProvider.hasVertexNormals,M=n.fog.enabled&&n.fog.renderable&&!u,H=e.showGroundAtmosphere&&n.mode===me.SCENE3D,G=sr.castShadows(e.shadows)&&!h,I=sr.receiveShadows(e.shadows)&&!h,O=e.hueShift,m=e.saturationShift,P=e.brightnessShift;let R=!(F.equalsEpsilon(O,0,F.EPSILON7)&&F.equalsEpsilon(m,0,F.EPSILON7)&&F.equalsEpsilon(P,0,F.EPSILON7)),U=!1;if(H){const Ne=d.magnitude(n.camera.positionWC),ke=e.nightFadeOutDistance;U=Ne>ke}D&&--s,B&&--s,l(n.shadowState)&&n.shadowState.shadowsEnabled&&--s,l(e.clippingPlanes)&&e.clippingPlanes.enabled&&--s,s-=f.numberOfTextureUniforms;const W=i.renderedMesh;let q=W.center;const Y=W.encoding,j=i.tileBoundingRegion,ee=n.terrainExaggeration,K=n.terrainExaggerationRelativeHeight,se=ee!==1,Q=Y.hasGeodeticSurfaceNormals,Z=y3e;let J=0,de=0,_e=0,le=0,Te=!1;if(n.mode!==me.SCENE3D){const Ne=n.mapProjection,ke=Ne.project(Ee.southwest(t.rectangle),b3e),Qe=Ne.project(Ee.northeast(t.rectangle),E3e);if(Z.x=ke.x,Z.y=ke.y,Z.z=Qe.x,Z.w=Qe.y,n.mode!==me.MORPHING&&(q=C3e,q.x=0,q.y=(Z.z+Z.x)*.5,q.z=(Z.w+Z.y)*.5,Z.x-=q.y,Z.y-=q.z,Z.z-=q.y,Z.w-=q.z),n.mode===me.SCENE2D&&Y.quantization===rl.BITS12){const Ge=1/(Math.pow(2,12)-1)*.5,Pt=(Z.z-Z.x)*Ge,Lt=(Z.w-Z.y)*Ge;Z.x-=Pt,Z.y-=Lt,Z.z+=Pt,Z.w+=Lt}Ne instanceof Ii&&(J=t.rectangle.south,de=t.rectangle.north,_e=Ii.geodeticLatitudeToMercatorAngle(J),le=1/(Ii.geodeticLatitudeToMercatorAngle(de)-_e),Te=!0)}const pe=L3e;pe.frameState=n,pe.surfaceTile=i,pe.showReflectiveOcean=D,pe.showOceanWaves=B,pe.enableLighting=e.enableLighting,pe.dynamicAtmosphereLighting=e.dynamicAtmosphereLighting,pe.dynamicAtmosphereLightingFromSun=e.dynamicAtmosphereLightingFromSun,pe.showGroundAtmosphere=H,pe.atmosphereLightIntensity=e.atmosphereLightIntensity,pe.atmosphereRayleighCoefficient=e.atmosphereRayleighCoefficient,pe.atmosphereMieCoefficient=e.atmosphereMieCoefficient,pe.atmosphereRayleighScaleHeight=e.atmosphereRayleighScaleHeight,pe.atmosphereMieScaleHeight=e.atmosphereMieScaleHeight,pe.atmosphereMieAnisotropy=e.atmosphereMieAnisotropy,pe.perFragmentGroundAtmosphere=U,pe.hasVertexNormals=V,pe.useWebMercatorProjection=Te,pe.clippedByBoundaries=i.clippedByBoundaries,pe.hasGeodeticSurfaceNormals=Q,pe.hasExaggeration=se;const ne=i.imagery;let ae=0;const ye=ne.length,Ce=e.showSkirts&&!u&&!h,Be=e.backFaceCulling&&!u&&!h,Le=Be?e._renderState:e._disableCullingRenderState,Ve=Be?e._blendRenderState:e._disableCullingBlendRenderState;let Ie=Le,He=e._firstPassInitialColor;const Me=n.context;if(l(e._debug.boundingSphereTile)||BD(),e._materialUniformMap!==e.materialUniformMap){e._materialUniformMap=e.materialUniformMap;const Ne=e._drawCommands.length;for(let ke=0;ke<Ne;++ke)e._uniformMaps[ke]=u6(n,e)}do{let Ne=0,ke,Qe;if(e._drawCommands.length<=e._usedDrawCommands?(ke=new Dt,ke.owner=t,ke.cull=!1,ke.boundingVolume=new Ae,ke.orientedBoundingBox=void 0,Qe=u6(n,e),e._drawCommands.push(ke),e._uniformMaps.push(Qe)):(ke=e._drawCommands[e._usedDrawCommands],Qe=e._uniformMaps[e._usedDrawCommands]),ke.owner=t,++e._usedDrawCommands,t===e._debug.boundingSphereTile){const Sn=j.boundingVolume,oo=j.boundingSphere;l(Sn)?wQ(Sn,k.RED).update(n):l(oo)&&SQ(oo,k.RED).update(n)}const Ge=Qe.properties;ue.clone(He,Ge.initialColor),Ge.oceanNormalMap=L,Ge.lightingFadeDistance.x=e.lightingFadeOutDistance,Ge.lightingFadeDistance.y=e.lightingFadeInDistance,Ge.nightFadeDistance.x=e.nightFadeOutDistance,Ge.nightFadeDistance.y=e.nightFadeInDistance,Ge.atmosphereLightIntensity=e.atmosphereLightIntensity,Ge.atmosphereRayleighCoefficient=e.atmosphereRayleighCoefficient,Ge.atmosphereMieCoefficient=e.atmosphereMieCoefficient,Ge.atmosphereRayleighScaleHeight=e.atmosphereRayleighScaleHeight,Ge.atmosphereMieScaleHeight=e.atmosphereMieScaleHeight,Ge.atmosphereMieAnisotropy=e.atmosphereMieAnisotropy,Ge.zoomedOutOceanSpecularIntensity=e.zoomedOutOceanSpecularIntensity;const Pt=u?g:_,Lt=u?_:g;l(Pt)&&(ue.fromElements(Pt.near,Pt.nearValue,Pt.far,Pt.farValue,Ge.frontFaceAlphaByDistance),ue.fromElements(Lt.near,Lt.nearValue,Lt.far,Lt.farValue,Ge.backFaceAlphaByDistance)),ue.fromElements(T.near,T.nearValue,T.far,T.farValue,Ge.undergroundColorAlphaByDistance),k.clone(y,Ge.undergroundColor),Ge.lambertDiffuseMultiplier=x,Ge.vertexShadowDarkness=v;const qt=!l(i.vertexArray)&&l(e.fillHighlightColor)&&e.fillHighlightColor.alpha>0;qt&&k.clone(e.fillHighlightColor,Ge.fillHighlightColor),Ge.terrainExaggerationAndRelativeHeight.x=ee,Ge.terrainExaggerationAndRelativeHeight.y=K,Ge.center3D=W.center,d.clone(q,Ge.rtc),ue.clone(Z,Ge.tileRectangle),Ge.southAndNorthLatitude.x=J,Ge.southAndNorthLatitude.y=de,Ge.southMercatorYAndOneOverHeight.x=_e,Ge.southMercatorYAndOneOverHeight.y=le;const zn=A3e,Gn=LD(t.rectangle,e.cartographicLimitRectangle),Dn=T3e,hn=LD(t.rectangle,p);d.fromElements(O,m,P,Ge.hsbShift);const jt=t.rectangle,In=1/jt.width,Rn=1/jt.height;zn.x=(Gn.west-jt.west)*In,zn.y=(Gn.south-jt.south)*Rn,zn.z=(Gn.east-jt.west)*In,zn.w=(Gn.north-jt.south)*Rn,ue.clone(zn,Ge.localizedCartographicLimitRectangle),Dn.x=(hn.west-jt.west)*In,Dn.y=(hn.south-jt.south)*Rn,Dn.z=(hn.east-jt.west)*In,Dn.w=(hn.north-jt.south)*Rn,ue.clone(Dn,Ge.localizedTranslucencyRectangle);const Jt=M&&F.fog(t._distance,n.fog.density)>F.EPSILON3;R=R&&(Jt||H);let ln=!1,ei=!1,bi=!1,pn=!1,Fi=!1,Co=!1,Xi=!1,gi=!1,wn=!1,ti=!1;for(;Ne<s&&ae<ye;){const Sn=ne[ae],oo=Sn.readyImagery;if(++ae,!l(oo)||oo.imageryLayer.alpha===0)continue;const jn=Sn.useWebMercatorT?oo.textureWebMercator:oo.texture;if(!l(jn))throw new w("readyImagery is not actually ready!");const Ki=oo.imageryLayer;l(Sn.textureTranslationAndScale)||(Sn.textureTranslationAndScale=Ki._calculateTextureTranslationAndScale(t,Sn)),Ge.dayTextures[Ne]=jn,Ge.dayTextureTranslationAndScale[Ne]=Sn.textureTranslationAndScale,Ge.dayTextureTexCoordsRectangle[Ne]=Sn.textureCoordinateRectangle,Ge.dayTextureUseWebMercatorT[Ne]=Sn.useWebMercatorT,Ge.dayTextureAlpha[Ne]=Ki.alpha,Co=Co||Ge.dayTextureAlpha[Ne]!==1,Ge.dayTextureNightAlpha[Ne]=Ki.nightAlpha,Xi=Xi||Ge.dayTextureNightAlpha[Ne]!==1,Ge.dayTextureDayAlpha[Ne]=Ki.dayAlpha,Xi=Xi||Ge.dayTextureDayAlpha[Ne]!==1,Ge.dayTextureBrightness[Ne]=Ki.brightness,ln=ln||Ge.dayTextureBrightness[Ne]!==si.DEFAULT_BRIGHTNESS,Ge.dayTextureContrast[Ne]=Ki.contrast,ei=ei||Ge.dayTextureContrast[Ne]!==si.DEFAULT_CONTRAST,Ge.dayTextureHue[Ne]=Ki.hue,bi=bi||Ge.dayTextureHue[Ne]!==si.DEFAULT_HUE,Ge.dayTextureSaturation[Ne]=Ki.saturation,pn=pn||Ge.dayTextureSaturation[Ne]!==si.DEFAULT_SATURATION,Ge.dayTextureOneOverGamma[Ne]=1/Ki.gamma,Fi=Fi||Ge.dayTextureOneOverGamma[Ne]!==1/si.DEFAULT_GAMMA,Ge.dayTextureSplit[Ne]=Ki.splitDirection,gi=gi||Ge.dayTextureSplit[Ne]!==0;let zo=Ge.dayTextureCutoutRectangles[Ne];if(l(zo)||(zo=Ge.dayTextureCutoutRectangles[Ne]=new ue),ue.clone(ue.ZERO,zo),l(Ki.cutoutRectangle)){const ro=LD(jt,Ki.cutoutRectangle),Ji=Ee.simpleIntersection(ro,jt,EQ);wn=l(Ji)||wn,zo.x=(ro.west-jt.west)*In,zo.y=(ro.south-jt.south)*Rn,zo.z=(ro.east-jt.west)*In,zo.w=(ro.north-jt.south)*Rn}let So=Ge.colorsToAlpha[Ne];l(So)||(So=Ge.colorsToAlpha[Ne]=new ue);const Yr=l(Ki.colorToAlpha)&&Ki.colorToAlphaThreshold>0;if(ti=ti||Yr,Yr){const ro=Ki.colorToAlpha;So.x=ro.red,So.y=ro.green,So.z=ro.blue,So.w=Ki.colorToAlphaThreshold}else So.w=-1;if(l(oo.credits)){const ro=oo.credits;for(let Ji=0,Rr=ro.length;Ji<Rr;++Ji)o.addCredit(ro[Ji])}++Ne}Ge.dayTextures.length=Ne,Ge.waterMask=a,ue.clone(c,Ge.waterMaskTranslationAndScale),Ge.minMaxHeight.x=Y.minimumHeight,Ge.minMaxHeight.y=Y.maximumHeight,N.clone(Y.matrix,Ge.scaleAndBias);const Jn=e._clippingPlanes,Tn=l(Jn)&&Jn.enabled&&t.isClipped;Tn&&(Ge.clippingPlanesEdgeColor=k.clone(Jn.edgeColor,Ge.clippingPlanesEdgeColor),Ge.clippingPlanesEdgeWidth=Jn.edgeWidth),pe.numberOfDayTextures=Ne,pe.applyBrightness=ln,pe.applyContrast=ei,pe.applyHue=bi,pe.applySaturation=pn,pe.applyGamma=Fi,pe.applyAlpha=Co,pe.applyDayNightAlpha=Xi,pe.applySplit=gi,pe.enableFog=Jt,pe.enableClippingPlanes=Tn,pe.clippingPlanes=Jn,pe.hasImageryLayerCutout=wn,pe.colorCorrect=R,pe.highlightFillTile=qt,pe.colorToAlpha=ti,pe.showUndergroundColor=b,pe.translucent=h;let Rt=i.renderedMesh.indices.length;Ce||(Rt=i.renderedMesh.indexCountWithoutSkirts),ke.shaderProgram=e._surfaceShaderSet.getShaderProgram(pe),ke.castShadows=G,ke.receiveShadows=I,ke.renderState=Ie,ke.primitiveType=dt.TRIANGLES,ke.vertexArray=i.vertexArray||i.fill.vertexArray,ke.count=Rt,ke.uniformMap=Qe,ke.pass=We.GLOBE,e._debug.wireframe&&(I3e(Me,e,t),l(i.wireframeVertexArray)&&(ke.vertexArray=i.wireframeVertexArray,ke.primitiveType=dt.LINES,ke.count=Rt*2));let et=ke.boundingVolume;const qn=ke.orientedBoundingBox;n.mode!==me.SCENE3D?(Ae.fromRectangleWithHeights2D(t.rectangle,n.mapProjection,j.minimumHeight,j.maximumHeight,et),d.fromElements(et.center.z,et.center.x,et.center.y,et.center),n.mode===me.MORPHING&&(et=Ae.union(j.boundingSphere,et,et))):(ke.boundingVolume=Ae.clone(j.boundingSphere,et),ke.orientedBoundingBox=Zt.clone(j.boundingVolume,qn)),ke.dirty=!0,h&&f.updateDerivedCommands(ke,n),bQ(ke,n),Ie=Ve,He=O3e}while(ae<ye)}function vQ(){this._enabled=!1,this._frontFaceAlpha=1,this._frontFaceAlphaByDistance=void 0,this._backFaceAlpha=1,this._backFaceAlphaByDistance=void 0,this._rectangle=Ee.clone(Ee.MAX_VALUE)}Object.defineProperties(vQ.prototype,{enabled:{get:function(){return this._enabled},set:function(e){E.typeOf.bool("enabled",e),this._enabled=e}},frontFaceAlpha:{get:function(){return this._frontFaceAlpha},set:function(e){E.typeOf.number.greaterThanOrEquals("frontFaceAlpha",e,0),E.typeOf.number.lessThanOrEquals("frontFaceAlpha",e,1),this._frontFaceAlpha=e}},frontFaceAlphaByDistance:{get:function(){return this._frontFaceAlphaByDistance},set:function(e){if(l(e)&&e.far<e.near)throw new w("far distance must be greater than near distance.");this._frontFaceAlphaByDistance=tn.clone(e,this._frontFaceAlphaByDistance)}},backFaceAlpha:{get:function(){return this._backFaceAlpha},set:function(e){E.typeOf.number.greaterThanOrEquals("backFaceAlpha",e,0),E.typeOf.number.lessThanOrEquals("backFaceAlpha",e,1),this._backFaceAlpha=e}},backFaceAlphaByDistance:{get:function(){return this._backFaceAlphaByDistance},set:function(e){if(l(e)&&e.far<e.near)throw new w("far distance must be greater than near distance.");this._backFaceAlphaByDistance=tn.clone(e,this._backFaceAlphaByDistance)}},rectangle:{get:function(){return this._rectangle},set:function(e){l(e)||(e=Ee.clone(Ee.MAX_VALUE)),Ee.clone(e,this._rectangle)}}});function _s(){this._layers=[],this.layerAdded=new lt,this.layerRemoved=new lt,this.layerMoved=new lt,this.layerShownOrHidden=new lt}Object.defineProperties(_s.prototype,{length:{get:function(){return this._layers.length}}});_s.prototype.add=function(e,t){const n=l(t);if(!l(e))throw new w("layer is required.");if(n){if(t<0)throw new w("index must be greater than or equal to zero.");if(t>this._layers.length)throw new w("index must be less than or equal to the number of layers.")}n?this._layers.splice(t,0,e):(t=this._layers.length,this._layers.push(e)),this._update(),this.layerAdded.raiseEvent(e,t)};_s.prototype.addImageryProvider=function(e,t){if(!l(e))throw new w("imageryProvider is required.");const n=new si(e);return this.add(n,t),n};_s.prototype.remove=function(e,t){t=A(t,!0);const n=this._layers.indexOf(e);return n!==-1?(this._layers.splice(n,1),this._update(),this.layerRemoved.raiseEvent(e,n),t&&e.destroy(),!0):!1};_s.prototype.removeAll=function(e){e=A(e,!0);const t=this._layers;for(let n=0,i=t.length;n<i;n++){const o=t[n];this.layerRemoved.raiseEvent(o,n),e&&o.destroy()}this._layers=[]};_s.prototype.contains=function(e){return this.indexOf(e)!==-1};_s.prototype.indexOf=function(e){return this._layers.indexOf(e)};_s.prototype.get=function(e){if(!l(e))throw new w("index is required.");return this._layers[e]};function nP(e,t){if(!l(t))throw new w("layer is required.");const n=e.indexOf(t);if(n===-1)throw new w("layer is not in this collection.");return n}function DQ(e,t,n){const i=e._layers;if(t=F.clamp(t,0,i.length-1),n=F.clamp(n,0,i.length-1),t===n)return;const o=i[t];i[t]=i[n],i[n]=o,e._update(),e.layerMoved.raiseEvent(o,n,t)}_s.prototype.raise=function(e){const t=nP(this._layers,e);DQ(this,t,t+1)};_s.prototype.lower=function(e){const t=nP(this._layers,e);DQ(this,t,t-1)};_s.prototype.raiseToTop=function(e){const t=nP(this._layers,e);t!==this._layers.length-1&&(this._layers.splice(t,1),this._layers.push(e),this._update(),this.layerMoved.raiseEvent(e,this._layers.length-1,t))};_s.prototype.lowerToBottom=function(e){const t=nP(this._layers,e);t!==0&&(this._layers.splice(t,1),this._layers.splice(0,0,e),this._update(),this.layerMoved.raiseEvent(e,0,t))};const M3e=new Ee;function IQ(e,t,n,i){const o=e.globe._surface._tilesToRender;let r;for(let a=0;!l(r)&&a<o.length;++a){const c=o[a];Ee.contains(c.rectangle,t)&&(r=c)}if(!l(r))return;const s=r.data.imagery;for(let a=s.length-1;a>=0;--a){const c=s[a],u=c.readyImagery;if(!l(u))continue;const f=u.imageryLayer.imageryProvider;if(n&&!l(f.pickFeatures)||!Ee.contains(u.rectangle,t))continue;const h=M3e,_=1/1024;h.west=F.lerp(r.rectangle.west,r.rectangle.east,c.textureCoordinateRectangle.x-_),h.east=F.lerp(r.rectangle.west,r.rectangle.east,c.textureCoordinateRectangle.z+_),h.south=F.lerp(r.rectangle.south,r.rectangle.north,c.textureCoordinateRectangle.y-_),h.north=F.lerp(r.rectangle.south,r.rectangle.north,c.textureCoordinateRectangle.w+_),Ee.contains(h,t)&&i(u)}}_s.prototype.pickImageryLayers=function(e,t){const n=t.globe.pick(e,t);if(!l(n))return;const i=t.globe.ellipsoid.cartesianToCartographic(n),o=[];if(IQ(t,i,!1,function(r){o.push(r.imageryLayer)}),o.length!==0)return o};_s.prototype.pickImageryLayerFeatures=function(e,t){const n=t.globe.pick(e,t);if(!l(n))return;const i=t.globe.ellipsoid.cartesianToCartographic(n),o=[],r=[];if(IQ(t,i,!0,function(s){const c=s.imageryLayer.imageryProvider.pickFeatures(s.x,s.y,s.level,i.longitude,i.latitude);l(c)&&(o.push(c),r.push(s.imageryLayer))}),o.length!==0)return Promise.all(o).then(function(s){const a=[];for(let c=0;c<s.length;++c){const u=s[c],f=r[c];if(l(u)&&u.length>0)for(let h=0;h<u.length;++h){const _=u[h];_.imageryLayer=f,l(_.position)||(_.position=i),a.push(_)}}return a})};_s.prototype.queueReprojectionCommands=function(e){const t=this._layers;for(let n=0,i=t.length;n<i;++n)t[n].queueReprojectionCommands(e)};_s.prototype.cancelReprojections=function(){const e=this._layers;for(let t=0,n=e.length;t<n;++t)e[t].cancelReprojections()};_s.prototype.isDestroyed=function(){return!1};_s.prototype.destroy=function(){return this.removeAll(!0),Je(this)};_s.prototype._update=function(){let e=!0;const t=this._layers;let n,i,o,r;for(o=0,r=t.length;o<r;++o)i=t[o],i._layerIndex=o,i.show?(i._isBaseLayer=e,e=!1):i._isBaseLayer=!1,i.show!==i._show&&(l(i._show)&&(l(n)||(n=[]),n.push(i)),i._show=i.show);if(l(n))for(o=0,r=n.length;o<r;++o)i=n[o],this.layerShownOrHidden.raiseEvent(i,i._layerIndex,i.show)};function PQ(e){this._ellipsoid=new Eu(e.ellipsoid,d.ZERO)}Object.defineProperties(PQ.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}});function hc(e){if(!l(e))throw new w("options is required.");if(l(e.x))if(l(e.y)){if(e.x<0||e.y<0)throw new w("options.x and options.y must be greater than or equal to zero.")}else throw new w("options.y is required.");else throw new w("options.x is required.");if(!l(e.level))throw new w("options.level is required and must be greater than or equal to zero.");if(!l(e.tilingScheme))throw new w("options.tilingScheme is required.");this._tilingScheme=e.tilingScheme,this._x=e.x,this._y=e.y,this._level=e.level,this._parent=e.parent,this._rectangle=this._tilingScheme.tileXYToRectangle(this._x,this._y,this._level),this._southwestChild=void 0,this._southeastChild=void 0,this._northwestChild=void 0,this._northeastChild=void 0,this.replacementPrevious=void 0,this.replacementNext=void 0,this._distance=0,this._loadPriority=0,this._customData=[],this._frameUpdated=void 0,this._lastSelectionResult=Ti.NONE,this._lastSelectionResultFrame=void 0,this._loadedCallbacks={},this.state=_u.START,this.renderable=!1,this.upsampledFromParent=!1,this.data=void 0}hc.createLevelZeroTiles=function(e){if(!l(e))throw new w("tilingScheme is required.");const t=e.getNumberOfXTilesAtLevel(0),n=e.getNumberOfYTilesAtLevel(0),i=new Array(t*n);let o=0;for(let r=0;r<n;++r)for(let s=0;s<t;++s)i[o++]=new hc({tilingScheme:e,x:s,y:r,level:0});return i};hc.prototype._updateCustomData=function(e,t,n){let i=this.customData,o,r,s;if(l(t)&&l(n)){for(i=i.filter(function(a){return n.indexOf(a)===-1}),this._customData=i,s=this._rectangle,o=0;o<t.length;++o)r=t[o],Ee.contains(s,r.positionCartographic)&&i.push(r);this._frameUpdated=e}else{const a=this._parent;if(l(a)&&this._frameUpdated!==a._frameUpdated){i.length=0,s=this._rectangle;const c=a.customData;for(o=0;o<c.length;++o)r=c[o],Ee.contains(s,r.positionCartographic)&&i.push(r);this._frameUpdated=a._frameUpdated}}};Object.defineProperties(hc.prototype,{tilingScheme:{get:function(){return this._tilingScheme}},x:{get:function(){return this._x}},y:{get:function(){return this._y}},level:{get:function(){return this._level}},parent:{get:function(){return this._parent}},rectangle:{get:function(){return this._rectangle}},children:{get:function(){return[this.northwestChild,this.northeastChild,this.southwestChild,this.southeastChild]}},southwestChild:{get:function(){return l(this._southwestChild)||(this._southwestChild=new hc({tilingScheme:this.tilingScheme,x:this.x*2,y:this.y*2+1,level:this.level+1,parent:this})),this._southwestChild}},southeastChild:{get:function(){return l(this._southeastChild)||(this._southeastChild=new hc({tilingScheme:this.tilingScheme,x:this.x*2+1,y:this.y*2+1,level:this.level+1,parent:this})),this._southeastChild}},northwestChild:{get:function(){return l(this._northwestChild)||(this._northwestChild=new hc({tilingScheme:this.tilingScheme,x:this.x*2,y:this.y*2,level:this.level+1,parent:this})),this._northwestChild}},northeastChild:{get:function(){return l(this._northeastChild)||(this._northeastChild=new hc({tilingScheme:this.tilingScheme,x:this.x*2+1,y:this.y*2,level:this.level+1,parent:this})),this._northeastChild}},customData:{get:function(){return this._customData}},needsLoading:{get:function(){return this.state<_u.DONE}},eligibleForUnloading:{get:function(){let e=!0;return l(this.data)&&(e=this.data.eligibleForUnloading,l(e)||(e=!0)),e}}});hc.prototype.findLevelZeroTile=function(e,t,n){const i=this.tilingScheme.getNumberOfXTilesAtLevel(0);if(t<0?t+=i:t>=i&&(t-=i),!(n<0||n>=this.tilingScheme.getNumberOfYTilesAtLevel(0)))return e.filter(function(o){return o.x===t&&o.y===n})[0]};hc.prototype.findTileToWest=function(e){const t=this.parent;if(t===void 0)return this.findLevelZeroTile(e,this.x-1,this.y);if(t.southeastChild===this)return t.southwestChild;if(t.northeastChild===this)return t.northwestChild;const n=t.findTileToWest(e);if(n!==void 0)return t.southwestChild===this?n.southeastChild:n.northeastChild};hc.prototype.findTileToEast=function(e){const t=this.parent;if(t===void 0)return this.findLevelZeroTile(e,this.x+1,this.y);if(t.southwestChild===this)return t.southeastChild;if(t.northwestChild===this)return t.northeastChild;const n=t.findTileToEast(e);if(n!==void 0)return t.southeastChild===this?n.southwestChild:n.northwestChild};hc.prototype.findTileToSouth=function(e){const t=this.parent;if(t===void 0)return this.findLevelZeroTile(e,this.x,this.y+1);if(t.northwestChild===this)return t.southwestChild;if(t.northeastChild===this)return t.southeastChild;const n=t.findTileToSouth(e);if(n!==void 0)return t.southwestChild===this?n.northwestChild:n.northeastChild};hc.prototype.findTileToNorth=function(e){const t=this.parent;if(t===void 0)return this.findLevelZeroTile(e,this.x,this.y-1);if(t.southwestChild===this)return t.northwestChild;if(t.southeastChild===this)return t.northeastChild;const n=t.findTileToNorth(e);if(n!==void 0)return t.northwestChild===this?n.southwestChild:n.southeastChild};hc.prototype.freeResources=function(){this.state=_u.START,this.renderable=!1,this.upsampledFromParent=!1,l(this.data)&&l(this.data.freeResources)&&this.data.freeResources(),tv(this._southwestChild),this._southwestChild=void 0,tv(this._southeastChild),this._southeastChild=void 0,tv(this._northwestChild),this._northwestChild=void 0,tv(this._northeastChild),this._northeastChild=void 0};function tv(e){l(e)&&e.freeResources()}function iP(){this.head=void 0,this.tail=void 0,this.count=0,this._lastBeforeStartOfFrame=void 0}iP.prototype.markStartOfRenderFrame=function(){this._lastBeforeStartOfFrame=this.head};iP.prototype.trimTiles=function(e){let t=this.tail,n=!0;for(;n&&l(this._lastBeforeStartOfFrame)&&this.count>e&&l(t);){n=t!==this._lastBeforeStartOfFrame;const i=t.replacementPrevious;t.eligibleForUnloading&&(t.freeResources(),OQ(this,t)),t=i}};function OQ(e,t){const n=t.replacementPrevious,i=t.replacementNext;t===e._lastBeforeStartOfFrame&&(e._lastBeforeStartOfFrame=i),t===e.head?e.head=i:n.replacementNext=i,t===e.tail?e.tail=n:i.replacementPrevious=n,t.replacementPrevious=void 0,t.replacementNext=void 0,--e.count}iP.prototype.markTileRendered=function(e){const t=this.head;if(t===e){e===this._lastBeforeStartOfFrame&&(this._lastBeforeStartOfFrame=e.replacementNext);return}if(++this.count,!l(t)){e.replacementPrevious=void 0,e.replacementNext=void 0,this.head=e,this.tail=e;return}(l(e.replacementPrevious)||l(e.replacementNext))&&OQ(this,e),e.replacementPrevious=void 0,e.replacementNext=t,t.replacementPrevious=e,this.head=e};function xu(e){if(!l(e)||!l(e.tileProvider))throw new w("options.tileProvider is required.");if(l(e.tileProvider.quadtree))throw new w("A QuadtreeTileProvider can only be used with a single QuadtreePrimitive");this._tileProvider=e.tileProvider,this._tileProvider.quadtree=this,this._debug={enableDebugOutput:!1,maxDepth:0,maxDepthVisited:0,tilesVisited:0,tilesCulled:0,tilesRendered:0,tilesWaitingForChildren:0,lastMaxDepth:-1,lastMaxDepthVisited:-1,lastTilesVisited:-1,lastTilesCulled:-1,lastTilesRendered:-1,lastTilesWaitingForChildren:-1,suspendLodUpdate:!1};const n=this._tileProvider.tilingScheme.ellipsoid;this._tilesToRender=[],this._tileLoadQueueHigh=[],this._tileLoadQueueMedium=[],this._tileLoadQueueLow=[],this._tileReplacementQueue=new iP,this._levelZeroTiles=void 0,this._loadQueueTimeSlice=5,this._tilesInvalidated=!1,this._addHeightCallbacks=[],this._removeHeightCallbacks=[],this._tileToUpdateHeights=[],this._lastTileIndex=0,this._updateHeightsTimeSlice=2,this._cameraPositionCartographic=void 0,this._cameraReferenceFrameOriginCartographic=void 0,this.maximumScreenSpaceError=A(e.maximumScreenSpaceError,2),this.tileCacheSize=A(e.tileCacheSize,100),this.loadingDescendantLimit=20,this.preloadAncestors=!0,this.preloadSiblings=!1,this._occluders=new PQ({ellipsoid:n}),this._tileLoadProgressEvent=new lt,this._lastTileLoadQueueLength=0,this._lastSelectionFrameNumber=void 0}Object.defineProperties(xu.prototype,{tileProvider:{get:function(){return this._tileProvider}},tileLoadProgressEvent:{get:function(){return this._tileLoadProgressEvent}},occluders:{get:function(){return this._occluders}}});xu.prototype.invalidateAllTiles=function(){this._tilesInvalidated=!0};function F3e(e){const t=e._tileReplacementQueue;t.head=void 0,t.tail=void 0,t.count=0,LQ(e);const n=e._levelZeroTiles;if(l(n))for(let i=0;i<n.length;++i){const r=n[i].customData,s=r.length;for(let a=0;a<s;++a){const c=r[a];c.level=0,e._addHeightCallbacks.push(c)}n[i].freeResources()}e._levelZeroTiles=void 0,e._tileProvider.cancelReprojections()}xu.prototype.forEachLoadedTile=function(e){let t=this._tileReplacementQueue.head;for(;l(t);)t.state!==_u.START&&e(t),t=t.replacementNext};xu.prototype.forEachRenderedTile=function(e){const t=this._tilesToRender;for(let n=0,i=t.length;n<i;++n)e(t[n])};xu.prototype.updateHeight=function(e,t){const n=this,i={positionOnEllipsoidSurface:void 0,positionCartographic:e,level:-1,callback:t};return i.removeFunc=function(){const o=n._addHeightCallbacks,r=o.length;for(let s=0;s<r;++s)if(o[s]===i){o.splice(s,1);break}n._removeHeightCallbacks.push(i),i.callback&&(i.callback=void 0)},n._addHeightCallbacks.push(i),i.removeFunc};xu.prototype.update=function(e){l(this._tileProvider.update)&&this._tileProvider.update(e)};function LQ(e){const t=e._debug;t.maxDepth=0,t.maxDepthVisited=0,t.tilesVisited=0,t.tilesCulled=0,t.tilesRendered=0,t.tilesWaitingForChildren=0,e._tileLoadQueueHigh.length=0,e._tileLoadQueueMedium.length=0,e._tileLoadQueueLow.length=0}xu.prototype.beginFrame=function(e){e.passes.render&&(this._tilesInvalidated&&(F3e(this),this._tilesInvalidated=!1),this._tileProvider.initialize(e),LQ(this),!this._debug.suspendLodUpdate&&this._tileReplacementQueue.markStartOfRenderFrame())};xu.prototype.render=function(e){const t=e.passes,n=this._tileProvider;t.render&&(n.beginUpdate(e),V3e(this,e),J3e(this,e),n.endUpdate(e)),t.pick&&this._tilesToRender.length>0&&n.updateForPick(e)};function z3e(e,t){const n=e._tileLoadQueueHigh.length+e._tileLoadQueueMedium.length+e._tileLoadQueueLow.length;if(n!==e._lastTileLoadQueueLength||e._tilesInvalidated){const o=lt.prototype.raiseEvent.bind(e._tileLoadProgressEvent,n);t.afterRender.push(()=>(o(),!0)),e._lastTileLoadQueueLength=n}const i=e._debug;i.enableDebugOutput&&!i.suspendLodUpdate&&(i.maxDepth=e._tilesToRender.reduce(function(o,r){return Math.max(o,r.level)},-1),i.tilesRendered=e._tilesToRender.length,(i.tilesVisited!==i.lastTilesVisited||i.tilesRendered!==i.lastTilesRendered||i.tilesCulled!==i.lastTilesCulled||i.maxDepth!==i.lastMaxDepth||i.tilesWaitingForChildren!==i.lastTilesWaitingForChildren||i.maxDepthVisited!==i.lastMaxDepthVisited)&&(console.log(`Visited ${i.tilesVisited}, Rendered: ${i.tilesRendered}, Culled: ${i.tilesCulled}, Max Depth Rendered: ${i.maxDepth}, Max Depth Visited: ${i.maxDepthVisited}, Waiting for children: ${i.tilesWaitingForChildren}`),i.lastTilesVisited=i.tilesVisited,i.lastTilesRendered=i.tilesRendered,i.lastTilesCulled=i.tilesCulled,i.lastMaxDepth=i.maxDepth,i.lastTilesWaitingForChildren=i.tilesWaitingForChildren,i.lastMaxDepthVisited=i.maxDepthVisited))}xu.prototype.endFrame=function(e){!e.passes.render||e.mode===me.MORPHING||(Y3e(this,e),K3e(this,e),z3e(this,e))};xu.prototype.isDestroyed=function(){return!1};xu.prototype.destroy=function(){this._tileProvider=this._tileProvider&&this._tileProvider.destroy()};let pb;const f6=new ve;function U3e(e,t){let n=Ee.center(e.rectangle,f6);const i=n.longitude-pb.longitude,o=n.latitude-pb.latitude;n=Ee.center(t.rectangle,f6);const r=n.longitude-pb.longitude,s=n.latitude-pb.latitude;return i*i+o*o-(r*r+s*s)}const H3e=new d;let SC=[];function V3e(e,t){const n=e._debug;if(n.suspendLodUpdate)return;const i=e._tilesToRender;i.length=0;let o;const r=e._tileProvider;if(!l(e._levelZeroTiles))if(r.ready){const y=r.tilingScheme;e._levelZeroTiles=hc.createLevelZeroTiles(y);const T=e._levelZeroTiles.length;if(SC.length<T)for(SC=new Array(T),o=0;o<T;++o)SC[o]===void 0&&(SC[o]=new mb)}else return;e._occluders.ellipsoid.cameraPosition=t.camera.positionWC;let s;const a=e._levelZeroTiles,c=a.length>1?e._occluders:void 0;pb=t.camera.positionCartographic,a.sort(U3e);const u=e._addHeightCallbacks,f=e._removeHeightCallbacks,h=t.frameNumber;let _;if(u.length>0||f.length>0){for(o=0,_=a.length;o<_;++o)s=a[o],s._updateCustomData(h,u,f);u.length=0,f.length=0}const g=t.camera;e._cameraPositionCartographic=g.positionCartographic;const p=N.getTranslation(g.transform,H3e);for(e._cameraReferenceFrameOriginCartographic=e.tileProvider.tilingScheme.ellipsoid.cartesianToCartographic(p,e._cameraReferenceFrameOriginCartographic),o=0,_=a.length;o<_;++o)s=a[o],e._tileReplacementQueue.markTileRendered(s),s.renderable?na(e,s,r,t,c,!1,SC[o]):(bh(e,e._tileLoadQueueHigh,s,t),++n.tilesWaitingForChildren);e._lastSelectionFrameNumber=h}function bh(e,t,n,i){n.needsLoading&&(e.tileProvider.computeTileLoadPriority!==void 0&&(n._loadPriority=e.tileProvider.computeTileLoadPriority(n,i)),t.push(n))}function mb(){this.allAreRenderable=!0,this.anyWereRenderedLastFrame=!1,this.notYetRenderableCount=0}function BQ(){this.southwest=new mb,this.southeast=new mb,this.northwest=new mb,this.northeast=new mb}BQ.prototype.combine=function(e){const t=this.southwest,n=this.southeast,i=this.northwest,o=this.northeast;e.allAreRenderable=t.allAreRenderable&&n.allAreRenderable&&i.allAreRenderable&&o.allAreRenderable,e.anyWereRenderedLastFrame=t.anyWereRenderedLastFrame||n.anyWereRenderedLastFrame||i.anyWereRenderedLastFrame||o.anyWereRenderedLastFrame,e.notYetRenderableCount=t.notYetRenderableCount+n.notYetRenderableCount+i.notYetRenderableCount+o.notYetRenderableCount};const _F=new Array(31);for(let e=0;e<_F.length;++e)_F[e]=new BQ;function k3e(e,t,n,i,o){const r=e._debug;++r.tilesVisited,e._tileReplacementQueue.markTileRendered(n),n._updateCustomData(t.frameNumber),n.level>r.maxDepthVisited&&(r.maxDepthVisited=n.level);const s=q3e(e,t,n)<e.maximumScreenSpaceError,a=n.southwestChild,c=n.southeastChild,u=n.northwestChild,f=n.northeastChild,h=e._lastSelectionFrameNumber,_=n._lastSelectionResultFrame===h?n._lastSelectionResult:Ti.NONE,g=e.tileProvider;if(s||i){const p=Ti.originalResult(_)===Ti.RENDERED,y=Ti.originalResult(_)===Ti.CULLED||_===Ti.NONE,T=n.state===_u.DONE;let b=p||y||T;if(b||l(g.canRenderWithoutLosingDetail)&&(b=g.canRenderWithoutLosingDetail(n)),b){s&&bh(e,e._tileLoadQueueMedium,n,t),nv(e,n),o.allAreRenderable=n.renderable,o.anyWereRenderedLastFrame=_===Ti.RENDERED,o.notYetRenderableCount=n.renderable?0:1,n._lastSelectionResultFrame=t.frameNumber,n._lastSelectionResult=Ti.RENDERED,o.anyWereRenderedLastFrame||e._tileToUpdateHeights.push(n);return}i=!0,s&&bh(e,e._tileLoadQueueHigh,n,t)}if(g.canRefine(n)){if(a.upsampledFromParent&&c.upsampledFromParent&&u.upsampledFromParent&&f.upsampledFromParent){nv(e,n),bh(e,e._tileLoadQueueMedium,n,t),e._tileReplacementQueue.markTileRendered(a),e._tileReplacementQueue.markTileRendered(c),e._tileReplacementQueue.markTileRendered(u),e._tileReplacementQueue.markTileRendered(f),o.allAreRenderable=n.renderable,o.anyWereRenderedLastFrame=_===Ti.RENDERED,o.notYetRenderableCount=n.renderable?0:1,n._lastSelectionResultFrame=t.frameNumber,n._lastSelectionResult=Ti.RENDERED,o.anyWereRenderedLastFrame||e._tileToUpdateHeights.push(n);return}n._lastSelectionResultFrame=t.frameNumber,n._lastSelectionResult=Ti.REFINED;const y=e._tilesToRender.length,T=e._tileLoadQueueLow.length,b=e._tileLoadQueueMedium.length,x=e._tileLoadQueueHigh.length,v=e._tileToUpdateHeights.length;if(G3e(e,a,c,u,f,t,i,o),y!==e._tilesToRender.length){const D=o.allAreRenderable,L=o.anyWereRenderedLastFrame,B=o.notYetRenderableCount;let V=!1;if(!D&&!L){const M=e._tilesToRender;for(let G=y;G<M.length;++G){let I=M[G];for(;I!==void 0&&I._lastSelectionResult!==Ti.KICKED&&I!==n;)I._lastSelectionResult=Ti.kick(I._lastSelectionResult),I=I.parent}e._tilesToRender.length=y,e._tileToUpdateHeights.length=v,nv(e,n),n._lastSelectionResult=Ti.RENDERED;const H=_===Ti.RENDERED;!H&&B>e.loadingDescendantLimit&&(e._tileLoadQueueLow.length=T,e._tileLoadQueueMedium.length=b,e._tileLoadQueueHigh.length=x,bh(e,e._tileLoadQueueMedium,n,t),o.notYetRenderableCount=n.renderable?0:1,V=!0),o.allAreRenderable=n.renderable,o.anyWereRenderedLastFrame=H,H||e._tileToUpdateHeights.push(n),++r.tilesWaitingForChildren}e.preloadAncestors&&!V&&bh(e,e._tileLoadQueueLow,n,t)}return}n._lastSelectionResultFrame=t.frameNumber,n._lastSelectionResult=Ti.RENDERED,nv(e,n),bh(e,e._tileLoadQueueHigh,n,t),o.allAreRenderable=n.renderable,o.anyWereRenderedLastFrame=_===Ti.RENDERED,o.notYetRenderableCount=n.renderable?0:1}function G3e(e,t,n,i,o,r,s,a){const c=r.camera.positionCartographic,u=e._tileProvider,f=e._occluders,h=_F[t.level],_=h.southwest,g=h.southeast,p=h.northwest,y=h.northeast;c.longitude<t.rectangle.east?c.latitude<t.rectangle.north?(na(e,t,u,r,f,s,_),na(e,n,u,r,f,s,g),na(e,i,u,r,f,s,p),na(e,o,u,r,f,s,y)):(na(e,i,u,r,f,s,p),na(e,t,u,r,f,s,_),na(e,o,u,r,f,s,y),na(e,n,u,r,f,s,g)):c.latitude<t.rectangle.north?(na(e,n,u,r,f,s,g),na(e,t,u,r,f,s,_),na(e,o,u,r,f,s,y),na(e,i,u,r,f,s,p)):(na(e,o,u,r,f,s,y),na(e,i,u,r,f,s,p),na(e,n,u,r,f,s,g),na(e,t,u,r,f,s,_)),h.combine(a)}function W3e(e,t){const n=t.rectangle;return l(e._cameraPositionCartographic)&&Ee.contains(n,e._cameraPositionCartographic)||l(e._cameraReferenceFrameOriginCartographic)&&Ee.contains(n,e._cameraReferenceFrameOriginCartographic)}function na(e,t,n,i,o,r,s){if(n.computeTileVisibility(t,i,o)!==Es.NONE)return k3e(e,i,t,r,s);if(++e._debug.tilesCulled,e._tileReplacementQueue.markTileRendered(t),s.allAreRenderable=!0,s.anyWereRenderedLastFrame=!1,s.notYetRenderableCount=0,W3e(e,t)){(!l(t.data)||!l(t.data.vertexArray))&&bh(e,e._tileLoadQueueMedium,t,i);const a=e._lastSelectionFrameNumber,c=t._lastSelectionResultFrame===a?t._lastSelectionResult:Ti.NONE;c!==Ti.CULLED_BUT_NEEDED&&c!==Ti.RENDERED&&e._tileToUpdateHeights.push(t),t._lastSelectionResult=Ti.CULLED_BUT_NEEDED}else(e.preloadSiblings||t.level===0)&&bh(e,e._tileLoadQueueLow,t,i),t._lastSelectionResult=Ti.CULLED;t._lastSelectionResultFrame=i.frameNumber}function q3e(e,t,n){if(t.mode===me.SCENE2D||t.camera.frustum instanceof nn||t.camera.frustum instanceof yr)return j3e(e,t,n);const i=e._tileProvider.getLevelMaximumGeometricError(n.level),o=n._distance,r=t.context.drawingBufferHeight,s=t.camera.frustum.sseDenominator;let a=i*r/(o*s);return t.fog.enabled&&(a-=F.fog(o,t.fog.density)*t.fog.sse),a/=t.pixelRatio,a}function j3e(e,t,n){let o=t.camera.frustum;l(o._offCenterFrustum)&&(o=o._offCenterFrustum);const r=t.context,s=r.drawingBufferWidth,a=r.drawingBufferHeight,c=e._tileProvider.getLevelMaximumGeometricError(n.level),u=Math.max(o.top-o.bottom,o.right-o.left)/Math.max(s,a);let f=c/u;return t.fog.enabled&&t.mode!==me.SCENE2D&&(f-=F.fog(n._distance,t.fog.density)*t.fog.sse),f/=t.pixelRatio,f}function nv(e,t){e._tilesToRender.push(t)}function Y3e(e,t){const n=e._tileLoadQueueHigh,i=e._tileLoadQueueMedium,o=e._tileLoadQueueLow;if(n.length===0&&i.length===0&&o.length===0)return;e._tileReplacementQueue.trimTiles(e.tileCacheSize);const r=Gr()+e._loadQueueTimeSlice,s=e._tileProvider;let a=PB(e,t,s,r,n,!1);a=PB(e,t,s,r,i,a),PB(e,t,s,r,o,a)}function $3e(e,t){return e._loadPriority-t._loadPriority}function PB(e,t,n,i,o,r){n.computeTileLoadPriority!==void 0&&o.sort($3e);for(let s=0,a=o.length;s<a&&(Gr()<i||!r);++s){const c=o[s];e._tileReplacementQueue.markTileRendered(c),n.loadTile(t,c),r=!0}return r}const w0=new ii,OB=new ve,Xp=new d,X3e=[];function K3e(e,t){if(!e.tileProvider.ready)return;const n=X3e;n.length=0;const i=e._tileToUpdateHeights,o=Gr(),r=e._updateHeightsTimeSlice,s=o+r,a=t.mode,c=t.mapProjection,u=e.tileProvider.tilingScheme.ellipsoid;let f;for(;i.length>0;){const h=i[0];if(!l(h.data)||!l(h.data.mesh)){const y=h._lastSelectionResultFrame===e._lastSelectionFrameNumber?h._lastSelectionResult:Ti.NONE;(y===Ti.RENDERED||y===Ti.CULLED_BUT_NEEDED)&&n.push(h),i.shift(),e._lastTileIndex=0;continue}const _=h.customData,g=_.length;let p=!1;for(f=e._lastTileIndex;f<g;++f){const y=_[f],T=h.data.terrainData,b=l(T)&&T.wasCreatedByUpsampling();if(h.level>y.level&&!b){if(l(y.positionOnEllipsoidSurface)||(y.positionOnEllipsoidSurface=d.fromRadians(y.positionCartographic.longitude,y.positionCartographic.latitude,0,u)),a===me.SCENE3D){const v=u.geodeticSurfaceNormal(y.positionOnEllipsoidSurface,w0.direction),D=u.getSurfaceNormalIntersectionWithZAxis(y.positionOnEllipsoidSurface,11500,w0.origin);if(!l(D)){let L=0;l(h.data.tileBoundingRegion)&&(L=h.data.tileBoundingRegion.minimumHeight);const B=Math.min(L,-11500),V=d.multiplyByScalar(v,Math.abs(B)+1,Xp);d.subtract(y.positionOnEllipsoidSurface,V,w0.origin)}}else ve.clone(y.positionCartographic,OB),OB.height=-11500,c.project(OB,Xp),d.fromElements(Xp.z,Xp.x,Xp.y,Xp),d.clone(Xp,w0.origin),d.clone(d.UNIT_X,w0.direction);const x=h.data.pick(w0,a,c,!1,Xp);l(x)&&(l(y.callback)&&y.callback(x),y.level=h.level)}if(Gr()>=s){p=!0;break}}if(p){e._lastTileIndex=f;break}else e._lastTileIndex=0,i.shift()}for(f=0;f<n.length;f++)i.push(n[f])}function J3e(e,t){const n=e._tileProvider,i=e._tilesToRender;for(let o=0,r=i.length;o<r;++o){const s=i[o];n.showTileThisFrame(s,t)}}function vf(e){e=A(e,be.WGS84);const t=new y_({ellipsoid:e}),n=new _s;this._ellipsoid=e,this._imageryLayerCollection=n,this._surfaceShaderSet=new gz,this._material=void 0,this._surface=new xu({tileProvider:new Wo({terrainProvider:t,imageryLayers:n,surfaceShaderSet:this._surfaceShaderSet})}),this._terrainProvider=t,this._terrainProviderChanged=new lt,this._undergroundColor=k.clone(k.BLACK),this._undergroundColorAlphaByDistance=new tn(e.maximumRadius/1e3,0,e.maximumRadius/5,1),this._translucency=new vQ,gF(this),this.show=!0,this._oceanNormalMapResourceDirty=!0,this._oceanNormalMapResource=new je({url:Un("Assets/Textures/waterNormalsSmall.jpg")}),this.maximumScreenSpaceError=2,this.tileCacheSize=100,this.loadingDescendantLimit=20,this.preloadAncestors=!0,this.preloadSiblings=!1,this.fillHighlightColor=void 0,this.enableLighting=!1,this.lambertDiffuseMultiplier=.9,this.dynamicAtmosphereLighting=!0,this.dynamicAtmosphereLightingFromSun=!1,this.showGroundAtmosphere=!0,this.atmosphereLightIntensity=10,this.atmosphereRayleighCoefficient=new d(55e-7,13e-6,284e-7),this.atmosphereMieCoefficient=new d(21e-6,21e-6,21e-6),this.atmosphereRayleighScaleHeight=1e4,this.atmosphereMieScaleHeight=3200,this.atmosphereMieAnisotropy=.9,this.lightingFadeOutDistance=1e7,this.lightingFadeInDistance=2e7,this.nightFadeOutDistance=1e7,this.nightFadeInDistance=5e7,this.showWaterEffect=!0,this.depthTestAgainstTerrain=!1,this.shadows=sr.RECEIVE_ONLY,this.atmosphereHueShift=0,this.atmosphereSaturationShift=0,this.atmosphereBrightnessShift=0,this.terrainExaggeration=1,this.terrainExaggerationRelativeHeight=0,this.showSkirts=!0,this.backFaceCulling=!0,this._oceanNormalMap=void 0,this._zoomedOutOceanSpecularIntensity=void 0,this.vertexShadowDarkness=.3}Object.defineProperties(vf.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},imageryLayers:{get:function(){return this._imageryLayerCollection}},imageryLayersUpdatedEvent:{get:function(){return this._surface.tileProvider.imageryLayersUpdatedEvent}},tilesLoaded:{get:function(){return l(this._surface)?this._surface.tileProvider.ready&&this._surface._tileLoadQueueHigh.length===0&&this._surface._tileLoadQueueMedium.length===0&&this._surface._tileLoadQueueLow.length===0:!0}},baseColor:{get:function(){return this._surface.tileProvider.baseColor},set:function(e){this._surface.tileProvider.baseColor=e}},clippingPlanes:{get:function(){return this._surface.tileProvider.clippingPlanes},set:function(e){this._surface.tileProvider.clippingPlanes=e}},cartographicLimitRectangle:{get:function(){return this._surface.tileProvider.cartographicLimitRectangle},set:function(e){l(e)||(e=Ee.clone(Ee.MAX_VALUE)),this._surface.tileProvider.cartographicLimitRectangle=e}},oceanNormalMapUrl:{get:function(){return this._oceanNormalMapResource.url},set:function(e){this._oceanNormalMapResource.url=e,this._oceanNormalMapResourceDirty=!0}},terrainProvider:{get:function(){return this._terrainProvider},set:function(e){e!==this._terrainProvider&&(this._terrainProvider=e,this._terrainProviderChanged.raiseEvent(e),l(this._material)&&gF(this))}},terrainProviderChanged:{get:function(){return this._terrainProviderChanged}},tileLoadProgressEvent:{get:function(){return this._surface.tileLoadProgressEvent}},material:{get:function(){return this._material},set:function(e){this._material!==e&&(this._material=e,gF(this))}},undergroundColor:{get:function(){return this._undergroundColor},set:function(e){this._undergroundColor=k.clone(e,this._undergroundColor)}},undergroundColorAlphaByDistance:{get:function(){return this._undergroundColorAlphaByDistance},set:function(e){if(l(e)&&e.far<e.near)throw new w("far distance must be greater than near distance.");this._undergroundColorAlphaByDistance=tn.clone(e,this._undergroundColorAlphaByDistance)}},translucency:{get:function(){return this._translucency}}});function gF(e){const t=[],n=l(e._material)&&(e._material.shaderSource.match(/slope/)||e._material.shaderSource.match("normalEC")),i=[OI,R5];l(e._material)&&(!n||e._terrainProvider.requestVertexNormals)?(i.push(e._material.shaderSource),t.push("APPLY_MATERIAL"),e._surface._tileProvider.materialUniformMap=e._material._uniforms):e._surface._tileProvider.materialUniformMap=void 0,i.push(LOe),e._surfaceShaderSet.baseVertexShaderSource=new nt({sources:[OI,R5,BOe],defines:t}),e._surfaceShaderSet.baseFragmentShaderSource=new nt({sources:i,defines:t}),e._surfaceShaderSet.material=e._material}function Q3e(e){return function(t,n){const i=Ae.distanceSquaredTo(t.pickBoundingSphere,e),o=Ae.distanceSquaredTo(n.pickBoundingSphere,e);return i-o}}const Z3e=[],eze={start:0,stop:0};vf.prototype.pickWorldCoordinates=function(e,t,n,i){if(!l(e))throw new w("ray is required");if(!l(t))throw new w("scene is required");n=A(n,!0);const o=t.mode,r=t.mapProjection,s=Z3e;s.length=0;const a=this._surface._tilesToRender;let c=a.length,u,f;for(f=0;f<c;++f){u=a[f];const _=u.data;if(!l(_))continue;let g=_.pickBoundingSphere;if(o!==me.SCENE3D)_.pickBoundingSphere=g=Ae.fromRectangleWithHeights2D(u.rectangle,r,_.tileBoundingRegion.minimumHeight,_.tileBoundingRegion.maximumHeight,g),d.fromElements(g.center.z,g.center.x,g.center.y,g.center);else if(l(_.renderedMesh))Ae.clone(_.tileBoundingRegion.boundingSphere,g);else continue;const p=qr.raySphere(e,g,eze);l(p)&&s.push(_)}s.sort(Q3e(e.origin));let h;for(c=s.length,f=0;f<c&&(h=s[f].pick(e,t.mode,t.mapProjection,n,i),!l(h));++f);return h};const tze=new ve;vf.prototype.pick=function(e,t,n){if(n=this.pickWorldCoordinates(e,t,!0,n),l(n)&&t.mode!==me.SCENE3D){n=d.fromElements(n.y,n.z,n.x,n);const i=t.mapProjection.unproject(n,tze);n=t.globe.ellipsoid.cartographicToCartesian(i,n)}return n};const nze=new d,d6=new d,ize=new ve,oze=new ii;function LB(e,t){return l(e)&&Ee.contains(e.rectangle,t)?e:void 0}vf.prototype.getHeight=function(e){if(!l(e))throw new w("cartographic is required");const t=this._surface._levelZeroTiles;if(!l(t))return;let n,i;const o=t.length;for(i=0;i<o&&(n=t[i],!Ee.contains(n.rectangle,e));++i);if(i>=o)return;let r=n;for(;l(n);)n=LB(n._southwestChild,e)||LB(n._southeastChild,e)||LB(n._northwestChild,e)||n._northeastChild,l(n)&&l(n.data)&&l(n.data.renderedMesh)&&(r=n);if(n=r,!l(n)||!l(n.data)||!l(n.data.renderedMesh))return;const s=this._surface._tileProvider.tilingScheme.projection,a=this._surface._tileProvider.tilingScheme.ellipsoid,c=d.fromRadians(e.longitude,e.latitude,0,a,nze),u=oze,f=a.geodeticSurfaceNormal(c,u.direction),h=a.getSurfaceNormalIntersectionWithZAxis(c,11500,u.origin);if(!l(h)){let g;l(n.data.tileBoundingRegion)&&(g=n.data.tileBoundingRegion.minimumHeight);const p=Math.min(A(g,0),-11500),y=d.multiplyByScalar(f,Math.abs(p)+1,d6);d.subtract(c,y,u.origin)}const _=n.data.pick(u,void 0,s,!1,d6);if(l(_))return a.cartesianToCartographic(_,ize).height};vf.prototype.update=function(e){this.show&&e.passes.render&&this._surface.update(e)};vf.prototype.beginFrame=function(e){const t=this._surface,n=t.tileProvider,i=this.terrainProvider,o=this.showWaterEffect&&i.ready&&i.hasWaterMask;if(o&&this._oceanNormalMapResourceDirty){this._oceanNormalMapResourceDirty=!1;const a=this._oceanNormalMapResource,c=a.url;if(l(c)){const u=this;a.fetchImage().then(function(f){c===u._oceanNormalMapResource.url&&(u._oceanNormalMap=u._oceanNormalMap&&u._oceanNormalMap.destroy(),u._oceanNormalMap=new rn({context:e.context,source:f}))})}else this._oceanNormalMap=this._oceanNormalMap&&this._oceanNormalMap.destroy()}const r=e.passes,s=e.mode;r.render&&(this.showGroundAtmosphere?this._zoomedOutOceanSpecularIntensity=.4:this._zoomedOutOceanSpecularIntensity=.5,t.maximumScreenSpaceError=this.maximumScreenSpaceError,t.tileCacheSize=this.tileCacheSize,t.loadingDescendantLimit=this.loadingDescendantLimit,t.preloadAncestors=this.preloadAncestors,t.preloadSiblings=this.preloadSiblings,n.terrainProvider=this.terrainProvider,n.lightingFadeOutDistance=this.lightingFadeOutDistance,n.lightingFadeInDistance=this.lightingFadeInDistance,n.nightFadeOutDistance=this.nightFadeOutDistance,n.nightFadeInDistance=this.nightFadeInDistance,n.zoomedOutOceanSpecularIntensity=s===me.SCENE3D?this._zoomedOutOceanSpecularIntensity:0,n.hasWaterMask=o,n.oceanNormalMap=this._oceanNormalMap,n.enableLighting=this.enableLighting,n.dynamicAtmosphereLighting=this.dynamicAtmosphereLighting,n.dynamicAtmosphereLightingFromSun=this.dynamicAtmosphereLightingFromSun,n.showGroundAtmosphere=this.showGroundAtmosphere,n.atmosphereLightIntensity=this.atmosphereLightIntensity,n.atmosphereRayleighCoefficient=this.atmosphereRayleighCoefficient,n.atmosphereMieCoefficient=this.atmosphereMieCoefficient,n.atmosphereRayleighScaleHeight=this.atmosphereRayleighScaleHeight,n.atmosphereMieScaleHeight=this.atmosphereMieScaleHeight,n.atmosphereMieAnisotropy=this.atmosphereMieAnisotropy,n.shadows=this.shadows,n.hueShift=this.atmosphereHueShift,n.saturationShift=this.atmosphereSaturationShift,n.brightnessShift=this.atmosphereBrightnessShift,n.fillHighlightColor=this.fillHighlightColor,n.showSkirts=this.showSkirts,n.backFaceCulling=this.backFaceCulling,n.vertexShadowDarkness=this.vertexShadowDarkness,n.undergroundColor=this._undergroundColor,n.undergroundColorAlphaByDistance=this._undergroundColorAlphaByDistance,n.lambertDiffuseMultiplier=this.lambertDiffuseMultiplier,t.beginFrame(e))};vf.prototype.render=function(e){this.show&&(l(this._material)&&this._material.update(e.context),this._surface.render(e))};vf.prototype.endFrame=function(e){this.show&&e.passes.render&&this._surface.endFrame(e)};vf.prototype.isDestroyed=function(){return!1};vf.prototype.destroy=function(){return this._surfaceShaderSet=this._surfaceShaderSet&&this._surfaceShaderSet.destroy(),this._surface=this._surface&&this._surface.destroy(),this._oceanNormalMap=this._oceanNormalMap&&this._oceanNormalMap.destroy(),Je(this)};function rze(e,t,n,i){this.rightAscension=e,this.declination=t,this.rotation=n,this.rotationRate=i}const RQ={},sze=32.184,aze=2451545,h6=-.0529921,p6=-.1059842,m6=13.0120009,_6=13.3407154,g6=.9856003,y6=26.4057084,A6=13.064993,T6=.3287146,C6=1.7484877,b6=-.1589763,E6=.0036096,x6=.1643573,w6=12.9590088;let BB=new ce;RQ.ComputeMoon=function(e,t){l(e)||(e=ce.now()),BB=ce.addSeconds(e,sze,BB);const n=ce.totalDays(BB)-aze,i=n/to.DAYS_PER_JULIAN_CENTURY,o=(125.045+h6*n)*F.RADIANS_PER_DEGREE,r=(250.089+p6*n)*F.RADIANS_PER_DEGREE,s=(260.008+m6*n)*F.RADIANS_PER_DEGREE,a=(176.625+_6*n)*F.RADIANS_PER_DEGREE,c=(357.529+g6*n)*F.RADIANS_PER_DEGREE,u=(311.589+y6*n)*F.RADIANS_PER_DEGREE,f=(134.963+A6*n)*F.RADIANS_PER_DEGREE,h=(276.617+T6*n)*F.RADIANS_PER_DEGREE,_=(34.226+C6*n)*F.RADIANS_PER_DEGREE,g=(15.134+b6*n)*F.RADIANS_PER_DEGREE,p=(119.743+E6*n)*F.RADIANS_PER_DEGREE,y=(239.961+x6*n)*F.RADIANS_PER_DEGREE,T=(25.053+w6*n)*F.RADIANS_PER_DEGREE,b=Math.sin(o),x=Math.sin(r),v=Math.sin(s),D=Math.sin(a),L=Math.sin(c),B=Math.sin(u),V=Math.sin(f),M=Math.sin(h),H=Math.sin(_),G=Math.sin(g),I=Math.sin(p),O=Math.sin(y),m=Math.sin(T),P=Math.cos(o),R=Math.cos(r),U=Math.cos(s),W=Math.cos(a),q=Math.cos(c),Y=Math.cos(u),j=Math.cos(f),ee=Math.cos(h),K=Math.cos(_),se=Math.cos(g),Q=Math.cos(p),Z=Math.cos(y),J=Math.cos(T),de=(269.9949+.0031*i-3.8787*b-.1204*x+.07*v-.0172*D+.0072*B-.0052*G+.0043*m)*F.RADIANS_PER_DEGREE,_e=(66.5392+.013*i+1.5419*P+.0239*R-.0278*U+.0068*W-.0029*Y+9e-4*j+8e-4*se-9e-4*J)*F.RADIANS_PER_DEGREE,le=(38.3213+13.17635815*n-14e-13*n*n+3.561*b+.1208*x-.0642*v+.0158*D+.0252*L-.0066*B-.0047*V-.0046*M+.0028*H+.0052*G+.004*I+.0019*O-.0044*m)*F.RADIANS_PER_DEGREE,Te=(13.17635815-14e-13*(2*n)+3.561*P*h6+.1208*R*p6-.0642*U*m6+.0158*W*_6+.0252*q*g6-.0066*Y*y6-.0047*j*A6-.0046*ee*T6+.0028*K*C6+.0052*se*b6+.004*Q*E6+.0019*Z*x6-.0044*J*w6)/86400*F.RADIANS_PER_DEGREE;return l(t)||(t=new rze),t.rightAscension=de,t.declination=_e,t.rotation=le,t.rotationRate=Te,t};const cze=RQ;function NQ(e){(!l(e)||typeof e!="function")&&(e=cze.ComputeMoon),this._computeFunction=e}const lze=new d,uze=new d,fze=new d;function dze(e,t,n){const i=lze;i.x=Math.cos(e+F.PI_OVER_TWO),i.y=Math.sin(e+F.PI_OVER_TWO),i.z=0;const o=Math.cos(t),r=fze;r.x=o*Math.cos(e),r.y=o*Math.sin(e),r.z=Math.sin(t);const s=d.cross(r,i,uze);return l(n)||(n=new te),n[0]=i.x,n[1]=s.x,n[2]=r.x,n[3]=i.y,n[4]=s.y,n[5]=r.y,n[6]=i.z,n[7]=s.z,n[8]=r.z,n}const hze=new te,pze=new De;NQ.prototype.evaluate=function(e,t){l(e)||(e=ce.now());const n=this._computeFunction(e),i=dze(n.rightAscension,n.declination,t),o=F.zeroToTwoPi(n.rotation),r=De.fromAxisAngle(d.UNIT_Z,o,pze),s=te.fromQuaternion(De.conjugate(r,r),hze);return te.multiply(s,i,i)};const mze=new d;function Ss(e){e=A(e,A.EMPTY_OBJECT);const t=e.minimum,n=e.maximum;if(E.typeOf.object("min",t),E.typeOf.object("max",n),l(e.offsetAttribute)&&e.offsetAttribute===Fn.TOP)throw new w("GeometryOffsetAttribute.TOP is not a supported options.offsetAttribute for this geometry.");const i=A(e.vertexFormat,Ye.DEFAULT);this._minimum=d.clone(t),this._maximum=d.clone(n),this._vertexFormat=i,this._offsetAttribute=e.offsetAttribute,this._workerName="createBoxGeometry"}Ss.fromDimensions=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.dimensions;E.typeOf.object("dimensions",t),E.typeOf.number.greaterThanOrEquals("dimensions.x",t.x,0),E.typeOf.number.greaterThanOrEquals("dimensions.y",t.y,0),E.typeOf.number.greaterThanOrEquals("dimensions.z",t.z,0);const n=d.multiplyByScalar(t,.5,new d);return new Ss({minimum:d.negate(n,new d),maximum:n,vertexFormat:e.vertexFormat,offsetAttribute:e.offsetAttribute})};Ss.fromAxisAlignedBoundingBox=function(e){return E.typeOf.object("boundingBox",e),new Ss({minimum:e.minimum,maximum:e.maximum})};Ss.packedLength=2*d.packedLength+Ye.packedLength+1;Ss.pack=function(e,t,n){return E.typeOf.object("value",e),E.defined("array",t),n=A(n,0),d.pack(e._minimum,t,n),d.pack(e._maximum,t,n+d.packedLength),Ye.pack(e._vertexFormat,t,n+2*d.packedLength),t[n+2*d.packedLength+Ye.packedLength]=A(e._offsetAttribute,-1),t};const MQ=new d,FQ=new d,zQ=new Ye,S6={minimum:MQ,maximum:FQ,vertexFormat:zQ,offsetAttribute:void 0};Ss.unpack=function(e,t,n){E.defined("array",e),t=A(t,0);const i=d.unpack(e,t,MQ),o=d.unpack(e,t+d.packedLength,FQ),r=Ye.unpack(e,t+2*d.packedLength,zQ),s=e[t+2*d.packedLength+Ye.packedLength];return l(n)?(n._minimum=d.clone(i,n._minimum),n._maximum=d.clone(o,n._maximum),n._vertexFormat=Ye.clone(r,n._vertexFormat),n._offsetAttribute=s===-1?void 0:s,n):(S6.offsetAttribute=s===-1?void 0:s,new Ss(S6))};Ss.createGeometry=function(e){const t=e._minimum,n=e._maximum,i=e._vertexFormat;if(d.equals(t,n))return;const o=new To;let r,s;if(i.position&&(i.st||i.normal||i.tangent||i.bitangent)){if(i.position&&(s=new Float64Array(6*4*3),s[0]=t.x,s[1]=t.y,s[2]=n.z,s[3]=n.x,s[4]=t.y,s[5]=n.z,s[6]=n.x,s[7]=n.y,s[8]=n.z,s[9]=t.x,s[10]=n.y,s[11]=n.z,s[12]=t.x,s[13]=t.y,s[14]=t.z,s[15]=n.x,s[16]=t.y,s[17]=t.z,s[18]=n.x,s[19]=n.y,s[20]=t.z,s[21]=t.x,s[22]=n.y,s[23]=t.z,s[24]=n.x,s[25]=t.y,s[26]=t.z,s[27]=n.x,s[28]=n.y,s[29]=t.z,s[30]=n.x,s[31]=n.y,s[32]=n.z,s[33]=n.x,s[34]=t.y,s[35]=n.z,s[36]=t.x,s[37]=t.y,s[38]=t.z,s[39]=t.x,s[40]=n.y,s[41]=t.z,s[42]=t.x,s[43]=n.y,s[44]=n.z,s[45]=t.x,s[46]=t.y,s[47]=n.z,s[48]=t.x,s[49]=n.y,s[50]=t.z,s[51]=n.x,s[52]=n.y,s[53]=t.z,s[54]=n.x,s[55]=n.y,s[56]=n.z,s[57]=t.x,s[58]=n.y,s[59]=n.z,s[60]=t.x,s[61]=t.y,s[62]=t.z,s[63]=n.x,s[64]=t.y,s[65]=t.z,s[66]=n.x,s[67]=t.y,s[68]=n.z,s[69]=t.x,s[70]=t.y,s[71]=n.z,o.position=new Xe({componentDatatype:oe.DOUBLE,componentsPerAttribute:3,values:s})),i.normal){const u=new Float32Array(72);u[0]=0,u[1]=0,u[2]=1,u[3]=0,u[4]=0,u[5]=1,u[6]=0,u[7]=0,u[8]=1,u[9]=0,u[10]=0,u[11]=1,u[12]=0,u[13]=0,u[14]=-1,u[15]=0,u[16]=0,u[17]=-1,u[18]=0,u[19]=0,u[20]=-1,u[21]=0,u[22]=0,u[23]=-1,u[24]=1,u[25]=0,u[26]=0,u[27]=1,u[28]=0,u[29]=0,u[30]=1,u[31]=0,u[32]=0,u[33]=1,u[34]=0,u[35]=0,u[36]=-1,u[37]=0,u[38]=0,u[39]=-1,u[40]=0,u[41]=0,u[42]=-1,u[43]=0,u[44]=0,u[45]=-1,u[46]=0,u[47]=0,u[48]=0,u[49]=1,u[50]=0,u[51]=0,u[52]=1,u[53]=0,u[54]=0,u[55]=1,u[56]=0,u[57]=0,u[58]=1,u[59]=0,u[60]=0,u[61]=-1,u[62]=0,u[63]=0,u[64]=-1,u[65]=0,u[66]=0,u[67]=-1,u[68]=0,u[69]=0,u[70]=-1,u[71]=0,o.normal=new Xe({componentDatatype:oe.FLOAT,componentsPerAttribute:3,values:u})}if(i.st){const u=new Float32Array(48);u[0]=0,u[1]=0,u[2]=1,u[3]=0,u[4]=1,u[5]=1,u[6]=0,u[7]=1,u[8]=1,u[9]=0,u[10]=0,u[11]=0,u[12]=0,u[13]=1,u[14]=1,u[15]=1,u[16]=0,u[17]=0,u[18]=1,u[19]=0,u[20]=1,u[21]=1,u[22]=0,u[23]=1,u[24]=1,u[25]=0,u[26]=0,u[27]=0,u[28]=0,u[29]=1,u[30]=1,u[31]=1,u[32]=1,u[33]=0,u[34]=0,u[35]=0,u[36]=0,u[37]=1,u[38]=1,u[39]=1,u[40]=0,u[41]=0,u[42]=1,u[43]=0,u[44]=1,u[45]=1,u[46]=0,u[47]=1,o.st=new Xe({componentDatatype:oe.FLOAT,componentsPerAttribute:2,values:u})}if(i.tangent){const u=new Float32Array(72);u[0]=1,u[1]=0,u[2]=0,u[3]=1,u[4]=0,u[5]=0,u[6]=1,u[7]=0,u[8]=0,u[9]=1,u[10]=0,u[11]=0,u[12]=-1,u[13]=0,u[14]=0,u[15]=-1,u[16]=0,u[17]=0,u[18]=-1,u[19]=0,u[20]=0,u[21]=-1,u[22]=0,u[23]=0,u[24]=0,u[25]=1,u[26]=0,u[27]=0,u[28]=1,u[29]=0,u[30]=0,u[31]=1,u[32]=0,u[33]=0,u[34]=1,u[35]=0,u[36]=0,u[37]=-1,u[38]=0,u[39]=0,u[40]=-1,u[41]=0,u[42]=0,u[43]=-1,u[44]=0,u[45]=0,u[46]=-1,u[47]=0,u[48]=-1,u[49]=0,u[50]=0,u[51]=-1,u[52]=0,u[53]=0,u[54]=-1,u[55]=0,u[56]=0,u[57]=-1,u[58]=0,u[59]=0,u[60]=1,u[61]=0,u[62]=0,u[63]=1,u[64]=0,u[65]=0,u[66]=1,u[67]=0,u[68]=0,u[69]=1,u[70]=0,u[71]=0,o.tangent=new Xe({componentDatatype:oe.FLOAT,componentsPerAttribute:3,values:u})}if(i.bitangent){const u=new Float32Array(72);u[0]=0,u[1]=1,u[2]=0,u[3]=0,u[4]=1,u[5]=0,u[6]=0,u[7]=1,u[8]=0,u[9]=0,u[10]=1,u[11]=0,u[12]=0,u[13]=1,u[14]=0,u[15]=0,u[16]=1,u[17]=0,u[18]=0,u[19]=1,u[20]=0,u[21]=0,u[22]=1,u[23]=0,u[24]=0,u[25]=0,u[26]=1,u[27]=0,u[28]=0,u[29]=1,u[30]=0,u[31]=0,u[32]=1,u[33]=0,u[34]=0,u[35]=1,u[36]=0,u[37]=0,u[38]=1,u[39]=0,u[40]=0,u[41]=1,u[42]=0,u[43]=0,u[44]=1,u[45]=0,u[46]=0,u[47]=1,u[48]=0,u[49]=0,u[50]=1,u[51]=0,u[52]=0,u[53]=1,u[54]=0,u[55]=0,u[56]=1,u[57]=0,u[58]=0,u[59]=1,u[60]=0,u[61]=0,u[62]=1,u[63]=0,u[64]=0,u[65]=1,u[66]=0,u[67]=0,u[68]=1,u[69]=0,u[70]=0,u[71]=1,o.bitangent=new Xe({componentDatatype:oe.FLOAT,componentsPerAttribute:3,values:u})}r=new Uint16Array(6*2*3),r[0]=0,r[1]=1,r[2]=2,r[3]=0,r[4]=2,r[5]=3,r[6]=4+2,r[7]=4+1,r[8]=4+0,r[9]=4+3,r[10]=4+2,r[11]=4+0,r[12]=8+0,r[13]=8+1,r[14]=8+2,r[15]=8+0,r[16]=8+2,r[17]=8+3,r[18]=12+2,r[19]=12+1,r[20]=12+0,r[21]=12+3,r[22]=12+2,r[23]=12+0,r[24]=16+2,r[25]=16+1,r[26]=16+0,r[27]=16+3,r[28]=16+2,r[29]=16+0,r[30]=20+0,r[31]=20+1,r[32]=20+2,r[33]=20+0,r[34]=20+2,r[35]=20+3}else s=new Float64Array(8*3),s[0]=t.x,s[1]=t.y,s[2]=t.z,s[3]=n.x,s[4]=t.y,s[5]=t.z,s[6]=n.x,s[7]=n.y,s[8]=t.z,s[9]=t.x,s[10]=n.y,s[11]=t.z,s[12]=t.x,s[13]=t.y,s[14]=n.z,s[15]=n.x,s[16]=t.y,s[17]=n.z,s[18]=n.x,s[19]=n.y,s[20]=n.z,s[21]=t.x,s[22]=n.y,s[23]=n.z,o.position=new Xe({componentDatatype:oe.DOUBLE,componentsPerAttribute:3,values:s}),r=new Uint16Array(6*2*3),r[0]=4,r[1]=5,r[2]=6,r[3]=4,r[4]=6,r[5]=7,r[6]=1,r[7]=0,r[8]=3,r[9]=1,r[10]=3,r[11]=2,r[12]=1,r[13]=6,r[14]=5,r[15]=1,r[16]=2,r[17]=6,r[18]=2,r[19]=3,r[20]=7,r[21]=2,r[22]=7,r[23]=6,r[24]=3,r[25]=0,r[26]=4,r[27]=3,r[28]=4,r[29]=7,r[30]=0,r[31]=1,r[32]=5,r[33]=0,r[34]=5,r[35]=4;const a=d.subtract(n,t,mze),c=d.magnitude(a)*.5;if(l(e._offsetAttribute)){const u=s.length,f=e._offsetAttribute===Fn.NONE?0:1,h=new Uint8Array(u/3).fill(f);o.applyOffset=new Xe({componentDatatype:oe.UNSIGNED_BYTE,componentsPerAttribute:1,values:h})}return new $t({attributes:o,indices:r,primitiveType:dt.TRIANGLES,boundingSphere:new Ae(d.ZERO,c),offsetAttribute:e._offsetAttribute})};let RB;Ss.getUnitBox=function(){return l(RB)||(RB=Ss.createGeometry(Ss.fromDimensions({dimensions:new d(1,1,1),vertexFormat:Ye.POSITION_ONLY}))),RB};const _ze=`uniform sampler2D image;
|
||
|
||
czm_material czm_getMaterial(czm_materialInput materialInput)
|
||
{
|
||
czm_material material = czm_getDefaultMaterial(materialInput);
|
||
vec4 rampColor = texture2D(image, vec2(materialInput.aspect / (2.0 * czm_pi), 0.5));
|
||
rampColor = czm_gammaCorrect(rampColor);
|
||
material.diffuse = rampColor.rgb;
|
||
material.alpha = rampColor.a;
|
||
return material;
|
||
}
|
||
`,gze=`uniform sampler2D image;
|
||
uniform float strength;
|
||
uniform vec2 repeat;
|
||
|
||
czm_material czm_getMaterial(czm_materialInput materialInput)
|
||
{
|
||
czm_material material = czm_getDefaultMaterial(materialInput);
|
||
|
||
vec2 st = materialInput.st;
|
||
|
||
vec2 centerPixel = fract(repeat * st);
|
||
float centerBump = texture2D(image, centerPixel).channel;
|
||
|
||
float imageWidth = float(imageDimensions.x);
|
||
vec2 rightPixel = fract(repeat * (st + vec2(1.0 / imageWidth, 0.0)));
|
||
float rightBump = texture2D(image, rightPixel).channel;
|
||
|
||
float imageHeight = float(imageDimensions.y);
|
||
vec2 leftPixel = fract(repeat * (st + vec2(0.0, 1.0 / imageHeight)));
|
||
float topBump = texture2D(image, leftPixel).channel;
|
||
|
||
vec3 normalTangentSpace = normalize(vec3(centerBump - rightBump, centerBump - topBump, clamp(1.0 - strength, 0.1, 1.0)));
|
||
vec3 normalEC = materialInput.tangentToEyeMatrix * normalTangentSpace;
|
||
|
||
material.normal = normalEC;
|
||
material.diffuse = vec3(0.01);
|
||
|
||
return material;
|
||
}
|
||
`,yze=`uniform vec4 lightColor;
|
||
uniform vec4 darkColor;
|
||
uniform vec2 repeat;
|
||
|
||
czm_material czm_getMaterial(czm_materialInput materialInput)
|
||
{
|
||
czm_material material = czm_getDefaultMaterial(materialInput);
|
||
|
||
vec2 st = materialInput.st;
|
||
|
||
// From Stefan Gustavson's Procedural Textures in GLSL in OpenGL Insights
|
||
float b = mod(floor(repeat.s * st.s) + floor(repeat.t * st.t), 2.0); // 0.0 or 1.0
|
||
|
||
// Find the distance from the closest separator (region between two colors)
|
||
float scaledWidth = fract(repeat.s * st.s);
|
||
scaledWidth = abs(scaledWidth - floor(scaledWidth + 0.5));
|
||
float scaledHeight = fract(repeat.t * st.t);
|
||
scaledHeight = abs(scaledHeight - floor(scaledHeight + 0.5));
|
||
float value = min(scaledWidth, scaledHeight);
|
||
|
||
vec4 currentColor = mix(lightColor, darkColor, b);
|
||
vec4 color = czm_antialias(lightColor, darkColor, currentColor, value, 0.03);
|
||
|
||
color = czm_gammaCorrect(color);
|
||
material.diffuse = color.rgb;
|
||
material.alpha = color.a;
|
||
|
||
return material;
|
||
}
|
||
`,Aze=`uniform vec4 lightColor;
|
||
uniform vec4 darkColor;
|
||
uniform vec2 repeat;
|
||
|
||
czm_material czm_getMaterial(czm_materialInput materialInput)
|
||
{
|
||
czm_material material = czm_getDefaultMaterial(materialInput);
|
||
|
||
// From Stefan Gustavson's Procedural Textures in GLSL in OpenGL Insights
|
||
float b = smoothstep(0.3, 0.32, length(fract(repeat * materialInput.st) - 0.5)); // 0.0 or 1.0
|
||
|
||
vec4 color = mix(lightColor, darkColor, b);
|
||
color = czm_gammaCorrect(color);
|
||
material.diffuse = color.rgb;
|
||
material.alpha = color.a;
|
||
|
||
return material;
|
||
}
|
||
`,Tze=`uniform sampler2D heights;
|
||
uniform sampler2D colors;
|
||
|
||
// This material expects heights to be sorted from lowest to highest.
|
||
|
||
float getHeight(int idx, float invTexSize)
|
||
{
|
||
vec2 uv = vec2((float(idx) + 0.5) * invTexSize, 0.5);
|
||
#ifdef OES_texture_float
|
||
return texture2D(heights, uv).x;
|
||
#else
|
||
return czm_unpackFloat(texture2D(heights, uv));
|
||
#endif
|
||
}
|
||
|
||
czm_material czm_getMaterial(czm_materialInput materialInput)
|
||
{
|
||
czm_material material = czm_getDefaultMaterial(materialInput);
|
||
|
||
float height = materialInput.height;
|
||
float invTexSize = 1.0 / float(heightsDimensions.x);
|
||
|
||
float minHeight = getHeight(0, invTexSize);
|
||
float maxHeight = getHeight(heightsDimensions.x - 1, invTexSize);
|
||
|
||
// early-out when outside the height range
|
||
if (height < minHeight || height > maxHeight) {
|
||
material.diffuse = vec3(0.0);
|
||
material.alpha = 0.0;
|
||
return material;
|
||
}
|
||
|
||
// Binary search to find heights above and below.
|
||
int idxBelow = 0;
|
||
int idxAbove = heightsDimensions.x;
|
||
float heightBelow = minHeight;
|
||
float heightAbove = maxHeight;
|
||
|
||
// while loop not allowed, so use for loop with max iterations.
|
||
// maxIterations of 16 supports a texture size up to 65536 (2^16).
|
||
const int maxIterations = 16;
|
||
for (int i = 0; i < maxIterations; i++) {
|
||
if (idxBelow >= idxAbove - 1) {
|
||
break;
|
||
}
|
||
|
||
int idxMid = (idxBelow + idxAbove) / 2;
|
||
float heightTex = getHeight(idxMid, invTexSize);
|
||
|
||
if (height > heightTex) {
|
||
idxBelow = idxMid;
|
||
heightBelow = heightTex;
|
||
} else {
|
||
idxAbove = idxMid;
|
||
heightAbove = heightTex;
|
||
}
|
||
}
|
||
|
||
float lerper = heightBelow == heightAbove ? 1.0 : (height - heightBelow) / (heightAbove - heightBelow);
|
||
vec2 colorUv = vec2(invTexSize * (float(idxBelow) + 0.5 + lerper), 0.5);
|
||
vec4 color = texture2D(colors, colorUv);
|
||
|
||
// undo preumultiplied alpha
|
||
if (color.a > 0.0)
|
||
{
|
||
color.rgb /= color.a;
|
||
}
|
||
|
||
color.rgb = czm_gammaCorrect(color.rgb);
|
||
|
||
material.diffuse = color.rgb;
|
||
material.alpha = color.a;
|
||
return material;
|
||
}
|
||
`,Cze=`#ifdef GL_OES_standard_derivatives
|
||
#extension GL_OES_standard_derivatives : enable
|
||
#endif
|
||
|
||
uniform vec4 color;
|
||
uniform float spacing;
|
||
uniform float width;
|
||
|
||
czm_material czm_getMaterial(czm_materialInput materialInput)
|
||
{
|
||
czm_material material = czm_getDefaultMaterial(materialInput);
|
||
|
||
float distanceToContour = mod(materialInput.height, spacing);
|
||
|
||
#ifdef GL_OES_standard_derivatives
|
||
float dxc = abs(dFdx(materialInput.height));
|
||
float dyc = abs(dFdy(materialInput.height));
|
||
float dF = max(dxc, dyc) * czm_pixelRatio * width;
|
||
float alpha = (distanceToContour < dF) ? 1.0 : 0.0;
|
||
#else
|
||
float alpha = (distanceToContour < (czm_pixelRatio * width)) ? 1.0 : 0.0;
|
||
#endif
|
||
|
||
vec4 outColor = czm_gammaCorrect(vec4(color.rgb, alpha * color.a));
|
||
material.diffuse = outColor.rgb;
|
||
material.alpha = outColor.a;
|
||
|
||
return material;
|
||
}
|
||
`,bze=`uniform sampler2D image;
|
||
uniform float minimumHeight;
|
||
uniform float maximumHeight;
|
||
|
||
czm_material czm_getMaterial(czm_materialInput materialInput)
|
||
{
|
||
czm_material material = czm_getDefaultMaterial(materialInput);
|
||
float scaledHeight = clamp((materialInput.height - minimumHeight) / (maximumHeight - minimumHeight), 0.0, 1.0);
|
||
vec4 rampColor = texture2D(image, vec2(scaledHeight, 0.5));
|
||
rampColor = czm_gammaCorrect(rampColor);
|
||
material.diffuse = rampColor.rgb;
|
||
material.alpha = rampColor.a;
|
||
return material;
|
||
}
|
||
`,Eze=`uniform vec4 fadeInColor;
|
||
uniform vec4 fadeOutColor;
|
||
uniform float maximumDistance;
|
||
uniform bool repeat;
|
||
uniform vec2 fadeDirection;
|
||
uniform vec2 time;
|
||
|
||
float getTime(float t, float coord)
|
||
{
|
||
float scalar = 1.0 / maximumDistance;
|
||
float q = distance(t, coord) * scalar;
|
||
if (repeat)
|
||
{
|
||
float r = distance(t, coord + 1.0) * scalar;
|
||
float s = distance(t, coord - 1.0) * scalar;
|
||
q = min(min(r, s), q);
|
||
}
|
||
return clamp(q, 0.0, 1.0);
|
||
}
|
||
|
||
czm_material czm_getMaterial(czm_materialInput materialInput)
|
||
{
|
||
czm_material material = czm_getDefaultMaterial(materialInput);
|
||
|
||
vec2 st = materialInput.st;
|
||
float s = getTime(time.x, st.s) * fadeDirection.s;
|
||
float t = getTime(time.y, st.t) * fadeDirection.t;
|
||
|
||
float u = length(vec2(s, t));
|
||
vec4 color = mix(fadeInColor, fadeOutColor, u);
|
||
|
||
color = czm_gammaCorrect(color);
|
||
material.emission = color.rgb;
|
||
material.alpha = color.a;
|
||
|
||
return material;
|
||
}
|
||
`,xze=`#ifdef GL_OES_standard_derivatives
|
||
#extension GL_OES_standard_derivatives : enable
|
||
#endif
|
||
|
||
uniform vec4 color;
|
||
uniform float cellAlpha;
|
||
uniform vec2 lineCount;
|
||
uniform vec2 lineThickness;
|
||
uniform vec2 lineOffset;
|
||
|
||
czm_material czm_getMaterial(czm_materialInput materialInput)
|
||
{
|
||
czm_material material = czm_getDefaultMaterial(materialInput);
|
||
|
||
vec2 st = materialInput.st;
|
||
|
||
float scaledWidth = fract(lineCount.s * st.s - lineOffset.s);
|
||
scaledWidth = abs(scaledWidth - floor(scaledWidth + 0.5));
|
||
float scaledHeight = fract(lineCount.t * st.t - lineOffset.t);
|
||
scaledHeight = abs(scaledHeight - floor(scaledHeight + 0.5));
|
||
|
||
float value;
|
||
#ifdef GL_OES_standard_derivatives
|
||
// Fuzz Factor - Controls blurriness of lines
|
||
const float fuzz = 1.2;
|
||
vec2 thickness = (lineThickness * czm_pixelRatio) - 1.0;
|
||
|
||
// From "3D Engine Design for Virtual Globes" by Cozzi and Ring, Listing 4.13.
|
||
vec2 dx = abs(dFdx(st));
|
||
vec2 dy = abs(dFdy(st));
|
||
vec2 dF = vec2(max(dx.s, dy.s), max(dx.t, dy.t)) * lineCount;
|
||
value = min(
|
||
smoothstep(dF.s * thickness.s, dF.s * (fuzz + thickness.s), scaledWidth),
|
||
smoothstep(dF.t * thickness.t, dF.t * (fuzz + thickness.t), scaledHeight));
|
||
#else
|
||
// Fuzz Factor - Controls blurriness of lines
|
||
const float fuzz = 0.05;
|
||
|
||
vec2 range = 0.5 - (lineThickness * 0.05);
|
||
value = min(
|
||
1.0 - smoothstep(range.s, range.s + fuzz, scaledWidth),
|
||
1.0 - smoothstep(range.t, range.t + fuzz, scaledHeight));
|
||
#endif
|
||
|
||
// Edges taken from RimLightingMaterial.glsl
|
||
// See http://www.fundza.com/rman_shaders/surface/fake_rim/fake_rim1.html
|
||
float dRim = 1.0 - abs(dot(materialInput.normalEC, normalize(materialInput.positionToEyeEC)));
|
||
float sRim = smoothstep(0.8, 1.0, dRim);
|
||
value *= (1.0 - sRim);
|
||
|
||
vec4 halfColor;
|
||
halfColor.rgb = color.rgb * 0.5;
|
||
halfColor.a = color.a * (1.0 - ((1.0 - cellAlpha) * value));
|
||
halfColor = czm_gammaCorrect(halfColor);
|
||
material.diffuse = halfColor.rgb;
|
||
material.emission = halfColor.rgb;
|
||
material.alpha = halfColor.a;
|
||
|
||
return material;
|
||
}
|
||
`,wze=`uniform sampler2D image;
|
||
uniform float strength;
|
||
uniform vec2 repeat;
|
||
|
||
czm_material czm_getMaterial(czm_materialInput materialInput)
|
||
{
|
||
czm_material material = czm_getDefaultMaterial(materialInput);
|
||
|
||
vec4 textureValue = texture2D(image, fract(repeat * materialInput.st));
|
||
vec3 normalTangentSpace = textureValue.channels;
|
||
normalTangentSpace.xy = normalTangentSpace.xy * 2.0 - 1.0;
|
||
normalTangentSpace.z = clamp(1.0 - strength, 0.1, 1.0);
|
||
normalTangentSpace = normalize(normalTangentSpace);
|
||
vec3 normalEC = materialInput.tangentToEyeMatrix * normalTangentSpace;
|
||
|
||
material.normal = normalEC;
|
||
|
||
return material;
|
||
}
|
||
`,Sze=`#ifdef GL_OES_standard_derivatives
|
||
#extension GL_OES_standard_derivatives : enable
|
||
#endif
|
||
|
||
uniform vec4 color;
|
||
|
||
float getPointOnLine(vec2 p0, vec2 p1, float x)
|
||
{
|
||
float slope = (p0.y - p1.y) / (p0.x - p1.x);
|
||
return slope * (x - p0.x) + p0.y;
|
||
}
|
||
|
||
czm_material czm_getMaterial(czm_materialInput materialInput)
|
||
{
|
||
czm_material material = czm_getDefaultMaterial(materialInput);
|
||
|
||
vec2 st = materialInput.st;
|
||
|
||
#ifdef GL_OES_standard_derivatives
|
||
float base = 1.0 - abs(fwidth(st.s)) * 10.0 * czm_pixelRatio;
|
||
#else
|
||
float base = 0.975; // 2.5% of the line will be the arrow head
|
||
#endif
|
||
|
||
vec2 center = vec2(1.0, 0.5);
|
||
float ptOnUpperLine = getPointOnLine(vec2(base, 1.0), center, st.s);
|
||
float ptOnLowerLine = getPointOnLine(vec2(base, 0.0), center, st.s);
|
||
|
||
float halfWidth = 0.15;
|
||
float s = step(0.5 - halfWidth, st.t);
|
||
s *= 1.0 - step(0.5 + halfWidth, st.t);
|
||
s *= 1.0 - step(base, st.s);
|
||
|
||
float t = step(base, materialInput.st.s);
|
||
t *= 1.0 - step(ptOnUpperLine, st.t);
|
||
t *= step(ptOnLowerLine, st.t);
|
||
|
||
// Find the distance from the closest separator (region between two colors)
|
||
float dist;
|
||
if (st.s < base)
|
||
{
|
||
float d1 = abs(st.t - (0.5 - halfWidth));
|
||
float d2 = abs(st.t - (0.5 + halfWidth));
|
||
dist = min(d1, d2);
|
||
}
|
||
else
|
||
{
|
||
float d1 = czm_infinity;
|
||
if (st.t < 0.5 - halfWidth && st.t > 0.5 + halfWidth)
|
||
{
|
||
d1 = abs(st.s - base);
|
||
}
|
||
float d2 = abs(st.t - ptOnUpperLine);
|
||
float d3 = abs(st.t - ptOnLowerLine);
|
||
dist = min(min(d1, d2), d3);
|
||
}
|
||
|
||
vec4 outsideColor = vec4(0.0);
|
||
vec4 currentColor = mix(outsideColor, color, clamp(s + t, 0.0, 1.0));
|
||
vec4 outColor = czm_antialias(outsideColor, color, currentColor, dist);
|
||
|
||
outColor = czm_gammaCorrect(outColor);
|
||
material.diffuse = outColor.rgb;
|
||
material.alpha = outColor.a;
|
||
return material;
|
||
}
|
||
`,vze=`uniform vec4 color;
|
||
uniform vec4 gapColor;
|
||
uniform float dashLength;
|
||
uniform float dashPattern;
|
||
varying float v_polylineAngle;
|
||
|
||
const float maskLength = 16.0;
|
||
|
||
mat2 rotate(float rad) {
|
||
float c = cos(rad);
|
||
float s = sin(rad);
|
||
return mat2(
|
||
c, s,
|
||
-s, c
|
||
);
|
||
}
|
||
|
||
czm_material czm_getMaterial(czm_materialInput materialInput)
|
||
{
|
||
czm_material material = czm_getDefaultMaterial(materialInput);
|
||
|
||
vec2 pos = rotate(v_polylineAngle) * gl_FragCoord.xy;
|
||
|
||
// Get the relative position within the dash from 0 to 1
|
||
float dashPosition = fract(pos.x / (dashLength * czm_pixelRatio));
|
||
// Figure out the mask index.
|
||
float maskIndex = floor(dashPosition * maskLength);
|
||
// Test the bit mask.
|
||
float maskTest = floor(dashPattern / pow(2.0, maskIndex));
|
||
vec4 fragColor = (mod(maskTest, 2.0) < 1.0) ? gapColor : color;
|
||
if (fragColor.a < 0.005) { // matches 0/255 and 1/255
|
||
discard;
|
||
}
|
||
|
||
fragColor = czm_gammaCorrect(fragColor);
|
||
material.emission = fragColor.rgb;
|
||
material.alpha = fragColor.a;
|
||
return material;
|
||
}
|
||
`,Dze=`uniform vec4 color;
|
||
uniform float glowPower;
|
||
uniform float taperPower;
|
||
|
||
czm_material czm_getMaterial(czm_materialInput materialInput)
|
||
{
|
||
czm_material material = czm_getDefaultMaterial(materialInput);
|
||
|
||
vec2 st = materialInput.st;
|
||
float glow = glowPower / abs(st.t - 0.5) - (glowPower / 0.5);
|
||
|
||
if (taperPower <= 0.99999) {
|
||
glow *= min(1.0, taperPower / (0.5 - st.s * 0.5) - (taperPower / 0.5));
|
||
}
|
||
|
||
vec4 fragColor;
|
||
fragColor.rgb = max(vec3(glow - 1.0 + color.rgb), color.rgb);
|
||
fragColor.a = clamp(0.0, 1.0, glow) * color.a;
|
||
fragColor = czm_gammaCorrect(fragColor);
|
||
|
||
material.emission = fragColor.rgb;
|
||
material.alpha = fragColor.a;
|
||
|
||
return material;
|
||
}
|
||
`,Ize=`uniform vec4 color;
|
||
uniform vec4 outlineColor;
|
||
uniform float outlineWidth;
|
||
|
||
varying float v_width;
|
||
|
||
czm_material czm_getMaterial(czm_materialInput materialInput)
|
||
{
|
||
czm_material material = czm_getDefaultMaterial(materialInput);
|
||
|
||
vec2 st = materialInput.st;
|
||
float halfInteriorWidth = 0.5 * (v_width - outlineWidth) / v_width;
|
||
float b = step(0.5 - halfInteriorWidth, st.t);
|
||
b *= 1.0 - step(0.5 + halfInteriorWidth, st.t);
|
||
|
||
// Find the distance from the closest separator (region between two colors)
|
||
float d1 = abs(st.t - (0.5 - halfInteriorWidth));
|
||
float d2 = abs(st.t - (0.5 + halfInteriorWidth));
|
||
float dist = min(d1, d2);
|
||
|
||
vec4 currentColor = mix(outlineColor, color, b);
|
||
vec4 outColor = czm_antialias(outlineColor, color, currentColor, dist);
|
||
outColor = czm_gammaCorrect(outColor);
|
||
|
||
material.diffuse = outColor.rgb;
|
||
material.alpha = outColor.a;
|
||
|
||
return material;
|
||
}
|
||
`,Pze=`uniform vec4 color;
|
||
uniform vec4 rimColor;
|
||
uniform float width;
|
||
|
||
czm_material czm_getMaterial(czm_materialInput materialInput)
|
||
{
|
||
czm_material material = czm_getDefaultMaterial(materialInput);
|
||
|
||
// See http://www.fundza.com/rman_shaders/surface/fake_rim/fake_rim1.html
|
||
float d = 1.0 - dot(materialInput.normalEC, normalize(materialInput.positionToEyeEC));
|
||
float s = smoothstep(1.0 - width, 1.0, d);
|
||
|
||
vec4 outColor = czm_gammaCorrect(color);
|
||
vec4 outRimColor = czm_gammaCorrect(rimColor);
|
||
|
||
material.diffuse = outColor.rgb;
|
||
material.emission = outRimColor.rgb * s;
|
||
material.alpha = mix(outColor.a, outRimColor.a, s);
|
||
|
||
return material;
|
||
}
|
||
`,Oze=`uniform sampler2D image;
|
||
|
||
czm_material czm_getMaterial(czm_materialInput materialInput)
|
||
{
|
||
czm_material material = czm_getDefaultMaterial(materialInput);
|
||
vec4 rampColor = texture2D(image, vec2(materialInput.slope / (czm_pi / 2.0), 0.5));
|
||
rampColor = czm_gammaCorrect(rampColor);
|
||
material.diffuse = rampColor.rgb;
|
||
material.alpha = rampColor.a;
|
||
return material;
|
||
}
|
||
`,Lze=`uniform vec4 evenColor;
|
||
uniform vec4 oddColor;
|
||
uniform float offset;
|
||
uniform float repeat;
|
||
uniform bool horizontal;
|
||
|
||
czm_material czm_getMaterial(czm_materialInput materialInput)
|
||
{
|
||
czm_material material = czm_getDefaultMaterial(materialInput);
|
||
|
||
// Based on the Stripes Fragment Shader in the Orange Book (11.1.2)
|
||
float coord = mix(materialInput.st.s, materialInput.st.t, float(horizontal));
|
||
float value = fract((coord - offset) * (repeat * 0.5));
|
||
float dist = min(value, min(abs(value - 0.5), 1.0 - value));
|
||
|
||
vec4 currentColor = mix(evenColor, oddColor, step(0.5, value));
|
||
vec4 color = czm_antialias(evenColor, oddColor, currentColor, dist);
|
||
color = czm_gammaCorrect(color);
|
||
|
||
material.diffuse = color.rgb;
|
||
material.alpha = color.a;
|
||
|
||
return material;
|
||
}
|
||
`,Bze=`// Thanks for the contribution Jonas
|
||
// http://29a.ch/2012/7/19/webgl-terrain-rendering-water-fog
|
||
|
||
uniform sampler2D specularMap;
|
||
uniform sampler2D normalMap;
|
||
uniform vec4 baseWaterColor;
|
||
uniform vec4 blendColor;
|
||
uniform float frequency;
|
||
uniform float animationSpeed;
|
||
uniform float amplitude;
|
||
uniform float specularIntensity;
|
||
uniform float fadeFactor;
|
||
|
||
czm_material czm_getMaterial(czm_materialInput materialInput)
|
||
{
|
||
czm_material material = czm_getDefaultMaterial(materialInput);
|
||
|
||
float time = czm_frameNumber * animationSpeed;
|
||
|
||
// fade is a function of the distance from the fragment and the frequency of the waves
|
||
float fade = max(1.0, (length(materialInput.positionToEyeEC) / 10000000000.0) * frequency * fadeFactor);
|
||
|
||
float specularMapValue = texture2D(specularMap, materialInput.st).r;
|
||
|
||
// note: not using directional motion at this time, just set the angle to 0.0;
|
||
vec4 noise = czm_getWaterNoise(normalMap, materialInput.st * frequency, time, 0.0);
|
||
vec3 normalTangentSpace = noise.xyz * vec3(1.0, 1.0, (1.0 / amplitude));
|
||
|
||
// fade out the normal perturbation as we move further from the water surface
|
||
normalTangentSpace.xy /= fade;
|
||
|
||
// attempt to fade out the normal perturbation as we approach non water areas (low specular map value)
|
||
normalTangentSpace = mix(vec3(0.0, 0.0, 50.0), normalTangentSpace, specularMapValue);
|
||
|
||
normalTangentSpace = normalize(normalTangentSpace);
|
||
|
||
// get ratios for alignment of the new normal vector with a vector perpendicular to the tangent plane
|
||
float tsPerturbationRatio = clamp(dot(normalTangentSpace, vec3(0.0, 0.0, 1.0)), 0.0, 1.0);
|
||
|
||
// fade out water effect as specular map value decreases
|
||
material.alpha = mix(blendColor.a, baseWaterColor.a, specularMapValue) * specularMapValue;
|
||
|
||
// base color is a blend of the water and non-water color based on the value from the specular map
|
||
// may need a uniform blend factor to better control this
|
||
material.diffuse = mix(blendColor.rgb, baseWaterColor.rgb, specularMapValue);
|
||
|
||
// diffuse highlights are based on how perturbed the normal is
|
||
material.diffuse += (0.1 * tsPerturbationRatio);
|
||
|
||
material.diffuse = material.diffuse;
|
||
|
||
material.normal = normalize(materialInput.tangentToEyeMatrix * normalTangentSpace);
|
||
|
||
material.specular = specularIntensity;
|
||
material.shininess = 10.0;
|
||
|
||
return material;
|
||
}
|
||
`;function $e(e){this.type=void 0,this.shaderSource=void 0,this.materials=void 0,this.uniforms=void 0,this._uniforms=void 0,this.translucent=void 0,this._minificationFilter=A(e.minificationFilter,Wn.LINEAR),this._magnificationFilter=A(e.magnificationFilter,Ps.LINEAR),this._strict=void 0,this._template=void 0,this._count=void 0,this._texturePaths={},this._loadedImages=[],this._loadedCubeMaps=[],this._textures={},this._updateFunctions=[],this._defaultTexture=void 0,Rze(e,this),Object.defineProperties(this,{type:{value:this.type,writable:!1}}),l($e._uniformList[this.type])||($e._uniformList[this.type]=Object.keys(this._uniforms))}$e._uniformList={};$e.fromType=function(e,t){if(!l($e._materialCache.getMaterial(e)))throw new w(`material with type '${e}' does not exist.`);const n=new $e({fabric:{type:e}});if(l(t))for(const i in t)t.hasOwnProperty(i)&&(n.uniforms[i]=t[i]);return n};$e.prototype.isTranslucent=function(){if(l(this.translucent))return typeof this.translucent=="function"?this.translucent():this.translucent;let e=!0;const t=this._translucentFunctions,n=t.length;for(let i=0;i<n;++i){const o=t[i];if(typeof o=="function"?e=e&&o():e=e&&o,!e)break}return e};$e.prototype.update=function(e){this._defaultTexture=e.defaultTexture;let t,n;const i=this._loadedImages;let o=i.length;for(t=0;t<o;++t){const c=i[t];n=c.id;let u=c.image,f;Array.isArray(u)&&(f=u.slice(1,u.length).map(function(y){return y.bufferView}),u=u[0]);const h=new Ci({minificationFilter:this._minificationFilter,magnificationFilter:this._magnificationFilter});let _;l(u.internalFormat)?_=new rn({context:e,pixelFormat:u.internalFormat,width:u.width,height:u.height,source:{arrayBufferView:u.bufferView,mipLevels:f},sampler:h}):_=new rn({context:e,source:u,sampler:h});const g=this._textures[n];l(g)&&g!==this._defaultTexture&&g.destroy(),this._textures[n]=_;const p=`${n}Dimensions`;if(this.uniforms.hasOwnProperty(p)){const y=this.uniforms[p];y.x=_._width,y.y=_._height}}i.length=0;const r=this._loadedCubeMaps;for(o=r.length,t=0;t<o;++t){const c=r[t];n=c.id;const u=c.images,f=new xf({context:e,source:{positiveX:u[0],negativeX:u[1],positiveY:u[2],negativeY:u[3],positiveZ:u[4],negativeZ:u[5]},sampler:new Ci({minificationFilter:this._minificationFilter,magnificationFilter:this._magnificationFilter})});this._textures[n]=f}r.length=0;const s=this._updateFunctions;for(o=s.length,t=0;t<o;++t)s[t](this,e);const a=this.materials;for(const c in a)a.hasOwnProperty(c)&&a[c].update(e)};$e.prototype.isDestroyed=function(){return!1};$e.prototype.destroy=function(){const e=this._textures;for(const n in e)if(e.hasOwnProperty(n)){const i=e[n];i!==this._defaultTexture&&i.destroy()}const t=this.materials;for(const n in t)t.hasOwnProperty(n)&&t[n].destroy();return Je(this)};function Rze(e,t){e=A(e,A.EMPTY_OBJECT),t._strict=A(e.strict,!1),t._count=A(e.count,0),t._template=St(A(e.fabric,A.EMPTY_OBJECT)),t._template.uniforms=St(A(t._template.uniforms,A.EMPTY_OBJECT)),t._template.materials=St(A(t._template.materials,A.EMPTY_OBJECT)),t.type=l(t._template.type)?t._template.type:ma(),t.shaderSource="",t.materials={},t.uniforms={},t._uniforms={},t._translucentFunctions=[];let n;const i=$e._materialCache.getMaterial(t.type);if(l(i)){const r=St(i.fabric,!0);t._template=Ln(t._template,r,!0),n=i.translucent}zze(t),l(i)||$e._materialCache.addMaterial(t.type,t),Hze(t),Wze(t),jze(t);const o=t._translucentFunctions.length===0?!0:void 0;if(n=A(n,o),n=A(e.translucent,n),l(n))if(typeof n=="function"){const r=function(){return n(t)};t._translucentFunctions.push(r)}else t._translucentFunctions.push(n)}function NB(e,t,n,i){if(l(e)){for(const o in e)if(e.hasOwnProperty(o)){const r=t.indexOf(o)!==-1;(i&&!r||!i&&r)&&n(o,t)}}}function v6(e,t){let n=`fabric: property name '${e}' is not valid. It should be `;for(let i=0;i<t.length;i++){const o=`'${t[i]}'`;n+=i===t.length-1?`or ${o}.`:`${o}, `}throw new w(n)}function Nze(e,t){const n=`fabric: uniforms and materials cannot share the same property '${e}'`;throw new w(n)}const Mze=["type","materials","uniforms","components","source"],Fze=["diffuse","specular","shininess","normal","emission","alpha"];function zze(e){const t=e._template,n=t.uniforms,i=t.materials,o=t.components;if(l(o)&&l(t.source))throw new w("fabric: cannot have source and components in the same template.");NB(t,Mze,v6,!0),NB(o,Fze,v6,!0);const r=[];for(const s in i)i.hasOwnProperty(s)&&r.push(s);NB(n,r,Nze,!1)}function Uze(e,t){const n=t._template.materials;for(const i in n)if(n.hasOwnProperty(i)&&e.indexOf(i)>-1)return!0;return!1}function Hze(e){const t=e._template.components,n=e._template.source;if(l(n))e.shaderSource+=`${n}
|
||
`;else{if(e.shaderSource+=`czm_material czm_getMaterial(czm_materialInput materialInput)
|
||
{
|
||
`,e.shaderSource+=`czm_material material = czm_getDefaultMaterial(materialInput);
|
||
`,l(t)){const i=Object.keys(e._template.materials).length>0;for(const o in t)if(t.hasOwnProperty(o))if(o==="diffuse"||o==="emission"){const s=i&&Uze(t[o],e)?t[o]:`czm_gammaCorrect(${t[o]})`;e.shaderSource+=`material.${o} = ${s};
|
||
`}else o==="alpha"?e.shaderSource+=`material.alpha = ${t.alpha};
|
||
`:e.shaderSource+=`material.${o} = ${t[o]};
|
||
`}e.shaderSource+=`return material;
|
||
}
|
||
`}}const D6={mat2:Et,mat3:te,mat4:N},Vze=/\.ktx2$/i;function kze(e){let t;return function(n,i){const o=n.uniforms,r=o[e],s=t!==r,a=!l(r)||r===$e.DefaultImageId;t=r;let c=n._textures[e],u,f;if(r instanceof HTMLVideoElement){if(r.readyState>=2){if(s&&l(c)&&(c!==i.defaultTexture&&c.destroy(),c=void 0),!l(c)||c===i.defaultTexture){const _=new Ci({minificationFilter:n._minificationFilter,magnificationFilter:n._magnificationFilter});c=new rn({context:i,source:r,sampler:_}),n._textures[e]=c;return}c.copyFrom({source:r})}else l(c)||(n._textures[e]=i.defaultTexture);return}if(r instanceof rn&&r!==c){n._texturePaths[e]=void 0;const _=n._textures[e];l(_)&&_!==n._defaultTexture&&_.destroy(),n._textures[e]=r,u=`${e}Dimensions`,o.hasOwnProperty(u)&&(f=o[u],f.x=r._width,f.y=r._height);return}if(s&&l(c)&&a&&(c!==n._defaultTexture&&c.destroy(),c=void 0),l(c)||(n._texturePaths[e]=void 0,c=n._textures[e]=n._defaultTexture,u=`${e}Dimensions`,o.hasOwnProperty(u)&&(f=o[u],f.x=c._width,f.y=c._height)),a)return;const h=r instanceof je;if(!l(n._texturePaths[e])||h&&r.url!==n._texturePaths[e].url||!h&&r!==n._texturePaths[e]){if(typeof r=="string"||h){const _=h?r:je.createIfNeeded(r);let g;Vze.test(_.url)?g=Sy(_.url):g=_.fetchImage(),Promise.resolve(g).then(function(p){n._loadedImages.push({id:e,image:p})}).catch(function(){l(c)&&c!==n._defaultTexture&&c.destroy(),n._textures[e]=n._defaultTexture})}else(r instanceof HTMLCanvasElement||r instanceof HTMLImageElement)&&n._loadedImages.push({id:e,image:r});n._texturePaths[e]=r}}}function Gze(e){return function(t,n){const i=t.uniforms[e];if(i instanceof xf){const r=t._textures[e];r!==t._defaultTexture&&r.destroy(),t._texturePaths[e]=void 0,t._textures[e]=i;return}if(l(t._textures[e])||(t._texturePaths[e]=void 0,t._textures[e]=n.defaultCubeMap),i===$e.DefaultCubeMapId)return;const o=i.positiveX+i.negativeX+i.positiveY+i.negativeY+i.positiveZ+i.negativeZ;if(o!==t._texturePaths[e]){const r=[je.createIfNeeded(i.positiveX).fetchImage(),je.createIfNeeded(i.negativeX).fetchImage(),je.createIfNeeded(i.positiveY).fetchImage(),je.createIfNeeded(i.negativeY).fetchImage(),je.createIfNeeded(i.positiveZ).fetchImage(),je.createIfNeeded(i.negativeZ).fetchImage()];Promise.all(r).then(function(s){t._loadedCubeMaps.push({id:e,images:s})}),t._texturePaths[e]=o}}}function Wze(e){const t=e._template.uniforms;for(const n in t)t.hasOwnProperty(n)&&UQ(e,n)}function UQ(e,t){const n=e._strict,i=e._template.uniforms,o=i[t],r=qze(o);if(!l(r))throw new w(`fabric: uniform '${t}' has invalid type.`);let s;if(r==="channels"){if(s=SE(e,t,o,!1),s===0&&n)throw new w(`strict: shader source does not use channels '${t}'.`)}else{if(r==="sampler2D"){const u=`${t}Dimensions`;Yze(e,u)>0&&(i[u]={type:"ivec3",x:1,y:1},UQ(e,u))}if(!new RegExp(`uniform\\s+${r}\\s+${t}\\s*;`).test(e.shaderSource)){const u=`uniform ${r} ${t};`;e.shaderSource=u+e.shaderSource}const c=`${t}_${e._count++}`;if(s=SE(e,t,c),s===1&&n)throw new w(`strict: shader source does not use uniform '${t}'.`);if(e.uniforms[t]=o,r==="sampler2D")e._uniforms[c]=function(){return e._textures[t]},e._updateFunctions.push(kze(t));else if(r==="samplerCube")e._uniforms[c]=function(){return e._textures[t]},e._updateFunctions.push(Gze(t));else if(r.indexOf("mat")!==-1){const u=new D6[r];e._uniforms[c]=function(){return D6[r].fromColumnMajorArray(e.uniforms[t],u)}}else e._uniforms[c]=function(){return e.uniforms[t]}}}function qze(e){let t=e.type;if(!l(t)){const n=typeof e;if(n==="number")t="float";else if(n==="boolean")t="bool";else if(n==="string"||e instanceof je||e instanceof HTMLCanvasElement||e instanceof HTMLImageElement)/^([rgba]){1,4}$/i.test(e)?t="channels":e===$e.DefaultCubeMapId?t="samplerCube":t="sampler2D";else if(n==="object")if(Array.isArray(e))(e.length===4||e.length===9||e.length===16)&&(t=`mat${Math.sqrt(e.length)}`);else{let i=0;for(const o in e)e.hasOwnProperty(o)&&(i+=1);i>=2&&i<=4?t=`vec${i}`:i===6&&(t="samplerCube")}}return t}function jze(e){const t=e._strict,n=e._template.materials;for(const i in n)if(n.hasOwnProperty(i)){const o=new $e({strict:t,fabric:n[i],count:e._count});e._count=o._count,e._uniforms=Ln(e._uniforms,o._uniforms,!0),e.materials[i]=o,e._translucentFunctions=e._translucentFunctions.concat(o._translucentFunctions);const r="czm_getMaterial",s=`${r}_${e._count++}`;SE(o,r,s),e.shaderSource=o.shaderSource+e.shaderSource;const a=`${s}(materialInput)`;if(SE(e,i,a)===0&&t)throw new w(`strict: shader source does not use material '${i}'.`)}}function SE(e,t,n,i){i=A(i,!0);let o=0;const r="([\\w])?",s=`([\\w${i?".":""}])?`,a=new RegExp(s+t+r,"g");return e.shaderSource=e.shaderSource.replace(a,function(c,u,f){return u||f?c:(o+=1,n)}),o}function Yze(e,t,n){return SE(e,t,t,n)}$e._materialCache={_materials:{},addMaterial:function(e,t){this._materials[e]=t},getMaterial:function(e){return this._materials[e]}};$e.DefaultImageId="czm_defaultImage";$e.DefaultCubeMapId="czm_defaultCubeMap";$e.ColorType="Color";$e._materialCache.addMaterial($e.ColorType,{fabric:{type:$e.ColorType,uniforms:{color:new k(1,0,0,.5)},components:{diffuse:"color.rgb",alpha:"color.a"}},translucent:function(e){return e.uniforms.color.alpha<1}});$e.ImageType="Image";$e._materialCache.addMaterial($e.ImageType,{fabric:{type:$e.ImageType,uniforms:{image:$e.DefaultImageId,repeat:new $(1,1),color:new k(1,1,1,1)},components:{diffuse:"texture2D(image, fract(repeat * materialInput.st)).rgb * color.rgb",alpha:"texture2D(image, fract(repeat * materialInput.st)).a * color.a"}},translucent:function(e){return e.uniforms.color.alpha<1}});$e.DiffuseMapType="DiffuseMap";$e._materialCache.addMaterial($e.DiffuseMapType,{fabric:{type:$e.DiffuseMapType,uniforms:{image:$e.DefaultImageId,channels:"rgb",repeat:new $(1,1)},components:{diffuse:"texture2D(image, fract(repeat * materialInput.st)).channels"}},translucent:!1});$e.AlphaMapType="AlphaMap";$e._materialCache.addMaterial($e.AlphaMapType,{fabric:{type:$e.AlphaMapType,uniforms:{image:$e.DefaultImageId,channel:"a",repeat:new $(1,1)},components:{alpha:"texture2D(image, fract(repeat * materialInput.st)).channel"}},translucent:!0});$e.SpecularMapType="SpecularMap";$e._materialCache.addMaterial($e.SpecularMapType,{fabric:{type:$e.SpecularMapType,uniforms:{image:$e.DefaultImageId,channel:"r",repeat:new $(1,1)},components:{specular:"texture2D(image, fract(repeat * materialInput.st)).channel"}},translucent:!1});$e.EmissionMapType="EmissionMap";$e._materialCache.addMaterial($e.EmissionMapType,{fabric:{type:$e.EmissionMapType,uniforms:{image:$e.DefaultImageId,channels:"rgb",repeat:new $(1,1)},components:{emission:"texture2D(image, fract(repeat * materialInput.st)).channels"}},translucent:!1});$e.BumpMapType="BumpMap";$e._materialCache.addMaterial($e.BumpMapType,{fabric:{type:$e.BumpMapType,uniforms:{image:$e.DefaultImageId,channel:"r",strength:.8,repeat:new $(1,1)},source:gze},translucent:!1});$e.NormalMapType="NormalMap";$e._materialCache.addMaterial($e.NormalMapType,{fabric:{type:$e.NormalMapType,uniforms:{image:$e.DefaultImageId,channels:"rgb",strength:.8,repeat:new $(1,1)},source:wze},translucent:!1});$e.GridType="Grid";$e._materialCache.addMaterial($e.GridType,{fabric:{type:$e.GridType,uniforms:{color:new k(0,1,0,1),cellAlpha:.1,lineCount:new $(8,8),lineThickness:new $(1,1),lineOffset:new $(0,0)},source:xze},translucent:function(e){const t=e.uniforms;return t.color.alpha<1||t.cellAlpha<1}});$e.StripeType="Stripe";$e._materialCache.addMaterial($e.StripeType,{fabric:{type:$e.StripeType,uniforms:{horizontal:!0,evenColor:new k(1,1,1,.5),oddColor:new k(0,0,1,.5),offset:0,repeat:5},source:Lze},translucent:function(e){const t=e.uniforms;return t.evenColor.alpha<1||t.oddColor.alpha<1}});$e.CheckerboardType="Checkerboard";$e._materialCache.addMaterial($e.CheckerboardType,{fabric:{type:$e.CheckerboardType,uniforms:{lightColor:new k(1,1,1,.5),darkColor:new k(0,0,0,.5),repeat:new $(5,5)},source:yze},translucent:function(e){const t=e.uniforms;return t.lightColor.alpha<1||t.darkColor.alpha<1}});$e.DotType="Dot";$e._materialCache.addMaterial($e.DotType,{fabric:{type:$e.DotType,uniforms:{lightColor:new k(1,1,0,.75),darkColor:new k(0,1,1,.75),repeat:new $(5,5)},source:Aze},translucent:function(e){const t=e.uniforms;return t.lightColor.alpha<1||t.darkColor.alpha<1}});$e.WaterType="Water";$e._materialCache.addMaterial($e.WaterType,{fabric:{type:$e.WaterType,uniforms:{baseWaterColor:new k(.2,.3,.6,1),blendColor:new k(0,1,.699,1),specularMap:$e.DefaultImageId,normalMap:$e.DefaultImageId,frequency:10,animationSpeed:.01,amplitude:1,specularIntensity:.5,fadeFactor:1},source:Bze},translucent:function(e){const t=e.uniforms;return t.baseWaterColor.alpha<1||t.blendColor.alpha<1}});$e.RimLightingType="RimLighting";$e._materialCache.addMaterial($e.RimLightingType,{fabric:{type:$e.RimLightingType,uniforms:{color:new k(1,0,0,.7),rimColor:new k(1,1,1,.4),width:.3},source:Pze},translucent:function(e){const t=e.uniforms;return t.color.alpha<1||t.rimColor.alpha<1}});$e.FadeType="Fade";$e._materialCache.addMaterial($e.FadeType,{fabric:{type:$e.FadeType,uniforms:{fadeInColor:new k(1,0,0,1),fadeOutColor:new k(0,0,0,0),maximumDistance:.5,repeat:!0,fadeDirection:{x:!0,y:!0},time:new $(.5,.5)},source:Eze},translucent:function(e){const t=e.uniforms;return t.fadeInColor.alpha<1||t.fadeOutColor.alpha<1}});$e.PolylineArrowType="PolylineArrow";$e._materialCache.addMaterial($e.PolylineArrowType,{fabric:{type:$e.PolylineArrowType,uniforms:{color:new k(1,1,1,1)},source:Sze},translucent:!0});$e.PolylineDashType="PolylineDash";$e._materialCache.addMaterial($e.PolylineDashType,{fabric:{type:$e.PolylineDashType,uniforms:{color:new k(1,0,1,1),gapColor:new k(0,0,0,0),dashLength:16,dashPattern:255},source:vze},translucent:!0});$e.PolylineGlowType="PolylineGlow";$e._materialCache.addMaterial($e.PolylineGlowType,{fabric:{type:$e.PolylineGlowType,uniforms:{color:new k(0,.5,1,1),glowPower:.25,taperPower:1},source:Dze},translucent:!0});$e.PolylineOutlineType="PolylineOutline";$e._materialCache.addMaterial($e.PolylineOutlineType,{fabric:{type:$e.PolylineOutlineType,uniforms:{color:new k(1,1,1,1),outlineColor:new k(1,0,0,1),outlineWidth:1},source:Ize},translucent:function(e){const t=e.uniforms;return t.color.alpha<1||t.outlineColor.alpha<1}});$e.ElevationContourType="ElevationContour";$e._materialCache.addMaterial($e.ElevationContourType,{fabric:{type:$e.ElevationContourType,uniforms:{spacing:100,color:new k(1,0,0,1),width:1},source:Cze},translucent:!1});$e.ElevationRampType="ElevationRamp";$e._materialCache.addMaterial($e.ElevationRampType,{fabric:{type:$e.ElevationRampType,uniforms:{image:$e.DefaultImageId,minimumHeight:0,maximumHeight:1e4},source:bze},translucent:!1});$e.SlopeRampMaterialType="SlopeRamp";$e._materialCache.addMaterial($e.SlopeRampMaterialType,{fabric:{type:$e.SlopeRampMaterialType,uniforms:{image:$e.DefaultImageId},source:Oze},translucent:!1});$e.AspectRampMaterialType="AspectRamp";$e._materialCache.addMaterial($e.AspectRampMaterialType,{fabric:{type:$e.AspectRampMaterialType,uniforms:{image:$e.DefaultImageId},source:_ze},translucent:!1});$e.ElevationBandType="ElevationBand";$e._materialCache.addMaterial($e.ElevationBandType,{fabric:{type:$e.ElevationBandType,uniforms:{heights:$e.DefaultImageId,colors:$e.DefaultImageId},source:Tze},translucent:!0});const yF={position:0};function oP(e){e=A(e,A.EMPTY_OBJECT),this.center=d.clone(A(e.center,d.ZERO)),this._center=new d,this.radii=d.clone(e.radii),this._radii=new d,this._oneOverEllipsoidRadiiSquared=new d,this._boundingSphere=new Ae,this.modelMatrix=N.clone(A(e.modelMatrix,N.IDENTITY)),this._modelMatrix=new N,this._computedModelMatrix=new N,this.show=A(e.show,!0),this.material=A(e.material,$e.fromType($e.ColorType)),this._material=void 0,this._translucent=void 0,this.id=e.id,this._id=void 0,this.debugShowBoundingVolume=A(e.debugShowBoundingVolume,!1),this.onlySunLighting=A(e.onlySunLighting,!1),this._onlySunLighting=!1,this._depthTestEnabled=A(e.depthTestEnabled,!0),this._useLogDepth=!1,this._sp=void 0,this._rs=void 0,this._va=void 0,this._pickSP=void 0,this._pickId=void 0,this._colorCommand=new Dt({owner:A(e._owner,this)}),this._pickCommand=new Dt({owner:A(e._owner,this),pickOnly:!0});const t=this;this._uniforms={u_radii:function(){return t.radii},u_oneOverEllipsoidRadiiSquared:function(){return t._oneOverEllipsoidRadiiSquared}},this._pickUniforms={czm_pickColor:function(){return t._pickId.color}}}function $ze(e){let t=e.cache.ellipsoidPrimitive_vertexArray;if(l(t))return t;const n=Ss.createGeometry(Ss.fromDimensions({dimensions:new d(2,2,2),vertexFormat:Ye.POSITION_ONLY}));return t=Fo.fromGeometry({context:e,geometry:n,attributeLocations:yF,bufferUsage:mt.STATIC_DRAW,interleave:!0}),e.cache.ellipsoidPrimitive_vertexArray=t,t}const I6=`#ifdef GL_EXT_frag_depth
|
||
#extension GL_EXT_frag_depth : enable
|
||
#endif
|
||
|
||
`;oP.prototype.update=function(e){if(!this.show||e.mode!==me.SCENE3D||!l(this.center)||!l(this.radii))return;if(!l(this.material))throw new w("this.material must be defined.");const t=e.context,n=this.material.isTranslucent(),i=this._translucent!==n;(!l(this._rs)||i)&&(this._translucent=n,this._rs=ht.fromCache({cull:{enabled:!0,face:mr.FRONT},depthTest:{enabled:this._depthTestEnabled},depthMask:!n&&t.fragmentDepth,blending:n?fo.ALPHA_BLEND:void 0})),l(this._va)||(this._va=$ze(t));let o=!1;const r=this.radii;if(!d.equals(this._radii,r)){d.clone(r,this._radii);const y=this._oneOverEllipsoidRadiiSquared;y.x=1/(r.x*r.x),y.y=1/(r.y*r.y),y.z=1/(r.z*r.z),o=!0}(!N.equals(this.modelMatrix,this._modelMatrix)||!d.equals(this.center,this._center))&&(N.clone(this.modelMatrix,this._modelMatrix),d.clone(this.center,this._center),N.multiplyByTranslation(this.modelMatrix,this.center,this._computedModelMatrix),o=!0),o&&(d.clone(d.ZERO,this._boundingSphere.center),this._boundingSphere.radius=d.maximumComponent(r),Ae.transform(this._boundingSphere,this._computedModelMatrix,this._boundingSphere));const s=this._material!==this.material;this._material=this.material,this._material.update(t);const a=this.onlySunLighting!==this._onlySunLighting;this._onlySunLighting=this.onlySunLighting;const c=e.useLogDepth,u=this._useLogDepth!==c;this._useLogDepth=c;const f=this._colorCommand;let h,_;(s||a||i||u)&&(h=new nt({sources:[B5]}),_=new nt({sources:[this.material.shaderSource,L5]}),this.onlySunLighting&&_.defines.push("ONLY_SUN_LIGHTING"),!n&&t.fragmentDepth&&_.defines.push("WRITE_DEPTH"),this._useLogDepth&&(h.defines.push("LOG_DEPTH"),_.defines.push("LOG_DEPTH"),_.sources.push(I6)),this._sp=Hn.replaceCache({context:t,shaderProgram:this._sp,vertexShaderSource:h,fragmentShaderSource:_,attributeLocations:yF}),f.vertexArray=this._va,f.renderState=this._rs,f.shaderProgram=this._sp,f.uniformMap=Ln(this._uniforms,this.material._uniforms),f.executeInClosestFrustum=n);const g=e.commandList,p=e.passes;if(p.render&&(f.boundingVolume=this._boundingSphere,f.debugShowBoundingVolume=this.debugShowBoundingVolume,f.modelMatrix=this._computedModelMatrix,f.pass=n?We.TRANSLUCENT:We.OPAQUE,g.push(f)),p.pick){const y=this._pickCommand;(!l(this._pickId)||this._id!==this.id)&&(this._id=this.id,this._pickId=this._pickId&&this._pickId.destroy(),this._pickId=t.createPickId({primitive:this,id:this.id})),(s||a||!l(this._pickSP)||u)&&(h=new nt({sources:[B5]}),_=new nt({sources:[this.material.shaderSource,L5],pickColorQualifier:"uniform"}),this.onlySunLighting&&_.defines.push("ONLY_SUN_LIGHTING"),!n&&t.fragmentDepth&&_.defines.push("WRITE_DEPTH"),this._useLogDepth&&(h.defines.push("LOG_DEPTH"),_.defines.push("LOG_DEPTH"),_.sources.push(I6)),this._pickSP=Hn.replaceCache({context:t,shaderProgram:this._pickSP,vertexShaderSource:h,fragmentShaderSource:_,attributeLocations:yF}),y.vertexArray=this._va,y.renderState=this._rs,y.shaderProgram=this._pickSP,y.uniformMap=Ln(Ln(this._uniforms,this._pickUniforms),this.material._uniforms),y.executeInClosestFrustum=n),y.boundingVolume=this._boundingSphere,y.modelMatrix=this._computedModelMatrix,y.pass=n?We.TRANSLUCENT:We.OPAQUE,g.push(y)}};oP.prototype.isDestroyed=function(){return!1};oP.prototype.destroy=function(){return this._sp=this._sp&&this._sp.destroy(),this._pickSP=this._pickSP&&this._pickSP.destroy(),this._pickId=this._pickId&&this._pickId.destroy(),Je(this)};function Tx(e){e=A(e,A.EMPTY_OBJECT);let t=e.textureUrl;l(t)||(t=Un("Assets/Textures/moonSmall.jpg")),this.show=A(e.show,!0),this.textureUrl=t,this._ellipsoid=A(e.ellipsoid,be.MOON),this.onlySunLighting=A(e.onlySunLighting,!0),this._ellipsoidPrimitive=new oP({radii:this.ellipsoid.radii,material:$e.fromType($e.ImageType),depthTestEnabled:!1,_owner:this}),this._ellipsoidPrimitive.material.translucent=!1,this._axes=new NQ}Object.defineProperties(Tx.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}});const iv=new te,Xze=new te,Kze=new d,ov=[];Tx.prototype.update=function(e){if(!this.show)return;const t=this._ellipsoidPrimitive;t.material.uniforms.image=this.textureUrl,t.onlySunLighting=this.onlySunLighting;const n=e.time;l(En.computeIcrfToFixedMatrix(n,iv))||En.computeTemeToPseudoFixedMatrix(n,iv);const i=this._axes.evaluate(n,Xze);te.transpose(i,i),te.multiply(iv,i,i);const o=jM.computeMoonPositionInEarthInertialFrame(n,Kze);te.multiplyByVector(iv,o,o),N.fromRotationTranslation(i,o,t.modelMatrix);const r=e.commandList;return e.commandList=ov,ov.length=0,t.update(e),e.commandList=r,ov.length===1?ov[0]:void 0};Tx.prototype.isDestroyed=function(){return!1};Tx.prototype.destroy=function(){return this._ellipsoidPrimitive=this._ellipsoidPrimitive&&this._ellipsoidPrimitive.destroy(),Je(this)};const Jze=new d,Qze=new d,Zze=new d,eUe=new d,tUe=new d,nUe=new d(1,1,1),P6=Math.cos,O6=Math.sin;function sl(e){e=A(e,A.EMPTY_OBJECT);const t=A(e.radii,nUe),n=A(e.innerRadii,t),i=A(e.minimumClock,0),o=A(e.maximumClock,F.TWO_PI),r=A(e.minimumCone,0),s=A(e.maximumCone,F.PI),a=Math.round(A(e.stackPartitions,64)),c=Math.round(A(e.slicePartitions,64)),u=A(e.vertexFormat,Ye.DEFAULT);if(c<3)throw new w("options.slicePartitions cannot be less than three.");if(a<3)throw new w("options.stackPartitions cannot be less than three.");this._radii=d.clone(t),this._innerRadii=d.clone(n),this._minimumClock=i,this._maximumClock=o,this._minimumCone=r,this._maximumCone=s,this._stackPartitions=a,this._slicePartitions=c,this._vertexFormat=Ye.clone(u),this._offsetAttribute=e.offsetAttribute,this._workerName="createEllipsoidGeometry"}sl.packedLength=2*d.packedLength+Ye.packedLength+7;sl.pack=function(e,t,n){if(!l(e))throw new w("value is required");if(!l(t))throw new w("array is required");return n=A(n,0),d.pack(e._radii,t,n),n+=d.packedLength,d.pack(e._innerRadii,t,n),n+=d.packedLength,Ye.pack(e._vertexFormat,t,n),n+=Ye.packedLength,t[n++]=e._minimumClock,t[n++]=e._maximumClock,t[n++]=e._minimumCone,t[n++]=e._maximumCone,t[n++]=e._stackPartitions,t[n++]=e._slicePartitions,t[n]=A(e._offsetAttribute,-1),t};const HQ=new d,VQ=new d,kQ=new Ye,Kp={radii:HQ,innerRadii:VQ,vertexFormat:kQ,minimumClock:void 0,maximumClock:void 0,minimumCone:void 0,maximumCone:void 0,stackPartitions:void 0,slicePartitions:void 0,offsetAttribute:void 0};sl.unpack=function(e,t,n){if(!l(e))throw new w("array is required");t=A(t,0);const i=d.unpack(e,t,HQ);t+=d.packedLength;const o=d.unpack(e,t,VQ);t+=d.packedLength;const r=Ye.unpack(e,t,kQ);t+=Ye.packedLength;const s=e[t++],a=e[t++],c=e[t++],u=e[t++],f=e[t++],h=e[t++],_=e[t];return l(n)?(n._radii=d.clone(i,n._radii),n._innerRadii=d.clone(o,n._innerRadii),n._vertexFormat=Ye.clone(r,n._vertexFormat),n._minimumClock=s,n._maximumClock=a,n._minimumCone=c,n._maximumCone=u,n._stackPartitions=f,n._slicePartitions=h,n._offsetAttribute=_===-1?void 0:_,n):(Kp.minimumClock=s,Kp.maximumClock=a,Kp.minimumCone=c,Kp.maximumCone=u,Kp.stackPartitions=f,Kp.slicePartitions=h,Kp.offsetAttribute=_===-1?void 0:_,new sl(Kp))};sl.createGeometry=function(e){const t=e._radii;if(t.x<=0||t.y<=0||t.z<=0)return;const n=e._innerRadii;if(n.x<=0||n.y<=0||n.z<=0)return;const i=e._minimumClock,o=e._maximumClock,r=e._minimumCone,s=e._maximumCone,a=e._vertexFormat;let c=e._slicePartitions+1,u=e._stackPartitions+1;c=Math.round(c*Math.abs(o-i)/F.TWO_PI),u=Math.round(u*Math.abs(s-r)/F.PI),c<2&&(c=2),u<2&&(u=2);let f,h,_=0;const g=[r],p=[i];for(f=0;f<u;f++)g.push(r+f*(s-r)/(u-1));for(g.push(s),h=0;h<c;h++)p.push(i+h*(o-i)/(c-1));p.push(o);const y=g.length,T=p.length;let b=0,x=1;const v=n.x!==t.x||n.y!==t.y||n.z!==t.z;let D=!1,L=!1,B=!1;v&&(x=2,r>0&&(D=!0,b+=c-1),s<Math.PI&&(L=!0,b+=c-1),(o-i)%F.TWO_PI?(B=!0,b+=(u-1)*2+1):b+=1);const V=T*y*x,M=new Float64Array(V*3),H=new Array(V).fill(!1),G=new Array(V).fill(!1),I=c*u*x,O=6*(I+b+1-(c+u)*x),m=At.createTypedArray(I,O),P=a.normal?new Float32Array(V*3):void 0,R=a.tangent?new Float32Array(V*3):void 0,U=a.bitangent?new Float32Array(V*3):void 0,W=a.st?new Float32Array(V*2):void 0,q=new Array(y),Y=new Array(y);for(f=0;f<y;f++)q[f]=O6(g[f]),Y[f]=P6(g[f]);const j=new Array(T),ee=new Array(T);for(h=0;h<T;h++)ee[h]=P6(p[h]),j[h]=O6(p[h]);for(f=0;f<y;f++)for(h=0;h<T;h++)M[_++]=t.x*q[f]*ee[h],M[_++]=t.y*q[f]*j[h],M[_++]=t.z*Y[f];let K=V/2;if(v)for(f=0;f<y;f++)for(h=0;h<T;h++)M[_++]=n.x*q[f]*ee[h],M[_++]=n.y*q[f]*j[h],M[_++]=n.z*Y[f],H[K]=!0,f>0&&f!==y-1&&h!==0&&h!==T-1&&(G[K]=!0),K++;_=0;let se,Q;for(f=1;f<y-2;f++)for(se=f*T,Q=(f+1)*T,h=1;h<T-2;h++)m[_++]=Q+h,m[_++]=Q+h+1,m[_++]=se+h+1,m[_++]=Q+h,m[_++]=se+h+1,m[_++]=se+h;if(v){const Be=y*T;for(f=1;f<y-2;f++)for(se=Be+f*T,Q=Be+(f+1)*T,h=1;h<T-2;h++)m[_++]=Q+h,m[_++]=se+h,m[_++]=se+h+1,m[_++]=Q+h,m[_++]=se+h+1,m[_++]=Q+h+1}let Z,J;if(v){if(D)for(J=y*T,f=1;f<T-2;f++)m[_++]=f,m[_++]=f+1,m[_++]=J+f+1,m[_++]=f,m[_++]=J+f+1,m[_++]=J+f;if(L)for(Z=y*T-T,J=y*T*x-T,f=1;f<T-2;f++)m[_++]=Z+f+1,m[_++]=Z+f,m[_++]=J+f,m[_++]=Z+f+1,m[_++]=J+f,m[_++]=J+f+1}if(B){for(f=1;f<y-2;f++)J=T*y+T*f,Z=T*f,m[_++]=J,m[_++]=Z+T,m[_++]=Z,m[_++]=J,m[_++]=J+T,m[_++]=Z+T;for(f=1;f<y-2;f++)J=T*y+T*(f+1)-1,Z=T*(f+1)-1,m[_++]=Z+T,m[_++]=J,m[_++]=Z,m[_++]=Z+T,m[_++]=J+T,m[_++]=J}const de=new To;a.position&&(de.position=new Xe({componentDatatype:oe.DOUBLE,componentsPerAttribute:3,values:M}));let _e=0,le=0,Te=0,pe=0;const ne=V/2;let ae;const ye=be.fromCartesian3(t),Ce=be.fromCartesian3(n);if(a.st||a.normal||a.tangent||a.bitangent){for(f=0;f<V;f++){ae=H[f]?Ce:ye;const Be=d.fromArray(M,f*3,Jze),Le=ae.geodeticSurfaceNormal(Be,Qze);if(G[f]&&d.negate(Le,Le),a.st){const Ve=$.negate(Le,tUe);W[_e++]=Math.atan2(Ve.y,Ve.x)/F.TWO_PI+.5,W[_e++]=Math.asin(Le.z)/Math.PI+.5}if(a.normal&&(P[le++]=Le.x,P[le++]=Le.y,P[le++]=Le.z),a.tangent||a.bitangent){const Ve=Zze;let Ie=0,He;if(H[f]&&(Ie=ne),!D&&f>=Ie&&f<Ie+T*2?He=d.UNIT_X:He=d.UNIT_Z,d.cross(He,Le,Ve),d.normalize(Ve,Ve),a.tangent&&(R[Te++]=Ve.x,R[Te++]=Ve.y,R[Te++]=Ve.z),a.bitangent){const Me=d.cross(Le,Ve,eUe);d.normalize(Me,Me),U[pe++]=Me.x,U[pe++]=Me.y,U[pe++]=Me.z}}}a.st&&(de.st=new Xe({componentDatatype:oe.FLOAT,componentsPerAttribute:2,values:W})),a.normal&&(de.normal=new Xe({componentDatatype:oe.FLOAT,componentsPerAttribute:3,values:P})),a.tangent&&(de.tangent=new Xe({componentDatatype:oe.FLOAT,componentsPerAttribute:3,values:R})),a.bitangent&&(de.bitangent=new Xe({componentDatatype:oe.FLOAT,componentsPerAttribute:3,values:U}))}if(l(e._offsetAttribute)){const Be=M.length,Le=e._offsetAttribute===Fn.NONE?0:1,Ve=new Uint8Array(Be/3).fill(Le);de.applyOffset=new Xe({componentDatatype:oe.UNSIGNED_BYTE,componentsPerAttribute:1,values:Ve})}return new $t({attributes:de,indices:m,primitiveType:dt.TRIANGLES,boundingSphere:Ae.fromEllipsoid(ye),offsetAttribute:e._offsetAttribute})};let MB;sl.getUnitEllipsoid=function(){return l(MB)||(MB=sl.createGeometry(new sl({radii:new d(1,1,1),vertexFormat:Ye.POSITION_ONLY}))),MB};const AF=[],TF=[];function iUe(e,t,n,i,o,r){const s=o-i+1,a=r-o,c=AF,u=TF;let f,h;for(f=0;f<s;++f)c[f]=e[i+f];for(h=0;h<a;++h)u[h]=e[o+h+1];f=0,h=0;for(let _=i;_<=r;++_){const g=c[f],p=u[h];f<s&&(h>=a||t(g,p,n)<=0)?(e[_]=g,++f):h<a&&(e[_]=p,++h)}}function CF(e,t,n,i,o){if(i>=o)return;const r=Math.floor((i+o)*.5);CF(e,t,n,i,r),CF(e,t,n,r+1,o),iUe(e,t,n,i,r,o)}function xz(e,t,n){if(!l(e))throw new w("array is required.");if(!l(t))throw new w("comparator is required.");const i=e.length,o=Math.ceil(i*.5);AF.length=o,TF.length=o,CF(e,t,n,0,i-1),AF.length=0,TF.length=0}function Ha(e,t){if(!l(e))throw new w("occluderBoundingSphere is required.");if(!l(t))throw new w("camera position is required.");this._occluderPosition=d.clone(e.center),this._occluderRadius=e.radius,this._horizonDistance=0,this._horizonPlaneNormal=void 0,this._horizonPlanePosition=void 0,this._cameraPosition=void 0,this.cameraPosition=t}const rv=new d;Object.defineProperties(Ha.prototype,{position:{get:function(){return this._occluderPosition}},radius:{get:function(){return this._occluderRadius}},cameraPosition:{set:function(e){if(!l(e))throw new w("cameraPosition is required.");e=d.clone(e,this._cameraPosition);const t=d.subtract(this._occluderPosition,e,rv);let n=d.magnitudeSquared(t);const i=this._occluderRadius*this._occluderRadius;let o,r,s;if(n>i){o=Math.sqrt(n-i),n=1/Math.sqrt(n),r=d.multiplyByScalar(t,n,rv);const a=o*o*n;s=d.add(e,d.multiplyByScalar(r,a,rv),rv)}else o=Number.MAX_VALUE;this._horizonDistance=o,this._horizonPlaneNormal=r,this._horizonPlanePosition=s,this._cameraPosition=e}}});Ha.fromBoundingSphere=function(e,t,n){if(!l(e))throw new w("occluderBoundingSphere is required.");if(!l(t))throw new w("camera position is required.");return l(n)?(d.clone(e.center,n._occluderPosition),n._occluderRadius=e.radius,n.cameraPosition=t,n):new Ha(e,t)};const GQ=new d;Ha.prototype.isPointVisible=function(e){if(this._horizonDistance!==Number.MAX_VALUE){let t=d.subtract(e,this._occluderPosition,GQ),n=this._occluderRadius;if(n=d.magnitudeSquared(t)-n*n,n>0)return n=Math.sqrt(n)+this._horizonDistance,t=d.subtract(e,this._cameraPosition,t),n*n>d.magnitudeSquared(t)}return!1};const oUe=new d;Ha.prototype.isBoundingSphereVisible=function(e){const t=d.clone(e.center,oUe),n=e.radius;if(this._horizonDistance!==Number.MAX_VALUE){let i=d.subtract(t,this._occluderPosition,GQ),o=this._occluderRadius-n;if(o=d.magnitudeSquared(i)-o*o,n<this._occluderRadius)return o>0?(o=Math.sqrt(o)+this._horizonDistance,i=d.subtract(t,this._cameraPosition,i),o*o+n*n>d.magnitudeSquared(i)):!1;if(o>0){i=d.subtract(t,this._cameraPosition,i);const r=d.magnitudeSquared(i),s=this._occluderRadius*this._occluderRadius,a=n*n;return(this._horizonDistance*this._horizonDistance+s)*a>r*s?!0:(o=Math.sqrt(o)+this._horizonDistance,o*o+a>r)}return!0}return!1};const rUe=new d;Ha.prototype.computeVisibility=function(e){if(!l(e))throw new w("occludeeBS is required.");const t=d.clone(e.center),n=e.radius;if(n>this._occluderRadius)return Es.FULL;if(this._horizonDistance!==Number.MAX_VALUE){let i=d.subtract(t,this._occluderPosition,rUe),o=this._occluderRadius-n;const r=d.magnitudeSquared(i);if(o=r-o*o,o>0){o=Math.sqrt(o)+this._horizonDistance,i=d.subtract(t,this._cameraPosition,i);const s=d.magnitudeSquared(i);return o*o+n*n<s?Es.NONE:(o=this._occluderRadius+n,o=r-o*o,o>0?(o=Math.sqrt(o)+this._horizonDistance,s<o*o+n*n?Es.FULL:Es.PARTIAL):(i=d.subtract(t,this._horizonPlanePosition,i),d.dot(i,this._horizonPlaneNormal)>-n?Es.PARTIAL:Es.FULL))}}return Es.NONE};const sv=new d;Ha.computeOccludeePoint=function(e,t,n){if(!l(e))throw new w("occluderBoundingSphere is required.");if(!l(n))throw new w("positions is required.");if(n.length===0)throw new w("positions must contain at least one element");const i=d.clone(t),o=d.clone(e.center),r=e.radius,s=n.length;if(d.equals(o,t))throw new w("occludeePosition must be different than occluderBoundingSphere.center");const a=d.normalize(d.subtract(i,o,sv),sv),c=-d.dot(a,o),u=Ha._anyRotationVector(o,a,c);let f=Ha._horizonToPlaneNormalDotProduct(e,a,c,u,n[0]);if(!f)return;let h;for(let g=1;g<s;++g){if(h=Ha._horizonToPlaneNormalDotProduct(e,a,c,u,n[g]),!h)return;h<f&&(f=h)}if(f<.0017453283658983088)return;const _=r/f;return d.add(o,d.multiplyByScalar(a,_,sv),sv)};const sUe=[];Ha.computeOccludeePointFromRectangle=function(e,t){if(!l(e))throw new w("rectangle is required.");t=A(t,be.WGS84);const n=Ee.subsample(e,t,0,sUe),i=Ae.fromPoints(n),o=d.ZERO;if(!d.equals(o,i.center))return Ha.computeOccludeePoint(new Ae(o,t.minimumRadius),i.center,n)};const aUe=new d;Ha._anyRotationVector=function(e,t,n){const i=d.abs(t,aUe);let o=i.x>i.y?0:1;(o===0&&i.z>i.x||o===1&&i.z>i.y)&&(o=2);const r=new d;let s;o===0?(i.x=e.x,i.y=e.y+1,i.z=e.z+1,s=d.UNIT_X):o===1?(i.x=e.x+1,i.y=e.y,i.z=e.z+1,s=d.UNIT_Y):(i.x=e.x+1,i.y=e.y+1,i.z=e.z,s=d.UNIT_Z);const a=(d.dot(t,i)+n)/-d.dot(t,s);return d.normalize(d.subtract(d.add(i,d.multiplyByScalar(s,a,r),i),e,i),i)};const cUe=new d;Ha._rotationVector=function(e,t,n,i,o){let r=d.subtract(i,e,cUe);if(r=d.normalize(r,r),d.dot(t,r)<.9999999847691291){const s=d.cross(t,r,r);if(d.magnitude(s)>F.EPSILON13)return d.normalize(s,new d)}return o};const FB=new d,lUe=new d,av=new d,L6=new d;Ha._horizonToPlaneNormalDotProduct=function(e,t,n,i,o){const r=d.clone(o,FB),s=d.clone(e.center,lUe),a=e.radius;let c=d.subtract(s,r,av);const u=d.magnitudeSquared(c),f=a*a;if(u<f)return!1;const h=u-f,_=Math.sqrt(h),p=1/Math.sqrt(u),T=_*p*_;c=d.normalize(c,c);const b=d.add(r,d.multiplyByScalar(c,T,L6),L6),x=Math.sqrt(h-T*T);let v=this._rotationVector(s,t,n,r,i),D=d.fromElements(v.x*v.x*c.x+(v.x*v.y-v.z)*c.y+(v.x*v.z+v.y)*c.z,(v.x*v.y+v.z)*c.x+v.y*v.y*c.y+(v.y*v.z-v.x)*c.z,(v.x*v.z-v.y)*c.x+(v.y*v.z+v.x)*c.y+v.z*v.z*c.z,FB);D=d.normalize(D,D);const L=d.multiplyByScalar(D,x,FB);v=d.normalize(d.subtract(d.add(b,L,av),s,av),av);const B=d.dot(t,v);v=d.normalize(d.subtract(d.subtract(b,L,v),s,v),v);const V=d.dot(t,v);return B<V?B:V};function Wa(e){e=A(e,A.EMPTY_OBJECT),this.left=e.left,this._left=void 0,this.right=e.right,this._right=void 0,this.top=e.top,this._top=void 0,this.bottom=e.bottom,this._bottom=void 0,this.near=A(e.near,1),this._near=this.near,this.far=A(e.far,5e8),this._far=this.far,this._cullingVolume=new Ur,this._perspectiveMatrix=new N,this._infinitePerspective=new N}function bF(e){if(!l(e.right)||!l(e.left)||!l(e.top)||!l(e.bottom)||!l(e.near)||!l(e.far))throw new w("right, left, top, bottom, near, or far parameters are not set.");const t=e.top,n=e.bottom,i=e.right,o=e.left,r=e.near,s=e.far;if(t!==e._top||n!==e._bottom||o!==e._left||i!==e._right||r!==e._near||s!==e._far){if(e.near<=0||e.near>e.far)throw new w("near must be greater than zero and less than far.");e._left=o,e._right=i,e._top=t,e._bottom=n,e._near=r,e._far=s,e._perspectiveMatrix=N.computePerspectiveOffCenter(o,i,n,t,r,s,e._perspectiveMatrix),e._infinitePerspective=N.computeInfinitePerspectiveOffCenter(o,i,n,t,r,e._infinitePerspective)}}Object.defineProperties(Wa.prototype,{projectionMatrix:{get:function(){return bF(this),this._perspectiveMatrix}},infiniteProjectionMatrix:{get:function(){return bF(this),this._infinitePerspective}}});const uUe=new d,fUe=new d,dUe=new d,hUe=new d;Wa.prototype.computeCullingVolume=function(e,t,n){if(!l(e))throw new w("position is required.");if(!l(t))throw new w("direction is required.");if(!l(n))throw new w("up is required.");const i=this._cullingVolume.planes,o=this.top,r=this.bottom,s=this.right,a=this.left,c=this.near,u=this.far,f=d.cross(t,n,uUe),h=fUe;d.multiplyByScalar(t,c,h),d.add(e,h,h);const _=dUe;d.multiplyByScalar(t,u,_),d.add(e,_,_);const g=hUe;d.multiplyByScalar(f,a,g),d.add(h,g,g),d.subtract(g,e,g),d.normalize(g,g),d.cross(g,n,g),d.normalize(g,g);let p=i[0];return l(p)||(p=i[0]=new ue),p.x=g.x,p.y=g.y,p.z=g.z,p.w=-d.dot(g,e),d.multiplyByScalar(f,s,g),d.add(h,g,g),d.subtract(g,e,g),d.cross(n,g,g),d.normalize(g,g),p=i[1],l(p)||(p=i[1]=new ue),p.x=g.x,p.y=g.y,p.z=g.z,p.w=-d.dot(g,e),d.multiplyByScalar(n,r,g),d.add(h,g,g),d.subtract(g,e,g),d.cross(f,g,g),d.normalize(g,g),p=i[2],l(p)||(p=i[2]=new ue),p.x=g.x,p.y=g.y,p.z=g.z,p.w=-d.dot(g,e),d.multiplyByScalar(n,o,g),d.add(h,g,g),d.subtract(g,e,g),d.cross(g,f,g),d.normalize(g,g),p=i[3],l(p)||(p=i[3]=new ue),p.x=g.x,p.y=g.y,p.z=g.z,p.w=-d.dot(g,e),p=i[4],l(p)||(p=i[4]=new ue),p.x=t.x,p.y=t.y,p.z=t.z,p.w=-d.dot(t,h),d.negate(t,g),p=i[5],l(p)||(p=i[5]=new ue),p.x=g.x,p.y=g.y,p.z=g.z,p.w=-d.dot(g,_),this._cullingVolume};Wa.prototype.getPixelDimensions=function(e,t,n,i,o){if(bF(this),!l(e)||!l(t))throw new w("Both drawingBufferWidth and drawingBufferHeight are required.");if(e<=0)throw new w("drawingBufferWidth must be greater than zero.");if(t<=0)throw new w("drawingBufferHeight must be greater than zero.");if(!l(n))throw new w("distance is required.");if(!l(i))throw new w("pixelRatio is required");if(i<=0)throw new w("pixelRatio must be greater than zero.");if(!l(o))throw new w("A result object is required.");const r=1/this.near;let s=this.top*r;const a=2*i*n*s/t;s=this.right*r;const c=2*i*n*s/e;return o.x=c,o.y=a,o};Wa.prototype.clone=function(e){return l(e)||(e=new Wa),e.right=this.right,e.left=this.left,e.top=this.top,e.bottom=this.bottom,e.near=this.near,e.far=this.far,e._left=void 0,e._right=void 0,e._top=void 0,e._bottom=void 0,e._near=void 0,e._far=void 0,e};Wa.prototype.equals=function(e){return l(e)&&e instanceof Wa&&this.right===e.right&&this.left===e.left&&this.top===e.top&&this.bottom===e.bottom&&this.near===e.near&&this.far===e.far};Wa.prototype.equalsEpsilon=function(e,t,n){return e===this||l(e)&&e instanceof Wa&&F.equalsEpsilon(this.right,e.right,t,n)&&F.equalsEpsilon(this.left,e.left,t,n)&&F.equalsEpsilon(this.top,e.top,t,n)&&F.equalsEpsilon(this.bottom,e.bottom,t,n)&&F.equalsEpsilon(this.near,e.near,t,n)&&F.equalsEpsilon(this.far,e.far,t,n)};function hi(e){e=A(e,A.EMPTY_OBJECT),this._offCenterFrustum=new Wa,this.fov=e.fov,this._fov=void 0,this._fovy=void 0,this._sseDenominator=void 0,this.aspectRatio=e.aspectRatio,this._aspectRatio=void 0,this.near=A(e.near,1),this._near=this.near,this.far=A(e.far,5e8),this._far=this.far,this.xOffset=A(e.xOffset,0),this._xOffset=this.xOffset,this.yOffset=A(e.yOffset,0),this._yOffset=this.yOffset}hi.packedLength=6;hi.pack=function(e,t,n){return E.typeOf.object("value",e),E.defined("array",t),n=A(n,0),t[n++]=e.fov,t[n++]=e.aspectRatio,t[n++]=e.near,t[n++]=e.far,t[n++]=e.xOffset,t[n]=e.yOffset,t};hi.unpack=function(e,t,n){return E.defined("array",e),t=A(t,0),l(n)||(n=new hi),n.fov=e[t++],n.aspectRatio=e[t++],n.near=e[t++],n.far=e[t++],n.xOffset=e[t++],n.yOffset=e[t],n};function ld(e){if(!l(e.fov)||!l(e.aspectRatio)||!l(e.near)||!l(e.far))throw new w("fov, aspectRatio, near, or far parameters are not set.");const t=e._offCenterFrustum;if(e.fov!==e._fov||e.aspectRatio!==e._aspectRatio||e.near!==e._near||e.far!==e._far||e.xOffset!==e._xOffset||e.yOffset!==e._yOffset){if(e.fov<0||e.fov>=Math.PI)throw new w("fov must be in the range [0, PI).");if(e.aspectRatio<0)throw new w("aspectRatio must be positive.");if(e.near<0||e.near>e.far)throw new w("near must be greater than zero and less than far.");e._aspectRatio=e.aspectRatio,e._fov=e.fov,e._fovy=e.aspectRatio<=1?e.fov:Math.atan(Math.tan(e.fov*.5)/e.aspectRatio)*2,e._near=e.near,e._far=e.far,e._sseDenominator=2*Math.tan(.5*e._fovy),e._xOffset=e.xOffset,e._yOffset=e.yOffset,t.top=e.near*Math.tan(.5*e._fovy),t.bottom=-t.top,t.right=e.aspectRatio*t.top,t.left=-t.right,t.near=e.near,t.far=e.far,t.right+=e.xOffset,t.left+=e.xOffset,t.top+=e.yOffset,t.bottom+=e.yOffset}}Object.defineProperties(hi.prototype,{projectionMatrix:{get:function(){return ld(this),this._offCenterFrustum.projectionMatrix}},infiniteProjectionMatrix:{get:function(){return ld(this),this._offCenterFrustum.infiniteProjectionMatrix}},fovy:{get:function(){return ld(this),this._fovy}},sseDenominator:{get:function(){return ld(this),this._sseDenominator}}});hi.prototype.computeCullingVolume=function(e,t,n){return ld(this),this._offCenterFrustum.computeCullingVolume(e,t,n)};hi.prototype.getPixelDimensions=function(e,t,n,i,o){return ld(this),this._offCenterFrustum.getPixelDimensions(e,t,n,i,o)};hi.prototype.clone=function(e){return l(e)||(e=new hi),e.aspectRatio=this.aspectRatio,e.fov=this.fov,e.near=this.near,e.far=this.far,e._aspectRatio=void 0,e._fov=void 0,e._near=void 0,e._far=void 0,this._offCenterFrustum.clone(e._offCenterFrustum),e};hi.prototype.equals=function(e){return!l(e)||!(e instanceof hi)?!1:(ld(this),ld(e),this.fov===e.fov&&this.aspectRatio===e.aspectRatio&&this._offCenterFrustum.equals(e._offCenterFrustum))};hi.prototype.equalsEpsilon=function(e,t,n){return!l(e)||!(e instanceof hi)?!1:(ld(this),ld(e),F.equalsEpsilon(this.fov,e.fov,t,n)&&F.equalsEpsilon(this.aspectRatio,e.aspectRatio,t,n)&&this._offCenterFrustum.equalsEpsilon(e._offCenterFrustum,t,n))};function Cx(){this._colorTexture=void 0,this._drawCommand=void 0}Object.defineProperties(Cx.prototype,{colorTexture:{get:function(){return this._colorTexture}}});function pUe(e,t,n){const i=t.createViewportQuadCommand(SOe,{framebuffer:n,renderState:ht.fromCache({viewport:new at(0,0,256,256)})});e._drawCommand=i}Cx.prototype.update=function(e){if(!l(this._colorTexture)){const t=e.context,n=new rn({context:t,width:256,height:256,pixelFormat:yt.RGBA,pixelDatatype:ft.UNSIGNED_BYTE,sampler:Ci.NEAREST});this._colorTexture=n;const i=new Ds({context:t,colorTextures:[n],destroyAttachments:!1});pUe(this,t,i),this._drawCommand.execute(t),i.destroy(),this._drawCommand.shaderProgram=this._drawCommand.shaderProgram&&this._drawCommand.shaderProgram.destroy()}};Cx.prototype.isDestroyed=function(){return!1};Cx.prototype.destroy=function(){return this._colorTexture=this._colorTexture&&this._colorTexture.destroy(),Je(this)};var Li={Linear:{None:function(e){return e}},Quadratic:{In:function(e){return e*e},Out:function(e){return e*(2-e)},InOut:function(e){return(e*=2)<1?.5*e*e:-.5*(--e*(e-2)-1)}},Cubic:{In:function(e){return e*e*e},Out:function(e){return--e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e:.5*((e-=2)*e*e+2)}},Quartic:{In:function(e){return e*e*e*e},Out:function(e){return 1- --e*e*e*e},InOut:function(e){return(e*=2)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2)}},Quintic:{In:function(e){return e*e*e*e*e},Out:function(e){return--e*e*e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2)}},Sinusoidal:{In:function(e){return 1-Math.cos(e*Math.PI/2)},Out:function(e){return Math.sin(e*Math.PI/2)},InOut:function(e){return .5*(1-Math.cos(Math.PI*e))}},Exponential:{In:function(e){return e===0?0:Math.pow(1024,e-1)},Out:function(e){return e===1?1:1-Math.pow(2,-10*e)},InOut:function(e){return e===0?0:e===1?1:(e*=2)<1?.5*Math.pow(1024,e-1):.5*(-Math.pow(2,-10*(e-1))+2)}},Circular:{In:function(e){return 1-Math.sqrt(1-e*e)},Out:function(e){return Math.sqrt(1- --e*e)},InOut:function(e){return(e*=2)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)}},Elastic:{In:function(e){return e===0?0:e===1?1:-Math.pow(2,10*(e-1))*Math.sin((e-1.1)*5*Math.PI)},Out:function(e){return e===0?0:e===1?1:Math.pow(2,-10*e)*Math.sin((e-.1)*5*Math.PI)+1},InOut:function(e){return e===0?0:e===1?1:(e*=2,e<1?-.5*Math.pow(2,10*(e-1))*Math.sin((e-1.1)*5*Math.PI):.5*Math.pow(2,-10*(e-1))*Math.sin((e-1.1)*5*Math.PI)+1)}},Back:{In:function(e){var t=1.70158;return e*e*((t+1)*e-t)},Out:function(e){var t=1.70158;return--e*e*((t+1)*e+t)+1},InOut:function(e){var t=2.5949095;return(e*=2)<1?.5*(e*e*((t+1)*e-t)):.5*((e-=2)*e*((t+1)*e+t)+2)}},Bounce:{In:function(e){return 1-Li.Bounce.Out(1-e)},Out:function(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},InOut:function(e){return e<.5?Li.Bounce.In(e*2)*.5:Li.Bounce.Out(e*2-1)*.5+.5}}},_b;typeof self>"u"&&typeof process<"u"&&process.hrtime?_b=function(){var e=process.hrtime();return e[0]*1e3+e[1]/1e6}:typeof self<"u"&&self.performance!==void 0&&self.performance.now!==void 0?_b=self.performance.now.bind(self.performance):Date.now!==void 0?_b=Date.now:_b=function(){return new Date().getTime()};var J0=_b,mUe=function(){function e(){this._tweens={},this._tweensAddedDuringUpdate={}}return e.prototype.getAll=function(){var t=this;return Object.keys(this._tweens).map(function(n){return t._tweens[n]})},e.prototype.removeAll=function(){this._tweens={}},e.prototype.add=function(t){this._tweens[t.getId()]=t,this._tweensAddedDuringUpdate[t.getId()]=t},e.prototype.remove=function(t){delete this._tweens[t.getId()],delete this._tweensAddedDuringUpdate[t.getId()]},e.prototype.update=function(t,n){t===void 0&&(t=J0()),n===void 0&&(n=!1);var i=Object.keys(this._tweens);if(i.length===0)return!1;for(;i.length>0;){this._tweensAddedDuringUpdate={};for(var o=0;o<i.length;o++){var r=this._tweens[i[o]],s=!n;r&&r.update(t,s)===!1&&!n&&delete this._tweens[i[o]]}i=Object.keys(this._tweensAddedDuringUpdate)}return!0},e}(),gb={Linear:function(e,t){var n=e.length-1,i=n*t,o=Math.floor(i),r=gb.Utils.Linear;return t<0?r(e[0],e[1],i):t>1?r(e[n],e[n-1],n-i):r(e[o],e[o+1>n?n:o+1],i-o)},Bezier:function(e,t){for(var n=0,i=e.length-1,o=Math.pow,r=gb.Utils.Bernstein,s=0;s<=i;s++)n+=o(1-t,i-s)*o(t,s)*e[s]*r(i,s);return n},CatmullRom:function(e,t){var n=e.length-1,i=n*t,o=Math.floor(i),r=gb.Utils.CatmullRom;return e[0]===e[n]?(t<0&&(o=Math.floor(i=n*(1+t))),r(e[(o-1+n)%n],e[o],e[(o+1)%n],e[(o+2)%n],i-o)):t<0?e[0]-(r(e[0],e[0],e[1],e[1],-i)-e[0]):t>1?e[n]-(r(e[n],e[n],e[n-1],e[n-1],i-n)-e[n]):r(e[o?o-1:0],e[o],e[n<o+1?n:o+1],e[n<o+2?n:o+2],i-o)},Utils:{Linear:function(e,t,n){return(t-e)*n+e},Bernstein:function(e,t){var n=gb.Utils.Factorial;return n(e)/n(t)/n(e-t)},Factorial:function(){var e=[1];return function(t){var n=1;if(e[t])return e[t];for(var i=t;i>1;i--)n*=i;return e[t]=n,n}}(),CatmullRom:function(e,t,n,i,o){var r=(n-e)*.5,s=(i-t)*.5,a=o*o,c=o*a;return(2*t-2*n+r+s)*c+(-3*t+3*n-2*r-s)*a+r*o+t}}},WQ=function(){function e(){}return e.nextId=function(){return e._nextId++},e._nextId=0,e}(),qQ=new mUe,_Ue=function(){function e(t,n){n===void 0&&(n=qQ),this._object=t,this._group=n,this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=Li.Linear.None,this._interpolationFunction=gb.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._id=WQ.nextId(),this._isChainStopped=!1,this._goToEnd=!1}return e.prototype.getId=function(){return this._id},e.prototype.isPlaying=function(){return this._isPlaying},e.prototype.isPaused=function(){return this._isPaused},e.prototype.to=function(t,n){return this._valuesEnd=Object.create(t),n!==void 0&&(this._duration=n),this},e.prototype.duration=function(t){return this._duration=t,this},e.prototype.start=function(t){if(this._isPlaying)return this;if(this._group&&this._group.add(this),this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var n in this._valuesStartRepeat)this._swapEndStartRepeatValues(n),this._valuesStart[n]=this._valuesStartRepeat[n]}return this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=t!==void 0?typeof t=="string"?J0()+parseFloat(t):t:J0(),this._startTime+=this._delayTime,this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat),this},e.prototype._setupProperties=function(t,n,i,o){for(var r in i){var s=t[r],a=Array.isArray(s),c=a?"array":typeof s,u=!a&&Array.isArray(i[r]);if(!(c==="undefined"||c==="function")){if(u){var f=i[r];if(f.length===0)continue;f=f.map(this._handleRelativeValue.bind(this,s)),i[r]=[s].concat(f)}if((c==="object"||a)&&s&&!u){n[r]=a?[]:{};for(var h in s)n[r][h]=s[h];o[r]=a?[]:{},this._setupProperties(s,n[r],i[r],o[r])}else typeof n[r]>"u"&&(n[r]=s),a||(n[r]*=1),u?o[r]=i[r].slice().reverse():o[r]=n[r]||0}}},e.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._group&&this._group.remove(this),this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},e.prototype.end=function(){return this._goToEnd=!0,this.update(1/0),this},e.prototype.pause=function(t){return t===void 0&&(t=J0()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=t,this._group&&this._group.remove(this),this)},e.prototype.resume=function(t){return t===void 0&&(t=J0()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=t-this._pauseStart,this._pauseStart=0,this._group&&this._group.add(this),this)},e.prototype.stopChainedTweens=function(){for(var t=0,n=this._chainedTweens.length;t<n;t++)this._chainedTweens[t].stop();return this},e.prototype.group=function(t){return this._group=t,this},e.prototype.delay=function(t){return this._delayTime=t,this},e.prototype.repeat=function(t){return this._initialRepeat=t,this._repeat=t,this},e.prototype.repeatDelay=function(t){return this._repeatDelayTime=t,this},e.prototype.yoyo=function(t){return this._yoyo=t,this},e.prototype.easing=function(t){return this._easingFunction=t,this},e.prototype.interpolation=function(t){return this._interpolationFunction=t,this},e.prototype.chain=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return this._chainedTweens=t,this},e.prototype.onStart=function(t){return this._onStartCallback=t,this},e.prototype.onUpdate=function(t){return this._onUpdateCallback=t,this},e.prototype.onRepeat=function(t){return this._onRepeatCallback=t,this},e.prototype.onComplete=function(t){return this._onCompleteCallback=t,this},e.prototype.onStop=function(t){return this._onStopCallback=t,this},e.prototype.update=function(t,n){if(t===void 0&&(t=J0()),n===void 0&&(n=!0),this._isPaused)return!0;var i,o,r=this._startTime+this._duration;if(!this._goToEnd&&!this._isPlaying){if(t>r)return!1;n&&this.start(t)}if(this._goToEnd=!1,t<this._startTime)return!0;this._onStartCallbackFired===!1&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),o=(t-this._startTime)/this._duration,o=this._duration===0||o>1?1:o;var s=this._easingFunction(o);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,s),this._onUpdateCallback&&this._onUpdateCallback(this._object,o),o===1)if(this._repeat>0){isFinite(this._repeat)&&this._repeat--;for(i in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[i]=="string"&&(this._valuesStartRepeat[i]=this._valuesStartRepeat[i]+parseFloat(this._valuesEnd[i])),this._yoyo&&this._swapEndStartRepeatValues(i),this._valuesStart[i]=this._valuesStartRepeat[i];return this._yoyo&&(this._reversed=!this._reversed),this._repeatDelayTime!==void 0?this._startTime=t+this._repeatDelayTime:this._startTime=t+this._delayTime,this._onRepeatCallback&&this._onRepeatCallback(this._object),!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var a=0,c=this._chainedTweens.length;a<c;a++)this._chainedTweens[a].start(this._startTime+this._duration);return this._isPlaying=!1,!1}return!0},e.prototype._updateProperties=function(t,n,i,o){for(var r in i)if(n[r]!==void 0){var s=n[r]||0,a=i[r],c=Array.isArray(t[r]),u=Array.isArray(a),f=!c&&u;f?t[r]=this._interpolationFunction(a,o):typeof a=="object"&&a?this._updateProperties(t[r],s,a,o):(a=this._handleRelativeValue(s,a),typeof a=="number"&&(t[r]=s+(a-s)*o))}},e.prototype._handleRelativeValue=function(t,n){return typeof n!="string"?n:n.charAt(0)==="+"||n.charAt(0)==="-"?t+parseFloat(n):parseFloat(n)},e.prototype._swapEndStartRepeatValues=function(t){var n=this._valuesStartRepeat[t],i=this._valuesEnd[t];typeof i=="string"?this._valuesStartRepeat[t]=this._valuesStartRepeat[t]+parseFloat(i):this._valuesStartRepeat[t]=this._valuesEnd[t],this._valuesEnd[t]=n},e}();WQ.nextId;var Cd=qQ;Cd.getAll.bind(Cd);Cd.removeAll.bind(Cd);Cd.add.bind(Cd);Cd.remove.bind(Cd);Cd.update.bind(Cd);const gUe={LINEAR_NONE:Li.Linear.None,QUADRATIC_IN:Li.Quadratic.In,QUADRATIC_OUT:Li.Quadratic.Out,QUADRATIC_IN_OUT:Li.Quadratic.InOut,CUBIC_IN:Li.Cubic.In,CUBIC_OUT:Li.Cubic.Out,CUBIC_IN_OUT:Li.Cubic.InOut,QUARTIC_IN:Li.Quartic.In,QUARTIC_OUT:Li.Quartic.Out,QUARTIC_IN_OUT:Li.Quartic.InOut,QUINTIC_IN:Li.Quintic.In,QUINTIC_OUT:Li.Quintic.Out,QUINTIC_IN_OUT:Li.Quintic.InOut,SINUSOIDAL_IN:Li.Sinusoidal.In,SINUSOIDAL_OUT:Li.Sinusoidal.Out,SINUSOIDAL_IN_OUT:Li.Sinusoidal.InOut,EXPONENTIAL_IN:Li.Exponential.In,EXPONENTIAL_OUT:Li.Exponential.Out,EXPONENTIAL_IN_OUT:Li.Exponential.InOut,CIRCULAR_IN:Li.Circular.In,CIRCULAR_OUT:Li.Circular.Out,CIRCULAR_IN_OUT:Li.Circular.InOut,ELASTIC_IN:Li.Elastic.In,ELASTIC_OUT:Li.Elastic.Out,ELASTIC_IN_OUT:Li.Elastic.InOut,BACK_IN:Li.Back.In,BACK_OUT:Li.Back.Out,BACK_IN_OUT:Li.Back.InOut,BOUNCE_IN:Li.Bounce.In,BOUNCE_OUT:Li.Bounce.Out,BOUNCE_IN_OUT:Li.Bounce.InOut},_l=Object.freeze(gUe);function yUe(e){const t=e._uSquared,n=e._ellipsoid.maximumRadius,i=e._ellipsoid.minimumRadius,o=(n-i)/n,r=Math.cos(e._startHeading),s=Math.sin(e._startHeading),a=(1-o)*Math.tan(e._start.latitude),c=1/Math.sqrt(1+a*a),u=c*a,f=Math.atan2(a,r),h=c*s,_=h*h,g=1-_,p=Math.sqrt(g),y=t/4,T=y*y,b=T*y,x=T*T,v=1+y-3*T/4+5*b/4-175*x/64,D=1-y+15*T/8-35*b/8,L=1-3*y+35*T/4,B=1-5*y,V=v*f-D*Math.sin(2*f)*y/2-L*Math.sin(4*f)*T/16-B*Math.sin(6*f)*b/48-Math.sin(8*f)*5*x/512,M=e._constants;M.a=n,M.b=i,M.f=o,M.cosineHeading=r,M.sineHeading=s,M.tanU=a,M.cosineU=c,M.sineU=u,M.sigma=f,M.sineAlpha=h,M.sineSquaredAlpha=_,M.cosineSquaredAlpha=g,M.cosineAlpha=p,M.u2Over4=y,M.u4Over16=T,M.u6Over64=b,M.u8Over256=x,M.a0=v,M.a1=D,M.a2=L,M.a3=B,M.distanceRatio=V}function AUe(e,t){return e*t*(4+e*(4-3*t))/16}function jQ(e,t,n,i,o,r,s){const a=AUe(e,n);return(1-a)*e*t*(i+a*o*(s+a*r*(2*s*s-1)))}function TUe(e,t,n,i,o,r,s){const a=(t-n)/t,c=r-i,u=Math.atan((1-a)*Math.tan(o)),f=Math.atan((1-a)*Math.tan(s)),h=Math.cos(u),_=Math.sin(u),g=Math.cos(f),p=Math.sin(f),y=h*g,T=h*p,b=_*p,x=_*g;let v=c,D=F.TWO_PI,L=Math.cos(v),B=Math.sin(v),V,M,H,G,I;do{L=Math.cos(v),B=Math.sin(v);const j=T-x*L;H=Math.sqrt(g*g*B*B+j*j),M=b+y*L,V=Math.atan2(H,M);let ee;H===0?(ee=0,G=1):(ee=y*B/H,G=1-ee*ee),D=v,I=M-2*b/G,isFinite(I)||(I=0),v=c+jQ(a,ee,G,V,H,M,I)}while(Math.abs(v-D)>F.EPSILON12);const O=G*(t*t-n*n)/(n*n),m=1+O*(4096+O*(O*(320-175*O)-768))/16384,P=O*(256+O*(O*(74-47*O)-128))/1024,R=I*I,U=P*H*(I+P*(M*(2*R-1)-P*I*(4*H*H-3)*(4*R-3)/6)/4),W=n*m*(V-U),q=Math.atan2(g*B,T-x*L),Y=Math.atan2(h*B,T*L-x);e._distance=W,e._startHeading=q,e._endHeading=Y,e._uSquared=O}const CUe=new d,zB=new d;function YQ(e,t,n,i){const o=d.normalize(i.cartographicToCartesian(t,zB),CUe),r=d.normalize(i.cartographicToCartesian(n,zB),zB);E.typeOf.number.greaterThanOrEquals("value",Math.abs(Math.abs(d.angleBetween(o,r))-Math.PI),.0125),TUe(e,i.maximumRadius,i.minimumRadius,t.longitude,t.latitude,n.longitude,n.latitude),e._start=ve.clone(t,e._start),e._end=ve.clone(n,e._end),e._start.height=0,e._end.height=0,yUe(e)}function fp(e,t,n){const i=A(n,be.WGS84);this._ellipsoid=i,this._start=new ve,this._end=new ve,this._constants={},this._startHeading=void 0,this._endHeading=void 0,this._distance=void 0,this._uSquared=void 0,l(e)&&l(t)&&YQ(this,e,t,i)}Object.defineProperties(fp.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},surfaceDistance:{get:function(){return E.defined("distance",this._distance),this._distance}},start:{get:function(){return this._start}},end:{get:function(){return this._end}},startHeading:{get:function(){return E.defined("distance",this._distance),this._startHeading}},endHeading:{get:function(){return E.defined("distance",this._distance),this._endHeading}}});fp.prototype.setEndPoints=function(e,t){E.defined("start",e),E.defined("end",t),YQ(this,e,t,this._ellipsoid)};fp.prototype.interpolateUsingFraction=function(e,t){return this.interpolateUsingSurfaceDistance(this._distance*e,t)};fp.prototype.interpolateUsingSurfaceDistance=function(e,t){E.defined("distance",this._distance);const n=this._constants,i=n.distanceRatio+e/n.b,o=Math.cos(2*i),r=Math.cos(4*i),s=Math.cos(6*i),a=Math.sin(2*i),c=Math.sin(4*i),u=Math.sin(6*i),f=Math.sin(8*i),h=i*i,_=i*h,g=n.u8Over256,p=n.u2Over4,y=n.u6Over64,T=n.u4Over16;let b=2*_*g*o/3+i*(1-p+7*T/4-15*y/4+579*g/64-(T-15*y/4+187*g/16)*o-(5*y/4-115*g/16)*r-29*g*s/16)+(p/2-T+71*y/32-85*g/16)*a+(5*T/16-5*y/4+383*g/96)*c-h*((y-11*g/2)*a+5*g*c/2)+(29*y/96-29*g/16)*u+539*g*f/1536;const x=Math.asin(Math.sin(b)*n.cosineAlpha),v=Math.atan(n.a/n.b*Math.tan(x));b=b-n.sigma;const D=Math.cos(2*n.sigma+b),L=Math.sin(b),B=Math.cos(b),V=n.cosineU*B,M=n.sineU*L,G=Math.atan2(L*n.sineHeading,V-M*n.cosineHeading)-jQ(n.f,n.sineAlpha,n.cosineSquaredAlpha,b,L,B,D);return l(t)?(t.longitude=this._start.longitude+G,t.latitude=v,t.height=0,t):new ve(this._start.longitude+G,v,0)};function ry(e,t,n){this.heading=A(e,0),this.pitch=A(t,0),this.range=A(n,0)}ry.clone=function(e,t){if(l(e))return l(t)||(t=new ry),t.heading=e.heading,t.pitch=e.pitch,t.range=e.range,t};const $Q={};function bUe(e,t,n){let i,o,r;if(e instanceof hi){const s=Math.tan(.5*e.fovy);return i=e.near,o=e.near*s,r=e.aspectRatio*o,Math.max(t*i/r,n*i/o)}else if(e instanceof Wa)return i=e.near,o=e.top,r=e.right,Math.max(t*i/r,n*i/o);return Math.max(t,n)}const EUe=new d,B6=new d;function XQ(e,t,n,i){if(l(i)&&n(.5)>i){const o=n(0),r=n(1),s=n(.5),a=s-o,c=s-r;return function(u){const f=n(u);if(u<=.5){const _=(f-o)/a;return F.lerp(e,-F.PI_OVER_TWO,_)}const h=(f-r)/c;return F.lerp(-F.PI_OVER_TWO,t,1-h)}}return function(o){return F.lerp(e,t,o)}}function wz(e,t,n,i,o){let r=o;const s=Math.max(n,i);if(!l(r)){const a=e.position,c=t,u=e.up,f=e.right,h=e.frustum,_=d.subtract(a,c,EUe),g=d.magnitude(d.multiplyByScalar(u,d.dot(_,u),B6)),p=d.magnitude(d.multiplyByScalar(f,d.dot(_,f),B6));r=Math.min(bUe(h,g,p)*.2,1e9)}if(s<r){const u=-Math.pow((r-n)*1e6,.125),f=Math.pow((r-i)*1e6,1/8);return function(h){const _=h*(f-u)+u;return-Math.pow(_,8)/1e6+r}}return function(a){return F.lerp(n,i,a)}}function vE(e,t){return F.equalsEpsilon(e,F.TWO_PI,F.EPSILON11)&&(e=0),t>e+Math.PI?e+=F.TWO_PI:t<e-Math.PI&&(e-=F.TWO_PI),e}const KQ=new d;function xUe(e,t,n,i,o,r,s,a){const c=e.camera,u=d.clone(c.position,KQ),f=c.pitch,h=vE(c.heading,i),_=vE(c.roll,r),g=wz(c,n,u.z,n.z,s),p=XQ(f,o,g,a);function y(T){const b=T.time/t;c.setView({orientation:{heading:F.lerp(h,i,b),pitch:p(b),roll:F.lerp(_,r,b)}}),$.lerp(u,n,b,c.position),c.position.z=g(b)}return y}function wUe(e,t){e.longitude<t.longitude?e.longitude+=F.TWO_PI:t.longitude+=F.TWO_PI}function SUe(e,t){const n=e.longitude-t.longitude;n<-F.PI?e.longitude+=F.TWO_PI:n>F.PI&&(t.longitude+=F.TWO_PI)}const vUe=new ve,DUe=new ve;function IUe(e,t,n,i,o,r,s,a,c,u){const f=e.camera,_=e.mapProjection.ellipsoid,g=ve.clone(f.positionCartographic,vUe),p=f.pitch,y=vE(f.heading,i),T=vE(f.roll,r),b=_.cartesianToCartographic(n,DUe);g.longitude=F.zeroToTwoPi(g.longitude),b.longitude=F.zeroToTwoPi(b.longitude);let x=!1;if(l(a)){const B=F.zeroToTwoPi(a),V=Math.min(g.longitude,b.longitude),M=Math.max(g.longitude,b.longitude),H=B>=V&&B<=M;if(l(c)){const G=Math.abs(g.longitude-b.longitude),I=F.TWO_PI-G;(H?G:I)<(H?I:G)*c&&!H&&(x=!0)}else H||(x=!0)}x?wUe(g,b):SUe(g,b);const v=wz(f,n,g.height,b.height,s),D=XQ(p,o,v,u);function L(){const B=g.longitude,V=b.longitude,M=g.latitude,H=b.latitude;return function(I){const O=I.time/t,m=d.fromRadians(F.lerp(B,V,O),F.lerp(M,H,O),v(O),_);f.setView({destination:m,orientation:{heading:F.lerp(y,i,O),pitch:D(O),roll:F.lerp(T,r,O)}})}}return L()}function PUe(e,t,n,i,o,r,s){const a=e.camera,c=d.clone(a.position,KQ),u=vE(a.heading,i),f=a.frustum.right-a.frustum.left,h=wz(a,n,f,n.z,s);function _(g){const p=g.time/t;a.setView({orientation:{heading:F.lerp(u,i,p)}}),$.lerp(c,n,p,a.position);const y=h(p),T=a.frustum,b=T.top/T.right,x=(y-(T.right-T.left))*.5;T.right+=x,T.left-=x,T.top=b*T.right,T.bottom=-T.top}return _}const R6=new ve,OUe=new d;function UB(e,t){return{startObject:{},stopObject:{},duration:0,complete:e,cancel:t}}function N6(e,t){function n(){typeof t=="function"&&t(),e.enableInputs=!0}return n}$Q.createTween=function(e,t){t=A(t,A.EMPTY_OBJECT);let n=t.destination;if(!l(e))throw new w("scene is required.");if(!l(n))throw new w("destination is required.");const i=e.mode;if(i===me.MORPHING)return UB();const o=A(t.convert,!0),r=e.mapProjection,s=r.ellipsoid,a=t.maximumHeight,c=t.flyOverLongitude,u=t.flyOverLongitudeWeight,f=t.pitchAdjustHeight;let h=t.easingFunction;o&&i!==me.SCENE3D&&(s.cartesianToCartographic(n,R6),n=r.project(R6,OUe));const _=e.camera,g=t.endTransform;l(g)&&_._setTransform(g);let p=t.duration;l(p)||(p=Math.ceil(d.distance(_.position,n)/1e6)+2,p=Math.min(p,3));const y=A(t.heading,0),T=A(t.pitch,-F.PI_OVER_TWO),b=A(t.roll,0),x=e.screenSpaceCameraController;x.enableInputs=!1;const v=N6(x,t.complete),D=N6(x,t.cancel),L=_.frustum;let B=e.mode===me.SCENE2D;if(B=B&&$.equalsEpsilon(_.position,n,F.EPSILON6),B=B&&F.equalsEpsilon(Math.max(L.right-L.left,L.top-L.bottom),n.z,F.EPSILON6),B=B||e.mode!==me.SCENE2D&&d.equalsEpsilon(n,_.position,F.EPSILON10),B=B&&F.equalsEpsilon(F.negativePiToPi(y),F.negativePiToPi(_.heading),F.EPSILON10)&&F.equalsEpsilon(F.negativePiToPi(T),F.negativePiToPi(_.pitch),F.EPSILON10)&&F.equalsEpsilon(F.negativePiToPi(b),F.negativePiToPi(_.roll),F.EPSILON10),B)return UB(v,D);const V=new Array(4);if(V[me.SCENE2D]=PUe,V[me.SCENE3D]=IUe,V[me.COLUMBUS_VIEW]=xUe,p<=0)return UB(function(){V[i](e,1,n,y,T,b,a,c,u,f)({time:1}),typeof v=="function"&&v()},D);const M=V[i](e,p,n,y,T,b,a,c,u,f);if(!l(h)){const H=_.positionCartographic.height,G=i===me.SCENE3D?s.cartesianToCartographic(n).height:n.z;H>G&&H>11500?h=_l.CUBIC_OUT:h=_l.QUINTIC_IN_OUT}return{duration:p,easingFunction:h,startObject:{time:0},stopObject:{time:p},update:M,complete:v,cancel:D}};const LUe=$Q,BUe={ROTATE:0,INFINITE_SCROLL:1},Zm=Object.freeze(BUe);function Tt(e){if(!l(e))throw new w("scene is required.");this._scene=e,this._transform=N.clone(N.IDENTITY),this._invTransform=N.clone(N.IDENTITY),this._actualTransform=N.clone(N.IDENTITY),this._actualInvTransform=N.clone(N.IDENTITY),this._transformChanged=!1,this.position=new d,this._position=new d,this._positionWC=new d,this._positionCartographic=new ve,this._oldPositionWC=void 0,this.positionWCDeltaMagnitude=0,this.positionWCDeltaMagnitudeLastFrame=0,this.timeSinceMoved=0,this._lastMovedTimestamp=0,this.direction=new d,this._direction=new d,this._directionWC=new d,this.up=new d,this._up=new d,this._upWC=new d,this.right=new d,this._right=new d,this._rightWC=new d,this.frustum=new hi,this.frustum.aspectRatio=e.drawingBufferWidth/e.drawingBufferHeight,this.frustum.fov=F.toRadians(60),this.defaultMoveAmount=1e5,this.defaultLookAmount=Math.PI/60,this.defaultRotateAmount=Math.PI/3600,this.defaultZoomAmount=1e5,this.constrainedAxis=void 0,this.maximumZoomFactor=1.5,this._moveStart=new lt,this._moveEnd=new lt,this._changed=new lt,this._changedPosition=void 0,this._changedDirection=void 0,this._changedFrustum=void 0,this._changedHeading=void 0,this.percentageChanged=.5,this._viewMatrix=new N,this._invViewMatrix=new N,JQ(this),this._mode=me.SCENE3D,this._modeChanged=!0;const t=e.mapProjection;this._projection=t,this._maxCoord=t.project(new ve(Math.PI,F.PI_OVER_TWO)),this._max2Dfrustum=void 0,lZ(this,Tt.DEFAULT_VIEW_RECTANGLE,this.position,!0);let n=d.magnitude(this.position);n+=n*Tt.DEFAULT_VIEW_FACTOR,d.normalize(this.position,this.position),d.multiplyByScalar(this.position,n,this.position)}Tt.TRANSFORM_2D=new N(0,0,1,0,1,0,0,0,0,1,0,0,0,0,0,1);Tt.TRANSFORM_2D_INVERSE=N.inverseTransformation(Tt.TRANSFORM_2D,new N);Tt.DEFAULT_VIEW_RECTANGLE=Ee.fromDegrees(-95,-20,-70,90);Tt.DEFAULT_VIEW_FACTOR=.5;Tt.DEFAULT_OFFSET=new ry(0,-F.PI_OVER_FOUR,0);function JQ(e){N.computeView(e._position,e._direction,e._up,e._right,e._viewMatrix),N.multiply(e._viewMatrix,e._actualInvTransform,e._viewMatrix),N.inverseTransformation(e._viewMatrix,e._invViewMatrix)}function RUe(e){if(!l(e._oldPositionWC))e._oldPositionWC=d.clone(e.positionWC,e._oldPositionWC);else{e.positionWCDeltaMagnitudeLastFrame=e.positionWCDeltaMagnitude;const t=d.subtract(e.positionWC,e._oldPositionWC,e._oldPositionWC);e.positionWCDeltaMagnitude=d.magnitude(t),e._oldPositionWC=d.clone(e.positionWC,e._oldPositionWC),e.positionWCDeltaMagnitude>0?(e.timeSinceMoved=0,e._lastMovedTimestamp=Gr()):e.timeSinceMoved=Math.max(Gr()-e._lastMovedTimestamp,0)/1e3}}Tt.prototype.canPreloadFlight=function(){return l(this._currentFlight)&&this._mode!==me.SCENE2D};Tt.prototype._updateCameraChanged=function(){const e=this;if(RUe(e),e._changed.numberOfListeners===0)return;const t=e.percentageChanged,n=e.heading;l(e._changedHeading)||(e._changedHeading=n);let i=Math.abs(e._changedHeading-n)%F.TWO_PI;i=i>F.PI?F.TWO_PI-i:i;const o=i/Math.PI;if(o>t&&(e._changed.raiseEvent(o),e._changedHeading=n),e._mode===me.SCENE2D){if(!l(e._changedFrustum)){e._changedPosition=d.clone(e.position,e._changedPosition),e._changedFrustum=e.frustum.clone();return}const u=e.position,f=e._changedPosition,h=e.frustum,_=e._changedFrustum,g=u.x+h.left,p=u.x+h.right,y=f.x+_.left,T=f.x+_.right,b=u.y+h.bottom,x=u.y+h.top,v=f.y+_.bottom,D=f.y+_.top,L=Math.max(g,y),B=Math.min(p,T),V=Math.max(b,v),M=Math.min(x,D);let H;if(L>=B||V>=x)H=1;else{let G=_;g<y&&p>T&&b<v&&x>D&&(G=h),H=1-(B-L)*(M-V)/((G.right-G.left)*(G.top-G.bottom))}H>t&&(e._changed.raiseEvent(H),e._changedPosition=d.clone(e.position,e._changedPosition),e._changedFrustum=e.frustum.clone(e._changedFrustum));return}if(!l(e._changedDirection)){e._changedPosition=d.clone(e.positionWC,e._changedPosition),e._changedDirection=d.clone(e.directionWC,e._changedDirection);return}const r=F.acosClamped(d.dot(e.directionWC,e._changedDirection));let s;l(e.frustum.fovy)?s=r/(e.frustum.fovy*.5):s=r;const c=d.distance(e.positionWC,e._changedPosition)/e.positionCartographic.height;(s>t||c>t)&&(e._changed.raiseEvent(Math.max(s,c)),e._changedPosition=d.clone(e.positionWC,e._changedPosition),e._changedDirection=d.clone(e.directionWC,e._changedDirection))};function NUe(e){En.basisTo2D(e._projection,e._transform,e._actualTransform)}const MUe=new ve,FUe=new d,cv=new d,zUe=new ue,UUe=new ue,HUe=new ue,VUe=new ue,kUe=new ue;function GUe(e){const t=e._projection,n=t.ellipsoid,i=N.getColumn(e._transform,3,zUe),o=n.cartesianToCartographic(i,MUe),r=t.project(o,FUe),s=UUe;s.x=r.z,s.y=r.x,s.z=r.y,s.w=1;const a=ue.clone(ue.UNIT_X,kUe),c=ue.add(N.getColumn(e._transform,0,cv),i,cv);n.cartesianToCartographic(c,o),t.project(o,r);const u=HUe;u.x=r.z,u.y=r.x,u.z=r.y,u.w=0,d.subtract(u,s,u),u.x=0;const f=VUe;if(d.magnitudeSquared(u)>F.EPSILON10)d.cross(a,u,f);else{const h=ue.add(N.getColumn(e._transform,1,cv),i,cv);n.cartesianToCartographic(h,o),t.project(o,r),f.x=r.z,f.y=r.x,f.z=r.y,f.w=0,d.subtract(f,s,f),f.x=0,d.magnitudeSquared(f)<F.EPSILON10&&(ue.clone(ue.UNIT_Y,u),ue.clone(ue.UNIT_Z,f))}d.cross(f,a,u),d.normalize(u,u),d.cross(a,u,f),d.normalize(f,f),N.setColumn(e._actualTransform,0,u,e._actualTransform),N.setColumn(e._actualTransform,1,f,e._actualTransform),N.setColumn(e._actualTransform,2,a,e._actualTransform),N.setColumn(e._actualTransform,3,s,e._actualTransform)}const HB=new d;function Ia(e){const t=e._mode;let n=!1,i=0;t===me.SCENE2D&&(i=e.frustum.right-e.frustum.left,n=i!==e._positionCartographic.height);let o=e._position;const r=!d.equals(o,e.position)||n;r&&(o=d.clone(e.position,e._position));let s=e._direction;const a=!d.equals(s,e.direction);a&&(d.normalize(e.direction,e.direction),s=d.clone(e.direction,e._direction));let c=e._up;const u=!d.equals(c,e.up);u&&(d.normalize(e.up,e.up),c=d.clone(e.up,e._up));let f=e._right;const h=!d.equals(f,e.right);h&&(d.normalize(e.right,e.right),f=d.clone(e.right,e._right));const _=e._transformChanged||e._modeChanged;e._transformChanged=!1,_&&(N.inverseTransformation(e._transform,e._invTransform),e._mode===me.COLUMBUS_VIEW||e._mode===me.SCENE2D?N.equals(N.IDENTITY,e._transform)?N.clone(Tt.TRANSFORM_2D,e._actualTransform):e._mode===me.COLUMBUS_VIEW?NUe(e):GUe(e):N.clone(e._transform,e._actualTransform),N.inverseTransformation(e._actualTransform,e._actualInvTransform),e._modeChanged=!1);const g=e._actualTransform;if(r||_)if(e._positionWC=N.multiplyByPoint(g,o,e._positionWC),t===me.SCENE3D||t===me.MORPHING)e._positionCartographic=e._projection.ellipsoid.cartesianToCartographic(e._positionWC,e._positionCartographic);else{const p=HB;p.x=e._positionWC.y,p.y=e._positionWC.z,p.z=e._positionWC.x,t===me.SCENE2D&&(p.z=i),e._projection.unproject(p,e._positionCartographic)}if(a||u||h){const p=d.dot(s,d.cross(c,f,HB));if(Math.abs(1-p)>F.EPSILON2){const y=1/d.magnitudeSquared(c),T=d.dot(c,s)*y,b=d.multiplyByScalar(s,T,HB);c=d.normalize(d.subtract(c,b,e._up),e._up),d.clone(c,e.up),f=d.cross(s,c,e._right),d.clone(f,e.right)}}(a||_)&&(e._directionWC=N.multiplyByPointAsVector(g,s,e._directionWC),d.normalize(e._directionWC,e._directionWC)),(u||_)&&(e._upWC=N.multiplyByPointAsVector(g,c,e._upWC),d.normalize(e._upWC,e._upWC)),(h||_)&&(e._rightWC=N.multiplyByPointAsVector(g,f,e._rightWC),d.normalize(e._rightWC,e._rightWC)),(r||a||u||h||_)&&JQ(e)}function QQ(e,t){let n;return F.equalsEpsilon(Math.abs(e.z),1,F.EPSILON3)?n=Math.atan2(t.y,t.x)-F.PI_OVER_TWO:n=Math.atan2(e.y,e.x)-F.PI_OVER_TWO,F.TWO_PI-F.zeroToTwoPi(n)}function ZQ(e){return F.PI_OVER_TWO-F.acosClamped(e.z)}function eZ(e,t,n){let i=0;return F.equalsEpsilon(Math.abs(e.z),1,F.EPSILON3)||(i=Math.atan2(-n.z,t.z),i=F.zeroToTwoPi(i+F.TWO_PI)),i}const RD=new N,ND=new N;Object.defineProperties(Tt.prototype,{transform:{get:function(){return this._transform}},inverseTransform:{get:function(){return Ia(this),this._invTransform}},viewMatrix:{get:function(){return Ia(this),this._viewMatrix}},inverseViewMatrix:{get:function(){return Ia(this),this._invViewMatrix}},positionCartographic:{get:function(){return Ia(this),this._positionCartographic}},positionWC:{get:function(){return Ia(this),this._positionWC}},directionWC:{get:function(){return Ia(this),this._directionWC}},upWC:{get:function(){return Ia(this),this._upWC}},rightWC:{get:function(){return Ia(this),this._rightWC}},heading:{get:function(){if(this._mode!==me.MORPHING){const e=this._projection.ellipsoid,t=N.clone(this._transform,RD),n=En.eastNorthUpToFixedFrame(this.positionWC,e,ND);this._setTransform(n);const i=QQ(this.direction,this.up);return this._setTransform(t),i}}},pitch:{get:function(){if(this._mode!==me.MORPHING){const e=this._projection.ellipsoid,t=N.clone(this._transform,RD),n=En.eastNorthUpToFixedFrame(this.positionWC,e,ND);this._setTransform(n);const i=ZQ(this.direction);return this._setTransform(t),i}}},roll:{get:function(){if(this._mode!==me.MORPHING){const e=this._projection.ellipsoid,t=N.clone(this._transform,RD),n=En.eastNorthUpToFixedFrame(this.positionWC,e,ND);this._setTransform(n);const i=eZ(this.direction,this.up,this.right);return this._setTransform(t),i}}},moveStart:{get:function(){return this._moveStart}},moveEnd:{get:function(){return this._moveEnd}},changed:{get:function(){return this._changed}}});Tt.prototype.update=function(e){if(!l(e))throw new w("mode is required.");if(e===me.SCENE2D&&!(this.frustum instanceof yr))throw new w("An OrthographicOffCenterFrustum is required in 2D.");if((e===me.SCENE3D||e===me.COLUMBUS_VIEW)&&!(this.frustum instanceof hi)&&!(this.frustum instanceof nn))throw new w("A PerspectiveFrustum or OrthographicFrustum is required in 3D and Columbus view");let t=!1;if(e!==this._mode&&(this._mode=e,this._modeChanged=e!==me.MORPHING,t=this._mode===me.SCENE2D),t){const n=this._max2Dfrustum=this.frustum.clone();if(!(n instanceof yr))throw new w("The camera frustum is expected to be orthographic for 2D camera control.");const i=2,o=n.top/n.right;n.right=this._maxCoord.x*i,n.left=-n.right,n.top=o*n.right,n.bottom=-n.top}this._mode===me.SCENE2D&&oZ(this,this.position)};const WUe=new d,qUe=new d,jUe=new d;Tt.prototype._setTransform=function(e){const t=d.clone(this.positionWC,WUe),n=d.clone(this.upWC,qUe),i=d.clone(this.directionWC,jUe);N.clone(e,this._transform),this._transformChanged=!0,Ia(this);const o=this._actualInvTransform;N.multiplyByPoint(o,t,this.position),N.multiplyByPointAsVector(o,i,this.direction),N.multiplyByPointAsVector(o,n,this.up),d.cross(this.direction,this.up,this.right),Ia(this)};const YUe=new $,$Ue=new ii,XUe=new d,KUe=new d;function tZ(e){if(!N.equals(N.IDENTITY,e.transform))return d.magnitude(e.position);const t=e._scene,n=t.globe,i=YUe;i.x=t.drawingBufferWidth/2,i.y=t.drawingBufferHeight/2;let o;if(l(n)){const a=e.getPickRay(i,$Ue);o=n.pickWorldCoordinates(a,t,!0,XUe)}let r;t.pickPositionSupported&&(r=t.pickPositionWorldCoordinates(i,KUe));let s;if(l(o)||l(r)){const a=l(r)?d.distance(r,e.positionWC):Number.POSITIVE_INFINITY,c=l(o)?d.distance(o,e.positionWC):Number.POSITIVE_INFINITY;s=Math.min(a,c)}else s=Math.max(e.positionCartographic.height,0);return s}Tt.prototype._adjustOrthographicFrustum=function(e){this.frustum instanceof nn&&(!e&&this._positionCartographic.height<15e4||(this.frustum.width=tZ(this)))};const kI=new d,Sz=new N,JUe=new N,vz=new De,Dz=new te,nZ=new ve;function QUe(e,t,n){const i=N.clone(e.transform,Sz),o=En.eastNorthUpToFixedFrame(t,e._projection.ellipsoid,JUe);e._setTransform(o),d.clone(d.ZERO,e.position),n.heading=n.heading-F.PI_OVER_TWO;const r=De.fromHeadingPitchRoll(n,vz),s=te.fromQuaternion(r,Dz);te.getColumn(s,0,e.direction),te.getColumn(s,2,e.up),d.cross(e.direction,e.up,e.right),e._setTransform(i),e._adjustOrthographicFrustum(!0)}function ZUe(e,t,n,i){const o=N.clone(e.transform,Sz);if(e._setTransform(N.IDENTITY),!d.equals(t,e.positionWC)){if(i){const a=e._projection,c=a.ellipsoid.cartesianToCartographic(t,nZ);t=a.project(c,kI)}d.clone(t,e.position)}n.heading=n.heading-F.PI_OVER_TWO;const r=De.fromHeadingPitchRoll(n,vz),s=te.fromQuaternion(r,Dz);te.getColumn(s,0,e.direction),te.getColumn(s,2,e.up),d.cross(e.direction,e.up,e.right),e._setTransform(o),e._adjustOrthographicFrustum(!0)}function eHe(e,t,n,i){const o=N.clone(e.transform,Sz);if(e._setTransform(N.IDENTITY),!d.equals(t,e.positionWC)){if(i){const c=e._projection,u=c.ellipsoid.cartesianToCartographic(t,nZ);t=c.project(u,kI)}$.clone(t,e.position);const r=-t.z*.5,s=-r,a=e.frustum;if(s>r){const c=a.top/a.right;a.right=s,a.left=r,a.top=a.right*c,a.bottom=-a.top}}if(e._scene.mapMode2D===Zm.ROTATE){n.heading=n.heading-F.PI_OVER_TWO,n.pitch=-F.PI_OVER_TWO,n.roll=0;const r=De.fromHeadingPitchRoll(n,vz),s=te.fromQuaternion(r,Dz);te.getColumn(s,2,e.up),d.cross(e.direction,e.up,e.right)}e._setTransform(o)}const tHe=new d,nHe=new d,iHe=new d;function iZ(e,t,n,i){const o=d.clone(n.direction,tHe),r=d.clone(n.up,nHe);if(e._scene.mode===me.SCENE3D){const a=e._projection.ellipsoid,c=En.eastNorthUpToFixedFrame(t,a,RD),u=N.inverseTransformation(c,ND);N.multiplyByPointAsVector(u,o,o),N.multiplyByPointAsVector(u,r,r)}const s=d.cross(o,r,iHe);return i.heading=QQ(o,r),i.pitch=ZQ(o),i.roll=eZ(o,r,s),i}const EF={destination:void 0,orientation:{direction:void 0,up:void 0,heading:void 0,pitch:void 0,roll:void 0},convert:void 0,endTransform:void 0},S0=new Is;Tt.prototype.setView=function(e){e=A(e,A.EMPTY_OBJECT);let t=A(e.orientation,A.EMPTY_OBJECT);const n=this._mode;if(n===me.MORPHING)return;l(e.endTransform)&&this._setTransform(e.endTransform);let i=A(e.convert,!0),o=A(e.destination,d.clone(this.positionWC,kI));l(o)&&l(o.west)&&(o=this.getRectangleCameraCoordinates(o,kI),i=!1),l(t.direction)&&(t=iZ(this,o,t,EF.orientation)),S0.heading=A(t.heading,0),S0.pitch=A(t.pitch,-F.PI_OVER_TWO),S0.roll=A(t.roll,0),n===me.SCENE3D?QUe(this,o,S0):n===me.SCENE2D?eHe(this,o,S0,i):ZUe(this,o,S0,i)};const oHe=new d;Tt.prototype.flyHome=function(e){const t=this._mode;if(t===me.MORPHING&&this._scene.completeMorph(),t===me.SCENE2D)this.flyTo({destination:Tt.DEFAULT_VIEW_RECTANGLE,duration:e,endTransform:N.IDENTITY});else if(t===me.SCENE3D){const n=this.getRectangleCameraCoordinates(Tt.DEFAULT_VIEW_RECTANGLE);let i=d.magnitude(n);i+=i*Tt.DEFAULT_VIEW_FACTOR,d.normalize(n,n),d.multiplyByScalar(n,i,n),this.flyTo({destination:n,duration:e,endTransform:N.IDENTITY})}else if(t===me.COLUMBUS_VIEW){const n=this._projection.ellipsoid.maximumRadius;let i=new d(0,-1,1);i=d.multiplyByScalar(d.normalize(i,i),5*n,i),this.flyTo({destination:i,duration:e,orientation:{heading:0,pitch:-Math.acos(d.normalize(i,oHe).z),roll:0},endTransform:N.IDENTITY,convert:!1})}};Tt.prototype.worldToCameraCoordinates=function(e,t){if(!l(e))throw new w("cartesian is required.");return l(t)||(t=new ue),Ia(this),N.multiplyByVector(this._actualInvTransform,e,t)};Tt.prototype.worldToCameraCoordinatesPoint=function(e,t){if(!l(e))throw new w("cartesian is required.");return l(t)||(t=new d),Ia(this),N.multiplyByPoint(this._actualInvTransform,e,t)};Tt.prototype.worldToCameraCoordinatesVector=function(e,t){if(!l(e))throw new w("cartesian is required.");return l(t)||(t=new d),Ia(this),N.multiplyByPointAsVector(this._actualInvTransform,e,t)};Tt.prototype.cameraToWorldCoordinates=function(e,t){if(!l(e))throw new w("cartesian is required.");return l(t)||(t=new ue),Ia(this),N.multiplyByVector(this._actualTransform,e,t)};Tt.prototype.cameraToWorldCoordinatesPoint=function(e,t){if(!l(e))throw new w("cartesian is required.");return l(t)||(t=new d),Ia(this),N.multiplyByPoint(this._actualTransform,e,t)};Tt.prototype.cameraToWorldCoordinatesVector=function(e,t){if(!l(e))throw new w("cartesian is required.");return l(t)||(t=new d),Ia(this),N.multiplyByPointAsVector(this._actualTransform,e,t)};function oZ(e,t){const n=e._scene.mapMode2D===Zm.ROTATE,i=e._maxCoord.x,o=e._maxCoord.y;let r,s;n?(s=i,r=-s):(s=t.x-i*2,r=t.x+i*2),t.x>i&&(t.x=s),t.x<-i&&(t.x=r),t.y>o&&(t.y=o),t.y<-o&&(t.y=-o)}const M6=new d;Tt.prototype.move=function(e,t){if(!l(e))throw new w("direction is required.");const n=this.position;d.multiplyByScalar(e,t,M6),d.add(n,M6,n),this._mode===me.SCENE2D&&oZ(this,n),this._adjustOrthographicFrustum(!0)};Tt.prototype.moveForward=function(e){e=A(e,this.defaultMoveAmount),this._mode===me.SCENE2D?rP(this,e):this.move(this.direction,e)};Tt.prototype.moveBackward=function(e){e=A(e,this.defaultMoveAmount),this._mode===me.SCENE2D?rP(this,-e):this.move(this.direction,-e)};Tt.prototype.moveUp=function(e){e=A(e,this.defaultMoveAmount),this.move(this.up,e)};Tt.prototype.moveDown=function(e){e=A(e,this.defaultMoveAmount),this.move(this.up,-e)};Tt.prototype.moveRight=function(e){e=A(e,this.defaultMoveAmount),this.move(this.right,e)};Tt.prototype.moveLeft=function(e){e=A(e,this.defaultMoveAmount),this.move(this.right,-e)};Tt.prototype.lookLeft=function(e){e=A(e,this.defaultLookAmount),this._mode!==me.SCENE2D&&this.look(this.up,-e)};Tt.prototype.lookRight=function(e){e=A(e,this.defaultLookAmount),this._mode!==me.SCENE2D&&this.look(this.up,e)};Tt.prototype.lookUp=function(e){e=A(e,this.defaultLookAmount),this._mode!==me.SCENE2D&&this.look(this.right,-e)};Tt.prototype.lookDown=function(e){e=A(e,this.defaultLookAmount),this._mode!==me.SCENE2D&&this.look(this.right,e)};const rHe=new De,sHe=new te;Tt.prototype.look=function(e,t){if(!l(e))throw new w("axis is required.");const n=A(t,this.defaultLookAmount),i=De.fromAxisAngle(e,-n,rHe),o=te.fromQuaternion(i,sHe),r=this.direction,s=this.up,a=this.right;te.multiplyByVector(o,r,r),te.multiplyByVector(o,s,s),te.multiplyByVector(o,a,a)};Tt.prototype.twistLeft=function(e){e=A(e,this.defaultLookAmount),this.look(this.direction,e)};Tt.prototype.twistRight=function(e){e=A(e,this.defaultLookAmount),this.look(this.direction,-e)};const aHe=new De,cHe=new te;Tt.prototype.rotate=function(e,t){if(!l(e))throw new w("axis is required.");const n=A(t,this.defaultRotateAmount),i=De.fromAxisAngle(e,-n,aHe),o=te.fromQuaternion(i,cHe);te.multiplyByVector(o,this.position,this.position),te.multiplyByVector(o,this.direction,this.direction),te.multiplyByVector(o,this.up,this.up),d.cross(this.direction,this.up,this.right),d.cross(this.right,this.direction,this.up),this._adjustOrthographicFrustum(!1)};Tt.prototype.rotateDown=function(e){e=A(e,this.defaultRotateAmount),rZ(this,e)};Tt.prototype.rotateUp=function(e){e=A(e,this.defaultRotateAmount),rZ(this,-e)};const lHe=new d,uHe=new d,fHe=new d,F6=new d;function rZ(e,t){const n=e.position;if(l(e.constrainedAxis)&&!d.equalsEpsilon(e.position,d.ZERO,F.EPSILON2)){const i=d.normalize(n,lHe),o=d.equalsEpsilon(i,e.constrainedAxis,F.EPSILON2),r=d.equalsEpsilon(i,d.negate(e.constrainedAxis,F6),F.EPSILON2);if(!o&&!r){const s=d.normalize(e.constrainedAxis,uHe);let a=d.dot(i,s),c=F.acosClamped(a);t>0&&t>c&&(t=c-F.EPSILON4),a=d.dot(i,d.negate(s,F6)),c=F.acosClamped(a),t<0&&-t>c&&(t=-c+F.EPSILON4);const u=d.cross(s,i,fHe);e.rotate(u,t)}else(o&&t<0||r&&t>0)&&e.rotate(e.right,t)}else e.rotate(e.right,t)}Tt.prototype.rotateRight=function(e){e=A(e,this.defaultRotateAmount),sZ(this,-e)};Tt.prototype.rotateLeft=function(e){e=A(e,this.defaultRotateAmount),sZ(this,e)};function sZ(e,t){l(e.constrainedAxis)?e.rotate(e.constrainedAxis,t):e.rotate(e.up,t)}function rP(e,t){const n=e.frustum;if(!(n instanceof yr)||!l(n.left)||!l(n.right)||!l(n.bottom)||!l(n.top))throw new w("The camera frustum is expected to be orthographic for 2D camera control.");let i;if(t=t*.5,Math.abs(n.top)+Math.abs(n.bottom)>Math.abs(n.left)+Math.abs(n.right)){let o=n.top-t,r=n.bottom+t,s=e._maxCoord.y;e._scene.mapMode2D===Zm.ROTATE&&(s*=e.maximumZoomFactor),r>s&&(r=s,o=-s),o<=r&&(o=1,r=-1),i=n.right/n.top,n.top=o,n.bottom=r,n.right=n.top*i,n.left=-n.right}else{let o=n.right-t,r=n.left+t,s=e._maxCoord.x;e._scene.mapMode2D===Zm.ROTATE&&(s*=e.maximumZoomFactor),o>s&&(o=s,r=-s),o<=r&&(o=1,r=-1),i=n.top/n.right,n.right=o,n.left=r,n.top=n.right*i,n.bottom=-n.top}}function aZ(e,t){e.move(e.direction,t)}Tt.prototype.zoomIn=function(e){e=A(e,this.defaultZoomAmount),this._mode===me.SCENE2D?rP(this,e):aZ(this,e)};Tt.prototype.zoomOut=function(e){e=A(e,this.defaultZoomAmount),this._mode===me.SCENE2D?rP(this,-e):aZ(this,-e)};Tt.prototype.getMagnitude=function(){if(this._mode===me.SCENE3D)return d.magnitude(this.position);if(this._mode===me.COLUMBUS_VIEW)return Math.abs(this.position.z);if(this._mode===me.SCENE2D)return Math.max(this.frustum.right-this.frustum.left,this.frustum.top-this.frustum.bottom)};const dHe=new N;Tt.prototype.lookAt=function(e,t){if(!l(e))throw new w("target is required");if(!l(t))throw new w("offset is required");if(this._mode===me.MORPHING)throw new w("lookAt is not supported while morphing.");const n=En.eastNorthUpToFixedFrame(e,be.WGS84,dHe);this.lookAtTransform(n,t)};const hHe=new d,pHe=new De,mHe=new De,_He=new te;function cZ(e,t,n){t=F.clamp(t,-F.PI_OVER_TWO,F.PI_OVER_TWO),e=F.zeroToTwoPi(e)-F.PI_OVER_TWO;const i=De.fromAxisAngle(d.UNIT_Y,-t,pHe),o=De.fromAxisAngle(d.UNIT_Z,-e,mHe),r=De.multiply(o,i,o),s=te.fromQuaternion(r,_He),a=d.clone(d.UNIT_X,hHe);return te.multiplyByVector(s,a,a),d.negate(a,a),d.multiplyByScalar(a,n,a),a}Tt.prototype.lookAtTransform=function(e,t){if(!l(e))throw new w("transform is required");if(this._mode===me.MORPHING)throw new w("lookAtTransform is not supported while morphing.");if(this._setTransform(e),!l(t))return;let n;if(l(t.heading)?n=cZ(t.heading,t.pitch,t.range):n=t,this._mode===me.SCENE2D){$.clone($.ZERO,this.position),d.negate(n,this.up),this.up.z=0,d.magnitudeSquared(this.up)<F.EPSILON10&&d.clone(d.UNIT_Y,this.up),d.normalize(this.up,this.up),this._setTransform(N.IDENTITY),d.negate(d.UNIT_Z,this.direction),d.cross(this.direction,this.up,this.right),d.normalize(this.right,this.right);const i=this.frustum,o=i.top/i.right;i.right=d.magnitude(n)*.5,i.left=-i.right,i.top=o*i.right,i.bottom=-i.top,this._setTransform(e);return}d.clone(n,this.position),d.negate(this.position,this.direction),d.normalize(this.direction,this.direction),d.cross(this.direction,d.UNIT_Z,this.right),d.magnitudeSquared(this.right)<F.EPSILON10&&d.clone(d.UNIT_X,this.right),d.normalize(this.right,this.right),d.cross(this.right,this.direction,this.up),d.normalize(this.up,this.up),this._adjustOrthographicFrustum(!0)};const vC=new ve,gHe=new ve,yHe=new d,AHe=new d,THe=new d,CHe=new d,bHe=new d,EHe=new d,xHe=new d,VB=new d,wHe={direction:new d,right:new d,up:new d};let z6;function Ca(e,t,n,i){return Math.abs(d.dot(t,n))/i-d.dot(e,n)}function lZ(e,t,n,i){const o=e._projection.ellipsoid,r=i?e:wHe,s=t.north,a=t.south;let c=t.east;const u=t.west;u>c&&(c+=F.TWO_PI);const f=(u+c)*.5;let h;if(a<-F.PI_OVER_TWO+F.RADIANS_PER_DEGREE&&s>F.PI_OVER_TWO-F.RADIANS_PER_DEGREE)h=0;else{const H=vC;H.longitude=f,H.latitude=s,H.height=0;const G=gHe;G.longitude=f,G.latitude=a,G.height=0;let I=z6;(!l(I)||I.ellipsoid!==o)&&(z6=I=new fp(void 0,void 0,o)),I.setEndPoints(H,G),h=I.interpolateUsingFraction(.5,vC).latitude}const _=vC;_.longitude=f,_.latitude=h,_.height=0;const g=o.cartographicToCartesian(_,xHe),p=vC;p.longitude=c,p.latitude=s;const y=o.cartographicToCartesian(p,yHe);p.longitude=u;const T=o.cartographicToCartesian(p,THe);p.longitude=f;const b=o.cartographicToCartesian(p,bHe);p.latitude=a;const x=o.cartographicToCartesian(p,EHe);p.longitude=c;const v=o.cartographicToCartesian(p,CHe);p.longitude=u;const D=o.cartographicToCartesian(p,AHe);d.subtract(T,g,T),d.subtract(v,g,v),d.subtract(y,g,y),d.subtract(D,g,D),d.subtract(b,g,b),d.subtract(x,g,x);const L=o.geodeticSurfaceNormal(g,r.direction);d.negate(L,L);const B=d.cross(L,d.UNIT_Z,r.right);d.normalize(B,B);const V=d.cross(B,L,r.up);let M;if(e.frustum instanceof nn){const H=Math.max(d.distance(y,T),d.distance(v,D)),G=Math.max(d.distance(y,v),d.distance(T,D));let I,O;const m=e.frustum._offCenterFrustum.right/e.frustum._offCenterFrustum.top,P=G*m;H>P?(I=H,O=I/m):(O=G,I=P),M=Math.max(I,O)}else{const H=Math.tan(e.frustum.fovy*.5),G=e.frustum.aspectRatio*H;if(M=Math.max(Ca(L,V,T,H),Ca(L,V,v,H),Ca(L,V,y,H),Ca(L,V,D,H),Ca(L,V,b,H),Ca(L,V,x,H),Ca(L,B,T,G),Ca(L,B,v,G),Ca(L,B,y,G),Ca(L,B,D,G),Ca(L,B,b,G),Ca(L,B,x,G)),a<0&&s>0){const I=vC;I.longitude=u,I.latitude=0,I.height=0;let O=o.cartographicToCartesian(I,VB);d.subtract(O,g,O),M=Math.max(M,Ca(L,V,O,H),Ca(L,B,O,G)),I.longitude=c,O=o.cartographicToCartesian(I,VB),d.subtract(O,g,O),M=Math.max(M,Ca(L,V,O,H),Ca(L,B,O,G))}}return d.add(g,d.multiplyByScalar(L,-M,VB),n)}const SHe=new ve,vHe=new d,DHe=new d;function IHe(e,t,n){const i=e._projection;t.west>t.east&&(t=Ee.MAX_VALUE);const o=e._actualTransform,r=e._actualInvTransform,s=SHe;s.longitude=t.east,s.latitude=t.north;const a=i.project(s,vHe);N.multiplyByPoint(o,a,a),N.multiplyByPoint(r,a,a),s.longitude=t.west,s.latitude=t.south;const c=i.project(s,DHe);if(N.multiplyByPoint(o,c,c),N.multiplyByPoint(r,c,c),n.x=(a.x-c.x)*.5+c.x,n.y=(a.y-c.y)*.5+c.y,l(e.frustum.fovy)){const u=Math.tan(e.frustum.fovy*.5),f=e.frustum.aspectRatio*u;n.z=Math.max((a.x-c.x)/f,(a.y-c.y)/u)*.5}else{const u=a.x-c.x,f=a.y-c.y;n.z=Math.max(u,f)}return n}const PHe=new ve,OHe=new d,LHe=new d;function BHe(e,t,n){const i=e._projection;let o=t.east;t.west>t.east&&(e._scene.mapMode2D===Zm.INFINITE_SCROLL?o+=F.TWO_PI:(t=Ee.MAX_VALUE,o=t.east));let r=PHe;r.longitude=o,r.latitude=t.north;const s=i.project(r,OHe);r.longitude=t.west,r.latitude=t.south;const a=i.project(r,LHe),c=Math.abs(s.x-a.x)*.5;let u=Math.abs(s.y-a.y)*.5,f,h;const _=e.frustum.right/e.frustum.top,g=u*_;return c>g?(f=c,h=f/_):(h=u,f=g),u=Math.max(2*f,2*h),n.x=(s.x-a.x)*.5+a.x,n.y=(s.y-a.y)*.5+a.y,r=i.unproject(n,r),r.height=u,n=i.project(r,n),n}Tt.prototype.getRectangleCameraCoordinates=function(e,t){if(!l(e))throw new w("rectangle is required");const n=this._mode;if(l(t)||(t=new d),n===me.SCENE3D)return lZ(this,e,t);if(n===me.COLUMBUS_VIEW)return IHe(this,e,t);if(n===me.SCENE2D)return BHe(this,e,t)};const RHe=new ii;function NHe(e,t,n,i){n=A(n,be.WGS84);const o=e.getPickRay(t,RHe),r=qr.rayEllipsoid(o,n);if(!r)return;const s=r.start>0?r.start:r.stop;return ii.getPoint(o,s,i)}const MHe=new ii;function FHe(e,t,n,i){let r=e.getPickRay(t,MHe).origin;r=d.fromElements(r.y,r.z,0,r);const s=n.unproject(r);if(!(s.latitude<-F.PI_OVER_TWO||s.latitude>F.PI_OVER_TWO))return n.ellipsoid.cartographicToCartesian(s,i)}const zHe=new ii;function UHe(e,t,n,i){const o=e.getPickRay(t,zHe),r=-o.origin.x/o.direction.x;ii.getPoint(o,r,i);const s=n.unproject(new d(i.y,i.z,0));if(!(s.latitude<-F.PI_OVER_TWO||s.latitude>F.PI_OVER_TWO||s.longitude<-Math.PI||s.longitude>Math.PI))return n.ellipsoid.cartographicToCartesian(s,i)}Tt.prototype.pickEllipsoid=function(e,t,n){if(!l(e))throw new w("windowPosition is required.");const i=this._scene.canvas;if(!(i.clientWidth===0||i.clientHeight===0)){if(l(n)||(n=new d),t=A(t,be.WGS84),this._mode===me.SCENE3D)n=NHe(this,e,t,n);else if(this._mode===me.SCENE2D)n=FHe(this,e,this._projection,n);else if(this._mode===me.COLUMBUS_VIEW)n=UHe(this,e,this._projection,n);else return;return n}};const HHe=new d,VHe=new d,kHe=new d;function GHe(e,t,n){const i=e._scene.canvas,o=i.clientWidth,r=i.clientHeight,s=Math.tan(e.frustum.fovy*.5),a=e.frustum.aspectRatio*s,c=e.frustum.near,u=2/o*t.x-1,f=2/r*(r-t.y)-1,h=e.positionWC;d.clone(h,n.origin);const _=d.multiplyByScalar(e.directionWC,c,HHe);d.add(h,_,_);const g=d.multiplyByScalar(e.rightWC,u*c*a,VHe),p=d.multiplyByScalar(e.upWC,f*c*s,kHe),y=d.add(_,g,n.direction);return d.add(y,p,y),d.subtract(y,h,y),d.normalize(y,y),n}const lv=new d;function WHe(e,t,n){const i=e._scene.canvas,o=i.clientWidth,r=i.clientHeight;let s=e.frustum;l(s._offCenterFrustum)&&(s=s._offCenterFrustum);let a=2/o*t.x-1;a*=(s.right-s.left)*.5;let c=2/r*(r-t.y)-1;c*=(s.top-s.bottom)*.5;const u=n.origin;return d.clone(e.position,u),d.multiplyByScalar(e.right,a,lv),d.add(lv,u,u),d.multiplyByScalar(e.up,c,lv),d.add(lv,u,u),d.clone(e.directionWC,n.direction),(e._mode===me.COLUMBUS_VIEW||e._mode===me.SCENE2D)&&d.fromElements(n.origin.z,n.origin.x,n.origin.y,n.origin),n}Tt.prototype.getPickRay=function(e,t){if(!l(e))throw new w("windowPosition is required.");l(t)||(t=new ii);const n=this._scene.canvas;if(n.clientWidth<=0||n.clientHeight<=0)return;const i=this.frustum;return l(i.aspectRatio)&&l(i.fov)&&l(i.near)?GHe(this,e,t):WHe(this,e,t)};const qHe=new d,jHe=new d;Tt.prototype.distanceToBoundingSphere=function(e){if(!l(e))throw new w("boundingSphere is required.");const t=d.subtract(this.positionWC,e.center,qHe),n=d.multiplyByScalar(this.directionWC,d.dot(t,this.directionWC),jHe);return Math.max(0,d.magnitude(n)-e.radius)};const YHe=new $;Tt.prototype.getPixelSize=function(e,t,n){if(!l(e))throw new w("boundingSphere is required.");if(!l(t))throw new w("drawingBufferWidth is required.");if(!l(n))throw new w("drawingBufferHeight is required.");const i=this.distanceToBoundingSphere(e),o=this.frustum.getPixelDimensions(t,n,i,this._scene.pixelRatio,YHe);return Math.max(o.x,o.y)};function $He(e,t,n,i,o,r){const s=d.clone(t);n.y>i?s.y-=n.y-i:n.y<-i&&(s.y+=-i-n.y),n.z>o?s.z-=n.z-o:n.z<-o&&(s.z+=-o-n.z);function a(c){const u=d.lerp(t,s,c.time,new d);e.worldToCameraCoordinatesPoint(u,e.position)}return{easingFunction:_l.EXPONENTIAL_OUT,startObject:{time:0},stopObject:{time:1},duration:r,update:a}}const XHe=new d,U6=new d,KHe=new d,JHe=new d;function QHe(e,t){let n=e.position;const i=e.direction,o=e.worldToCameraCoordinatesVector(d.UNIT_X,XHe),r=-d.dot(o,n)/d.dot(o,i),s=d.add(n,d.multiplyByScalar(i,r,U6),U6);e.cameraToWorldCoordinatesPoint(s,s),n=e.cameraToWorldCoordinatesPoint(e.position,KHe);const a=Math.tan(e.frustum.fovy*.5),c=e.frustum.aspectRatio*a,u=d.magnitude(d.subtract(n,s,JHe)),f=c*u,h=a*u,_=e._maxCoord.x,g=e._maxCoord.y,p=Math.max(f-_,_),y=Math.max(h-g,g);if(n.z<-p||n.z>p||n.y<-y||n.y>y){const T=s.y<-p||s.y>p,b=s.z<-y||s.z>y;if(T||b)return $He(e,n,s,p,y,t)}}Tt.prototype.createCorrectPositionTween=function(e){if(!l(e))throw new w("duration is required.");if(this._mode===me.COLUMBUS_VIEW)return QHe(this,e)};const ZHe=new d,Cs={destination:void 0,heading:void 0,pitch:void 0,roll:void 0,duration:void 0,complete:void 0,cancel:void 0,endTransform:void 0,maximumHeight:void 0,easingFunction:void 0};Tt.prototype.cancelFlight=function(){l(this._currentFlight)&&(this._currentFlight.cancelTween(),this._currentFlight=void 0)};Tt.prototype.completeFlight=function(){if(l(this._currentFlight)){this._currentFlight.cancelTween();const e={destination:void 0,orientation:{heading:void 0,pitch:void 0,roll:void 0}};e.destination=Cs.destination,e.orientation.heading=Cs.heading,e.orientation.pitch=Cs.pitch,e.orientation.roll=Cs.roll,this.setView(e),l(this._currentFlight.complete)&&this._currentFlight.complete(),this._currentFlight=void 0}};Tt.prototype.flyTo=function(e){e=A(e,A.EMPTY_OBJECT);let t=e.destination;if(!l(t))throw new w("destination is required.");if(this._mode===me.MORPHING)return;this.cancelFlight();const i=t instanceof Ee;i&&(t=this.getRectangleCameraCoordinates(t,ZHe));let o=A(e.orientation,A.EMPTY_OBJECT);if(l(o.direction)&&(o=iZ(this,t,o,EF.orientation)),l(e.duration)&&e.duration<=0){const f=EF;f.destination=e.destination,f.orientation.heading=o.heading,f.orientation.pitch=o.pitch,f.orientation.roll=o.roll,f.convert=e.convert,f.endTransform=e.endTransform,this.setView(f),typeof e.complete=="function"&&e.complete();return}const r=this;let s;Cs.destination=t,Cs.heading=o.heading,Cs.pitch=o.pitch,Cs.roll=o.roll,Cs.duration=e.duration,Cs.complete=function(){s===r._currentFlight&&(r._currentFlight=void 0),l(e.complete)&&e.complete()},Cs.cancel=e.cancel,Cs.endTransform=e.endTransform,Cs.convert=i?!1:e.convert,Cs.maximumHeight=e.maximumHeight,Cs.pitchAdjustHeight=e.pitchAdjustHeight,Cs.flyOverLongitude=e.flyOverLongitude,Cs.flyOverLongitudeWeight=e.flyOverLongitudeWeight,Cs.easingFunction=e.easingFunction;const a=this._scene,c=LUe.createTween(a,Cs);if(c.duration===0){typeof c.complete=="function"&&c.complete();return}s=a.tweens.add(c),this._currentFlight=s;let u=this._scene.preloadFlightCamera;this._mode!==me.SCENE2D&&(l(u)||(u=Tt.clone(this)),u.setView({destination:t,orientation:o}),this._scene.preloadFlightCullingVolume=u.frustum.computeCullingVolume(u.positionWC,u.directionWC,u.upWC))};function eVe(e,t){const n=e.frustum,i=Math.tan(n.fovy*.5),o=n.aspectRatio*i;return Math.max(t/o,t/i)}function tVe(e,t){let n=e.frustum;l(n._offCenterFrustum)&&(n=n._offCenterFrustum);let i,o;const r=n.right/n.top,s=t*r;return t>s?(i=t,o=i/r):(o=t,i=s),Math.max(i,o)*1.5}const nVe=100;function uZ(e,t,n){n=ry.clone(l(n)?n:Tt.DEFAULT_OFFSET);const i=e._scene.screenSpaceCameraController.minimumZoomDistance,o=e._scene.screenSpaceCameraController.maximumZoomDistance,r=n.range;if(!l(r)||r===0){const s=t.radius;s===0?n.range=nVe:e.frustum instanceof nn||e._mode===me.SCENE2D?n.range=tVe(e,s):n.range=eVe(e,s),n.range=F.clamp(n.range,i,o)}return n}Tt.prototype.viewBoundingSphere=function(e,t){if(!l(e))throw new w("boundingSphere is required.");if(this._mode===me.MORPHING)throw new w("viewBoundingSphere is not supported while morphing.");t=uZ(this,e,t),this.lookAt(e.center,t)};const iVe=new N,oVe=new d,rVe=new d,sVe=new d,aVe=new d,cVe=new ue,lVe=new De,uVe=new te;Tt.prototype.flyToBoundingSphere=function(e,t){if(!l(e))throw new w("boundingSphere is required.");t=A(t,A.EMPTY_OBJECT);const n=this._mode===me.SCENE2D||this._mode===me.COLUMBUS_VIEW;this._setTransform(N.IDENTITY);const i=uZ(this,e,t.offset);let o;n?o=d.multiplyByScalar(d.UNIT_Z,i.range,oVe):o=cZ(i.heading,i.pitch,i.range);const r=En.eastNorthUpToFixedFrame(e.center,be.WGS84,iVe);N.multiplyByPoint(r,o,o);let s,a;if(!n){if(s=d.subtract(e.center,o,rVe),d.normalize(s,s),a=N.multiplyByPointAsVector(r,d.UNIT_Z,sVe),1-Math.abs(d.dot(s,a))<F.EPSILON6){const u=De.fromAxisAngle(s,i.heading,lVe),f=te.fromQuaternion(u,uVe);d.fromCartesian4(N.getColumn(r,1,cVe),a),te.multiplyByVector(f,a,a)}const c=d.cross(s,a,aVe);d.cross(c,s,a),d.normalize(a,a)}this.flyTo({destination:o,orientation:{direction:s,up:a},duration:t.duration,complete:t.complete,cancel:t.cancel,endTransform:t.endTransform,maximumHeight:t.maximumHeight,easingFunction:t.easingFunction,flyOverLongitude:t.flyOverLongitude,flyOverLongitudeWeight:t.flyOverLongitudeWeight,pitchAdjustHeight:t.pitchAdjustHeight})};const H6=new d,V6=new d,kB=new d,k6=new d,DC=[new d,new d,new d,new d];function fVe(e,t){const n=t.radii,i=e.positionWC,o=d.multiplyComponents(t.oneOverRadii,i,H6),r=d.magnitude(o),s=d.normalize(o,V6);let a,c;d.equalsEpsilon(s,d.UNIT_Z,F.EPSILON10)?(a=new d(0,1,0),c=new d(0,0,1)):(a=d.normalize(d.cross(d.UNIT_Z,s,kB),kB),c=d.normalize(d.cross(s,a,k6),k6));const u=Math.sqrt(d.magnitudeSquared(o)-1),f=d.multiplyByScalar(s,1/r,H6),h=u/r,_=d.multiplyByScalar(a,h,V6),g=d.multiplyByScalar(c,h,kB),p=d.add(f,g,DC[0]);d.subtract(p,_,p),d.multiplyComponents(n,p,p);const y=d.subtract(f,g,DC[1]);d.subtract(y,_,y),d.multiplyComponents(n,y,y);const T=d.subtract(f,g,DC[2]);d.add(T,_,T),d.multiplyComponents(n,T,T);const b=d.add(f,g,DC[3]);return d.add(b,_,b),d.multiplyComponents(n,b,b),DC}const GB=new $,dVe=new d,Em=[new ve,new ve,new ve,new ve];function uv(e,t,n,i,o,r){GB.x=e,GB.y=t;const s=i.pickEllipsoid(GB,o,dVe);return l(s)?(Em[n]=o.cartesianToCartographic(s,Em[n]),1):(Em[n]=o.cartesianToCartographic(r[n],Em[n]),0)}Tt.prototype.computeViewRectangle=function(e,t){e=A(e,be.WGS84);const n=this.frustum.computeCullingVolume(this.positionWC,this.directionWC,this.upWC),i=new Ae(d.ZERO,e.maximumRadius);if(n.computeVisibility(i)===Vn.OUTSIDE)return;const r=this._scene.canvas,s=r.clientWidth,a=r.clientHeight;let c=0;const u=fVe(this,e);if(c+=uv(0,0,0,this,e,u),c+=uv(0,a,1,this,e,u),c+=uv(s,a,2,this,e,u),c+=uv(s,0,3,this,e,u),c<2)return Ee.MAX_VALUE;t=Ee.fromCartographicArray(Em,t);let f=0,h=Em[3].longitude;for(let _=0;_<4;++_){const g=Em[_].longitude,p=Math.abs(g-h);p>F.PI?f+=F.TWO_PI-p:f+=p,h=g}return F.equalsEpsilon(Math.abs(f),F.TWO_PI,F.EPSILON9)&&(t.west=-F.PI,t.east=F.PI,Em[0].latitude>=0?t.north=F.PI_OVER_TWO:t.south=-F.PI_OVER_TWO),t};Tt.prototype.switchToPerspectiveFrustum=function(){if(this._mode===me.SCENE2D||this.frustum instanceof hi)return;const e=this._scene;this.frustum=new hi,this.frustum.aspectRatio=e.drawingBufferWidth/e.drawingBufferHeight,this.frustum.fov=F.toRadians(60)};Tt.prototype.switchToOrthographicFrustum=function(){if(this._mode===me.SCENE2D||this.frustum instanceof nn)return;const e=tZ(this),t=this._scene;this.frustum=new nn,this.frustum.aspectRatio=t.drawingBufferWidth/t.drawingBufferHeight,this.frustum.width=e};Tt.clone=function(e,t){return l(t)||(t=new Tt(e._scene)),d.clone(e.position,t.position),d.clone(e.direction,t.direction),d.clone(e.up,t.up),d.clone(e.right,t.right),N.clone(e._transform,t.transform),t._transformChanged=!0,t.frustum=e.frustum.clone(),t};function qa(e){e=A(e,0),this._array=new Array(e),this._length=e}Object.defineProperties(qa.prototype,{length:{get:function(){return this._length},set:function(e){E.typeOf.number.greaterThanOrEquals("length",e,0);const t=this._array,n=this._length;if(e<n)for(let i=e;i<n;++i)t[i]=void 0;else e>t.length&&(t.length=e);this._length=e}},values:{get:function(){return this._array}}});qa.prototype.get=function(e){return E.typeOf.number.lessThan("index",e,this._array.length),this._array[e]};qa.prototype.set=function(e,t){E.typeOf.number("index",e),e>=this._length&&(this.length=e+1),this._array[e]=t};qa.prototype.peek=function(){return this._array[this._length-1]};qa.prototype.push=function(e){const t=this.length++;this._array[t]=e};qa.prototype.pop=function(){if(this._length===0)return;const e=this._array[this._length-1];return--this.length,e};qa.prototype.reserve=function(e){E.typeOf.number.greaterThanOrEquals("length",e,0),e>this._array.length&&(this._array.length=e)};qa.prototype.resize=function(e){E.typeOf.number.greaterThanOrEquals("length",e,0),this.length=e};qa.prototype.trim=function(e){e=A(e,this._length),this._array.length=e};const hVe={ADD:0,REPLACE:1},_c=Object.freeze(hVe);function Iz(){}const IC={stack:new qa,stackMaximumLength:0};Iz.selectTiles=function(e,t){e._selectedTiles.length=0,e._requestedTiles.length=0,e._hasMixedContent=!1;let n=!0;const i=e.root;if(i.updateVisibility(t),!fZ(i))return n;const o=IC.stack;for(o.push(e.root);o.length>0;){IC.stackMaximumLength=Math.max(IC.stackMaximumLength,o.length);const r=o.pop(),s=r.refine===_c.ADD,a=r.refine===_c.REPLACE,c=mVe(e,r);c&&_Ve(e,r,o,t),(s||a&&!c)&&(gVe(e,r),yVe(e,r,t),TVe(e,r,t),!dZ(r)&&!r.contentAvailable&&(n=!1)),AVe(e)}return IC.stack.trim(IC.stackMaximumLength),n};function fZ(e){return e._visible&&e._inRequestVolume}function dZ(e){return e.hasEmptyContent||e.hasTilesetContent||e.hasImplicitContent}function pVe(e){return!dZ(e)&&e.contentUnloaded}function mVe(e,t){return t.children.length===0?!1:t.hasTilesetContent||t.hasImplicitContent?!t.contentExpired:(t.hasEmptyContent,!0)}function _Ve(e,t,n,i){const o=t.children,r=o.length;for(let s=0;s<r;++s){const a=o[s];a.updateVisibility(i),fZ(a)&&n.push(a)}}function gVe(e,t){(pVe(t)||t.contentExpired)&&(t._priority=0,e._requestedTiles.push(t))}function yVe(e,t,n){t._touchedFrame!==n.frameNumber&&(e._cache.touch(t),t._touchedFrame=n.frameNumber)}function AVe(e){++e.statistics.visited}function TVe(e,t,n){t.contentAvailable&&t.contentVisibility(n)!==Vn.OUTSIDE&&e._selectedTiles.push(t)}const CVe={NOT_COMPUTED:-1,USE_OPTIMIZATION:1,SKIP_OPTIMIZATION:0},pA=Object.freeze(CVe);function Ly(){}function By(e){return e._visible&&e._inRequestVolume}const qb={stack:new qa,stackMaximumLength:0},jb={stack:new qa,stackMaximumLength:0},Yb={stack:new qa,stackMaximumLength:0},nd={stack:new qa,stackMaximumLength:0,ancestorStack:new qa,ancestorStackMaximumLength:0},bVe=2;Ly.selectTiles=function(e,t){if(e._requestedTiles.length=0,e.debugFreezeFrame)return;e._selectedTiles.length=0,e._selectedTilesToStyle.length=0,e._emptyTiles.length=0,e._hasMixedContent=!1;const n=e.root;if(aP(e,n,t),!By(n)||n.getScreenSpaceError(t,!0)<=e._maximumScreenSpaceError)return;DE(e)?e.immediatelyLoadDesiredLevelOfDetail?xVe(e,n,t):wVe(e,n,t):EVe(e,n,t),qb.stack.trim(qb.stackMaximumLength),jb.stack.trim(jb.stackMaximumLength),Yb.stack.trim(Yb.stackMaximumLength),nd.stack.trim(nd.stackMaximumLength),nd.ancestorStack.trim(nd.ancestorStackMaximumLength);const i=e._requestedTiles,o=i.length;for(let r=0;r<o;++r)i[r].updatePriority()};function EVe(e,t,n){const i=e._maximumScreenSpaceError,o=e._maximumScreenSpaceError;Oz(e,t,i,o,n)}function xVe(e,t,n){const i=Number.MAX_VALUE,o=e._maximumScreenSpaceError;Oz(e,t,i,o,n),_Z(e,t,n)}function wVe(e,t,n){const i=Math.max(e.baseScreenSpaceError,e.maximumScreenSpaceError),o=e.maximumScreenSpaceError;Oz(e,t,i,o,n),_Z(e,t,n)}function DE(e){return e._skipLevelOfDetail}function SVe(e,t){e._emptyTiles.push(t)}function $b(e,t,n){if(t.contentVisibility(n)!==Vn.OUTSIDE){const i=t.content;i.featurePropertiesDirty?(i.featurePropertiesDirty=!1,t.lastStyleTime=0,e._selectedTilesToStyle.push(t)):t._selectedFrame<n.frameNumber-1&&e._selectedTilesToStyle.push(t),t._selectedFrame=n.frameNumber,e._selectedTiles.push(t)}}function vVe(e,t,n){const i=Yb.stack;for(i.push(t);i.length>0;){Yb.stackMaximumLength=Math.max(Yb.stackMaximumLength,i.length);const r=i.pop().children,s=r.length;for(let a=0;a<s;++a){const c=r[a];By(c)&&(c.contentAvailable?(aP(e,c,n),sP(e,c,n),$b(e,c,n)):c._depth-t._depth<bVe&&i.push(c))}}}function fv(e,t,n){if(!DE(e)){t.contentAvailable&&$b(e,t,n);return}const i=t.contentAvailable?t:t._ancestorWithContentAvailable;l(i)?i._shouldSelect=!0:vVe(e,t,n)}function DVe(e,t,n){++e._statistics.visited,t._visitedFrame=n.frameNumber}function sP(e,t,n){t._touchedFrame!==n.frameNumber&&(e._cache.touch(t),t._touchedFrame=n.frameNumber)}function IVe(e,t){e._maximumPriority.distance=Math.max(t._priorityHolder._distanceToCamera,e._maximumPriority.distance),e._minimumPriority.distance=Math.min(t._priorityHolder._distanceToCamera,e._minimumPriority.distance),e._maximumPriority.depth=Math.max(t._depth,e._maximumPriority.depth),e._minimumPriority.depth=Math.min(t._depth,e._minimumPriority.depth),e._maximumPriority.foveatedFactor=Math.max(t._priorityHolder._foveatedFactor,e._maximumPriority.foveatedFactor),e._minimumPriority.foveatedFactor=Math.min(t._priorityHolder._foveatedFactor,e._minimumPriority.foveatedFactor),e._maximumPriority.reverseScreenSpaceError=Math.max(t._priorityReverseScreenSpaceError,e._maximumPriority.reverseScreenSpaceError),e._minimumPriority.reverseScreenSpaceError=Math.min(t._priorityReverseScreenSpaceError,e._minimumPriority.reverseScreenSpaceError)}function PVe(e,t,n){if(!e._cullRequestsWhileMoving)return!0;const i=t.boundingSphere,o=Math.max(i.radius*2,1),r=n.camera,s=r.positionWCDeltaMagnitude!==0?r.positionWCDeltaMagnitude:r.positionWCDeltaMagnitudeLastFrame;return e.cullRequestsWhileMovingMultiplier*s/o<1}function vg(e,t,n){if(t._requestedFrame===n.frameNumber||!mZ(t)&&!t.contentExpired||!PVe(e,t,n))return;const i=n.camera.timeSinceMoved<e.foveatedTimeDelay;t.priorityDeferred&&i||(t._requestedFrame=n.frameNumber,e._requestedTiles.push(t))}function hZ(e,t,n){t._updatedVisibilityFrame!==e._updatedVisibilityFrame&&(t.updateVisibility(n),t._updatedVisibilityFrame=e._updatedVisibilityFrame)}function OVe(e,t,n){let i=!1;const o=t.children,r=o.length;for(let s=0;s<r;++s){const a=o[s];hZ(e,a,n),i=i||By(a)}return i}function LVe(e,t,n){const i=t.parent;return!l(i)||i.hasTilesetContent||i.hasImplicitContent||i.refine!==_c.ADD?!1:t.getScreenSpaceError(n,!0)<=e._maximumScreenSpaceError}function pZ(e,t,n){if(hZ(e,t,n),!By(t))return;const i=t.children.length>0;if((t.hasTilesetContent||t.hasImplicitContent)&&i){const s=t.children[0];pZ(e,s,n),t._visible=s._visible;return}if(LVe(e,t,n)){t._visible=!1;return}const o=t.refine===_c.REPLACE,r=t._optimChildrenWithinParent===pA.USE_OPTIMIZATION;if(o&&r&&i&&!OVe(e,t,n)){++e._statistics.numberOfTilesCulledWithChildrenUnion,t._visible=!1;return}}function aP(e,t,n){pZ(e,t,n),t.updateExpiration(),t._wasMinPriorityChild=!1,t._priorityHolder=t,IVe(e,t),t._shouldSelect=!1,t._finalResolution=!0}function BVe(e,t){e._ancestorWithContent=void 0,e._ancestorWithContentAvailable=void 0;const n=e.parent;if(l(n)){const i=!mZ(n)||n._requestedFrame===t.frameNumber;e._ancestorWithContent=i?n:n._ancestorWithContent,e._ancestorWithContentAvailable=n.contentAvailable?n:n._ancestorWithContentAvailable}}function IE(e){return e.hasEmptyContent||e.hasTilesetContent||e.hasImplicitContent}function mZ(e){return!IE(e)&&e.contentUnloaded}function RVe(e,t){const n=t._ancestorWithContent;return!e.immediatelyLoadDesiredLevelOfDetail&&(t._priorityProgressiveResolutionScreenSpaceErrorLeaf||l(n)&&t._screenSpaceError<n._screenSpaceError/e.skipScreenSpaceErrorFactor&&t._depth>n._depth+e.skipLevels)}function NVe(e,t){return t._distanceToCamera===0&&e._distanceToCamera===0?t._centerZDepth-e._centerZDepth:t._distanceToCamera-e._distanceToCamera}function MVe(e,t,n,i){let o;const r=t.refine===_c.REPLACE,s=t.children,a=s.length;for(o=0;o<a;++o)aP(e,s[o],i);s.sort(NVe);const c=!DE(e)&&r&&!IE(t);let u=!0,f=!1,h=-1,_=Number.MAX_VALUE,g;for(o=0;o<a;++o)if(g=s[o],By(g)?(n.push(g),g._foveatedFactor<_&&(h=o,_=g._foveatedFactor),f=!0):(c||e.loadSiblings)&&(g._foveatedFactor<_&&(h=o,_=g._foveatedFactor),vg(e,g,i),sP(e,g,i)),c){let p;g._inRequestVolume?IE(g)?p=zVe(e,g,i):p=g.contentAvailable:p=!1,u=u&&p}if(f||(u=!1),h!==-1&&!DE(e)&&r){const p=s[h];p._wasMinPriorityChild=!0;const y=(t._wasMinPriorityChild||t===e.root)&&_<=t._priorityHolder._foveatedFactor?t._priorityHolder:t;for(y._foveatedFactor=Math.min(p._foveatedFactor,y._foveatedFactor),y._distanceToCamera=Math.min(p._distanceToCamera,y._distanceToCamera),o=0;o<a;++o)g=s[o],g._priorityHolder=y}return u}function FVe(e,t,n){return DE(e)?e.immediatelyLoadDesiredLevelOfDetail?!1:l(t._ancestorWithContent)?t._screenSpaceError===0?t.parent._screenSpaceError>n:t._screenSpaceError>n:!0:!0}function Pz(e,t){return t.children.length===0?!1:t.hasTilesetContent||t.hasImplicitContent?!t.contentExpired:t._screenSpaceError>e._maximumScreenSpaceError}function Oz(e,t,n,i,o){const r=qb.stack;for(r.push(t);r.length>0;){qb.stackMaximumLength=Math.max(qb.stackMaximumLength,r.length);const s=r.pop();BVe(s,o);const a=FVe(e,s,n),c=s.refine===_c.ADD,u=s.refine===_c.REPLACE,f=s.parent,h=!l(f)||f._refines;let _=!1;Pz(e,s)&&(_=MVe(e,s,r,o)&&h);const g=!_&&h;IE(s)?(SVe(e,s),vg(e,s,o),g&&fv(e,s,o)):c?(fv(e,s,o),vg(e,s,o)):u&&(a?(vg(e,s,o),g&&fv(e,s,o)):g?(fv(e,s,o),vg(e,s,o)):RVe(e,s)&&vg(e,s,o)),DVe(e,s,o),sP(e,s,o),s._refines=_}}function zVe(e,t,n){let i=!0;const o=jb.stack;for(o.push(t);o.length>0;){jb.stackMaximumLength=Math.max(jb.stackMaximumLength,o.length);const r=o.pop(),s=r.children,a=s.length,c=IE(r),u=c&&Pz(e,r),f=c&&r.children.length===0;if(!u&&!r.contentAvailable&&!f&&(i=!1),aP(e,r,n),By(r)||(vg(e,r,n),sP(e,r,n)),u)for(let h=0;h<a;++h){const _=s[h];o.push(_)}}return i}function _Z(e,t,n){const i=nd.stack,o=nd.ancestorStack;let r;for(i.push(t);i.length>0||o.length>0;){if(nd.stackMaximumLength=Math.max(nd.stackMaximumLength,i.length),nd.ancestorStackMaximumLength=Math.max(nd.ancestorStackMaximumLength,o.length),o.length>0){const _=o.peek();if(_._stackLength===i.length){o.pop(),_!==r&&(_._finalResolution=!1),$b(e,_,n);continue}}const s=i.pop();if(!l(s))continue;const a=s.refine===_c.ADD,c=s._shouldSelect,u=s.children,f=u.length,h=Pz(e,s);if(c)if(a)$b(e,s,n);else{if(s._selectionDepth=o.length,s._selectionDepth>0&&(e._hasMixedContent=!0),r=s,!h){$b(e,s,n);continue}o.push(s),s._stackLength=i.length}if(h)for(let _=0;_<f;++_){const g=u[_];By(g)&&i.push(g)}}}const Df={RENDER:0,PICK:1,SHADOW:2,PRELOAD:3,PRELOAD_FLIGHT:4,REQUEST_RENDER_MODE_DEFER_CHECK:5,MOST_DETAILED_PRELOAD:6,MOST_DETAILED_PICK:7,NUMBER_OF_PASSES:8},dp=new Array(Df.NUMBER_OF_PASSES);dp[Df.RENDER]=Object.freeze({traversal:Ly,isRender:!0,requestTiles:!0,ignoreCommands:!1});dp[Df.PICK]=Object.freeze({traversal:Ly,isRender:!1,requestTiles:!1,ignoreCommands:!1});dp[Df.SHADOW]=Object.freeze({traversal:Ly,isRender:!1,requestTiles:!0,ignoreCommands:!1});dp[Df.PRELOAD]=Object.freeze({traversal:Ly,isRender:!1,requestTiles:!0,ignoreCommands:!0});dp[Df.PRELOAD_FLIGHT]=Object.freeze({traversal:Ly,isRender:!1,requestTiles:!0,ignoreCommands:!0});dp[Df.REQUEST_RENDER_MODE_DEFER_CHECK]=Object.freeze({traversal:Ly,isRender:!1,requestTiles:!0,ignoreCommands:!0});dp[Df.MOST_DETAILED_PRELOAD]=Object.freeze({traversal:Iz,isRender:!1,requestTiles:!0,ignoreCommands:!0});dp[Df.MOST_DETAILED_PICK]=Object.freeze({traversal:Iz,isRender:!1,requestTiles:!1,ignoreCommands:!1});Df.getPassOptions=function(e){return dp[e]};const Va=Object.freeze(Df);function Ry(e){E.typeOf.object("options",e),E.typeOf.number("options.pass",e.pass),this.pass=e.pass,this.commandList=e.commandList,this.camera=e.camera,this.cullingVolume=e.cullingVolume,this.ready=!1}function Vt(){this._array=[],this._hash={}}Object.defineProperties(Vt.prototype,{length:{get:function(){return this._array.length}},values:{get:function(){return this._array}}});Vt.prototype.contains=function(e){if(typeof e!="string"&&typeof e!="number")throw new w("key is required to be a string or number.");return l(this._hash[e])};Vt.prototype.set=function(e,t){if(typeof e!="string"&&typeof e!="number")throw new w("key is required to be a string or number.");const n=this._hash[e];t!==n&&(this.remove(e),this._hash[e]=t,this._array.push(t))};Vt.prototype.get=function(e){if(typeof e!="string"&&typeof e!="number")throw new w("key is required to be a string or number.");return this._hash[e]};Vt.prototype.remove=function(e){if(l(e)&&typeof e!="string"&&typeof e!="number")throw new w("key is required to be a string or number.");const t=this._hash[e],n=l(t);if(n){const i=this._array;i.splice(i.indexOf(t),1),delete this._hash[e]}return n};Vt.prototype.removeAll=function(){const e=this._array;e.length>0&&(this._hash={},e.length=0)};const G6=576,UVe=100,PC="#ffffff",WB="#48b";function gZ(e,t){this.credit=e,this.count=A(t,1)}function HVe(e,t){const n=e.length;for(let i=0;i<n;i++){const o=e[i];if(Si.equals(o,t))return!0}return!1}function VVe(e){const t=e._previousCesiumCredit,n=e._currentCesiumCredit;Si.equals(n,t)||(l(t)&&e._cesiumCreditContainer.removeChild(t.element),l(n)&&e._cesiumCreditContainer.appendChild(n.element),e._previousCesiumCredit=n)}const yZ="cesium-credit-delimiter";function W6(e){const t=document.createElement("span");return t.textContent=e,t.className=yZ,t}function q6(e,t){if(l(t)){const n=document.createElement(t);n._creditId=e._creditId,n.appendChild(e),e=n}return e}function j6(e,t,n,i){const o=e.childNodes;let r=-1;t.sort(function(s,a){return a.count-s.count});for(let s=0;s<t.length;++s){const a=t[s].credit;if(l(a)){if(r=s,l(n)&&(r*=2,s>0)){const u=r-1;if(o.length<=u)e.appendChild(W6(n));else{const f=o[u];f.className!==yZ&&e.replaceChild(W6(n),f)}}const c=a.element;if(o.length<=r)e.appendChild(q6(c,i));else{const u=o[r];u._creditId!==a._id&&e.replaceChild(q6(c,i),u)}}}for(++r;r<o.length;)e.removeChild(o[r])}function kVe(e){const t=e._lightboxCredits,n=e.viewport.clientWidth,i=e.viewport.clientHeight;n!==e._lastViewportWidth&&(n<G6?(t.className="cesium-credit-lightbox cesium-credit-lightbox-mobile",t.style.marginTop="0"):(t.className="cesium-credit-lightbox cesium-credit-lightbox-expanded",t.style.marginTop=`${Math.floor((i-t.clientHeight)*.5)}px`),e._lastViewportWidth=n),n>=G6&&i!==e._lastViewportHeight&&(t.style.marginTop=`${Math.floor((i-t.clientHeight)*.5)}px`,e._lastViewportHeight=i)}function ba(e,t){let n=`${e} {`;for(const i in t)t.hasOwnProperty(i)&&(n+=`${i}: ${t[i]}; `);return n+=` }
|
||
`,n}function GVe(){let e="";e+=ba(".cesium-credit-lightbox-overlay",{display:"none","z-index":"1",position:"absolute",top:"0",left:"0",width:"100%",height:"100%","background-color":"rgba(80, 80, 80, 0.8)"}),e+=ba(".cesium-credit-lightbox",{"background-color":"#303336",color:PC,position:"relative","min-height":`${UVe}px`,margin:"auto"}),e+=ba(".cesium-credit-lightbox > ul > li a, .cesium-credit-lightbox > ul > li a:visited",{color:PC}),e+=ba(".cesium-credit-lightbox > ul > li a:hover",{color:WB}),e+=ba(".cesium-credit-lightbox.cesium-credit-lightbox-expanded",{border:"1px solid #444","border-radius":"5px","max-width":"370px"}),e+=ba(".cesium-credit-lightbox.cesium-credit-lightbox-mobile",{height:"100%",width:"100%"}),e+=ba(".cesium-credit-lightbox-title",{padding:"20px 20px 0 20px"}),e+=ba(".cesium-credit-lightbox-close",{"font-size":"18pt",cursor:"pointer",position:"absolute",top:"0",right:"6px",color:PC}),e+=ba(".cesium-credit-lightbox-close:hover",{color:WB}),e+=ba(".cesium-credit-lightbox > ul",{margin:"0",padding:"12px 20px 12px 40px","font-size":"13px"}),e+=ba(".cesium-credit-lightbox > ul > li",{"padding-bottom":"6px"}),e+=ba(".cesium-credit-lightbox > ul > li *",{padding:"0",margin:"0"}),e+=ba(".cesium-credit-expand-link",{"padding-left":"5px",cursor:"pointer","text-decoration":"underline",color:PC}),e+=ba(".cesium-credit-expand-link:hover",{color:WB}),e+=ba(".cesium-credit-text",{color:PC}),e+=ba(".cesium-credit-textContainer *, .cesium-credit-logoContainer *",{display:"inline"});const t=document.head,n=document.createElement("style");n.innerHTML=e,t.insertBefore(n,t.firstChild)}function _r(e,t,n){E.defined("container",e);const i=this;n=A(n,document.body);const o=document.createElement("div");o.className="cesium-credit-lightbox-overlay",n.appendChild(o);const r=document.createElement("div");r.className="cesium-credit-lightbox",o.appendChild(r);function s(p){r.contains(p.target)||i.hideLightbox()}o.addEventListener("click",s,!1);const a=document.createElement("div");a.className="cesium-credit-lightbox-title",a.textContent="Data provided by:",r.appendChild(a);const c=document.createElement("a");c.onclick=this.hideLightbox.bind(this),c.innerHTML="×",c.className="cesium-credit-lightbox-close",r.appendChild(c);const u=document.createElement("ul");r.appendChild(u);const f=document.createElement("div");f.className="cesium-credit-logoContainer",f.style.display="inline",e.appendChild(f);const h=document.createElement("div");h.className="cesium-credit-textContainer",h.style.display="inline",e.appendChild(h);const _=document.createElement("a");_.className="cesium-credit-expand-link",_.onclick=this.showLightbox.bind(this),_.textContent="Data attribution",e.appendChild(_),GVe();const g=Si.clone(_r.cesiumCredit);this._delimiter=A(t," • "),this._screenContainer=h,this._cesiumCreditContainer=f,this._lastViewportHeight=void 0,this._lastViewportWidth=void 0,this._lightboxCredits=r,this._creditList=u,this._lightbox=o,this._hideLightbox=s,this._expandLink=_,this._expanded=!1,this._defaultCredits=[],this._cesiumCredit=g,this._previousCesiumCredit=void 0,this._currentCesiumCredit=g,this._creditDisplayElementPool=[],this._creditDisplayElementIndex=0,this._currentFrameCredits={screenCredits:new Vt,lightboxCredits:new Vt},this._defaultCredit=void 0,this.viewport=n,this.container=e}function AZ(e,t,n,i){i=A(i,1);let o=t.get(n.id);if(l(o))o.count<Number.MAX_VALUE&&(o.count+=i);else{const r=e._creditDisplayElementPool,s=e._creditDisplayElementPoolIndex;s<r.length?(o=r[s],o.credit=n,o.count=i):(o=new gZ(n,i),r.push(o)),++e._creditDisplayElementPoolIndex,t.set(n.id,o)}}_r.prototype.addCredit=function(e){if(E.defined("credit",e),e._isIon){l(this._defaultCredit)||(this._defaultCredit=Si.clone(TZ())),this._currentCesiumCredit=this._defaultCredit;return}let t;e.showOnScreen?t=this._currentFrameCredits.screenCredits:t=this._currentFrameCredits.lightboxCredits,AZ(this,t,e)};_r.prototype.addDefaultCredit=function(e){E.defined("credit",e);const t=this._defaultCredits;HVe(t,e)||t.push(e)};_r.prototype.removeDefaultCredit=function(e){E.defined("credit",e);const t=this._defaultCredits,n=t.indexOf(e);n!==-1&&t.splice(n,1)};_r.prototype.showLightbox=function(){this._lightbox.style.display="block",this._expanded=!0};_r.prototype.hideLightbox=function(){this._lightbox.style.display="none",this._expanded=!1};_r.prototype.update=function(){this._expanded&&kVe(this)};_r.prototype.beginFrame=function(){const e=this._currentFrameCredits;this._creditDisplayElementPoolIndex=0;const t=e.screenCredits;t.removeAll();const n=this._defaultCredits;for(let i=0;i<n.length;++i){const o=n[i];AZ(this,t,o,Number.MAX_VALUE)}e.lightboxCredits.removeAll(),Si.equals(_r.cesiumCredit,this._cesiumCredit)||(this._cesiumCredit=Si.clone(_r.cesiumCredit)),this._currentCesiumCredit=this._cesiumCredit};_r.prototype.endFrame=function(){const e=this._currentFrameCredits.screenCredits.values;j6(this._screenContainer,e,this._delimiter,void 0);const t=this._currentFrameCredits.lightboxCredits.values;this._expandLink.style.display=t.length>0?"inline":"none",j6(this._creditList,t,void 0,"li"),VVe(this)};_r.prototype.destroy=function(){return this._lightbox.removeEventListener("click",this._hideLightbox,!1),this.container.removeChild(this._cesiumCreditContainer),this.container.removeChild(this._screenContainer),this.container.removeChild(this._expandLink),this.viewport.removeChild(this._lightbox),Je(this)};_r.prototype.isDestroyed=function(){return!1};_r._cesiumCredit=void 0;_r._cesiumCreditInitialized=!1;let dv;function TZ(){if(!l(dv)){let e=Un("Assets/Images/ion-credit.png");e.indexOf("http://")!==0&&e.indexOf("https://")!==0&&e.indexOf("data:")!==0&&(e=new ha(e).path()),dv=new Si(`<a href="https://cesium.com/" target="_blank"><img src="${e}" title="Cesium ion"/></a>`,!0)}return _r._cesiumCreditInitialized||(_r._cesiumCredit=dv,_r._cesiumCreditInitialized=!0),dv}Object.defineProperties(_r,{cesiumCredit:{get:function(){return TZ(),_r._cesiumCredit},set:function(e){_r._cesiumCredit=e,_r._cesiumCreditInitialized=!0}}});_r.CreditDisplayElement=gZ;const cP=0,WVe=1;function e_(e){E.typeOf.object("options",e),E.typeOf.object("options.frustum",e.frustum),E.typeOf.object("options.origin",e.origin),E.typeOf.object("options.orientation",e.orientation);const t=e.frustum,n=e.orientation,i=e.origin,o=A(e.vertexFormat,Ye.DEFAULT),r=A(e._drawNearPlane,!0);let s,a;t instanceof hi?(s=cP,a=hi.packedLength):t instanceof nn&&(s=WVe,a=nn.packedLength),this._frustumType=s,this._frustum=t.clone(),this._origin=d.clone(i),this._orientation=De.clone(n),this._drawNearPlane=r,this._vertexFormat=o,this._workerName="createFrustumGeometry",this.packedLength=2+a+d.packedLength+De.packedLength+Ye.packedLength}e_.pack=function(e,t,n){E.typeOf.object("value",e),E.defined("array",t),n=A(n,0);const i=e._frustumType,o=e._frustum;return t[n++]=i,i===cP?(hi.pack(o,t,n),n+=hi.packedLength):(nn.pack(o,t,n),n+=nn.packedLength),d.pack(e._origin,t,n),n+=d.packedLength,De.pack(e._orientation,t,n),n+=De.packedLength,Ye.pack(e._vertexFormat,t,n),n+=Ye.packedLength,t[n]=e._drawNearPlane?1:0,t};const qVe=new hi,jVe=new nn,YVe=new De,$Ve=new d,XVe=new Ye;e_.unpack=function(e,t,n){E.defined("array",e),t=A(t,0);const i=e[t++];let o;i===cP?(o=hi.unpack(e,t,qVe),t+=hi.packedLength):(o=nn.unpack(e,t,jVe),t+=nn.packedLength);const r=d.unpack(e,t,$Ve);t+=d.packedLength;const s=De.unpack(e,t,YVe);t+=De.packedLength;const a=Ye.unpack(e,t,XVe);t+=Ye.packedLength;const c=e[t]===1;if(!l(n))return new e_({frustum:o,origin:r,orientation:s,vertexFormat:a,_drawNearPlane:c});const u=i===n._frustumType?n._frustum:void 0;return n._frustum=o.clone(u),n._frustumType=i,n._origin=d.clone(r,n._origin),n._orientation=De.clone(s,n._orientation),n._vertexFormat=Ye.clone(a,n._vertexFormat),n._drawNearPlane=c,n};function v0(e,t,n,i,o,r,s,a){const c=e/3*2;for(let u=0;u<4;++u)l(t)&&(t[e]=r.x,t[e+1]=r.y,t[e+2]=r.z),l(n)&&(n[e]=s.x,n[e+1]=s.y,n[e+2]=s.z),l(i)&&(i[e]=a.x,i[e+1]=a.y,i[e+2]=a.z),e+=3;o[c]=0,o[c+1]=0,o[c+2]=1,o[c+3]=0,o[c+4]=1,o[c+5]=1,o[c+6]=0,o[c+7]=1}const KVe=new te,JVe=new N,qB=new N,CZ=new d,bZ=new d,EZ=new d,QVe=new d,ZVe=new d,e4e=new d,Jp=new Array(3),bx=new Array(4);bx[0]=new ue(-1,-1,1,1);bx[1]=new ue(1,-1,1,1);bx[2]=new ue(1,1,1,1);bx[3]=new ue(-1,1,1,1);const xZ=new Array(4);for(let e=0;e<4;++e)xZ[e]=new ue;e_._computeNearFarPlanes=function(e,t,n,i,o,r,s,a){const c=te.fromQuaternion(t,KVe);let u=A(r,CZ),f=A(s,bZ),h=A(a,EZ);u=te.getColumn(c,0,u),f=te.getColumn(c,1,f),h=te.getColumn(c,2,h),d.normalize(u,u),d.normalize(f,f),d.normalize(h,h),d.negate(u,u);const _=N.computeView(e,h,f,u,JVe);let g,p;if(n===cP){const y=i.projectionMatrix,T=N.multiply(y,_,qB);p=N.inverse(T,qB)}else g=N.inverseTransformation(_,qB);l(p)?(Jp[0]=i.near,Jp[1]=i.far):(Jp[0]=0,Jp[1]=i.near,Jp[2]=i.far);for(let y=0;y<2;++y)for(let T=0;T<4;++T){let b=ue.clone(bx[T],xZ[T]);if(l(p)){b=N.multiplyByVector(p,b,b);const x=1/b.w;d.multiplyByScalar(b,x,b),d.subtract(b,e,b),d.normalize(b,b);const v=d.dot(h,b);d.multiplyByScalar(b,Jp[y]/v,b),d.add(b,e,b)}else{l(i._offCenterFrustum)&&(i=i._offCenterFrustum);const x=Jp[y],v=Jp[y+1];b.x=(b.x*(i.right-i.left)+i.left+i.right)*.5,b.y=(b.y*(i.top-i.bottom)+i.bottom+i.top)*.5,b.z=(b.z*(x-v)-x-v)*.5,b.w=1,N.multiplyByVector(g,b,b)}o[12*y+T*3]=b.x,o[12*y+T*3+1]=b.y,o[12*y+T*3+2]=b.z}};e_.createGeometry=function(e){const t=e._frustumType,n=e._frustum,i=e._origin,o=e._orientation,r=e._drawNearPlane,s=e._vertexFormat,a=r?6:5;let c=new Float64Array(3*4*6);e_._computeNearFarPlanes(i,o,t,n,c);let u=3*4*2;c[u]=c[3*4],c[u+1]=c[3*4+1],c[u+2]=c[3*4+2],c[u+3]=c[0],c[u+4]=c[1],c[u+5]=c[2],c[u+6]=c[3*3],c[u+7]=c[3*3+1],c[u+8]=c[3*3+2],c[u+9]=c[3*7],c[u+10]=c[3*7+1],c[u+11]=c[3*7+2],u+=3*4,c[u]=c[3*5],c[u+1]=c[3*5+1],c[u+2]=c[3*5+2],c[u+3]=c[3],c[u+4]=c[3+1],c[u+5]=c[3+2],c[u+6]=c[0],c[u+7]=c[1],c[u+8]=c[2],c[u+9]=c[3*4],c[u+10]=c[3*4+1],c[u+11]=c[3*4+2],u+=3*4,c[u]=c[3],c[u+1]=c[3+1],c[u+2]=c[3+2],c[u+3]=c[3*5],c[u+4]=c[3*5+1],c[u+5]=c[3*5+2],c[u+6]=c[3*6],c[u+7]=c[3*6+1],c[u+8]=c[3*6+2],c[u+9]=c[3*2],c[u+10]=c[3*2+1],c[u+11]=c[3*2+2],u+=3*4,c[u]=c[3*2],c[u+1]=c[3*2+1],c[u+2]=c[3*2+2],c[u+3]=c[3*6],c[u+4]=c[3*6+1],c[u+5]=c[3*6+2],c[u+6]=c[3*7],c[u+7]=c[3*7+1],c[u+8]=c[3*7+2],c[u+9]=c[3*3],c[u+10]=c[3*3+1],c[u+11]=c[3*3+2],r||(c=c.subarray(3*4));const f=new To({position:new Xe({componentDatatype:oe.DOUBLE,componentsPerAttribute:3,values:c})});if(l(s.normal)||l(s.tangent)||l(s.bitangent)||l(s.st)){const _=l(s.normal)?new Float32Array(12*a):void 0,g=l(s.tangent)?new Float32Array(3*4*a):void 0,p=l(s.bitangent)?new Float32Array(3*4*a):void 0,y=l(s.st)?new Float32Array(2*4*a):void 0,T=CZ,b=bZ,x=EZ,v=d.negate(T,QVe),D=d.negate(b,ZVe),L=d.negate(x,e4e);u=0,r&&(v0(u,_,g,p,y,L,T,b),u+=3*4),v0(u,_,g,p,y,x,v,b),u+=3*4,v0(u,_,g,p,y,v,L,b),u+=3*4,v0(u,_,g,p,y,D,L,v),u+=3*4,v0(u,_,g,p,y,T,x,b),u+=3*4,v0(u,_,g,p,y,b,x,v),l(_)&&(f.normal=new Xe({componentDatatype:oe.FLOAT,componentsPerAttribute:3,values:_})),l(g)&&(f.tangent=new Xe({componentDatatype:oe.FLOAT,componentsPerAttribute:3,values:g})),l(p)&&(f.bitangent=new Xe({componentDatatype:oe.FLOAT,componentsPerAttribute:3,values:p})),l(y)&&(f.st=new Xe({componentDatatype:oe.FLOAT,componentsPerAttribute:2,values:y}))}const h=new Uint16Array(6*a);for(let _=0;_<a;++_){const g=_*6,p=_*4;h[g]=p,h[g+1]=p+1,h[g+2]=p+2,h[g+3]=p,h[g+4]=p+2,h[g+5]=p+3}return new $t({attributes:f,indices:h,primitiveType:dt.TRIANGLES,boundingSphere:Ae.fromVertices(c)})};const Lz=0,t4e=1;function PE(e){E.typeOf.object("options",e),E.typeOf.object("options.frustum",e.frustum),E.typeOf.object("options.origin",e.origin),E.typeOf.object("options.orientation",e.orientation);const t=e.frustum,n=e.orientation,i=e.origin,o=A(e._drawNearPlane,!0);let r,s;t instanceof hi?(r=Lz,s=hi.packedLength):t instanceof nn&&(r=t4e,s=nn.packedLength),this._frustumType=r,this._frustum=t.clone(),this._origin=d.clone(i),this._orientation=De.clone(n),this._drawNearPlane=o,this._workerName="createFrustumOutlineGeometry",this.packedLength=2+s+d.packedLength+De.packedLength}PE.pack=function(e,t,n){E.typeOf.object("value",e),E.defined("array",t),n=A(n,0);const i=e._frustumType,o=e._frustum;return t[n++]=i,i===Lz?(hi.pack(o,t,n),n+=hi.packedLength):(nn.pack(o,t,n),n+=nn.packedLength),d.pack(e._origin,t,n),n+=d.packedLength,De.pack(e._orientation,t,n),n+=De.packedLength,t[n]=e._drawNearPlane?1:0,t};const n4e=new hi,i4e=new nn,o4e=new De,r4e=new d;PE.unpack=function(e,t,n){E.defined("array",e),t=A(t,0);const i=e[t++];let o;i===Lz?(o=hi.unpack(e,t,n4e),t+=hi.packedLength):(o=nn.unpack(e,t,i4e),t+=nn.packedLength);const r=d.unpack(e,t,r4e);t+=d.packedLength;const s=De.unpack(e,t,o4e);t+=De.packedLength;const a=e[t]===1;if(!l(n))return new PE({frustum:o,origin:r,orientation:s,_drawNearPlane:a});const c=i===n._frustumType?n._frustum:void 0;return n._frustum=o.clone(c),n._frustumType=i,n._origin=d.clone(r,n._origin),n._orientation=De.clone(s,n._orientation),n._drawNearPlane=a,n};PE.createGeometry=function(e){const t=e._frustumType,n=e._frustum,i=e._origin,o=e._orientation,r=e._drawNearPlane,s=new Float64Array(3*4*2);e_._computeNearFarPlanes(i,o,t,n,s);const a=new To({position:new Xe({componentDatatype:oe.DOUBLE,componentsPerAttribute:3,values:s})});let c,u;const f=r?2:1,h=new Uint16Array(8*(f+1));let _=r?0:1;for(;_<2;++_)c=r?_*8:0,u=_*4,h[c]=u,h[c+1]=u+1,h[c+2]=u+1,h[c+3]=u+2,h[c+4]=u+2,h[c+5]=u+3,h[c+6]=u+3,h[c+7]=u;for(_=0;_<2;++_)c=(f+_)*8,u=_*4,h[c]=u,h[c+1]=u+4,h[c+2]=u+1,h[c+3]=u+5,h[c+4]=u+2,h[c+5]=u+6,h[c+6]=u+3,h[c+7]=u+7;return new $t({attributes:a,indices:h,primitiveType:dt.LINES,boundingSphere:Ae.fromVertices(s)})};function xm(e){if(e=A(e,A.EMPTY_OBJECT),!l(e.camera))throw new w("options.camera is required.");this._camera=e.camera,this._frustumSplits=e.frustumSplits,this._color=A(e.color,k.CYAN),this._updateOnChange=A(e.updateOnChange,!0),this.show=A(e.show,!0),this.id=e.id,this._id=void 0,this._outlinePrimitives=[],this._planesPrimitives=[]}const s4e=new d,a4e=new te,c4e=new De,l4e=new hi,u4e=new Wa,f4e=new nn,d4e=new yr,h4e=new k,p4e=[1,1e5];xm.prototype.update=function(e){if(!this.show)return;const t=this._planesPrimitives,n=this._outlinePrimitives;let i,o;if(this._updateOnChange){for(o=t.length,i=0;i<o;++i)n[i]=n[i]&&n[i].destroy(),t[i]=t[i]&&t[i].destroy();t.length=0,n.length=0}if(t.length===0){const r=this._camera,s=r.frustum;let a;s instanceof hi?a=l4e:s instanceof Wa?a=u4e:s instanceof nn?a=f4e:a=d4e,a=s.clone(a);let c,u=this._frustumSplits;!l(u)||u.length<=1?(u=p4e,u[0]=this._camera.frustum.near,u[1]=this._camera.frustum.far,c=1):c=u.length-1;const f=r.positionWC,h=r.directionWC,_=r.upWC;let g=r.rightWC;g=d.negate(g,s4e);const p=a4e;te.setColumn(p,0,g,p),te.setColumn(p,1,_,p),te.setColumn(p,2,h,p);const y=De.fromRotationMatrix(p,c4e);for(t.length=n.length=c,i=0;i<c;++i)a.near=u[i],a.far=u[i+1],t[i]=new fn({geometryInstances:new xn({geometry:new e_({origin:f,orientation:y,frustum:a,_drawNearPlane:i===0}),attributes:{color:Bn.fromColor(k.fromAlpha(this._color,.1,h4e))},id:this.id,pickPrimitive:this}),appearance:new kn({translucent:!0,flat:!0}),asynchronous:!1}),n[i]=new fn({geometryInstances:new xn({geometry:new PE({origin:f,orientation:y,frustum:a,_drawNearPlane:i===0}),attributes:{color:Bn.fromColor(this._color)},id:this.id,pickPrimitive:this}),appearance:new kn({translucent:!1,flat:!0}),asynchronous:!1})}for(o=t.length,i=0;i<o;++i)n[i].update(e),t[i].update(e)};xm.prototype.isDestroyed=function(){return!1};xm.prototype.destroy=function(){const e=this._planesPrimitives.length;for(let t=0;t<e;++t)this._outlinePrimitives[t]=this._outlinePrimitives[t]&&this._outlinePrimitives[t].destroy(),this._planesPrimitives[t]=this._planesPrimitives[t]&&this._planesPrimitives[t].destroy();return Je(this)};function Ex(e){this._rs=void 0,this._sp=void 0,this._va=void 0,this._command=void 0,this._mode=void 0,this._useLogDepth=!1,this._ellipsoidOffset=A(e,0)}const OC=Mn.supportsTypedArrays()?new Float32Array(12):[],Y6=new d,$6=new d,jB=new d,X6=new d,hv=new d;function m4e(e,t){const n=e.radii,i=t.camera;let o,r,s;if(i.frustum instanceof nn)o=d.ZERO,r=i.rightWC,s=i.upWC;else{const h=i.positionWC,_=d.multiplyComponents(e.oneOverRadii,h,Y6),g=d.normalize(_,$6),p=d.normalize(d.cross(d.UNIT_Z,_,jB),jB),y=d.normalize(d.cross(g,p,X6),X6),T=d.magnitude(_),b=Math.sqrt(T*T-1);o=d.multiplyByScalar(g,1/T,Y6);const x=b/T;r=d.multiplyByScalar(p,x,$6),s=d.multiplyByScalar(y,x,jB)}const a=d.add(o,s,hv);d.subtract(a,r,a),d.multiplyComponents(n,a,a),d.pack(a,OC,0);const c=d.subtract(o,s,hv);d.subtract(c,r,c),d.multiplyComponents(n,c,c),d.pack(c,OC,3);const u=d.add(o,s,hv);d.add(u,r,u),d.multiplyComponents(n,u,u),d.pack(u,OC,6);const f=d.subtract(o,s,hv);return d.add(f,r,f),d.multiplyComponents(n,f,f),d.pack(f,OC,9),OC}Ex.prototype.update=function(e){if(this._mode=e.mode,e.mode!==me.SCENE3D)return;const t=e.context,n=e.mapProjection.ellipsoid.radii,i=new be(n.x+this._ellipsoidOffset,n.y+this._ellipsoidOffset,n.z+this._ellipsoidOffset),o=e.useLogDepth;if(l(this._command)||(this._rs=ht.fromCache({cull:{enabled:!0},depthTest:{enabled:!0},colorMask:{red:!1,green:!1,blue:!1,alpha:!1}}),this._command=new Dt({renderState:this._rs,boundingVolume:new Ae(d.ZERO,i.maximumRadius),pass:We.OPAQUE,owner:this})),!l(this._sp)||this._useLogDepth!==o){this._useLogDepth=o;const s=new nt({sources:[POe]}),a=new nt({sources:[IOe]});if(o){const c=`#ifdef GL_EXT_frag_depth
|
||
#extension GL_EXT_frag_depth : enable
|
||
#endif
|
||
|
||
`;a.sources.push(c),a.defines.push("LOG_DEPTH"),s.defines.push("LOG_DEPTH")}this._sp=Hn.replaceCache({shaderProgram:this._sp,context:t,vertexShaderSource:s,fragmentShaderSource:a,attributeLocations:{position:0}}),this._command.shaderProgram=this._sp}const r=m4e(i,e);if(l(this._va))this._va.getAttribute(0).vertexBuffer.copyFromArrayView(r);else{const s=new $t({attributes:{position:new Xe({componentDatatype:oe.FLOAT,componentsPerAttribute:3,values:r})},indices:[0,1,2,2,1,3],primitiveType:dt.TRIANGLES});this._va=Fo.fromGeometry({context:t,geometry:s,attributeLocations:{position:0},bufferUsage:mt.DYNAMIC_DRAW}),this._command.vertexArray=this._va}};Ex.prototype.execute=function(e,t){this._mode===me.SCENE3D&&this._command.execute(e,t)};Ex.prototype.isDestroyed=function(){return!1};Ex.prototype.destroy=function(){this._sp=this._sp&&this._sp.destroy(),this._va=this._va&&this._va.destroy()};function Fh(){}const _4e=/\bgl_FragDepthEXT\b/,g4e=/\bdiscard\b/;function y4e(e,t){let n=e.shaderCache.getDerivedShaderProgram(t,"depthOnly");if(!l(n)){const i=t._attributeLocations;let o=t.fragmentShaderSource,r,s=!1;const a=o.sources;let c=a.length;for(r=0;r<c;++r)if(_4e.test(a[r])||g4e.test(a[r])){s=!0;break}let u=!1;const f=o.defines;for(c=f.length,r=0;r<c;++r)if(f[r]==="LOG_DEPTH"){u=!0;break}let h;!s&&!u?(h=`void main()
|
||
{
|
||
gl_FragColor = vec4(1.0);
|
||
}
|
||
`,o=new nt({sources:[h]})):!s&&u&&(h=`#ifdef GL_EXT_frag_depth
|
||
#extension GL_EXT_frag_depth : enable
|
||
#endif
|
||
|
||
void main()
|
||
{
|
||
gl_FragColor = vec4(1.0);
|
||
czm_writeLogDepth();
|
||
}
|
||
`,o=new nt({defines:["LOG_DEPTH"],sources:[h]})),n=e.shaderCache.createDerivedShaderProgram(t,"depthOnly",{vertexShaderSource:t.vertexShaderSource,fragmentShaderSource:o,attributeLocations:i})}return n}function A4e(e,t){const n=e._depthOnlyRenderStateCache;let i=n[t.id];if(!l(i)){const o=ht.getState(t);o.depthMask=!0,o.colorMask={red:!1,green:!1,blue:!1,alpha:!1},i=ht.fromCache(o),n[t.id]=i}return i}Fh.createDepthOnlyDerivedCommand=function(e,t,n,i){l(i)||(i={});let o,r;return l(i.depthOnlyCommand)&&(o=i.depthOnlyCommand.shaderProgram,r=i.depthOnlyCommand.renderState),i.depthOnlyCommand=Dt.shallowClone(t,i.depthOnlyCommand),!l(o)||i.shaderProgramId!==t.shaderProgram.id?(i.depthOnlyCommand.shaderProgram=y4e(n,t.shaderProgram),i.depthOnlyCommand.renderState=A4e(e,t.renderState),i.shaderProgramId=t.shaderProgram.id):(i.depthOnlyCommand.shaderProgram=o,i.depthOnlyCommand.renderState=r),i};const T4e=/\s+czm_writeLogDepth\(/,C4e=/\s+czm_vertexLogDepth\(/,b4e=/\s*#extension\s+GL_EXT_frag_depth\s*:\s*enable/;function E4e(e,t){if(t.fragmentShaderSource.defines.indexOf("LOG_DEPTH_READ_ONLY")>=0)return t;let i=e.shaderCache.getDerivedShaderProgram(t,"logDepth");if(!l(i)){const o=t._attributeLocations,r=t.vertexShaderSource.clone(),s=t.fragmentShaderSource.clone();r.defines=l(r.defines)?r.defines.slice(0):[],r.defines.push("LOG_DEPTH"),s.defines=l(s.defines)?s.defines.slice(0):[],s.defines.push("LOG_DEPTH");let a,c,u=!1,f=r.sources,h=f.length;for(a=0;a<h;++a)if(C4e.test(f[a])){u=!0;break}if(!u){for(a=0;a<h;++a)f[a]=nt.replaceMain(f[a],"czm_log_depth_main");c=`
|
||
|
||
void main()
|
||
{
|
||
czm_log_depth_main();
|
||
czm_vertexLogDepth();
|
||
}
|
||
`,f.push(c)}for(f=s.sources,h=f.length,u=!1,a=0;a<h;++a)T4e.test(f[a])&&(u=!0);s.defines.indexOf("LOG_DEPTH_WRITE")!==-1&&(u=!0);let _=!0;for(a=0;a<h;++a)b4e.test(f[a])&&(_=!1);let g="";if(_&&(g+=`#ifdef GL_EXT_frag_depth
|
||
#extension GL_EXT_frag_depth : enable
|
||
#endif
|
||
|
||
`),!u){for(a=0;a<h;a++)f[a]=nt.replaceMain(f[a],"czm_log_depth_main");g+=`
|
||
void main()
|
||
{
|
||
czm_log_depth_main();
|
||
czm_writeLogDepth();
|
||
}
|
||
`}f.push(g),i=e.shaderCache.createDerivedShaderProgram(t,"logDepth",{vertexShaderSource:r,fragmentShaderSource:s,attributeLocations:o})}return i}Fh.createLogDepthCommand=function(e,t,n){l(n)||(n={});let i;return l(n.command)&&(i=n.command.shaderProgram),n.command=Dt.shallowClone(e,n.command),!l(i)||n.shaderProgramId!==e.shaderProgram.id?(n.command.shaderProgram=E4e(t,e.shaderProgram),n.shaderProgramId=e.shaderProgram.id):n.command.shaderProgram=i,n};function x4e(e,t,n){let i=e.shaderCache.getDerivedShaderProgram(t,"pick");if(!l(i)){const o=t._attributeLocations;let r=t.fragmentShaderSource;const s=r.sources,a=s.length,c=`void main()
|
||
{
|
||
czm_non_pick_main();
|
||
if (gl_FragColor.a == 0.0) {
|
||
discard;
|
||
}
|
||
gl_FragColor = ${n};
|
||
}
|
||
`,u=new Array(a+1);for(let f=0;f<a;++f)u[f]=nt.replaceMain(s[f],"czm_non_pick_main");u[a]=c,r=new nt({sources:u,defines:r.defines}),i=e.shaderCache.createDerivedShaderProgram(t,"pick",{vertexShaderSource:t.vertexShaderSource,fragmentShaderSource:r,attributeLocations:o})}return i}function w4e(e,t){const n=e.picking.pickRenderStateCache;let i=n[t.id];if(!l(i)){const o=ht.getState(t);o.blending.enabled=!1,o.depthMask=!0,i=ht.fromCache(o),n[t.id]=i}return i}Fh.createPickDerivedCommand=function(e,t,n,i){l(i)||(i={});let o,r;return l(i.pickCommand)&&(o=i.pickCommand.shaderProgram,r=i.pickCommand.renderState),i.pickCommand=Dt.shallowClone(t,i.pickCommand),!l(o)||i.shaderProgramId!==t.shaderProgram.id?(i.pickCommand.shaderProgram=x4e(n,t.shaderProgram,t.pickId),i.pickCommand.renderState=w4e(e,t.renderState),i.shaderProgramId=t.shaderProgram.id):(i.pickCommand.shaderProgram=o,i.pickCommand.renderState=r),i};function S4e(e,t){let n=e.shaderCache.getDerivedShaderProgram(t,"HDR");if(!l(n)){const i=t._attributeLocations,o=t.vertexShaderSource.clone(),r=t.fragmentShaderSource.clone();o.defines=l(o.defines)?o.defines.slice(0):[],o.defines.push("HDR"),r.defines=l(r.defines)?r.defines.slice(0):[],r.defines.push("HDR"),n=e.shaderCache.createDerivedShaderProgram(t,"HDR",{vertexShaderSource:o,fragmentShaderSource:r,attributeLocations:i})}return n}Fh.createHdrCommand=function(e,t,n){l(n)||(n={});let i;return l(n.command)&&(i=n.command.shaderProgram),n.command=Dt.shallowClone(e,n.command),!l(i)||n.shaderProgramId!==e.shaderProgram.id?(n.command.shaderProgram=S4e(t,e.shaderProgram),n.shaderProgramId=e.shaderProgram.id):n.command.shaderProgram=i,n};function lP(e){if(!l(e))throw new w("scene is required.");this._scene=e,this._lastAlpha=void 0,this._lastBeta=void 0,this._lastGamma=void 0,this._alpha=void 0,this._beta=void 0,this._gamma=void 0;const t=this;function n(i){const o=i.alpha;if(!l(o)){t._alpha=void 0,t._beta=void 0,t._gamma=void 0;return}t._alpha=F.toRadians(o),t._beta=F.toRadians(i.beta),t._gamma=F.toRadians(i.gamma)}window.addEventListener("deviceorientation",n,!1),this._removeListener=function(){window.removeEventListener("deviceorientation",n,!1)}}const v4e=new De,K6=new De,D4e=new te;function I4e(e,t,n,i){const o=e.direction,r=e.right,s=e.up,a=De.fromAxisAngle(o,n,K6),c=De.fromAxisAngle(r,i,v4e),u=De.multiply(c,a,c),f=De.fromAxisAngle(s,t,K6);De.multiply(f,u,u);const h=te.fromQuaternion(u,D4e);te.multiplyByVector(h,r,r),te.multiplyByVector(h,s,s),te.multiplyByVector(h,o,o)}lP.prototype.update=function(){if(!l(this._alpha))return;l(this._lastAlpha)||(this._lastAlpha=this._alpha,this._lastBeta=this._beta,this._lastGamma=this._gamma);const e=this._lastAlpha-this._alpha,t=this._lastBeta-this._beta,n=this._lastGamma-this._gamma;I4e(this._scene.camera,-e,t,n),this._lastAlpha=this._alpha,this._lastBeta=this._beta,this._lastGamma=this._gamma};lP.prototype.isDestroyed=function(){return!1};lP.prototype.destroy=function(){return this._removeListener(),Je(this)};function wZ(){this.enabled=!0,this.renderable=!0,this.density=2e-4,this.screenSpaceErrorFactor=2,this.minimumBrightness=.03}const MD=[359.393,800.749,1275.6501,2151.1192,3141.7763,4777.5198,6281.2493,12364.307,15900.765,49889.0549,78026.8259,99260.7344,120036.3873,151011.0158,156091.1953,203849.3112,274866.9803,319916.3149,493552.0528,628733.5874],dd=[2e-5,2e-4,1e-4,7e-5,5e-5,4e-5,3e-5,19e-6,1e-5,85e-7,62e-7,58e-7,53e-7,52e-7,51e-7,42e-7,4e-6,34e-7,26e-7,22e-7];for(let e=0;e<dd.length;++e)dd[e]*=1e6;const SZ=dd[1],xF=dd[dd.length-1];for(let e=0;e<dd.length;++e)dd[e]=(dd[e]-xF)/(SZ-xF);let Rs=0;function P4e(e){const t=MD,n=t.length;if(e<t[0])return Rs=0,Rs;if(e>t[n-1])return Rs=n-2,Rs;if(e>=t[Rs]){if(Rs+1<n&&e<t[Rs+1])return Rs;if(Rs+2<n&&e<t[Rs+2])return++Rs,Rs}else if(Rs-1>=0&&e>=t[Rs-1])return--Rs,Rs;let i;for(i=0;i<n-2&&!(e>=t[i]&&e<t[i+1]);++i);return Rs=i,Rs}const O4e=new d;wZ.prototype.update=function(e){if(!(e.fog.enabled=this.enabled))return;e.fog.renderable=this.renderable;const n=e.camera,i=n.positionCartographic;if(!l(i)||i.height>8e5||e.mode!==me.SCENE3D){e.fog.enabled=!1;return}const o=i.height,r=P4e(o),s=F.clamp((o-MD[r])/(MD[r+1]-MD[r]),0,1);let a=F.lerp(dd[r],dd[r+1],s);const c=this.density*1e6,u=c/SZ*xF;a=a*(c-u)*1e-6;const f=d.normalize(n.positionWC,O4e),h=Math.abs(d.dot(n.directionWC,f));a*=1-h,e.fog.density=a,e.fog.sse=this.screenSpaceErrorFactor,e.fog.minimumBrightness=this.minimumBrightness};function L4e(e,t,n){this.context=e,this.commandList=[],this.shadowMaps=[],this.brdfLutGenerator=void 0,this.environmentMap=void 0,this.sphericalHarmonicCoefficients=void 0,this.specularEnvironmentMaps=void 0,this.specularEnvironmentMapsMaximumLOD=void 0,this.mode=me.SCENE3D,this.morphTime=me.getMorphTime(me.SCENE3D),this.frameNumber=0,this.newFrame=!1,this.time=void 0,this.jobScheduler=n,this.mapProjection=void 0,this.camera=void 0,this.cameraUnderground=!1,this.globeTranslucencyState=void 0,this.cullingVolume=void 0,this.occluder=void 0,this.maximumScreenSpaceError=void 0,this.pixelRatio=1,this.passes={render:!1,pick:!1,depth:!1,postProcess:!1,offscreen:!1},this.creditDisplay=t,this.afterRender=[],this.scene3DOnly=!1,this.fog={enabled:!1,density:void 0,sse:void 0,minimumBrightness:void 0},this.terrainExaggeration=1,this.terrainExaggerationRelativeHeight=0,this.shadowState={shadowsEnabled:!0,shadowMaps:[],lightShadowMaps:[],nearPlane:1,farPlane:5e3,closestObjectSize:1e3,lastDirtyTime:0,outOfView:!0},this.splitPosition=0,this.frustumSplits=[],this.backgroundColor=void 0,this.light=void 0,this.minimumDisableDepthTestDistance=void 0,this.invertClassification=!1,this.invertClassificationColor=void 0,this.useLogDepth=!1,this.tilesetPassState=void 0,this.minimumTerrainHeight=0}const Fs={OPAQUE_FRONT_FACE:0,OPAQUE_BACK_FACE:1,DEPTH_ONLY_FRONT_FACE:2,DEPTH_ONLY_BACK_FACE:3,DEPTH_ONLY_FRONT_AND_BACK_FACE:4,TRANSLUCENT_FRONT_FACE:5,TRANSLUCENT_BACK_FACE:6,TRANSLUCENT_FRONT_FACE_MANUAL_DEPTH_TEST:7,TRANSLUCENT_BACK_FACE_MANUAL_DEPTH_TEST:8,PICK_FRONT_FACE:9,PICK_BACK_FACE:10,DERIVED_COMMANDS_MAXIMUM_LENGTH:11},Bg=Fs.DERIVED_COMMANDS_MAXIMUM_LENGTH,vZ=["opaqueFrontFaceCommand","opaqueBackFaceCommand","depthOnlyFrontFaceCommand","depthOnlyBackFaceCommand","depthOnlyFrontAndBackFaceCommand","translucentFrontFaceCommand","translucentBackFaceCommand","translucentFrontFaceManualDepthTestCommand","translucentBackFaceManualDepthTestCommand","pickFrontFaceCommand","pickBackFaceCommand"];function Ny(){this._frontFaceAlphaByDistance=new tn(0,1,0,1),this._backFaceAlphaByDistance=new tn(0,1,0,1),this._frontFaceTranslucent=!1,this._backFaceTranslucent=!1,this._requiresManualDepthTest=!1,this._sunVisibleThroughGlobe=!1,this._environmentVisible=!1,this._useDepthPlane=!1,this._numberOfTextureUniforms=0,this._globeTranslucencyFramebuffer=void 0,this._rectangle=Ee.clone(Ee.MAX_VALUE),this._derivedCommandKey=0,this._derivedCommandsDirty=!1,this._derivedCommandPacks=void 0,this._derivedCommandTypes=new Array(Bg),this._derivedBlendCommandTypes=new Array(Bg),this._derivedPickCommandTypes=new Array(Bg),this._derivedCommandTypesToUpdate=new Array(Bg),this._derivedCommandsLength=0,this._derivedBlendCommandsLength=0,this._derivedPickCommandsLength=0,this._derivedCommandsToUpdateLength=0}Object.defineProperties(Ny.prototype,{frontFaceAlphaByDistance:{get:function(){return this._frontFaceAlphaByDistance}},backFaceAlphaByDistance:{get:function(){return this._backFaceAlphaByDistance}},translucent:{get:function(){return this._frontFaceTranslucent}},sunVisibleThroughGlobe:{get:function(){return this._sunVisibleThroughGlobe}},environmentVisible:{get:function(){return this._environmentVisible}},useDepthPlane:{get:function(){return this._useDepthPlane}},numberOfTextureUniforms:{get:function(){return this._numberOfTextureUniforms}},rectangle:{get:function(){return this._rectangle}}});Ny.prototype.update=function(e){const t=e.globe;if(!l(t)||!t.show){this._frontFaceTranslucent=!1,this._backFaceTranslucent=!1,this._sunVisibleThroughGlobe=!0,this._environmentVisible=!0,this._useDepthPlane=!1;return}this._frontFaceAlphaByDistance=J6(t.translucency.enabled,t.translucency.frontFaceAlpha,t.translucency.frontFaceAlphaByDistance,this._frontFaceAlphaByDistance),this._backFaceAlphaByDistance=J6(t.translucency.enabled,t.translucency.backFaceAlpha,t.translucency.backFaceAlphaByDistance,this._backFaceAlphaByDistance),this._frontFaceTranslucent=Q6(t.translucency.enabled,this._frontFaceAlphaByDistance,t),this._backFaceTranslucent=Q6(t.translucency.enabled,this._backFaceAlphaByDistance,t),this._requiresManualDepthTest=M4e(this,e,t),this._sunVisibleThroughGlobe=B4e(this,e),this._environmentVisible=R4e(this,e),this._useDepthPlane=N4e(this,e),this._numberOfTextureUniforms=F4e(this),this._rectangle=Ee.clone(t.translucency.rectangle,this._rectangle),z4e(this,e)};function J6(e,t,n,i){return e?l(n)?(tn.clone(n,i),i.nearValue*=t,i.farValue*=t,i):(i.nearValue=t,i.farValue=t,i):(i.nearValue=1,i.farValue=1,i)}function Q6(e,t,n){return e&&(n.baseColor.alpha<1||t.nearValue<1||t.farValue<1)}function B4e(e,t){const n=e._frontFaceTranslucent,i=e._backFaceTranslucent;return n&&(t.cameraUnderground||i)}function R4e(e,t){return!t.cameraUnderground||e._frontFaceTranslucent}function N4e(e,t){return!t.cameraUnderground&&!e._frontFaceTranslucent}function M4e(e,t,n){return e._frontFaceTranslucent&&!e._backFaceTranslucent&&!n.depthTestAgainstTerrain&&t.mode!==me.SCENE2D&&t.context.depthTexture}function F4e(e){let t=0;return e._frontFaceTranslucent&&++t,e._requiresManualDepthTest&&++t,t}function z4e(e,t){e._derivedCommandsLength=YB(e,t,!1,!1,e._derivedCommandTypes),e._derivedBlendCommandsLength=YB(e,t,!0,!1,e._derivedBlendCommandTypes),e._derivedPickCommandsLength=YB(e,t,!1,!0,e._derivedPickCommandTypes);let n,i=0;for(n=0;n<e._derivedCommandsLength;++n)i|=1<<e._derivedCommandTypes[n];for(n=0;n<e._derivedBlendCommandsLength;++n)i|=1<<e._derivedBlendCommandTypes[n];for(n=0;n<e._derivedPickCommandsLength;++n)i|=1<<e._derivedPickCommandTypes[n];let o=0;for(n=0;n<Bg;++n)(i&1<<n)>0&&(e._derivedCommandTypesToUpdate[o++]=n);e._derivedCommandsToUpdateLength=o;const r=i!==e._derivedCommandKey;e._derivedCommandKey=i,e._derivedCommandsDirty=r,!l(e._derivedCommandPacks)&&e._frontFaceTranslucent&&(e._derivedCommandPacks=Z4e())}function YB(e,t,n,i,o){let r=0;const s=e._frontFaceTranslucent,a=e._backFaceTranslucent;if(!s)return r;const c=t.cameraUnderground,u=e._requiresManualDepthTest,f=i?Fs.PICK_FRONT_FACE:u?Fs.TRANSLUCENT_FRONT_FACE_MANUAL_DEPTH_TEST:Fs.TRANSLUCENT_FRONT_FACE,h=i?Fs.PICK_BACK_FACE:u?Fs.TRANSLUCENT_BACK_FACE_MANUAL_DEPTH_TEST:Fs.TRANSLUCENT_BACK_FACE;return t.mode===me.SCENE2D?(o[r++]=Fs.DEPTH_ONLY_FRONT_FACE,o[r++]=f,r):(a?(n||(o[r++]=Fs.DEPTH_ONLY_FRONT_AND_BACK_FACE),c?(o[r++]=f,o[r++]=h):(o[r++]=h,o[r++]=f)):c?(n||(o[r++]=Fs.DEPTH_ONLY_BACK_FACE),o[r++]=Fs.OPAQUE_FRONT_FACE,o[r++]=h):(n||(o[r++]=Fs.DEPTH_ONLY_FRONT_FACE),o[r++]=Fs.OPAQUE_BACK_FACE,o[r++]=f),r)}function Kl(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}function Z6(e,t){return e.indexOf(t)>-1}function U4e(e,t){Kl(e.defines,"TRANSLUCENT"),Kl(t.defines,"TRANSLUCENT")}function H4e(e,t){Kl(e.defines,"GROUND_ATMOSPHERE"),Kl(t.defines,"GROUND_ATMOSPHERE"),Kl(e.defines,"FOG"),Kl(t.defines,"FOG"),Kl(e.defines,"TRANSLUCENT"),Kl(t.defines,"TRANSLUCENT")}function $B(e,t){if(Z6(t.defines,"TILE_LIMIT_RECTANGLE")||Z6(t.defines,"ENABLE_CLIPPING_PLANES"))return;const n=`void main()
|
||
{
|
||
gl_FragColor = vec4(1.0);
|
||
}
|
||
`;t.sources=[n]}function Bz(e,t){const n=t.sources,i=n.length;for(let r=0;r<i;++r)n[r]=nt.replaceMain(n[r],"czm_globe_translucency_main");const o=`
|
||
|
||
uniform sampler2D u_classificationTexture;
|
||
void main()
|
||
{
|
||
vec2 st = gl_FragCoord.xy / czm_viewport.zw;
|
||
#ifdef MANUAL_DEPTH_TEST
|
||
float logDepthOrDepth = czm_unpackDepth(texture2D(czm_globeDepthTexture, st));
|
||
if (logDepthOrDepth != 0.0)
|
||
{
|
||
vec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, logDepthOrDepth);
|
||
float depthEC = eyeCoordinate.z / eyeCoordinate.w;
|
||
if (v_positionEC.z < depthEC)
|
||
{
|
||
discard;
|
||
}
|
||
}
|
||
#endif
|
||
czm_globe_translucency_main();
|
||
vec4 classificationColor = texture2D(u_classificationTexture, st);
|
||
if (classificationColor.a > 0.0)
|
||
{
|
||
// Reverse premultiplication process to get the correct composited result of the classification primitives
|
||
classificationColor.rgb /= classificationColor.a;
|
||
}
|
||
gl_FragColor = classificationColor * vec4(classificationColor.aaa, 1.0) + gl_FragColor * (1.0 - classificationColor.a);
|
||
}
|
||
`;n.push(o)}function DZ(e,t){Bz(e,t),Kl(e.defines,"GROUND_ATMOSPHERE"),Kl(t.defines,"GROUND_ATMOSPHERE"),Kl(e.defines,"FOG"),Kl(t.defines,"FOG")}function V4e(e,t){Bz(e,t),e.defines.push("GENERATE_POSITION"),t.defines.push("MANUAL_DEPTH_TEST")}function k4e(e,t){DZ(e,t),e.defines.push("GENERATE_POSITION"),t.defines.push("MANUAL_DEPTH_TEST")}function eW(e,t){const n=`uniform sampler2D u_classificationTexture;
|
||
void main()
|
||
{
|
||
vec2 st = gl_FragCoord.xy / czm_viewport.zw;
|
||
vec4 pickColor = texture2D(u_classificationTexture, st);
|
||
if (pickColor == vec4(0.0))
|
||
{
|
||
discard;
|
||
}
|
||
gl_FragColor = pickColor;
|
||
}
|
||
`;t.sources=[n]}function G4e(e,t,n,i,o,r){if(!l(o))return t;if(!i&&l(n))return n;let s=e.shaderCache.getDerivedShaderProgram(t,r);if(!l(s)){const a=t._attributeLocations,c=t.vertexShaderSource.clone(),u=t.fragmentShaderSource.clone();c.defines=l(c.defines)?c.defines.slice(0):[],u.defines=l(u.defines)?u.defines.slice(0):[],o(c,u),s=e.shaderCache.createDerivedShaderProgram(t,r,{vertexShaderSource:c,fragmentShaderSource:u,attributeLocations:a})}return s}function W4e(e){e.cull.face=mr.BACK,e.cull.enabled=!0}function q4e(e){e.cull.face=mr.FRONT,e.cull.enabled=!0}function j4e(e){e.cull.face=mr.BACK,e.cull.enabled=!0,e.colorMask={red:!1,green:!1,blue:!1,alpha:!1}}function Y4e(e){e.cull.face=mr.FRONT,e.cull.enabled=!0,e.colorMask={red:!1,green:!1,blue:!1,alpha:!1}}function $4e(e){e.cull.enabled=!1,e.colorMask={red:!1,green:!1,blue:!1,alpha:!1}}function tW(e){e.cull.face=mr.BACK,e.cull.enabled=!0,e.depthMask=!1,e.blending=fo.ALPHA_BLEND}function nW(e){e.cull.face=mr.FRONT,e.cull.enabled=!0,e.depthMask=!1,e.blending=fo.ALPHA_BLEND}function X4e(e){e.cull.face=mr.BACK,e.cull.enabled=!0,e.blending.enabled=!1}function K4e(e){e.cull.face=mr.FRONT,e.cull.enabled=!0,e.blending.enabled=!1}function J4e(e,t,n,i,o){if(!l(i))return e;if(!n&&l(t))return t;let r=o[e.id];if(!l(r)){const s=ht.getState(e);i(s),r=ht.fromCache(s),o[e.id]=r}return r}function D0(e){return{u_classificationTexture:function(){return e._globeTranslucencyFramebuffer.classificationTexture}}}function Q4e(e,t,n,i,o){return l(o)?!i&&l(n)?n:Ln(t,o(e),!1):t}function Uu(e){this.pass=e.pass,this.pickOnly=e.pickOnly,this.getShaderProgramFunction=e.getShaderProgramFunction,this.getRenderStateFunction=e.getRenderStateFunction,this.getUniformMapFunction=e.getUniformMapFunction,this.renderStateCache={}}function Z4e(){return[new Uu({pass:We.GLOBE,pickOnly:!1,getShaderProgramFunction:U4e,getRenderStateFunction:W4e,getUniformMapFunction:void 0}),new Uu({pass:We.GLOBE,pickOnly:!1,getShaderProgramFunction:H4e,getRenderStateFunction:q4e,getUniformMapFunction:void 0}),new Uu({pass:We.GLOBE,pickOnly:!1,getShaderProgramFunction:$B,getRenderStateFunction:j4e,getUniformMapFunction:void 0}),new Uu({pass:We.GLOBE,pickOnly:!1,getShaderProgramFunction:$B,getRenderStateFunction:Y4e,getUniformMapFunction:void 0}),new Uu({pass:We.GLOBE,pickOnly:!1,getShaderProgramFunction:$B,getRenderStateFunction:$4e,getUniformMapFunction:void 0}),new Uu({pass:We.TRANSLUCENT,pickOnly:!1,getShaderProgramFunction:Bz,getRenderStateFunction:tW,getUniformMapFunction:D0}),new Uu({pass:We.TRANSLUCENT,pickOnly:!1,getShaderProgramFunction:DZ,getRenderStateFunction:nW,getUniformMapFunction:D0}),new Uu({pass:We.TRANSLUCENT,pickOnly:!1,getShaderProgramFunction:V4e,getRenderStateFunction:tW,getUniformMapFunction:D0}),new Uu({pass:We.TRANSLUCENT,pickOnly:!1,getShaderProgramFunction:k4e,getRenderStateFunction:nW,getUniformMapFunction:D0}),new Uu({pass:We.TRANSLUCENT,pickOnly:!0,getShaderProgramFunction:eW,getRenderStateFunction:X4e,getUniformMapFunction:D0}),new Uu({pass:We.TRANSLUCENT,pickOnly:!0,getShaderProgramFunction:eW,getRenderStateFunction:K4e,getUniformMapFunction:D0})]}const iW=new Array(Bg),oW=new Array(Bg);Ny.prototype.updateDerivedCommands=function(e,t){const n=this._derivedCommandTypesToUpdate,i=this._derivedCommandsToUpdateLength;if(i!==0){for(let o=0;o<i;++o)oW[o]=this._derivedCommandPacks[n[o]],iW[o]=vZ[n[o]];eke(this,e,i,n,iW,oW,t)}};function eke(e,t,n,i,o,r,s){let a=t.derivedCommands.globeTranslucency;const c=e._derivedCommandsDirty;if(t.dirty||!l(a)||c){t.dirty=!1,l(a)||(a={},t.derivedCommands.globeTranslucency=a);const u=s.frameNumber,f=A(a.uniformMapDirtyFrame,0),h=A(a.shaderProgramDirtyFrame,0),_=A(a.renderStateDirtyFrame,0),g=a.uniformMap!==t.uniformMap,p=a.shaderProgramId!==t.shaderProgram.id,y=a.renderStateId!==t.renderState.id;g&&(a.uniformMapDirtyFrame=u),p&&(a.shaderProgramDirtyFrame=u),y&&(a.renderStateDirtyFrame=u),a.uniformMap=t.uniformMap,a.shaderProgramId=t.shaderProgram.id,a.renderStateId=t.renderState.id;for(let T=0;T<n;++T){const b=r[T],x=i[T],v=o[T];let D=a[v],L,B,V;l(D)?(L=D.uniformMap,B=D.shaderProgram,V=D.renderState):(L=void 0,B=void 0,V=void 0),D=Dt.shallowClone(t,D),a[v]=D;const M=A(D.derivedCommands.uniformMapDirtyFrame,0),H=A(D.derivedCommands.shaderProgramDirtyFrame,0),G=A(D.derivedCommands.renderStateDirtyFrame,0),I=g||M<f,O=p||H<h,m=y||G<_;I&&(D.derivedCommands.uniformMapDirtyFrame=u),O&&(D.derivedCommands.shaderProgramDirtyFrame=u),m&&(D.derivedCommands.renderStateDirtyFrame=u),D.derivedCommands.type=x,D.pass=b.pass,D.pickOnly=b.pickOnly,D.uniformMap=Q4e(e,t.uniformMap,L,I,b.getUniformMapFunction),D.shaderProgram=G4e(s.context,t.shaderProgram,B,O,b.getShaderProgramFunction,v),D.renderState=J4e(t.renderState,V,m,b.getRenderStateFunction,b.renderStateCache)}}}Ny.prototype.pushDerivedCommands=function(e,t,n){const i=n.passes.pick;if(i&&t)return;let o=this._derivedCommandTypes,r=this._derivedCommandsLength;if(i?(o=this._derivedPickCommandTypes,r=this._derivedPickCommandsLength):t&&(o=this._derivedBlendCommandTypes,r=this._derivedBlendCommandsLength),r===0){n.commandList.push(e);return}const s=e.derivedCommands.globeTranslucency;for(let a=0;a<r;++a){const c=vZ[o[a]];n.commandList.push(s[c])}};function IZ(e,t,n,i,o,r,s){for(let a=0;a<t;++a){const c=e[a],u=c.derivedCommands.type;(!l(s)||s.indexOf(u)>-1)&&n(c,i,o,r)}}function rW(e,t,n,i,o,r){for(let s=0;s<t;++s)n(e[s],i,o,r)}const tke=[Fs.OPAQUE_FRONT_FACE,Fs.OPAQUE_BACK_FACE],nke=[Fs.DEPTH_ONLY_FRONT_FACE,Fs.DEPTH_ONLY_BACK_FACE,Fs.DEPTH_ONLY_FRONT_AND_BACK_FACE];Ny.prototype.executeGlobeCommands=function(e,t,n,i,o){const r=i.context,s=e.commands[We.GLOBE],a=e.indices[We.GLOBE];a!==0&&(this._globeTranslucencyFramebuffer=n,n.clearClassification(r,o),IZ(s,a,t,i,r,o,tke))};Ny.prototype.executeGlobeClassificationCommands=function(e,t,n,i,o){const r=i.context,s=e.commands[We.GLOBE],a=e.indices[We.GLOBE],c=e.commands[We.TERRAIN_CLASSIFICATION],u=e.indices[We.TERRAIN_CLASSIFICATION];if(a===0||u===0)return;const f=this._frontFaceTranslucent,h=this._backFaceTranslucent;if((!f||!h)&&rW(c,u,t,i,r,o),!f&&!h)return;this._globeTranslucencyFramebuffer=n;const _=r.uniformState.globeDepthTexture,g=o.framebuffer;if(o.framebuffer=n.classificationFramebuffer,IZ(s,a,t,i,r,o,nke),r.depthTexture){const p=n.packDepth(r,o);r.uniformState.globeDepthTexture=p}rW(c,u,t,i,r,o),r.uniformState.globeDepthTexture=_,o.framebuffer=g};const sy=`uniform sampler2D colorTexture;
|
||
|
||
varying vec2 v_textureCoordinates;
|
||
|
||
void main()
|
||
{
|
||
gl_FragColor = texture2D(colorTexture, v_textureCoordinates);
|
||
}
|
||
`,ike={NEVER:fe.NEVER,LESS:fe.LESS,EQUAL:fe.EQUAL,LESS_OR_EQUAL:fe.LEQUAL,GREATER:fe.GREATER,NOT_EQUAL:fe.NOTEQUAL,GREATER_OR_EQUAL:fe.GEQUAL,ALWAYS:fe.ALWAYS},Ni=Object.freeze(ike),oke={ZERO:fe.ZERO,KEEP:fe.KEEP,REPLACE:fe.REPLACE,INCREMENT:fe.INCR,DECREMENT:fe.DECR,INVERT:fe.INVERT,INCREMENT_WRAP:fe.INCR_WRAP,DECREMENT_WRAP:fe.DECR_WRAP},It=Object.freeze(oke),FD={CESIUM_3D_TILE_MASK:128,SKIP_LOD_MASK:112,SKIP_LOD_BIT_SHIFT:4,CLASSIFICATION_MASK:15};FD.setCesium3DTileBit=function(){return{enabled:!0,frontFunction:Ni.ALWAYS,frontOperation:{fail:It.KEEP,zFail:It.KEEP,zPass:It.REPLACE},backFunction:Ni.ALWAYS,backOperation:{fail:It.KEEP,zFail:It.KEEP,zPass:It.REPLACE},reference:FD.CESIUM_3D_TILE_MASK,mask:FD.CESIUM_3D_TILE_MASK}};const Kt=Object.freeze(FD);function If(){this._numSamples=1,this.previousFramebuffer=void 0,this._previousFramebuffer=void 0,this._depthStencilTexture=void 0,this._depthStencilRenderbuffer=void 0,this._fbo=new Xn({depthStencil:!0,createDepthAttachments:!1}),this._fboClassified=new Xn({depthStencil:!0,createDepthAttachments:!1}),this._rsUnclassified=void 0,this._rsClassified=void 0,this._unclassifiedCommand=void 0,this._classifiedCommand=void 0,this._translucentCommand=void 0,this._clearColorCommand=new Bo({color:new k(0,0,0,0),owner:this}),this._clearCommand=new Bo({color:new k(0,0,0,0),depth:1,stencil:0});const e=this;this._uniformMap={colorTexture:function(){return e._fbo.getColorTexture()},depthTexture:function(){return e._depthStencilTexture},classifiedTexture:function(){return e._fboClassified.getColorTexture()}}}Object.defineProperties(If.prototype,{unclassifiedCommand:{get:function(){return this._unclassifiedCommand}}});If.isTranslucencySupported=function(e){return e.depthTexture&&e.fragmentDepth};const rke={depthMask:!1,stencilTest:{enabled:!0,frontFunction:Ni.EQUAL,frontOperation:{fail:It.KEEP,zFail:It.KEEP,zPass:It.KEEP},backFunction:Ni.NEVER,reference:0,mask:Kt.CLASSIFICATION_MASK},blending:fo.ALPHA_BLEND},ske={depthMask:!1,stencilTest:{enabled:!0,frontFunction:Ni.NOT_EQUAL,frontOperation:{fail:It.KEEP,zFail:It.KEEP,zPass:It.KEEP},backFunction:Ni.NEVER,reference:0,mask:Kt.CLASSIFICATION_MASK},blending:fo.ALPHA_BLEND},ake={depthMask:!0,depthTest:{enabled:!0},stencilTest:Kt.setCesium3DTileBit(),stencilMask:Kt.CESIUM_3D_TILE_MASK,blending:fo.ALPHA_BLEND},cke=`#extension GL_EXT_frag_depth : enable
|
||
uniform sampler2D colorTexture;
|
||
uniform sampler2D depthTexture;
|
||
uniform sampler2D classifiedTexture;
|
||
varying vec2 v_textureCoordinates;
|
||
void main()
|
||
{
|
||
vec4 color = texture2D(colorTexture, v_textureCoordinates);
|
||
if (color.a == 0.0)
|
||
{
|
||
discard;
|
||
}
|
||
bool isClassified = all(equal(texture2D(classifiedTexture, v_textureCoordinates), vec4(0.0)));
|
||
#ifdef UNCLASSIFIED
|
||
vec4 highlightColor = czm_invertClassificationColor;
|
||
if (isClassified)
|
||
{
|
||
discard;
|
||
}
|
||
#else
|
||
vec4 highlightColor = vec4(1.0);
|
||
if (!isClassified)
|
||
{
|
||
discard;
|
||
}
|
||
#endif
|
||
gl_FragColor = color * highlightColor;
|
||
gl_FragDepthEXT = texture2D(depthTexture, v_textureCoordinates).r;
|
||
}
|
||
`,lke=`uniform sampler2D colorTexture;
|
||
varying vec2 v_textureCoordinates;
|
||
void main()
|
||
{
|
||
vec4 color = texture2D(colorTexture, v_textureCoordinates);
|
||
if (color.a == 0.0)
|
||
{
|
||
discard;
|
||
}
|
||
#ifdef UNCLASSIFIED
|
||
gl_FragColor = color * czm_invertClassificationColor;
|
||
#else
|
||
gl_FragColor = color;
|
||
#endif
|
||
}
|
||
`;If.prototype.update=function(e,t,n){const i=this._fbo.getColorTexture(),o=this.previousFramebuffer!==this._previousFramebuffer;this._previousFramebuffer=this.previousFramebuffer;const r=this._numSamples!==t,s=e.drawingBufferWidth,a=e.drawingBufferHeight,c=!l(i)||i.width!==s||i.height!==a;if((c||o||r)&&(this._numSamples=t,this._depthStencilTexture=this._depthStencilTexture&&this._depthStencilTexture.destroy(),this._depthStencilRenderbuffer=this._depthStencilRenderbuffer&&this._depthStencilRenderbuffer.destroy(),l(this._previousFramebuffer)||(this._depthStencilTexture=new rn({context:e,width:s,height:a,pixelFormat:yt.DEPTH_STENCIL,pixelDatatype:ft.UNSIGNED_INT_24_8}),t>1&&(this._depthStencilRenderbuffer=new Qu({context:e,width:s,height:a,format:vh.DEPTH24_STENCIL8,numSamples:t})))),!l(this._fbo.framebuffer)||c||o||r){this._fbo.destroy(),this._fboClassified.destroy();let u,f;l(this._previousFramebuffer)?(u=n.getDepthStencilTexture(),f=n.getDepthStencilRenderbuffer()):(u=this._depthStencilTexture,f=this._depthStencilRenderbuffer),this._fbo.setDepthStencilTexture(u),l(f)&&this._fbo.setDepthStencilRenderbuffer(f),this._fbo.update(e,s,a,t),l(this._previousFramebuffer)||(this._fboClassified.setDepthStencilTexture(u),this._fboClassified.update(e,s,a))}if(l(this._rsUnclassified)||(this._rsUnclassified=ht.fromCache(rke),this._rsClassified=ht.fromCache(ske),this._rsDefault=ht.fromCache(ake)),!l(this._unclassifiedCommand)||o||r){l(this._unclassifiedCommand)&&(this._unclassifiedCommand.shaderProgram=this._unclassifiedCommand.shaderProgram&&this._unclassifiedCommand.shaderProgram.destroy(),this._classifiedCommand.shaderProgram=this._classifiedCommand.shaderProgram&&this._classifiedCommand.shaderProgram.destroy());const u=l(this._previousFramebuffer)?lke:cke,f=new nt({defines:["UNCLASSIFIED"],sources:[u]}),h=new nt({sources:[u]});this._unclassifiedCommand=e.createViewportQuadCommand(f,{renderState:l(this._previousFramebuffer)?this._rsUnclassified:this._rsDefault,uniformMap:this._uniformMap,owner:this}),this._classifiedCommand=e.createViewportQuadCommand(h,{renderState:l(this._previousFramebuffer)?this._rsClassified:this._rsDefault,uniformMap:this._uniformMap,owner:this}),l(this._translucentCommand)&&(this._translucentCommand.shaderProgram=this._translucentCommand.shaderProgram&&this._translucentCommand.shaderProgram.destroy()),l(this._previousFramebuffer)||(this._translucentCommand=e.createViewportQuadCommand(sy,{renderState:this._rsUnclassified,uniformMap:this._uniformMap,owner:this}))}};If.prototype.prepareTextures=function(e,t){this._fbo._numSamples>1&&this._fbo.prepareTextures(e,t)};If.prototype.clear=function(e,t){l(this._previousFramebuffer)?this._fbo.clear(e,this._clearColorCommand,t):(this._fbo.clear(e,this._clearCommand,t),this._fboClassified.clear(e,this._clearCommand,t))};If.prototype.executeClassified=function(e,t){if(!l(this._previousFramebuffer)){const n=t.framebuffer;this.prepareTextures(e,!0),t.framebuffer=this._fboClassified.framebuffer,this._translucentCommand.execute(e,t),t.framebuffer=n}this._classifiedCommand.execute(e,t)};If.prototype.executeUnclassified=function(e,t){this._unclassifiedCommand.execute(e,t)};If.prototype.isDestroyed=function(){return!1};If.prototype.destroy=function(){return this._fbo.destroy(),this._fboClassified.destroy(),this._depthStencilTexture=this._depthStencilTexture&&this._depthStencilTexture.destroy(),this._depthStencilRenderbuffer=this._depthStencilRenderbuffer&&this._depthStencilRenderbuffer.destroy(),l(this._unclassifiedCommand)&&(this._unclassifiedCommand.shaderProgram=this._unclassifiedCommand.shaderProgram&&this._unclassifiedCommand.shaderProgram.destroy(),this._classifiedCommand.shaderProgram=this._classifiedCommand.shaderProgram&&this._classifiedCommand.shaderProgram.destroy()),Je(this)};const uke={TEXTURE:0,PROGRAM:1,BUFFER:2,NUMBER_OF_JOB_TYPES:3},ju=Object.freeze(uke);function zD(e){this._total=e,this.usedThisFrame=0,this.stolenFromMeThisFrame=0,this.starvedThisFrame=!1,this.starvedLastFrame=!1}Object.defineProperties(zD.prototype,{total:{get:function(){return this._total}}});function zm(e){if(l(e)&&e.length!==ju.NUMBER_OF_JOB_TYPES)throw new w("A budget must be specified for each job type; budgets.length should equal JobType.NUMBER_OF_JOB_TYPES.");const t=new Array(ju.NUMBER_OF_JOB_TYPES);t[ju.TEXTURE]=new zD(l(e)?e[ju.TEXTURE]:10),t[ju.PROGRAM]=new zD(l(e)?e[ju.PROGRAM]:10),t[ju.BUFFER]=new zD(l(e)?e[ju.BUFFER]:30);const n=t.length;let i,o=0;for(i=0;i<n;++i)o+=t[i].total;const r=new Array(n);for(i=0;i<n;++i)r[i]=!1;this._totalBudget=o,this._totalUsedThisFrame=0,this._budgets=t,this._executedThisFrame=r}zm.getTimestamp=Gr;Object.defineProperties(zm.prototype,{totalBudget:{get:function(){return this._totalBudget}}});zm.prototype.disableThisFrame=function(){this._totalUsedThisFrame=this._totalBudget};zm.prototype.resetBudgets=function(){const e=this._budgets,t=e.length;for(let n=0;n<t;++n){const i=e[n];i.starvedLastFrame=i.starvedThisFrame,i.starvedThisFrame=!1,i.usedThisFrame=0,i.stolenFromMeThisFrame=0}this._totalUsedThisFrame=0};zm.prototype.execute=function(e,t){const n=this._budgets,i=n[t],o=this._executedThisFrame[t];if(this._totalUsedThisFrame>=this._totalBudget&&o)return i.starvedThisFrame=!0,!1;let r;if(i.usedThisFrame+i.stolenFromMeThisFrame>=i.total){const c=n.length;let u;for(u=0;u<c&&(r=n[u],!(r.usedThisFrame+r.stolenFromMeThisFrame<r.total&&!r.starvedLastFrame));++u);if(u===c&&o)return!1;o&&(i.starvedThisFrame=!0)}const s=zm.getTimestamp();e.execute();const a=zm.getTimestamp()-s;return this._totalUsedThisFrame+=a,r?r.stolenFromMeThisFrame+=a:i.usedThisFrame+=a,this._executedThisFrame[t]=!0,!0};function gf(e){this._url=e,this._cubeMapBuffers=void 0,this._cubeMaps=void 0,this._texture=void 0,this._mipTextures=void 0,this._va=void 0,this._sp=void 0,this._maximumMipmapLevel=void 0,this._loading=!1,this._ready=!1;const t=this;this._readyPromise=new Promise((n,i)=>{t._completeLoadFromCache=o=>{Rz(this),this._texture=o,this._maximumMipmapLevel=this._texture.maximumMipmapLevel,this._ready=!0,n()},t._failLoad=o=>{i(o)},t._completeLoad=()=>{this._ready=!0,n()}})}Object.defineProperties(gf.prototype,{url:{get:function(){return this._url}},texture:{get:function(){return this._texture}},maximumMipmapLevel:{get:function(){return this._maximumMipmapLevel}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise}}});gf.isSupported=function(e){return e.colorBufferHalfFloat&&e.halfFloatingPointTexture||e.floatingPointTexture&&e.colorBufferFloat};const fke=new d(1,0,0),dke=new d(0,0,1),hke=new d(-1,0,0),pke=new d(0,0,-1),pv=new d(0,1,0),mke=new d(0,-1,0),PZ=[pv,hke,dke,mke,fke,pv,pke,pv,pv],OZ=PZ.length,LZ=new Float32Array(OZ*3);let sW=0;for(let e=0;e<OZ;++e,sW+=3)d.pack(PZ[e],LZ,sW);const _ke=new Float32Array([-1,1,-1,0,0,1,0,0,1,0,1,1,0,-1,-1,-1,1,-1]),gke=new Uint16Array([0,1,2,2,3,1,7,6,1,3,6,1,2,5,4,3,4,2,4,8,6,3,4,6]);function yke(e){const t=Mt.createVertexBuffer({context:e,typedArray:_ke,usage:mt.STATIC_DRAW}),n=Mt.createVertexBuffer({context:e,typedArray:LZ,usage:mt.STATIC_DRAW}),i=Mt.createIndexBuffer({context:e,typedArray:gke,usage:mt.STATIC_DRAW,indexDatatype:At.UNSIGNED_SHORT}),o=[{index:0,vertexBuffer:t,componentsPerAttribute:2,componentDatatype:oe.FLOAT},{index:1,vertexBuffer:n,componentsPerAttribute:3,componentDatatype:oe.FLOAT}];return new Fo({context:e,attributes:o,indexBuffer:i})}function aW(e){return function(){return e}}function Rz(e){e._va=e._va&&e._va.destroy(),e._sp=e._sp&&e._sp.destroy();let t,n;const i=e._cubeMaps;if(l(i))for(n=i.length,t=0;t<n;++t)i[t].destroy();const o=e._mipTextures;if(l(o))for(n=o.length,t=0;t<n;++t)o[t].destroy();e._va=void 0,e._sp=void 0,e._cubeMaps=void 0,e._cubeMapBuffers=void 0,e._mipTextures=void 0}gf.prototype.update=function(e){const t=e.context;if(!gf.isSupported(t)||(l(this._texture)&&l(this._va)&&Rz(this),l(this._texture)))return;if(!l(this._texture)&&!this._loading){const g=e.context.textureCache.getTexture(this._url);l(g)&&this._completeLoadFromCache(g)}const n=this._cubeMapBuffers;if(!l(n)&&!this._loading){const g=this;Sy(this._url).then(function(p){g._cubeMapBuffers=p,g._loading=!1}).catch(function(p){g._failLoad(p)}),this._loading=!0}if(!l(this._cubeMapBuffers))return;const i=[];let o=n[0].positiveX.pixelDatatype;l(o)?i.push("RGBA_NORMALIZED"):o=t.halfFloatingPointTexture?ft.HALF_FLOAT:ft.FLOAT;const r=yt.RGBA,s=new nt({defines:i,sources:[NOe]});this._va=yke(t),this._sp=Hn.fromCache({context:t,vertexShaderSource:MOe,fragmentShaderSource:s,attributeLocations:{position:0,cubeMapCoordinates:1}});const a=Math.min(n.length,6);this._maximumMipmapLevel=a-1;const c=this._cubeMaps=new Array(a),u=this._mipTextures=new Array(a),f=n[0].positiveX.width*2,h={originalSize:function(){return f}};for(let g=0;g<a;++g){const p=n[g].positiveY;n[g].positiveY=n[g].negativeY,n[g].negativeY=p;const y=c[g]=new xf({context:t,source:n[g],pixelDatatype:o}),T=c[g].width*2,b=u[g]=new rn({context:t,width:T,height:T,pixelDatatype:o,pixelFormat:r}),x=new AE({vertexArray:this._va,shaderProgram:this._sp,uniformMap:{cubeMap:aW(y)},outputTexture:b,persists:!0,owner:this});e.commandList.push(x),h[`texture${g}`]=aW(b)}this._texture=new rn({context:t,width:f*1.5+2,height:f,pixelDatatype:o,pixelFormat:r}),this._texture.maximumMipmapLevel=this._maximumMipmapLevel,t.textureCache.addTexture(this._url,this._texture);const _=new AE({fragmentShaderSource:ROe,uniformMap:h,outputTexture:this._texture,persists:!1,owner:this});e.commandList.push(_),this._completeLoad()};gf.prototype.isDestroyed=function(){return!1};gf.prototype.destroy=function(){return Rz(this),this._texture=this._texture&&this._texture.destroy(),Je(this)};function uP(e){e=A(e,A.EMPTY_OBJECT);const t=Zr(e.container);if(!l(t))throw new w("container is required");this._container=t;const n=document.createElement("div");n.className="cesium-performanceDisplay";const i=document.createElement("div");i.className="cesium-performanceDisplay-fps",this._fpsText=document.createTextNode(""),i.appendChild(this._fpsText);const o=document.createElement("div");o.className="cesium-performanceDisplay-ms",this._msText=document.createTextNode(""),o.appendChild(this._msText),n.appendChild(o),n.appendChild(i),this._container.appendChild(n),this._lastFpsSampleTime=Gr(),this._lastMsSampleTime=Gr(),this._fpsFrameCount=0,this._msFrameCount=0,this._throttled=!1;const r=document.createElement("div");r.className="cesium-performanceDisplay-throttled",this._throttledText=document.createTextNode(""),r.appendChild(this._throttledText),n.appendChild(r)}Object.defineProperties(uP.prototype,{throttled:{get:function(){return this._throttled},set:function(e){this._throttled!==e&&(e?this._throttledText.nodeValue="(throttled)":this._throttledText.nodeValue="",this._throttled=e)}}});uP.prototype.update=function(e){const t=Gr(),n=A(e,!0);this._fpsFrameCount++;const i=t-this._lastFpsSampleTime;if(i>1e3){let r="N/A";n&&(r=this._fpsFrameCount*1e3/i|0),this._fpsText.nodeValue=`${r} FPS`,this._lastFpsSampleTime=t,this._fpsFrameCount=0}this._msFrameCount++;const o=t-this._lastMsSampleTime;if(o>200){let r="N/A";n&&(r=(o/this._msFrameCount).toFixed(2)),this._msText.nodeValue=`${r} MS`,this._lastMsSampleTime=t,this._msFrameCount=0}};uP.prototype.destroy=function(){return Je(this)};const cW=new d,lW=new d,uW=new ve,XB=new d,Ake=new d,fW=new Ae,Tke=new Ga,LC=[new ve,new ve,new ve,new ve],BC=new $,hr={};hr.initialize=function(){let e=hr._initPromise;return l(e)||(e=je.fetchJson(Un("Assets/approximateTerrainHeights.json")).then(function(t){hr._terrainHeights=t}),hr._initPromise=e),e};hr.getMinimumMaximumHeights=function(e,t){if(E.defined("rectangle",e),!l(hr._terrainHeights))throw new w("You must call ApproximateTerrainHeights.initialize and wait for the promise to resolve before using this function");t=A(t,be.WGS84);const n=BZ(e);let i=hr._defaultMinTerrainHeight,o=hr._defaultMaxTerrainHeight;if(l(n)){const r=`${n.level}-${n.x}-${n.y}`,s=hr._terrainHeights[r];l(s)&&(i=s[0],o=s[1]),t.cartographicToCartesian(Ee.northeast(e,uW),cW),t.cartographicToCartesian(Ee.southwest(e,uW),lW),d.midpoint(lW,cW,XB);const a=t.scaleToGeodeticSurface(XB,Ake);if(l(a)){const c=d.distance(XB,a);i=Math.min(i,-c)}else i=hr._defaultMinTerrainHeight}return i=Math.max(hr._defaultMinTerrainHeight,i),{minimumTerrainHeight:i,maximumTerrainHeight:o}};hr.getBoundingSphere=function(e,t){if(E.defined("rectangle",e),!l(hr._terrainHeights))throw new w("You must call ApproximateTerrainHeights.initialize and wait for the promise to resolve before using this function");t=A(t,be.WGS84);const n=BZ(e);let i=hr._defaultMaxTerrainHeight;if(l(n)){const r=`${n.level}-${n.x}-${n.y}`,s=hr._terrainHeights[r];l(s)&&(i=s[1])}const o=Ae.fromRectangle3D(e,t,0);return Ae.fromRectangle3D(e,t,i,fW),Ae.union(o,fW,o)};function BZ(e){ve.fromRadians(e.east,e.north,0,LC[0]),ve.fromRadians(e.west,e.north,0,LC[1]),ve.fromRadians(e.east,e.south,0,LC[2]),ve.fromRadians(e.west,e.south,0,LC[3]);let t=0,n=0,i=0,o=0;const r=hr._terrainHeightsMaxLevel;let s;for(s=0;s<=r;++s){let a=!1;for(let c=0;c<4;++c){const u=LC[c];if(Tke.positionToTileXY(u,s,BC),c===0)i=BC.x,o=BC.y;else if(i!==BC.x||o!==BC.y){a=!0;break}}if(a)break;t=i,n=o}if(s!==0)return{x:t,y:n,level:s>r?r:s-1}}hr._terrainHeightsMaxLevel=6;hr._defaultMaxTerrainHeight=9e3;hr._defaultMinTerrainHeight=-1e5;hr._terrainHeights=void 0;hr._initPromise=void 0;Object.defineProperties(hr,{initialized:{get:function(){return l(hr._terrainHeights)}}});const Ro=hr;function pi(e){e=A(e,!0),this.value=pi.toValue(e)}Object.defineProperties(pi.prototype,{componentDatatype:{get:function(){return oe.UNSIGNED_BYTE}},componentsPerAttribute:{get:function(){return 1}},normalize:{get:function(){return!1}}});pi.toValue=function(e,t){if(!l(e))throw new w("show is required.");return l(t)?(t[0]=e,t):new Uint8Array([e])};function Js(e,t){this._content=e,this._batchId=t,this._color=void 0}Object.defineProperties(Js.prototype,{show:{get:function(){return this._content.batchTable.getShow(this._batchId)},set:function(e){this._content.batchTable.setShow(this._batchId,e)}},color:{get:function(){return l(this._color)||(this._color=new k),this._content.batchTable.getColor(this._batchId,this._color)},set:function(e){this._content.batchTable.setColor(this._batchId,e)}},polylinePositions:{get:function(){if(l(this._content.getPolylinePositions))return this._content.getPolylinePositions(this._batchId)}},content:{get:function(){return this._content}},tileset:{get:function(){return this._content.tileset}},primitive:{get:function(){return this._content.tileset}},featureId:{get:function(){return this._batchId}},pickId:{get:function(){return this._content.batchTable.getPickColor(this._batchId)}}});Js.prototype.hasProperty=function(e){return this._content.batchTable.hasProperty(this._batchId,e)};Js.prototype.getPropertyIds=function(e){return this._content.batchTable.getPropertyIds(this._batchId,e)};Js.prototype.getProperty=function(e){return this._content.batchTable.getProperty(this._batchId,e)};Js.getPropertyInherited=function(e,t,n){const i=e.batchTable;if(l(i)){if(i.hasPropertyBySemantic(t,n))return i.getPropertyBySemantic(t,n);if(i.hasProperty(t,n))return i.getProperty(t,n)}const o=e.metadata;if(l(o)){if(o.hasPropertyBySemantic(n))return o.getPropertyBySemantic(n);if(o.hasProperty(n))return o.getProperty(n)}const r=e.tile,s=r.metadata;if(l(s)){if(s.hasPropertyBySemantic(n))return s.getPropertyBySemantic(n);if(s.hasProperty(n))return s.getProperty(n)}let a;if(l(r.implicitSubtree)&&(a=r.implicitSubtree.metadata),l(a)){if(a.hasPropertyBySemantic(n))return a.getPropertyBySemantic(n);if(a.hasProperty(n))return a.getProperty(n)}const c=l(e.group)?e.group.metadata:void 0;if(l(c)){if(c.hasPropertyBySemantic(n))return c.getPropertyBySemantic(n);if(c.hasProperty(n))return c.getProperty(n)}const u=e.tileset.metadata;if(l(u)){if(u.hasPropertyBySemantic(n))return u.getPropertyBySemantic(n);if(u.hasProperty(n))return u.getProperty(n)}};Js.prototype.getPropertyInherited=function(e){return Js.getPropertyInherited(this._content,this._batchId,e)};Js.prototype.setProperty=function(e,t){this._content.batchTable.setProperty(this._batchId,e,t),this._content.featurePropertiesDirty=!0};Js.prototype.isExactClass=function(e){return this._content.batchTable.isExactClass(this._batchId,e)};Js.prototype.isClass=function(e){return this._content.batchTable.isClass(this._batchId,e)};Js.prototype.getExactClassName=function(){return this._content.batchTable.getExactClassName(this._batchId)};function My(){this._framebuffer=new Xn,this._textureToCopy=void 0,this._copyDepthCommand=void 0}Object.defineProperties(My.prototype,{framebuffer:{get:function(){return this._framebuffer.framebuffer}}});function Cke(e,t,n){const i=n.width,o=n.height;e._framebuffer.update(t,i,o)}function bke(e,t,n){if(!l(e._copyDepthCommand)){const i=`uniform highp sampler2D u_texture;
|
||
varying vec2 v_textureCoordinates;
|
||
void main()
|
||
{
|
||
gl_FragColor = czm_packDepth(texture2D(u_texture, v_textureCoordinates).r);
|
||
}
|
||
`;e._copyDepthCommand=t.createViewportQuadCommand(i,{renderState:ht.fromCache(),uniformMap:{u_texture:function(){return e._textureToCopy}},owner:e})}e._textureToCopy=n,e._copyDepthCommand.framebuffer=e.framebuffer}My.prototype.update=function(e,t){Cke(this,e,t),bke(this,e,t)};const Eke=new ue,xke=new ue(1,1/255,1/65025,1/16581375);My.prototype.getDepth=function(e,t,n){if(!l(this.framebuffer))return;const i=e.readPixels({x:t,y:n,width:1,height:1,framebuffer:this.framebuffer}),o=ue.unpack(i,0,Eke);return ue.divideByScalar(o,255,o),ue.dot(o,xke)};My.prototype.executeCopyDepth=function(e,t){this._copyDepthCommand.execute(e,t)};My.prototype.isDestroyed=function(){return!1};My.prototype.destroy=function(){return this._framebuffer.destroy(),l(this._copyDepthCommand)&&(this._copyDepthCommand.shaderProgram=l(this._copyDepthCommand.shaderProgram)&&this._copyDepthCommand.shaderProgram.destroy()),Je(this)};function Tr(e){e=A(e,A.EMPTY_OBJECT),this._primitives=[],this._guid=ma(),this._zIndex=void 0,this.show=A(e.show,!0),this.destroyPrimitives=A(e.destroyPrimitives,!0)}Object.defineProperties(Tr.prototype,{length:{get:function(){return this._primitives.length}}});Tr.prototype.add=function(e,t){const n=l(t);if(!l(e))throw new w("primitive is required.");if(n){if(t<0)throw new w("index must be greater than or equal to zero.");if(t>this._primitives.length)throw new w("index must be less than or equal to the number of primitives.")}const i=e._external=e._external||{},o=i._composites=i._composites||{};return o[this._guid]={collection:this},n?this._primitives.splice(t,0,e):this._primitives.push(e),e};Tr.prototype.remove=function(e){if(this.contains(e)){const t=this._primitives.indexOf(e);if(t!==-1)return this._primitives.splice(t,1),delete e._external._composites[this._guid],this.destroyPrimitives&&e.destroy(),!0}return!1};Tr.prototype.removeAndDestroy=function(e){const t=this.remove(e);return t&&!this.destroyPrimitives&&e.destroy(),t};Tr.prototype.removeAll=function(){const e=this._primitives,t=e.length;for(let n=0;n<t;++n)delete e[n]._external._composites[this._guid],this.destroyPrimitives&&e[n].destroy();this._primitives=[]};Tr.prototype.contains=function(e){return!!(l(e)&&e._external&&e._external._composites&&e._external._composites[this._guid])};function fP(e,t){if(!e.contains(t))throw new w("primitive is not in this collection.");return e._primitives.indexOf(t)}Tr.prototype.raise=function(e){if(l(e)){const t=fP(this,e),n=this._primitives;if(t!==n.length-1){const i=n[t];n[t]=n[t+1],n[t+1]=i}}};Tr.prototype.raiseToTop=function(e){if(l(e)){const t=fP(this,e),n=this._primitives;t!==n.length-1&&(n.splice(t,1),n.push(e))}};Tr.prototype.lower=function(e){if(l(e)){const t=fP(this,e),n=this._primitives;if(t!==0){const i=n[t];n[t]=n[t-1],n[t-1]=i}}};Tr.prototype.lowerToBottom=function(e){if(l(e)){const t=fP(this,e),n=this._primitives;t!==0&&(n.splice(t,1),n.unshift(e))}};Tr.prototype.get=function(e){if(!l(e))throw new w("index is required.");return this._primitives[e]};Tr.prototype.update=function(e){if(!this.show)return;const t=this._primitives;for(let n=0;n<t.length;++n)t[n].update(e)};Tr.prototype.prePassesUpdate=function(e){const t=this._primitives;for(let n=0;n<t.length;++n){const i=t[n];l(i.prePassesUpdate)&&i.prePassesUpdate(e)}};Tr.prototype.updateForPass=function(e,t){const n=this._primitives;for(let i=0;i<n.length;++i){const o=n[i];l(o.updateForPass)&&o.updateForPass(e,t)}};Tr.prototype.postPassesUpdate=function(e){const t=this._primitives;for(let n=0;n<t.length;++n){const i=t[n];l(i.postPassesUpdate)&&i.postPassesUpdate(e)}};Tr.prototype.isDestroyed=function(){return!1};Tr.prototype.destroy=function(){return this.removeAll(),Je(this)};const sa={},wke=new ue(0,0,0,1);let Ea=new ue;const Ske=new at,KB=new $,JB=new $;sa.wgs84ToWindowCoordinates=function(e,t,n){return sa.wgs84WithEyeOffsetToWindowCoordinates(e,t,d.ZERO,n)};const dW=new ue,hW=new d;function RC(e,t,n,i){const o=n.viewMatrix,r=N.multiplyByVector(o,ue.fromElements(e.x,e.y,e.z,1,dW),dW),s=d.multiplyComponents(t,d.normalize(r,hW),hW);return r.x+=t.x+s.x,r.y+=t.y+s.y,r.z+=s.z,N.multiplyByVector(n.frustum.projectionMatrix,r,i)}const vke=new ve(Math.PI,F.PI_OVER_TWO),Dke=new d,Ike=new d;sa.wgs84WithEyeOffsetToWindowCoordinates=function(e,t,n,i){if(!l(e))throw new w("scene is required.");if(!l(t))throw new w("position is required.");const o=e.frameState,r=sa.computeActualWgs84Position(o,t,wke);if(!l(r))return;const s=e.canvas,a=Ske;a.x=0,a.y=0,a.width=s.clientWidth,a.height=s.clientHeight;const c=e.camera;let u=!1;if(o.mode===me.SCENE2D){const f=e.mapProjection,h=vke,_=f.project(h,Dke),g=d.clone(c.position,Ike),p=c.frustum.clone(),y=N.computeViewportTransformation(a,0,1,new N),T=c.frustum.projectionMatrix,b=c.positionWC.y,x=d.fromElements(F.sign(b)*_.x-b,0,-c.positionWC.x),v=En.pointToGLWindowCoordinates(T,y,x);if(b===0||v.x<=0||v.x>=s.clientWidth)u=!0;else{if(v.x>s.clientWidth*.5){a.width=v.x,c.frustum.right=_.x-b,Ea=RC(r,n,c,Ea),sa.clipToGLWindowCoordinates(a,Ea,KB),a.x+=v.x,c.position.x=-c.position.x;const D=c.frustum.right;c.frustum.right=-c.frustum.left,c.frustum.left=-D,Ea=RC(r,n,c,Ea),sa.clipToGLWindowCoordinates(a,Ea,JB)}else{a.x+=v.x,a.width-=v.x,c.frustum.left=-_.x-b,Ea=RC(r,n,c,Ea),sa.clipToGLWindowCoordinates(a,Ea,KB),a.x=a.x-a.width,c.position.x=-c.position.x;const D=c.frustum.left;c.frustum.left=-c.frustum.right,c.frustum.right=-D,Ea=RC(r,n,c,Ea),sa.clipToGLWindowCoordinates(a,Ea,JB)}d.clone(g,c.position),c.frustum=p.clone(),i=$.clone(KB,i),(i.x<0||i.x>s.clientWidth)&&(i.x=JB.x)}}if(o.mode!==me.SCENE2D||u){if(Ea=RC(r,n,c,Ea),Ea.z<0&&!(c.frustum instanceof nn)&&!(c.frustum instanceof yr))return;i=sa.clipToGLWindowCoordinates(a,Ea,i)}return i.y=s.clientHeight-i.y,i};sa.wgs84ToDrawingBufferCoordinates=function(e,t,n){if(n=sa.wgs84ToWindowCoordinates(e,t,n),!!l(n))return sa.transformWindowToDrawingBuffer(e,n,n)};const hh=new d,Pke=new ve;sa.computeActualWgs84Position=function(e,t,n){const i=e.mode;if(i===me.SCENE3D)return d.clone(t,n);const o=e.mapProjection,r=o.ellipsoid.cartesianToCartographic(t,Pke);if(!l(r))return;if(o.project(r,hh),i===me.COLUMBUS_VIEW)return d.fromElements(hh.z,hh.x,hh.y,n);if(i===me.SCENE2D)return d.fromElements(0,hh.x,hh.y,n);const s=e.morphTime;return d.fromElements(F.lerp(hh.z,t.x,s),F.lerp(hh.x,t.y,s),F.lerp(hh.y,t.z,s),n)};const pW=new d,mW=new d,_W=new N;sa.clipToGLWindowCoordinates=function(e,t,n){return d.divideByScalar(t,t.w,pW),N.computeViewportTransformation(e,0,1,_W),N.multiplyByPoint(_W,pW,mW),$.fromCartesian3(mW,n)};sa.transformWindowToDrawingBuffer=function(e,t,n){const i=e.canvas,o=e.drawingBufferWidth/i.clientWidth,r=e.drawingBufferHeight/i.clientHeight;return $.fromElements(t.x*o,t.y*r,n)};const Oke=new ue,gW=new ue;sa.drawingBufferToWgs84Coordinates=function(e,t,n,i){const r=e.context.uniformState,s=r.currentFrustum,a=s.x,c=s.y;if(e.frameState.useLogDepth){const g=n*r.log2FarDepthFromNearPlusOne,p=Math.pow(2,g)-1;n=c*(1-a/(p+a))/(c-a)}const u=e.view.passState.viewport,f=ue.clone(ue.UNIT_W,Oke);f.x=(t.x-u.x)/u.width*2-1,f.y=(t.y-u.y)/u.height*2-1,f.z=n*2-1,f.w=1;let h,_=e.camera.frustum;if(!l(_.fovy))l(_._offCenterFrustum)&&(_=_._offCenterFrustum),h=gW,h.x=(f.x*(_.right-_.left)+_.left+_.right)*.5,h.y=(f.y*(_.top-_.bottom)+_.bottom+_.top)*.5,h.z=(f.z*(a-c)-a-c)*.5,h.w=1,h=N.multiplyByVector(r.inverseView,h,h);else{h=N.multiplyByVector(r.inverseViewProjection,f,gW);const g=1/h.w;d.multiplyByScalar(h,g,h)}return d.fromCartesian4(h,i)};const es=sa;function Lke(e,t){this.near=A(e,0),this.far=A(t,0);const n=We.NUMBER_OF_PASSES,i=new Array(n),o=new Array(n);for(let r=0;r<n;++r)i[r]=[],o[r]=0;this.commands=i,this.indices=o}const wF=`uniform highp sampler2D u_depthTexture;
|
||
|
||
varying vec2 v_textureCoordinates;
|
||
|
||
void main()
|
||
{
|
||
gl_FragColor = czm_packDepth(texture2D(u_depthTexture, v_textureCoordinates).r);
|
||
}
|
||
`;function Nd(){this._picking=!1,this._numSamples=1,this._tempCopyDepthTexture=void 0,this._pickColorFramebuffer=new Xn({depthStencil:!0,supportsDepthTexture:!0}),this._outputFramebuffer=new Xn({depthStencil:!0,supportsDepthTexture:!0}),this._copyDepthFramebuffer=new Xn,this._tempCopyDepthFramebuffer=new Xn,this._updateDepthFramebuffer=new Xn({createColorAttachments:!1,createDepthAttachments:!1,depthStencil:!0}),this._clearGlobeColorCommand=void 0,this._copyColorCommand=void 0,this._copyDepthCommand=void 0,this._tempCopyDepthCommand=void 0,this._updateDepthCommand=void 0,this._viewport=new at,this._rs=void 0,this._rsBlend=void 0,this._rsUpdate=void 0,this._useScissorTest=!1,this._scissorRectangle=void 0,this._useHdr=void 0,this._clearGlobeDepth=void 0}Object.defineProperties(Nd.prototype,{colorFramebufferManager:{get:function(){return this._picking?this._pickColorFramebuffer:this._outputFramebuffer}},framebuffer:{get:function(){return this.colorFramebufferManager.framebuffer}},depthStencilTexture:{get:function(){return this.colorFramebufferManager.getDepthStencilTexture()}},picking:{get:function(){return this._picking},set:function(e){this._picking=e}}});function Bke(e){e._pickColorFramebuffer.destroy(),e._outputFramebuffer.destroy(),e._copyDepthFramebuffer.destroy(),e._tempCopyDepthFramebuffer.destroy(),e._updateDepthFramebuffer.destroy()}function RZ(e,t,n,i,o){e._viewport.width=n,e._viewport.height=i;const r=!at.equals(e._viewport,o.viewport);let s=r!==e._useScissorTest;e._useScissorTest=r,at.equals(e._scissorRectangle,o.viewport)||(e._scissorRectangle=at.clone(o.viewport,e._scissorRectangle),s=!0),(!l(e._rs)||!at.equals(e._viewport,e._rs.viewport)||s)&&(e._rs=ht.fromCache({viewport:e._viewport,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle}}),e._rsBlend=ht.fromCache({viewport:e._viewport,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle},blending:fo.ALPHA_BLEND}),e._rsUpdate=ht.fromCache({viewport:e._viewport,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle},stencilTest:{enabled:!0,frontFunction:Ni.EQUAL,frontOperation:{fail:It.KEEP,zFail:It.KEEP,zPass:It.KEEP},backFunction:Ni.NEVER,reference:Kt.CESIUM_3D_TILE_MASK,mask:Kt.CESIUM_3D_TILE_MASK}})),l(e._copyDepthCommand)||(e._copyDepthCommand=t.createViewportQuadCommand(wF,{uniformMap:{u_depthTexture:function(){return e.colorFramebufferManager.getDepthStencilTexture()}},owner:e})),e._copyDepthCommand.framebuffer=e._copyDepthFramebuffer.framebuffer,e._copyDepthCommand.renderState=e._rs,l(e._copyColorCommand)||(e._copyColorCommand=t.createViewportQuadCommand(sy,{uniformMap:{colorTexture:function(){return e.colorFramebufferManager.getColorTexture()}},owner:e})),e._copyColorCommand.renderState=e._rs,l(e._tempCopyDepthCommand)||(e._tempCopyDepthCommand=t.createViewportQuadCommand(wF,{uniformMap:{u_depthTexture:function(){return e._tempCopyDepthTexture}},owner:e})),e._tempCopyDepthCommand.framebuffer=e._tempCopyDepthFramebuffer.framebuffer,e._tempCopyDepthCommand.renderState=e._rs,l(e._updateDepthCommand)||(e._updateDepthCommand=t.createViewportQuadCommand(sy,{uniformMap:{colorTexture:function(){return e._tempCopyDepthFramebuffer.getColorTexture()}},owner:e})),e._updateDepthCommand.framebuffer=e._updateDepthFramebuffer.framebuffer,e._updateDepthCommand.renderState=e._rsUpdate,l(e._clearGlobeColorCommand)||(e._clearGlobeColorCommand=new Bo({color:new k(0,0,0,0),stencil:0,owner:e})),e._clearGlobeColorCommand.framebuffer=e.framebuffer}Nd.prototype.update=function(e,t,n,i,o,r){const s=n.width,a=n.height,c=o?e.halfFloatingPointTexture?ft.HALF_FLOAT:ft.FLOAT:ft.UNSIGNED_BYTE;this._numSamples=i,this.picking?this._pickColorFramebuffer.update(e,s,a):this._outputFramebuffer.update(e,s,a,i,c),this._copyDepthFramebuffer.update(e,s,a),RZ(this,e,s,a,t),e.uniformState.globeDepthTexture=void 0,this._useHdr=o,this._clearGlobeDepth=r};Nd.prototype.prepareColorTextures=function(e,t){!this.picking&&this._numSamples>1&&this._outputFramebuffer.prepareTextures(e,t)};Nd.prototype.executeCopyDepth=function(e,t){l(this._copyDepthCommand)&&(this.prepareColorTextures(e),this._copyDepthCommand.execute(e,t),e.uniformState.globeDepthTexture=this._copyDepthFramebuffer.getColorTexture())};Nd.prototype.executeUpdateDepth=function(e,t,n,i){const o=l(i)?i:t.framebuffer.depthStencilTexture;if(n||o!==this.colorFramebufferManager.getDepthStencilTexture()){if(l(this._updateDepthCommand)){if(!l(this._updateDepthFramebuffer.framebuffer)||this._updateDepthFramebuffer.getDepthStencilTexture()!==o||this._updateDepthFramebuffer.getColorTexture()!==this._copyDepthFramebuffer.getColorTexture()){const r=this._copyDepthFramebuffer.getColorTexture().width,s=this._copyDepthFramebuffer.getColorTexture().height;this._tempCopyDepthFramebuffer.destroy(),this._tempCopyDepthFramebuffer.update(e,r,s);const a=this._copyDepthFramebuffer.getColorTexture();this._updateDepthFramebuffer.setColorTexture(a,0),this._updateDepthFramebuffer.setDepthStencilTexture(o),this._updateDepthFramebuffer.update(e,r,s),RZ(this,e,r,s,t)}this._tempCopyDepthTexture=o,this._tempCopyDepthCommand.execute(e,t),this._updateDepthCommand.execute(e,t)}return}l(this._copyDepthCommand)&&this._copyDepthCommand.execute(e,t)};Nd.prototype.executeCopyColor=function(e,t){l(this._copyColorCommand)&&this._copyColorCommand.execute(e,t)};Nd.prototype.clear=function(e,t,n){const i=this._clearGlobeColorCommand;l(i)&&(k.clone(n,i.color),this.colorFramebufferManager.clear(e,i,t))};Nd.prototype.isDestroyed=function(){return!1};Nd.prototype.destroy=function(){return Bke(this),l(this._copyColorCommand)&&(this._copyColorCommand.shaderProgram=this._copyColorCommand.shaderProgram.destroy()),l(this._copyDepthCommand)&&(this._copyDepthCommand.shaderProgram=this._copyDepthCommand.shaderProgram.destroy()),l(this._tempCopyDepthCommand)&&(this._tempCopyDepthCommand.shaderProgram=this._tempCopyDepthCommand.shaderProgram.destroy()),l(this._updateDepthCommand)&&(this._updateDepthCommand.shaderProgram=this._updateDepthCommand.shaderProgram.destroy()),Je(this)};function Fy(){this._framebuffer=new Xn({depthStencil:!0,supportsDepthTexture:!0}),this._packedDepthFramebuffer=new Xn,this._renderState=void 0,this._packedDepthCommand=void 0,this._clearCommand=void 0,this._viewport=new at,this._useScissorTest=!1,this._scissorRectangle=void 0,this._useHdr=void 0}Object.defineProperties(Fy.prototype,{classificationTexture:{get:function(){return this._framebuffer.getColorTexture()}},classificationFramebuffer:{get:function(){return this._framebuffer.framebuffer}},packedDepthFramebuffer:{get:function(){return this._packedDepthFramebuffer.framebuffer}},depthStencilTexture:{get:function(){return this._framebuffer.getDepthStencilTexture()}},depthStencilRenderbuffer:{get:function(){return this._framebuffer.getDepthStencilRenderbuffer()}},packedDepthTexture:{get:function(){return this._packedDepthFramebuffer.getColorTexture()}}});function Rke(e){e._framebuffer.destroy(),e._packedDepthFramebuffer.destroy()}function Nke(e,t,n,i,o){const r=o?t.halfFloatingPointTexture?ft.HALF_FLOAT:ft.FLOAT:ft.UNSIGNED_BYTE;e._framebuffer.update(t,n,i,1,r),e._packedDepthFramebuffer.update(t,n,i)}function Mke(e,t,n,i,o){e._viewport.width=n,e._viewport.height=i;const r=!at.equals(e._viewport,o.viewport);let s=r!==e._useScissorTest;e._useScissorTest=r,at.equals(e._scissorRectangle,o.viewport)||(e._scissorRectangle=at.clone(o.viewport,e._scissorRectangle),s=!0),(!l(e._renderState)||!at.equals(e._viewport,e._renderState.viewport)||s)&&(e._renderState=ht.fromCache({viewport:e._viewport,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle}})),l(e._packedDepthCommand)||(e._packedDepthCommand=t.createViewportQuadCommand(wF,{uniformMap:{u_depthTexture:function(){return e.depthStencilTexture}},owner:e})),l(e._clearCommand)||(e._clearCommand=new Bo({color:new k(0,0,0,0),depth:1,stencil:0,owner:e})),e._packedDepthCommand.framebuffer=e._packedDepthFramebuffer.framebuffer,e._packedDepthCommand.renderState=e._renderState,e._clearCommand.framebuffer=e.classificationFramebuffer,e._clearCommand.renderState=e._renderState}Fy.prototype.updateAndClear=function(e,t,n,i){const o=t.width,r=t.height;Nke(this,n,o,r,e),Mke(this,n,o,r,i),this._useHdr=e};Fy.prototype.clearClassification=function(e,t){this._clearCommand.execute(e,t)};Fy.prototype.packDepth=function(e,t){return this._packedDepthCommand.execute(e,t),this.packedDepthTexture};Fy.prototype.isDestroyed=function(){return!1};Fy.prototype.destroy=function(){return Rke(this),Je(this)};function hp(e){this._numSamples=1,this._translucentMultipassSupport=!1,this._translucentMRTSupport=!1;const t=e.colorBufferFloat&&e.depthTexture&&e.floatBlend;this._translucentMRTSupport=e.drawBuffers&&t,this._translucentMultipassSupport=!this._translucentMRTSupport&&t,this._opaqueFBO=void 0,this._opaqueTexture=void 0,this._depthStencilTexture=void 0,this._accumulationTexture=void 0,this._translucentFBO=new Xn({colorAttachmentsLength:this._translucentMRTSupport?2:1,createColorAttachments:!1,createDepthAttachments:!1,depth:!0}),this._alphaFBO=new Xn({createColorAttachments:!1,createDepthAttachments:!1,depth:!0}),this._adjustTranslucentFBO=new Xn({colorAttachmentsLength:this._translucentMRTSupport?2:1,createColorAttachments:!1}),this._adjustAlphaFBO=new Xn({createColorAttachments:!1}),this._opaqueClearCommand=new Bo({color:new k(0,0,0,0),owner:this}),this._translucentMRTClearCommand=new Bo({color:new k(0,0,0,1),owner:this}),this._translucentMultipassClearCommand=new Bo({color:new k(0,0,0,0),owner:this}),this._alphaClearCommand=new Bo({color:new k(1,1,1,1),owner:this}),this._translucentRenderStateCache={},this._alphaRenderStateCache={},this._compositeCommand=void 0,this._adjustTranslucentCommand=void 0,this._adjustAlphaCommand=void 0,this._viewport=new at,this._rs=void 0,this._useScissorTest=!1,this._scissorRectangle=void 0,this._useHDR=!1}function NZ(e){e._accumulationTexture=e._accumulationTexture&&!e._accumulationTexture.isDestroyed()&&e._accumulationTexture.destroy(),e._revealageTexture=e._revealageTexture&&!e._revealageTexture.isDestroyed()&&e._revealageTexture.destroy()}function SF(e){e._translucentFBO.destroy(),e._alphaFBO.destroy(),e._adjustTranslucentFBO.destroy(),e._adjustAlphaFBO.destroy()}function MZ(e){NZ(e),SF(e)}function Fke(e,t,n,i){NZ(e),e._accumulationTexture=new rn({context:t,width:n,height:i,pixelFormat:yt.RGBA,pixelDatatype:ft.FLOAT});const o=new Float32Array(n*i*4);e._revealageTexture=new rn({context:t,pixelFormat:yt.RGBA,pixelDatatype:ft.FLOAT,source:{arrayBufferView:o,width:n,height:i},flipY:!1})}function zke(e,t){SF(e);const n=fe.FRAMEBUFFER_COMPLETE;let i=!0;const o=e._accumulationTexture.width,r=e._accumulationTexture.height;if(e._translucentMRTSupport&&(e._translucentFBO.setColorTexture(e._accumulationTexture,0),e._translucentFBO.setColorTexture(e._revealageTexture,1),e._translucentFBO.setDepthStencilTexture(e._depthStencilTexture),e._translucentFBO.update(t,o,r),e._adjustTranslucentFBO.setColorTexture(e._accumulationTexture,0),e._adjustTranslucentFBO.setColorTexture(e._revealageTexture,1),e._adjustTranslucentFBO.update(t,o,r),(e._translucentFBO.status!==n||e._adjustTranslucentFBO.status!==n)&&(SF(e),e._translucentMRTSupport=!1)),!e._translucentMRTSupport){e._translucentFBO.setColorTexture(e._accumulationTexture),e._translucentFBO.setDepthStencilTexture(e._depthStencilTexture),e._translucentFBO.update(t,o,r),e._alphaFBO.setColorTexture(e._revealageTexture),e._alphaFBO.setDepthStencilTexture(e._depthStencilTexture),e._alphaFBO.update(t,o,r),e._adjustTranslucentFBO.setColorTexture(e._accumulationTexture),e._adjustTranslucentFBO.update(t,o,r),e._adjustAlphaFBO.setColorTexture(e._revealageTexture),e._adjustAlphaFBO.update(t,o,r);const s=e._translucentFBO.status===n,a=e._alphaFBO.status===n,c=e._adjustTranslucentFBO.status===n,u=e._adjustAlphaFBO.status===n;(!s||!a||!c||!u)&&(MZ(e),e._translucentMultipassSupport=!1,i=!1)}return i}hp.prototype.update=function(e,t,n,i,o){if(!this.isSupported())return;this._opaqueFBO=n,this._opaqueTexture=n.getColorTexture(0),this._depthStencilTexture=n.getDepthStencilTexture();const r=this._opaqueTexture.width,s=this._opaqueTexture.height,a=this._accumulationTexture,c=!l(a)||a.width!==r||a.height!==s||i!==this._useHDR,u=this._numSamples!==o;if((c||u)&&(this._numSamples=o,Fke(this,e,r,s)),(!l(this._translucentFBO.framebuffer)||c||u)&&!zke(this,e))return;this._useHDR=i;const f=this;let h,_;l(this._compositeCommand)||(h=new nt({sources:[DOe]}),this._translucentMRTSupport&&h.defines.push("MRT"),_={u_opaque:function(){return f._opaqueTexture},u_accumulation:function(){return f._accumulationTexture},u_revealage:function(){return f._revealageTexture}},this._compositeCommand=e.createViewportQuadCommand(h,{uniformMap:_,owner:this})),l(this._adjustTranslucentCommand)||(this._translucentMRTSupport?(h=new nt({defines:["MRT"],sources:[O5]}),_={u_bgColor:function(){return f._translucentMRTClearCommand.color},u_depthTexture:function(){return f._depthStencilTexture}},this._adjustTranslucentCommand=e.createViewportQuadCommand(h,{uniformMap:_,owner:this})):this._translucentMultipassSupport&&(h=new nt({sources:[O5]}),_={u_bgColor:function(){return f._translucentMultipassClearCommand.color},u_depthTexture:function(){return f._depthStencilTexture}},this._adjustTranslucentCommand=e.createViewportQuadCommand(h,{uniformMap:_,owner:this}),_={u_bgColor:function(){return f._alphaClearCommand.color},u_depthTexture:function(){return f._depthStencilTexture}},this._adjustAlphaCommand=e.createViewportQuadCommand(h,{uniformMap:_,owner:this}))),this._viewport.width=r,this._viewport.height=s;const g=!at.equals(this._viewport,t.viewport);let p=g!==this._useScissorTest;this._useScissorTest=g,at.equals(this._scissorRectangle,t.viewport)||(this._scissorRectangle=at.clone(t.viewport,this._scissorRectangle),p=!0),(!l(this._rs)||!at.equals(this._viewport,this._rs.viewport)||p)&&(this._rs=ht.fromCache({viewport:this._viewport,scissorTest:{enabled:this._useScissorTest,rectangle:this._scissorRectangle}})),l(this._compositeCommand)&&(this._compositeCommand.renderState=this._rs),this._adjustTranslucentCommand&&(this._adjustTranslucentCommand.renderState=this._rs),l(this._adjustAlphaCommand)&&(this._adjustAlphaCommand.renderState=this._rs)};const Uke={enabled:!0,color:new k(0,0,0,0),equationRgb:Xl.ADD,equationAlpha:Xl.ADD,functionSourceRgb:fr.ONE,functionDestinationRgb:fr.ONE,functionSourceAlpha:fr.ZERO,functionDestinationAlpha:fr.ONE_MINUS_SOURCE_ALPHA},Hke={enabled:!0,color:new k(0,0,0,0),equationRgb:Xl.ADD,equationAlpha:Xl.ADD,functionSourceRgb:fr.ONE,functionDestinationRgb:fr.ONE,functionSourceAlpha:fr.ONE,functionDestinationAlpha:fr.ONE},Vke={enabled:!0,color:new k(0,0,0,0),equationRgb:Xl.ADD,equationAlpha:Xl.ADD,functionSourceRgb:fr.ZERO,functionDestinationRgb:fr.ONE_MINUS_SOURCE_ALPHA,functionSourceAlpha:fr.ZERO,functionDestinationAlpha:fr.ONE_MINUS_SOURCE_ALPHA};function Nz(e,t,n,i){let o=n[i.id];if(!l(o)){const r=ht.getState(i);r.depthMask=!1,r.blending=t,o=ht.fromCache(r),n[i.id]=o}return o}function kke(e,t,n){return Nz(t,Uke,e._translucentRenderStateCache,n)}function Gke(e,t,n){return Nz(t,Hke,e._translucentRenderStateCache,n)}function Wke(e,t,n){return Nz(t,Vke,e._alphaRenderStateCache,n)}const qke=` vec3 Ci = czm_gl_FragColor.rgb * czm_gl_FragColor.a;
|
||
float ai = czm_gl_FragColor.a;
|
||
float wzi = czm_alphaWeight(ai);
|
||
gl_FragData[0] = vec4(Ci * wzi, ai);
|
||
gl_FragData[1] = vec4(ai * wzi);
|
||
`,jke=` vec3 Ci = czm_gl_FragColor.rgb * czm_gl_FragColor.a;
|
||
float ai = czm_gl_FragColor.a;
|
||
float wzi = czm_alphaWeight(ai);
|
||
gl_FragColor = vec4(Ci, ai) * wzi;
|
||
`,Yke=` float ai = czm_gl_FragColor.a;
|
||
gl_FragColor = vec4(ai);
|
||
`;function Mz(e,t,n,i){let o=e.shaderCache.getDerivedShaderProgram(t,n);if(!l(o)){const r=t._attributeLocations,s=t.fragmentShaderSource.clone();s.sources=s.sources.map(function(a){return a=nt.replaceMain(a,"czm_translucent_main"),a=a.replace(/gl_FragColor/g,"czm_gl_FragColor"),a=a.replace(/\bdiscard\b/g,"czm_discard = true"),a=a.replace(/czm_phong/g,"czm_translucentPhong"),a}),s.sources.splice(0,0,`${i.indexOf("gl_FragData")!==-1?`#extension GL_EXT_draw_buffers : enable
|
||
`:""}vec4 czm_gl_FragColor;
|
||
bool czm_discard = false;
|
||
`),s.sources.push(`void main()
|
||
{
|
||
czm_translucent_main();
|
||
if (czm_discard)
|
||
{
|
||
discard;
|
||
}
|
||
${i}}
|
||
`),o=e.shaderCache.createDerivedShaderProgram(t,n,{vertexShaderSource:t.vertexShaderSource,fragmentShaderSource:s,attributeLocations:r})}return o}function $ke(e,t){return Mz(e,t,"translucentMRT",qke)}function Xke(e,t){return Mz(e,t,"translucentMultipass",jke)}function Kke(e,t){return Mz(e,t,"alphaMultipass",Yke)}hp.prototype.createDerivedCommands=function(e,t,n){if(l(n)||(n={}),this._translucentMRTSupport){let i,o;l(n.translucentCommand)&&(i=n.translucentCommand.shaderProgram,o=n.translucentCommand.renderState),n.translucentCommand=Dt.shallowClone(e,n.translucentCommand),!l(i)||n.shaderProgramId!==e.shaderProgram.id?(n.translucentCommand.shaderProgram=$ke(t,e.shaderProgram),n.translucentCommand.renderState=kke(this,t,e.renderState),n.shaderProgramId=e.shaderProgram.id):(n.translucentCommand.shaderProgram=i,n.translucentCommand.renderState=o)}else{let i,o,r,s;l(n.translucentCommand)&&(i=n.translucentCommand.shaderProgram,o=n.translucentCommand.renderState,r=n.alphaCommand.shaderProgram,s=n.alphaCommand.renderState),n.translucentCommand=Dt.shallowClone(e,n.translucentCommand),n.alphaCommand=Dt.shallowClone(e,n.alphaCommand),!l(i)||n.shaderProgramId!==e.shaderProgram.id?(n.translucentCommand.shaderProgram=Xke(t,e.shaderProgram),n.translucentCommand.renderState=Gke(this,t,e.renderState),n.alphaCommand.shaderProgram=Kke(t,e.shaderProgram),n.alphaCommand.renderState=Wke(this,t,e.renderState),n.shaderProgramId=e.shaderProgram.id):(n.translucentCommand.shaderProgram=i,n.translucentCommand.renderState=o,n.alphaCommand.shaderProgram=r,n.alphaCommand.renderState=s)}return n};function Jke(e,t,n,i,o,r){let s,a,c;const u=t.context,f=t.frameState.useLogDepth,h=t._hdr,_=i.framebuffer,g=o.length,p=t.frameState.shadowState.lightShadowsEnabled;i.framebuffer=e._adjustTranslucentFBO.framebuffer,e._adjustTranslucentCommand.execute(u,i),i.framebuffer=e._adjustAlphaFBO.framebuffer,e._adjustAlphaCommand.execute(u,i);const y=e._opaqueFBO.framebuffer;for(i.framebuffer=e._translucentFBO.framebuffer,c=0;c<g;++c)s=o[c],s=f?s.derivedCommands.logDepth.command:s,s=h?s.derivedCommands.hdr.command:s,a=p&&s.receiveShadows?s.derivedCommands.oit.shadows.translucentCommand:s.derivedCommands.oit.translucentCommand,n(a,t,u,i,y);for(l(r)&&(s=r.unclassifiedCommand,a=p&&s.receiveShadows?s.derivedCommands.oit.shadows.translucentCommand:s.derivedCommands.oit.translucentCommand,n(a,t,u,i,y)),i.framebuffer=e._alphaFBO.framebuffer,c=0;c<g;++c)s=o[c],s=f?s.derivedCommands.logDepth.command:s,s=h?s.derivedCommands.hdr.command:s,a=p&&s.receiveShadows?s.derivedCommands.oit.shadows.alphaCommand:s.derivedCommands.oit.alphaCommand,n(a,t,u,i,y);l(r)&&(s=r.unclassifiedCommand,a=p&&s.receiveShadows?s.derivedCommands.oit.shadows.alphaCommand:s.derivedCommands.oit.alphaCommand,n(a,t,u,i,y)),i.framebuffer=_}function Qke(e,t,n,i,o,r){const s=t.context,a=t.frameState.useLogDepth,c=t._hdr,u=i.framebuffer,f=o.length,h=t.frameState.shadowState.lightShadowsEnabled;i.framebuffer=e._adjustTranslucentFBO.framebuffer,e._adjustTranslucentCommand.execute(s,i);const _=e._opaqueFBO.framebuffer;i.framebuffer=e._translucentFBO.framebuffer;let g,p;for(let y=0;y<f;++y)g=o[y],g=a?g.derivedCommands.logDepth.command:g,g=c?g.derivedCommands.hdr.command:g,p=h&&g.receiveShadows?g.derivedCommands.oit.shadows.translucentCommand:g.derivedCommands.oit.translucentCommand,n(p,t,s,i,_);l(r)&&(g=r.unclassifiedCommand,p=h&&g.receiveShadows?g.derivedCommands.oit.shadows.translucentCommand:g.derivedCommands.oit.translucentCommand,n(p,t,s,i,_)),i.framebuffer=u}hp.prototype.executeCommands=function(e,t,n,i,o){if(this._translucentMRTSupport){Qke(this,e,t,n,i,o);return}Jke(this,e,t,n,i,o)};hp.prototype.execute=function(e,t){this._compositeCommand.execute(e,t)};hp.prototype.clear=function(e,t,n){const i=t.framebuffer;t.framebuffer=this._opaqueFBO.framebuffer,k.clone(n,this._opaqueClearCommand.color),this._opaqueClearCommand.execute(e,t),t.framebuffer=this._translucentFBO.framebuffer,(this._translucentMRTSupport?this._translucentMRTClearCommand:this._translucentMultipassClearCommand).execute(e,t),this._translucentMultipassSupport&&(t.framebuffer=this._alphaFBO.framebuffer,this._alphaClearCommand.execute(e,t)),t.framebuffer=i};hp.prototype.isSupported=function(){return this._translucentMRTSupport||this._translucentMultipassSupport};hp.prototype.isDestroyed=function(){return!1};hp.prototype.destroy=function(){return MZ(this),l(this._compositeCommand)&&(this._compositeCommand.shaderProgram=this._compositeCommand.shaderProgram&&this._compositeCommand.shaderProgram.destroy()),l(this._adjustTranslucentCommand)&&(this._adjustTranslucentCommand.shaderProgram=this._adjustTranslucentCommand.shaderProgram&&this._adjustTranslucentCommand.shaderProgram.destroy()),l(this._adjustAlphaCommand)&&(this._adjustAlphaCommand.shaderProgram=this._adjustAlphaCommand.shaderProgram&&this._adjustAlphaCommand.shaderProgram.destroy()),Je(this)};function xx(){this._framebuffer=new Xn({color:!1,depthStencil:!0,supportsDepthTexture:!0}),this._passState=void 0}Object.defineProperties(xx.prototype,{framebuffer:{get:function(){return this._framebuffer.framebuffer}}});function Zke(e){e._framebuffer.destroy()}function eGe(e,t){const n=t.drawingBufferWidth,i=t.drawingBufferHeight;e._framebuffer.update(t,n,i);const o=new vy(t);o.blendingEnabled=!1,o.scissorTest={enabled:!0,rectangle:new at},o.viewport=new at,e._passState=o}xx.prototype.update=function(e,t,n){const i=n.width,o=n.height;this._framebuffer.isDirty(i,o)&&eGe(this,e);const r=this.framebuffer,s=this._passState;return s.framebuffer=r,s.viewport.width=i,s.viewport.height=o,s.scissorTest.rectangle.x=t.x,s.scissorTest.rectangle.y=o-t.y,s.scissorTest.rectangle.width=1,s.scissorTest.rectangle.height=1,s};xx.prototype.isDestroyed=function(){return!1};xx.prototype.destroy=function(){return Zke(this),Je(this)};function wx(e){const t=new vy(e);t.blendingEnabled=!1,t.scissorTest={enabled:!0,rectangle:new at},t.viewport=new at,this._context=e,this._fb=new Xn({depthStencil:!0}),this._passState=t,this._width=0,this._height=0}wx.prototype.begin=function(e,t){const n=this._context,i=t.width,o=t.height;return at.clone(e,this._passState.scissorTest.rectangle),this._width=i,this._height=o,this._fb.update(n,i,o),this._passState.framebuffer=this._fb.framebuffer,this._passState.viewport.width=i,this._passState.viewport.height=o,this._passState};const NC=new k;wx.prototype.end=function(e){const t=A(e.width,1),n=A(e.height,1),i=this._context,o=i.readPixels({x:e.x,y:e.y,width:t,height:n,framebuffer:this._fb.framebuffer}),r=Math.max(t,n),s=r*r,a=Math.floor(t*.5),c=Math.floor(n*.5);let u=0,f=0,h=0,_=-1;for(let g=0;g<s;++g){if(-a<=u&&u<=a&&-c<=f&&f<=c){const p=4*((c-f)*t+u+a);NC.red=k.byteToFloat(o[p]),NC.green=k.byteToFloat(o[p+1]),NC.blue=k.byteToFloat(o[p+2]),NC.alpha=k.byteToFloat(o[p+3]);const y=i.getObjectByPickColor(NC);if(l(y))return y}if(u===f||u<0&&-u===f||u>0&&u===1-f){const p=h;h=-_,_=p}u+=h,f+=_}};wx.prototype.isDestroyed=function(){return!1};wx.prototype.destroy=function(){return this._fb.destroy(),Je(this)};function Md(){this._numSamples=1,this._colorFramebuffer=new Xn({depthStencil:!0,supportsDepthTexture:!0}),this._idFramebuffer=new Xn({depthStencil:!0,supportsDepthTexture:!0}),this._idClearColor=new k(0,0,0,0),this._clearCommand=new Bo({color:new k(0,0,0,0),depth:1,owner:this})}function tGe(e){e._colorFramebuffer.destroy(),e._idFramebuffer.destroy()}Object.defineProperties(Md.prototype,{framebuffer:{get:function(){return this._colorFramebuffer.framebuffer}},idFramebuffer:{get:function(){return this._idFramebuffer.framebuffer}},depthStencilTexture:{get:function(){return this._colorFramebuffer.getDepthStencilTexture()}}});Md.prototype.update=function(e,t,n,i){const o=t.width,r=t.height,s=n?e.halfFloatingPointTexture?ft.HALF_FLOAT:ft.FLOAT:ft.UNSIGNED_BYTE;this._numSamples=i,this._colorFramebuffer.update(e,o,r,i,s),this._idFramebuffer.update(e,o,r)};Md.prototype.clear=function(e,t,n){k.clone(n,this._clearCommand.color),k.clone(this._idClearColor,this._clearCommand.color),this._colorFramebuffer.clear(e,this._clearCommand,t),this._idFramebuffer.clear(e,this._clearCommand,t)};Md.prototype.getFramebuffer=function(){return this._colorFramebuffer.framebuffer};Md.prototype.getIdFramebuffer=function(){return this._idFramebuffer.framebuffer};Md.prototype.prepareColorTextures=function(e){this._numSamples>1&&this._colorFramebuffer.prepareTextures(e)};Md.prototype.isDestroyed=function(){return!1};Md.prototype.destroy=function(){return tGe(this),Je(this)};function lu(){}lu.getShadowCastShaderKeyword=function(e,t,n,i){return`castShadow ${e} ${t} ${n} ${i}`};lu.createShadowCastVertexShader=function(e,t,n){const i=e.defines.slice(0),o=e.sources.slice(0);i.push("SHADOW_MAP"),n&&i.push("GENERATE_POSITION");const r=nt.findPositionVarying(e),s=l(r);if(t&&!s){const a=o.length;for(let u=0;u<a;++u)o[u]=nt.replaceMain(o[u],"czm_shadow_cast_main");const c=`varying vec3 v_positionEC;
|
||
void main()
|
||
{
|
||
czm_shadow_cast_main();
|
||
v_positionEC = (czm_inverseProjection * gl_Position).xyz;
|
||
}`;o.push(c)}return new nt({defines:i,sources:o})};lu.createShadowCastFragmentShader=function(e,t,n,i){const o=e.defines.slice(0),r=e.sources.slice(0);o.push("SHADOW_MAP");let s=nt.findPositionVarying(e);const a=l(s);a||(s="v_positionEC");const c=r.length;for(let f=0;f<c;++f)r[f]=nt.replaceMain(r[f],"czm_shadow_cast_main");let u="";return t&&(a||(u+=`varying vec3 v_positionEC;
|
||
`),u+=`uniform vec4 shadowMap_lightPositionEC;
|
||
`),i?u+=`void main()
|
||
{
|
||
`:u+=`void main()
|
||
{
|
||
czm_shadow_cast_main();
|
||
if (gl_FragColor.a == 0.0)
|
||
{
|
||
discard;
|
||
}
|
||
`,t?u+=` float distance = length(${s});
|
||
if (distance >= shadowMap_lightPositionEC.w)
|
||
{
|
||
discard;
|
||
}
|
||
distance /= shadowMap_lightPositionEC.w; // radius
|
||
gl_FragColor = czm_packDepth(distance);
|
||
`:n?u+=` gl_FragColor = vec4(1.0);
|
||
`:u+=` gl_FragColor = czm_packDepth(gl_FragCoord.z);
|
||
`,u+=`}
|
||
`,r.push(u),new nt({defines:o,sources:r})};lu.getShadowReceiveShaderKeyword=function(e,t,n,i){const o=e._usesDepthTexture,r=e._polygonOffsetSupported,s=e._isPointLight,a=e._isSpotLight,c=e._numberOfCascades>1,u=e.debugCascadeColors,f=e.softShadows;return`receiveShadow ${o}${r}${s}${a}${c}${u}${f}${t}${n}${i}`};lu.createShadowReceiveVertexShader=function(e,t,n){const i=e.defines.slice(0),o=e.sources.slice(0);return i.push("SHADOW_MAP"),t&&(n?i.push("GENERATE_POSITION_AND_NORMAL"):i.push("GENERATE_POSITION")),new nt({defines:i,sources:o})};lu.createShadowReceiveFragmentShader=function(e,t,n,i,o){const r=nt.findNormalVarying(e),s=!i&&l(r)||i&&o,a=nt.findPositionVarying(e),c=l(a),u=t._usesDepthTexture,f=t._polygonOffsetSupported,h=t._isPointLight,_=t._isSpotLight,g=t._numberOfCascades>1,p=t.debugCascadeColors,y=t.softShadows,T=h?t._pointBias:i?t._terrainBias:t._primitiveBias,b=e.defines.slice(0),x=e.sources.slice(0),v=x.length;for(let B=0;B<v;++B)x[B]=nt.replaceMain(x[B],"czm_shadow_receive_main");h?b.push("USE_CUBE_MAP_SHADOW"):u&&b.push("USE_SHADOW_DEPTH_TEXTURE"),y&&!h&&b.push("USE_SOFT_SHADOWS"),g&&n&&i&&(s?b.push("ENABLE_VERTEX_LIGHTING"):b.push("ENABLE_DAYNIGHT_SHADING")),n&&T.normalShading&&s&&(b.push("USE_NORMAL_SHADING"),T.normalShadingSmooth>0&&b.push("USE_NORMAL_SHADING_SMOOTH"));let D="";h?D+=`uniform samplerCube shadowMap_textureCube;
|
||
`:D+=`uniform sampler2D shadowMap_texture;
|
||
`;let L;return c?L=` return vec4(${a}, 1.0);
|
||
`:L=`#ifndef LOG_DEPTH
|
||
return czm_windowToEyeCoordinates(gl_FragCoord);
|
||
#else
|
||
return vec4(v_logPositionEC, 1.0);
|
||
#endif
|
||
`,D+=`uniform mat4 shadowMap_matrix;
|
||
uniform vec3 shadowMap_lightDirectionEC;
|
||
uniform vec4 shadowMap_lightPositionEC;
|
||
uniform vec4 shadowMap_normalOffsetScaleDistanceMaxDistanceAndDarkness;
|
||
uniform vec4 shadowMap_texelSizeDepthBiasAndNormalShadingSmooth;
|
||
#ifdef LOG_DEPTH
|
||
varying vec3 v_logPositionEC;
|
||
#endif
|
||
vec4 getPositionEC()
|
||
{
|
||
${L}}
|
||
vec3 getNormalEC()
|
||
{
|
||
${s?` return normalize(${r});
|
||
`:` return vec3(1.0);
|
||
`}}
|
||
void applyNormalOffset(inout vec4 positionEC, vec3 normalEC, float nDotL)
|
||
{
|
||
${T.normalOffset&&s?` float normalOffset = shadowMap_normalOffsetScaleDistanceMaxDistanceAndDarkness.x;
|
||
float normalOffsetScale = 1.0 - nDotL;
|
||
vec3 offset = normalOffset * normalOffsetScale * normalEC;
|
||
positionEC.xyz += offset;
|
||
`:""}}
|
||
`,D+=`void main()
|
||
{
|
||
czm_shadow_receive_main();
|
||
vec4 positionEC = getPositionEC();
|
||
vec3 normalEC = getNormalEC();
|
||
float depth = -positionEC.z;
|
||
`,D+=` czm_shadowParameters shadowParameters;
|
||
shadowParameters.texelStepSize = shadowMap_texelSizeDepthBiasAndNormalShadingSmooth.xy;
|
||
shadowParameters.depthBias = shadowMap_texelSizeDepthBiasAndNormalShadingSmooth.z;
|
||
shadowParameters.normalShadingSmooth = shadowMap_texelSizeDepthBiasAndNormalShadingSmooth.w;
|
||
shadowParameters.darkness = shadowMap_normalOffsetScaleDistanceMaxDistanceAndDarkness.w;
|
||
`,i?D+=` shadowParameters.depthBias *= max(depth * 0.01, 1.0);
|
||
`:f||(D+=` shadowParameters.depthBias *= mix(1.0, 100.0, depth * 0.0015);
|
||
`),h?D+=` vec3 directionEC = positionEC.xyz - shadowMap_lightPositionEC.xyz;
|
||
float distance = length(directionEC);
|
||
directionEC = normalize(directionEC);
|
||
float radius = shadowMap_lightPositionEC.w;
|
||
// Stop early if the fragment is beyond the point light radius
|
||
if (distance > radius)
|
||
{
|
||
return;
|
||
}
|
||
vec3 directionWC = czm_inverseViewRotation * directionEC;
|
||
shadowParameters.depth = distance / radius;
|
||
shadowParameters.nDotL = clamp(dot(normalEC, -directionEC), 0.0, 1.0);
|
||
shadowParameters.texCoords = directionWC;
|
||
float visibility = czm_shadowVisibility(shadowMap_textureCube, shadowParameters);
|
||
`:_?D+=` vec3 directionEC = normalize(positionEC.xyz - shadowMap_lightPositionEC.xyz);
|
||
float nDotL = clamp(dot(normalEC, -directionEC), 0.0, 1.0);
|
||
applyNormalOffset(positionEC, normalEC, nDotL);
|
||
vec4 shadowPosition = shadowMap_matrix * positionEC;
|
||
// Spot light uses a perspective projection, so perform the perspective divide
|
||
shadowPosition /= shadowPosition.w;
|
||
// Stop early if the fragment is not in the shadow bounds
|
||
if (any(lessThan(shadowPosition.xyz, vec3(0.0))) || any(greaterThan(shadowPosition.xyz, vec3(1.0))))
|
||
{
|
||
return;
|
||
}
|
||
shadowParameters.texCoords = shadowPosition.xy;
|
||
shadowParameters.depth = shadowPosition.z;
|
||
shadowParameters.nDotL = nDotL;
|
||
float visibility = czm_shadowVisibility(shadowMap_texture, shadowParameters);
|
||
`:g?D+=` float maxDepth = shadowMap_cascadeSplits[1].w;
|
||
// Stop early if the eye depth exceeds the last cascade
|
||
if (depth > maxDepth)
|
||
{
|
||
return;
|
||
}
|
||
// Get the cascade based on the eye-space depth
|
||
vec4 weights = czm_cascadeWeights(depth);
|
||
// Apply normal offset
|
||
float nDotL = clamp(dot(normalEC, shadowMap_lightDirectionEC), 0.0, 1.0);
|
||
applyNormalOffset(positionEC, normalEC, nDotL);
|
||
// Transform position into the cascade
|
||
vec4 shadowPosition = czm_cascadeMatrix(weights) * positionEC;
|
||
// Get visibility
|
||
shadowParameters.texCoords = shadowPosition.xy;
|
||
shadowParameters.depth = shadowPosition.z;
|
||
shadowParameters.nDotL = nDotL;
|
||
float visibility = czm_shadowVisibility(shadowMap_texture, shadowParameters);
|
||
// Fade out shadows that are far away
|
||
float shadowMapMaximumDistance = shadowMap_normalOffsetScaleDistanceMaxDistanceAndDarkness.z;
|
||
float fade = max((depth - shadowMapMaximumDistance * 0.8) / (shadowMapMaximumDistance * 0.2), 0.0);
|
||
visibility = mix(visibility, 1.0, fade);
|
||
${p?` // Draw cascade colors for debugging
|
||
gl_FragColor *= czm_cascadeColor(weights);
|
||
`:""}`:D+=` float nDotL = clamp(dot(normalEC, shadowMap_lightDirectionEC), 0.0, 1.0);
|
||
applyNormalOffset(positionEC, normalEC, nDotL);
|
||
vec4 shadowPosition = shadowMap_matrix * positionEC;
|
||
// Stop early if the fragment is not in the shadow bounds
|
||
if (any(lessThan(shadowPosition.xyz, vec3(0.0))) || any(greaterThan(shadowPosition.xyz, vec3(1.0))))
|
||
{
|
||
return;
|
||
}
|
||
shadowParameters.texCoords = shadowPosition.xy;
|
||
shadowParameters.depth = shadowPosition.z;
|
||
shadowParameters.nDotL = nDotL;
|
||
float visibility = czm_shadowVisibility(shadowMap_texture, shadowParameters);
|
||
`,D+=` gl_FragColor.rgb *= visibility;
|
||
}
|
||
`,x.push(D),new nt({defines:b,sources:x})};function El(e){e=A(e,A.EMPTY_OBJECT);const t=e.context;if(!l(t))throw new w("context is required.");if(!l(e.lightCamera))throw new w("lightCamera is required.");if(l(e.numberOfCascades)&&e.numberOfCascades!==1&&e.numberOfCascades!==4)throw new w("Only one or four cascades are supported.");this._enabled=A(e.enabled,!0),this._softShadows=A(e.softShadows,!1),this._normalOffset=A(e.normalOffset,!0),this.dirty=!0,this.fromLightSource=A(e.fromLightSource,!0),this.darkness=A(e.darkness,.3),this._darkness=this.darkness,this.fadingEnabled=A(e.fadingEnabled,!0),this.maximumDistance=A(e.maximumDistance,5e3),this._outOfView=!1,this._outOfViewPrevious=!1,this._needsUpdate=!0;let n=!0;(Mn.isInternetExplorer()||Mn.isEdge()||(Mn.isChrome()||Mn.isFirefox())&&Mn.isWindows()&&!t.depthTexture)&&(n=!1),this._polygonOffsetSupported=n,this._terrainBias={polygonOffset:n,polygonOffsetFactor:1.1,polygonOffsetUnits:4,normalOffset:this._normalOffset,normalOffsetScale:.5,normalShading:!0,normalShadingSmooth:.3,depthBias:1e-4},this._primitiveBias={polygonOffset:n,polygonOffsetFactor:1.1,polygonOffsetUnits:4,normalOffset:this._normalOffset,normalOffsetScale:.1,normalShading:!0,normalShadingSmooth:.05,depthBias:2e-5},this._pointBias={polygonOffset:!1,polygonOffsetFactor:1.1,polygonOffsetUnits:4,normalOffset:this._normalOffset,normalOffsetScale:0,normalShading:!0,normalShadingSmooth:.1,depthBias:5e-4},this._depthAttachment=void 0,this._colorAttachment=void 0,this._shadowMapMatrix=new N,this._shadowMapTexture=void 0,this._lightDirectionEC=new d,this._lightPositionEC=new ue,this._distance=0,this._lightCamera=e.lightCamera,this._shadowMapCamera=new dP,this._shadowMapCullingVolume=void 0,this._sceneCamera=void 0,this._boundingSphere=new Ae,this._isPointLight=A(e.isPointLight,!1),this._pointLightRadius=A(e.pointLightRadius,100),this._cascadesEnabled=this._isPointLight?!1:A(e.cascadesEnabled,!0),this._numberOfCascades=this._cascadesEnabled?A(e.numberOfCascades,4):0,this._fitNearFar=!0,this._maximumCascadeDistances=[25,150,700,Number.MAX_VALUE],this._textureSize=new $,this._isSpotLight=!1,this._cascadesEnabled?this._shadowMapCamera.frustum=new yr:l(this._lightCamera.frustum.fov)&&(this._isSpotLight=!0),this._cascadeSplits=[new ue,new ue],this._cascadeMatrices=[new N,new N,new N,new N],this._cascadeDistances=new ue;let i;this._isPointLight?i=6:this._cascadesEnabled?i=this._numberOfCascades:i=1,this._passes=new Array(i);for(let o=0;o<i;++o)this._passes[o]=new nGe(t);this.debugShow=!1,this.debugFreezeFrame=!1,this._debugFreezeFrame=!1,this._debugCascadeColors=!1,this._debugLightFrustum=void 0,this._debugCameraFrustum=void 0,this._debugCascadeFrustums=new Array(this._numberOfCascades),this._debugShadowViewCommand=void 0,this._usesDepthTexture=t.depthTexture,this._isPointLight&&(this._usesDepthTexture=!1),this._primitiveRenderState=void 0,this._terrainRenderState=void 0,this._pointRenderState=void 0,Fz(this),this._clearCommand=new Bo({depth:1,color:new k}),this._clearPassState=new vy(t),this._size=A(e.size,2048),this.size=this._size}El.MAXIMUM_DISTANCE=2e4;function nGe(e){this.camera=new dP,this.passState=new vy(e),this.framebuffer=void 0,this.textureOffsets=void 0,this.commandList=[],this.cullingVolume=void 0}function QB(e,t){return ht.fromCache({cull:{enabled:!0,face:mr.BACK},depthTest:{enabled:!0},colorMask:{red:e,green:e,blue:e,alpha:e},depthMask:!0,polygonOffset:{enabled:t.polygonOffset,factor:t.polygonOffsetFactor,units:t.polygonOffsetUnits}})}function Fz(e){const t=!e._usesDepthTexture;e._primitiveRenderState=QB(t,e._primitiveBias),e._terrainRenderState=QB(t,e._terrainBias),e._pointRenderState=QB(t,e._pointBias)}El.prototype.debugCreateRenderStates=function(){Fz(this)};Object.defineProperties(El.prototype,{enabled:{get:function(){return this._enabled},set:function(e){this.dirty=this._enabled!==e,this._enabled=e}},normalOffset:{get:function(){return this._normalOffset},set:function(e){this.dirty=this._normalOffset!==e,this._normalOffset=e,this._terrainBias.normalOffset=e,this._primitiveBias.normalOffset=e,this._pointBias.normalOffset=e}},softShadows:{get:function(){return this._softShadows},set:function(e){this.dirty=this._softShadows!==e,this._softShadows=e}},size:{get:function(){return this._size},set:function(e){cGe(this,e)}},outOfView:{get:function(){return this._outOfView}},shadowMapCullingVolume:{get:function(){return this._shadowMapCullingVolume}},passes:{get:function(){return this._passes}},isPointLight:{get:function(){return this._isPointLight}},debugCascadeColors:{get:function(){return this._debugCascadeColors},set:function(e){this.dirty=this._debugCascadeColors!==e,this._debugCascadeColors=e}}});function zz(e){const t=e._passes.length;for(let n=0;n<t;++n){const i=e._passes[n],o=i.framebuffer;l(o)&&!o.isDestroyed()&&o.destroy(),i.framebuffer=void 0}e._depthAttachment=e._depthAttachment&&e._depthAttachment.destroy(),e._colorAttachment=e._colorAttachment&&e._colorAttachment.destroy()}function iGe(e,t){const n=new Qu({context:t,width:e._textureSize.x,height:e._textureSize.y,format:vh.DEPTH_COMPONENT16}),i=new rn({context:t,width:e._textureSize.x,height:e._textureSize.y,pixelFormat:yt.RGBA,pixelDatatype:ft.UNSIGNED_BYTE,sampler:Ci.NEAREST}),o=new Ds({context:t,depthRenderbuffer:n,colorTextures:[i],destroyAttachments:!1}),r=e._passes.length;for(let s=0;s<r;++s){const a=e._passes[s];a.framebuffer=o,a.passState.framebuffer=o}e._shadowMapTexture=i,e._depthAttachment=n,e._colorAttachment=i}function oGe(e,t){const n=new rn({context:t,width:e._textureSize.x,height:e._textureSize.y,pixelFormat:yt.DEPTH_STENCIL,pixelDatatype:ft.UNSIGNED_INT_24_8,sampler:Ci.NEAREST}),i=new Ds({context:t,depthStencilTexture:n,destroyAttachments:!1}),o=e._passes.length;for(let r=0;r<o;++r){const s=e._passes[r];s.framebuffer=i,s.passState.framebuffer=i}e._shadowMapTexture=n,e._depthAttachment=n}function rGe(e,t){const n=new Qu({context:t,width:e._textureSize.x,height:e._textureSize.y,format:vh.DEPTH_COMPONENT16}),i=new xf({context:t,width:e._textureSize.x,height:e._textureSize.y,pixelFormat:yt.RGBA,pixelDatatype:ft.UNSIGNED_BYTE,sampler:Ci.NEAREST}),o=[i.negativeX,i.negativeY,i.negativeZ,i.positiveX,i.positiveY,i.positiveZ];for(let r=0;r<6;++r){const s=new Ds({context:t,depthRenderbuffer:n,colorTextures:[o[r]],destroyAttachments:!1}),a=e._passes[r];a.framebuffer=s,a.passState.framebuffer=s}e._shadowMapTexture=i,e._depthAttachment=n,e._colorAttachment=i}function FZ(e,t){e._isPointLight?rGe(e,t):e._usesDepthTexture?oGe(e,t):iGe(e,t)}function sGe(e,t){e._usesDepthTexture&&e._passes[0].framebuffer.status!==fe.FRAMEBUFFER_COMPLETE&&(e._usesDepthTexture=!1,Fz(e),zz(e),FZ(e,t))}function aGe(e,t){(!l(e._passes[0].framebuffer)||e._shadowMapTexture.width!==e._textureSize.x)&&(zz(e),FZ(e,t),sGe(e,t),zZ(e,t))}function zZ(e,t,n){n=A(n,0),(e._isPointLight||n===0)&&(e._clearCommand.framebuffer=e._passes[n].framebuffer,e._clearCommand.execute(t,e._clearPassState))}function cGe(e,t){e._size=t;const n=e._passes,i=n.length,o=e._textureSize;if(e._isPointLight){t=Gt.maximumCubeMapSize>=t?t:Gt.maximumCubeMapSize,o.x=t,o.y=t;const r=new at(0,0,t,t);n[0].passState.viewport=r,n[1].passState.viewport=r,n[2].passState.viewport=r,n[3].passState.viewport=r,n[4].passState.viewport=r,n[5].passState.viewport=r}else i===1?(t=Gt.maximumTextureSize>=t?t:Gt.maximumTextureSize,o.x=t,o.y=t,n[0].passState.viewport=new at(0,0,t,t)):i===4&&(t=Gt.maximumTextureSize>=t*2?t:Gt.maximumTextureSize/2,o.x=t*2,o.y=t*2,n[0].passState.viewport=new at(0,0,t,t),n[1].passState.viewport=new at(t,0,t,t),n[2].passState.viewport=new at(0,t,t,t),n[3].passState.viewport=new at(t,t,t,t));e._clearPassState.viewport=new at(0,0,o.x,o.y);for(let r=0;r<i;++r){const s=n[r],a=s.passState.viewport,c=a.x/o.x,u=a.y/o.y,f=a.width/o.x,h=a.height/o.y;s.textureOffsets=new N(f,0,0,c,0,h,0,u,0,0,1,0,0,0,0,1)}}const lGe=new at;function uGe(e,t){let n;e._isPointLight?n=`uniform samplerCube shadowMap_textureCube;
|
||
varying vec2 v_textureCoordinates;
|
||
void main()
|
||
{
|
||
vec2 uv = v_textureCoordinates;
|
||
vec3 dir;
|
||
|
||
if (uv.y < 0.5)
|
||
{
|
||
if (uv.x < 0.333)
|
||
{
|
||
dir.x = -1.0;
|
||
dir.y = uv.x * 6.0 - 1.0;
|
||
dir.z = uv.y * 4.0 - 1.0;
|
||
}
|
||
else if (uv.x < 0.666)
|
||
{
|
||
dir.y = -1.0;
|
||
dir.x = uv.x * 6.0 - 3.0;
|
||
dir.z = uv.y * 4.0 - 1.0;
|
||
}
|
||
else
|
||
{
|
||
dir.z = -1.0;
|
||
dir.x = uv.x * 6.0 - 5.0;
|
||
dir.y = uv.y * 4.0 - 1.0;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
if (uv.x < 0.333)
|
||
{
|
||
dir.x = 1.0;
|
||
dir.y = uv.x * 6.0 - 1.0;
|
||
dir.z = uv.y * 4.0 - 3.0;
|
||
}
|
||
else if (uv.x < 0.666)
|
||
{
|
||
dir.y = 1.0;
|
||
dir.x = uv.x * 6.0 - 3.0;
|
||
dir.z = uv.y * 4.0 - 3.0;
|
||
}
|
||
else
|
||
{
|
||
dir.z = 1.0;
|
||
dir.x = uv.x * 6.0 - 5.0;
|
||
dir.y = uv.y * 4.0 - 3.0;
|
||
}
|
||
}
|
||
|
||
float shadow = czm_unpackDepth(textureCube(shadowMap_textureCube, dir));
|
||
gl_FragColor = vec4(vec3(shadow), 1.0);
|
||
}
|
||
`:n=`uniform sampler2D shadowMap_texture;
|
||
varying vec2 v_textureCoordinates;
|
||
void main()
|
||
{
|
||
${e._usesDepthTexture?` float shadow = texture2D(shadowMap_texture, v_textureCoordinates).r;
|
||
`:` float shadow = czm_unpackDepth(texture2D(shadowMap_texture, v_textureCoordinates));
|
||
`} gl_FragColor = vec4(vec3(shadow), 1.0);
|
||
}
|
||
`;const i=t.createViewportQuadCommand(n,{uniformMap:{shadowMap_texture:function(){return e._shadowMapTexture},shadowMap_textureCube:function(){return e._shadowMapTexture}}});return i.pass=We.OVERLAY,i}function fGe(e,t){const n=t.context,i=t.context.drawingBufferWidth,o=t.context.drawingBufferHeight,r=Math.min(i,o)*.3,s=lGe;s.x=i-r,s.y=0,s.width=r,s.height=r;let a=e._debugShadowViewCommand;l(a)||(a=uGe(e,n),e._debugShadowViewCommand=a),(!l(a.renderState)||!at.equals(a.renderState.viewport,s))&&(a.renderState=ht.fromCache({viewport:at.clone(s)})),t.commandList.push(e._debugShadowViewCommand)}const Fd=new Array(8);Fd[0]=new ue(-1,-1,-1,1);Fd[1]=new ue(1,-1,-1,1);Fd[2]=new ue(1,1,-1,1);Fd[3]=new ue(-1,1,-1,1);Fd[4]=new ue(-1,-1,1,1);Fd[5]=new ue(1,-1,1,1);Fd[6]=new ue(1,1,1,1);Fd[7]=new ue(-1,1,1,1);const wm=new N,Uz=new Array(8);for(let e=0;e<8;++e)Uz[e]=new ue;function dGe(e,t){const n=new xn({geometry:new pl({minimum:new d(-.5,-.5,-.5),maximum:new d(.5,.5,.5)}),attributes:{color:Bn.fromColor(t)}}),i=new xn({geometry:new Jm({radius:.5}),attributes:{color:Bn.fromColor(t)}});return new fn({geometryInstances:[n,i],appearance:new kn({translucent:!1,flat:!0}),asynchronous:!1,modelMatrix:e})}const hGe=[k.RED,k.GREEN,k.BLUE,k.MAGENTA],pGe=new d;function mGe(e,t){fGe(e,t);const n=e.debugFreezeFrame&&!e._debugFreezeFrame;if(e._debugFreezeFrame=e.debugFreezeFrame,e.debugFreezeFrame&&(n&&(e._debugCameraFrustum=e._debugCameraFrustum&&e._debugCameraFrustum.destroy(),e._debugCameraFrustum=new xm({camera:e._sceneCamera,color:k.CYAN,updateOnChange:!1})),e._debugCameraFrustum.update(t)),e._cascadesEnabled){if(e.debugFreezeFrame){n&&(e._debugLightFrustum=e._debugLightFrustum&&e._debugLightFrustum.destroy(),e._debugLightFrustum=new xm({camera:e._shadowMapCamera,color:k.YELLOW,updateOnChange:!1})),e._debugLightFrustum.update(t);for(let i=0;i<e._numberOfCascades;++i)n&&(e._debugCascadeFrustums[i]=e._debugCascadeFrustums[i]&&e._debugCascadeFrustums[i].destroy(),e._debugCascadeFrustums[i]=new xm({camera:e._passes[i].camera,color:hGe[i],updateOnChange:!1})),e._debugCascadeFrustums[i].update(t)}}else if(e._isPointLight){if(!l(e._debugLightFrustum)||e._needsUpdate){const i=e._shadowMapCamera.positionWC,o=De.IDENTITY,r=e._pointLightRadius*2,s=d.fromElements(r,r,r,pGe),a=N.fromTranslationQuaternionRotationScale(i,o,s,wm);e._debugLightFrustum=e._debugLightFrustum&&e._debugLightFrustum.destroy(),e._debugLightFrustum=dGe(a,k.YELLOW)}e._debugLightFrustum.update(t)}else(!l(e._debugLightFrustum)||e._needsUpdate)&&(e._debugLightFrustum=new xm({camera:e._shadowMapCamera,color:k.YELLOW,updateOnChange:!1})),e._debugLightFrustum.update(t)}function dP(){this.viewMatrix=new N,this.inverseViewMatrix=new N,this.frustum=void 0,this.positionCartographic=new ve,this.positionWC=new d,this.directionWC=d.clone(d.UNIT_Z),this.upWC=d.clone(d.UNIT_Y),this.rightWC=d.clone(d.UNIT_X),this.viewProjectionMatrix=new N}dP.prototype.clone=function(e){N.clone(e.viewMatrix,this.viewMatrix),N.clone(e.inverseViewMatrix,this.inverseViewMatrix),this.frustum=e.frustum.clone(this.frustum),ve.clone(e.positionCartographic,this.positionCartographic),d.clone(e.positionWC,this.positionWC),d.clone(e.directionWC,this.directionWC),d.clone(e.upWC,this.upWC),d.clone(e.rightWC,this.rightWC)};const _Ge=new N(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1);dP.prototype.getViewProjection=function(){const e=this.viewMatrix,t=this.frustum.projectionMatrix;return N.multiply(t,e,this.viewProjectionMatrix),N.multiply(_Ge,this.viewProjectionMatrix,this.viewProjectionMatrix),this.viewProjectionMatrix};const gGe=new Array(5),yGe=new hi,AGe=new Array(4),UZ=new d,HZ=new d;function TGe(e,t){const n=e._shadowMapCamera,i=e._sceneCamera,o=i.frustum.near,r=i.frustum.far,s=e._numberOfCascades;let a;const c=r-o,u=r/o;let f=.9,h=!1;t.shadowState.closestObjectSize<200&&(h=!0,f=.9);const _=AGe,g=gGe;for(g[0]=o,g[s]=r,a=0;a<s;++a){const G=(a+1)/s,I=o*Math.pow(u,G),O=o+c*G,m=F.lerp(O,I,f);g[a+1]=m,_[a]=m-g[a]}if(h){for(a=0;a<s;++a)_[a]=Math.min(_[a],e._maximumCascadeDistances[a]);let G=g[0];for(a=0;a<s-1;++a)G+=_[a],g[a+1]=G}ue.unpack(g,0,e._cascadeSplits[0]),ue.unpack(g,1,e._cascadeSplits[1]),ue.unpack(_,0,e._cascadeDistances);const p=n.frustum,y=p.left,T=p.right,b=p.bottom,x=p.top,v=p.near,D=p.far,L=n.positionWC,B=n.directionWC,V=n.upWC,M=i.frustum.clone(yGe),H=n.getViewProjection();for(a=0;a<s;++a){M.near=g[a],M.far=g[a+1];const G=N.multiply(M.projectionMatrix,i.viewMatrix,wm),I=N.inverse(G,wm),O=N.multiply(H,I,wm),m=d.fromElements(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,UZ),P=d.fromElements(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE,HZ);for(let Y=0;Y<8;++Y){const j=ue.clone(Fd[Y],Uz[Y]);N.multiplyByVector(O,j,j),d.divideByScalar(j,j.w,j),d.minimumByComponent(j,m,m),d.maximumByComponent(j,P,P)}m.x=Math.max(m.x,0),m.y=Math.max(m.y,0),m.z=0,P.x=Math.min(P.x,1),P.y=Math.min(P.y,1),P.z=Math.min(P.z,1);const R=e._passes[a],U=R.camera;U.clone(n);const W=U.frustum;W.left=y+m.x*(T-y),W.right=y+P.x*(T-y),W.bottom=b+m.y*(x-b),W.top=b+P.y*(x-b),W.near=v+m.z*(D-v),W.far=v+P.z*(D-v),R.cullingVolume=U.frustum.computeCullingVolume(L,B,V);const q=e._cascadeMatrices[a];N.multiply(U.getViewProjection(),i.inverseViewMatrix,q),N.multiply(R.textureOffsets,q,q)}}const CGe=new N,bGe=new d,EGe=new d,yW=new d;function xGe(e,t){const n=e._shadowMapCamera,i=e._sceneCamera,o=N.multiply(i.frustum.projectionMatrix,i.viewMatrix,wm),r=N.inverse(o,wm),s=n.directionWC;let a=i.directionWC;d.equalsEpsilon(s,a,F.EPSILON10)&&(a=i.upWC);const c=d.cross(s,a,bGe);a=d.cross(c,s,EGe),d.normalize(a,a),d.normalize(c,c);const u=d.fromElements(0,0,0,yW);let f=N.computeView(u,s,a,c,CGe);const h=N.multiply(f,r,wm),_=d.fromElements(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,UZ),g=d.fromElements(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE,HZ);for(let D=0;D<8;++D){const L=ue.clone(Fd[D],Uz[D]);N.multiplyByVector(h,L,L),d.divideByScalar(L,L.w,L),d.minimumByComponent(L,_,_),d.maximumByComponent(L,g,g)}g.z+=1e3,_.z-=10;const p=yW;p.x=-(.5*(_.x+g.x)),p.y=-(.5*(_.y+g.y)),p.z=-g.z;const y=N.fromTranslation(p,wm);f=N.multiply(y,f,f);const T=.5*(g.x-_.x),b=.5*(g.y-_.y),x=g.z-_.z,v=n.frustum;v.left=-T,v.right=T,v.bottom=-b,v.top=b,v.near=.01,v.far=x,N.clone(f,n.viewMatrix),N.inverse(f,n.inverseViewMatrix),N.getTranslation(n.inverseViewMatrix,n.positionWC),t.mapProjection.ellipsoid.cartesianToCartographic(n.positionWC,n.positionCartographic),d.clone(s,n.directionWC),d.clone(a,n.upWC),d.clone(c,n.rightWC)}const wGe=[new d(-1,0,0),new d(0,-1,0),new d(0,0,-1),new d(1,0,0),new d(0,1,0),new d(0,0,1)],SGe=[new d(0,-1,0),new d(0,0,-1),new d(0,-1,0),new d(0,-1,0),new d(0,0,1),new d(0,-1,0)],vGe=[new d(0,0,1),new d(1,0,0),new d(-1,0,0),new d(0,0,-1),new d(1,0,0),new d(1,0,0)];function DGe(e,t){const n=new hi;n.fov=F.PI_OVER_TWO,n.near=1,n.far=e._pointLightRadius,n.aspectRatio=1;for(let i=0;i<6;++i){const o=e._passes[i].camera;o.positionWC=e._shadowMapCamera.positionWC,o.positionCartographic=t.mapProjection.ellipsoid.cartesianToCartographic(o.positionWC,o.positionCartographic),o.directionWC=wGe[i],o.upWC=SGe[i],o.rightWC=vGe[i],N.computeView(o.positionWC,o.directionWC,o.upWC,o.rightWC,o.viewMatrix),N.inverse(o.viewMatrix,o.inverseViewMatrix),o.frustum=n}}const IGe=new d,PGe=new d,VZ=new Ae,AW=VZ.center;function OGe(e,t){const n=e._sceneCamera,i=e._shadowMapCamera,o=VZ;if(e._cascadesEnabled){if(n.frustum.near>=e.maximumDistance){e._outOfView=!0,e._needsUpdate=!1;return}const r=t.mapProjection.ellipsoid.geodeticSurfaceNormal(n.positionWC,IGe),s=d.negate(i.directionWC,PGe),a=d.dot(r,s);if(e.fadingEnabled){const c=F.clamp(a/.1,0,1);e._darkness=F.lerp(1,e.darkness,c)}else e._darkness=e.darkness;if(a<0){e._outOfView=!0,e._needsUpdate=!1;return}e._needsUpdate=!0,e._outOfView=!1}else if(e._isPointLight)o.center=i.positionWC,o.radius=e._pointLightRadius,e._outOfView=t.cullingVolume.computeVisibility(o)===Vn.OUTSIDE,e._needsUpdate=!e._outOfView&&!e._boundingSphere.equals(o),Ae.clone(o,e._boundingSphere);else{const r=i.frustum.far/2,s=d.add(i.positionWC,d.multiplyByScalar(i.directionWC,r,AW),AW);o.center=s,o.radius=r,e._outOfView=t.cullingVolume.computeVisibility(o)===Vn.OUTSIDE,e._needsUpdate=!e._outOfView&&!e._boundingSphere.equals(o),Ae.clone(o,e._boundingSphere)}}function LGe(e,t){const n=t.camera,i=e._lightCamera,o=e._sceneCamera,r=e._shadowMapCamera;e._cascadesEnabled?d.clone(i.directionWC,r.directionWC):e._isPointLight?d.clone(i.positionWC,r.positionWC):r.clone(i);const s=e._lightDirectionEC;N.multiplyByPointAsVector(n.viewMatrix,r.directionWC,s),d.normalize(s,s),d.negate(s,s),N.multiplyByPoint(n.viewMatrix,r.positionWC,e._lightPositionEC),e._lightPositionEC.w=e._pointLightRadius;let a,c;e._fitNearFar?(a=Math.min(t.shadowState.nearPlane,e.maximumDistance),c=Math.min(t.shadowState.farPlane,e.maximumDistance),c=Math.max(c,a+1)):(a=n.frustum.near,c=e.maximumDistance),e._sceneCamera=Tt.clone(n,o),n.frustum.clone(e._sceneCamera.frustum),e._sceneCamera.frustum.near=a,e._sceneCamera.frustum.far=c,e._distance=c-a,OGe(e,t),!e._outOfViewPrevious&&e._outOfView&&(e._needsUpdate=!0),e._outOfViewPrevious=e._outOfView}El.prototype.update=function(e){if(LGe(this,e),this._needsUpdate)if(aGe(this,e.context),this._isPointLight&&DGe(this,e),this._cascadesEnabled&&(xGe(this,e),this._numberOfCascades>1&&TGe(this,e)),this._isPointLight)this._shadowMapCullingVolume=Ur.fromBoundingSphere(this._boundingSphere);else{const t=this._shadowMapCamera,n=t.positionWC,i=t.directionWC,o=t.upWC;this._shadowMapCullingVolume=t.frustum.computeCullingVolume(n,i,o),this._passes.length===1&&this._passes[0].camera.clone(t)}if(this._passes.length===1){const t=this._sceneCamera.inverseViewMatrix;N.multiply(this._shadowMapCamera.getViewProjection(),t,this._shadowMapMatrix)}this.debugShow&&mGe(this,e)};El.prototype.updatePass=function(e,t){zZ(this,e,t)};const BGe=new $;function kZ(e,t,n){const i=e._isPointLight?e._pointBias:n?e._terrainBias:e._primitiveBias,o={shadowMap_texture:function(){return e._shadowMapTexture},shadowMap_textureCube:function(){return e._shadowMapTexture},shadowMap_matrix:function(){return e._shadowMapMatrix},shadowMap_cascadeSplits:function(){return e._cascadeSplits},shadowMap_cascadeMatrices:function(){return e._cascadeMatrices},shadowMap_lightDirectionEC:function(){return e._lightDirectionEC},shadowMap_lightPositionEC:function(){return e._lightPositionEC},shadowMap_cascadeDistances:function(){return e._cascadeDistances},shadowMap_texelSizeDepthBiasAndNormalShadingSmooth:function(){const r=BGe;return r.x=1/e._textureSize.x,r.y=1/e._textureSize.y,ue.fromElements(r.x,r.y,i.depthBias,i.normalShadingSmooth,this.combinedUniforms1)},shadowMap_normalOffsetScaleDistanceMaxDistanceAndDarkness:function(){return ue.fromElements(i.normalOffsetScale,e._distance,e.maximumDistance,e._darkness,this.combinedUniforms2)},combinedUniforms1:new ue,combinedUniforms2:new ue};return Ln(t,o,!1)}function RGe(e,t,n,i,o,r){let s,a,c;if(l(r)&&(s=r.shaderProgram,a=r.renderState,c=r.uniformMap),r=Dt.shallowClone(n,r),r.castShadows=!0,r.receiveShadows=!1,!l(s)||o!==n.shaderProgram.id||t){const u=n.shaderProgram,f=n.pass===We.GLOBE,h=n.pass!==We.TRANSLUCENT,_=e._isPointLight,g=e._usesDepthTexture,p=lu.getShadowCastShaderKeyword(_,f,g,h);if(s=i.shaderCache.getDerivedShaderProgram(u,p),!l(s)){const T=u.vertexShaderSource,b=u.fragmentShaderSource,x=lu.createShadowCastVertexShader(T,_,f),v=lu.createShadowCastFragmentShader(b,_,g,h);s=i.shaderCache.createDerivedShaderProgram(u,p,{vertexShaderSource:x,fragmentShaderSource:v,attributeLocations:u._attributeLocations})}a=e._primitiveRenderState,_?a=e._pointRenderState:f&&(a=e._terrainRenderState),n.renderState.cull.enabled||(a=St(a,!1),a.cull=St(a.cull,!1),a.cull.enabled=!1,a=ht.fromCache(a)),c=kZ(e,n.uniformMap,f)}return r.shaderProgram=s,r.renderState=a,r.uniformMap=c,r}El.createReceiveDerivedCommand=function(e,t,n,i,o){l(o)||(o={});const r=e.length>0,s=t.shaderProgram,a=s.vertexShaderSource,c=s.fragmentShaderSource,u=t.pass===We.GLOBE;let f=!1;if(u&&(f=t.owner.data.renderedMesh.encoding.hasVertexNormals),t.receiveShadows&&r){let h,_;l(o.receiveCommand)&&(h=o.receiveCommand.shaderProgram,_=o.receiveCommand.uniformMap),o.receiveCommand=Dt.shallowClone(t,o.receiveCommand),o.castShadows=!1,o.receiveShadows=!0;const g=o.receiveShaderCastShadows!==t.castShadows,p=o.receiveShaderProgramId!==t.shaderProgram.id;if(!l(h)||p||n||g){const y=lu.getShadowReceiveShaderKeyword(e[0],t.castShadows,u,f);if(h=i.shaderCache.getDerivedShaderProgram(s,y),!l(h)){const T=lu.createShadowReceiveVertexShader(a,u,f),b=lu.createShadowReceiveFragmentShader(c,e[0],t.castShadows,u,f);h=i.shaderCache.createDerivedShaderProgram(s,y,{vertexShaderSource:T,fragmentShaderSource:b,attributeLocations:s._attributeLocations})}_=kZ(e[0],t.uniformMap,u)}o.receiveCommand.shaderProgram=h,o.receiveCommand.uniformMap=_,o.receiveShaderProgramId=t.shaderProgram.id,o.receiveShaderCastShadows=t.castShadows}return o};El.createCastDerivedCommand=function(e,t,n,i,o){if(l(o)||(o={}),t.castShadows){let r=o.castCommands;l(r)||(r=o.castCommands=[]);const s=o.castShaderProgramId,a=e.length;r.length=a;for(let c=0;c<a;++c)r[c]=RGe(e[c],n,t,i,s,r[c]);o.castShaderProgramId=t.shaderProgram.id}return o};El.prototype.isDestroyed=function(){return!1};El.prototype.destroy=function(){zz(this),this._debugLightFrustum=this._debugLightFrustum&&this._debugLightFrustum.destroy(),this._debugCameraFrustum=this._debugCameraFrustum&&this._debugCameraFrustum.destroy(),this._debugShadowViewCommand=this._debugShadowViewCommand&&this._debugShadowViewCommand.shaderProgram&&this._debugShadowViewCommand.shaderProgram.destroy();for(let e=0;e<this._numberOfCascades;++e)this._debugCascadeFrustums[e]=this._debugCascadeFrustums[e]&&this._debugCascadeFrustums[e].destroy();return Je(this)};const ZB=`uniform sampler2D colorTexture;
|
||
|
||
#ifdef DEBUG_SHOW_DEPTH
|
||
uniform sampler2D u_packedTranslucentDepth;
|
||
#endif
|
||
|
||
varying vec2 v_textureCoordinates;
|
||
|
||
void main()
|
||
{
|
||
#ifdef DEBUG_SHOW_DEPTH
|
||
if (v_textureCoordinates.x < 0.5)
|
||
{
|
||
gl_FragColor.rgb = vec3(czm_unpackDepth(texture2D(u_packedTranslucentDepth, v_textureCoordinates)));
|
||
gl_FragColor.a = 1.0;
|
||
}
|
||
#else
|
||
vec4 color = texture2D(colorTexture, v_textureCoordinates);
|
||
|
||
#ifdef PICK
|
||
if (color == vec4(0.0))
|
||
{
|
||
discard;
|
||
}
|
||
#else
|
||
// Reverse premultiplication process to get the correct composited result of the classification primitives
|
||
color.rgb /= color.a;
|
||
#endif
|
||
gl_FragColor = color;
|
||
#endif
|
||
}
|
||
`;function A_(e){this._drawClassificationFBO=new Xn({createDepthAttachments:!1}),this._accumulationFBO=new Xn({createDepthAttachments:!1}),this._packFBO=new Xn,this._opaqueDepthStencilTexture=void 0,this._textureToComposite=void 0,this._translucentDepthStencilTexture=void 0,this._packDepthCommand=void 0,this._accumulateCommand=void 0,this._compositeCommand=void 0,this._copyCommand=void 0,this._clearColorCommand=new Bo({color:new k(0,0,0,0),owner:this}),this._clearDepthStencilCommand=new Bo({depth:1,stencil:0,owner:this}),this._supported=e.depthTexture,this._viewport=new at,this._rsDepth=void 0,this._rsAccumulate=void 0,this._rsComp=void 0,this._useScissorTest=void 0,this._scissorRectangle=void 0,this._hasTranslucentDepth=!1,this._frustumsDrawn=0}Object.defineProperties(A_.prototype,{hasTranslucentDepth:{get:function(){return this._hasTranslucentDepth}}});function GZ(e){e._textureToComposite=void 0,e._translucentDepthStencilTexture=e._translucentDepthStencilTexture&&!e._translucentDepthStencilTexture.isDestroyed()&&e._translucentDepthStencilTexture.destroy()}function WZ(e){e._drawClassificationFBO.destroy(),e._accumulationFBO.destroy(),e._packFBO.destroy()}function NGe(e,t,n,i){GZ(e),e._translucentDepthStencilTexture=new rn({context:t,width:n,height:i,pixelFormat:yt.DEPTH_STENCIL,pixelDatatype:ft.UNSIGNED_INT_24_8,sampler:Ci.NEAREST})}function MGe(e,t,n,i){WZ(e),e._drawClassificationFBO.setDepthStencilTexture(e._translucentDepthStencilTexture),e._drawClassificationFBO.update(t,n,i),e._accumulationFBO.setDepthStencilTexture(e._translucentDepthStencilTexture),e._accumulationFBO.update(t,n,i),e._packFBO.update(t,n,i)}function FGe(e,t,n,i){if(!e.isSupported())return;e._opaqueDepthStencilTexture=i;const o=e._opaqueDepthStencilTexture.width,r=e._opaqueDepthStencilTexture.height;e._drawClassificationFBO.isDirty(o,r)&&(NGe(e,t,o,r),MGe(e,t,o,r));let s,a;if(l(e._packDepthCommand)||(s=new nt({sources:[vOe]}),a={u_opaqueDepthTexture:function(){return e._opaqueDepthStencilTexture},u_translucentDepthTexture:function(){return e._translucentDepthStencilTexture}},e._packDepthCommand=t.createViewportQuadCommand(s,{uniformMap:a,owner:e})),!l(e._compositeCommand)){s=new nt({sources:[ZB]}),a={colorTexture:function(){return e._textureToComposite}},e._compositeCommand=t.createViewportQuadCommand(s,{uniformMap:a,owner:e});const f=e._compositeCommand,h=f.shaderProgram,_=t.shaderCache.createDerivedShaderProgram(h,"pick",{vertexShaderSource:h.vertexShaderSource,fragmentShaderSource:new nt({sources:s.sources,defines:["PICK"]}),attributeLocations:h._attributeLocations}),g=Dt.shallowClone(f);g.shaderProgram=_,f.derivedCommands.pick=g}l(e._copyCommand)||(s=new nt({sources:[ZB]}),a={colorTexture:function(){return e._drawClassificationFBO.getColorTexture()}},e._copyCommand=t.createViewportQuadCommand(s,{uniformMap:a,owner:e})),l(e._accumulateCommand)||(s=new nt({sources:[ZB]}),a={colorTexture:function(){return e._drawClassificationFBO.getColorTexture()}},e._accumulateCommand=t.createViewportQuadCommand(s,{uniformMap:a,owner:e})),e._viewport.width=o,e._viewport.height=r;const c=!at.equals(e._viewport,n.viewport);let u=c!==e._useScissorTest;e._useScissorTest=c,at.equals(e._scissorRectangle,n.viewport)||(e._scissorRectangle=at.clone(n.viewport,e._scissorRectangle),u=!0),(!l(e._rsDepth)||!at.equals(e._viewport,e._rsDepth.viewport)||u)&&(e._rsDepth=ht.fromCache({viewport:e._viewport,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle}})),l(e._packDepthCommand)&&(e._packDepthCommand.renderState=e._rsDepth),(!l(e._rsAccumulate)||!at.equals(e._viewport,e._rsAccumulate.viewport)||u)&&(e._rsAccumulate=ht.fromCache({viewport:e._viewport,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle},stencilTest:{enabled:!0,frontFunction:Ni.EQUAL,reference:Kt.CESIUM_3D_TILE_MASK}})),l(e._accumulateCommand)&&(e._accumulateCommand.renderState=e._rsAccumulate),(!l(e._rsComp)||!at.equals(e._viewport,e._rsComp.viewport)||u)&&(e._rsComp=ht.fromCache({viewport:e._viewport,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle},blending:fo.ALPHA_BLEND})),l(e._compositeCommand)&&(e._compositeCommand.renderState=e._rsComp,e._compositeCommand.derivedCommands.pick.renderState=e._rsComp)}A_.prototype.executeTranslucentCommands=function(e,t,n,i,o){const r=i.length;let s,a;const c=e.frameState.useLogDepth,u=e.context,f=n.framebuffer;for(a=0;a<r;++a)if(s=i[a],s=c?s.derivedCommands.logDepth.command:s,s.depthForTranslucentClassification){this._hasTranslucentDepth=!0;break}if(this._hasTranslucentDepth){for(FGe(this,u,n,o),n.framebuffer=this._drawClassificationFBO.framebuffer,this._clearDepthStencilCommand.execute(u,n),a=0;a<r;++a){if(s=i[a],s=c?s.derivedCommands.logDepth.command:s,!s.depthForTranslucentClassification)continue;const h=s.derivedCommands.depth.depthOnlyCommand;t(h,e,u,n)}this._frustumsDrawn+=this._hasTranslucentDepth?1:0,this._hasTranslucentDepth&&(n.framebuffer=this._packFBO.framebuffer,this._packDepthCommand.execute(u,n)),n.framebuffer=f}};A_.prototype.executeClassificationCommands=function(e,t,n,i){if(!this._hasTranslucentDepth)return;const o=e.context,r=o.uniformState,s=n.framebuffer;this._frustumsDrawn===2&&(n.framebuffer=this._accumulationFBO.framebuffer,this._copyCommand.execute(o,n)),n.framebuffer=this._drawClassificationFBO.framebuffer,this._frustumsDrawn>1&&this._clearColorCommand.execute(o,n),r.updatePass(We.CESIUM_3D_TILE_CLASSIFICATION);const a=r.globeDepthTexture;r.globeDepthTexture=this._packFBO.getColorTexture();const c=i.commands[We.CESIUM_3D_TILE_CLASSIFICATION],u=i.indices[We.CESIUM_3D_TILE_CLASSIFICATION];for(let f=0;f<u;++f)t(c[f],e,o,n);r.globeDepthTexture=a,n.framebuffer=s,this._frustumsDrawn!==1&&(n.framebuffer=this._accumulationFBO.framebuffer,this._accumulateCommand.execute(o,n),n.framebuffer=s)};A_.prototype.execute=function(e,t){if(!this._hasTranslucentDepth)return;this._frustumsDrawn===1?this._textureToComposite=this._drawClassificationFBO.getColorTexture():this._textureToComposite=this._accumulationFBO.getColorTexture(),(e.frameState.passes.pick?this._compositeCommand.derivedCommands.pick:this._compositeCommand).execute(e.context,t),zGe(this,e,t)};function zGe(e,t,n){if(!e._hasTranslucentDepth)return;const i=n.framebuffer;n.framebuffer=e._drawClassificationFBO.framebuffer,e._clearColorCommand.execute(t._context,n),n.framebuffer=i,e._frustumsDrawn>1&&(n.framebuffer=e._accumulationFBO.framebuffer,e._clearColorCommand.execute(t._context,n)),e._hasTranslucentDepth=!1,e._frustumsDrawn=0}A_.prototype.isSupported=function(){return this._supported};A_.prototype.isDestroyed=function(){return!1};A_.prototype.destroy=function(){return GZ(this),WZ(this),l(this._compositeCommand)&&(this._compositeCommand.shaderProgram=this._compositeCommand.shaderProgram&&this._compositeCommand.shaderProgram.destroy()),l(this._packDepthCommand)&&(this._packDepthCommand.shaderProgram=this._packDepthCommand.shaderProgram&&this._packDepthCommand.shaderProgram.destroy()),Je(this)};function UGe(){this.command=void 0,this.near=void 0,this.far=void 0}function Sx(e,t,n){const i=e.context;let o;i.depthTexture&&(o=new Nd);let r;e._useOIT&&i.depthTexture&&(r=new hp(i));const s=new vy(i);s.viewport=at.clone(n),this.camera=t,this._cameraClone=Tt.clone(t),this._cameraStartFired=!1,this._cameraMovedTime=void 0,this.viewport=n,this.passState=s,this.pickFramebuffer=new wx(i),this.pickDepthFramebuffer=new xx,this.sceneFramebuffer=new Md,this.globeDepth=o,this.globeTranslucencyFramebuffer=new Fy,this.oit=r,this.translucentTileClassification=new A_(i),this.pickDepths=[],this.frustumCommandsList=[],this.debugFrustumStatistics=void 0,this._commandExtents=[]}const TW=new d,CW=new d;function HGe(e,t){const n=Math.max(Math.abs(e.x),Math.abs(t.x)),i=Math.max(Math.abs(e.y),Math.abs(t.y)),o=Math.max(Math.abs(e.z),Math.abs(t.z));return Math.max(Math.max(n,i),o)}function VGe(e,t,n){const i=1/Math.max(1,HGe(e.position,t.position));return d.multiplyByScalar(e.position,i,TW),d.multiplyByScalar(t.position,i,CW),d.equalsEpsilon(TW,CW,n)&&d.equalsEpsilon(e.direction,t.direction,n)&&d.equalsEpsilon(e.up,t.up,n)&&d.equalsEpsilon(e.right,t.right,n)&&N.equalsEpsilon(e.transform,t.transform,n)&&e.frustum.equalsEpsilon(t.frustum,n)}Sx.prototype.checkForCameraUpdates=function(e){const t=this.camera,n=this._cameraClone;return VGe(t,n,F.EPSILON15)?(this._cameraStartFired&&Gr()-this._cameraMovedTime>e.cameraEventWaitTime&&(t.moveEnd.raiseEvent(),this._cameraStartFired=!1),!1):(this._cameraStartFired||(t.moveStart.raiseEvent(),this._cameraStartFired=!0),this._cameraMovedTime=Gr(),Tt.clone(t,n),!0)};function kGe(e,t,n,i){const o=t.frameState,r=o.camera,s=o.useLogDepth?t.logarithmicDepthFarToNearRatio:t.farToNearRatio,a=t.mode===me.SCENE2D,c=t.nearToFarDistance2D;i*=1+F.EPSILON2,n=Math.min(Math.max(n,r.frustum.near),r.frustum.far),i=Math.max(Math.min(i,r.frustum.far),n);let u;a?(i=Math.min(i,r.position.z+t.nearToFarDistance2D),n=Math.min(n,i),u=Math.ceil(Math.max(1,i-n)/t.nearToFarDistance2D)):u=Math.ceil(Math.log(i/n)/Math.log(s));const f=e.frustumCommandsList;f.length=u;for(let h=0;h<u;++h){let _,g;a?(_=Math.min(i-c,n+h*c),g=Math.min(i,_+c)):(_=Math.max(n,Math.pow(s,h)*n),g=Math.min(i,s*_));let p=f[h];l(p)?(p.near=_,p.far=g):p=f[h]=new Lke(_,g)}}function GGe(e,t,n,i,o){t.debugShowFrustums&&(n.debugOverlappingFrustums=0);const r=e.frustumCommandsList,s=r.length;for(let a=0;a<s;++a){const c=r[a],u=c.near,f=c.far;if(i>f)continue;if(o<u)break;const h=n.pass,_=c.indices[h]++;if(c.commands[h][_]=n,t.debugShowFrustums&&(n.debugOverlappingFrustums|=1<<a),n.executeInClosestFrustum)break}if(t.debugShowFrustums){const a=e.debugFrustumStatistics.commandsInFrustums;a[n.debugOverlappingFrustums]=l(a[n.debugOverlappingFrustums])?a[n.debugOverlappingFrustums]+1:1,++e.debugFrustumStatistics.totalCommands}t.updateDerivedCommands(n)}const bW=new Ur,WGe=new bm;Sx.prototype.createPotentiallyVisibleSet=function(e){const t=e.frameState,n=t.camera,i=n.directionWC,o=n.positionWC,r=e._computeCommandList,s=e._overlayCommandList,a=t.commandList;e.debugShowFrustums&&(this.debugFrustumStatistics={totalCommands:0,commandsInFrustums:{}});const c=this.frustumCommandsList,u=c.length,f=We.NUMBER_OF_PASSES;for(let O=0;O<u;++O)for(let m=0;m<f;++m)c[O].indices[m]=0;r.length=0,s.length=0;const h=this._commandExtents,_=h.length;let g=0,p=+Number.MAX_VALUE,y=-Number.MAX_VALUE;const T=t.shadowState.shadowsEnabled;let b=+Number.MAX_VALUE,x=-Number.MAX_VALUE,v=Number.MAX_VALUE;const D=t.mode===me.SCENE3D?t.occluder:void 0;let L=t.cullingVolume;const B=bW.planes;for(let O=0;O<5;++O)B[O]=L.planes[O];L=bW;const V=a.length;for(let O=0;O<V;++O){const m=a[O],P=m.pass;if(P===We.COMPUTE)r.push(m);else if(P===We.OVERLAY)s.push(m);else{let R,U;const W=m.boundingVolume;if(l(W)){if(!e.isVisible(m,L,D))continue;const Y=W.computePlaneDistances(o,i,WGe);if(R=Y.start,U=Y.stop,p=Math.min(p,R),y=Math.max(y,U),T&&m.receiveShadows&&R<El.MAXIMUM_DISTANCE&&!(P===We.GLOBE&&R<-100&&U>100)){const j=U-R;P!==We.GLOBE&&R<100&&(v=Math.min(v,j)),b=Math.min(b,R),x=Math.max(x,U)}}else m instanceof Bo?(R=n.frustum.near,U=n.frustum.far):(R=n.frustum.near,U=n.frustum.far,p=Math.min(p,R),y=Math.max(y,U));let q=h[g];l(q)||(q=h[g]=new UGe),q.command=m,q.near=R,q.far=U,g++}}T&&(b=Math.min(Math.max(b,n.frustum.near),n.frustum.far),x=Math.max(Math.min(x,n.frustum.far),b)),T&&(t.shadowState.nearPlane=b,t.shadowState.farPlane=x,t.shadowState.closestObjectSize=v),kGe(this,e,p,y);let M,H;for(M=0;M<g;M++)H=h[M],GGe(this,e,H.command,H.near,H.far);if(g<_)for(M=g;M<_&&(H=h[M],!!l(H.command));M++)H.command=void 0;const G=c.length,I=t.frustumSplits;I.length=G+1;for(let O=0;O<G;++O)I[O]=c[O].near,O===G-1&&(I[O+1]=c[O].far)};Sx.prototype.destroy=function(){this.pickFramebuffer=this.pickFramebuffer&&this.pickFramebuffer.destroy(),this.pickDepthFramebuffer=this.pickDepthFramebuffer&&this.pickDepthFramebuffer.destroy(),this.sceneFramebuffer=this.sceneFramebuffer&&this.sceneFramebuffer.destroy(),this.globeDepth=this.globeDepth&&this.globeDepth.destroy(),this.oit=this.oit&&this.oit.destroy(),this.translucentTileClassification=this.translucentTileClassification&&this.translucentTileClassification.destroy(),this.globeTranslucencyFramebuffer=this.globeTranslucencyFramebuffer&&this.globeTranslucencyFramebuffer.destroy();let e;const t=this.pickDepths,n=t.length;for(e=0;e<n;++e)t[e].destroy()};const qZ=.1,qGe=new Ry({pass:Va.MOST_DETAILED_PRELOAD}),jGe=new Ry({pass:Va.MOST_DETAILED_PICK}),Hz=new Ry({pass:Va.PICK});function ga(e){this._mostDetailedRayPicks=[],this.pickRenderStateCache={},this._pickPositionCache={},this._pickPositionCacheDirty=!1;const t=new at(0,0,1,1),n=new Tt(e);n.frustum=new nn({width:qZ,aspectRatio:1,near:.1}),this._pickOffscreenView=new Sx(e,n,t)}ga.prototype.update=function(){this._pickPositionCacheDirty=!0};ga.prototype.getPickDepth=function(e,t){const n=e.view.pickDepths;let i=n[t];return l(i)||(i=new My,n[t]=i),i};const YGe=new yr,$Ge=new d,mv=new d,XGe=new $,KGe=new N;function JGe(e,t,n,i,o){const r=e.camera;let s=r.frustum;l(s._offCenterFrustum)&&(s=s._offCenterFrustum);let a=2*(t.x-o.x)/o.width-1;a*=(s.right-s.left)*.5;let c=2*(o.height-t.y-o.y)/o.height-1;c*=(s.top-s.bottom)*.5;const u=N.clone(r.transform,KGe);r._setTransform(N.IDENTITY);const f=d.clone(r.position,$Ge);d.multiplyByScalar(r.right,a,mv),d.add(mv,f,f),d.multiplyByScalar(r.up,c,mv),d.add(mv,f,f),r._setTransform(u),e.mode===me.SCENE2D&&d.fromElements(f.z,f.x,f.y,f);const h=s.getPixelDimensions(o.width,o.height,1,1,XGe),_=YGe;return _.right=h.x*.5,_.left=-_.right,_.top=h.y*.5,_.bottom=-_.top,_.near=s.near,_.far=s.far,_.computeCullingVolume(f,r.directionWC,r.upWC)}const QGe=new Wa,ZGe=new $;function e5e(e,t,n,i,o){const r=e.camera,s=r.frustum,a=s.near,c=Math.tan(s.fovy*.5),u=s.aspectRatio*c,f=2*(t.x-o.x)/o.width-1,h=2*(o.height-t.y-o.y)/o.height-1,_=f*a*u,g=h*a*c,p=s.getPixelDimensions(o.width,o.height,1,1,ZGe),y=p.x*n*.5,T=p.y*i*.5,b=QGe;return b.top=g+T,b.bottom=g-T,b.right=_+y,b.left=_-y,b.near=a,b.far=s.far,b.computeCullingVolume(r.positionWC,r.directionWC,r.upWC)}function jZ(e,t,n,i,o){const r=e.camera.frustum;return r instanceof nn||r instanceof yr?JGe(e,t,n,i,o):e5e(e,t,n,i,o)}let Q0=3,yb=3,id=new at(0,0,Q0,yb);const YZ=new $,Vz=new k(0,0,0,0);ga.prototype.pick=function(e,t,n,i){if(!l(t))throw new w("windowPosition is undefined.");Q0=A(n,3),yb=A(i,Q0);const o=e.context,r=o.uniformState,s=e.frameState,a=e.defaultView;e.view=a;const c=a.viewport;c.x=0,c.y=0,c.width=o.drawingBufferWidth,c.height=o.drawingBufferHeight;let u=a.passState;u.viewport=at.clone(c,u.viewport);const f=es.transformWindowToDrawingBuffer(e,t,YZ);e.jobScheduler.disableThisFrame(),e.updateFrameState(),s.cullingVolume=jZ(e,f,Q0,yb,c),s.invertClassification=!1,s.passes.pick=!0,s.tilesetPassState=Hz,r.update(s),e.updateEnvironment(),id.x=f.x-(Q0-1)*.5,id.y=e.drawingBufferHeight-f.y-(yb-1)*.5,id.width=Q0,id.height=yb,u=a.pickFramebuffer.begin(id,a.viewport),e.updateAndExecuteCommands(u,Vz),e.resolveFramebuffers(u);const h=a.pickFramebuffer.end(id);return o.endFrame(),h};function t5e(e,t){const n=e.context,i=e.frameState,o=e.environmentState,r=e.defaultView;e.view=r;const s=r.viewport;s.x=0,s.y=0,s.width=n.drawingBufferWidth,s.height=n.drawingBufferHeight;let a=r.passState;a.viewport=at.clone(s,a.viewport),e.clearPasses(i.passes),i.passes.pick=!0,i.passes.depth=!0,i.cullingVolume=jZ(e,t,1,1,s),i.tilesetPassState=Hz,e.updateEnvironment(),o.renderTranslucentDepthForPick=!0,a=r.pickDepthFramebuffer.update(n,t,s),e.updateAndExecuteCommands(a,Vz),e.resolveFramebuffers(a),n.endFrame()}const n5e=new hi,i5e=new Wa,o5e=new nn,r5e=new yr;ga.prototype.pickPositionWorldCoordinates=function(e,t,n){if(!e.useDepthPicking)return;if(!l(t))throw new w("windowPosition is undefined.");if(!e.context.depthTexture)throw new w("Picking from the depth buffer is not supported. Check pickPositionSupported.");const i=t.toString();if(this._pickPositionCacheDirty)this._pickPositionCache={},this._pickPositionCacheDirty=!1;else if(this._pickPositionCache.hasOwnProperty(i))return d.clone(this._pickPositionCache[i],n);const o=e.frameState,r=e.context,s=r.uniformState,a=e.defaultView;e.view=a;const c=es.transformWindowToDrawingBuffer(e,t,YZ);e.pickTranslucentDepth?t5e(e,c):(e.updateFrameState(),s.update(o),e.updateEnvironment()),c.y=e.drawingBufferHeight-c.y;const u=e.camera;let f;l(u.frustum.fov)?f=u.frustum.clone(n5e):l(u.frustum.infiniteProjectionMatrix)?f=u.frustum.clone(i5e):l(u.frustum.width)?f=u.frustum.clone(o5e):f=u.frustum.clone(r5e);const h=a.frustumCommandsList,_=h.length;for(let g=0;g<_;++g){const y=this.getPickDepth(e,g).getDepth(r,c.x,c.y);if(l(y)&&y>0&&y<1){const T=h[g];let b;return e.mode===me.SCENE2D?(b=u.position.z,u.position.z=b-T.near+1,f.far=Math.max(1,T.far-T.near),f.near=1,s.update(o),s.updateFrustum(f)):(f.near=T.near*(g!==0?e.opaqueFrustumNearOffset:1),f.far=T.far,s.updateFrustum(f)),n=es.drawingBufferToWgs84Coordinates(e,c,y,n),e.mode===me.SCENE2D&&(u.position.z=b,s.update(o)),this._pickPositionCache[i]=d.clone(n),n}}this._pickPositionCache[i]=void 0};const s5e=new ve;ga.prototype.pickPosition=function(e,t,n){if(n=this.pickPositionWorldCoordinates(e,t,n),l(n)&&e.mode!==me.SCENE3D){d.fromElements(n.y,n.z,n.x,n);const i=e.mapProjection,o=i.ellipsoid,r=i.unproject(n,s5e);o.cartographicToCartesian(r,n)}return n};function $Z(e,t){let n,i;const o=[],r=[],s=[],a=[];l(e)||(e=Number.MAX_VALUE);let c=t();for(;l(c);){const u=c.object,f=c.position,h=c.exclude;if(l(f)&&!l(u)){o.push(c);break}if(!l(u)||!l(u.primitive)||!h&&(o.push(c),0>=--e))break;const _=u.primitive;let g=!1;typeof _.getGeometryInstanceAttributes=="function"&&l(u.id)&&(i=_.getGeometryInstanceAttributes(u.id),l(i)&&l(i.show)&&(g=!0,i.show=pi.toValue(!1,i.show),s.push(i))),u instanceof Js&&(g=!0,u.show=!1,a.push(u)),g||(_.show=!1,r.push(_)),c=t()}for(n=0;n<r.length;++n)r[n].show=!0;for(n=0;n<s.length;++n)i=s[n],i.show=pi.toValue(!0,i.show);for(n=0;n<a.length;++n)a[n].show=!0;return o}ga.prototype.drillPick=function(e,t,n,i,o){const r=this;return $Z(n,function(){const c=r.pick(e,t,i,o);if(l(c))return{object:c,position:void 0,exclude:!1}}).map(function(c){return c.object})};const EW=new d,a5e=new d;function c5e(e,t,n){this.ray=e,this.width=t,this.tilesets=n,this.ready=!1;const i=this;this.promise=new Promise(o=>{i._completePick=()=>{o()}})}function XZ(e,t,n,i){const o=t.direction,r=d.mostOrthogonalAxis(o,EW),s=d.cross(o,r,EW),a=d.cross(o,s,a5e);return i.position=t.origin,i.direction=o,i.up=a,i.right=s,i.frustum.width=A(n,qZ),i.frustum.computeCullingVolume(i.positionWC,i.directionWC,i.upWC)}function l5e(e,t,n){const i=t.frameState,o=n.ray,r=n.width,s=n.tilesets,a=e._pickOffscreenView.camera,c=XZ(e,o,r,a),u=qGe;u.camera=a,u.cullingVolume=c;let f=!0;const h=s.length;for(let _=0;_<h;++_){const g=s[_];g.show&&t.primitives.contains(g)&&(g.updateForPass(i,u),f=f&&u.ready)}return f&&n._completePick(),f}ga.prototype.updateMostDetailedRayPicks=function(e){const t=this._mostDetailedRayPicks;for(let n=0;n<t.length;++n)l5e(this,e,t[n])&&t.splice(n--,1)};function KZ(e,t,n){const i=e.length;for(let o=0;o<i;++o){const r=e.get(o);r.show&&(l(r.isCesium3DTileset)?(!l(t)||t.indexOf(r)===-1)&&n.push(r):r instanceof Tr&&KZ(r,t,n))}}function hP(e,t,n,i,o,r){const s=[];if(KZ(t.primitives,i,s),s.length===0)return Promise.resolve(r());const a=new c5e(n,o,s);return e._mostDetailedRayPicks.push(a),a.promise.then(function(){return r()})}function u5e(e,t){return!l(e)||!l(t)||t.length===0?!1:t.indexOf(e)>-1||t.indexOf(e.primitive)>-1||t.indexOf(e.id)>-1}function f5e(e,t,n,i,o,r,s){const a=t.context,c=a.uniformState,u=t.frameState,f=e._pickOffscreenView;t.view=f,XZ(e,n,o,f.camera),id=at.clone(f.viewport,id);const h=f.pickFramebuffer.begin(id,f.viewport);t.jobScheduler.disableThisFrame(),t.updateFrameState(),u.invertClassification=!1,u.passes.pick=!0,u.passes.offscreen=!0,s?u.tilesetPassState=jGe:u.tilesetPassState=Hz,c.update(u),t.updateEnvironment(),t.updateAndExecuteCommands(h,Vz),t.resolveFramebuffers(h);let _;const g=f.pickFramebuffer.end(id);if(t.context.depthTexture){const p=f.frustumCommandsList.length;for(let y=0;y<p;++y){const b=e.getPickDepth(t,y).getDepth(a,0,0);if(l(b)&&b>0&&b<1){const x=f.frustumCommandsList[y],v=x.near*(y!==0?t.opaqueFrustumNearOffset:1),D=x.far,L=v+b*(D-v);_=ii.getPoint(n,L);break}}}if(t.view=t.defaultView,a.endFrame(),l(g)||l(_))return{object:g,position:_,exclude:!l(_)&&r||u5e(g,i)}}function JZ(e,t,n,i,o,r,s,a){return $Z(i,function(){return f5e(e,t,n,o,r,s,a)})}function wT(e,t,n,i,o,r,s){const a=JZ(e,t,n,1,i,o,r,s);if(a.length>0)return a[0]}function QZ(e,t,n,i,o,r,s,a){return JZ(e,t,n,i,o,r,s,a)}function pP(e,t){return new Promise((n,i)=>{t.then(function(o){const r=e.postRender.addEventListener(function(){r(),n(o)});e.requestRender()}).catch(function(o){i(o)})})}ga.prototype.pickFromRay=function(e,t,n,i){if(E.defined("ray",t),e.mode!==me.SCENE3D)throw new w("Ray intersections are only supported in 3D mode.");return wT(this,e,t,n,i,!1,!1)};ga.prototype.drillPickFromRay=function(e,t,n,i,o){if(E.defined("ray",t),e.mode!==me.SCENE3D)throw new w("Ray intersections are only supported in 3D mode.");return QZ(this,e,t,n,i,o,!1,!1)};ga.prototype.pickFromRayMostDetailed=function(e,t,n,i){if(E.defined("ray",t),e.mode!==me.SCENE3D)throw new w("Ray intersections are only supported in 3D mode.");const o=this;return t=ii.clone(t),n=l(n)?n.slice():n,pP(e,hP(o,e,t,n,i,function(){return wT(o,e,t,n,i,!1,!0)}))};ga.prototype.drillPickFromRayMostDetailed=function(e,t,n,i,o){if(E.defined("ray",t),e.mode!==me.SCENE3D)throw new w("Ray intersections are only supported in 3D mode.");const r=this;return t=ii.clone(t),i=l(i)?i.slice():i,pP(e,hP(r,e,t,i,o,function(){return QZ(r,e,t,n,i,o,!1,!0)}))};const d5e=new d,h5e=new d,p5e=new ii,ZZ=new ve;function kz(e,t){const n=e.globe,i=l(n)?n.ellipsoid:e.mapProjection.ellipsoid,o=Ro._defaultMaxTerrainHeight,r=i.geodeticSurfaceNormalCartographic(t,h5e),s=ve.toCartesian(t,i,d5e),a=p5e;a.origin=s,a.direction=r;const c=new ii;return ii.getPoint(a,o,c.origin),d.negate(r,c.direction),c}function eee(e,t){const n=e.globe,i=l(n)?n.ellipsoid:e.mapProjection.ellipsoid,o=ve.fromCartesian(t,i,ZZ);return kz(e,o)}function tee(e,t){const n=e.globe,i=l(n)?n.ellipsoid:e.mapProjection.ellipsoid;return ve.fromCartesian(t,i,ZZ).height}function m5e(e,t,n,i,o){const r=kz(t,n);return hP(e,t,r,i,o,function(){const s=wT(e,t,r,i,o,!0,!0);if(l(s))return tee(t,s.position)})}function _5e(e,t,n,i,o,r){const s=eee(t,n);return hP(e,t,s,i,o,function(){const a=wT(e,t,s,i,o,!0,!0);if(l(a))return d.clone(a.position,r)})}ga.prototype.sampleHeight=function(e,t,n,i){if(E.defined("position",t),e.mode!==me.SCENE3D)throw new w("sampleHeight is only supported in 3D mode.");if(!e.sampleHeightSupported)throw new w("sampleHeight requires depth texture support. Check sampleHeightSupported.");const o=kz(e,t),r=wT(this,e,o,n,i,!0,!1);if(l(r))return tee(e,r.position)};ga.prototype.clampToHeight=function(e,t,n,i,o){if(E.defined("cartesian",t),e.mode!==me.SCENE3D)throw new w("clampToHeight is only supported in 3D mode.");if(!e.clampToHeightSupported)throw new w("clampToHeight requires depth texture support. Check clampToHeightSupported.");const r=eee(e,t),s=wT(this,e,r,n,i,!0,!1);if(l(s))return d.clone(s.position,o)};ga.prototype.sampleHeightMostDetailed=function(e,t,n,i){if(E.defined("positions",t),e.mode!==me.SCENE3D)throw new w("sampleHeightMostDetailed is only supported in 3D mode.");if(!e.sampleHeightSupported)throw new w("sampleHeightMostDetailed requires depth texture support. Check sampleHeightSupported.");n=l(n)?n.slice():n;const o=t.length,r=new Array(o);for(let s=0;s<o;++s)r[s]=m5e(this,e,t[s],n,i);return pP(e,Promise.all(r).then(function(s){const a=s.length;for(let c=0;c<a;++c)t[c].height=s[c];return t}))};ga.prototype.clampToHeightMostDetailed=function(e,t,n,i){if(E.defined("cartesians",t),e.mode!==me.SCENE3D)throw new w("clampToHeightMostDetailed is only supported in 3D mode.");if(!e.clampToHeightSupported)throw new w("clampToHeightMostDetailed requires depth texture support. Check clampToHeightSupported.");n=l(n)?n.slice():n;const o=t.length,r=new Array(o);for(let s=0;s<o;++s)r[s]=_5e(this,e,t[s],n,i,t[s]);return pP(e,Promise.all(r).then(function(s){const a=s.length;for(let c=0;c<a;++c)t[c]=s[c];return t}))};ga.prototype.destroy=function(){this._pickOffscreenView=this._pickOffscreenView&&this._pickOffscreenView.destroy()};const g5e=`uniform sampler2D colorTexture;
|
||
|
||
varying vec2 v_textureCoordinates;
|
||
|
||
#ifdef AUTO_EXPOSURE
|
||
uniform sampler2D autoExposure;
|
||
#endif
|
||
|
||
void main()
|
||
{
|
||
vec4 fragmentColor = texture2D(colorTexture, v_textureCoordinates);
|
||
vec3 color = fragmentColor.rgb;
|
||
|
||
#ifdef AUTO_EXPOSURE
|
||
color /= texture2D(autoExposure, vec2(0.5)).r;
|
||
#endif
|
||
color = czm_acesTonemapping(color);
|
||
color = czm_inverseGamma(color);
|
||
|
||
gl_FragColor = vec4(color, fragmentColor.a);
|
||
}
|
||
`,y5e=`uniform sampler2D randomTexture;
|
||
uniform sampler2D depthTexture;
|
||
uniform float intensity;
|
||
uniform float bias;
|
||
uniform float lengthCap;
|
||
uniform float stepSize;
|
||
uniform float frustumLength;
|
||
|
||
varying vec2 v_textureCoordinates;
|
||
|
||
vec4 clipToEye(vec2 uv, float depth)
|
||
{
|
||
vec2 xy = vec2((uv.x * 2.0 - 1.0), ((1.0 - uv.y) * 2.0 - 1.0));
|
||
vec4 posEC = czm_inverseProjection * vec4(xy, depth, 1.0);
|
||
posEC = posEC / posEC.w;
|
||
return posEC;
|
||
}
|
||
|
||
//Reconstruct Normal Without Edge Removation
|
||
vec3 getNormalXEdge(vec3 posInCamera, float depthU, float depthD, float depthL, float depthR, vec2 pixelSize)
|
||
{
|
||
vec4 posInCameraUp = clipToEye(v_textureCoordinates - vec2(0.0, pixelSize.y), depthU);
|
||
vec4 posInCameraDown = clipToEye(v_textureCoordinates + vec2(0.0, pixelSize.y), depthD);
|
||
vec4 posInCameraLeft = clipToEye(v_textureCoordinates - vec2(pixelSize.x, 0.0), depthL);
|
||
vec4 posInCameraRight = clipToEye(v_textureCoordinates + vec2(pixelSize.x, 0.0), depthR);
|
||
|
||
vec3 up = posInCamera.xyz - posInCameraUp.xyz;
|
||
vec3 down = posInCameraDown.xyz - posInCamera.xyz;
|
||
vec3 left = posInCamera.xyz - posInCameraLeft.xyz;
|
||
vec3 right = posInCameraRight.xyz - posInCamera.xyz;
|
||
|
||
vec3 DX = length(left) < length(right) ? left : right;
|
||
vec3 DY = length(up) < length(down) ? up : down;
|
||
|
||
return normalize(cross(DY, DX));
|
||
}
|
||
|
||
void main(void)
|
||
{
|
||
float depth = czm_readDepth(depthTexture, v_textureCoordinates);
|
||
vec4 posInCamera = clipToEye(v_textureCoordinates, depth);
|
||
|
||
if (posInCamera.z > frustumLength)
|
||
{
|
||
gl_FragColor = vec4(1.0);
|
||
return;
|
||
}
|
||
|
||
vec2 pixelSize = czm_pixelRatio / czm_viewport.zw;
|
||
float depthU = czm_readDepth(depthTexture, v_textureCoordinates - vec2(0.0, pixelSize.y));
|
||
float depthD = czm_readDepth(depthTexture, v_textureCoordinates + vec2(0.0, pixelSize.y));
|
||
float depthL = czm_readDepth(depthTexture, v_textureCoordinates - vec2(pixelSize.x, 0.0));
|
||
float depthR = czm_readDepth(depthTexture, v_textureCoordinates + vec2(pixelSize.x, 0.0));
|
||
vec3 normalInCamera = getNormalXEdge(posInCamera.xyz, depthU, depthD, depthL, depthR, pixelSize);
|
||
|
||
float ao = 0.0;
|
||
vec2 sampleDirection = vec2(1.0, 0.0);
|
||
float gapAngle = 90.0 * czm_radiansPerDegree;
|
||
|
||
// RandomNoise
|
||
float randomVal = texture2D(randomTexture, v_textureCoordinates).x;
|
||
|
||
//Loop for each direction
|
||
for (int i = 0; i < 4; i++)
|
||
{
|
||
float newGapAngle = gapAngle * (float(i) + randomVal);
|
||
float cosVal = cos(newGapAngle);
|
||
float sinVal = sin(newGapAngle);
|
||
|
||
//Rotate Sampling Direction
|
||
vec2 rotatedSampleDirection = vec2(cosVal * sampleDirection.x - sinVal * sampleDirection.y, sinVal * sampleDirection.x + cosVal * sampleDirection.y);
|
||
float localAO = 0.0;
|
||
float localStepSize = stepSize;
|
||
|
||
//Loop for each step
|
||
for (int j = 0; j < 6; j++)
|
||
{
|
||
vec2 newCoords = v_textureCoordinates + rotatedSampleDirection * localStepSize * pixelSize;
|
||
|
||
//Exception Handling
|
||
if(newCoords.x > 1.0 || newCoords.y > 1.0 || newCoords.x < 0.0 || newCoords.y < 0.0)
|
||
{
|
||
break;
|
||
}
|
||
|
||
float stepDepthInfo = czm_readDepth(depthTexture, newCoords);
|
||
vec4 stepPosInCamera = clipToEye(newCoords, stepDepthInfo);
|
||
vec3 diffVec = stepPosInCamera.xyz - posInCamera.xyz;
|
||
float len = length(diffVec);
|
||
|
||
if (len > lengthCap)
|
||
{
|
||
break;
|
||
}
|
||
|
||
float dotVal = clamp(dot(normalInCamera, normalize(diffVec)), 0.0, 1.0 );
|
||
float weight = len / lengthCap;
|
||
weight = 1.0 - weight * weight;
|
||
|
||
if (dotVal < bias)
|
||
{
|
||
dotVal = 0.0;
|
||
}
|
||
|
||
localAO = max(localAO, dotVal * weight);
|
||
localStepSize += stepSize;
|
||
}
|
||
ao += localAO;
|
||
}
|
||
|
||
ao /= 4.0;
|
||
ao = 1.0 - clamp(ao, 0.0, 1.0);
|
||
ao = pow(ao, intensity);
|
||
gl_FragColor = vec4(vec3(ao), 1.0);
|
||
}
|
||
`,A5e=`uniform sampler2D colorTexture;
|
||
uniform sampler2D ambientOcclusionTexture;
|
||
uniform bool ambientOcclusionOnly;
|
||
varying vec2 v_textureCoordinates;
|
||
|
||
void main(void)
|
||
{
|
||
vec3 color = texture2D(colorTexture, v_textureCoordinates).rgb;
|
||
vec3 ao = texture2D(ambientOcclusionTexture, v_textureCoordinates).rgb;
|
||
gl_FragColor.rgb = ambientOcclusionOnly ? ao : ao * color;
|
||
}
|
||
`,T5e=`uniform sampler2D colorTexture;
|
||
uniform float gradations;
|
||
|
||
varying vec2 v_textureCoordinates;
|
||
|
||
void main(void)
|
||
{
|
||
vec3 rgb = texture2D(colorTexture, v_textureCoordinates).rgb;
|
||
#ifdef CZM_SELECTED_FEATURE
|
||
if (czm_selected()) {
|
||
gl_FragColor = vec4(rgb, 1.0);
|
||
return;
|
||
}
|
||
#endif
|
||
float luminance = czm_luminance(rgb);
|
||
float darkness = luminance * gradations;
|
||
darkness = (darkness - fract(darkness)) / gradations;
|
||
gl_FragColor = vec4(vec3(darkness), 1.0);
|
||
}
|
||
`,C5e=`uniform sampler2D colorTexture;
|
||
uniform sampler2D bloomTexture;
|
||
uniform bool glowOnly;
|
||
|
||
varying vec2 v_textureCoordinates;
|
||
|
||
void main(void)
|
||
{
|
||
vec4 color = texture2D(colorTexture, v_textureCoordinates);
|
||
|
||
#ifdef CZM_SELECTED_FEATURE
|
||
if (czm_selected()) {
|
||
gl_FragColor = color;
|
||
return;
|
||
}
|
||
#endif
|
||
|
||
vec4 bloom = texture2D(bloomTexture, v_textureCoordinates);
|
||
gl_FragColor = glowOnly ? bloom : bloom + color;
|
||
}
|
||
`,b5e=`uniform sampler2D colorTexture;
|
||
uniform float brightness;
|
||
|
||
varying vec2 v_textureCoordinates;
|
||
|
||
void main(void)
|
||
{
|
||
vec3 rgb = texture2D(colorTexture, v_textureCoordinates).rgb;
|
||
vec3 target = vec3(0.0);
|
||
gl_FragColor = vec4(mix(target, rgb, brightness), 1.0);
|
||
}
|
||
`,E5e=`uniform sampler2D colorTexture;
|
||
uniform float contrast;
|
||
uniform float brightness;
|
||
|
||
varying vec2 v_textureCoordinates;
|
||
|
||
void main(void)
|
||
{
|
||
vec3 sceneColor = texture2D(colorTexture, v_textureCoordinates).xyz;
|
||
sceneColor = czm_RGBToHSB(sceneColor);
|
||
sceneColor.z += brightness;
|
||
sceneColor = czm_HSBToRGB(sceneColor);
|
||
|
||
float factor = (259.0 * (contrast + 255.0)) / (255.0 * (259.0 - contrast));
|
||
sceneColor = factor * (sceneColor - vec3(0.5)) + vec3(0.5);
|
||
gl_FragColor = vec4(sceneColor, 1.0);
|
||
}
|
||
`,x5e=`uniform sampler2D colorTexture;
|
||
uniform sampler2D blurTexture;
|
||
uniform sampler2D depthTexture;
|
||
uniform float focalDistance;
|
||
|
||
varying vec2 v_textureCoordinates;
|
||
|
||
vec4 toEye(vec2 uv, float depth)
|
||
{
|
||
vec2 xy = vec2((uv.x * 2.0 - 1.0), ((1.0 - uv.y) * 2.0 - 1.0));
|
||
vec4 posInCamera = czm_inverseProjection * vec4(xy, depth, 1.0);
|
||
posInCamera = posInCamera / posInCamera.w;
|
||
return posInCamera;
|
||
}
|
||
|
||
float computeDepthBlur(float depth)
|
||
{
|
||
float f;
|
||
if (depth < focalDistance)
|
||
{
|
||
f = (focalDistance - depth) / (focalDistance - czm_currentFrustum.x);
|
||
}
|
||
else
|
||
{
|
||
f = (depth - focalDistance) / (czm_currentFrustum.y - focalDistance);
|
||
f = pow(f, 0.1);
|
||
}
|
||
f *= f;
|
||
f = clamp(f, 0.0, 1.0);
|
||
return pow(f, 0.5);
|
||
}
|
||
|
||
void main(void)
|
||
{
|
||
float depth = czm_readDepth(depthTexture, v_textureCoordinates);
|
||
vec4 posInCamera = toEye(v_textureCoordinates, depth);
|
||
float d = computeDepthBlur(-posInCamera.z);
|
||
gl_FragColor = mix(texture2D(colorTexture, v_textureCoordinates), texture2D(blurTexture, v_textureCoordinates), d);
|
||
}
|
||
`,w5e=`uniform sampler2D depthTexture;
|
||
|
||
varying vec2 v_textureCoordinates;
|
||
|
||
void main(void)
|
||
{
|
||
float depth = czm_readDepth(depthTexture, v_textureCoordinates);
|
||
gl_FragColor = vec4(vec3(depth), 1.0);
|
||
}
|
||
`,S5e=`uniform sampler2D depthTexture;
|
||
uniform float length;
|
||
uniform vec4 color;
|
||
|
||
varying vec2 v_textureCoordinates;
|
||
|
||
void main(void)
|
||
{
|
||
float directions[3];
|
||
directions[0] = -1.0;
|
||
directions[1] = 0.0;
|
||
directions[2] = 1.0;
|
||
|
||
float scalars[3];
|
||
scalars[0] = 3.0;
|
||
scalars[1] = 10.0;
|
||
scalars[2] = 3.0;
|
||
|
||
float padx = czm_pixelRatio / czm_viewport.z;
|
||
float pady = czm_pixelRatio / czm_viewport.w;
|
||
|
||
#ifdef CZM_SELECTED_FEATURE
|
||
bool selected = false;
|
||
for (int i = 0; i < 3; ++i)
|
||
{
|
||
float dir = directions[i];
|
||
selected = selected || czm_selected(vec2(-padx, dir * pady));
|
||
selected = selected || czm_selected(vec2(padx, dir * pady));
|
||
selected = selected || czm_selected(vec2(dir * padx, -pady));
|
||
selected = selected || czm_selected(vec2(dir * padx, pady));
|
||
if (selected)
|
||
{
|
||
break;
|
||
}
|
||
}
|
||
if (!selected)
|
||
{
|
||
gl_FragColor = vec4(color.rgb, 0.0);
|
||
return;
|
||
}
|
||
#endif
|
||
|
||
float horizEdge = 0.0;
|
||
float vertEdge = 0.0;
|
||
|
||
for (int i = 0; i < 3; ++i)
|
||
{
|
||
float dir = directions[i];
|
||
float scale = scalars[i];
|
||
|
||
horizEdge -= texture2D(depthTexture, v_textureCoordinates + vec2(-padx, dir * pady)).x * scale;
|
||
horizEdge += texture2D(depthTexture, v_textureCoordinates + vec2(padx, dir * pady)).x * scale;
|
||
|
||
vertEdge -= texture2D(depthTexture, v_textureCoordinates + vec2(dir * padx, -pady)).x * scale;
|
||
vertEdge += texture2D(depthTexture, v_textureCoordinates + vec2(dir * padx, pady)).x * scale;
|
||
}
|
||
|
||
float len = sqrt(horizEdge * horizEdge + vertEdge * vertEdge);
|
||
gl_FragColor = vec4(color.rgb, len > length ? color.a : 0.0);
|
||
}
|
||
`,v5e=`uniform sampler2D colorTexture;
|
||
|
||
varying vec2 v_textureCoordinates;
|
||
|
||
#ifdef AUTO_EXPOSURE
|
||
uniform sampler2D autoExposure;
|
||
#endif
|
||
|
||
// See slides 142 and 143:
|
||
// http://www.gdcvault.com/play/1012459/Uncharted_2__HDR_Lighting
|
||
|
||
void main()
|
||
{
|
||
vec4 fragmentColor = texture2D(colorTexture, v_textureCoordinates);
|
||
vec3 color = fragmentColor.rgb;
|
||
|
||
#ifdef AUTO_EXPOSURE
|
||
float exposure = texture2D(autoExposure, vec2(0.5)).r;
|
||
color /= exposure;
|
||
#endif
|
||
|
||
const float A = 0.22; // shoulder strength
|
||
const float B = 0.30; // linear strength
|
||
const float C = 0.10; // linear angle
|
||
const float D = 0.20; // toe strength
|
||
const float E = 0.01; // toe numerator
|
||
const float F = 0.30; // toe denominator
|
||
|
||
const float white = 11.2; // linear white point value
|
||
|
||
vec3 c = ((color * (A * color + C * B) + D * E) / (color * ( A * color + B) + D * F)) - E / F;
|
||
float w = ((white * (A * white + C * B) + D * E) / (white * ( A * white + B) + D * F)) - E / F;
|
||
|
||
c = czm_inverseGamma(c / w);
|
||
gl_FragColor = vec4(c, fragmentColor.a);
|
||
}
|
||
`,D5e=`varying vec2 v_textureCoordinates;
|
||
|
||
uniform sampler2D colorTexture;
|
||
|
||
const float fxaaQualitySubpix = 0.5;
|
||
const float fxaaQualityEdgeThreshold = 0.125;
|
||
const float fxaaQualityEdgeThresholdMin = 0.0833;
|
||
|
||
void main()
|
||
{
|
||
vec2 fxaaQualityRcpFrame = vec2(1.0) / czm_viewport.zw;
|
||
vec4 color = FxaaPixelShader(
|
||
v_textureCoordinates,
|
||
colorTexture,
|
||
fxaaQualityRcpFrame,
|
||
fxaaQualitySubpix,
|
||
fxaaQualityEdgeThreshold,
|
||
fxaaQualityEdgeThresholdMin);
|
||
float alpha = texture2D(colorTexture, v_textureCoordinates).a;
|
||
gl_FragColor = vec4(color.rgb, alpha);
|
||
}
|
||
`,vF=`#define SAMPLES 8
|
||
|
||
uniform float delta;
|
||
uniform float sigma;
|
||
uniform float direction; // 0.0 for x direction, 1.0 for y direction
|
||
|
||
uniform sampler2D colorTexture;
|
||
|
||
#ifdef USE_STEP_SIZE
|
||
uniform float stepSize;
|
||
#else
|
||
uniform vec2 step;
|
||
#endif
|
||
|
||
varying vec2 v_textureCoordinates;
|
||
|
||
// Incremental Computation of the Gaussian:
|
||
// https://developer.nvidia.com/gpugems/GPUGems3/gpugems3_ch40.html
|
||
|
||
void main()
|
||
{
|
||
vec2 st = v_textureCoordinates;
|
||
vec2 dir = vec2(1.0 - direction, direction);
|
||
|
||
#ifdef USE_STEP_SIZE
|
||
vec2 step = vec2(stepSize * (czm_pixelRatio / czm_viewport.zw));
|
||
#else
|
||
vec2 step = step;
|
||
#endif
|
||
|
||
vec3 g;
|
||
g.x = 1.0 / (sqrt(czm_twoPi) * sigma);
|
||
g.y = exp((-0.5 * delta * delta) / (sigma * sigma));
|
||
g.z = g.y * g.y;
|
||
|
||
vec4 result = texture2D(colorTexture, st) * g.x;
|
||
for (int i = 1; i < SAMPLES; ++i)
|
||
{
|
||
g.xy *= g.yz;
|
||
|
||
vec2 offset = float(i) * dir * step;
|
||
result += texture2D(colorTexture, st - offset) * g.x;
|
||
result += texture2D(colorTexture, st + offset) * g.x;
|
||
}
|
||
|
||
gl_FragColor = result;
|
||
}
|
||
`,I5e=`uniform sampler2D colorTexture;
|
||
uniform sampler2D dirtTexture;
|
||
uniform sampler2D starTexture;
|
||
uniform vec2 dirtTextureDimensions;
|
||
uniform float distortion;
|
||
uniform float ghostDispersal;
|
||
uniform float haloWidth;
|
||
uniform float dirtAmount;
|
||
uniform float earthRadius;
|
||
uniform float intensity;
|
||
|
||
varying vec2 v_textureCoordinates;
|
||
|
||
// whether it is in space or not
|
||
// 6500000.0 is empirical value
|
||
#define DISTANCE_TO_SPACE 6500000.0
|
||
|
||
// return ndc from world coordinate biased earthRadius
|
||
vec4 getNDCFromWC(vec3 WC, float earthRadius)
|
||
{
|
||
vec4 positionEC = czm_view * vec4(WC, 1.0);
|
||
positionEC = vec4(positionEC.x + earthRadius, positionEC.y, positionEC.z, 1.0);
|
||
vec4 positionWC = czm_eyeToWindowCoordinates(positionEC);
|
||
return czm_viewportOrthographic * vec4(positionWC.xy, -positionWC.z, 1.0);
|
||
}
|
||
|
||
// Check if current pixel is included Earth
|
||
// if then mask it gradually
|
||
float isInEarth(vec2 texcoord, vec2 sceneSize)
|
||
{
|
||
vec2 NDC = texcoord * 2.0 - 1.0;
|
||
vec4 earthPosSC = getNDCFromWC(vec3(0.0), 0.0);
|
||
vec4 earthPosSCEdge = getNDCFromWC(vec3(0.0), earthRadius * 1.5);
|
||
NDC.xy -= earthPosSC.xy;
|
||
|
||
float X = abs(NDC.x) * sceneSize.x;
|
||
float Y = abs(NDC.y) * sceneSize.y;
|
||
|
||
return clamp(0.0, 1.0, max(sqrt(X * X + Y * Y) / max(abs(earthPosSCEdge.x * sceneSize.x), 1.0) - 0.8 , 0.0));
|
||
}
|
||
|
||
// For Chromatic effect
|
||
vec4 textureDistorted(sampler2D tex, vec2 texcoord, vec2 direction, vec3 distortion, bool isSpace)
|
||
{
|
||
vec2 sceneSize = czm_viewport.zw;
|
||
vec3 color;
|
||
if(isSpace)
|
||
{
|
||
color.r = isInEarth(texcoord + direction * distortion.r, sceneSize) * texture2D(tex, texcoord + direction * distortion.r).r;
|
||
color.g = isInEarth(texcoord + direction * distortion.g, sceneSize) * texture2D(tex, texcoord + direction * distortion.g).g;
|
||
color.b = isInEarth(texcoord + direction * distortion.b, sceneSize) * texture2D(tex, texcoord + direction * distortion.b).b;
|
||
}
|
||
else
|
||
{
|
||
color.r = texture2D(tex, texcoord + direction * distortion.r).r;
|
||
color.g = texture2D(tex, texcoord + direction * distortion.g).g;
|
||
color.b = texture2D(tex, texcoord + direction * distortion.b).b;
|
||
}
|
||
return vec4(clamp(color, 0.0, 1.0), 0.0);
|
||
}
|
||
|
||
void main(void)
|
||
{
|
||
vec4 originalColor = texture2D(colorTexture, v_textureCoordinates);
|
||
vec3 rgb = originalColor.rgb;
|
||
bool isSpace = length(czm_viewerPositionWC.xyz) > DISTANCE_TO_SPACE;
|
||
|
||
// Sun position
|
||
vec4 sunPos = czm_morphTime == 1.0 ? vec4(czm_sunPositionWC, 1.0) : vec4(czm_sunPositionColumbusView.zxy, 1.0);
|
||
vec4 sunPositionEC = czm_view * sunPos;
|
||
vec4 sunPositionWC = czm_eyeToWindowCoordinates(sunPositionEC);
|
||
sunPos = czm_viewportOrthographic * vec4(sunPositionWC.xy, -sunPositionWC.z, 1.0);
|
||
|
||
// If sun is not in the screen space, use original color.
|
||
if(!isSpace || !((sunPos.x >= -1.1 && sunPos.x <= 1.1) && (sunPos.y >= -1.1 && sunPos.y <= 1.1)))
|
||
{
|
||
// Lens flare is disabled when not in space until #5932 is fixed.
|
||
// https://github.com/CesiumGS/cesium/issues/5932
|
||
gl_FragColor = originalColor;
|
||
return;
|
||
}
|
||
|
||
vec2 texcoord = vec2(1.0) - v_textureCoordinates;
|
||
vec2 pixelSize = czm_pixelRatio / czm_viewport.zw;
|
||
vec2 invPixelSize = 1.0 / pixelSize;
|
||
vec3 distortionVec = pixelSize.x * vec3(-distortion, 0.0, distortion);
|
||
|
||
// ghost vector to image centre:
|
||
vec2 ghostVec = (vec2(0.5) - texcoord) * ghostDispersal;
|
||
vec3 direction = normalize(vec3(ghostVec, 0.0));
|
||
|
||
// sample ghosts:
|
||
vec4 result = vec4(0.0);
|
||
vec4 ghost = vec4(0.0);
|
||
for (int i = 0; i < 4; ++i)
|
||
{
|
||
vec2 offset = fract(texcoord + ghostVec * float(i));
|
||
// Only bright spots from the centre of the source image
|
||
ghost += textureDistorted(colorTexture, offset, direction.xy, distortionVec, isSpace);
|
||
}
|
||
result += ghost;
|
||
|
||
// sample halo
|
||
vec2 haloVec = normalize(ghostVec) * haloWidth;
|
||
float weightForHalo = length(vec2(0.5) - fract(texcoord + haloVec)) / length(vec2(0.5));
|
||
weightForHalo = pow(1.0 - weightForHalo, 5.0);
|
||
|
||
result += textureDistorted(colorTexture, texcoord + haloVec, direction.xy, distortionVec, isSpace) * weightForHalo * 1.5;
|
||
|
||
// dirt on lens
|
||
vec2 dirtTexCoords = (v_textureCoordinates * invPixelSize) / dirtTextureDimensions;
|
||
if (dirtTexCoords.x > 1.0)
|
||
{
|
||
dirtTexCoords.x = mod(floor(dirtTexCoords.x), 2.0) == 1.0 ? 1.0 - fract(dirtTexCoords.x) : fract(dirtTexCoords.x);
|
||
}
|
||
if (dirtTexCoords.y > 1.0)
|
||
{
|
||
dirtTexCoords.y = mod(floor(dirtTexCoords.y), 2.0) == 1.0 ? 1.0 - fract(dirtTexCoords.y) : fract(dirtTexCoords.y);
|
||
}
|
||
result += dirtAmount * texture2D(dirtTexture, dirtTexCoords);
|
||
|
||
// Rotating starburst texture's coordinate
|
||
// dot(czm_view[0].xyz, vec3(0.0, 0.0, 1.0)) + dot(czm_view[1].xyz, vec3(0.0, 1.0, 0.0))
|
||
float camrot = czm_view[0].z + czm_view[1].y;
|
||
float cosValue = cos(camrot);
|
||
float sinValue = sin(camrot);
|
||
mat3 rotation = mat3(
|
||
cosValue, -sinValue, 0.0,
|
||
sinValue, cosValue, 0.0,
|
||
0.0, 0.0, 1.0
|
||
);
|
||
|
||
vec3 st1 = vec3(v_textureCoordinates * 2.0 - vec2(1.0), 1.0);
|
||
vec3 st2 = vec3((rotation * st1).xy, 1.0);
|
||
vec3 st3 = st2 * 0.5 + vec3(0.5);
|
||
vec2 lensStarTexcoord = st3.xy;
|
||
float weightForLensFlare = length(vec3(sunPos.xy, 0.0));
|
||
float oneMinusWeightForLensFlare = max(1.0 - weightForLensFlare, 0.0);
|
||
|
||
if (!isSpace)
|
||
{
|
||
result *= oneMinusWeightForLensFlare * intensity * 0.2;
|
||
}
|
||
else
|
||
{
|
||
result *= oneMinusWeightForLensFlare * intensity;
|
||
result *= texture2D(starTexture, lensStarTexcoord) * pow(weightForLensFlare, 1.0) * max((1.0 - length(vec3(st1.xy, 0.0))), 0.0) * 2.0;
|
||
}
|
||
|
||
result += texture2D(colorTexture, v_textureCoordinates);
|
||
|
||
gl_FragColor = result;
|
||
}
|
||
`,P5e=`uniform sampler2D colorTexture;
|
||
uniform vec3 white;
|
||
|
||
varying vec2 v_textureCoordinates;
|
||
|
||
#ifdef AUTO_EXPOSURE
|
||
uniform sampler2D autoExposure;
|
||
#endif
|
||
|
||
// See equation 4:
|
||
// http://www.cs.utah.edu/~reinhard/cdrom/tonemap.pdf
|
||
|
||
void main()
|
||
{
|
||
vec4 fragmentColor = texture2D(colorTexture, v_textureCoordinates);
|
||
vec3 color = fragmentColor.rgb;
|
||
#ifdef AUTO_EXPOSURE
|
||
float exposure = texture2D(autoExposure, vec2(0.5)).r;
|
||
color /= exposure;
|
||
#endif
|
||
color = (color * (1.0 + color / white)) / (1.0 + color);
|
||
color = czm_inverseGamma(color);
|
||
gl_FragColor = vec4(color, fragmentColor.a);
|
||
}
|
||
`,O5e=`uniform sampler2D colorTexture;
|
||
|
||
varying vec2 v_textureCoordinates;
|
||
|
||
float rand(vec2 co)
|
||
{
|
||
return fract(sin(dot(co.xy ,vec2(12.9898, 78.233))) * 43758.5453);
|
||
}
|
||
|
||
void main(void)
|
||
{
|
||
float noiseValue = rand(v_textureCoordinates + sin(czm_frameNumber)) * 0.1;
|
||
vec3 rgb = texture2D(colorTexture, v_textureCoordinates).rgb;
|
||
vec3 green = vec3(0.0, 1.0, 0.0);
|
||
gl_FragColor = vec4((noiseValue + rgb) * green, 1.0);
|
||
}
|
||
`,L5e=`uniform sampler2D colorTexture;
|
||
|
||
varying vec2 v_textureCoordinates;
|
||
|
||
#ifdef AUTO_EXPOSURE
|
||
uniform sampler2D autoExposure;
|
||
#endif
|
||
|
||
// See equation 3:
|
||
// http://www.cs.utah.edu/~reinhard/cdrom/tonemap.pdf
|
||
|
||
void main()
|
||
{
|
||
vec4 fragmentColor = texture2D(colorTexture, v_textureCoordinates);
|
||
vec3 color = fragmentColor.rgb;
|
||
#ifdef AUTO_EXPOSURE
|
||
float exposure = texture2D(autoExposure, vec2(0.5)).r;
|
||
color /= exposure;
|
||
#endif
|
||
color = color / (1.0 + color);
|
||
color = czm_inverseGamma(color);
|
||
gl_FragColor = vec4(color, fragmentColor.a);
|
||
}
|
||
`,B5e=`uniform sampler2D colorTexture;
|
||
uniform sampler2D silhouetteTexture;
|
||
|
||
varying vec2 v_textureCoordinates;
|
||
|
||
void main(void)
|
||
{
|
||
vec4 silhouetteColor = texture2D(silhouetteTexture, v_textureCoordinates);
|
||
vec4 color = texture2D(colorTexture, v_textureCoordinates);
|
||
gl_FragColor = mix(color, silhouetteColor, silhouetteColor.a);
|
||
}
|
||
`;function zy(){this._uniformMap=void 0,this._command=void 0,this._colorTexture=void 0,this._depthTexture=void 0,this._ready=!1,this._name="czm_autoexposure",this._logDepthChanged=void 0,this._useLogDepth=void 0,this._framebuffers=void 0,this._previousLuminance=new Xn,this._commands=void 0,this._clearCommand=void 0,this._minMaxLuminance=new $,this.enabled=!0,this._enabled=!0,this.minimumLuminance=.1,this.maximumLuminance=10}Object.defineProperties(zy.prototype,{ready:{get:function(){return this._ready}},name:{get:function(){return this._name}},outputTexture:{get:function(){const e=this._framebuffers;if(l(e))return e[e.length-1].getColorTexture(0)}}});function nee(e){const t=e._framebuffers;if(!l(t))return;const n=t.length;for(let i=0;i<n;++i)t[i].destroy();e._framebuffers=void 0,e._previousLuminance.destroy(),e._previousLuminance=void 0}function R5e(e,t){nee(e);let n=e._width,i=e._height;const o=t.halfFloatingPointTexture?ft.HALF_FLOAT:ft.FLOAT,r=Math.ceil(Math.log(Math.max(n,i))/Math.log(3)),s=new Array(r);for(let c=0;c<r;++c)n=Math.max(Math.ceil(n/3),1),i=Math.max(Math.ceil(i/3),1),s[c]=new Xn,s[c].update(t,n,i,1,o);const a=s[r-1].getColorTexture(0);e._previousLuminance.update(t,a.width,a.height,1,o),e._framebuffers=s}function iee(e){const t=e._commands;if(!l(t))return;const n=t.length;for(let i=0;i<n;++i)t[i].shaderProgram.destroy();e._commands=void 0}function N5e(e,t){let n;if(t===0)n={colorTexture:function(){return e._colorTexture},colorTextureDimensions:function(){return e._colorTexture.dimensions}};else{const i=e._framebuffers[t-1].getColorTexture(0);n={colorTexture:function(){return i},colorTextureDimensions:function(){return i.dimensions}}}return n.minMaxLuminance=function(){return e._minMaxLuminance},n.previousLuminance=function(){return e._previousLuminance.getColorTexture(0)},n}function M5e(e,t){let n=`uniform sampler2D colorTexture;
|
||
varying vec2 v_textureCoordinates;
|
||
float sampleTexture(vec2 offset) {
|
||
`;return e===0?n+=` vec4 color = texture2D(colorTexture, v_textureCoordinates + offset);
|
||
return czm_luminance(color.rgb);
|
||
`:n+=` return texture2D(colorTexture, v_textureCoordinates + offset).r;
|
||
`,n+=`}
|
||
|
||
`,n+=`uniform vec2 colorTextureDimensions;
|
||
uniform vec2 minMaxLuminance;
|
||
uniform sampler2D previousLuminance;
|
||
void main() {
|
||
float color = 0.0;
|
||
float xStep = 1.0 / colorTextureDimensions.x;
|
||
float yStep = 1.0 / colorTextureDimensions.y;
|
||
int count = 0;
|
||
for (int i = 0; i < 3; ++i) {
|
||
for (int j = 0; j < 3; ++j) {
|
||
vec2 offset;
|
||
offset.x = -xStep + float(i) * xStep;
|
||
offset.y = -yStep + float(j) * yStep;
|
||
if (offset.x < 0.0 || offset.x > 1.0 || offset.y < 0.0 || offset.y > 1.0) {
|
||
continue;
|
||
}
|
||
color += sampleTexture(offset);
|
||
++count;
|
||
}
|
||
}
|
||
if (count > 0) {
|
||
color /= float(count);
|
||
}
|
||
`,e===t-1&&(n+=` float previous = texture2D(previousLuminance, vec2(0.5)).r;
|
||
color = clamp(color, minMaxLuminance.x, minMaxLuminance.y);
|
||
color = previous + (color - previous) / (60.0 * 1.5);
|
||
color = clamp(color, minMaxLuminance.x, minMaxLuminance.y);
|
||
`),n+=` gl_FragColor = vec4(color);
|
||
}
|
||
`,n}function F5e(e,t){iee(e);const n=e._framebuffers,i=n.length,o=new Array(i);for(let r=0;r<i;++r)o[r]=t.createViewportQuadCommand(M5e(r,i),{framebuffer:n[r].framebuffer,uniformMap:N5e(e,r)});e._commands=o}zy.prototype.clear=function(e){const t=this._framebuffers;if(!l(t))return;let n=this._clearCommand;l(n)||(n=this._clearCommand=new Bo({color:new k(0,0,0,0),framebuffer:void 0}));const i=t.length;for(let o=0;o<i;++o)t[o].clear(e,n)};zy.prototype.update=function(e){const t=e.drawingBufferWidth,n=e.drawingBufferHeight;(t!==this._width||n!==this._height)&&(this._width=t,this._height=n,R5e(this,e),F5e(this,e),this._ready||(this._ready=!0)),this._minMaxLuminance.x=this.minimumLuminance,this._minMaxLuminance.y=this.maximumLuminance;const i=this._framebuffers,o=i[i.length-1];i[i.length-1]=this._previousLuminance,this._commands[this._commands.length-1].framebuffer=this._previousLuminance.framebuffer,this._previousLuminance=o};zy.prototype.execute=function(e,t){this._colorTexture=t;const n=this._commands;if(!l(n))return;const i=n.length;for(let o=0;o<i;++o)n[o].execute(e)};zy.prototype.isDestroyed=function(){return!1};zy.prototype.destroy=function(){return nee(this),iee(this),Je(this)};const z5e={NEAREST:0,LINEAR:1},ay=z5e;function eo(e){e=A(e,A.EMPTY_OBJECT);const t=e.fragmentShader,n=A(e.textureScale,1),i=A(e.pixelFormat,yt.RGBA);if(E.typeOf.string("options.fragmentShader",t),E.typeOf.number.greaterThan("options.textureScale",n,0),E.typeOf.number.lessThanOrEquals("options.textureScale",n,1),!yt.isColorFormat(i))throw new w("options.pixelFormat must be a color format.");this._fragmentShader=t,this._uniforms=e.uniforms,this._textureScale=n,this._forcePowerOfTwo=A(e.forcePowerOfTwo,!1),this._sampleMode=A(e.sampleMode,ay.NEAREST),this._pixelFormat=i,this._pixelDatatype=A(e.pixelDatatype,ft.UNSIGNED_BYTE),this._clearColor=A(e.clearColor,k.BLACK),this._uniformMap=void 0,this._command=void 0,this._colorTexture=void 0,this._depthTexture=void 0,this._idTexture=void 0,this._actualUniforms={},this._dirtyUniforms=[],this._texturesToRelease=[],this._texturesToCreate=[],this._texturePromise=void 0;const o=new vy;o.scissorTest={enabled:!0,rectangle:l(e.scissorRectangle)?at.clone(e.scissorRectangle):new at},this._passState=o,this._ready=!1;let r=e.name;l(r)||(r=ma()),this._name=r,this._logDepthChanged=void 0,this._useLogDepth=void 0,this._selectedIdTexture=void 0,this._selected=void 0,this._selectedShadow=void 0,this._parentSelected=void 0,this._parentSelectedShadow=void 0,this._combinedSelected=void 0,this._combinedSelectedShadow=void 0,this._selectedLength=0,this._parentSelectedLength=0,this._selectedDirty=!0,this._textureCache=void 0,this._index=void 0,this.enabled=!0,this._enabled=!0}Object.defineProperties(eo.prototype,{ready:{get:function(){return this._ready}},name:{get:function(){return this._name}},fragmentShader:{get:function(){return this._fragmentShader}},uniforms:{get:function(){return this._uniforms}},textureScale:{get:function(){return this._textureScale}},forcePowerOfTwo:{get:function(){return this._forcePowerOfTwo}},sampleMode:{get:function(){return this._sampleMode}},pixelFormat:{get:function(){return this._pixelFormat}},pixelDatatype:{get:function(){return this._pixelDatatype}},clearColor:{get:function(){return this._clearColor}},scissorRectangle:{get:function(){return this._passState.scissorTest.rectangle}},outputTexture:{get:function(){if(l(this._textureCache)){const e=this._textureCache.getFramebuffer(this._name);if(l(e))return e.getColorTexture(0)}}},selected:{get:function(){return this._selected},set:function(e){this._selected=e}},parentSelected:{get:function(){return this._parentSelected},set:function(e){this._parentSelected=e}}});const U5e=/uniform\s+sampler2D\s+depthTexture/g;eo.prototype._isSupported=function(e){return!U5e.test(this._fragmentShader)||e.depthTexture};function H5e(e,t,n){const i=t[n];return(typeof i=="string"||i instanceof HTMLCanvasElement||i instanceof HTMLImageElement||i instanceof HTMLVideoElement||i instanceof ImageData)&&e._dirtyUniforms.push(n),{get:function(){return t[n]},set:function(o){const r=t[n];t[n]=o;const s=e._actualUniforms,a=s[n];l(a)&&a!==r&&a instanceof rn&&!l(e._textureCache.getStageByName(n))&&(e._texturesToRelease.push(a),delete s[n],delete s[`${n}Dimensions`]),r instanceof rn&&e._texturesToRelease.push(r),typeof o=="string"||o instanceof HTMLCanvasElement||o instanceof HTMLImageElement||o instanceof HTMLVideoElement||o instanceof ImageData?e._dirtyUniforms.push(n):s[n]=o}}}function V5e(e,t){return function(){const n=e._actualUniforms[t];return typeof n=="function"?n():n}}function k5e(e,t){return function(){const n=e[t]();if(l(n))return n.dimensions}}function G5e(e){if(l(e._uniformMap))return;const t={},n={},i=e._uniforms,o=e._actualUniforms;for(const r in i)if(i.hasOwnProperty(r)){typeof i[r]!="function"?(t[r]=V5e(e,r),n[r]=H5e(e,i,r)):(t[r]=i[r],n[r]=i[r]),o[r]=i[r];const s=t[r]();(typeof s=="string"||s instanceof rn||s instanceof HTMLImageElement||s instanceof HTMLCanvasElement||s instanceof HTMLVideoElement)&&(t[`${r}Dimensions`]=k5e(t,r))}e._uniforms={},Object.defineProperties(e._uniforms,n),e._uniformMap=Ln(t,{colorTexture:function(){return e._colorTexture},colorTextureDimensions:function(){return e._colorTexture.dimensions},depthTexture:function(){return e._depthTexture},depthTextureDimensions:function(){return e._depthTexture.dimensions},czm_idTexture:function(){return e._idTexture},czm_selectedIdTexture:function(){return e._selectedIdTexture},czm_selectedIdTextureStep:function(){return 1/e._selectedIdTexture.width}})}function W5e(e,t){if(l(e._command)&&!e._logDepthChanged&&!e._selectedDirty)return;let n=e._fragmentShader;if(l(e._selectedIdTexture)){const o=e._selectedIdTexture.width;n=n.replace(/varying\s+vec2\s+v_textureCoordinates;/g,""),n=`#define CZM_SELECTED_FEATURE
|
||
uniform sampler2D czm_idTexture;
|
||
uniform sampler2D czm_selectedIdTexture;
|
||
uniform float czm_selectedIdTextureStep;
|
||
varying vec2 v_textureCoordinates;
|
||
bool czm_selected(vec2 offset)
|
||
{
|
||
bool selected = false;
|
||
vec4 id = texture2D(czm_idTexture, v_textureCoordinates + offset);
|
||
for (int i = 0; i < ${o}; ++i)
|
||
{
|
||
vec4 selectedId = texture2D(czm_selectedIdTexture, vec2((float(i) + 0.5) * czm_selectedIdTextureStep, 0.5));
|
||
if (all(equal(id, selectedId)))
|
||
{
|
||
return true;
|
||
}
|
||
}
|
||
return false;
|
||
}
|
||
|
||
bool czm_selected()
|
||
{
|
||
return czm_selected(vec2(0.0));
|
||
}
|
||
|
||
${n}`}const i=new nt({defines:[e._useLogDepth?"LOG_DEPTH":""],sources:[n]});e._command=t.createViewportQuadCommand(i,{uniformMap:e._uniformMap,owner:e})}function q5e(e){const t=e._sampleMode;let n,i;t===ay.LINEAR?(n=Wn.LINEAR,i=Ps.LINEAR):(n=Wn.NEAREST,i=Ps.NEAREST);const o=e._sampler;(!l(o)||o.minificationFilter!==n||o.magnificationFilter!==i)&&(e._sampler=new Ci({wrapS:io.CLAMP_TO_EDGE,wrapT:io.CLAMP_TO_EDGE,minificationFilter:n,magnificationFilter:i}))}function j5e(e,t){return function(n){e._texturesToCreate.push({name:t,source:n})}}function Y5e(e,t){return function(){return e._textureCache.getOutputTexture(t)}}function $5e(e,t){let n,i,o;const r=e._texturesToRelease;let s=r.length;for(n=0;n<s;++n)i=r[n],i=i&&i.destroy();r.length=0;const a=e._texturesToCreate;for(s=a.length,n=0;n<s;++n){const h=a[n];o=h.name;const _=h.source;e._actualUniforms[o]=new rn({context:t,source:_})}a.length=0;const c=e._dirtyUniforms;if(c.length===0&&!l(e._texturePromise)){e._ready=!0;return}if(c.length===0||l(e._texturePromise))return;s=c.length;const u=e._uniforms,f=[];for(n=0;n<s;++n){o=c[n];const h=u[o],_=e._textureCache.getStageByName(h);if(l(_))e._actualUniforms[o]=Y5e(e,h);else if(typeof h=="string"){const g=new je({url:h});f.push(g.fetchImage().then(j5e(e,o)))}else e._texturesToCreate.push({name:o,source:h})}c.length=0,f.length>0?(e._ready=!1,e._texturePromise=Promise.all(f).then(function(){e._ready=!0,e._texturePromise=void 0})):e._ready=!0}function oee(e){l(e._command)&&(e._command.shaderProgram=e._command.shaderProgram&&e._command.shaderProgram.destroy(),e._command=void 0),e._selectedIdTexture=e._selectedIdTexture&&e._selectedIdTexture.destroy();const t=e._textureCache;if(!l(t))return;const n=e._uniforms,i=e._actualUniforms;for(const o in i)i.hasOwnProperty(o)&&i[o]instanceof rn&&(l(t.getStageByName(n[o]))||i[o].destroy(),e._dirtyUniforms.push(o))}function X5e(e){let t=l(e._selected)?e._selected.length:0;const n=l(e._parentSelected)?e._parentSelected:0;let i=e._selected!==e._selectedShadow||t!==e._selectedLength;if(i=i||e._parentSelected!==e._parentSelectedShadow||n!==e._parentSelectedLength,l(e._selected)&&l(e._parentSelected)?e._combinedSelected=e._selected.concat(e._parentSelected):l(e._parentSelected)?e._combinedSelected=e._parentSelected:e._combinedSelected=e._selected,!i&&l(e._combinedSelected)){if(!l(e._combinedSelectedShadow))return!0;t=e._combinedSelected.length;for(let o=0;o<t;++o)if(e._combinedSelected[o]!==e._combinedSelectedShadow[o])return!0}return i}function K5e(e,t){if(!e._selectedDirty)return;e._selectedIdTexture=e._selectedIdTexture&&e._selectedIdTexture.destroy(),e._selectedIdTexture=void 0;const n=e._combinedSelected;if(!l(n))return;let i,o,r=0;const s=n.length;for(i=0;i<s;++i)o=n[i],l(o.pickIds)?r+=o.pickIds.length:l(o.pickId)&&++r;if(s===0||r===0){const f=new Uint8Array(4);f[0]=255,f[1]=255,f[2]=255,f[3]=255,e._selectedIdTexture=new rn({context:t,pixelFormat:yt.RGBA,pixelDatatype:ft.UNSIGNED_BYTE,source:{arrayBufferView:f,width:1,height:1},sampler:Ci.NEAREST});return}let a,c=0;const u=new Uint8Array(r*4);for(i=0;i<s;++i)if(o=n[i],l(o.pickIds)){const f=o.pickIds,h=f.length;for(let _=0;_<h;++_)a=f[_].color,u[c]=k.floatToByte(a.red),u[c+1]=k.floatToByte(a.green),u[c+2]=k.floatToByte(a.blue),u[c+3]=k.floatToByte(a.alpha),c+=4}else l(o.pickId)&&(a=o.pickId.color,u[c]=k.floatToByte(a.red),u[c+1]=k.floatToByte(a.green),u[c+2]=k.floatToByte(a.blue),u[c+3]=k.floatToByte(a.alpha),c+=4);e._selectedIdTexture=new rn({context:t,pixelFormat:yt.RGBA,pixelDatatype:ft.UNSIGNED_BYTE,source:{arrayBufferView:u,width:r,height:1},sampler:Ci.NEAREST})}eo.prototype.update=function(e,t){if(this.enabled!==this._enabled&&!this.enabled&&oee(this),this._enabled=this.enabled,!this._enabled||(this._logDepthChanged=t!==this._useLogDepth,this._useLogDepth=t,this._selectedDirty=X5e(this),this._selectedShadow=this._selected,this._parentSelectedShadow=this._parentSelected,this._combinedSelectedShadow=this._combinedSelected,this._selectedLength=l(this._selected)?this._selected.length:0,this._parentSelectedLength=l(this._parentSelected)?this._parentSelected.length:0,K5e(this,e),G5e(this),$5e(this,e),W5e(this,e),q5e(this),this._selectedDirty=!1,!this._ready))return;const n=this._textureCache.getFramebuffer(this._name);if(this._command.framebuffer=n,!l(n))return;const i=n.getColorTexture(0);let o;(i.width!==e.drawingBufferWidth||i.height!==e.drawingBufferHeight)&&(o=this._renderState,(!l(o)||i.width!==o.viewport.width||i.height!==o.viewport.height)&&(this._renderState=ht.fromCache({viewport:new at(0,0,i.width,i.height)}))),this._command.renderState=o};eo.prototype.execute=function(e,t,n,i){if(!l(this._command)||!l(this._command.framebuffer)||!this._ready||!this._enabled)return;this._colorTexture=t,this._depthTexture=n,this._idTexture=i,Ci.equals(this._colorTexture.sampler,this._sampler)||(this._colorTexture.sampler=this._sampler);const o=this.scissorRectangle.width>0&&this.scissorRectangle.height>0?this._passState:void 0;l(o)&&(o.context=e),this._command.execute(e,o)};eo.prototype.isDestroyed=function(){return!1};eo.prototype.destroy=function(){return oee(this),Je(this)};function ja(e){e=A(e,A.EMPTY_OBJECT),E.defined("options.stages",e.stages),E.typeOf.number.greaterThan("options.stages.length",e.stages.length,0),this._stages=e.stages,this._inputPreviousStageTexture=A(e.inputPreviousStageTexture,!0);let t=e.name;l(t)||(t=ma()),this._name=t,this._uniforms=e.uniforms,this._textureCache=void 0,this._index=void 0,this._selected=void 0,this._selectedShadow=void 0,this._parentSelected=void 0,this._parentSelectedShadow=void 0,this._combinedSelected=void 0,this._combinedSelectedShadow=void 0,this._selectedLength=0,this._parentSelectedLength=0,this._selectedDirty=!0}Object.defineProperties(ja.prototype,{ready:{get:function(){const e=this._stages,t=e.length;for(let n=0;n<t;++n)if(!e[n].ready)return!1;return!0}},name:{get:function(){return this._name}},enabled:{get:function(){return this._stages[0].enabled},set:function(e){const t=this._stages,n=t.length;for(let i=0;i<n;++i)t[i].enabled=e}},uniforms:{get:function(){return this._uniforms}},inputPreviousStageTexture:{get:function(){return this._inputPreviousStageTexture}},length:{get:function(){return this._stages.length}},selected:{get:function(){return this._selected},set:function(e){this._selected=e}},parentSelected:{get:function(){return this._parentSelected},set:function(e){this._parentSelected=e}}});ja.prototype._isSupported=function(e){const t=this._stages,n=t.length;for(let i=0;i<n;++i)if(!t[i]._isSupported(e))return!1;return!0};ja.prototype.get=function(e){return E.typeOf.number.greaterThanOrEquals("index",e,0),E.typeOf.number.lessThan("index",e,this.length),this._stages[e]};function J5e(e){let t=l(e._selected)?e._selected.length:0;const n=l(e._parentSelected)?e._parentSelected:0;let i=e._selected!==e._selectedShadow||t!==e._selectedLength;if(i=i||e._parentSelected!==e._parentSelectedShadow||n!==e._parentSelectedLength,l(e._selected)&&l(e._parentSelected)?e._combinedSelected=e._selected.concat(e._parentSelected):l(e._parentSelected)?e._combinedSelected=e._parentSelected:e._combinedSelected=e._selected,!i&&l(e._combinedSelected)){if(!l(e._combinedSelectedShadow))return!0;t=e._combinedSelected.length;for(let o=0;o<t;++o)if(e._combinedSelected[o]!==e._combinedSelectedShadow[o])return!0}return i}ja.prototype.update=function(e,t){this._selectedDirty=J5e(this),this._selectedShadow=this._selected,this._parentSelectedShadow=this._parentSelected,this._combinedSelectedShadow=this._combinedSelected,this._selectedLength=l(this._selected)?this._selected.length:0,this._parentSelectedLength=l(this._parentSelected)?this._parentSelected.length:0;const n=this._stages,i=n.length;for(let o=0;o<i;++o){const r=n[o];this._selectedDirty&&(r.parentSelected=this._combinedSelected),r.update(e,t)}};ja.prototype.isDestroyed=function(){return!1};ja.prototype.destroy=function(){const e=this._stages,t=e.length;for(let n=0;n<t;++n)e[n].destroy();return Je(this)};const Lr={};function mP(e){const o=`#define USE_STEP_SIZE
|
||
${vF}`,r=new eo({name:`${e}_x_direction`,fragmentShader:o,uniforms:{delta:1,sigma:2,stepSize:1,direction:0},sampleMode:ay.LINEAR}),s=new eo({name:`${e}_y_direction`,fragmentShader:o,uniforms:{delta:1,sigma:2,stepSize:1,direction:1},sampleMode:ay.LINEAR}),a={};return Object.defineProperties(a,{delta:{get:function(){return r.uniforms.delta},set:function(c){const u=r.uniforms,f=s.uniforms;u.delta=f.delta=c}},sigma:{get:function(){return r.uniforms.sigma},set:function(c){const u=r.uniforms,f=s.uniforms;u.sigma=f.sigma=c}},stepSize:{get:function(){return r.uniforms.stepSize},set:function(c){const u=r.uniforms,f=s.uniforms;u.stepSize=f.stepSize=c}}}),new ja({name:e,stages:[r,s],uniforms:a})}Lr.createBlurStage=function(){return mP("czm_blur")};Lr.createDepthOfFieldStage=function(){const e=mP("czm_depth_of_field_blur"),t=new eo({name:"czm_depth_of_field_composite",fragmentShader:x5e,uniforms:{focalDistance:5,blurTexture:e.name}}),n={};return Object.defineProperties(n,{focalDistance:{get:function(){return t.uniforms.focalDistance},set:function(i){t.uniforms.focalDistance=i}},delta:{get:function(){return e.uniforms.delta},set:function(i){e.uniforms.delta=i}},sigma:{get:function(){return e.uniforms.sigma},set:function(i){e.uniforms.sigma=i}},stepSize:{get:function(){return e.uniforms.stepSize},set:function(i){e.uniforms.stepSize=i}}}),new ja({name:"czm_depth_of_field",stages:[e,t],inputPreviousStageTexture:!1,uniforms:n})};Lr.isDepthOfFieldSupported=function(e){return e.context.depthTexture};Lr.createEdgeDetectionStage=function(){const e=ma();return new eo({name:`czm_edge_detection_${e}`,fragmentShader:S5e,uniforms:{length:.25,color:k.clone(k.BLACK)}})};Lr.isEdgeDetectionSupported=function(e){return e.context.depthTexture};function Q5e(e){if(!l(e))return Lr.createEdgeDetectionStage();const t=new ja({name:"czm_edge_detection_multiple",stages:e,inputPreviousStageTexture:!1}),n={};let i="",o="";for(let a=0;a<e.length;++a)i+=`uniform sampler2D edgeTexture${a};
|
||
`,o+=` vec4 edge${a} = texture2D(edgeTexture${a}, v_textureCoordinates);
|
||
if (edge${a}.a > 0.0)
|
||
{
|
||
color = edge${a};
|
||
break;
|
||
}
|
||
`,n[`edgeTexture${a}`]=e[a].name;const r=`${i}varying vec2 v_textureCoordinates;
|
||
void main() {
|
||
vec4 color = vec4(0.0);
|
||
for (int i = 0; i < ${e.length}; i++)
|
||
{
|
||
${o} }
|
||
gl_FragColor = color;
|
||
}
|
||
`,s=new eo({name:"czm_edge_detection_combine",fragmentShader:r,uniforms:n});return new ja({name:"czm_edge_detection_composite",stages:[t,s]})}Lr.createSilhouetteStage=function(e){const t=Q5e(e),n=new eo({name:"czm_silhouette_color_edges",fragmentShader:B5e,uniforms:{silhouetteTexture:t.name}});return new ja({name:"czm_silhouette",stages:[t,n],inputPreviousStageTexture:!1,uniforms:t.uniforms})};Lr.isSilhouetteSupported=function(e){return e.context.depthTexture};Lr.createBloomStage=function(){const e=new eo({name:"czm_bloom_contrast_bias",fragmentShader:E5e,uniforms:{contrast:128,brightness:-.3}}),t=mP("czm_bloom_blur"),n=new ja({name:"czm_bloom_contrast_bias_blur",stages:[e,t]}),i=new eo({name:"czm_bloom_generate_composite",fragmentShader:C5e,uniforms:{glowOnly:!1,bloomTexture:n.name}}),o={};return Object.defineProperties(o,{glowOnly:{get:function(){return i.uniforms.glowOnly},set:function(r){i.uniforms.glowOnly=r}},contrast:{get:function(){return e.uniforms.contrast},set:function(r){e.uniforms.contrast=r}},brightness:{get:function(){return e.uniforms.brightness},set:function(r){e.uniforms.brightness=r}},delta:{get:function(){return t.uniforms.delta},set:function(r){t.uniforms.delta=r}},sigma:{get:function(){return t.uniforms.sigma},set:function(r){t.uniforms.sigma=r}},stepSize:{get:function(){return t.uniforms.stepSize},set:function(r){t.uniforms.stepSize=r}}}),new ja({name:"czm_bloom",stages:[n,i],inputPreviousStageTexture:!1,uniforms:o})};Lr.createAmbientOcclusionStage=function(){const e=new eo({name:"czm_ambient_occlusion_generate",fragmentShader:y5e,uniforms:{intensity:3,bias:.1,lengthCap:.26,stepSize:1.95,frustumLength:1e3,randomTexture:void 0}}),t=mP("czm_ambient_occlusion_blur");t.uniforms.stepSize=.86;const n=new ja({name:"czm_ambient_occlusion_generate_blur",stages:[e,t]}),i=new eo({name:"czm_ambient_occlusion_composite",fragmentShader:A5e,uniforms:{ambientOcclusionOnly:!1,ambientOcclusionTexture:n.name}}),o={};return Object.defineProperties(o,{intensity:{get:function(){return e.uniforms.intensity},set:function(r){e.uniforms.intensity=r}},bias:{get:function(){return e.uniforms.bias},set:function(r){e.uniforms.bias=r}},lengthCap:{get:function(){return e.uniforms.lengthCap},set:function(r){e.uniforms.lengthCap=r}},stepSize:{get:function(){return e.uniforms.stepSize},set:function(r){e.uniforms.stepSize=r}},frustumLength:{get:function(){return e.uniforms.frustumLength},set:function(r){e.uniforms.frustumLength=r}},randomTexture:{get:function(){return e.uniforms.randomTexture},set:function(r){e.uniforms.randomTexture=r}},delta:{get:function(){return t.uniforms.delta},set:function(r){t.uniforms.delta=r}},sigma:{get:function(){return t.uniforms.sigma},set:function(r){t.uniforms.sigma=r}},blurStepSize:{get:function(){return t.uniforms.stepSize},set:function(r){t.uniforms.stepSize=r}},ambientOcclusionOnly:{get:function(){return i.uniforms.ambientOcclusionOnly},set:function(r){i.uniforms.ambientOcclusionOnly=r}}}),new ja({name:"czm_ambient_occlusion",stages:[n,i],inputPreviousStageTexture:!1,uniforms:o})};Lr.isAmbientOcclusionSupported=function(e){return e.context.depthTexture};const Z5e=`#define FXAA_QUALITY_PRESET 39
|
||
${OOe}
|
||
${D5e}`;Lr.createFXAAStage=function(){return new eo({name:"czm_FXAA",fragmentShader:Z5e,sampleMode:ay.LINEAR})};Lr.createAcesTonemappingStage=function(e){let t=e?`#define AUTO_EXPOSURE
|
||
`:"";return t+=g5e,new eo({name:"czm_aces",fragmentShader:t,uniforms:{autoExposure:void 0}})};Lr.createFilmicTonemappingStage=function(e){let t=e?`#define AUTO_EXPOSURE
|
||
`:"";return t+=v5e,new eo({name:"czm_filmic",fragmentShader:t,uniforms:{autoExposure:void 0}})};Lr.createReinhardTonemappingStage=function(e){let t=e?`#define AUTO_EXPOSURE
|
||
`:"";return t+=L5e,new eo({name:"czm_reinhard",fragmentShader:t,uniforms:{autoExposure:void 0}})};Lr.createModifiedReinhardTonemappingStage=function(e){let t=e?`#define AUTO_EXPOSURE
|
||
`:"";return t+=P5e,new eo({name:"czm_modified_reinhard",fragmentShader:t,uniforms:{white:k.WHITE,autoExposure:void 0}})};Lr.createAutoExposureStage=function(){return new zy};Lr.createBlackAndWhiteStage=function(){return new eo({name:"czm_black_and_white",fragmentShader:T5e,uniforms:{gradations:5}})};Lr.createBrightnessStage=function(){return new eo({name:"czm_brightness",fragmentShader:b5e,uniforms:{brightness:.5}})};Lr.createNightVisionStage=function(){return new eo({name:"czm_night_vision",fragmentShader:O5e})};Lr.createDepthViewStage=function(){return new eo({name:"czm_depth_view",fragmentShader:w5e})};Lr.createLensFlareStage=function(){return new eo({name:"czm_lens_flare",fragmentShader:I5e,uniforms:{dirtTexture:Un("Assets/Textures/LensFlare/DirtMask.jpg"),starTexture:Un("Assets/Textures/LensFlare/StarBurst.jpg"),intensity:2,distortion:10,ghostDispersal:.4,haloWidth:.4,dirtAmount:.4,earthRadius:be.WGS84.maximumRadius}})};const Sm=Lr;function zd(e){this._collection=e,this._framebuffers=[],this._stageNameToFramebuffer={},this._width=void 0,this._height=void 0,this._updateDependencies=!1}function Xb(e){for(;l(e.length);)e=e.get(e.length-1);return e.name}function DF(e,t,n,i,o){if(!i.enabled||!i._isSupported(t))return o;const r=n[i.name]={};if(l(o)){const a=e.getStageByName(o);r[Xb(a)]=!0}const s=i.uniforms;if(l(s)){const a=Object.getOwnPropertyNames(s),c=a.length;for(let u=0;u<c;++u){const f=s[a[u]];if(typeof f=="string"){const h=e.getStageByName(f);l(h)&&(r[Xb(h)]=!0)}}}return i.name}function Ab(e,t,n,i,o){if(l(i.enabled)&&!i.enabled||l(i._isSupported)&&!i._isSupported(t))return o;const r=o,s=!l(i.inputPreviousStageTexture)||i.inputPreviousStageTexture;let a=o;const c=i.length;for(let h=0;h<c;++h){const _=i.get(h);l(_.length)?a=Ab(e,t,n,_,o):a=DF(e,t,n,_,o),s&&(o=a)}let u,f;if(s)for(u=1;u<c;++u)f=Xb(i.get(u)),l(n[f])||(n[f]={}),n[f][r]=!0;else for(u=1;u<c;++u){f=Xb(i.get(u));const h=n[f];for(let _=0;_<u;++_)h[Xb(i.get(_))]=!0}return a}function e8e(e,t){const n={};if(l(e.ambientOcclusion)){const i=e.ambientOcclusion,o=e.bloom,r=e._tonemapping,s=e.fxaa;let a=Ab(e,t,n,i,void 0);a=Ab(e,t,n,o,a),a=DF(e,t,n,r,a),a=Ab(e,t,n,e,a),DF(e,t,n,s,a)}else Ab(e,t,n,e,void 0);return n}function t8e(e,t,n){const o=e._collection.getStageByName(t),r=o._textureScale,s=o._forcePowerOfTwo,a=o._pixelFormat,c=o._pixelDatatype,u=o._clearColor;let f,h;const _=e._framebuffers,g=_.length;for(f=0;f<g;++f){if(h=_[f],r!==h.textureScale||s!==h.forcePowerOfTwo||a!==h.pixelFormat||c!==h.pixelDatatype||!k.equals(u,h.clearColor))continue;const p=h.stages,y=p.length;let T=!1;for(let b=0;b<y;++b)if(n[p[b]]){T=!0;break}if(!T)break}return l(h)&&f<g?(h.stages.push(t),h):(h={textureScale:r,forcePowerOfTwo:s,pixelFormat:a,pixelDatatype:c,clearColor:u,stages:[t],buffer:new Xn({pixelFormat:a,pixelDatatype:c}),clear:void 0},_.push(h),h)}function n8e(e,t){const n=e8e(e._collection,t);for(const i in n)n.hasOwnProperty(i)&&(e._stageNameToFramebuffer[i]=t8e(e,i,n[i]))}function IF(e){const t=e._framebuffers,n=t.length;for(let i=0;i<n;++i)t[i].buffer.destroy()}function i8e(e,t){const n=e._width,i=e._height,o=e._framebuffers,r=o.length;for(let s=0;s<r;++s){const a=o[s],c=a.textureScale;let u=Math.ceil(n*c),f=Math.ceil(i*c),h=Math.min(u,f);a.forcePowerOfTwo&&(F.isPowerOfTwo(h)||(h=F.nextPowerOfTwo(h)),u=h,f=h),a.buffer.update(t,u,f),a.clear=new Bo({color:a.clearColor,framebuffer:a.buffer.framebuffer})}}zd.prototype.updateDependencies=function(){this._updateDependencies=!0};zd.prototype.update=function(e){const t=this._collection,n=this._updateDependencies,i=l(t.ambientOcclusion)&&t.ambientOcclusion.enabled&&t.ambientOcclusion._isSupported(e),o=l(t.bloom)&&t.bloom.enabled&&t.bloom._isSupported(e),r=l(t._tonemapping)&&t._tonemapping.enabled&&t._tonemapping._isSupported(e),s=l(t.fxaa)&&t.fxaa.enabled&&t.fxaa._isSupported(e),a=!l(t._activeStages)||t._activeStages.length>0||i||o||r||s;if((n||!a&&this._framebuffers.length>0)&&(IF(this),this._framebuffers.length=0,this._stageNameToFramebuffer={},this._width=void 0,this._height=void 0),!n&&!a)return;this._framebuffers.length===0&&n8e(this,e);const c=e.drawingBufferWidth,u=e.drawingBufferHeight,f=this._width!==c||this._height!==u;!n&&!f||(this._width=c,this._height=u,this._updateDependencies=!1,IF(this),i8e(this,e))};zd.prototype.clear=function(e){const t=this._framebuffers;for(let n=0;n<t.length;++n)t[n].clear.execute(e)};zd.prototype.getStageByName=function(e){return this._collection.getStageByName(e)};zd.prototype.getOutputTexture=function(e){return this._collection.getOutputTexture(e)};zd.prototype.getFramebuffer=function(e){const t=this._stageNameToFramebuffer[e];if(l(t))return t.buffer.framebuffer};zd.prototype.isDestroyed=function(){return!1};zd.prototype.destroy=function(){return IF(this),Je(this)};const Tb={REINHARD:0,MODIFIED_REINHARD:1,FILMIC:2,ACES:3,validate:function(e){return e===Tb.REINHARD||e===Tb.MODIFIED_REINHARD||e===Tb.FILMIC||e===Tb.ACES}},Cb=Object.freeze(Tb),Gz=[];function Cc(){const e=Sm.createFXAAStage(),t=Sm.createAmbientOcclusionStage(),n=Sm.createBloomStage();this._autoExposureEnabled=!1,this._autoExposure=Sm.createAutoExposureStage(),this._tonemapping=void 0,this._tonemapper=void 0,this.tonemapper=Cb.ACES;const i=this._tonemapping;e.enabled=!1,t.enabled=!1,n.enabled=!1,i.enabled=!1;const o=new zd(this),r={},s=Gz;for(s.push(e,t,n,i);s.length>0;){const c=s.pop();r[c.name]=c,c._textureCache=o;const u=c.length;if(l(u))for(let f=0;f<u;++f)s.push(c.get(f))}this._stages=[],this._activeStages=[],this._previousActiveStages=[],this._randomTexture=void 0;const a=this;t.uniforms.randomTexture=function(){return a._randomTexture},this._ao=t,this._bloom=n,this._fxaa=e,this._aoEnabled=void 0,this._bloomEnabled=void 0,this._tonemappingEnabled=void 0,this._fxaaEnabled=void 0,this._activeStagesChanged=!1,this._stagesRemoved=!1,this._textureCacheDirty=!1,this._stageNames=r,this._textureCache=o}Object.defineProperties(Cc.prototype,{ready:{get:function(){let e=!1;const t=this._stages,n=t.length;for(let a=n-1;a>=0;--a){const c=t[a];e=e||c.ready&&c.enabled}const i=this._fxaa,o=this._ao,r=this._bloom,s=this._tonemapping;return e=e||i.ready&&i.enabled,e=e||o.ready&&o.enabled,e=e||r.ready&&r.enabled,e=e||s.ready&&s.enabled,e}},fxaa:{get:function(){return this._fxaa}},ambientOcclusion:{get:function(){return this._ao}},bloom:{get:function(){return this._bloom}},length:{get:function(){return Wz(this),this._stages.length}},outputTexture:{get:function(){const e=this._fxaa;if(e.enabled&&e.ready)return this.getOutputTexture(e.name);const t=this._stages,n=t.length;for(let s=n-1;s>=0;--s){const a=t[s];if(l(a)&&a.ready&&a.enabled)return this.getOutputTexture(a.name)}const i=this._tonemapping;if(i.enabled&&i.ready)return this.getOutputTexture(i.name);const o=this._bloom;if(o.enabled&&o.ready)return this.getOutputTexture(o.name);const r=this._ao;if(r.enabled&&r.ready)return this.getOutputTexture(r.name)}},hasSelected:{get:function(){const e=this._stages.slice();for(;e.length>0;){const t=e.pop();if(!l(t))continue;if(l(t.selected))return!0;const n=t.length;if(l(n))for(let i=0;i<n;++i)e.push(t.get(i))}return!1}},tonemapper:{get:function(){return this._tonemapper},set:function(e){if(this._tonemapper===e)return;if(!Cb.validate(e))throw new w("tonemapper was set to an invalid value.");l(this._tonemapping)&&(delete this._stageNames[this._tonemapping.name],this._tonemapping.destroy());const t=this._autoExposureEnabled;let n;switch(e){case Cb.REINHARD:n=Sm.createReinhardTonemappingStage(t);break;case Cb.MODIFIED_REINHARD:n=Sm.createModifiedReinhardTonemappingStage(t);break;case Cb.FILMIC:n=Sm.createFilmicTonemappingStage(t);break;default:n=Sm.createAcesTonemappingStage(t);break}if(t){const i=this._autoExposure;n.uniforms.autoExposure=function(){return i.outputTexture}}this._tonemapper=e,this._tonemapping=n,l(this._stageNames)&&(this._stageNames[n.name]=n,n._textureCache=this._textureCache),this._textureCacheDirty=!0}}});function Wz(e){if(!e._stagesRemoved)return;e._stagesRemoved=!1;const t=[],n=e._stages,i=n.length;for(let o=0,r=0;o<i;++o){const s=n[o];s&&(s._index=r++,t.push(s))}e._stages=t}Cc.prototype.add=function(e){E.typeOf.object("stage",e);const t=this._stageNames,n=Gz;for(n.push(e);n.length>0;){const o=n.pop();if(l(t[o.name]))throw new w(`${o.name} has already been added to the collection or does not have a unique name.`);t[o.name]=o,o._textureCache=this._textureCache;const r=o.length;if(l(r))for(let s=0;s<r;++s)n.push(o.get(s))}const i=this._stages;return e._index=i.length,i.push(e),this._textureCacheDirty=!0,e};Cc.prototype.remove=function(e){if(!this.contains(e))return!1;const t=this._stageNames,n=Gz;for(n.push(e);n.length>0;){const i=n.pop();delete t[i.name];const o=i.length;if(l(o))for(let r=0;r<o;++r)n.push(i.get(r))}return this._stages[e._index]=void 0,this._stagesRemoved=!0,this._textureCacheDirty=!0,e._index=void 0,e._textureCache=void 0,e.destroy(),!0};Cc.prototype.contains=function(e){return l(e)&&l(e._index)&&e._textureCache===this._textureCache};Cc.prototype.get=function(e){Wz(this);const t=this._stages,n=t.length;return E.typeOf.number.greaterThanOrEquals("stages length",n,0),E.typeOf.number.greaterThanOrEquals("index",e,0),E.typeOf.number.lessThan("index",e,n),t[e]};Cc.prototype.removeAll=function(){const e=this._stages,t=e.length;for(let n=0;n<t;++n)this.remove(e[n]);e.length=0};Cc.prototype.getStageByName=function(e){return this._stageNames[e]};Cc.prototype.update=function(e,t,n){Wz(this);const i=this._activeStages,o=this._activeStages=this._previousActiveStages;this._previousActiveStages=i;const r=this._stages;let s=o.length=r.length,a,c,u=0;for(a=0;a<s;++a)c=r[a],c.ready&&c.enabled&&c._isSupported(e)&&(o[u++]=c);o.length=u;let f=u!==i.length;if(!f){for(a=0;a<u;++a)if(o[a]!==i[a]){f=!0;break}}const h=this._ao,_=this._bloom,g=this._autoExposure,p=this._tonemapping,y=this._fxaa;p.enabled=n;const T=h.enabled&&h._isSupported(e),b=_.enabled&&_._isSupported(e),x=p.enabled&&p._isSupported(e),v=y.enabled&&y._isSupported(e);if((f||this._textureCacheDirty||T!==this._aoEnabled||b!==this._bloomEnabled||x!==this._tonemappingEnabled||v!==this._fxaaEnabled)&&(this._textureCache.updateDependencies(),this._aoEnabled=T,this._bloomEnabled=b,this._tonemappingEnabled=x,this._fxaaEnabled=v,this._textureCacheDirty=!1),l(this._randomTexture)&&!T&&(this._randomTexture.destroy(),this._randomTexture=void 0),!l(this._randomTexture)&&T){s=256*256*3;const D=new Uint8Array(s);for(a=0;a<s;a+=3)D[a]=Math.floor(Math.random()*255);this._randomTexture=new rn({context:e,pixelFormat:yt.RGB,pixelDatatype:ft.UNSIGNED_BYTE,source:{arrayBufferView:D,width:256,height:256},sampler:new Ci({wrapS:io.REPEAT,wrapT:io.REPEAT,minificationFilter:Wn.NEAREST,magnificationFilter:Ps.NEAREST})})}for(this._textureCache.update(e),y.update(e,t),h.update(e,t),_.update(e,t),p.update(e,t),this._autoExposureEnabled&&g.update(e,t),s=r.length,a=0;a<s;++a)r[a].update(e,t);for(u=0,a=0;a<s;++a)c=r[a],c.ready&&c.enabled&&c._isSupported(e)&&u++;f=u!==o.length,f&&this.update(e,t,n)};Cc.prototype.clear=function(e){this._textureCache.clear(e),this._autoExposureEnabled&&this._autoExposure.clear(e)};function Dg(e){for(;l(e.length);)e=e.get(e.length-1);return e.outputTexture}Cc.prototype.getOutputTexture=function(e){const t=this.getStageByName(e);if(l(t))return Dg(t)};function Zf(e,t,n,i,o){if(l(e.execute)){e.execute(t,n,i,o);return}const r=e.length;let s;if(e.inputPreviousStageTexture)for(Zf(e.get(0),t,n,i,o),s=1;s<r;++s)Zf(e.get(s),t,Dg(e.get(s-1)),i,o);else for(s=0;s<r;++s)Zf(e.get(s),t,n,i,o)}Cc.prototype.execute=function(e,t,n,i){const o=this._activeStages,r=o.length,s=this._fxaa,a=this._ao,c=this._bloom,u=this._autoExposure,f=this._tonemapping,h=a.enabled&&a._isSupported(e),_=c.enabled&&c._isSupported(e),g=this._autoExposureEnabled,p=f.enabled&&f._isSupported(e),y=s.enabled&&s._isSupported(e);if(!y&&!h&&!_&&!p&&r===0)return;let T=t;h&&a.ready&&(Zf(a,e,T,n,i),T=Dg(a)),_&&c.ready&&(Zf(c,e,T,n,i),T=Dg(c)),g&&u.ready&&Zf(u,e,T,n,i),p&&f.ready&&(Zf(f,e,T,n,i),T=Dg(f));let b=T;if(r>0){Zf(o[0],e,T,n,i);for(let x=1;x<r;++x)Zf(o[x],e,Dg(o[x-1]),n,i);b=Dg(o[r-1])}y&&s.ready&&Zf(s,e,b,n,i)};Cc.prototype.copy=function(e,t){if(!l(this._copyColorCommand)){const n=this;this._copyColorCommand=e.createViewportQuadCommand(sy,{uniformMap:{colorTexture:function(){return n.outputTexture}},owner:this})}this._copyColorCommand.framebuffer=t,this._copyColorCommand.execute(e)};Cc.prototype.isDestroyed=function(){return!1};Cc.prototype.destroy=function(){return this._fxaa.destroy(),this._ao.destroy(),this._bloom.destroy(),this._autoExposure.destroy(),this._tonemapping.destroy(),this.removeAll(),this._textureCache=this._textureCache&&this._textureCache.destroy(),Je(this)};const o8e={SHIFT:0,CTRL:1,ALT:2},uu=Object.freeze(o8e),r8e={LEFT_DOWN:0,LEFT_UP:1,LEFT_CLICK:2,LEFT_DOUBLE_CLICK:3,RIGHT_DOWN:5,RIGHT_UP:6,RIGHT_CLICK:7,MIDDLE_DOWN:10,MIDDLE_UP:11,MIDDLE_CLICK:12,MOUSE_MOVE:15,WHEEL:16,PINCH_START:17,PINCH_END:18,PINCH_MOVE:19},ai=Object.freeze(r8e);function T_(e,t,n){const i=e._element;if(i===document)return n.x=t.clientX,n.y=t.clientY,n;const o=i.getBoundingClientRect();return n.x=t.clientX-o.left,n.y=t.clientY-o.top,n}function qz(e,t){let n=e;return l(t)&&(n+=`+${t}`),n}function Uy(e){if(e.shiftKey)return uu.SHIFT;if(e.ctrlKey)return uu.CTRL;if(e.altKey)return uu.ALT}const cs={LEFT:0,MIDDLE:1,RIGHT:2};function $c(e,t,n,i){function o(r){i(e,r)}Mn.isInternetExplorer()?n.addEventListener(t,o,!1):n.addEventListener(t,o,{capture:!1,passive:!1}),e._removalFunctions.push(function(){n.removeEventListener(t,o,!1)})}function s8e(e){const t=e._element,n=l(t.disableRootEvents)?t:document;Mn.supportsPointerEvents()?($c(e,"pointerdown",t,d8e),$c(e,"pointerup",t,BW),$c(e,"pointermove",t,h8e),$c(e,"pointercancel",t,BW)):($c(e,"mousedown",t,ree),$c(e,"mouseup",n,see),$c(e,"mousemove",n,aee),$c(e,"touchstart",t,u8e),$c(e,"touchend",n,DW),$c(e,"touchmove",n,f8e),$c(e,"touchcancel",n,DW)),$c(e,"dblclick",t,c8e);let i;"onwheel"in t?i="wheel":document.onmousewheel!==void 0?i="mousewheel":i="DOMMouseScroll",$c(e,i,t,l8e)}function a8e(e){const t=e._removalFunctions;for(let n=0;n<t.length;++n)t[n]()}const xW={position:new $};function jz(e){e._lastSeenTouchEvent=Gr()}function Yz(e){return Gr()-e._lastSeenTouchEvent>xl.mouseEmulationIgnoreMilliseconds}function PF(e,t,n){const i=e.x-t.x,o=e.y-t.y;return Math.sqrt(i*i+o*o)<n}function ree(e,t){if(!Yz(e))return;const n=t.button;e._buttonDown[n]=!0;let i;if(n===cs.LEFT)i=ai.LEFT_DOWN;else if(n===cs.MIDDLE)i=ai.MIDDLE_DOWN;else if(n===cs.RIGHT)i=ai.RIGHT_DOWN;else return;const o=T_(e,t,e._primaryPosition);$.clone(o,e._primaryStartPosition),$.clone(o,e._primaryPreviousPosition);const r=Uy(t),s=e.getInputAction(i,r);l(s)&&($.clone(o,xW.position),s(xW),t.preventDefault())}const wW={position:new $},SW={position:new $};function eR(e,t,n,i){const o=Uy(i),r=e.getInputAction(t,o),s=e.getInputAction(n,o);if(l(r)||l(s)){const a=T_(e,i,e._primaryPosition);if(l(r)&&($.clone(a,wW.position),r(wW)),l(s)){const c=e._primaryStartPosition;PF(c,a,e._clickPixelTolerance)&&($.clone(a,SW.position),s(SW))}}}function see(e,t){if(!Yz(e))return;const n=t.button;n!==cs.LEFT&&n!==cs.MIDDLE&&n!==cs.RIGHT||(e._buttonDown[cs.LEFT]&&(eR(e,ai.LEFT_UP,ai.LEFT_CLICK,t),e._buttonDown[cs.LEFT]=!1),e._buttonDown[cs.MIDDLE]&&(eR(e,ai.MIDDLE_UP,ai.MIDDLE_CLICK,t),e._buttonDown[cs.MIDDLE]=!1),e._buttonDown[cs.RIGHT]&&(eR(e,ai.RIGHT_UP,ai.RIGHT_CLICK,t),e._buttonDown[cs.RIGHT]=!1))}const tR={startPosition:new $,endPosition:new $};function aee(e,t){if(!Yz(e))return;const n=Uy(t),i=T_(e,t,e._primaryPosition),o=e._primaryPreviousPosition,r=e.getInputAction(ai.MOUSE_MOVE,n);l(r)&&($.clone(o,tR.startPosition),$.clone(i,tR.endPosition),r(tR)),$.clone(i,o),(e._buttonDown[cs.LEFT]||e._buttonDown[cs.MIDDLE]||e._buttonDown[cs.RIGHT])&&t.preventDefault()}const vW={position:new $};function c8e(e,t){const n=t.button;let i;if(n===cs.LEFT)i=ai.LEFT_DOUBLE_CLICK;else return;const o=Uy(t),r=e.getInputAction(i,o);l(r)&&(T_(e,t,vW.position),r(vW))}function l8e(e,t){let n;if(l(t.deltaY)){const r=t.deltaMode;r===t.DOM_DELTA_PIXEL?n=-t.deltaY:r===t.DOM_DELTA_LINE?n=-t.deltaY*40:n=-t.deltaY*120}else t.detail>0?n=t.detail*-120:n=t.wheelDelta;if(!l(n))return;const i=Uy(t),o=e.getInputAction(ai.WHEEL,i);l(o)&&(o(n),t.preventDefault())}function u8e(e,t){jz(e);const n=t.changedTouches;let i;const o=n.length;let r,s;const a=e._positions;for(i=0;i<o;++i)r=n[i],s=r.identifier,a.set(s,T_(e,r,new $));_P(e,t);const c=e._previousPositions;for(i=0;i<o;++i)r=n[i],s=r.identifier,c.set(s,$.clone(a.get(s)))}function DW(e,t){jz(e);const n=t.changedTouches;let i;const o=n.length;let r,s;const a=e._positions;for(i=0;i<o;++i)r=n[i],s=r.identifier,a.remove(s);_P(e,t);const c=e._previousPositions;for(i=0;i<o;++i)r=n[i],s=r.identifier,c.remove(s)}const IW={position:new $},nR={position1:new $,position2:new $},PW={position:new $},OW={position:new $},LW={position:new $};function _P(e,t){const n=Uy(t),i=e._positions,o=i.length;let r,s;const a=e._isPinching;if(o!==1&&e._buttonDown[cs.LEFT]){if(e._buttonDown[cs.LEFT]=!1,l(e._touchHoldTimer)&&(clearTimeout(e._touchHoldTimer),e._touchHoldTimer=void 0),r=e.getInputAction(ai.LEFT_UP,n),l(r)&&($.clone(e._primaryPosition,PW.position),r(PW)),o===0&&!e._isTouchHolding&&(s=e.getInputAction(ai.LEFT_CLICK,n),l(s))){const c=e._primaryStartPosition,u=e._previousPositions.values[0];PF(c,u,e._clickPixelTolerance)&&($.clone(e._primaryPosition,OW.position),s(OW))}e._isTouchHolding=!1}if(o===0&&a&&(e._isPinching=!1,r=e.getInputAction(ai.PINCH_END,n),l(r)&&r()),o===1&&!a){const c=i.values[0];$.clone(c,e._primaryPosition),$.clone(c,e._primaryStartPosition),$.clone(c,e._primaryPreviousPosition),e._buttonDown[cs.LEFT]=!0,r=e.getInputAction(ai.LEFT_DOWN,n),l(r)&&($.clone(c,IW.position),r(IW)),e._touchHoldTimer=setTimeout(function(){if(!e.isDestroyed()&&(e._touchHoldTimer=void 0,e._isTouchHolding=!0,s=e.getInputAction(ai.RIGHT_CLICK,n),l(s))){const u=e._primaryStartPosition,f=e._previousPositions.values[0];PF(u,f,e._holdPixelTolerance)&&($.clone(e._primaryPosition,LW.position),s(LW))}},xl.touchHoldDelayMilliseconds),t.preventDefault()}o===2&&!a&&(e._isPinching=!0,r=e.getInputAction(ai.PINCH_START,n),l(r)&&($.clone(i.values[0],nR.position1),$.clone(i.values[1],nR.position2),r(nR),t.preventDefault()))}function f8e(e,t){jz(e);const n=t.changedTouches;let i;const o=n.length;let r,s;const a=e._positions;for(i=0;i<o;++i){r=n[i],s=r.identifier;const u=a.get(s);l(u)&&T_(e,r,u)}cee(e,t);const c=e._previousPositions;for(i=0;i<o;++i)r=n[i],s=r.identifier,$.clone(a.get(s),c.get(s))}const iR={startPosition:new $,endPosition:new $},MC={distance:{startPosition:new $,endPosition:new $},angleAndHeight:{startPosition:new $,endPosition:new $}};function cee(e,t){const n=Uy(t),i=e._positions,o=e._previousPositions,r=i.length;let s;if(r===1&&e._buttonDown[cs.LEFT]){const a=i.values[0];$.clone(a,e._primaryPosition);const c=e._primaryPreviousPosition;s=e.getInputAction(ai.MOUSE_MOVE,n),l(s)&&($.clone(c,iR.startPosition),$.clone(a,iR.endPosition),s(iR)),$.clone(a,c),t.preventDefault()}else if(r===2&&e._isPinching&&(s=e.getInputAction(ai.PINCH_MOVE,n),l(s))){const a=i.values[0],c=i.values[1],u=o.values[0],f=o.values[1],h=c.x-a.x,_=c.y-a.y,g=Math.sqrt(h*h+_*_)*.25,p=f.x-u.x,y=f.y-u.y,T=Math.sqrt(p*p+y*y)*.25,b=(c.y+a.y)*.125,x=(f.y+u.y)*.125,v=Math.atan2(_,h),D=Math.atan2(y,p);$.fromElements(0,T,MC.distance.startPosition),$.fromElements(0,g,MC.distance.endPosition),$.fromElements(D,x,MC.angleAndHeight.startPosition),$.fromElements(v,b,MC.angleAndHeight.endPosition),s(MC)}}function d8e(e,t){if(t.target.setPointerCapture(t.pointerId),t.pointerType==="touch"){const n=e._positions,i=t.pointerId;n.set(i,T_(e,t,new $)),_P(e,t),e._previousPositions.set(i,$.clone(n.get(i)))}else ree(e,t)}function BW(e,t){if(t.pointerType==="touch"){const n=e._positions,i=t.pointerId;n.remove(i),_P(e,t),e._previousPositions.remove(i)}else see(e,t)}function h8e(e,t){if(t.pointerType==="touch"){const n=e._positions,i=t.pointerId,o=n.get(i);if(!l(o))return;T_(e,t,o),cee(e,t);const r=e._previousPositions;$.clone(n.get(i),r.get(i))}else aee(e,t)}function xl(e){this._inputEvents={},this._buttonDown={LEFT:!1,MIDDLE:!1,RIGHT:!1},this._isPinching=!1,this._isTouchHolding=!1,this._lastSeenTouchEvent=-xl.mouseEmulationIgnoreMilliseconds,this._primaryStartPosition=new $,this._primaryPosition=new $,this._primaryPreviousPosition=new $,this._positions=new Vt,this._previousPositions=new Vt,this._removalFunctions=[],this._touchHoldTimer=void 0,this._clickPixelTolerance=5,this._holdPixelTolerance=25,this._element=A(e,document),s8e(this)}xl.prototype.setInputAction=function(e,t,n){if(!l(e))throw new w("action is required.");if(!l(t))throw new w("type is required.");const i=qz(t,n);this._inputEvents[i]=e};xl.prototype.getInputAction=function(e,t){if(!l(e))throw new w("type is required.");const n=qz(e,t);return this._inputEvents[n]};xl.prototype.removeInputAction=function(e,t){if(!l(e))throw new w("type is required.");const n=qz(e,t);delete this._inputEvents[n]};xl.prototype.isDestroyed=function(){return!1};xl.prototype.destroy=function(){return a8e(this),Je(this)};xl.mouseEmulationIgnoreMilliseconds=800;xl.touchHoldDelayMilliseconds=1500;function Hy(e){E.typeOf.object("scene",e),this._scene=e,this._currentTweens=[],this._morphHandler=void 0,this._morphCancelled=!1,this._completeMorph=void 0,this._morphToOrthographic=!1}Hy.prototype.completeMorph=function(){l(this._completeMorph)&&this._completeMorph()};Hy.prototype.morphTo2D=function(e,t){l(this._completeMorph)&&this._completeMorph();const n=this._scene;this._previousMode=n.mode,this._morphToOrthographic=n.camera.frustum instanceof nn,!(this._previousMode===me.SCENE2D||this._previousMode===me.MORPHING)&&(this._scene.morphStart.raiseEvent(this,this._previousMode,me.SCENE2D,!0),n._mode=me.MORPHING,n.camera._setTransform(N.IDENTITY),this._previousMode===me.COLUMBUS_VIEW?j8e(this,e):Z8e(this,e,t),e===0&&l(this._completeMorph)&&this._completeMorph())};const p8e=new d,m8e=new d,_8e=new d,g8e=new d,y8e=new d,A8e=new d,T8e=new d,C8e=new ve,b8e=new N,E8e=new hi,x8e=new nn,w8e={position:void 0,direction:void 0,up:void 0,position2D:void 0,direction2D:void 0,up2D:void 0,frustum:void 0};Hy.prototype.morphToColumbusView=function(e,t){l(this._completeMorph)&&this._completeMorph();const n=this._scene;if(this._previousMode=n.mode,this._previousMode===me.COLUMBUS_VIEW||this._previousMode===me.MORPHING)return;this._scene.morphStart.raiseEvent(this,this._previousMode,me.COLUMBUS_VIEW,!0),n.camera._setTransform(N.IDENTITY);let i=p8e;const o=m8e,r=_8e;if(e>0)i.x=0,i.y=-1,i.z=1,i=d.multiplyByScalar(d.normalize(i,i),5*t.maximumRadius,i),d.negate(d.normalize(i,o),o),d.cross(d.UNIT_X,o,r);else{const u=n.camera;if(this._previousMode===me.SCENE2D)d.clone(u.position,i),i.z=u.frustum.right-u.frustum.left,d.negate(d.UNIT_Z,o),d.clone(d.UNIT_Y,r);else{d.clone(u.positionWC,i),d.clone(u.directionWC,o),d.clone(u.upWC,r);const f=t.scaleToGeodeticSurface(i,T8e),h=En.eastNorthUpToFixedFrame(f,t,b8e);N.inverseTransformation(h,h),n.mapProjection.project(t.cartesianToCartographic(i,C8e),i),N.multiplyByPointAsVector(h,o,o),N.multiplyByPointAsVector(h,r,r)}}let s;this._morphToOrthographic?(s=x8e,s.width=n.camera.frustum.right-n.camera.frustum.left,s.aspectRatio=n.drawingBufferWidth/n.drawingBufferHeight):(s=E8e,s.aspectRatio=n.drawingBufferWidth/n.drawingBufferHeight,s.fov=F.toRadians(60));const a=w8e;a.position=i,a.direction=o,a.up=r,a.frustum=s;const c=t6e(a);vx(this,c),this._previousMode===me.SCENE2D?e6e(this,e,a,c):(a.position2D=N.multiplyByPoint(Tt.TRANSFORM_2D,i,g8e),a.direction2D=N.multiplyByPointAsVector(Tt.TRANSFORM_2D,o,y8e),a.up2D=N.multiplyByPointAsVector(Tt.TRANSFORM_2D,r,A8e),n._mode=me.MORPHING,yee(this,e,a,c)),e===0&&l(this._completeMorph)&&this._completeMorph()};const $z={position:new d,direction:new d,up:new d,frustum:void 0},lee=new hi;Hy.prototype.morphTo3D=function(e,t){l(this._completeMorph)&&this._completeMorph();const n=this._scene;if(this._previousMode=n.mode,!(this._previousMode===me.SCENE3D||this._previousMode===me.MORPHING)){if(this._scene.morphStart.raiseEvent(this,this._previousMode,me.SCENE3D,!0),n._mode=me.MORPHING,n.camera._setTransform(N.IDENTITY),this._previousMode===me.SCENE2D)M8e(this,e,t);else{let i;e>0?(i=$z,d.fromDegrees(0,0,5*t.maximumRadius,t,i.position),d.negate(i.position,i.direction),d.normalize(i.direction,i.direction),d.clone(d.UNIT_Z,i.up)):i=uee(this,t);let o;const r=n.camera;r.frustum instanceof nn?o=r.frustum.clone():(o=lee,o.aspectRatio=n.drawingBufferWidth/n.drawingBufferHeight,o.fov=F.toRadians(60)),i.frustum=o;const s=Tee(i);vx(this,s),OF(this,e,i,s)}e===0&&l(this._completeMorph)&&this._completeMorph()}};Hy.prototype.isDestroyed=function(){return!1};Hy.prototype.destroy=function(){return gP(this),Je(this)};function vx(e,t){if(e._scene.completeMorphOnUserInput){e._morphHandler=new xl(e._scene.canvas);const n=function(){e._morphCancelled=!0,e._scene.camera.cancelFlight(),t(e)};e._completeMorph=n,e._morphHandler.setInputAction(n,ai.LEFT_DOWN),e._morphHandler.setInputAction(n,ai.MIDDLE_DOWN),e._morphHandler.setInputAction(n,ai.RIGHT_DOWN),e._morphHandler.setInputAction(n,ai.WHEEL)}}function gP(e){const t=e._currentTweens;for(let n=0;n<t.length;++n)t[n].cancelTween();e._currentTweens.length=0,e._morphHandler=e._morphHandler&&e._morphHandler.destroy()}const S8e=new ve,v8e=new d,D8e=new N;function uee(e,t){const n=e._scene,i=n.camera,o=$z,r=o.position,s=o.direction,a=o.up,c=n.mapProjection.unproject(i.position,S8e);t.cartographicToCartesian(c,r);const u=t.scaleToGeodeticSurface(r,v8e),f=En.eastNorthUpToFixedFrame(u,t,D8e);return N.multiplyByPointAsVector(f,i.direction,s),N.multiplyByPointAsVector(f,i.up,a),o}const I8e=new d,P8e=new d,O8e=new d,L8e=new d,B8e=new d,R8e=new d;function OF(e,t,n,i){t*=.5;const o=e._scene,r=o.camera,s=d.clone(r.position,I8e),a=d.clone(r.direction,P8e),c=d.clone(r.up,O8e),u=N.multiplyByPoint(Tt.TRANSFORM_2D_INVERSE,n.position,L8e),f=N.multiplyByPointAsVector(Tt.TRANSFORM_2D_INVERSE,n.direction,B8e),h=N.multiplyByPointAsVector(Tt.TRANSFORM_2D_INVERSE,n.up,R8e);function _(p){fu(s,u,p.time,r.position),fu(a,f,p.time,r.direction),fu(c,h,p.time,r.up),d.cross(r.direction,r.up,r.right),d.normalize(r.right,r.right)}const g=o.tweens.add({duration:t,easingFunction:_l.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:_,complete:function(){Aee(e,o,0,1,t,i)}});e._currentTweens.push(g)}const N8e=new nn,fee=new d,dee=new d,hee=new d,Xz=new d,pee=new d,mee=new d;function M8e(e,t,n){t/=3;const i=e._scene,o=i.camera;let r;t>0?(r=$z,d.fromDegrees(0,0,5*n.maximumRadius,n,r.position),d.negate(r.position,r.direction),d.normalize(r.direction,r.direction),d.clone(d.UNIT_Z,r.up)):(o.position.z=o.frustum.right-o.frustum.left,r=uee(e,n));let s;e._morphToOrthographic?(s=N8e,s.aspectRatio=i.drawingBufferWidth/i.drawingBufferHeight,s.width=o.frustum.right-o.frustum.left):(s=lee,s.aspectRatio=i.drawingBufferWidth/i.drawingBufferHeight,s.fov=F.toRadians(60)),r.frustum=s;const a=Tee(r);vx(e,a);let c;e._morphToOrthographic?c=function(){OF(e,t,r,a)}:c=function(){gee(e,t,r,function(){OF(e,t,r,a)})},t>0?(i._mode=me.SCENE2D,o.flyTo({duration:t,destination:d.fromDegrees(0,0,5*n.maximumRadius,n,Xz),complete:function(){i._mode=me.MORPHING,c()}})):c()}function fu(e,t,n,i){return d.lerp(e,t,n,i)}function _ee(e,t,n,i,o){const r=e._scene,s=r.camera;if(s.frustum instanceof nn)return;const a=s.frustum.fov,c=F.RADIANS_PER_DEGREE*.5,u=n.position.z*Math.tan(a*.5);s.frustum.far=u/Math.tan(c*.5)+1e7;function f(_){s.frustum.fov=F.lerp(a,c,_.time);const g=u/Math.tan(s.frustum.fov*.5);i(s,g)}const h=r.tweens.add({duration:t,easingFunction:_l.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:f,complete:function(){s.frustum=n.frustum.clone(),o(e)}});e._currentTweens.push(h)}const F8e=new d,z8e=new d,U8e=new d,oR=new d,H8e=new d,V8e=new d,k8e=new yr,G8e=new ii,W8e=new d,q8e={position:void 0,direction:void 0,up:void 0,frustum:void 0};function j8e(e,t){t*=.5;const n=e._scene,i=n.camera,o=d.clone(i.position,F8e),r=d.clone(i.direction,z8e),s=d.clone(i.up,U8e),a=d.negate(d.UNIT_Z,H8e),c=d.clone(d.UNIT_Y,V8e),u=oR;if(t>0)d.clone(d.ZERO,oR),u.z=5*n.mapProjection.ellipsoid.maximumRadius;else{d.clone(o,oR);const T=G8e;N.multiplyByPoint(Tt.TRANSFORM_2D,o,T.origin),N.multiplyByPointAsVector(Tt.TRANSFORM_2D,r,T.direction);const b=n.globe;if(l(b)){const x=b.pickWorldCoordinates(T,n,!0,W8e);l(x)&&(N.multiplyByPoint(Tt.TRANSFORM_2D_INVERSE,x,u),u.z+=d.distance(o,u))}}const f=k8e;f.right=u.z*.5,f.left=-f.right,f.top=f.right*(n.drawingBufferHeight/n.drawingBufferWidth),f.bottom=-f.top;const h=q8e;h.position=u,h.direction=a,h.up=c,h.frustum=f;const _=Cee(h);vx(e,_);function g(T){fu(o,u,T.time,i.position),fu(r,a,T.time,i.direction),fu(s,c,T.time,i.up),d.cross(i.direction,i.up,i.right),d.normalize(i.right,i.right),i._adjustOrthographicFrustum(!0)}function p(T,b){T.position.z=b}const y=n.tweens.add({duration:t,easingFunction:_l.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:g,complete:function(){_ee(e,t,h,p,_)}});e._currentTweens.push(y)}const RW=new ve,Y8e={position:new d,direction:new d,up:new d,position2D:new d,direction2D:new d,up2D:new d,frustum:new yr},$8e={position:new d,direction:new d,up:new d,frustum:void 0},X8e=new d,K8e=new ii,J8e=new N,Q8e=new d;function Z8e(e,t,n){t*=.5;const i=e._scene,o=i.camera,r=Y8e;if(t>0)d.clone(d.ZERO,r.position),r.position.z=5*n.maximumRadius,d.negate(d.UNIT_Z,r.direction),d.clone(d.UNIT_Y,r.up);else{n.cartesianToCartographic(o.positionWC,RW),i.mapProjection.project(RW,r.position),d.negate(d.UNIT_Z,r.direction),d.clone(d.UNIT_Y,r.up);const h=K8e;d.clone(r.position2D,h.origin);const _=d.clone(o.directionWC,h.direction),g=n.scaleToGeodeticSurface(o.positionWC,Q8e),p=En.eastNorthUpToFixedFrame(g,n,J8e);N.inverseTransformation(p,p),N.multiplyByPointAsVector(p,_,_),N.multiplyByPointAsVector(Tt.TRANSFORM_2D,_,_);const y=i.globe;if(l(y)){const T=y.pickWorldCoordinates(h,i,!0,X8e);if(l(T)){const b=d.distance(r.position2D,T);T.x+=b,d.clone(T,r.position2D)}}}function s(h,_){h.position.x=_}N.multiplyByPoint(Tt.TRANSFORM_2D,r.position,r.position2D),N.multiplyByPointAsVector(Tt.TRANSFORM_2D,r.direction,r.direction2D),N.multiplyByPointAsVector(Tt.TRANSFORM_2D,r.up,r.up2D);const a=r.frustum;a.right=r.position.z*.5,a.left=-a.right,a.top=a.right*(i.drawingBufferHeight/i.drawingBufferWidth),a.bottom=-a.top;const c=$8e;N.multiplyByPoint(Tt.TRANSFORM_2D_INVERSE,r.position2D,c.position),d.clone(r.direction,c.direction),d.clone(r.up,c.up),c.frustum=a;const u=Cee(c);vx(e,u);function f(){_ee(e,t,r,s,u)}yee(e,t,r,f)}function gee(e,t,n,i){const o=e._scene,r=o.camera,s=r.frustum.right-r.frustum.left;r.frustum=n.frustum.clone();const a=r.frustum.fov,c=F.RADIANS_PER_DEGREE*.5,u=s*Math.tan(a*.5);r.frustum.far=u/Math.tan(c*.5)+1e7,r.frustum.fov=c;function f(_){r.frustum.fov=F.lerp(c,a,_.time),r.position.z=u/Math.tan(r.frustum.fov*.5)}const h=o.tweens.add({duration:t,easingFunction:_l.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:f,complete:function(){i(e)}});e._currentTweens.push(h)}function e6e(e,t,n,i){t*=.5;const o=e._scene,r=o.camera,s=d.clone(n.position,Xz),a=d.clone(n.direction,pee),c=d.clone(n.up,mee);o._mode=me.MORPHING;function u(){r.frustum=n.frustum.clone();const f=d.clone(r.position,fee),h=d.clone(r.direction,dee),_=d.clone(r.up,hee);f.z=s.z;function g(y){fu(f,s,y.time,r.position),fu(h,a,y.time,r.direction),fu(_,c,y.time,r.up),d.cross(r.direction,r.up,r.right),d.normalize(r.right,r.right)}const p=o.tweens.add({duration:t,easingFunction:_l.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:g,complete:function(){i(e)}});e._currentTweens.push(p)}e._morphToOrthographic?u():gee(e,0,n,u)}function yee(e,t,n,i){const o=e._scene,r=o.camera,s=d.clone(r.position,fee),a=d.clone(r.direction,dee),c=d.clone(r.up,hee),u=d.clone(n.position2D,Xz),f=d.clone(n.direction2D,pee),h=d.clone(n.up2D,mee);function _(p){fu(s,u,p.time,r.position),fu(a,f,p.time,r.direction),fu(c,h,p.time,r.up),d.cross(r.direction,r.up,r.right),d.normalize(r.right,r.right),r._adjustOrthographicFrustum(!0)}const g=o.tweens.add({duration:t,easingFunction:_l.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:_,complete:function(){Aee(e,o,1,0,t,i)}});e._currentTweens.push(g)}function Aee(e,t,n,i,o,r){const s={object:t,property:"morphTime",startValue:n,stopValue:i,duration:o,easingFunction:_l.QUARTIC_OUT};l(r)&&(s.complete=function(){r(e)});const a=t.tweens.addProperty(s);e._currentTweens.push(a)}function Tee(e){return function(t){const n=t._scene;n._mode=me.SCENE3D,n.morphTime=me.getMorphTime(me.SCENE3D),gP(t);const i=n.camera;(t._previousMode!==me.MORPHING||t._morphCancelled)&&(t._morphCancelled=!1,d.clone(e.position,i.position),d.clone(e.direction,i.direction),d.clone(e.up,i.up),d.cross(i.direction,i.up,i.right),d.normalize(i.right,i.right),i.frustum=e.frustum.clone());const o=i.frustum;n.frameState.useLogDepth&&(o.near=.1,o.far=1e10);const r=l(t._completeMorph);t._completeMorph=void 0,n.camera.update(n.mode),t._scene.morphComplete.raiseEvent(t,t._previousMode,me.SCENE3D,r)}}function Cee(e){return function(t){const n=t._scene;n._mode=me.SCENE2D,n.morphTime=me.getMorphTime(me.SCENE2D),gP(t);const i=n.camera;d.clone(e.position,i.position),i.position.z=n.mapProjection.ellipsoid.maximumRadius*2,d.clone(e.direction,i.direction),d.clone(e.up,i.up),d.cross(i.direction,i.up,i.right),d.normalize(i.right,i.right),i.frustum=e.frustum.clone();const o=l(t._completeMorph);t._completeMorph=void 0,n.camera.update(n.mode),t._scene.morphComplete.raiseEvent(t,t._previousMode,me.SCENE2D,o)}}function t6e(e){return function(t){const n=t._scene;n._mode=me.COLUMBUS_VIEW,n.morphTime=me.getMorphTime(me.COLUMBUS_VIEW),gP(t);const i=n.camera;(t._previousModeMode!==me.MORPHING||t._morphCancelled)&&(t._morphCancelled=!1,d.clone(e.position,i.position),d.clone(e.direction,i.direction),d.clone(e.up,i.up),d.cross(i.direction,i.up,i.right),d.normalize(i.right,i.right));const o=i.frustum;n.frameState.useLogDepth&&(o.near=.1,o.far=1e10);const r=l(t._completeMorph);t._completeMorph=void 0,n.camera.update(n.mode),t._scene.morphComplete.raiseEvent(t,t._previousMode,me.COLUMBUS_VIEW,r)}}const n6e={LEFT_DRAG:0,RIGHT_DRAG:1,MIDDLE_DRAG:2,WHEEL:3,PINCH:4},Qi=Object.freeze(n6e);function ka(e,t){let n=e;return l(t)&&(n+=`+${t}`),n}function i6e(e,t){$.clone(e.distance.startPosition,t.distance.startPosition),$.clone(e.distance.endPosition,t.distance.endPosition),$.clone(e.angleAndHeight.startPosition,t.angleAndHeight.startPosition),$.clone(e.angleAndHeight.endPosition,t.angleAndHeight.endPosition)}function NW(e,t,n){const i=ka(Qi.PINCH,t),o=e._update,r=e._isDown,s=e._eventStartPosition,a=e._pressTime,c=e._releaseTime;o[i]=!0,r[i]=!1,s[i]=new $;let u=e._movement[i];l(u)||(u=e._movement[i]={}),u.distance={startPosition:new $,endPosition:new $},u.angleAndHeight={startPosition:new $,endPosition:new $},u.prevAngle=0,e._eventHandler.setInputAction(function(f){e._buttonsDown++,r[i]=!0,a[i]=new Date,$.lerp(f.position1,f.position2,.5,s[i])},ai.PINCH_START,t),e._eventHandler.setInputAction(function(){e._buttonsDown=Math.max(e._buttonsDown-1,0),r[i]=!1,c[i]=new Date},ai.PINCH_END,t),e._eventHandler.setInputAction(function(f){if(r[i]){o[i]?(i6e(f,u),o[i]=!1,u.prevAngle=u.angleAndHeight.startPosition.x):($.clone(f.distance.endPosition,u.distance.endPosition),$.clone(f.angleAndHeight.endPosition,u.angleAndHeight.endPosition));let h=u.angleAndHeight.endPosition.x;const _=u.prevAngle,g=Math.PI*2;for(;h>=_+Math.PI;)h-=g;for(;h<_-Math.PI;)h+=g;u.angleAndHeight.endPosition.x=-h*n.clientWidth/12,u.angleAndHeight.startPosition.x=-_*n.clientWidth/12}},ai.PINCH_MOVE,t)}function MW(e,t){const n=ka(Qi.WHEEL,t),i=e._update;i[n]=!0;let o=e._movement[n];l(o)||(o=e._movement[n]={}),o.startPosition=new $,o.endPosition=new $,e._eventHandler.setInputAction(function(r){const s=15*F.toRadians(r);i[n]?($.clone($.ZERO,o.startPosition),o.endPosition.x=0,o.endPosition.y=s,i[n]=!1):o.endPosition.y=o.endPosition.y+s},ai.WHEEL,t)}function I0(e,t,n){const i=ka(n,t),o=e._isDown,r=e._eventStartPosition,s=e._pressTime,a=e._releaseTime;o[i]=!1,r[i]=new $;let c=e._lastMovement[i];l(c)||(c=e._lastMovement[i]={startPosition:new $,endPosition:new $,valid:!1});let u,f;n===Qi.LEFT_DRAG?(u=ai.LEFT_DOWN,f=ai.LEFT_UP):n===Qi.RIGHT_DRAG?(u=ai.RIGHT_DOWN,f=ai.RIGHT_UP):n===Qi.MIDDLE_DRAG&&(u=ai.MIDDLE_DOWN,f=ai.MIDDLE_UP),e._eventHandler.setInputAction(function(h){e._buttonsDown++,c.valid=!1,o[i]=!0,s[i]=new Date,$.clone(h.position,r[i])},u,t),e._eventHandler.setInputAction(function(){e._buttonsDown=Math.max(e._buttonsDown-1,0),o[i]=!1,a[i]=new Date},f,t)}function FW(e,t){$.clone(e.startPosition,t.startPosition),$.clone(e.endPosition,t.endPosition)}function zW(e,t){const n=e._update,i=e._movement,o=e._lastMovement,r=e._isDown;for(const s in Qi)if(Qi.hasOwnProperty(s)){const a=Qi[s];if(l(a)){const c=ka(a,t);n[c]=!0,l(e._lastMovement[c])||(e._lastMovement[c]={startPosition:new $,endPosition:new $,valid:!1}),l(e._movement[c])||(e._movement[c]={startPosition:new $,endPosition:new $})}}e._eventHandler.setInputAction(function(s){for(const a in Qi)if(Qi.hasOwnProperty(a)){const c=Qi[a];if(l(c)){const u=ka(c,t);r[u]&&(n[u]?(FW(i[u],o[u]),o[u].valid=!0,FW(s,i[u]),n[u]=!1):$.clone(s.endPosition,i[u].endPosition))}}$.clone(s.endPosition,e._currentMousePosition)},ai.MOUSE_MOVE,t)}function wu(e){if(!l(e))throw new w("canvas is required.");this._eventHandler=new xl(e),this._update={},this._movement={},this._lastMovement={},this._isDown={},this._eventStartPosition={},this._pressTime={},this._releaseTime={},this._buttonsDown=0,this._currentMousePosition=new $,MW(this,void 0),NW(this,void 0,e),I0(this,void 0,Qi.LEFT_DRAG),I0(this,void 0,Qi.RIGHT_DRAG),I0(this,void 0,Qi.MIDDLE_DRAG),zW(this,void 0);for(const t in uu)if(uu.hasOwnProperty(t)){const n=uu[t];l(n)&&(MW(this,n),NW(this,n,e),I0(this,n,Qi.LEFT_DRAG),I0(this,n,Qi.RIGHT_DRAG),I0(this,n,Qi.MIDDLE_DRAG),zW(this,n))}}Object.defineProperties(wu.prototype,{currentMousePosition:{get:function(){return this._currentMousePosition}},anyButtonDown:{get:function(){const e=!this._update[ka(Qi.WHEEL)]||!this._update[ka(Qi.WHEEL,uu.SHIFT)]||!this._update[ka(Qi.WHEEL,uu.CTRL)]||!this._update[ka(Qi.WHEEL,uu.ALT)];return this._buttonsDown>0||e}}});wu.prototype.isMoving=function(e,t){if(!l(e))throw new w("type is required.");const n=ka(e,t);return!this._update[n]};wu.prototype.getMovement=function(e,t){if(!l(e))throw new w("type is required.");const n=ka(e,t);return this._movement[n]};wu.prototype.getLastMovement=function(e,t){if(!l(e))throw new w("type is required.");const n=ka(e,t),i=this._lastMovement[n];if(i.valid)return i};wu.prototype.isButtonDown=function(e,t){if(!l(e))throw new w("type is required.");const n=ka(e,t);return this._isDown[n]};wu.prototype.getStartMousePosition=function(e,t){if(!l(e))throw new w("type is required.");if(e===Qi.WHEEL)return this._currentMousePosition;const n=ka(e,t);return this._eventStartPosition[n]};wu.prototype.getButtonPressTime=function(e,t){if(!l(e))throw new w("type is required.");const n=ka(e,t);return this._pressTime[n]};wu.prototype.getButtonReleaseTime=function(e,t){if(!l(e))throw new w("type is required.");const n=ka(e,t);return this._releaseTime[n]};wu.prototype.reset=function(){for(const e in this._update)this._update.hasOwnProperty(e)&&(this._update[e]=!0)};wu.prototype.isDestroyed=function(){return!1};wu.prototype.destroy=function(){return this._eventHandler=this._eventHandler&&this._eventHandler.destroy(),Je(this)};function GI(e,t,n,i,o,r,s,a,c,u){this._tweens=e,this._tweenjs=t,this._startObject=St(n),this._stopObject=St(i),this._duration=o,this._delay=r,this._easingFunction=s,this._update=a,this._complete=c,this.cancel=u,this.needsStart=!0}Object.defineProperties(GI.prototype,{startObject:{get:function(){return this._startObject}},stopObject:{get:function(){return this._stopObject}},duration:{get:function(){return this._duration}},delay:{get:function(){return this._delay}},easingFunction:{get:function(){return this._easingFunction}},update:{get:function(){return this._update}},complete:{get:function(){return this._complete}},tweenjs:{get:function(){return this._tweenjs}}});GI.prototype.cancelTween=function(){this._tweens.remove(this)};function Su(){this._tweens=[]}Object.defineProperties(Su.prototype,{length:{get:function(){return this._tweens.length}}});Su.prototype.add=function(e){if(e=A(e,A.EMPTY_OBJECT),!l(e.startObject)||!l(e.stopObject))throw new w("options.startObject and options.stopObject are required.");if(!l(e.duration)||e.duration<0)throw new w("options.duration is required and must be positive.");if(e.duration===0)return l(e.complete)&&e.complete(),new GI(this);const t=e.duration/to.SECONDS_PER_MILLISECOND,n=A(e.delay,0),i=n/to.SECONDS_PER_MILLISECOND,o=A(e.easingFunction,_l.LINEAR_NONE),r=e.startObject,s=new _Ue(r);s.to(St(e.stopObject),t),s.delay(i),s.easing(o),l(e.update)&&s.onUpdate(function(){e.update(r)}),s.onComplete(A(e.complete,null)),s.repeat(A(e._repeat,0));const a=new GI(this,s,e.startObject,e.stopObject,e.duration,n,o,e.update,e.complete,e.cancel);return this._tweens.push(a),a};Su.prototype.addProperty=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.object,n=e.property,i=e.startValue,o=e.stopValue;if(!l(t)||!l(e.property))throw new w("options.object and options.property are required.");if(!l(t[n]))throw new w("options.object must have the specified property.");if(!l(i)||!l(o))throw new w("options.startValue and options.stopValue are required.");function r(s){t[n]=s.value}return this.add({startObject:{value:i},stopObject:{value:o},duration:A(e.duration,3),delay:e.delay,easingFunction:e.easingFunction,update:r,complete:e.complete,cancel:e.cancel,_repeat:e._repeat})};Su.prototype.addAlpha=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.material;if(!l(t))throw new w("options.material is required.");const n=[];for(const o in t.uniforms)t.uniforms.hasOwnProperty(o)&&l(t.uniforms[o])&&l(t.uniforms[o].alpha)&&n.push(o);if(n.length===0)throw new w("material has no properties with alpha components.");function i(o){const r=n.length;for(let s=0;s<r;++s)t.uniforms[n[s]].alpha=o.alpha}return this.add({startObject:{alpha:A(e.startValue,0)},stopObject:{alpha:A(e.stopValue,1)},duration:A(e.duration,3),delay:e.delay,easingFunction:e.easingFunction,update:i,complete:e.complete,cancel:e.cancel})};Su.prototype.addOffsetIncrement=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.material;if(!l(t))throw new w("material is required.");if(!l(t.uniforms.offset))throw new w("material.uniforms must have an offset property.");const n=t.uniforms;return this.addProperty({object:n,property:"offset",startValue:n.offset,stopValue:n.offset+1,duration:e.duration,delay:e.delay,easingFunction:e.easingFunction,update:e.update,cancel:e.cancel,_repeat:1/0})};Su.prototype.remove=function(e){if(!l(e))return!1;const t=this._tweens.indexOf(e);return t!==-1?(e.tweenjs.stop(),l(e.cancel)&&e.cancel(),this._tweens.splice(t,1),!0):!1};Su.prototype.removeAll=function(){const e=this._tweens;for(let t=0;t<e.length;++t){const n=e[t];n.tweenjs.stop(),l(n.cancel)&&n.cancel()}e.length=0};Su.prototype.contains=function(e){return l(e)&&this._tweens.indexOf(e)!==-1};Su.prototype.get=function(e){if(!l(e))throw new w("index is required.");return this._tweens[e]};Su.prototype.update=function(e){const t=this._tweens;let n=0;for(e=l(e)?e/to.SECONDS_PER_MILLISECOND:Gr();n<t.length;){const i=t[n],o=i.tweenjs;i.needsStart?(i.needsStart=!1,o.start(e)):o.update(e)?n++:(o.stop(),t.splice(n,1))}};function Dx(e){if(!l(e))throw new w("scene is required.");this.enableInputs=!0,this.enableTranslate=!0,this.enableZoom=!0,this.enableRotate=!0,this.enableTilt=!0,this.enableLook=!0,this.inertiaSpin=.9,this.inertiaTranslate=.9,this.inertiaZoom=.8,this.maximumMovementRatio=.1,this.bounceAnimationTime=3,this.minimumZoomDistance=1,this.maximumZoomDistance=Number.POSITIVE_INFINITY,this.translateEventTypes=Qi.LEFT_DRAG,this.zoomEventTypes=[Qi.RIGHT_DRAG,Qi.WHEEL,Qi.PINCH],this.rotateEventTypes=Qi.LEFT_DRAG,this.tiltEventTypes=[Qi.MIDDLE_DRAG,Qi.PINCH,{eventType:Qi.LEFT_DRAG,modifier:uu.CTRL},{eventType:Qi.RIGHT_DRAG,modifier:uu.CTRL}],this.lookEventTypes={eventType:Qi.LEFT_DRAG,modifier:uu.SHIFT},this.minimumPickingTerrainHeight=15e4,this._minimumPickingTerrainHeight=this.minimumPickingTerrainHeight,this.minimumCollisionTerrainHeight=15e3,this._minimumCollisionTerrainHeight=this.minimumCollisionTerrainHeight,this.minimumTrackBallHeight=75e5,this._minimumTrackBallHeight=this.minimumTrackBallHeight,this.enableCollisionDetection=!0,this._scene=e,this._globe=void 0,this._ellipsoid=void 0,this._aggregator=new wu(e.canvas),this._lastInertiaSpinMovement=void 0,this._lastInertiaZoomMovement=void 0,this._lastInertiaTranslateMovement=void 0,this._lastInertiaTiltMovement=void 0,this._inertiaDisablers={_lastInertiaZoomMovement:["_lastInertiaSpinMovement","_lastInertiaTranslateMovement","_lastInertiaTiltMovement"],_lastInertiaTiltMovement:["_lastInertiaSpinMovement","_lastInertiaTranslateMovement"]},this._tweens=new Su,this._tween=void 0,this._horizontalRotationAxis=void 0,this._tiltCenterMousePosition=new $(-1,-1),this._tiltCenter=new d,this._rotateMousePosition=new $(-1,-1),this._rotateStartPosition=new d,this._strafeStartPosition=new d,this._strafeMousePosition=new $,this._strafeEndMousePosition=new $,this._zoomMouseStart=new $(-1,-1),this._zoomWorldPosition=new d,this._useZoomWorldPosition=!1,this._tiltCVOffMap=!1,this._looking=!1,this._rotating=!1,this._strafing=!1,this._zoomingOnVector=!1,this._zoomingUnderground=!1,this._rotatingZoom=!1,this._adjustedHeightForTerrain=!1,this._cameraUnderground=!1;const t=e.mapProjection;this._maxCoord=t.project(new ve(Math.PI,F.PI_OVER_TWO)),this._zoomFactor=5,this._rotateFactor=void 0,this._rotateRateRangeAdjustment=void 0,this._maximumRotateRate=1.77,this._minimumRotateRate=1/5e3,this._minimumZoomRate=20,this._maximumZoomRate=5906376272e3,this._minimumUndergroundPickDistance=2e3,this._maximumUndergroundPickDistance=1e4}function o6e(e,t){if(e<0)return 0;const n=(1-t)*25;return Math.exp(-n*e)}function r6e(e){return $.equalsEpsilon(e.startPosition,e.endPosition,F.EPSILON14)}const s6e=.4;function a6e(e,t,n,i,o,r,s){let a=r[s];l(a)||(a=r[s]={startPosition:new $,endPosition:new $,motion:new $,inertiaEnabled:!0});const c=e.getButtonPressTime(t,n),u=e.getButtonReleaseTime(t,n),f=c&&u&&(u.getTime()-c.getTime())/1e3,h=new Date,_=u&&(h.getTime()-u.getTime())/1e3;if(c&&u&&f<s6e){const g=o6e(_,i),p=e.getLastMovement(t,n);if(!l(p)||r6e(p)||!a.inertiaEnabled||(a.motion.x=(p.endPosition.x-p.startPosition.x)*.5,a.motion.y=(p.endPosition.y-p.startPosition.y)*.5,a.startPosition=$.clone(p.startPosition,a.startPosition),a.endPosition=$.multiplyByScalar(a.motion,g,a.endPosition),a.endPosition=$.add(a.startPosition,a.endPosition,a.endPosition),isNaN(a.endPosition.x)||isNaN(a.endPosition.y)||$.distance(a.startPosition,a.endPosition)<.5))return;if(!e.isButtonDown(t,n)){const y=e.getStartMousePosition(t,n);o(r,y,a)}}}function c6e(e,t){if(l(t)){let n=e[t];l(n)&&(n.inertiaEnabled=!0);const i=e._inertiaDisablers[t];if(l(i)){const o=i.length;for(let r=0;r<o;++r)n=e[i[r]],l(n)&&(n.inertiaEnabled=!1)}}}const UW=[];function uc(e,t,n,i,o,r){if(!l(n))return;const s=e._aggregator;Array.isArray(n)||(UW[0]=n,n=UW);const a=n.length;for(let c=0;c<a;++c){const u=n[c],f=l(u.eventType)?u.eventType:u,h=u.modifier,_=s.isMoving(f,h)&&s.getMovement(f,h),g=s.getStartMousePosition(f,h);e.enableInputs&&t&&(_?(i(e,g,_),c6e(e,r)):o<1&&a6e(s,f,h,o,i,e,r))}}const _v=new ii,l6e=new d,u6e=new $,f6e=new d,d6e=new $,h6e=new d,p6e=new d,m6e=new d,_6e=new d,g6e=new d,y6e=new d,A6e=new d,T6e=new d,C6e=new d,b6e=new d,E6e=new d,x6e=new d,w6e=new d,S6e=new d,v6e=new d,eg=new d,HW=new d,VW=new d,rR={orientation:new Is};function Kz(e,t,n,i,o,r){let s=1;l(r)&&(s=F.clamp(Math.abs(r),.25,1));const a=n.endPosition.y-n.startPosition.y,u=a>0?e.minimumZoomDistance*s:0,f=e.maximumZoomDistance,h=o-u;let _=i*h;_=F.clamp(_,e._minimumZoomRate,e._maximumZoomRate);let g=a/e._scene.canvas.clientHeight;g=Math.min(g,e.maximumMovementRatio);let p=_*g;if(e.enableCollisionDetection||e.minimumZoomDistance===0||!l(e._globe)){if(p>0&&Math.abs(o-u)<1||p<0&&Math.abs(o-f)<1)return;o-p<u?p=o-u-1:o-p>f&&(p=o-f)}const y=e._scene,T=y.camera,b=y.mode,x=rR.orientation;if(x.heading=T.heading,x.pitch=T.pitch,x.roll=T.roll,T.frustum instanceof nn){Math.abs(p)>0&&(T.zoomIn(p),T._adjustOrthographicFrustum());return}const v=$.equals(t,e._zoomMouseStart);let D=e._zoomingOnVector,L=e._rotatingZoom,B;if(v||(e._zoomMouseStart=$.clone(t,e._zoomMouseStart),l(e._globe)&&(b===me.SCENE2D?(B=T.getPickRay(t,_v).origin,B=d.fromElements(B.y,B.z,B.x)):B=t_(e,t,l6e)),l(B)?(e._useZoomWorldPosition=!0,e._zoomWorldPosition=d.clone(B,e._zoomWorldPosition)):e._useZoomWorldPosition=!1,D=e._zoomingOnVector=!1,L=e._rotatingZoom=!1,e._zoomingUnderground=e._cameraUnderground),!e._useZoomWorldPosition){T.zoomIn(p);return}let V=b===me.COLUMBUS_VIEW;if(T.positionCartographic.height<2e6&&(L=!0),!v||L){if(b===me.SCENE2D){const M=e._zoomWorldPosition,H=T.position;if(!d.equals(M,H)&&T.positionCartographic.height<e._maxCoord.x*2){const G=T.position.x,I=d.subtract(M,H,f6e);d.normalize(I,I);const O=d.distance(M,H)*p/(T.getMagnitude()*.5);T.move(I,O*.5),(T.position.x<0&&G>0||T.position.x>0&&G<0)&&(B=T.getPickRay(t,_v).origin,B=d.fromElements(B.y,B.z,B.x),e._zoomWorldPosition=d.clone(B,e._zoomWorldPosition))}}else if(b===me.SCENE3D){const M=d.normalize(T.position,g6e);if(e._cameraUnderground||e._zoomingUnderground||T.positionCartographic.height<3e3&&Math.abs(d.dot(T.direction,M))<.6)V=!0;else{const H=y.canvas,G=d6e;G.x=H.clientWidth/2,G.y=H.clientHeight/2;const I=t_(e,G,h6e);if(!l(I))V=!0;else if(T.positionCartographic.height<1e6)if(d.dot(T.direction,M)>=-.5)V=!0;else{const O=A6e;d.clone(T.position,O);const m=e._zoomWorldPosition;let P=y6e;if(P=d.normalize(m,P),d.dot(P,M)<0)return;const R=v6e,U=b6e;d.clone(T.direction,U),d.add(O,d.multiplyByScalar(U,1e3,eg),R);const W=E6e,q=x6e;d.subtract(m,O,W),d.normalize(W,q);const Y=d.dot(M,q);if(Y>=0){e._zoomMouseStart.x=-1;return}const j=Math.acos(-Y),ee=d.magnitude(O),K=d.magnitude(m),se=ee-p,Q=d.magnitude(W),Z=Math.asin(F.clamp(Q/K*Math.sin(j),-1,1)),J=Math.asin(F.clamp(se/K*Math.sin(j),-1,1)),de=Z-J+j,_e=T6e;d.normalize(O,_e);let le=C6e;le=d.cross(q,_e,le),le=d.normalize(le,le),d.normalize(d.cross(_e,le,eg),U),d.multiplyByScalar(d.normalize(R,eg),d.magnitude(R)-p,R),d.normalize(O,O),d.multiplyByScalar(O,se,O);const Te=w6e;d.multiplyByScalar(d.add(d.multiplyByScalar(_e,Math.cos(de)-1,HW),d.multiplyByScalar(U,Math.sin(de),VW),eg),se,Te),d.add(O,Te,O),d.normalize(R,_e),d.normalize(d.cross(_e,le,eg),U);const pe=S6e;d.multiplyByScalar(d.add(d.multiplyByScalar(_e,Math.cos(de)-1,HW),d.multiplyByScalar(U,Math.sin(de),VW),eg),d.magnitude(R),pe),d.add(R,pe,R),d.clone(O,T.position),d.normalize(d.subtract(R,O,eg),T.direction),d.clone(T.direction,T.direction),d.cross(T.direction,T.up,T.right),d.cross(T.right,T.direction,T.up),T.setView(rR);return}else{const O=d.normalize(I,p6e),m=d.normalize(e._zoomWorldPosition,m6e),P=d.dot(m,O);if(P>0&&P<1){const R=F.acosClamped(P),U=d.cross(m,O,_6e),W=Math.abs(R)>F.toRadians(20)?T.positionCartographic.height*.75:T.positionCartographic.height-p,q=p/W;T.rotate(U,R*q)}}}}e._rotatingZoom=!V}if(!v&&V||D){let M;const H=es.wgs84ToWindowCoordinates(y,e._zoomWorldPosition,u6e);b!==me.COLUMBUS_VIEW&&$.equals(t,e._zoomMouseStart)&&l(H)?M=T.getPickRay(H,_v):M=T.getPickRay(t,_v);const G=M.direction;(b===me.COLUMBUS_VIEW||b===me.SCENE2D)&&d.fromElements(G.y,G.z,G.x,G),T.move(G,p),e._zoomingOnVector=!0}else T.zoomIn(p);e._cameraUnderground||T.setView(rR)}const D6e=new ii,I6e=new ii,P6e=new d;function O6e(e,t,n){const o=e._scene.camera;let r=o.getPickRay(n.startPosition,D6e).origin,s=o.getPickRay(n.endPosition,I6e).origin;r=d.fromElements(r.y,r.z,r.x,r),s=d.fromElements(s.y,s.z,s.x,s);const a=d.subtract(r,s,P6e),c=d.magnitude(a);c>0&&(d.normalize(a,a),o.move(a,c))}function kW(e,t,n){l(n.distance)&&(n=n.distance);const o=e._scene.camera;Kz(e,t,n,e._zoomFactor,o.getMagnitude())}const L6e=new $,B6e=new $;function GW(e,t,n){if(l(n.angleAndHeight)){R6e(e,t,n.angleAndHeight);return}const i=e._scene,o=i.camera,r=i.canvas,s=r.clientWidth,a=r.clientHeight;let c=L6e;c.x=2/s*n.startPosition.x-1,c.y=2/a*(a-n.startPosition.y)-1,c=$.normalize(c,c);let u=B6e;u.x=2/s*n.endPosition.x-1,u.y=2/a*(a-n.endPosition.y)-1,u=$.normalize(u,u);let f=F.acosClamped(c.x);c.y<0&&(f=F.TWO_PI-f);let h=F.acosClamped(u.x);u.y<0&&(h=F.TWO_PI-h);const _=h-f;o.twistRight(_)}function R6e(e,t,n){let i=e._rotateFactor*e._rotateRateRangeAdjustment;i>e._maximumRotateRate&&(i=e._maximumRotateRate),i<e._minimumRotateRate&&(i=e._minimumRotateRate);const o=e._scene,r=o.camera,s=o.canvas;let a=(n.endPosition.x-n.startPosition.x)/s.clientWidth;a=Math.min(a,e.maximumMovementRatio);const c=i*a*Math.PI*4;r.twistRight(c)}function N6e(e){const t=e._scene.mapMode2D===Zm.ROTATE;N.equals(N.IDENTITY,e._scene.camera.transform)?(uc(e,e.enableTranslate,e.translateEventTypes,O6e,e.inertiaTranslate,"_lastInertiaTranslateMovement"),uc(e,e.enableZoom,e.zoomEventTypes,kW,e.inertiaZoom,"_lastInertiaZoomMovement"),t&&uc(e,e.enableRotate,e.tiltEventTypes,GW,e.inertiaSpin,"_lastInertiaTiltMovement")):(uc(e,e.enableZoom,e.zoomEventTypes,kW,e.inertiaZoom,"_lastInertiaZoomMovement"),t&&uc(e,e.enableRotate,e.translateEventTypes,GW,e.inertiaSpin,"_lastInertiaSpinMovement"))}const bee=new ii,M6e=new d,F6e=new d;function t_(e,t,n){const i=e._scene,o=e._globe,r=i.camera;if(!l(o))return;const s=!e._cameraUnderground;let a;i.pickPositionSupported&&(a=i.pickPositionWorldCoordinates(t,M6e));const c=r.getPickRay(t,bee),u=o.pickWorldCoordinates(c,i,s,F6e),f=l(a)?d.distance(a,r.positionWC):Number.POSITIVE_INFINITY,h=l(u)?d.distance(u,r.positionWC):Number.POSITIVE_INFINITY;return f<h?d.clone(a,n):d.clone(u,n)}const z6e=new ve;function WI(e){const t=e._ellipsoid,n=e._scene,i=n.camera,o=n.mode;let r=0;if(o===me.SCENE3D){const c=t.cartesianToCartographic(i.position,z6e);l(c)&&(r=c.height)}else r=i.position.z;const s=A(e._scene.globeHeight,0);return Math.abs(s-r)}const U6e=new d;function Eee(e,t){const n=t.origin,i=t.direction,o=WI(e),r=d.normalize(n,U6e);let s=Math.abs(d.dot(r,i));return s=Math.max(s,.5)*2,o*s}function xee(e,t,n,i){let o=d.distance(t.origin,n);const r=WI(e),s=F.clamp(r*5,e._minimumUndergroundPickDistance,e._maximumUndergroundPickDistance);return o>s&&(o=Math.min(o,r/5),o=Math.max(o,100)),ii.getPoint(t,o,i)}function wee(e,t,n,i){let o;return l(n)?(o=d.distance(t.origin,n),o>e._maximumUndergroundPickDistance&&(o=WI(e))):o=WI(e),ii.getPoint(t,o,i)}const H6e=new $;function See(e,t){const n=t.endPosition,i=$.subtract(t.endPosition,t.startPosition,H6e),o=e._strafeEndMousePosition;$.add(o,i,o),t.endPosition=o,Jz(e,t,e._strafeStartPosition),t.endPosition=n}const WW=new ii,V6e=new ii,sR=new d,k6e=new d,G6e=new d,W6e=new d,q6e=new Wt(d.UNIT_X,0),j6e=new $,Y6e=new $;function $6e(e,t,n){if(d.equals(t,e._translateMousePosition)||(e._looking=!1),d.equals(t,e._strafeMousePosition)||(e._strafing=!1),e._looking){cl(e,t,n);return}if(e._strafing){See(e,n);return}const o=e._scene.camera,r=e._cameraUnderground,s=$.clone(n.startPosition,j6e),a=$.clone(n.endPosition,Y6e);let c=o.getPickRay(s,WW);const u=d.clone(d.ZERO,W6e),f=d.UNIT_X;let h;if(o.position.z<e._minimumPickingTerrainHeight&&(h=t_(e,s,sR),l(h)&&(u.x=h.x)),r||u.x>o.position.z&&l(h)){let v=h;r&&(v=wee(e,c,h,sR)),$.clone(t,e._strafeMousePosition),$.clone(t,e._strafeEndMousePosition),d.clone(v,e._strafeStartPosition),e._strafing=!0,Jz(e,n,e._strafeStartPosition);return}const _=Wt.fromPointNormal(u,f,q6e);c=o.getPickRay(s,WW);const g=qr.rayPlane(c,_,sR),p=o.getPickRay(a,V6e),y=qr.rayPlane(p,_,k6e);if(!l(g)||!l(y)){e._looking=!0,cl(e,t,n),$.clone(t,e._translateMousePosition);return}const T=d.subtract(g,y,G6e),b=T.x;T.x=T.y,T.y=T.z,T.z=b;const x=d.magnitude(T);x>F.EPSILON6&&(d.normalize(T,T),o.move(T,x))}const vee=new $,UD=new ii,HD=new d,X6e=new d,Dee=new N,K6e=new N,J6e=new d,Q6e=new Wt(d.UNIT_X,0),aR=new d,LF=new ve,Iee=new N,Z6e=new De,eWe=new te,VD=new d;function tWe(e,t,n){if(l(n.angleAndHeight)&&(n=n.angleAndHeight),$.equals(t,e._tiltCenterMousePosition)||(e._tiltCVOffMap=!1,e._looking=!1),e._looking){cl(e,t,n);return}const o=e._scene.camera;e._tiltCVOffMap||!e.onMap()||Math.abs(o.position.z)>e._minimumPickingTerrainHeight?(e._tiltCVOffMap=!0,nWe(e,t,n)):iWe(e,t,n)}function nWe(e,t,n){const i=e._scene,o=i.camera,r=i.canvas,s=vee;s.x=r.clientWidth/2,s.y=r.clientHeight/2;const a=o.getPickRay(s,UD),c=d.UNIT_X,u=a.origin,f=a.direction;let h;const _=d.dot(c,f);if(Math.abs(_)>F.EPSILON6&&(h=-d.dot(c,u)/_),!l(h)||h<=0){e._looking=!0,cl(e,t,n),$.clone(t,e._tiltCenterMousePosition);return}const g=d.multiplyByScalar(f,h,HD);d.add(u,g,g);const p=i.mapProjection,y=p.ellipsoid;d.fromElements(g.y,g.z,g.x,g);const T=p.unproject(g,LF);y.cartographicToCartesian(T,g);const b=En.eastNorthUpToFixedFrame(g,y,Dee),x=e._globe,v=e._ellipsoid;e._globe=void 0,e._ellipsoid=be.UNIT_SPHERE,e._rotateFactor=1,e._rotateRateRangeAdjustment=1;const D=N.clone(o.transform,Iee);o._setTransform(b),al(e,t,n,d.UNIT_Z),o._setTransform(D),e._globe=x,e._ellipsoid=v;const L=v.maximumRadius;e._rotateFactor=1/L,e._rotateRateRangeAdjustment=L}function iWe(e,t,n){const i=e._scene,o=i.camera,r=e._cameraUnderground;let s,a;const c=d.UNIT_X;if($.equals(t,e._tiltCenterMousePosition))s=d.clone(e._tiltCenter,HD);else{if(o.position.z<e._minimumPickingTerrainHeight&&(s=t_(e,t,HD)),!l(s)){a=o.getPickRay(t,UD);const I=a.origin,O=a.direction;let m;const P=d.dot(c,O);if(Math.abs(P)>F.EPSILON6&&(m=-d.dot(c,I)/P),!l(m)||m<=0){e._looking=!0,cl(e,t,n),$.clone(t,e._tiltCenterMousePosition);return}s=d.multiplyByScalar(O,m,HD),d.add(I,s,s)}r&&(l(a)||(a=o.getPickRay(t,UD)),xee(e,a,s,s)),$.clone(t,e._tiltCenterMousePosition),d.clone(s,e._tiltCenter)}const u=i.canvas,f=vee;f.x=u.clientWidth/2,f.y=e._tiltCenterMousePosition.y,a=o.getPickRay(f,UD);const h=d.clone(d.ZERO,J6e);h.x=s.x;const _=Wt.fromPointNormal(h,c,Q6e),g=qr.rayPlane(a,_,X6e),p=o._projection,y=p.ellipsoid;d.fromElements(s.y,s.z,s.x,s);let T=p.unproject(s,LF);y.cartographicToCartesian(T,s);const b=En.eastNorthUpToFixedFrame(s,y,Dee);let x;l(g)?(d.fromElements(g.y,g.z,g.x,g),T=p.unproject(g,LF),y.cartographicToCartesian(T,g),x=En.eastNorthUpToFixedFrame(g,y,K6e)):x=b;const v=e._globe,D=e._ellipsoid;e._globe=void 0,e._ellipsoid=be.UNIT_SPHERE,e._rotateFactor=1,e._rotateRateRangeAdjustment=1;let L=d.UNIT_Z;const B=N.clone(o.transform,Iee);o._setTransform(b);const V=d.cross(d.UNIT_Z,d.normalize(o.position,aR),aR),M=d.dot(o.right,V);if(al(e,t,n,L,!1,!0),o._setTransform(x),M<0){const I=n.startPosition.y-n.endPosition.y;(r&&I<0||!r&&I>0)&&(L=void 0);const O=o.constrainedAxis;o.constrainedAxis=void 0,al(e,t,n,L,!0,!1),o.constrainedAxis=O}else al(e,t,n,L,!0,!1);if(l(o.constrainedAxis)){const I=d.cross(o.direction,o.constrainedAxis,VD);d.equalsEpsilon(I,d.ZERO,F.EPSILON6)||(d.dot(I,o.right)<0&&d.negate(I,I),d.cross(I,o.direction,o.up),d.cross(o.direction,o.up,o.right),d.normalize(o.up,o.up),d.normalize(o.right,o.right))}o._setTransform(B),e._globe=v,e._ellipsoid=D;const H=D.maximumRadius;e._rotateFactor=1/H,e._rotateRateRangeAdjustment=H;const G=d.clone(o.positionWC,aR);if(e.enableCollisionDetection&&eU(e),!d.equals(o.positionWC,G)){o._setTransform(x),o.worldToCameraCoordinatesPoint(G,G);const I=d.magnitudeSquared(G);d.magnitudeSquared(o.position)>I&&(d.normalize(o.position,o.position),d.multiplyByScalar(o.position,Math.sqrt(I),o.position));const O=d.angleBetween(G,o.position),m=d.cross(G,o.position,G);d.normalize(m,m);const P=De.fromAxisAngle(m,O,Z6e),R=te.fromQuaternion(P,eWe);te.multiplyByVector(R,o.direction,o.direction),te.multiplyByVector(R,o.up,o.up),d.cross(o.direction,o.up,o.right),d.cross(o.right,o.direction,o.up),o._setTransform(B)}}const Pee=new $,Oee=new ii,Lee=new d;function oWe(e,t,n){l(n.distance)&&(n=n.distance);const i=e._scene,o=i.camera,r=i.canvas,s=e._cameraUnderground;let a;s?a=t:(a=Pee,a.x=r.clientWidth/2,a.y=r.clientHeight/2);const c=o.getPickRay(a,Oee),u=c.origin,f=c.direction,h=o.position.z;let _;h<e._minimumPickingTerrainHeight&&(_=t_(e,a,Lee));let g;if(l(_)&&(g=d.distance(u,_)),s){const p=Eee(e,c);l(g)?g=Math.min(g,p):g=p}if(!l(g)){const p=d.UNIT_X;g=-d.dot(p,u)/d.dot(p,f)}Kz(e,t,n,e._zoomFactor,g)}function rWe(e){const n=e._scene.camera;if(!N.equals(N.IDENTITY,n.transform))uc(e,e.enableRotate,e.rotateEventTypes,al,e.inertiaSpin,"_lastInertiaSpinMovement"),uc(e,e.enableZoom,e.zoomEventTypes,Bee,e.inertiaZoom,"_lastInertiaZoomMovement");else{const i=e._tweens;if(e._aggregator.anyButtonDown&&i.removeAll(),uc(e,e.enableTilt,e.tiltEventTypes,tWe,e.inertiaSpin,"_lastInertiaTiltMovement"),uc(e,e.enableTranslate,e.translateEventTypes,$6e,e.inertiaTranslate,"_lastInertiaTranslateMovement"),uc(e,e.enableZoom,e.zoomEventTypes,oWe,e.inertiaZoom,"_lastInertiaZoomMovement"),uc(e,e.enableLook,e.lookEventTypes,cl),!e._aggregator.anyButtonDown&&!i.contains(e._tween)){const o=n.createCorrectPositionTween(e.bounceAnimationTime);l(o)&&(e._tween=i.add(o))}i.update()}}const sWe=new ii,aWe=new Wt(d.UNIT_X,0),cWe=new d,lWe=new d,uWe=new d;function Jz(e,t,n){const i=e._scene,o=i.camera,r=o.getPickRay(t.endPosition,sWe);let s=d.clone(o.direction,lWe);i.mode===me.COLUMBUS_VIEW&&d.fromElements(s.z,s.x,s.y,s);const a=Wt.fromPointNormal(n,s,aWe),c=qr.rayPlane(r,a,cWe);l(c)&&(s=d.subtract(n,c,s),i.mode===me.COLUMBUS_VIEW&&d.fromElements(s.y,s.z,s.x,s),d.add(o.position,s,o.position))}const qW=new d,fWe=new ve,BF=new d,RF=new be,dWe=new d,hWe=new d;function pWe(e,t,n){const o=e._scene.camera,r=e._cameraUnderground;let s=e._ellipsoid;if(!N.equals(o.transform,N.IDENTITY)){al(e,t,n);return}let a,c;const u=s.geodeticSurfaceNormal(o.position,dWe);if($.equals(t,e._rotateMousePosition)){if(e._looking)cl(e,t,n,u);else if(e._rotating)al(e,t,n);else if(e._strafing)See(e,n);else{if(d.magnitude(o.position)<d.magnitude(e._rotateStartPosition))return;a=d.magnitude(e._rotateStartPosition),c=BF,c.x=c.y=c.z=a,s=be.fromCartesian3(c,RF),lR(e,t,n,s)}return}e._looking=!1,e._rotating=!1,e._strafing=!1;const f=s.cartesianToCartographic(o.positionWC,fWe).height,h=e._globe;if(l(h)&&f<e._minimumPickingTerrainHeight){const _=t_(e,n.startPosition,uWe);if(l(_)){let g=!1;const p=o.getPickRay(n.startPosition,bee);if(r)g=!0,wee(e,p,_,_);else{const y=s.geodeticSurfaceNormal(_,hWe);Math.abs(d.dot(p.direction,y))<.05?g=!0:g=d.magnitude(o.position)<d.magnitude(_)}g?($.clone(t,e._strafeEndMousePosition),d.clone(_,e._strafeStartPosition),e._strafing=!0,Jz(e,n,e._strafeStartPosition)):(a=d.magnitude(_),c=BF,c.x=c.y=c.z=a,s=be.fromCartesian3(c,RF),lR(e,t,n,s),d.clone(_,e._rotateStartPosition))}else e._looking=!0,cl(e,t,n,u)}else l(o.pickEllipsoid(n.startPosition,e._ellipsoid,qW))?(lR(e,t,n,e._ellipsoid),d.clone(qW,e._rotateStartPosition)):f>e._minimumTrackBallHeight?(e._rotating=!0,al(e,t,n)):(e._looking=!0,cl(e,t,n,u));$.clone(t,e._rotateMousePosition)}function al(e,t,n,i,o,r){o=A(o,!1),r=A(r,!1);const s=e._scene,a=s.camera,c=s.canvas,u=a.constrainedAxis;l(i)&&(a.constrainedAxis=i);const f=d.magnitude(a.position);let h=e._rotateFactor*(f-e._rotateRateRangeAdjustment);h>e._maximumRotateRate&&(h=e._maximumRotateRate),h<e._minimumRotateRate&&(h=e._minimumRotateRate);let _=(n.startPosition.x-n.endPosition.x)/c.clientWidth,g=(n.startPosition.y-n.endPosition.y)/c.clientHeight;_=Math.min(_,e.maximumMovementRatio),g=Math.min(g,e.maximumMovementRatio);const p=h*_*Math.PI*2,y=h*g*Math.PI;o||a.rotateRight(p),r||a.rotateUp(y),a.constrainedAxis=u}const mWe=ue.clone(ue.UNIT_W),_We=ue.clone(ue.UNIT_W),gv=new d,cR=new d,gWe=new d,yWe=new d,AWe=new $,TWe=new $;function lR(e,t,n,i){const r=e._scene.camera,s=$.clone(n.startPosition,AWe),a=$.clone(n.endPosition,TWe);let c=r.pickEllipsoid(s,i,mWe),u=r.pickEllipsoid(a,i,_We);if(!l(c)||!l(u)){e._rotating=!0,al(e,t,n);return}if(c=r.worldToCameraCoordinates(c,c),u=r.worldToCameraCoordinates(u,u),l(r.constrainedAxis)){const f=r.constrainedAxis,h=d.mostOrthogonalAxis(f,gv);d.cross(h,f,h),d.normalize(h,h);const _=d.cross(f,h,cR),g=d.magnitude(c),p=d.dot(f,c),y=Math.acos(p/g),T=d.multiplyByScalar(f,p,gWe);d.subtract(c,T,T),d.normalize(T,T);const b=d.magnitude(u),x=d.dot(f,u),v=Math.acos(x/b),D=d.multiplyByScalar(f,x,yWe);d.subtract(u,D,D),d.normalize(D,D);let L=Math.acos(d.dot(T,h));d.dot(T,_)<0&&(L=F.TWO_PI-L);let B=Math.acos(d.dot(D,h));d.dot(D,_)<0&&(B=F.TWO_PI-B);const V=L-B;let M;d.equalsEpsilon(f,r.position,F.EPSILON2)?M=r.right:M=d.cross(f,r.position,gv);const H=d.cross(f,M,gv),G=d.dot(H,d.subtract(c,f,cR)),I=d.dot(H,d.subtract(u,f,cR));let O;G>0&&I>0?O=v-y:G>0&&I<=0?d.dot(r.position,f)>0?O=-y-v:O=y+v:O=y-v,r.rotateRight(V),r.rotateUp(O)}else{d.normalize(c,c),d.normalize(u,u);const f=d.dot(c,u),h=d.cross(c,u,gv);if(f<1&&!d.equalsEpsilon(h,d.ZERO,F.EPSILON14)){const _=Math.acos(f);r.rotate(h,_)}}}const CWe=new d,bWe=new ve;function Bee(e,t,n){l(n.distance)&&(n=n.distance);const i=e._ellipsoid,o=e._scene,r=o.camera,s=o.canvas,a=e._cameraUnderground;let c;a?c=t:(c=Pee,c.x=s.clientWidth/2,c.y=s.clientHeight/2);const u=r.getPickRay(c,Oee);let f;const h=i.cartesianToCartographic(r.position,bWe).height;h<e._minimumPickingTerrainHeight&&(f=t_(e,c,Lee));let _;if(l(f)&&(_=d.distance(u.origin,f)),a){const p=Eee(e,u);l(_)?_=Math.min(_,p):_=p}l(_)||(_=h);const g=d.normalize(r.position,CWe);Kz(e,t,n,e._zoomFactor,_,d.dot(g,r.direction))}const Ree=new $,kD=new ii,Kb=new d,EWe=new d,Nee=new N,xWe=new N,Mee=new N,wWe=new De,SWe=new te,Qz=new ve,Zz=new d;function vWe(e,t,n){const o=e._scene.camera;if(!N.equals(o.transform,N.IDENTITY))return;if(l(n.angleAndHeight)&&(n=n.angleAndHeight),$.equals(t,e._tiltCenterMousePosition)||(e._tiltOnEllipsoid=!1,e._looking=!1),e._looking){const a=e._ellipsoid.geodeticSurfaceNormal(o.position,Zz);cl(e,t,n,a);return}const s=e._ellipsoid.cartesianToCartographic(o.position,Qz);e._tiltOnEllipsoid||s.height>e._minimumCollisionTerrainHeight?(e._tiltOnEllipsoid=!0,IWe(e,t,n)):PWe(e,t,n)}const DWe=new ve;function IWe(e,t,n){const i=e._ellipsoid,o=e._scene,r=o.camera,s=e.minimumZoomDistance*.25,a=i.cartesianToCartographic(r.positionWC,DWe).height;if(a-s-1<F.EPSILON3&&n.endPosition.y-n.startPosition.y<0)return;const c=o.canvas,u=Ree;u.x=c.clientWidth/2,u.y=c.clientHeight/2;const f=r.getPickRay(u,kD);let h;const _=qr.rayEllipsoid(f,i);if(l(_))h=ii.getPoint(f,_.start,Kb);else if(a>e._minimumTrackBallHeight){const x=qr.grazingAltitudeLocation(f,i);if(!l(x))return;const v=i.cartesianToCartographic(x,Qz);v.height=0,h=i.cartographicToCartesian(v,Kb)}else{e._looking=!0;const x=e._ellipsoid.geodeticSurfaceNormal(r.position,Zz);cl(e,t,n,x),$.clone(t,e._tiltCenterMousePosition);return}const g=En.eastNorthUpToFixedFrame(h,i,Nee),p=e._globe,y=e._ellipsoid;e._globe=void 0,e._ellipsoid=be.UNIT_SPHERE,e._rotateFactor=1,e._rotateRateRangeAdjustment=1;const T=N.clone(r.transform,Mee);r._setTransform(g),al(e,t,n,d.UNIT_Z),r._setTransform(T),e._globe=p,e._ellipsoid=y;const b=y.maximumRadius;e._rotateFactor=1/b,e._rotateRateRangeAdjustment=b}function PWe(e,t,n){const i=e._ellipsoid,o=e._scene,r=o.camera,s=e._cameraUnderground;let a,c,u;if($.equals(t,e._tiltCenterMousePosition))a=d.clone(e._tiltCenter,Kb);else{if(a=t_(e,t,Kb),!l(a)){if(c=r.getPickRay(t,kD),u=qr.rayEllipsoid(c,i),!l(u)){if(i.cartesianToCartographic(r.position,Qz).height<=e._minimumTrackBallHeight){e._looking=!0;const O=e._ellipsoid.geodeticSurfaceNormal(r.position,Zz);cl(e,t,n,O),$.clone(t,e._tiltCenterMousePosition)}return}a=ii.getPoint(c,u.start,Kb)}s&&(l(c)||(c=r.getPickRay(t,kD)),xee(e,c,a,a)),$.clone(t,e._tiltCenterMousePosition),d.clone(a,e._tiltCenter)}const f=o.canvas,h=Ree;h.x=f.clientWidth/2,h.y=e._tiltCenterMousePosition.y,c=r.getPickRay(h,kD);const _=d.magnitude(a),g=d.fromElements(_,_,_,BF),p=be.fromCartesian3(g,RF);if(u=qr.rayEllipsoid(c,p),!l(u))return;const y=d.magnitude(c.origin)>_?u.start:u.stop,T=ii.getPoint(c,y,EWe),b=En.eastNorthUpToFixedFrame(a,i,Nee),x=En.eastNorthUpToFixedFrame(T,p,xWe),v=e._globe,D=e._ellipsoid;e._globe=void 0,e._ellipsoid=be.UNIT_SPHERE,e._rotateFactor=1,e._rotateRateRangeAdjustment=1;let L=d.UNIT_Z;const B=N.clone(r.transform,Mee);r._setTransform(x);const V=d.cross(T,r.positionWC,VD);if(d.dot(r.rightWC,V)<0){const I=n.startPosition.y-n.endPosition.y;(s&&I<0||!s&&I>0)&&(L=void 0);const O=r.constrainedAxis;r.constrainedAxis=void 0,al(e,t,n,L,!0,!1),r.constrainedAxis=O}else al(e,t,n,L,!0,!1);if(r._setTransform(b),al(e,t,n,L,!1,!0),l(r.constrainedAxis)){const I=d.cross(r.direction,r.constrainedAxis,VD);d.equalsEpsilon(I,d.ZERO,F.EPSILON6)||(d.dot(I,r.right)<0&&d.negate(I,I),d.cross(I,r.direction,r.up),d.cross(r.direction,r.up,r.right),d.normalize(r.up,r.up),d.normalize(r.right,r.right))}r._setTransform(B),e._globe=v,e._ellipsoid=D;const H=D.maximumRadius;e._rotateFactor=1/H,e._rotateRateRangeAdjustment=H;const G=d.clone(r.positionWC,VD);if(e.enableCollisionDetection&&eU(e),!d.equals(r.positionWC,G)){r._setTransform(x),r.worldToCameraCoordinatesPoint(G,G);const I=d.magnitudeSquared(G);d.magnitudeSquared(r.position)>I&&(d.normalize(r.position,r.position),d.multiplyByScalar(r.position,Math.sqrt(I),r.position));const O=d.angleBetween(G,r.position),m=d.cross(G,r.position,G);d.normalize(m,m);const P=De.fromAxisAngle(m,O,wWe),R=te.fromQuaternion(P,SWe);te.multiplyByVector(R,r.direction,r.direction),te.multiplyByVector(R,r.up,r.up),d.cross(r.direction,r.up,r.right),d.cross(r.right,r.direction,r.up),r._setTransform(B)}}const OWe=new $,LWe=new $,jW=new ii,YW=new ii,BWe=new d,RWe=new d;function cl(e,t,n,i){const r=e._scene.camera,s=OWe;s.x=n.startPosition.x,s.y=0;const a=LWe;a.x=n.endPosition.x,a.y=0;let c=r.getPickRay(s,jW),u=r.getPickRay(a,YW),f=0,h,_;r.frustum instanceof nn?(h=c.origin,_=u.origin,d.add(r.direction,h,h),d.add(r.direction,_,_),d.subtract(h,r.position,h),d.subtract(_,r.position,_),d.normalize(h,h),d.normalize(_,_)):(h=c.direction,_=u.direction);let g=d.dot(h,_);g<1&&(f=Math.acos(g)),f=n.startPosition.x>n.endPosition.x?-f:f;const p=e._horizontalRotationAxis;if(l(i)?r.look(i,-f):l(p)?r.look(p,-f):r.lookLeft(f),s.x=0,s.y=n.startPosition.y,a.x=0,a.y=n.endPosition.y,c=r.getPickRay(s,jW),u=r.getPickRay(a,YW),f=0,r.frustum instanceof nn?(h=c.origin,_=u.origin,d.add(r.direction,h,h),d.add(r.direction,_,_),d.subtract(h,r.position,h),d.subtract(_,r.position,_),d.normalize(h,h),d.normalize(_,_)):(h=c.direction,_=u.direction),g=d.dot(h,_),g<1&&(f=Math.acos(g)),f=n.startPosition.y>n.endPosition.y?-f:f,i=A(i,p),l(i)){const y=r.direction,T=d.negate(i,BWe),b=d.equalsEpsilon(y,i,F.EPSILON2),x=d.equalsEpsilon(y,T,F.EPSILON2);if(!b&&!x){g=d.dot(y,i);let v=F.acosClamped(g);f>0&&f>v&&(f=v-F.EPSILON4),g=d.dot(y,T),v=F.acosClamped(g),f<0&&-f>v&&(f=-v+F.EPSILON4);const D=d.cross(i,y,RWe);r.look(D,f)}else(b&&f<0||x&&f>0)&&r.look(r.right,-f)}else r.lookUp(f)}function NWe(e){uc(e,e.enableRotate,e.rotateEventTypes,pWe,e.inertiaSpin,"_lastInertiaSpinMovement"),uc(e,e.enableZoom,e.zoomEventTypes,Bee,e.inertiaZoom,"_lastInertiaZoomMovement"),uc(e,e.enableTilt,e.tiltEventTypes,vWe,e.inertiaSpin,"_lastInertiaTiltMovement"),uc(e,e.enableLook,e.lookEventTypes,cl)}const MWe=new N,FWe=new ve;function eU(e){e._adjustedHeightForTerrain=!0;const t=e._scene,n=t.mode,i=t.globe;if(!l(i)||n===me.SCENE2D||n===me.MORPHING)return;const o=t.camera,r=i.ellipsoid,s=t.mapProjection;let a,c;N.equals(o.transform,N.IDENTITY)||(a=N.clone(o.transform,MWe),c=d.magnitude(o.position),o._setTransform(N.IDENTITY));const u=FWe;n===me.SCENE3D?r.cartesianToCartographic(o.position,u):s.unproject(o.position,u);let f=!1;if(u.height<e._minimumCollisionTerrainHeight){const h=e._scene.globeHeight;if(l(h)){const _=h+e.minimumZoomDistance;u.height<_&&(u.height=_,n===me.SCENE3D?r.cartographicToCartesian(u,o.position):s.project(u,o.position),f=!0)}}l(a)&&(o._setTransform(a),f&&(d.normalize(o.position,o.position),d.negate(o.position,o.direction),d.multiplyByScalar(o.position,Math.max(c,e.minimumZoomDistance),o.position),d.normalize(o.direction,o.direction),d.cross(o.direction,o.up,o.right),d.cross(o.right,o.direction,o.up)))}Dx.prototype.onMap=function(){const e=this._scene,t=e.mode,n=e.camera;return t===me.COLUMBUS_VIEW?Math.abs(n.position.x)-this._maxCoord.x<0&&Math.abs(n.position.y)-this._maxCoord.y<0:!0};const zWe=new d,UWe=new d;Dx.prototype.update=function(){const e=this._scene,t=e.camera,n=e.globe,i=e.mode;N.equals(t.transform,N.IDENTITY)?(this._globe=n,this._ellipsoid=l(this._globe)?this._globe.ellipsoid:e.mapProjection.ellipsoid):(this._globe=void 0,this._ellipsoid=be.UNIT_SPHERE);const o=l(this._globe)?this._globe.terrainExaggeration:1,r=l(this._globe)?this._globe.terrainExaggerationRelativeHeight:0;this._minimumCollisionTerrainHeight=Fm.getHeight(this.minimumCollisionTerrainHeight,o,r),this._minimumPickingTerrainHeight=Fm.getHeight(this.minimumPickingTerrainHeight,o,r),this._minimumTrackBallHeight=Fm.getHeight(this.minimumTrackBallHeight,o,r),this._cameraUnderground=e.cameraUnderground&&l(this._globe);const s=this._ellipsoid.maximumRadius;this._rotateFactor=1/s,this._rotateRateRangeAdjustment=s,this._adjustedHeightForTerrain=!1;const a=d.clone(t.positionWC,zWe),c=d.clone(t.directionWC,UWe);i===me.SCENE2D?N6e(this):i===me.COLUMBUS_VIEW?(this._horizontalRotationAxis=d.UNIT_Z,rWe(this)):i===me.SCENE3D&&(this._horizontalRotationAxis=void 0,NWe(this)),this.enableCollisionDetection&&!this._adjustedHeightForTerrain&&(!d.equals(a,t.positionWC)||!d.equals(c,t.directionWC))&&eU(this),this._aggregator.reset()};Dx.prototype.isDestroyed=function(){return!1};Dx.prototype.destroy=function(){return this._tweens.removeAll(),this._aggregator=this._aggregator&&this._aggregator.destroy(),Je(this)};const HWe=`uniform sampler2D colorTexture;
|
||
uniform sampler2D colorTexture2;
|
||
|
||
uniform vec2 center;
|
||
uniform float radius;
|
||
|
||
varying vec2 v_textureCoordinates;
|
||
|
||
void main()
|
||
{
|
||
vec4 color0 = texture2D(colorTexture, v_textureCoordinates);
|
||
vec4 color1 = texture2D(colorTexture2, v_textureCoordinates);
|
||
|
||
float x = length(gl_FragCoord.xy - center) / radius;
|
||
float t = smoothstep(0.5, 0.8, x);
|
||
gl_FragColor = mix(color0 + color1, color1, t);
|
||
}
|
||
`,VWe=`uniform sampler2D colorTexture;
|
||
|
||
uniform float avgLuminance;
|
||
uniform float threshold;
|
||
uniform float offset;
|
||
|
||
varying vec2 v_textureCoordinates;
|
||
|
||
float key(float avg)
|
||
{
|
||
float guess = 1.5 - (1.5 / (avg * 0.1 + 1.0));
|
||
return max(0.0, guess) + 0.1;
|
||
}
|
||
|
||
// See section 9. "The bright-pass filter" of Realtime HDR Rendering
|
||
// http://www.cg.tuwien.ac.at/research/publications/2007/Luksch_2007_RHR/Luksch_2007_RHR-RealtimeHDR%20.pdf
|
||
|
||
void main()
|
||
{
|
||
vec4 color = texture2D(colorTexture, v_textureCoordinates);
|
||
vec3 xyz = czm_RGBToXYZ(color.rgb);
|
||
float luminance = xyz.r;
|
||
|
||
float scaledLum = key(avgLuminance) * luminance / avgLuminance;
|
||
float brightLum = max(scaledLum - threshold, 0.0);
|
||
float brightness = brightLum / (offset + brightLum);
|
||
|
||
xyz.r = brightness;
|
||
gl_FragColor = vec4(czm_XYZToRGB(xyz), 1.0);
|
||
}
|
||
`;function pp(){this._sceneFramebuffer=new Md;const e=.125,t=new Array(6);t[0]=new eo({fragmentShader:sy,textureScale:e,forcePowerOfTwo:!0,sampleMode:ay.LINEAR});const n=t[1]=new eo({fragmentShader:VWe,uniforms:{avgLuminance:.5,threshold:.25,offset:.1},textureScale:e,forcePowerOfTwo:!0}),i=this;this._delta=1,this._sigma=2,this._blurStep=new $,t[2]=new eo({fragmentShader:vF,uniforms:{step:function(){return i._blurStep.x=i._blurStep.y=1/n.outputTexture.width,i._blurStep},delta:function(){return i._delta},sigma:function(){return i._sigma},direction:0},textureScale:e,forcePowerOfTwo:!0}),t[3]=new eo({fragmentShader:vF,uniforms:{step:function(){return i._blurStep.x=i._blurStep.y=1/n.outputTexture.width,i._blurStep},delta:function(){return i._delta},sigma:function(){return i._sigma},direction:1},textureScale:e,forcePowerOfTwo:!0}),t[4]=new eo({fragmentShader:sy,sampleMode:ay.LINEAR}),this._uCenter=new $,this._uRadius=void 0,t[5]=new eo({fragmentShader:HWe,uniforms:{center:function(){return i._uCenter},radius:function(){return i._uRadius},colorTexture2:function(){return i._sceneFramebuffer.framebuffer.getColorTexture(0)}}}),this._stages=new ja({stages:t});const o=new zd(this),r=t.length;for(let s=0;s<r;++s)t[s]._textureCache=o;this._textureCache=o,this.length=t.length}pp.prototype.get=function(e){return this._stages.get(e)};pp.prototype.getStageByName=function(e){const t=this._stages.length;for(let n=0;n<t;++n){const i=this._stages.get(n);if(i.name===e)return i}};const kWe=new ue,$W=new $,GWe=new $,XW=new N;function WWe(e,t,n){const i=t.uniformState,o=i.sunPositionWC,r=i.view,s=i.viewProjection,a=i.projection;let c=N.computeViewportTransformation(n,0,1,XW);const u=N.multiplyByPoint(r,o,kWe);let f=En.pointToGLWindowCoordinates(s,c,o,$W);u.x+=F.SOLAR_RADIUS;const h=En.pointToGLWindowCoordinates(a,c,u,u),_=$.magnitude($.subtract(h,f,h))*30*2,g=GWe;g.x=_,g.y=_,e._uCenter=$.clone(f,e._uCenter),e._uRadius=Math.max(g.x,g.y)*.15;const p=t.drawingBufferWidth,y=t.drawingBufferHeight,T=e._stages,b=T.get(0),x=b.outputTexture.width,v=b.outputTexture.height,D=new at;D.width=x,D.height=v,c=N.computeViewportTransformation(D,0,1,XW),f=En.pointToGLWindowCoordinates(s,c,o,$W),g.x*=x/p,g.y*=v/y;const L=b.scissorRectangle;L.x=Math.max(f.x-g.x*.5,0),L.y=Math.max(f.y-g.y*.5,0),L.width=Math.min(g.x,p),L.height=Math.min(g.y,y);for(let B=1;B<4;++B)at.clone(L,T.get(B).scissorRectangle)}pp.prototype.clear=function(e,t,n){this._sceneFramebuffer.clear(e,t,n),this._textureCache.clear(e)};pp.prototype.update=function(e){const t=e.context,n=e.viewport,i=this._sceneFramebuffer;i.update(t,n);const o=i.framebuffer;return this._textureCache.update(t),this._stages.update(t,!1),WWe(this,t,n),o};pp.prototype.execute=function(e){const t=this._sceneFramebuffer.framebuffer.getColorTexture(0),n=this._stages,i=n.length;n.get(0).execute(e,t);for(let o=1;o<i;++o)n.get(o).execute(e,n.get(o-1).outputTexture)};pp.prototype.copy=function(e,t){if(!l(this._copyColorCommand)){const n=this;this._copyColorCommand=e.createViewportQuadCommand(sy,{uniformMap:{colorTexture:function(){return n._stages.get(n._stages.length-1).outputTexture}},owner:this})}this._copyColorCommand.framebuffer=t,this._copyColorCommand.execute(e)};pp.prototype.isDestroyed=function(){return!1};pp.prototype.destroy=function(){return this._textureCache.destroy(),this._stages.destroy(),Je(this)};function Fee(){this._cachedShowFrustumsShaders={}}function qWe(e){const t={},n=e.vertexAttributes;for(const i in n)n.hasOwnProperty(i)&&(t[i]=n[i].index);return t}function jWe(e,t){const n=e.context,i=t,o=i.fragmentShaderSource.clone(),r=[];o.sources=o.sources.map(function(f){f=nt.replaceMain(f,"czm_Debug_main");const h=/gl_FragData\[(\d+)\]/g;let _;for(;(_=h.exec(f))!==null;)r.indexOf(_[1])===-1&&r.push(_[1]);return f});const s=r.length;let a="";a+=`uniform vec3 debugShowCommandsColor;
|
||
`,a+=`uniform vec3 debugShowFrustumsColor;
|
||
`,a+=`void main()
|
||
{
|
||
czm_Debug_main();
|
||
`;let c;if(s>0)for(c=0;c<s;++c)a+=` gl_FragData[${r[c]}].rgb *= debugShowCommandsColor;
|
||
`,a+=` gl_FragData[${r[c]}].rgb *= debugShowFrustumsColor;
|
||
`;else a+=` gl_FragColor.rgb *= debugShowCommandsColor;
|
||
`,a+=` gl_FragColor.rgb *= debugShowFrustumsColor;
|
||
`;a+="}",o.sources.push(a);const u=qWe(i);return Hn.fromCache({context:n,vertexShaderSource:i.vertexShaderSource,fragmentShaderSource:o,attributeLocations:u})}const FC=new k;function YWe(e,t){let n;return l(t.uniformMap)?n=t.uniformMap:n={},l(n.debugShowCommandsColor)||l(n.debugShowFrustumsColor)||(n.debugShowCommandsColor=function(){return e.debugShowCommands?(l(t._debugColor)||(t._debugColor=k.fromRandom()),t._debugColor):k.WHITE},n.debugShowFrustumsColor=function(){return e.debugShowFrustums?(FC.red=t.debugOverlappingFrustums&1<<0?1:0,FC.green=t.debugOverlappingFrustums&1<<1?1:0,FC.blue=t.debugOverlappingFrustums&1<<2?1:0,FC.alpha=1,FC):k.WHITE}),n}const $We=new Dt;Fee.prototype.executeDebugShowFrustumsCommand=function(e,t,n){const i=t.shaderProgram.id;let o=this._cachedShowFrustumsShaders[i];l(o)||(o=jWe(e,t.shaderProgram),this._cachedShowFrustumsShaders[i]=o);const r=Dt.shallowClone(t,$We);r.shaderProgram=o,r.uniformMap=YWe(e,t),r.execute(e.context,n)};const qI=function(e){return function(){e.frameState.afterRender.push(function(){e.requestRender()})}};function ki(e){e=A(e,A.EMPTY_OBJECT);const t=e.canvas;let n=e.creditContainer,i=e.creditViewport;const o=St(e.contextOptions);if(!l(t))throw new w("options and options.canvas are required.");const r=l(n),s=new Hc(t,o);r||(n=document.createElement("div"),n.style.position="absolute",n.style.bottom="0",n.style["text-shadow"]="0 0 2px #000000",n.style.color="#ffffff",n.style["font-size"]="10px",n.style["padding-right"]="5px",t.parentNode.appendChild(n)),l(i)||(i=t.parentNode),this._id=ma(),this._jobScheduler=new zm,this._frameState=new L4e(s,new _r(n," • ",i),this._jobScheduler),this._frameState.scene3DOnly=A(e.scene3DOnly,!1),this._removeCreditContainer=!r,this._creditContainer=n,this._canvas=t,this._context=s,this._computeEngine=new G1(s),this._globe=void 0,this._globeTranslucencyState=new Ny,this._primitives=new Tr,this._groundPrimitives=new Tr,this._globeHeight=void 0,this._cameraUnderground=!1,this._logDepthBuffer=s.fragmentDepth,this._logDepthBufferDirty=!0,this._tweens=new Su,this._shaderFrameCount=0,this._sunPostProcess=void 0,this._computeCommandList=[],this._overlayCommandList=[],this._useOIT=A(e.orderIndependentTranslucency,!0),this._executeOITFunction=void 0,this._depthPlane=new Ex(e.depthPlaneEllipsoidOffset),this._clearColorCommand=new Bo({color:new k,stencil:0,owner:this}),this._depthClearCommand=new Bo({depth:1,owner:this}),this._stencilClearCommand=new Bo({stencil:0}),this._classificationStencilClearCommand=new Bo({stencil:0,renderState:ht.fromCache({stencilMask:Kt.CLASSIFICATION_MASK})}),this._depthOnlyRenderStateCache={},this._transitioner=new Hy(this),this._preUpdate=new lt,this._postUpdate=new lt,this._renderError=new lt,this._preRender=new lt,this._postRender=new lt,this._minimumDisableDepthTestDistance=0,this._debugInspector=new Fee,this._msaaSamples=A(e.msaaSamples,1),this.rethrowRenderErrors=!1,this.completeMorphOnUserInput=!0,this.morphStart=new lt,this.morphComplete=new lt,this.skyBox=void 0,this.skyAtmosphere=void 0,this.sun=void 0,this.sunBloom=!0,this._sunBloom=void 0,this.moon=void 0,this.backgroundColor=k.clone(k.BLACK),this._mode=me.SCENE3D,this._mapProjection=l(e.mapProjection)?e.mapProjection:new Or,this.morphTime=1,this.farToNearRatio=1e3,this.logarithmicDepthFarToNearRatio=1e9,this.nearToFarDistance2D=175e4,this.debugCommandFilter=void 0,this.debugShowCommands=!1,this.debugShowFrustums=!1,this.debugShowFramesPerSecond=!1,this.debugShowDepthFrustum=1,this.debugShowFrustumPlanes=!1,this._debugShowFrustumPlanes=!1,this._debugFrustumPlanes=void 0,this.useDepthPicking=!0,this.pickTranslucentDepth=!1,this.cameraEventWaitTime=500,this.fog=new wZ,this._shadowMapCamera=new Tt(this),this.shadowMap=new El({context:s,lightCamera:this._shadowMapCamera,enabled:A(e.shadows,!1)}),this.invertClassification=!1,this.invertClassificationColor=k.clone(k.WHITE),this._actualInvertClassificationColor=k.clone(this._invertClassificationColor),this._invertClassification=new If,this.focalLength=void 0,this.eyeSeparation=void 0,this.postProcessStages=new Cc,this._brdfLutGenerator=new Cx,this._performanceDisplay=void 0,this._debugVolume=void 0,this._screenSpaceCameraController=new Dx(this),this._cameraUnderground=!1,this._mapMode2D=A(e.mapMode2D,Zm.INFINITE_SCROLL),this._environmentState={skyBoxCommand:void 0,skyAtmosphereCommand:void 0,sunDrawCommand:void 0,sunComputeCommand:void 0,moonCommand:void 0,isSunVisible:!1,isMoonVisible:!1,isReadyForAtmosphere:!1,isSkyAtmosphereVisible:!1,clearGlobeDepth:!1,useDepthPlane:!1,renderTranslucentDepthForPick:!1,originalFramebuffer:void 0,useGlobeDepthFramebuffer:!1,useOIT:!1,useInvertClassification:!1,usePostProcess:!1,usePostProcessSelected:!1,useWebVR:!1},this._useWebVR=!1,this._cameraVR=void 0,this._aspectRatioVR=void 0,this.requestRenderMode=A(e.requestRenderMode,!1),this._renderRequested=!0,this.maximumRenderTimeChange=A(e.maximumRenderTimeChange,0),this._lastRenderTime=void 0,this._frameRateMonitor=void 0,this._removeRequestListenerCallback=Ui.requestCompletedEvent.addEventListener(qI(this)),this._removeTaskProcessorListenerCallback=lo.taskCompletedEvent.addEventListener(qI(this)),this._removeGlobeCallbacks=[];const a=new at(0,0,s.drawingBufferWidth,s.drawingBufferHeight),c=new Tt(this);this._logDepthBuffer&&(c.frustum.near=.1,c.frustum.far=1e10),this.preloadFlightCamera=new Tt(this),this.preloadFlightCullingVolume=void 0,this._picking=new ga(this),this._defaultView=new Sx(this,c,a),this._view=this._defaultView,this._hdr=void 0,this._hdrDirty=void 0,this.highDynamicRange=!1,this.gamma=2.2,this.sphericalHarmonicCoefficients=void 0,this.specularEnvironmentMaps=void 0,this._specularEnvironmentMapAtlas=void 0,this.light=new j1,zee(this,0,ce.now()),this.updateFrameState(),this.initializeFrame()}function XWe(e,t){for(let i=0;i<e._removeGlobeCallbacks.length;++i)e._removeGlobeCallbacks[i]();e._removeGlobeCallbacks.length=0;const n=[];l(t)&&(n.push(t.imageryLayersUpdatedEvent.addEventListener(qI(e))),n.push(t.terrainProviderChanged.addEventListener(qI(e)))),e._removeGlobeCallbacks=n}Object.defineProperties(ki.prototype,{canvas:{get:function(){return this._canvas}},drawingBufferHeight:{get:function(){return this._context.drawingBufferHeight}},drawingBufferWidth:{get:function(){return this._context.drawingBufferWidth}},maximumAliasedLineWidth:{get:function(){return Gt.maximumAliasedLineWidth}},maximumCubeMapSize:{get:function(){return Gt.maximumCubeMapSize}},pickPositionSupported:{get:function(){return this._context.depthTexture}},sampleHeightSupported:{get:function(){return this._context.depthTexture}},clampToHeightSupported:{get:function(){return this._context.depthTexture}},invertClassificationSupported:{get:function(){return this._context.depthTexture}},specularEnvironmentMapsSupported:{get:function(){return gf.isSupported(this._context)}},globe:{get:function(){return this._globe},set:function(e){this._globe=this._globe&&this._globe.destroy(),this._globe=e,XWe(this,e)}},primitives:{get:function(){return this._primitives}},groundPrimitives:{get:function(){return this._groundPrimitives}},camera:{get:function(){return this._view.camera},set:function(e){this._view.camera=e}},view:{get:function(){return this._view},set:function(e){this._view=e}},defaultView:{get:function(){return this._defaultView}},picking:{get:function(){return this._picking}},screenSpaceCameraController:{get:function(){return this._screenSpaceCameraController}},mapProjection:{get:function(){return this._mapProjection}},jobScheduler:{get:function(){return this._jobScheduler}},frameState:{get:function(){return this._frameState}},environmentState:{get:function(){return this._environmentState}},tweens:{get:function(){return this._tweens}},imageryLayers:{get:function(){if(l(this.globe))return this.globe.imageryLayers}},terrainProvider:{get:function(){if(l(this.globe))return this.globe.terrainProvider},set:function(e){l(this.globe)&&(this.globe.terrainProvider=e)}},terrainProviderChanged:{get:function(){if(l(this.globe))return this.globe.terrainProviderChanged}},preUpdate:{get:function(){return this._preUpdate}},postUpdate:{get:function(){return this._postUpdate}},renderError:{get:function(){return this._renderError}},preRender:{get:function(){return this._preRender}},postRender:{get:function(){return this._postRender}},lastRenderTime:{get:function(){return this._lastRenderTime}},context:{get:function(){return this._context}},debugFrustumStatistics:{get:function(){return this._view.debugFrustumStatistics}},scene3DOnly:{get:function(){return this._frameState.scene3DOnly}},orderIndependentTranslucency:{get:function(){return this._useOIT}},id:{get:function(){return this._id}},mode:{get:function(){return this._mode},set:function(e){if(this.scene3DOnly&&e!==me.SCENE3D)throw new w("Only SceneMode.SCENE3D is valid when scene3DOnly is true.");if(e===me.SCENE2D)this.morphTo2D(0);else if(e===me.SCENE3D)this.morphTo3D(0);else if(e===me.COLUMBUS_VIEW)this.morphToColumbusView(0);else throw new w("value must be a valid SceneMode enumeration.");this._mode=e}},frustumCommandsList:{get:function(){return this._view.frustumCommandsList}},numberOfFrustums:{get:function(){return this._view.frustumCommandsList.length}},useWebVR:{get:function(){return this._useWebVR},set:function(e){if(this.camera.frustum instanceof nn)throw new w("VR is unsupported with an orthographic projection.");this._useWebVR=e,this._useWebVR?(this._frameState.creditDisplay.container.style.visibility="hidden",this._cameraVR=new Tt(this),l(this._deviceOrientationCameraController)||(this._deviceOrientationCameraController=new lP(this)),this._aspectRatioVR=this.camera.frustum.aspectRatio):(this._frameState.creditDisplay.container.style.visibility="visible",this._cameraVR=void 0,this._deviceOrientationCameraController=this._deviceOrientationCameraController&&!this._deviceOrientationCameraController.isDestroyed()&&this._deviceOrientationCameraController.destroy(),this.camera.frustum.aspectRatio=this._aspectRatioVR,this.camera.frustum.xOffset=0)}},mapMode2D:{get:function(){return this._mapMode2D}},splitPosition:{get:function(){return this._frameState.splitPosition},set:function(e){this._frameState.splitPosition=e}},minimumDisableDepthTestDistance:{get:function(){return this._minimumDisableDepthTestDistance},set:function(e){if(!l(e)||e<0)throw new w("minimumDisableDepthTestDistance must be greater than or equal to 0.0.");this._minimumDisableDepthTestDistance=e}},logarithmicDepthBuffer:{get:function(){return this._logDepthBuffer},set:function(e){e=this._context.fragmentDepth&&e,this._logDepthBuffer!==e&&(this._logDepthBuffer=e,this._logDepthBufferDirty=!0)}},gamma:{get:function(){return this._context.uniformState.gamma},set:function(e){this._context.uniformState.gamma=e}},highDynamicRange:{get:function(){return this._hdr},set:function(e){const t=this._context,n=e&&t.depthTexture&&(t.colorBufferFloat||t.colorBufferHalfFloat);this._hdrDirty=n!==this._hdr,this._hdr=n}},highDynamicRangeSupported:{get:function(){const e=this._context;return e.depthTexture&&(e.colorBufferFloat||e.colorBufferHalfFloat)}},cameraUnderground:{get:function(){return this._cameraUnderground}},msaaSamples:{get:function(){return this._msaaSamples},set:function(e){e=Math.min(e,Gt.maximumSamples),this._msaaSamples=e}},msaaSupported:{get:function(){return this._context.msaa}},pixelRatio:{get:function(){return this._frameState.pixelRatio},set:function(e){this._frameState.pixelRatio=e}},opaqueFrustumNearOffset:{get:function(){return .9999}},globeHeight:{get:function(){return this._globeHeight}}});ki.prototype.getCompressedTextureFormatSupported=function(e){const t=this.context;return(e==="WEBGL_compressed_texture_s3tc"||e==="s3tc")&&t.s3tc||(e==="WEBGL_compressed_texture_pvrtc"||e==="pvrtc")&&t.pvrtc||(e==="WEBGL_compressed_texture_etc"||e==="etc")&&t.etc||(e==="WEBGL_compressed_texture_etc1"||e==="etc1")&&t.etc1||(e==="WEBGL_compressed_texture_astc"||e==="astc")&&t.astc||(e==="EXT_texture_compression_bptc"||e==="bc7")&&t.bc7};function KW(e,t,n){const i=e._frameState,o=e._context,r=e._view.oit,s=i.shadowState.lightShadowMaps,a=i.shadowState.lightShadowsEnabled;let c=t.derivedCommands;l(t.pickId)&&(c.picking=Fh.createPickDerivedCommand(e,t,o,c.picking)),t.pickOnly||(c.depth=Fh.createDepthOnlyDerivedCommand(e,t,o,c.depth)),c.originalCommand=t,e._hdr&&(c.hdr=Fh.createHdrCommand(t,o,c.hdr),t=c.hdr.command,c=t.derivedCommands),a&&t.receiveShadows&&(c.shadows=El.createReceiveDerivedCommand(s,t,n,o,c.shadows)),t.pass===We.TRANSLUCENT&&l(r)&&r.isSupported()&&(a&&t.receiveShadows?(c.oit=l(c.oit)?c.oit:{},c.oit.shadows=r.createDerivedCommands(c.shadows.receiveCommand,o,c.oit.shadows)):c.oit=r.createDerivedCommands(t,o,c.oit))}ki.prototype.updateDerivedCommands=function(e){if(!l(e.derivedCommands))return;const t=this._frameState,n=this._context;let i=!1;const o=t.shadowState.lastDirtyTime;e.lastDirtyTime!==o&&(e.lastDirtyTime=o,e.dirty=!0,i=!0);const r=t.useLogDepth,s=this._hdr,a=e.derivedCommands,c=l(a.logDepth),u=l(a.hdr),f=l(a.originalCommand),h=r&&!c,_=s&&!u,g=(!r||!s)&&!f;if(e.dirty=e.dirty||h||_||g,e.dirty){e.dirty=!1;const p=t.shadowState.shadowMaps;t.shadowState.shadowsEnabled&&e.castShadows&&(a.shadows=El.createCastDerivedCommand(p,e,i,n,a.shadows)),(c||h)&&(a.logDepth=Fh.createLogDepthCommand(e,n,a.logDepth),KW(this,a.logDepth.command,i)),(f||g)&&KW(this,e,i)}};const KWe=new Ry({pass:Va.RENDER}),uR=new Ry({pass:Va.PRELOAD}),fR=new Ry({pass:Va.PRELOAD_FLIGHT}),JWe=new Ry({pass:Va.REQUEST_RENDER_MODE_DEFER_CHECK}),JW=new Ae;let dR;function QWe(e){const t=e.globe;if(e._mode===me.SCENE3D&&l(t)&&t.show&&!e._cameraUnderground&&!e._globeTranslucencyState.translucent){const n=t.ellipsoid,i=e.frameState.minimumTerrainHeight;return JW.radius=n.minimumRadius+i,dR=Ha.fromBoundingSphere(JW,e.camera.positionWC,dR),dR}}ki.prototype.clearPasses=function(e){e.render=!1,e.pick=!1,e.depth=!1,e.postProcess=!1,e.offscreen=!1};function zee(e,t,n){const i=e._frameState;i.frameNumber=t,i.time=ce.clone(n,i.time)}ki.prototype.updateFrameState=function(){const e=this.camera,t=this._frameState;t.commandList.length=0,t.shadowMaps.length=0,t.brdfLutGenerator=this._brdfLutGenerator,t.environmentMap=this.skyBox&&this.skyBox._cubeMap,t.mode=this._mode,t.morphTime=this.morphTime,t.mapProjection=this.mapProjection,t.camera=e,t.cullingVolume=e.frustum.computeCullingVolume(e.positionWC,e.directionWC,e.upWC),t.occluder=QWe(this),t.minimumTerrainHeight=0,t.minimumDisableDepthTestDistance=this._minimumDisableDepthTestDistance,t.invertClassification=this.invertClassification,t.useLogDepth=this._logDepthBuffer&&!(this.camera.frustum instanceof nn||this.camera.frustum instanceof yr),t.light=this.light,t.cameraUnderground=this._cameraUnderground,t.globeTranslucencyState=this._globeTranslucencyState,l(this.globe)&&(t.terrainExaggeration=this.globe.terrainExaggeration,t.terrainExaggerationRelativeHeight=this.globe.terrainExaggerationRelativeHeight),l(this._specularEnvironmentMapAtlas)&&this._specularEnvironmentMapAtlas.ready?(t.specularEnvironmentMaps=this._specularEnvironmentMapAtlas.texture,t.specularEnvironmentMapsMaximumLOD=this._specularEnvironmentMapAtlas.maximumMipmapLevel):(t.specularEnvironmentMaps=void 0,t.specularEnvironmentMapsMaximumLOD=void 0),t.sphericalHarmonicCoefficients=this.sphericalHarmonicCoefficients,this._actualInvertClassificationColor=k.clone(this.invertClassificationColor,this._actualInvertClassificationColor),If.isTranslucencySupported(this._context)||(this._actualInvertClassificationColor.alpha=1),t.invertClassificationColor=this._actualInvertClassificationColor,l(this.globe)?t.maximumScreenSpaceError=this.globe.maximumScreenSpaceError:t.maximumScreenSpaceError=2,this.clearPasses(t.passes),t.tilesetPassState=void 0};ki.prototype.isVisible=function(e,t,n){return l(e)&&(!l(e.boundingVolume)||!e.cull||t.computeVisibility(e.boundingVolume)!==Vn.OUTSIDE&&(!l(n)||!e.occlude||!e.boundingVolume.isOccluded(n)))};let GD=new N(0,0,1,0,1,0,0,0,0,1,0,0,0,0,0,1);GD=N.inverseTransformation(GD,GD);function ZWe(e,t,n,i){const o=t._frameState,r=o.context,s=e.boundingVolume;l(t._debugVolume)&&t._debugVolume.destroy();let a,c=d.clone(s.center);if(o.mode!==me.SCENE3D){c=N.multiplyByPoint(GD,c,c);const _=o.mapProjection,g=_.unproject(c);c=_.ellipsoid.cartographicToCartesian(g)}if(l(s.radius)){const _=s.radius;a=mo.toWireframe(sl.createGeometry(new sl({radii:new d(_,_,_),vertexFormat:kn.FLAT_VERTEX_FORMAT}))),t._debugVolume=new fn({geometryInstances:new xn({geometry:a,modelMatrix:N.fromTranslation(c),attributes:{color:new Bn(1,0,0,1)}}),appearance:new kn({flat:!0,translucent:!1}),asynchronous:!1})}else{const _=s.halfAxes;a=mo.toWireframe(Ss.createGeometry(Ss.fromDimensions({dimensions:new d(2,2,2),vertexFormat:kn.FLAT_VERTEX_FORMAT}))),t._debugVolume=new fn({geometryInstances:new xn({geometry:a,modelMatrix:N.fromRotationTranslation(_,c,new N),attributes:{color:new Bn(1,0,0,1)}}),appearance:new kn({flat:!0,translucent:!1}),asynchronous:!1})}const u=o.commandList,f=o.commandList=[];t._debugVolume.update(o),e=f[0],o.useLogDepth&&(e=Fh.createLogDepthCommand(e,r).command);let h;l(i)&&(h=n.framebuffer,n.framebuffer=i),e.execute(r,n),l(h)&&(n.framebuffer=h),o.commandList=u}function ia(e,t,n,i,o){const r=t._frameState;if(l(t.debugCommandFilter)&&!t.debugCommandFilter(e))return;if(e instanceof Bo){e.execute(n,i);return}e.debugShowBoundingVolume&&l(e.boundingVolume)&&ZWe(e,t,i,o),r.useLogDepth&&l(e.derivedCommands.logDepth)&&(e=e.derivedCommands.logDepth.command);const s=r.passes;if(!s.pick&&!s.depth&&t._hdr&&l(e.derivedCommands)&&l(e.derivedCommands.hdr)&&(e=e.derivedCommands.hdr.command),s.pick||s.depth){if(s.pick&&!s.depth&&l(e.derivedCommands.picking)){e=e.derivedCommands.picking.pickCommand,e.execute(n,i);return}else if(l(e.derivedCommands.depth)){e=e.derivedCommands.depth.depthOnlyCommand,e.execute(n,i);return}}if(t.debugShowCommands||t.debugShowFrustums){t._debugInspector.executeDebugShowFrustumsCommand(t,e,i);return}r.shadowState.lightShadowsEnabled&&e.receiveShadows&&l(e.derivedCommands.shadows)?e.derivedCommands.shadows.receiveCommand.execute(n,i):e.execute(n,i)}function zC(e,t,n,i){const o=t._frameState;let r=e.derivedCommands;l(r)&&(o.useLogDepth&&l(r.logDepth)&&(e=r.logDepth.command),r=e.derivedCommands,l(r.picking)?(e=r.picking.pickCommand,e.execute(n,i)):l(r.depth)&&(e=r.depth.depthOnlyCommand,e.execute(n,i)))}function Uee(e,t,n){return t.boundingVolume.distanceSquaredTo(n)-e.boundingVolume.distanceSquaredTo(n)}function e9e(e,t,n){return e.boundingVolume.distanceSquaredTo(n)-t.boundingVolume.distanceSquaredTo(n)+F.EPSILON12}function t9e(e,t,n,i,o){const r=e.context;xz(i,Uee,e.camera.positionWC),l(o)&&t(o.unclassifiedCommand,e,r,n);const s=i.length;for(let a=0;a<s;++a)t(i[a],e,r,n)}function n9e(e,t,n,i,o){const r=e.context;xz(i,e9e,e.camera.positionWC),l(o)&&t(o.unclassifiedCommand,e,r,n);const s=i.length;for(let a=0;a<s;++a)t(i[a],e,r,n)}function i9e(e,t,n,i){const o=e.context;xz(i,Uee,e.camera.positionWC);const r=i.length;for(let s=0;s<r;++s)t(i[s],e,o,n)}const o9e=new hi,r9e=new Wa,s9e=new nn,a9e=new yr;function NF(e,t){const n=e.camera,i=e.context,o=e.frameState,r=i.uniformState;r.updateCamera(n);let s;l(n.frustum.fov)?s=n.frustum.clone(o9e):l(n.frustum.infiniteProjectionMatrix)?s=n.frustum.clone(r9e):l(n.frustum.width)?s=n.frustum.clone(s9e):s=n.frustum.clone(a9e),s.near=n.frustum.near,s.far=n.frustum.far,r.updateFrustum(s),r.updatePass(We.ENVIRONMENT);const a=o.passes,c=a.pick,u=e._environmentState,f=e._view,h=u.renderTranslucentDepthForPick,_=u.useWebVR;if(!c){const O=u.skyBoxCommand;if(l(O)&&ia(O,e,i,t),u.isSkyAtmosphereVisible&&ia(u.skyAtmosphereCommand,e,i,t),u.isSunVisible&&(u.sunDrawCommand.execute(i,t),e.sunBloom&&!_)){let m;u.useGlobeDepthFramebuffer?m=f.globeDepth.framebuffer:u.usePostProcess?m=f.sceneFramebuffer.framebuffer:m=u.originalFramebuffer,e._sunPostProcess.execute(i),e._sunPostProcess.copy(i,m),t.framebuffer=m}u.isMoonVisible&&u.moonCommand.execute(i,t)}let g;u.useOIT?(l(e._executeOITFunction)||(e._executeOITFunction=function(O,m,P,R,U){f.globeDepth.prepareColorTextures(i),f.oit.executeCommands(O,m,P,R,U)}),g=e._executeOITFunction):a.render?g=t9e:g=n9e;const p=f.frustumCommandsList,y=p.length,T=u.clearGlobeDepth,b=u.useDepthPlane,x=e._globeTranslucencyState,v=x.translucent,D=e._view.globeTranslucencyFramebuffer,L=e._depthClearCommand,B=e._stencilClearCommand,V=e._classificationStencilClearCommand,M=e._depthPlane,H=u.usePostProcessSelected,G=n.position.z;let I;for(let O=0;O<y;++O){const m=y-O-1,P=p[m];e.mode===me.SCENE2D?(n.position.z=G-P.near+1,s.far=Math.max(1,P.far-P.near),s.near=1,r.update(o),r.updateFrustum(s)):(s.near=m!==0?P.near*e.opaqueFrustumNearOffset:P.near,s.far=P.far,r.updateFrustum(s)),L.execute(i,t),i.stencilBuffer&&B.execute(i,t),r.updatePass(We.GLOBE);let R=P.commands[We.GLOBE],U=P.indices[We.GLOBE];if(v)x.executeGlobeCommands(P,ia,D,e,t);else for(I=0;I<U;++I)ia(R[I],e,i,t);const W=f.globeDepth;if(l(W)&&u.useGlobeDepthFramebuffer&&W.executeCopyDepth(i,t),!u.renderTranslucentDepthForPick)if(r.updatePass(We.TERRAIN_CLASSIFICATION),R=P.commands[We.TERRAIN_CLASSIFICATION],U=P.indices[We.TERRAIN_CLASSIFICATION],v)x.executeGlobeClassificationCommands(P,ia,D,e,t);else for(I=0;I<U;++I)ia(R[I],e,i,t);if(T&&(L.execute(i,t),b&&M.execute(i,t)),!u.useInvertClassification||c||u.renderTranslucentDepthForPick){for(r.updatePass(We.CESIUM_3D_TILE),R=P.commands[We.CESIUM_3D_TILE],U=P.indices[We.CESIUM_3D_TILE],I=0;I<U;++I)ia(R[I],e,i,t);if(U>0&&(l(W)&&u.useGlobeDepthFramebuffer&&(W.prepareColorTextures(i,T),W.executeUpdateDepth(i,t,T,W.depthStencilTexture)),!u.renderTranslucentDepthForPick))for(r.updatePass(We.CESIUM_3D_TILE_CLASSIFICATION),R=P.commands[We.CESIUM_3D_TILE_CLASSIFICATION],U=P.indices[We.CESIUM_3D_TILE_CLASSIFICATION],I=0;I<U;++I)ia(R[I],e,i,t)}else{e._invertClassification.clear(i,t);const ee=t.framebuffer;for(t.framebuffer=e._invertClassification._fbo.framebuffer,r.updatePass(We.CESIUM_3D_TILE),R=P.commands[We.CESIUM_3D_TILE],U=P.indices[We.CESIUM_3D_TILE],I=0;I<U;++I)ia(R[I],e,i,t);for(l(W)&&u.useGlobeDepthFramebuffer&&(e._invertClassification.prepareTextures(i),W.executeUpdateDepth(i,t,T,e._invertClassification._fbo.getDepthStencilTexture())),r.updatePass(We.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW),R=P.commands[We.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW],U=P.indices[We.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW],I=0;I<U;++I)ia(R[I],e,i,t);for(t.framebuffer=ee,e._invertClassification.executeClassified(i,t),o.invertClassificationColor.alpha===1&&e._invertClassification.executeUnclassified(i,t),U>0&&i.stencilBuffer&&V.execute(i,t),r.updatePass(We.CESIUM_3D_TILE_CLASSIFICATION),R=P.commands[We.CESIUM_3D_TILE_CLASSIFICATION],U=P.indices[We.CESIUM_3D_TILE_CLASSIFICATION],I=0;I<U;++I)ia(R[I],e,i,t)}for(U>0&&i.stencilBuffer&&B.execute(i,t),r.updatePass(We.OPAQUE),R=P.commands[We.OPAQUE],U=P.indices[We.OPAQUE],I=0;I<U;++I)ia(R[I],e,i,t);m!==0&&e.mode!==me.SCENE2D&&(s.near=P.near,r.updateFrustum(s));let q;if(!c&&u.useInvertClassification&&o.invertClassificationColor.alpha<1&&(q=e._invertClassification),r.updatePass(We.TRANSLUCENT),R=P.commands[We.TRANSLUCENT],R.length=P.indices[We.TRANSLUCENT],g(e,ia,t,R,q),P.indices[We.CESIUM_3D_TILE_CLASSIFICATION]>0&&f.translucentTileClassification.isSupported()&&(f.translucentTileClassification.executeTranslucentCommands(e,ia,t,R,W.depthStencilTexture),f.translucentTileClassification.executeClassificationCommands(e,ia,t,P)),i.depthTexture&&e.useDepthPicking&&(u.useGlobeDepthFramebuffer||h)){const ee=W.depthStencilTexture,K=e._picking.getPickDepth(e,m);K.update(i,ee),K.executeCopyDepth(i,t)}if(r.updatePass(We.VOXELS),R=P.commands[We.VOXELS],U=P.indices[We.VOXELS],R.length=U,i9e(e,ia,t,R),c||!H)continue;const j=t.framebuffer;if(t.framebuffer=f.sceneFramebuffer.getIdFramebuffer(),s.near=m!==0?P.near*e.opaqueFrustumNearOffset:P.near,s.far=P.far,r.updateFrustum(s),r.updatePass(We.GLOBE),R=P.commands[We.GLOBE],U=P.indices[We.GLOBE],v)x.executeGlobeCommands(P,zC,D,e,t);else for(I=0;I<U;++I)zC(R[I],e,i,t);for(T&&(L.framebuffer=t.framebuffer,L.execute(i,t),L.framebuffer=void 0),T&&b&&M.execute(i,t),r.updatePass(We.CESIUM_3D_TILE),R=P.commands[We.CESIUM_3D_TILE],U=P.indices[We.CESIUM_3D_TILE],I=0;I<U;++I)zC(R[I],e,i,t);for(r.updatePass(We.OPAQUE),R=P.commands[We.OPAQUE],U=P.indices[We.OPAQUE],I=0;I<U;++I)zC(R[I],e,i,t);for(r.updatePass(We.TRANSLUCENT),R=P.commands[We.TRANSLUCENT],U=P.indices[We.TRANSLUCENT],I=0;I<U;++I)zC(R[I],e,i,t);t.framebuffer=j}}function Hee(e){e.context.uniformState.updatePass(We.COMPUTE);const n=e._environmentState.sunComputeCommand;l(n)&&n.execute(e._computeEngine);const i=e._computeCommandList,o=i.length;for(let r=0;r<o;++r)i[r].execute(e._computeEngine)}function c9e(e,t){e.context.uniformState.updatePass(We.OVERLAY);const i=e.context,o=e._overlayCommandList,r=o.length;for(let s=0;s<r;++s)o[s].execute(i,t)}function l9e(e,t,n){const i=n.shadowMapCullingVolume,o=n.isPointLight,r=n.passes,s=r.length,a=t.length;for(let c=0;c<a;++c){const u=t[c];if(e.updateDerivedCommands(u),u.castShadows&&(u.pass===We.GLOBE||u.pass===We.CESIUM_3D_TILE||u.pass===We.OPAQUE||u.pass===We.TRANSLUCENT)&&e.isVisible(u,i))if(o)for(let f=0;f<s;++f)r[f].commandList.push(u);else if(s===1)r[0].commandList.push(u);else{let f=!1;for(let h=s-1;h>=0;--h){const _=r[h].cullingVolume;if(e.isVisible(u,_))r[h].commandList.push(u),f=!0;else if(f)break}}}}function Vee(e){const t=e.frameState,n=t.shadowState.shadowMaps,i=n.length;if(!t.shadowState.shadowsEnabled)return;const o=e.context,r=o.uniformState;for(let s=0;s<i;++s){const a=n[s];if(a.outOfView)continue;const c=a.passes,u=c.length;for(let h=0;h<u;++h)c[h].commandList.length=0;const f=e.frameState.commandList;l9e(e,f,a);for(let h=0;h<u;++h){const _=a.passes[h];r.updateCamera(_.camera),a.updatePass(o,h);const g=_.commandList.length;for(let p=0;p<g;++p){const y=_.commandList[p];r.updatePass(y.pass),ia(y.derivedCommands.shadows.castCommands[s],e,o,_.passState)}}}}const u9e=new d;ki.prototype.updateAndExecuteCommands=function(e,t){const i=this._frameState.mode;this._environmentState.useWebVR?f9e(this,e,t):i!==me.SCENE2D||this._mapMode2D===Zm.ROTATE?dm(!0,this,e,t):(tU(this,e,t),T9e(this,e))};function f9e(e,t,n){const i=e._view,o=i.camera,s=e._environmentState.renderTranslucentDepthForPick;tU(e,t,n),kee(e),i.createPotentiallyVisibleSet(e),Hee(e),s||Vee(e);const a=t.viewport;a.x=0,a.y=0,a.width=a.width*.5;const c=Tt.clone(o,e._cameraVR);c.frustum=o.frustum;const u=o.frustum.near,f=u*A(e.focalLength,5),h=A(e.eyeSeparation,f/30),_=d.multiplyByScalar(c.right,h*.5,u9e);o.frustum.aspectRatio=a.width/a.height;const g=.5*h*u/f;d.add(c.position,_,o.position),o.frustum.xOffset=g,NF(e,t),a.x=a.width,d.subtract(c.position,_,o.position),o.frustum.xOffset=-g,NF(e,t),Tt.clone(c,o)}const d9e=new ve(Math.PI,F.PI_OVER_TWO),h9e=new d,p9e=new d,m9e=new N,_9e=new N,g9e=new d,y9e=new d,A9e=new at;function T9e(e,t){const n=e.context,i=e.frameState,o=e.camera,r=t.viewport,s=at.clone(r,A9e);t.viewport=s;const a=d9e,c=h9e;e.mapProjection.project(a,c);const f=d.clone(o.position,p9e),h=N.clone(o.transform,_9e),_=o.frustum.clone();o._setTransform(N.IDENTITY);const g=N.computeViewportTransformation(s,0,1,m9e),p=o.frustum.projectionMatrix,y=o.positionWC.y,T=d.fromElements(F.sign(y)*c.x-y,0,-o.positionWC.x,g9e),b=En.pointToGLWindowCoordinates(p,g,T,y9e);b.x=Math.floor(b.x);const x=s.x,v=s.width;if(y===0||b.x<=x||b.x>=x+v)dm(!0,e,t);else if(Math.abs(x+v*.5-b.x)<1)s.width=b.x-s.x,o.position.x*=F.sign(o.position.x),o.frustum.right=0,i.cullingVolume=o.frustum.computeCullingVolume(o.positionWC,o.directionWC,o.upWC),n.uniformState.update(i),dm(!0,e,t),s.x=b.x,o.position.x=-o.position.x,o.frustum.right=-o.frustum.left,o.frustum.left=0,i.cullingVolume=o.frustum.computeCullingVolume(o.positionWC,o.directionWC,o.upWC),n.uniformState.update(i),dm(!1,e,t);else if(b.x>x+v*.5){s.width=b.x-x;const D=o.frustum.right;o.frustum.right=c.x-y,i.cullingVolume=o.frustum.computeCullingVolume(o.positionWC,o.directionWC,o.upWC),n.uniformState.update(i),dm(!0,e,t),s.x=b.x,s.width=x+v-b.x,o.position.x=-o.position.x,o.frustum.left=-o.frustum.right,o.frustum.right=D-o.frustum.right*2,i.cullingVolume=o.frustum.computeCullingVolume(o.positionWC,o.directionWC,o.upWC),n.uniformState.update(i),dm(!1,e,t)}else{s.x=b.x,s.width=x+v-b.x;const D=o.frustum.left;o.frustum.left=-c.x-y,i.cullingVolume=o.frustum.computeCullingVolume(o.positionWC,o.directionWC,o.upWC),n.uniformState.update(i),dm(!0,e,t),s.x=x,s.width=b.x-x,o.position.x=-o.position.x,o.frustum.right=-o.frustum.left,o.frustum.left=D-o.frustum.left*2,i.cullingVolume=o.frustum.computeCullingVolume(o.positionWC,o.directionWC,o.upWC),n.uniformState.update(i),dm(!1,e,t)}o._setTransform(h),d.clone(f,o.position),o.frustum=_.clone(),t.viewport=r}function dm(e,t,n,i){const o=t._environmentState,r=t._view,s=o.renderTranslucentDepthForPick;e||(t.frameState.commandList.length=0),kee(t),r.createPotentiallyVisibleSet(t),e&&(l(i)&&tU(t,n,i),Hee(t),s||Vee(t)),NF(t,n)}const QW=new Ur;ki.prototype.updateEnvironment=function(){const e=this._frameState,t=this._view,n=this._environmentState,i=e.passes.render,o=e.passes.offscreen,r=this.skyAtmosphere,s=this.globe,a=this._globeTranslucencyState;if(!i||this._mode!==me.SCENE2D&&t.camera.frustum instanceof nn||!a.environmentVisible)n.skyAtmosphereCommand=void 0,n.skyBoxCommand=void 0,n.sunDrawCommand=void 0,n.sunComputeCommand=void 0,n.moonCommand=void 0;else{l(r)?(l(s)&&(r.setDynamicAtmosphereColor(s.enableLighting&&s.dynamicAtmosphereLighting,s.dynamicAtmosphereLightingFromSun),n.isReadyForAtmosphere=n.isReadyForAtmosphere||s._surface._tilesToRender.length>0),n.skyAtmosphereCommand=r.update(e,s),l(n.skyAtmosphereCommand)&&this.updateDerivedCommands(n.skyAtmosphereCommand)):n.skyAtmosphereCommand=void 0,n.skyBoxCommand=l(this.skyBox)?this.skyBox.update(e,this._hdr):void 0;const y=l(this.sun)?this.sun.update(e,t.passState,this._hdr):void 0;n.sunDrawCommand=l(y)?y.drawCommand:void 0,n.sunComputeCommand=l(y)?y.computeCommand:void 0,n.moonCommand=l(this.moon)?this.moon.update(e):void 0}const c=n.clearGlobeDepth=l(s)&&s.show&&(!s.depthTestAgainstTerrain||this.mode===me.SCENE2D);(n.useDepthPlane=c&&this.mode===me.SCENE3D&&a.useDepthPlane)&&this._depthPlane.update(e),n.renderTranslucentDepthForPick=!1,n.useWebVR=this._useWebVR&&this.mode!==me.SCENE2D&&!o;const f=e.mode===me.SCENE3D&&!a.sunVisibleThroughGlobe?e.occluder:void 0;let h=e.cullingVolume;const _=QW.planes;for(let y=0;y<5;++y)_[y]=h.planes[y];h=QW,n.isSkyAtmosphereVisible=l(n.skyAtmosphereCommand)&&n.isReadyForAtmosphere,n.isSunVisible=this.isVisible(n.sunDrawCommand,h,f),n.isMoonVisible=this.isVisible(n.moonCommand,h,f);const g=this.specularEnvironmentMaps;let p=this._specularEnvironmentMapAtlas;l(g)&&(!l(p)||p.url!==g)?(p=p&&p.destroy(),this._specularEnvironmentMapAtlas=new gf(g)):!l(g)&&l(p)&&(p.destroy(),this._specularEnvironmentMapAtlas=void 0),l(this._specularEnvironmentMapAtlas)&&this._specularEnvironmentMapAtlas.update(e)};function C9e(e){const t=e._frameState;e.debugShowFrustumPlanes!==e._debugShowFrustumPlanes&&(e.debugShowFrustumPlanes?e._debugFrustumPlanes=new xm({camera:e.camera,updateOnChange:!1,frustumSplits:t.frustumSplits}):e._debugFrustumPlanes=e._debugFrustumPlanes&&e._debugFrustumPlanes.destroy(),e._debugShowFrustumPlanes=e.debugShowFrustumPlanes),l(e._debugFrustumPlanes)&&e._debugFrustumPlanes.update(t)}function b9e(e){const t=e._frameState,n=t.shadowMaps,i=n.length,o=i>0&&!t.passes.pick&&e.mode===me.SCENE3D;if(o!==t.shadowState.shadowsEnabled&&(++t.shadowState.lastDirtyTime,t.shadowState.shadowsEnabled=o),t.shadowState.lightShadowsEnabled=!1,!!o){for(let r=0;r<i;++r)if(n[r]!==t.shadowState.shadowMaps[r]){++t.shadowState.lastDirtyTime;break}t.shadowState.shadowMaps.length=0,t.shadowState.lightShadowMaps.length=0;for(let r=0;r<i;++r){const s=n[r];s.update(t),t.shadowState.shadowMaps.push(s),s.fromLightSource&&(t.shadowState.lightShadowMaps.push(s),t.shadowState.lightShadowsEnabled=!0),s.dirty&&(++t.shadowState.lastDirtyTime,s.dirty=!1)}}}function kee(e){const t=e._frameState;e._groundPrimitives.update(t),e._primitives.update(t),C9e(e),b9e(e),e._globe&&e._globe.render(t)}function tU(e,t,n){const i=e._context,o=e._frameState,r=e._environmentState,s=e._view,c=e._frameState.passes.pick;l(s.globeDepth)&&(s.globeDepth.picking=c);const u=r.useWebVR;r.originalFramebuffer=t.framebuffer,l(e.sun)&&e.sunBloom!==e._sunBloom?(e.sunBloom&&!u?e._sunPostProcess=new pp:l(e._sunPostProcess)&&(e._sunPostProcess=e._sunPostProcess.destroy()),e._sunBloom=e.sunBloom):!l(e.sun)&&l(e._sunPostProcess)&&(e._sunPostProcess=e._sunPostProcess.destroy(),e._sunBloom=!1);const f=e._clearColorCommand;k.clone(n,f.color),f.execute(i,t);const h=r.useGlobeDepthFramebuffer=l(s.globeDepth);h&&(s.globeDepth.update(i,t,s.viewport,e.msaaSamples,e._hdr,r.clearGlobeDepth),s.globeDepth.clear(i,t,n));const _=s.oit,g=r.useOIT=!c&&l(_)&&_.isSupported();g&&(_.update(i,t,s.globeDepth.colorFramebufferManager,e._hdr,e.msaaSamples),_.clear(i,t,n),r.useOIT=_.isSupported());const p=e.postProcessStages;let y=r.usePostProcess=!c&&(e._hdr||p.length>0||p.ambientOcclusion.enabled||p.fxaa.enabled||p.bloom.enabled);if(r.usePostProcessSelected=!1,y&&(s.sceneFramebuffer.update(i,s.viewport,e._hdr,e.msaaSamples),s.sceneFramebuffer.clear(i,t,n),p.update(i,o.useLogDepth,e._hdr),p.clear(i),y=r.usePostProcess=p.ready,r.usePostProcessSelected=y&&p.hasSelected),r.isSunVisible&&e.sunBloom&&!u?(t.framebuffer=e._sunPostProcess.update(t),e._sunPostProcess.clear(i,t,n)):h?t.framebuffer=s.globeDepth.framebuffer:y&&(t.framebuffer=s.sceneFramebuffer.framebuffer),l(t.framebuffer)&&f.execute(i,t),r.useInvertClassification=!c&&l(t.framebuffer)&&e.invertClassification){let b;if(e.frameState.invertClassificationColor.alpha===1&&r.useGlobeDepthFramebuffer&&(b=s.globeDepth.framebuffer),l(b)||i.depthTexture){if(e._invertClassification.previousFramebuffer=b,e._invertClassification.update(i,e.msaaSamples,s.globeDepth.colorFramebufferManager),e._invertClassification.clear(i,t),e.frameState.invertClassificationColor.alpha<1&&g){const x=e._invertClassification.unclassifiedCommand,v=x.derivedCommands;v.oit=_.createDerivedCommands(x,i,v.oit)}}else r.useInvertClassification=!1}e._globeTranslucencyState.translucent&&s.globeTranslucencyFramebuffer.updateAndClear(e._hdr,s.viewport,i,t)}ki.prototype.resolveFramebuffers=function(e){const t=this._context,n=this._environmentState,i=this._view,o=i.globeDepth;l(o)&&o.prepareColorTextures(t);const r=n.useOIT,s=n.useGlobeDepthFramebuffer,a=n.usePostProcess,c=n.originalFramebuffer,u=s?o.colorFramebufferManager:void 0,f=i.sceneFramebuffer._colorFramebuffer,h=i.sceneFramebuffer.idFramebuffer;r&&(e.framebuffer=a?f.framebuffer:c,i.oit.execute(t,e));const _=i.translucentTileClassification;if(_.hasTranslucentDepth&&_.isSupported()&&_.execute(this,e),a){i.sceneFramebuffer.prepareColorTextures(t);let g=f;s&&!r&&(g=u);const p=this.postProcessStages,y=g.getColorTexture(0),T=h.getColorTexture(0),b=A(u,f).getDepthStencilTexture();p.execute(t,y,b,T),p.copy(t,c)}!r&&!a&&s&&(e.framebuffer=c,o.executeCopyColor(t,e))};function E9e(e){const t=e._frameState.afterRender;for(let n=0,i=t.length;n<i;++n)t[n]()&&e.requestRender();t.length=0}function x9e(e){const t=e._globe,i=e.camera.positionCartographic;if(l(t)&&t.show&&l(i))return t.getHeight(i)}function w9e(e){const t=e.camera,n=e._mode,i=e.globe,o=e._screenSpaceCameraController,r=t.positionCartographic;if(!l(r))return!1;if(!o.onMap()&&r.height<0)return!0;if(!l(i)||!i.show||n===me.SCENE2D||n===me.MORPHING)return!1;const s=e._globeHeight;return l(s)&&r.height<s}ki.prototype.initializeFrame=function(){this._shaderFrameCount++===120&&(this._shaderFrameCount=0,this._context.shaderCache.destroyReleasedShaderPrograms(),this._context.textureCache.destroyReleasedTextures()),this._tweens.update(),this._globeHeight=x9e(this),this._cameraUnderground=w9e(this),this._globeTranslucencyState.update(this),this._screenSpaceCameraController.update(),l(this._deviceOrientationCameraController)&&this._deviceOrientationCameraController.update(),this.camera.update(this._mode),this.camera._updateCameraChanged()};function S9e(e,t){if(e.debugShowFramesPerSecond){if(!l(e._performanceDisplay)){const n=document.createElement("div");n.className="cesium-performanceDisplay-defaultContainer",e._canvas.parentNode.appendChild(n);const o=new uP({container:n});e._performanceDisplay=o,e._performanceContainer=n}e._performanceDisplay.throttled=e.requestRenderMode,e._performanceDisplay.update(t)}else l(e._performanceDisplay)&&(e._performanceDisplay=e._performanceDisplay&&e._performanceDisplay.destroy(),e._performanceContainer.parentNode.removeChild(e._performanceContainer))}function v9e(e){e._jobScheduler.resetBudgets();const t=e._frameState;e.primitives.prePassesUpdate(t),l(e.globe)&&e.globe.update(t),e._picking.update(),t.creditDisplay.update()}function D9e(e){const t=e._frameState;e.primitives.postPassesUpdate(t),Ui.update()}const I9e=new k;function P9e(e){const t=e._frameState,n=e.context,i=n.uniformState,o=e._defaultView;e._view=o,e.updateFrameState(),t.passes.render=!0,t.passes.postProcess=e.postProcessStages.hasSelected,t.tilesetPassState=KWe;let r=A(e.backgroundColor,k.BLACK);e._hdr&&(r=k.clone(r,I9e),r.red=Math.pow(r.red,e.gamma),r.green=Math.pow(r.green,e.gamma),r.blue=Math.pow(r.blue,e.gamma)),t.backgroundColor=r,e.fog.update(t),i.update(t);const s=e.shadowMap;l(s)&&s.enabled&&(!l(e.light)||e.light instanceof j1?d.negate(i.sunDirectionWC,e._shadowMapCamera.direction):d.clone(e.light.direction,e._shadowMapCamera.direction),t.shadowMaps.push(s)),e._computeCommandList.length=0,e._overlayCommandList.length=0;const a=o.viewport;a.x=0,a.y=0,a.width=n.drawingBufferWidth,a.height=n.drawingBufferHeight;const c=o.passState;c.framebuffer=void 0,c.blendingEnabled=void 0,c.scissorTest=void 0,c.viewport=at.clone(a,c.viewport),l(e.globe)&&e.globe.beginFrame(t),e.updateEnvironment(),e.updateAndExecuteCommands(c,r),e.resolveFramebuffers(c),c.framebuffer=void 0,c9e(e,c),l(e.globe)&&(e.globe.endFrame(t),e.globe.tilesLoaded||(e._renderRequested=!0)),n.endFrame()}function tg(e,t){try{t(e)}catch(n){if(e._renderError.raiseEvent(e,n),e.rethrowRenderErrors)throw n}}function O9e(e){return e._picking.updateMostDetailedRayPicks(e)}ki.prototype.render=function(e){this._preUpdate.raiseEvent(this,e);const t=this._frameState;t.newFrame=!1,l(e)||(e=ce.now());const n=this._view.checkForCameraUpdates(this);let i=!this.requestRenderMode||this._renderRequested||n||this._logDepthBufferDirty||this._hdrDirty||this.mode===me.MORPHING;if(!i&&l(this.maximumRenderTimeChange)&&l(this._lastRenderTime)){const o=Math.abs(ce.secondsDifference(this._lastRenderTime,e));i=i||o>this.maximumRenderTimeChange}if(i){this._lastRenderTime=ce.clone(e,this._lastRenderTime),this._renderRequested=!1,this._logDepthBufferDirty=!1,this._hdrDirty=!1;const o=F.incrementWrap(t.frameNumber,15e6,1);zee(this,o,e),t.newFrame=!0}tg(this,v9e),this.primitives.show&&(tg(this,O9e),tg(this,L9e),tg(this,B9e),i||tg(this,R9e)),this._postUpdate.raiseEvent(this,e),i&&(this._preRender.raiseEvent(this,e),t.creditDisplay.beginFrame(),tg(this,P9e)),S9e(this,i),tg(this,D9e),E9e(this),i&&(this._postRender.raiseEvent(this,e),t.creditDisplay.endFrame())};ki.prototype.forceRender=function(e){this._renderRequested=!0,this.render(e)};ki.prototype.requestRender=function(){this._renderRequested=!0};ki.prototype.clampLineWidth=function(e){return Math.max(Gt.minimumAliasedLineWidth,Math.min(e,Gt.maximumAliasedLineWidth))};ki.prototype.pick=function(e,t,n){return this._picking.pick(this,e,t,n)};ki.prototype.pickPositionWorldCoordinates=function(e,t){return this._picking.pickPositionWorldCoordinates(this,e,t)};ki.prototype.pickPosition=function(e,t){return this._picking.pickPosition(this,e,t)};ki.prototype.drillPick=function(e,t,n,i){return this._picking.drillPick(this,e,t,n,i)};function L9e(e){const t=e._frameState;uR.camera=t.camera,uR.cullingVolume=t.cullingVolume,e.primitives.updateForPass(t,uR)}function B9e(e){const t=e._frameState;if(!t.camera.canPreloadFlight())return;fR.camera=e.preloadFlightCamera,fR.cullingVolume=e.preloadFlightCullingVolume,e.primitives.updateForPass(t,fR)}function R9e(e){e.primitives.updateForPass(e._frameState,JWe)}ki.prototype.pickFromRay=function(e,t,n){return this._picking.pickFromRay(this,e,t,n)};ki.prototype.drillPickFromRay=function(e,t,n,i){return this._picking.drillPickFromRay(this,e,t,n,i)};ki.prototype.pickFromRayMostDetailed=function(e,t,n){return this._picking.pickFromRayMostDetailed(this,e,t,n)};ki.prototype.drillPickFromRayMostDetailed=function(e,t,n,i){return this._picking.drillPickFromRayMostDetailed(this,e,t,n,i)};ki.prototype.sampleHeight=function(e,t,n){return this._picking.sampleHeight(this,e,t,n)};ki.prototype.clampToHeight=function(e,t,n,i){return this._picking.clampToHeight(this,e,t,n,i)};ki.prototype.sampleHeightMostDetailed=function(e,t,n){return this._picking.sampleHeightMostDetailed(this,e,t,n)};ki.prototype.clampToHeightMostDetailed=function(e,t,n){return this._picking.clampToHeightMostDetailed(this,e,t,n)};ki.prototype.cartesianToCanvasCoordinates=function(e,t){return es.wgs84ToWindowCoordinates(this,e,t)};ki.prototype.completeMorph=function(){this._transitioner.completeMorph()};ki.prototype.morphTo2D=function(e){let t;const n=this.globe;l(n)?t=n.ellipsoid:t=this.mapProjection.ellipsoid,e=A(e,2),this._transitioner.morphTo2D(e,t)};ki.prototype.morphToColumbusView=function(e){let t;const n=this.globe;l(n)?t=n.ellipsoid:t=this.mapProjection.ellipsoid,e=A(e,2),this._transitioner.morphToColumbusView(e,t)};ki.prototype.morphTo3D=function(e){let t;const n=this.globe;l(n)?t=n.ellipsoid:t=this.mapProjection.ellipsoid,e=A(e,2),this._transitioner.morphTo3D(e,t)};ki.prototype.isDestroyed=function(){return!1};ki.prototype.destroy=function(){this._tweens.removeAll(),this._computeEngine=this._computeEngine&&this._computeEngine.destroy(),this._screenSpaceCameraController=this._screenSpaceCameraController&&this._screenSpaceCameraController.destroy(),this._deviceOrientationCameraController=this._deviceOrientationCameraController&&!this._deviceOrientationCameraController.isDestroyed()&&this._deviceOrientationCameraController.destroy(),this._primitives=this._primitives&&this._primitives.destroy(),this._groundPrimitives=this._groundPrimitives&&this._groundPrimitives.destroy(),this._globe=this._globe&&this._globe.destroy(),this.skyBox=this.skyBox&&this.skyBox.destroy(),this.skyAtmosphere=this.skyAtmosphere&&this.skyAtmosphere.destroy(),this._debugSphere=this._debugSphere&&this._debugSphere.destroy(),this.sun=this.sun&&this.sun.destroy(),this._sunPostProcess=this._sunPostProcess&&this._sunPostProcess.destroy(),this._depthPlane=this._depthPlane&&this._depthPlane.destroy(),this._transitioner=this._transitioner&&this._transitioner.destroy(),this._debugFrustumPlanes=this._debugFrustumPlanes&&this._debugFrustumPlanes.destroy(),this._brdfLutGenerator=this._brdfLutGenerator&&this._brdfLutGenerator.destroy(),this._picking=this._picking&&this._picking.destroy(),this._defaultView=this._defaultView&&this._defaultView.destroy(),this._view=void 0,this._removeCreditContainer&&this._canvas.parentNode.removeChild(this._creditContainer),this.postProcessStages=this.postProcessStages&&this.postProcessStages.destroy(),this._context=this._context&&this._context.destroy(),this._frameState.creditDisplay=this._frameState.creditDisplay&&this._frameState.creditDisplay.destroy(),l(this._performanceDisplay)&&(this._performanceDisplay=this._performanceDisplay&&this._performanceDisplay.destroy(),this._performanceContainer.parentNode.removeChild(this._performanceContainer)),this._removeRequestListenerCallback(),this._removeTaskProcessorListenerCallback();for(let e=0;e<this._removeGlobeCallbacks.length;++e)this._removeGlobeCallbacks[e]();return this._removeGlobeCallbacks.length=0,Je(this)};const Jh={X:0,Y:1,Z:2};Jh.Y_UP_TO_Z_UP=N.fromRotationTranslation(te.fromRotationX(F.PI_OVER_TWO));Jh.Z_UP_TO_Y_UP=N.fromRotationTranslation(te.fromRotationX(-F.PI_OVER_TWO));Jh.X_UP_TO_Z_UP=N.fromRotationTranslation(te.fromRotationY(-F.PI_OVER_TWO));Jh.Z_UP_TO_X_UP=N.fromRotationTranslation(te.fromRotationY(F.PI_OVER_TWO));Jh.X_UP_TO_Y_UP=N.fromRotationTranslation(te.fromRotationZ(F.PI_OVER_TWO));Jh.Y_UP_TO_X_UP=N.fromRotationTranslation(te.fromRotationZ(-F.PI_OVER_TWO));Jh.fromName=function(e){return E.typeOf.string("name",e),Jh[e]};const Vs=Object.freeze(Jh);function ST(e){e=A(e,be.WGS84),this.show=!0,this.perFragmentAtmosphere=!1,this._ellipsoid=e;const t=1.025,n=d.multiplyByScalar(e.radii,t,new d);this._scaleMatrix=N.fromScale(n),this._modelMatrix=new N,this._command=new Dt({owner:this,modelMatrix:this._modelMatrix}),this._spSkyFromSpace=void 0,this._spSkyFromAtmosphere=void 0,this._flags=void 0,this.atmosphereLightIntensity=50,this.atmosphereRayleighCoefficient=new d(55e-7,13e-6,284e-7),this.atmosphereMieCoefficient=new d(21e-6,21e-6,21e-6),this.atmosphereRayleighScaleHeight=1e4,this.atmosphereMieScaleHeight=3200,this.atmosphereMieAnisotropy=.9,this.hueShift=0,this.saturationShift=0,this.brightnessShift=0,this._hueSaturationBrightness=new d;const i=new d;i.x=e.maximumRadius*t,i.y=e.maximumRadius,i.z=0,this._radiiAndDynamicAtmosphereColor=i;const o=this;this._command.uniformMap={u_radiiAndDynamicAtmosphereColor:function(){return o._radiiAndDynamicAtmosphereColor},u_hsbShift:function(){return o._hueSaturationBrightness.x=o.hueShift,o._hueSaturationBrightness.y=o.saturationShift,o._hueSaturationBrightness.z=o.brightnessShift,o._hueSaturationBrightness},u_atmosphereLightIntensity:function(){return o.atmosphereLightIntensity},u_atmosphereRayleighCoefficient:function(){return o.atmosphereRayleighCoefficient},u_atmosphereMieCoefficient:function(){return o.atmosphereMieCoefficient},u_atmosphereRayleighScaleHeight:function(){return o.atmosphereRayleighScaleHeight},u_atmosphereMieScaleHeight:function(){return o.atmosphereMieScaleHeight},u_atmosphereMieAnisotropy:function(){return o.atmosphereMieAnisotropy}}}Object.defineProperties(ST.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}});ST.prototype.setDynamicAtmosphereColor=function(e,t){const n=e?t?2:1:0;this._radiiAndDynamicAtmosphereColor.z=n};const hR=new N;ST.prototype.update=function(e,t){if(!this.show)return;const n=e.mode;if(n!==me.SCENE3D&&n!==me.MORPHING||!e.passes.render)return;const i=N.fromRotationTranslation(e.context.uniformState.inverseViewRotation,d.ZERO,hR),o=N.multiplyTransformation(i,Vs.Y_UP_TO_Z_UP,hR),r=N.multiply(this._scaleMatrix,o,hR);N.clone(r,this._modelMatrix);const s=e.context,a=N9e(this),c=e.globeTranslucencyState.translucent,u=this.perFragmentAtmosphere||c||!l(t)||!t.show,f=this._command;if(!l(f.vertexArray)){const _=sl.createGeometry(new sl({radii:new d(1,1,1),slicePartitions:256,stackPartitions:256,vertexFormat:Ye.POSITION_ONLY}));f.vertexArray=Fo.fromGeometry({context:s,geometry:_,attributeLocations:mo.createAttributeLocations(_),bufferUsage:mt.STATIC_DRAW}),f.renderState=ht.fromCache({cull:{enabled:!0,face:mr.FRONT},blending:fo.ALPHA_BLEND,depthMask:!1})}const h=a|u<<2|c<<3;if(h!==this._flags){this._flags=h;const _=[];a&&_.push("COLOR_CORRECT"),u&&_.push("PER_FRAGMENT_ATMOSPHERE"),c&&_.push("GLOBE_TRANSLUCENT");const g=new nt({defines:_,sources:[OI,N5,YOe]}),p=new nt({defines:_,sources:[OI,N5,jOe]});this._spSkyAtmosphere=Hn.fromCache({context:s,vertexShaderSource:g,fragmentShaderSource:p}),f.shaderProgram=this._spSkyAtmosphere}return f};function N9e(e){return!(F.equalsEpsilon(e.hueShift,0,F.EPSILON7)&&F.equalsEpsilon(e.saturationShift,0,F.EPSILON7)&&F.equalsEpsilon(e.brightnessShift,0,F.EPSILON7))}ST.prototype.isDestroyed=function(){return!1};ST.prototype.destroy=function(){const e=this._command;return e.vertexArray=e.vertexArray&&e.vertexArray.destroy(),this._spSkyAtmosphere=this._spSkyAtmosphere&&this._spSkyAtmosphere.destroy(),Je(this)};function yP(e){this.sources=e.sources,this._sources=void 0,this.show=A(e.show,!0),this._command=new Dt({modelMatrix:N.clone(N.IDENTITY),owner:this}),this._cubeMap=void 0,this._attributeLocations=void 0,this._useHdr=void 0}yP.prototype.update=function(e,t){const n=this;if(!this.show||e.mode!==me.SCENE3D&&e.mode!==me.MORPHING||!e.passes.render)return;const i=e.context;if(this._sources!==this.sources){this._sources=this.sources;const r=this.sources;if(!l(r.positiveX)||!l(r.negativeX)||!l(r.positiveY)||!l(r.negativeY)||!l(r.positiveZ)||!l(r.negativeZ))throw new w("this.sources is required and must have positiveX, negativeX, positiveY, negativeY, positiveZ, and negativeZ properties.");if(typeof r.positiveX!=typeof r.negativeX||typeof r.positiveX!=typeof r.positiveY||typeof r.positiveX!=typeof r.negativeY||typeof r.positiveX!=typeof r.positiveZ||typeof r.positiveX!=typeof r.negativeZ)throw new w("this.sources properties must all be the same type.");typeof r.positiveX=="string"?EOe(i,this._sources).then(function(s){n._cubeMap=n._cubeMap&&n._cubeMap.destroy(),n._cubeMap=s}):(this._cubeMap=this._cubeMap&&this._cubeMap.destroy(),this._cubeMap=new xf({context:i,source:r}))}const o=this._command;if(!l(o.vertexArray)){o.uniformMap={u_cubeMap:function(){return n._cubeMap}};const r=Ss.createGeometry(Ss.fromDimensions({dimensions:new d(2,2,2),vertexFormat:Ye.POSITION_ONLY})),s=this._attributeLocations=mo.createAttributeLocations(r);o.vertexArray=Fo.fromGeometry({context:i,geometry:r,attributeLocations:s,bufferUsage:mt.STATIC_DRAW}),o.renderState=ht.fromCache({blending:fo.ALPHA_BLEND})}if(!l(o.shaderProgram)||this._useHdr!==t){const r=new nt({defines:[t?"HDR":""],sources:[$Oe]});o.shaderProgram=Hn.fromCache({context:i,vertexShaderSource:XOe,fragmentShaderSource:r,attributeLocations:this._attributeLocations}),this._useHdr=t}if(l(this._cubeMap))return o};yP.prototype.isDestroyed=function(){return!1};yP.prototype.destroy=function(){const e=this._command;return e.vertexArray=e.vertexArray&&e.vertexArray.destroy(),e.shaderProgram=e.shaderProgram&&e.shaderProgram.destroy(),this._cubeMap=this._cubeMap&&this._cubeMap.destroy(),Je(this)};function Ix(){this.show=!0,this._drawCommand=new Dt({primitiveType:dt.TRIANGLES,boundingVolume:new Ae,owner:this}),this._commands={drawCommand:this._drawCommand,computeCommand:void 0},this._boundingVolume=new Ae,this._boundingVolume2D=new Ae,this._texture=void 0,this._drawingBufferWidth=void 0,this._drawingBufferHeight=void 0,this._radiusTS=void 0,this._size=void 0,this.glowFactor=1,this._glowFactorDirty=!1,this._useHdr=void 0;const e=this;this._uniformMap={u_texture:function(){return e._texture},u_size:function(){return e._size}}}Object.defineProperties(Ix.prototype,{glowFactor:{get:function(){return this._glowFactor},set:function(e){e=Math.max(e,0),this._glowFactor=e,this._glowFactorDirty=!0}}});const M9e=new $,F9e=new $,z9e=new ue,UC=new ue;Ix.prototype.update=function(e,t,n){if(!this.show)return;const i=e.mode;if(i===me.SCENE2D||i===me.MORPHING||!e.passes.render)return;const o=e.context,r=t.viewport.width,s=t.viewport.height;if(!l(this._texture)||r!==this._drawingBufferWidth||s!==this._drawingBufferHeight||this._glowFactorDirty||n!==this._useHdr){this._texture=this._texture&&this._texture.destroy(),this._drawingBufferWidth=r,this._drawingBufferHeight=s,this._glowFactorDirty=!1,this._useHdr=n;let D=Math.max(r,s);D=Math.pow(2,Math.ceil(Math.log(D)/Math.log(2))-2),D=Math.max(1,D);const L=n?o.halfFloatingPointTexture?ft.HALF_FLOAT:ft.FLOAT:ft.UNSIGNED_BYTE;this._texture=new rn({context:o,width:D,height:D,pixelFormat:yt.RGBA,pixelDatatype:L}),this._glowLengthTS=this._glowFactor*5,this._radiusTS=1/(1+2*this._glowLengthTS)*.5;const B=this,V={u_radiusTS:function(){return B._radiusTS}};this._commands.computeCommand=new AE({fragmentShaderSource:JOe,outputTexture:this._texture,uniformMap:V,persists:!1,owner:this,postExecute:function(){B._commands.computeCommand=void 0}})}const a=this._drawCommand;if(!l(a.vertexArray)){const D={direction:0},L=new Uint8Array(4*2);L[0]=0,L[1]=0,L[2]=255,L[3]=0,L[4]=255,L[5]=255,L[6]=0,L[7]=255;const B=Mt.createVertexBuffer({context:o,typedArray:L,usage:mt.STATIC_DRAW}),V=[{index:D.direction,vertexBuffer:B,componentsPerAttribute:2,normalize:!0,componentDatatype:oe.UNSIGNED_BYTE}],M=Mt.createIndexBuffer({context:o,typedArray:new Uint16Array([0,1,2,0,2,3]),usage:mt.STATIC_DRAW,indexDatatype:At.UNSIGNED_SHORT});a.vertexArray=new Fo({context:o,attributes:V,indexBuffer:M}),a.shaderProgram=Hn.fromCache({context:o,vertexShaderSource:QOe,fragmentShaderSource:KOe,attributeLocations:D}),a.renderState=ht.fromCache({blending:fo.ALPHA_BLEND}),a.uniformMap=this._uniformMap}const c=o.uniformState.sunPositionWC,u=o.uniformState.sunPositionColumbusView,f=this._boundingVolume,h=this._boundingVolume2D;d.clone(c,f.center),h.center.x=u.z,h.center.y=u.x,h.center.z=u.y,f.radius=F.SOLAR_RADIUS+F.SOLAR_RADIUS*this._glowLengthTS,h.radius=f.radius,i===me.SCENE3D?Ae.clone(f,a.boundingVolume):i===me.COLUMBUS_VIEW&&Ae.clone(h,a.boundingVolume);const _=es.computeActualWgs84Position(e,c,UC),g=d.magnitude(d.subtract(_,e.camera.position,UC)),p=o.uniformState.projection,y=z9e;y.x=0,y.y=0,y.z=-g,y.w=1;const T=N.multiplyByVector(p,y,UC),b=es.clipToGLWindowCoordinates(t.viewport,T,M9e);y.x=F.SOLAR_RADIUS;const x=N.multiplyByVector(p,y,UC),v=es.clipToGLWindowCoordinates(t.viewport,x,F9e);return this._size=$.magnitude($.subtract(v,b,UC)),this._size=2*this._size*(1+2*this._glowLengthTS),this._size=Math.ceil(this._size),this._commands};Ix.prototype.isDestroyed=function(){return!1};Ix.prototype.destroy=function(){const e=this._drawCommand;return e.vertexArray=e.vertexArray&&e.vertexArray.destroy(),e.shaderProgram=e.shaderProgram&&e.shaderProgram.destroy(),this._texture=this._texture&&this._texture.destroy(),Je(this)};function P0(e){return Un(`Assets/Textures/SkyBox/tycho2t3_80_${e}.jpg`)}function U9e(e){e._renderLoopRunning=!0;let t=0;function n(i){if(!e.isDestroyed())if(e._useDefaultRenderLoop)try{const o=e._targetFrameRate;if(!l(o))e.resize(),e.render(),requestAnimationFrame(n);else{const r=1e3/o,s=i-t;s>r&&(e.resize(),e.render(),t=i-s%r),requestAnimationFrame(n)}}catch(o){if(e._useDefaultRenderLoop=!1,e._renderLoopRunning=!1,e._showRenderLoopErrors){const r="An error occurred while rendering. Rendering has stopped.";e.showErrorPanel(r,void 0,o)}}else e._renderLoopRunning=!1}requestAnimationFrame(n)}function Gee(e){let t=e._useBrowserRecommendedResolution?1:window.devicePixelRatio;return t*=e._resolutionScale,l(e._scene)&&(e._scene.pixelRatio=t),t}function Wee(e){const t=e._canvas;let n=t.clientWidth,i=t.clientHeight;const o=Gee(e);e._canvasClientWidth=n,e._canvasClientHeight=i,n*=o,i*=o,t.width=n,t.height=i,e._canRender=n!==0&&i!==0,e._lastDevicePixelRatio=window.devicePixelRatio}function qee(e){const t=e._canvas,n=t.width,i=t.height;if(n!==0&&i!==0){const o=e._scene.camera.frustum;l(o.aspectRatio)?o.aspectRatio=n/i:(o.top=o.right*(i/n),o.bottom=-o.top)}}function Vy(e,t){if(!l(e))throw new w("container is required.");e=Zr(e),t=A(t,A.EMPTY_OBJECT);const n=document.createElement("div");n.className="cesium-widget",e.appendChild(n);const i=document.createElement("canvas"),o=Mn.supportsImageRenderingPixelated();this._supportsImageRenderingPixelated=o,o&&(i.style.imageRendering=Mn.imageRenderingValue()),i.oncontextmenu=function(){return!1},i.onselectstart=function(){return!1};function r(){i!==i.ownerDocument.activeElement&&i.ownerDocument.activeElement.blur()}A(t.blurActiveElementOnCanvasFocus,!0)&&(i.addEventListener("mousedown",r),i.addEventListener("pointerdown",r)),n.appendChild(i);const a=document.createElement("div");a.className="cesium-widget-credits";const c=l(t.creditContainer)?Zr(t.creditContainer):n;c.appendChild(a);const u=l(t.creditViewport)?Zr(t.creditViewport):n,f=A(t.showRenderLoopErrors,!0),h=A(t.useBrowserRecommendedResolution,!0);this._element=n,this._container=e,this._canvas=i,this._canvasClientWidth=0,this._canvasClientHeight=0,this._lastDevicePixelRatio=0,this._creditViewport=u,this._creditContainer=c,this._innerCreditContainer=a,this._canRender=!1,this._renderLoopRunning=!1,this._showRenderLoopErrors=f,this._resolutionScale=1,this._useBrowserRecommendedResolution=h,this._forceResize=!1,this._clock=l(t.clock)?t.clock:new Ax,Wee(this);try{const _=new ki({canvas:i,contextOptions:t.contextOptions,creditContainer:a,creditViewport:u,mapProjection:t.mapProjection,orderIndependentTranslucency:t.orderIndependentTranslucency,scene3DOnly:A(t.scene3DOnly,!1),shadows:t.shadows,mapMode2D:t.mapMode2D,requestRenderMode:t.requestRenderMode,maximumRenderTimeChange:t.maximumRenderTimeChange,depthPlaneEllipsoidOffset:t.depthPlaneEllipsoidOffset,msaaSamples:t.msaaSamples});this._scene=_,_.camera.constrainedAxis=d.UNIT_Z,Gee(this),qee(this);const g=A(_.mapProjection.ellipsoid,be.WGS84);let p=t.globe;l(p)||(p=new vf(g)),p!==!1&&(_.globe=p,_.globe.shadows=A(t.terrainShadows,sr.RECEIVE_ONLY));let y=t.skyBox;l(y)||(y=new yP({sources:{positiveX:P0("px"),negativeX:P0("mx"),positiveY:P0("py"),negativeY:P0("my"),positiveZ:P0("pz"),negativeZ:P0("mz")}})),y!==!1&&(_.skyBox=y,_.sun=new Ix,_.moon=new Tx);let T=t.skyAtmosphere;l(T)||(T=new ST(g)),T!==!1&&(_.skyAtmosphere=T);let b=t.globe===!1?!1:t.imageryProvider;l(b)||(b=DD()),b!==!1&&_.imageryLayers.addImageryProvider(b),l(t.terrainProvider)&&t.globe!==!1&&(_.terrainProvider=t.terrainProvider),this._screenSpaceEventHandler=new xl(i),l(t.sceneMode)&&(t.sceneMode===me.SCENE2D&&this._scene.morphTo2D(0),t.sceneMode===me.COLUMBUS_VIEW&&this._scene.morphToColumbusView(0)),this._useDefaultRenderLoop=void 0,this.useDefaultRenderLoop=A(t.useDefaultRenderLoop,!0),this._targetFrameRate=void 0,this.targetFrameRate=t.targetFrameRate;const x=this;this._onRenderError=function(v,D){if(x._useDefaultRenderLoop=!1,x._renderLoopRunning=!1,x._showRenderLoopErrors){const L="An error occurred while rendering. Rendering has stopped.";x.showErrorPanel(L,void 0,D)}},_.renderError.addEventListener(this._onRenderError)}catch(_){if(f){const g="Error constructing CesiumWidget.",p='Visit <a href="http://get.webgl.org">http://get.webgl.org</a> to verify that your web browser and hardware support WebGL. Consider trying a different web browser or updating your video drivers. Detailed error information is below:';this.showErrorPanel(g,p,_)}throw _}}Object.defineProperties(Vy.prototype,{container:{get:function(){return this._container}},canvas:{get:function(){return this._canvas}},creditContainer:{get:function(){return this._creditContainer}},creditViewport:{get:function(){return this._creditViewport}},scene:{get:function(){return this._scene}},imageryLayers:{get:function(){return this._scene.imageryLayers}},terrainProvider:{get:function(){return this._scene.terrainProvider},set:function(e){this._scene.terrainProvider=e}},camera:{get:function(){return this._scene.camera}},clock:{get:function(){return this._clock}},screenSpaceEventHandler:{get:function(){return this._screenSpaceEventHandler}},targetFrameRate:{get:function(){return this._targetFrameRate},set:function(e){if(e<=0)throw new w("targetFrameRate must be greater than 0, or undefined.");this._targetFrameRate=e}},useDefaultRenderLoop:{get:function(){return this._useDefaultRenderLoop},set:function(e){this._useDefaultRenderLoop!==e&&(this._useDefaultRenderLoop=e,e&&!this._renderLoopRunning&&U9e(this))}},resolutionScale:{get:function(){return this._resolutionScale},set:function(e){if(e<=0)throw new w("resolutionScale must be greater than 0.");this._resolutionScale!==e&&(this._resolutionScale=e,this._forceResize=!0)}},useBrowserRecommendedResolution:{get:function(){return this._useBrowserRecommendedResolution},set:function(e){this._useBrowserRecommendedResolution!==e&&(this._useBrowserRecommendedResolution=e,this._forceResize=!0)}}});Vy.prototype.showErrorPanel=function(e,t,n){const i=this._element,o=document.createElement("div");o.className="cesium-widget-errorPanel";const r=document.createElement("div");r.className="cesium-widget-errorPanel-content",o.appendChild(r);const s=document.createElement("div");s.className="cesium-widget-errorPanel-header",s.appendChild(document.createTextNode(e)),r.appendChild(s);const a=document.createElement("div");a.className="cesium-widget-errorPanel-scroll",r.appendChild(a);function c(){a.style.maxHeight=`${Math.max(Math.round(i.clientHeight*.9-100),30)}px`}c(),l(window.addEventListener)&&window.addEventListener("resize",c,!1);const u=l(t),f=l(n);if(u||f){const g=document.createElement("div");if(g.className="cesium-widget-errorPanel-message",a.appendChild(g),f){let p=JM(n);u||(typeof n=="string"&&(n=new Error(n)),t=JM({name:n.name,message:n.message}),p=n.stack),typeof console<"u"&&console.error(`${e}
|
||
${t}
|
||
${p}`);const y=document.createElement("div");y.className="cesium-widget-errorPanel-message-details collapsed";const T=document.createElement("span");T.className="cesium-widget-errorPanel-more-details",T.appendChild(document.createTextNode("See more...")),y.appendChild(T),y.onclick=function(b){y.removeChild(T),y.appendChild(document.createTextNode(p)),y.className="cesium-widget-errorPanel-message-details",r.className="cesium-widget-errorPanel-content expanded",y.onclick=void 0},a.appendChild(y)}g.innerHTML=`<p>${t}</p>`}const h=document.createElement("div");h.className="cesium-widget-errorPanel-buttonPanel",r.appendChild(h);const _=document.createElement("button");_.setAttribute("type","button"),_.className="cesium-button",_.appendChild(document.createTextNode("OK")),_.onclick=function(){l(c)&&l(window.removeEventListener)&&window.removeEventListener("resize",c,!1),i.removeChild(o)},h.appendChild(_),i.appendChild(o)};Vy.prototype.isDestroyed=function(){return!1};Vy.prototype.destroy=function(){l(this._scene)&&(this._scene.renderError.removeEventListener(this._onRenderError),this._scene=this._scene.destroy()),this._container.removeChild(this._element),this._creditContainer.removeChild(this._innerCreditContainer),Je(this)};Vy.prototype.resize=function(){const e=this._canvas;!this._forceResize&&this._canvasClientWidth===e.clientWidth&&this._canvasClientHeight===e.clientHeight&&this._lastDevicePixelRatio===window.devicePixelRatio||(this._forceResize=!1,Wee(this),qee(this),this._scene.requestRender())};Vy.prototype.render=function(){if(this._canRender){this._scene.initializeFrame();const e=this._clock.tick();this._scene.render(e)}else this._clock.tick()};function Cr(e){this._value=void 0,this._hasClone=!1,this._hasEquals=!1,this._definitionChanged=new lt,this.setValue(e)}Object.defineProperties(Cr.prototype,{isConstant:{value:!0},definitionChanged:{get:function(){return this._definitionChanged}}});Cr.prototype.getValue=function(e,t){return this._hasClone?this._value.clone(t):this._value};Cr.prototype.setValue=function(e){const t=this._value;if(t!==e){const n=l(e),i=n&&typeof e.clone=="function",o=n&&typeof e.equals=="function";(!o||!e.equals(t))&&(this._hasClone=i,this._hasEquals=o,this._value=i?e.clone(this._value):e,this._definitionChanged.raiseEvent(this))}};Cr.prototype.equals=function(e){return this===e||e instanceof Cr&&(!this._hasEquals&&this._value===e._value||this._hasEquals&&this._value.equals(e._value))};Cr.prototype.valueOf=function(){return this._value};Cr.prototype.toString=function(){return String(this._value)};function H9e(e,t,n,i,o){return{configurable:i,get:function(){return this[t]},set:function(r){const s=this[t],a=this[n];l(a)&&(a(),this[n]=void 0),r!==void 0&&(!l(r)||!l(r.getValue))&&l(o)&&(r=o(r)),s!==r&&(this[t]=r,this._definitionChanged.raiseEvent(this,e,r,s)),l(r)&&l(r.definitionChanged)&&(this[n]=r.definitionChanged.addEventListener(function(){this._definitionChanged.raiseEvent(this,e,r,r)},this))}}}function V9e(e){return new Cr(e)}function xe(e,t,n){return H9e(e,`_${e.toString()}`,`_${e.toString()}Subscription`,A(t,!1),A(n,V9e))}function OE(e){this._definitionChanged=new lt,this._show=void 0,this._showSubscription=void 0,this._image=void 0,this._imageSubscription=void 0,this._scale=void 0,this._scaleSubscription=void 0,this._pixelOffset=void 0,this._pixelOffsetSubscription=void 0,this._eyeOffset=void 0,this._eyeOffsetSubscription=void 0,this._horizontalOrigin=void 0,this._horizontalOriginSubscription=void 0,this._verticalOrigin=void 0,this._verticalOriginSubscription=void 0,this._heightReference=void 0,this._heightReferenceSubscription=void 0,this._color=void 0,this._colorSubscription=void 0,this._rotation=void 0,this._rotationSubscription=void 0,this._alignedAxis=void 0,this._alignedAxisSubscription=void 0,this._sizeInMeters=void 0,this._sizeInMetersSubscription=void 0,this._width=void 0,this._widthSubscription=void 0,this._height=void 0,this._heightSubscription=void 0,this._scaleByDistance=void 0,this._scaleByDistanceSubscription=void 0,this._translucencyByDistance=void 0,this._translucencyByDistanceSubscription=void 0,this._pixelOffsetScaleByDistance=void 0,this._pixelOffsetScaleByDistanceSubscription=void 0,this._imageSubRegion=void 0,this._imageSubRegionSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this._disableDepthTestDistance=void 0,this._disableDepthTestDistanceSubscription=void 0,this.merge(A(e,A.EMPTY_OBJECT))}Object.defineProperties(OE.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:xe("show"),image:xe("image"),scale:xe("scale"),pixelOffset:xe("pixelOffset"),eyeOffset:xe("eyeOffset"),horizontalOrigin:xe("horizontalOrigin"),verticalOrigin:xe("verticalOrigin"),heightReference:xe("heightReference"),color:xe("color"),rotation:xe("rotation"),alignedAxis:xe("alignedAxis"),sizeInMeters:xe("sizeInMeters"),width:xe("width"),height:xe("height"),scaleByDistance:xe("scaleByDistance"),translucencyByDistance:xe("translucencyByDistance"),pixelOffsetScaleByDistance:xe("pixelOffsetScaleByDistance"),imageSubRegion:xe("imageSubRegion"),distanceDisplayCondition:xe("distanceDisplayCondition"),disableDepthTestDistance:xe("disableDepthTestDistance")});OE.prototype.clone=function(e){return l(e)?(e.show=this._show,e.image=this._image,e.scale=this._scale,e.pixelOffset=this._pixelOffset,e.eyeOffset=this._eyeOffset,e.horizontalOrigin=this._horizontalOrigin,e.verticalOrigin=this._verticalOrigin,e.heightReference=this._heightReference,e.color=this._color,e.rotation=this._rotation,e.alignedAxis=this._alignedAxis,e.sizeInMeters=this._sizeInMeters,e.width=this._width,e.height=this._height,e.scaleByDistance=this._scaleByDistance,e.translucencyByDistance=this._translucencyByDistance,e.pixelOffsetScaleByDistance=this._pixelOffsetScaleByDistance,e.imageSubRegion=this._imageSubRegion,e.distanceDisplayCondition=this._distanceDisplayCondition,e.disableDepthTestDistance=this._disableDepthTestDistance,e):new OE(this)};OE.prototype.merge=function(e){if(!l(e))throw new w("source is required.");this.show=A(this._show,e.show),this.image=A(this._image,e.image),this.scale=A(this._scale,e.scale),this.pixelOffset=A(this._pixelOffset,e.pixelOffset),this.eyeOffset=A(this._eyeOffset,e.eyeOffset),this.horizontalOrigin=A(this._horizontalOrigin,e.horizontalOrigin),this.verticalOrigin=A(this._verticalOrigin,e.verticalOrigin),this.heightReference=A(this._heightReference,e.heightReference),this.color=A(this._color,e.color),this.rotation=A(this._rotation,e.rotation),this.alignedAxis=A(this._alignedAxis,e.alignedAxis),this.sizeInMeters=A(this._sizeInMeters,e.sizeInMeters),this.width=A(this._width,e.width),this.height=A(this._height,e.height),this.scaleByDistance=A(this._scaleByDistance,e.scaleByDistance),this.translucencyByDistance=A(this._translucencyByDistance,e.translucencyByDistance),this.pixelOffsetScaleByDistance=A(this._pixelOffsetScaleByDistance,e.pixelOffsetScaleByDistance),this.imageSubRegion=A(this._imageSubRegion,e.imageSubRegion),this.distanceDisplayCondition=A(this._distanceDisplayCondition,e.distanceDisplayCondition),this.disableDepthTestDistance=A(this._disableDepthTestDistance,e.disableDepthTestDistance)};function sn(e,t){e=A(e,0),this._near=e,t=A(t,Number.MAX_VALUE),this._far=t}Object.defineProperties(sn.prototype,{near:{get:function(){return this._near},set:function(e){this._near=e}},far:{get:function(){return this._far},set:function(e){this._far=e}}});sn.packedLength=2;sn.pack=function(e,t,n){if(!l(e))throw new w("value is required");if(!l(t))throw new w("array is required");return n=A(n,0),t[n++]=e.near,t[n]=e.far,t};sn.unpack=function(e,t,n){if(!l(e))throw new w("array is required");return t=A(t,0),l(n)||(n=new sn),n.near=e[t++],n.far=e[t],n};sn.equals=function(e,t){return e===t||l(e)&&l(t)&&e.near===t.near&&e.far===t.far};sn.clone=function(e,t){if(l(e))return l(t)||(t=new sn),t.near=e.near,t.far=e.far,t};sn.prototype.clone=function(e){return sn.clone(this,e)};sn.prototype.equals=function(e){return sn.equals(this,e)};const k9e={NONE:0,CLAMP_TO_GROUND:1,RELATIVE_TO_GROUND:2},Ht=Object.freeze(k9e),G9e={CENTER:0,LEFT:1,RIGHT:-1},yc=Object.freeze(G9e),W9e={CENTER:0,BOTTOM:1,BASELINE:2,TOP:-1},co=Object.freeze(W9e),q9e={DONE:0,PENDING:1,FAILED:2},Ot=Object.freeze(q9e);function ie(){w.throwInstantiationError()}Object.defineProperties(ie.prototype,{isConstant:{get:w.throwInstantiationError},definitionChanged:{get:w.throwInstantiationError}});ie.prototype.getValue=w.throwInstantiationError;ie.prototype.equals=w.throwInstantiationError;ie.equals=function(e,t){return e===t||l(e)&&e.equals(t)};ie.arrayEquals=function(e,t){if(e===t)return!0;if(!l(e)||!l(t)||e.length!==t.length)return!1;const n=e.length;for(let i=0;i<n;i++)if(!ie.equals(e[i],t[i]))return!1;return!0};ie.isConstant=function(e){return!l(e)||e.isConstant};ie.getValueOrUndefined=function(e,t,n){return l(e)?e.getValue(t,n):void 0};ie.getValueOrDefault=function(e,t,n,i){return l(e)?A(e.getValue(t,i),n):n};ie.getValueOrClonedDefault=function(e,t,n,i){let o;return l(e)&&(o=e.getValue(t,i)),l(o)||(o=n.clone(o)),o};const j9e=k.WHITE,Y9e=d.ZERO,$9e=Ht.NONE,X9e=$.ZERO,K9e=1,J9e=0,Q9e=d.ZERO,Z9e=yc.CENTER,eqe=co.CENTER,tqe=!1,nqe=new d,iqe=new k,oqe=new d,rqe=new $,sqe=new tn,aqe=new tn,cqe=new tn,lqe=new at,uqe=new sn;function ZW(e){this.entity=e,this.billboard=void 0,this.textureValue=void 0}function n_(e,t){if(!l(e))throw new w("entityCluster is required.");if(!l(t))throw new w("entityCollection is required.");t.collectionChanged.addEventListener(n_.prototype._onCollectionChanged,this),this._cluster=e,this._entityCollection=t,this._items=new Vt,this._onCollectionChanged(t,t.values,[],[])}n_.prototype.update=function(e){if(!l(e))throw new w("time is required.");const t=this._items.values,n=this._cluster;for(let i=0,o=t.length;i<o;i++){const r=t[i],s=r.entity,a=s._billboard;let c,u=r.billboard,f=s.isShowing&&s.isAvailable(e)&&ie.getValueOrDefault(a._show,e,!0),h;if(f&&(h=ie.getValueOrUndefined(s._position,e,nqe),c=ie.getValueOrUndefined(a._image,e),f=l(h)&&l(c)),!f){MF(r,s,n);continue}ie.isConstant(s._position)||(n._clusterDirty=!0),l(u)||(u=n.getBillboard(s),u.id=s,u.image=void 0,r.billboard=u),u.show=f,(!l(u.image)||r.textureValue!==c)&&(u.image=c,r.textureValue=c),u.position=h,u.color=ie.getValueOrDefault(a._color,e,j9e,iqe),u.eyeOffset=ie.getValueOrDefault(a._eyeOffset,e,Y9e,oqe),u.heightReference=ie.getValueOrDefault(a._heightReference,e,$9e),u.pixelOffset=ie.getValueOrDefault(a._pixelOffset,e,X9e,rqe),u.scale=ie.getValueOrDefault(a._scale,e,K9e),u.rotation=ie.getValueOrDefault(a._rotation,e,J9e),u.alignedAxis=ie.getValueOrDefault(a._alignedAxis,e,Q9e),u.horizontalOrigin=ie.getValueOrDefault(a._horizontalOrigin,e,Z9e),u.verticalOrigin=ie.getValueOrDefault(a._verticalOrigin,e,eqe),u.width=ie.getValueOrUndefined(a._width,e),u.height=ie.getValueOrUndefined(a._height,e),u.scaleByDistance=ie.getValueOrUndefined(a._scaleByDistance,e,sqe),u.translucencyByDistance=ie.getValueOrUndefined(a._translucencyByDistance,e,aqe),u.pixelOffsetScaleByDistance=ie.getValueOrUndefined(a._pixelOffsetScaleByDistance,e,cqe),u.sizeInMeters=ie.getValueOrDefault(a._sizeInMeters,e,tqe),u.distanceDisplayCondition=ie.getValueOrUndefined(a._distanceDisplayCondition,e,uqe),u.disableDepthTestDistance=ie.getValueOrUndefined(a._disableDepthTestDistance,e);const _=ie.getValueOrUndefined(a._imageSubRegion,e,lqe);l(_)&&u.setImageSubRegion(u._imageId,_)}return!0};n_.prototype.getBoundingSphere=function(e,t){if(!l(e))throw new w("entity is required.");if(!l(t))throw new w("result is required.");const n=this._items.get(e.id);if(!l(n)||!l(n.billboard))return Ot.FAILED;const i=n.billboard;if(i.heightReference===Ht.NONE)t.center=d.clone(i.position,t.center);else{if(!l(i._clampedPosition))return Ot.PENDING;t.center=d.clone(i._clampedPosition,t.center)}return t.radius=0,Ot.DONE};n_.prototype.isDestroyed=function(){return!1};n_.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(n_.prototype._onCollectionChanged,this);const e=this._entityCollection.values;for(let t=0;t<e.length;t++)this._cluster.removeBillboard(e[t]);return Je(this)};n_.prototype._onCollectionChanged=function(e,t,n,i){let o,r;const s=this._items,a=this._cluster;for(o=t.length-1;o>-1;o--)r=t[o],l(r._billboard)&&l(r._position)&&s.set(r.id,new ZW(r));for(o=i.length-1;o>-1;o--)r=i[o],l(r._billboard)&&l(r._position)?s.contains(r.id)||s.set(r.id,new ZW(r)):(MF(s.get(r.id),r,a),s.remove(r.id));for(o=n.length-1;o>-1;o--)r=n[o],MF(s.get(r.id),r,a),s.remove(r.id)};function MF(e,t,n){l(e)&&(e.billboard=void 0,n.removeBillboard(t))}function Yi(e,t){if(e=A(e,0),t=A(t,Number.MAX_VALUE),t<=e)throw new w("far distance must be greater than near distance.");this.value=new Float32Array([e,t])}Object.defineProperties(Yi.prototype,{componentDatatype:{get:function(){return oe.FLOAT}},componentsPerAttribute:{get:function(){return 2}},normalize:{get:function(){return!1}}});Yi.fromDistanceDisplayCondition=function(e){if(!l(e))throw new w("distanceDisplayCondition is required.");if(e.far<=e.near)throw new w("distanceDisplayCondition.far distance must be greater than distanceDisplayCondition.near distance.");return new Yi(e.near,e.far)};Yi.toValue=function(e,t){if(!l(e))throw new w("distanceDisplayCondition is required.");return l(t)?(t[0]=e.near,t[1]=e.far,t):new Float32Array([e.near,e.far])};function bn(e){e=A(e,A.EMPTY_OBJECT),this.start=l(e.start)?ce.clone(e.start):new ce,this.stop=l(e.stop)?ce.clone(e.stop):new ce,this.data=e.data,this.isStartIncluded=A(e.isStartIncluded,!0),this.isStopIncluded=A(e.isStopIncluded,!0)}Object.defineProperties(bn.prototype,{isEmpty:{get:function(){const e=ce.compare(this.stop,this.start);return e<0||e===0&&(!this.isStartIncluded||!this.isStopIncluded)}}});const O0={start:void 0,stop:void 0,isStartIncluded:void 0,isStopIncluded:void 0,data:void 0};bn.fromIso8601=function(e,t){E.typeOf.object("options",e),E.typeOf.string("options.iso8601",e.iso8601);const n=e.iso8601.split("/");if(n.length!==2)throw new w("options.iso8601 is an invalid ISO 8601 interval.");const i=ce.fromIso8601(n[0]),o=ce.fromIso8601(n[1]),r=A(e.isStartIncluded,!0),s=A(e.isStopIncluded,!0),a=e.data;return l(t)?(t.start=i,t.stop=o,t.isStartIncluded=r,t.isStopIncluded=s,t.data=a,t):(O0.start=i,O0.stop=o,O0.isStartIncluded=r,O0.isStopIncluded=s,O0.data=a,new bn(O0))};bn.toIso8601=function(e,t){return E.typeOf.object("timeInterval",e),`${ce.toIso8601(e.start,t)}/${ce.toIso8601(e.stop,t)}`};bn.clone=function(e,t){if(l(e))return l(t)?(t.start=e.start,t.stop=e.stop,t.isStartIncluded=e.isStartIncluded,t.isStopIncluded=e.isStopIncluded,t.data=e.data,t):new bn(e)};bn.equals=function(e,t,n){return e===t||l(e)&&l(t)&&(e.isEmpty&&t.isEmpty||e.isStartIncluded===t.isStartIncluded&&e.isStopIncluded===t.isStopIncluded&&ce.equals(e.start,t.start)&&ce.equals(e.stop,t.stop)&&(e.data===t.data||l(n)&&n(e.data,t.data)))};bn.equalsEpsilon=function(e,t,n,i){return n=A(n,0),e===t||l(e)&&l(t)&&(e.isEmpty&&t.isEmpty||e.isStartIncluded===t.isStartIncluded&&e.isStopIncluded===t.isStopIncluded&&ce.equalsEpsilon(e.start,t.start,n)&&ce.equalsEpsilon(e.stop,t.stop,n)&&(e.data===t.data||l(i)&&i(e.data,t.data)))};bn.intersect=function(e,t,n,i){if(E.typeOf.object("left",e),!l(t))return bn.clone(bn.EMPTY,n);const o=e.start,r=e.stop,s=t.start,a=t.stop,c=ce.greaterThanOrEquals(s,o)&&ce.greaterThanOrEquals(r,s),u=!c&&ce.lessThanOrEquals(s,o)&&ce.lessThanOrEquals(o,a);if(!c&&!u)return bn.clone(bn.EMPTY,n);const f=e.isStartIncluded,h=e.isStopIncluded,_=t.isStartIncluded,g=t.isStopIncluded,p=ce.lessThan(r,a);return l(n)||(n=new bn),n.start=c?s:o,n.isStartIncluded=f&&_||!ce.equals(s,o)&&(c&&_||u&&f),n.stop=p?r:a,n.isStopIncluded=p?h:h&&g||!ce.equals(a,r)&&g,n.data=l(i)?i(e.data,t.data):e.data,n};bn.contains=function(e,t){if(E.typeOf.object("timeInterval",e),E.typeOf.object("julianDate",t),e.isEmpty)return!1;const n=ce.compare(e.start,t);if(n===0)return e.isStartIncluded;const i=ce.compare(t,e.stop);return i===0?e.isStopIncluded:n<0&&i<0};bn.prototype.clone=function(e){return bn.clone(this,e)};bn.prototype.equals=function(e,t){return bn.equals(this,e,t)};bn.prototype.equalsEpsilon=function(e,t,n){return bn.equalsEpsilon(this,e,t,n)};bn.prototype.toString=function(){return bn.toIso8601(this)};bn.EMPTY=Object.freeze(new bn({start:new ce,stop:new ce,isStartIncluded:!1,isStopIncluded:!1}));const jee=Object.freeze(ce.fromIso8601("0000-01-01T00:00:00Z")),Yee=Object.freeze(ce.fromIso8601("9999-12-31T24:00:00Z")),fqe=Object.freeze(new bn({start:jee,stop:Yee})),dqe={MINIMUM_VALUE:jee,MAXIMUM_VALUE:Yee,MAXIMUM_INTERVAL:fqe},wt=dqe,hqe=`varying vec3 v_positionEC;
|
||
varying vec3 v_normalEC;
|
||
varying vec3 v_tangentEC;
|
||
varying vec3 v_bitangentEC;
|
||
varying vec2 v_st;
|
||
|
||
void main()
|
||
{
|
||
vec3 positionToEyeEC = -v_positionEC;
|
||
mat3 tangentToEyeMatrix = czm_tangentToEyeSpaceMatrix(v_normalEC, v_tangentEC, v_bitangentEC);
|
||
|
||
vec3 normalEC = normalize(v_normalEC);
|
||
#ifdef FACE_FORWARD
|
||
normalEC = faceforward(normalEC, vec3(0.0, 0.0, 1.0), -normalEC);
|
||
#endif
|
||
|
||
czm_materialInput materialInput;
|
||
materialInput.normalEC = normalEC;
|
||
materialInput.tangentToEyeMatrix = tangentToEyeMatrix;
|
||
materialInput.positionToEyeEC = positionToEyeEC;
|
||
materialInput.st = v_st;
|
||
czm_material material = czm_getMaterial(materialInput);
|
||
|
||
#ifdef FLAT
|
||
gl_FragColor = vec4(material.diffuse + material.emission, material.alpha);
|
||
#else
|
||
gl_FragColor = czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC);
|
||
#endif
|
||
}
|
||
`,pqe=`attribute vec3 position3DHigh;
|
||
attribute vec3 position3DLow;
|
||
attribute vec3 normal;
|
||
attribute vec3 tangent;
|
||
attribute vec3 bitangent;
|
||
attribute vec2 st;
|
||
attribute float batchId;
|
||
|
||
varying vec3 v_positionEC;
|
||
varying vec3 v_normalEC;
|
||
varying vec3 v_tangentEC;
|
||
varying vec3 v_bitangentEC;
|
||
varying vec2 v_st;
|
||
|
||
void main()
|
||
{
|
||
vec4 p = czm_computePosition();
|
||
|
||
v_positionEC = (czm_modelViewRelativeToEye * p).xyz; // position in eye coordinates
|
||
v_normalEC = czm_normal * normal; // normal in eye coordinates
|
||
v_tangentEC = czm_normal * tangent; // tangent in eye coordinates
|
||
v_bitangentEC = czm_normal * bitangent; // bitangent in eye coordinates
|
||
v_st = st;
|
||
|
||
gl_Position = czm_modelViewProjectionRelativeToEye * p;
|
||
}
|
||
`,mqe=`varying vec3 v_positionEC;
|
||
varying vec3 v_normalEC;
|
||
|
||
void main()
|
||
{
|
||
vec3 positionToEyeEC = -v_positionEC;
|
||
|
||
vec3 normalEC = normalize(v_normalEC);
|
||
#ifdef FACE_FORWARD
|
||
normalEC = faceforward(normalEC, vec3(0.0, 0.0, 1.0), -normalEC);
|
||
#endif
|
||
|
||
czm_materialInput materialInput;
|
||
materialInput.normalEC = normalEC;
|
||
materialInput.positionToEyeEC = positionToEyeEC;
|
||
czm_material material = czm_getMaterial(materialInput);
|
||
|
||
#ifdef FLAT
|
||
gl_FragColor = vec4(material.diffuse + material.emission, material.alpha);
|
||
#else
|
||
gl_FragColor = czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC);
|
||
#endif
|
||
}
|
||
`,_qe=`attribute vec3 position3DHigh;
|
||
attribute vec3 position3DLow;
|
||
attribute vec3 normal;
|
||
attribute float batchId;
|
||
|
||
varying vec3 v_positionEC;
|
||
varying vec3 v_normalEC;
|
||
|
||
void main()
|
||
{
|
||
vec4 p = czm_computePosition();
|
||
|
||
v_positionEC = (czm_modelViewRelativeToEye * p).xyz; // position in eye coordinates
|
||
v_normalEC = czm_normal * normal; // normal in eye coordinates
|
||
|
||
gl_Position = czm_modelViewProjectionRelativeToEye * p;
|
||
}
|
||
`,gqe=`varying vec3 v_positionEC;
|
||
varying vec3 v_normalEC;
|
||
varying vec2 v_st;
|
||
|
||
void main()
|
||
{
|
||
vec3 positionToEyeEC = -v_positionEC;
|
||
|
||
vec3 normalEC = normalize(v_normalEC);
|
||
#ifdef FACE_FORWARD
|
||
normalEC = faceforward(normalEC, vec3(0.0, 0.0, 1.0), -normalEC);
|
||
#endif
|
||
|
||
czm_materialInput materialInput;
|
||
materialInput.normalEC = normalEC;
|
||
materialInput.positionToEyeEC = positionToEyeEC;
|
||
materialInput.st = v_st;
|
||
czm_material material = czm_getMaterial(materialInput);
|
||
|
||
#ifdef FLAT
|
||
gl_FragColor = vec4(material.diffuse + material.emission, material.alpha);
|
||
#else
|
||
gl_FragColor = czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC);
|
||
#endif
|
||
}
|
||
`,yqe=`attribute vec3 position3DHigh;
|
||
attribute vec3 position3DLow;
|
||
attribute vec3 normal;
|
||
attribute vec2 st;
|
||
attribute float batchId;
|
||
|
||
varying vec3 v_positionEC;
|
||
varying vec3 v_normalEC;
|
||
varying vec2 v_st;
|
||
|
||
void main()
|
||
{
|
||
vec4 p = czm_computePosition();
|
||
|
||
v_positionEC = (czm_modelViewRelativeToEye * p).xyz; // position in eye coordinates
|
||
v_normalEC = czm_normal * normal; // normal in eye coordinates
|
||
v_st = st;
|
||
|
||
gl_Position = czm_modelViewProjectionRelativeToEye * p;
|
||
}
|
||
`;function Dr(e){e=A(e,A.EMPTY_OBJECT);const t=A(e.translucent,!0),n=A(e.closed,!1),i=A(e.materialSupport,Dr.MaterialSupport.TEXTURED);this.material=l(e.material)?e.material:$e.fromType($e.ColorType),this.translucent=t,this._vertexShaderSource=A(e.vertexShaderSource,i.vertexShaderSource),this._fragmentShaderSource=A(e.fragmentShaderSource,i.fragmentShaderSource),this._renderState=ns.getDefaultRenderState(t,n,e.renderState),this._closed=n,this._materialSupport=i,this._vertexFormat=i.vertexFormat,this._flat=A(e.flat,!1),this._faceForward=A(e.faceForward,!n)}Object.defineProperties(Dr.prototype,{vertexShaderSource:{get:function(){return this._vertexShaderSource}},fragmentShaderSource:{get:function(){return this._fragmentShaderSource}},renderState:{get:function(){return this._renderState}},closed:{get:function(){return this._closed}},materialSupport:{get:function(){return this._materialSupport}},vertexFormat:{get:function(){return this._vertexFormat}},flat:{get:function(){return this._flat}},faceForward:{get:function(){return this._faceForward}}});Dr.prototype.getFragmentShaderSource=ns.prototype.getFragmentShaderSource;Dr.prototype.isTranslucent=ns.prototype.isTranslucent;Dr.prototype.getRenderState=ns.prototype.getRenderState;Dr.MaterialSupport={BASIC:Object.freeze({vertexFormat:Ye.POSITION_AND_NORMAL,vertexShaderSource:_qe,fragmentShaderSource:mqe}),TEXTURED:Object.freeze({vertexFormat:Ye.POSITION_NORMAL_AND_ST,vertexShaderSource:yqe,fragmentShaderSource:gqe}),ALL:Object.freeze({vertexFormat:Ye.ALL,vertexShaderSource:pqe,fragmentShaderSource:hqe})};function An(e){this._definitionChanged=new lt,this._color=void 0,this._colorSubscription=void 0,this.color=e}Object.defineProperties(An.prototype,{isConstant:{get:function(){return ie.isConstant(this._color)}},definitionChanged:{get:function(){return this._definitionChanged}},color:xe("color")});An.prototype.getType=function(e){return"Color"};An.prototype.getValue=function(e,t){return l(t)||(t={}),t.color=ie.getValueOrClonedDefault(this._color,e,k.WHITE,t.color),t};An.prototype.equals=function(e){return this===e||e instanceof An&&ie.equals(this._color,e._color)};const $ee={TERRAIN:0,CESIUM_3D_TILE:1,BOTH:2};$ee.NUMBER_OF_CLASSIFICATION_TYPES=3;const ir=Object.freeze($ee);function Zu(e){if(e=A(e,A.EMPTY_OBJECT),!l(e.componentDatatype))throw new w("options.componentDatatype is required.");if(!l(e.componentsPerAttribute))throw new w("options.componentsPerAttribute is required.");if(e.componentsPerAttribute<1||e.componentsPerAttribute>4)throw new w("options.componentsPerAttribute must be between 1 and 4.");if(!l(e.value))throw new w("options.value is required.");this.componentDatatype=e.componentDatatype,this.componentsPerAttribute=e.componentsPerAttribute,this.normalize=A(e.normalize,!1),this.value=e.value}function Ys(e,t,n){E.typeOf.bool("extentsCulling",e),E.typeOf.bool("planarExtents",t),E.typeOf.object("appearance",n),this._projectionExtentDefines={eastMostYhighDefine:"",eastMostYlowDefine:"",westMostYhighDefine:"",westMostYlowDefine:""};const i=new FF;i.requiresTextureCoordinates=e,i.requiresEC=!n.flat;const o=new FF;if(o.requiresTextureCoordinates=e,n instanceof kn)i.requiresNormalEC=!n.flat;else{const r=`${n.material.shaderSource}
|
||
${n.fragmentShaderSource}`;i.normalEC=r.indexOf("materialInput.normalEC")!==-1||r.indexOf("czm_getDefaultMaterial")!==-1,i.positionToEyeEC=r.indexOf("materialInput.positionToEyeEC")!==-1,i.tangentToEyeMatrix=r.indexOf("materialInput.tangentToEyeMatrix")!==-1,i.st=r.indexOf("materialInput.st")!==-1}this._colorShaderDependencies=i,this._pickShaderDependencies=o,this._appearance=n,this._extentsCulling=e,this._planarExtents=t}Ys.prototype.createFragmentShader=function(e){E.typeOf.bool("columbusView2D",e);const t=this._appearance,n=this._colorShaderDependencies,i=[];!e&&!this._planarExtents&&i.push("SPHERICAL"),n.requiresEC&&i.push("REQUIRES_EC"),n.requiresWC&&i.push("REQUIRES_WC"),n.requiresTextureCoordinates&&i.push("TEXTURE_COORDINATES"),this._extentsCulling&&i.push("CULL_FRAGMENTS"),n.requiresNormalEC&&i.push("NORMAL_EC"),t instanceof kn&&i.push("PER_INSTANCE_COLOR"),n.normalEC&&i.push("USES_NORMAL_EC"),n.positionToEyeEC&&i.push("USES_POSITION_TO_EYE_EC"),n.tangentToEyeMatrix&&i.push("USES_TANGENT_TO_EYE"),n.st&&i.push("USES_ST"),t.flat&&i.push("FLAT");let o="";return t instanceof kn||(o=t.material.shaderSource),new nt({defines:i,sources:[o,KK]})};Ys.prototype.createPickFragmentShader=function(e){E.typeOf.bool("columbusView2D",e);const t=this._pickShaderDependencies,n=["PICK"];return!e&&!this._planarExtents&&n.push("SPHERICAL"),t.requiresEC&&n.push("REQUIRES_EC"),t.requiresWC&&n.push("REQUIRES_WC"),t.requiresTextureCoordinates&&n.push("TEXTURE_COORDINATES"),this._extentsCulling&&n.push("CULL_FRAGMENTS"),new nt({defines:n,sources:[KK],pickColorQualifier:"varying"})};Ys.prototype.createVertexShader=function(e,t,n,i){return E.defined("defines",e),E.typeOf.string("vertexShaderSource",t),E.typeOf.bool("columbusView2D",n),E.defined("mapProjection",i),Xee(this._colorShaderDependencies,this._planarExtents,n,e,t,this._appearance,i,this._projectionExtentDefines)};Ys.prototype.createPickVertexShader=function(e,t,n,i){return E.defined("defines",e),E.typeOf.string("vertexShaderSource",t),E.typeOf.bool("columbusView2D",n),E.defined("mapProjection",i),Xee(this._pickShaderDependencies,this._planarExtents,n,e,t,void 0,i,this._projectionExtentDefines)};const e9=new d,t9=new ve,n9={high:0,low:0};function Xee(e,t,n,i,o,r,s,a){const c=i.slice();if(a.eastMostYhighDefine===""){const u=t9;u.longitude=F.PI,u.latitude=0,u.height=0;const f=s.project(u,e9);let h=Zn.encode(f.x,n9);a.eastMostYhighDefine=`EAST_MOST_X_HIGH ${h.high.toFixed(`${h.high}`.length+1)}`,a.eastMostYlowDefine=`EAST_MOST_X_LOW ${h.low.toFixed(`${h.low}`.length+1)}`;const _=t9;_.longitude=-F.PI,_.latitude=0,_.height=0;const g=s.project(_,e9);h=Zn.encode(g.x,n9),a.westMostYhighDefine=`WEST_MOST_X_HIGH ${h.high.toFixed(`${h.high}`.length+1)}`,a.westMostYlowDefine=`WEST_MOST_X_LOW ${h.low.toFixed(`${h.low}`.length+1)}`}return n&&(c.push(a.eastMostYhighDefine),c.push(a.eastMostYlowDefine),c.push(a.westMostYhighDefine),c.push(a.westMostYlowDefine)),l(r)&&r instanceof kn&&c.push("PER_INSTANCE_COLOR"),e.requiresTextureCoordinates&&(c.push("TEXTURE_COORDINATES"),t||n||c.push("SPHERICAL"),n&&c.push("COLUMBUS_VIEW_2D")),new nt({defines:c,sources:[o]})}function FF(){this._requiresEC=!1,this._requiresWC=!1,this._requiresNormalEC=!1,this._requiresTextureCoordinates=!1,this._usesNormalEC=!1,this._usesPositionToEyeEC=!1,this._usesTangentToEyeMat=!1,this._usesSt=!1}Object.defineProperties(FF.prototype,{requiresEC:{get:function(){return this._requiresEC},set:function(e){this._requiresEC=e||this._requiresEC}},requiresWC:{get:function(){return this._requiresWC},set:function(e){this._requiresWC=e||this._requiresWC,this.requiresEC=this._requiresWC}},requiresNormalEC:{get:function(){return this._requiresNormalEC},set:function(e){this._requiresNormalEC=e||this._requiresNormalEC,this.requiresEC=this._requiresNormalEC}},requiresTextureCoordinates:{get:function(){return this._requiresTextureCoordinates},set:function(e){this._requiresTextureCoordinates=e||this._requiresTextureCoordinates,this.requiresWC=this._requiresTextureCoordinates}},normalEC:{set:function(e){this.requiresNormalEC=e,this._usesNormalEC=e},get:function(){return this._usesNormalEC}},tangentToEyeMatrix:{set:function(e){this.requiresWC=e,this.requiresNormalEC=e,this._usesTangentToEyeMat=e},get:function(){return this._usesTangentToEyeMat}},positionToEyeEC:{set:function(e){this.requiresEC=e,this._usesPositionToEyeEC=e},get:function(){return this._usesPositionToEyeEC}},st:{set:function(e){this.requiresTextureCoordinates=e,this._usesSt=e},get:function(){return this._usesSt}}});function i9(e,t,n){return Math.abs((t.y-e.y)*n.x-(t.x-e.x)*n.y+t.x*e.y-t.y*e.x)/$.distance(t,e)}const Aqe=[new $,new $,new $,new $];function Kee(e,t){const n=Aqe,i=$.unpack(t,0,n[0]),o=$.unpack(t,2,n[1]),r=$.unpack(t,4,n[2]);e.uMaxVmax=new Zu({componentDatatype:oe.FLOAT,componentsPerAttribute:4,normalize:!1,value:[o.x,o.y,r.x,r.y]});const s=1/i9(i,o,r),a=1/i9(i,r,o);e.uvMinAndExtents=new Zu({componentDatatype:oe.FLOAT,componentsPerAttribute:4,normalize:!1,value:[i.x,i.y,s,a]})}const Jee=new ve,Qee=new d,Tqe=new d,Cqe=new d,yv={high:0,low:0};function Zee(e,t,n){const i=Jee;i.height=0,i.longitude=e.west,i.latitude=e.south;const o=t.project(i,Qee);i.latitude=e.north;const r=t.project(i,Tqe);i.longitude=e.east,i.latitude=e.south;const s=t.project(i,Cqe),a=[0,0,0,0],c=[0,0,0,0];let u=Zn.encode(o.x,yv);a[0]=u.high,c[0]=u.low,u=Zn.encode(o.y,yv),a[1]=u.high,c[1]=u.low,u=Zn.encode(r.y,yv),a[2]=u.high,c[2]=u.low,u=Zn.encode(s.x,yv),a[3]=u.high,c[3]=u.low,n.planes2D_HIGH=new Zu({componentDatatype:oe.FLOAT,componentsPerAttribute:4,normalize:!1,value:a}),n.planes2D_LOW=new Zu({componentDatatype:oe.FLOAT,componentsPerAttribute:4,normalize:!1,value:c})}const bqe=new N,Eqe=new N,o9=new d,xqe=new ve,wqe=[new ve,new ve,new ve,new ve,new ve,new ve,new ve,new ve];function Sqe(e,t,n,i,o,r){const s=Ee.center(e,xqe);s.height=n;const a=ve.toCartesian(s,t,o9),c=En.eastNorthUpToFixedFrame(a,t,bqe),u=N.inverse(c,Eqe),f=e.west,h=e.east,_=e.north,g=e.south,p=wqe;p[0].latitude=g,p[0].longitude=f,p[1].latitude=_,p[1].longitude=f,p[2].latitude=_,p[2].longitude=h,p[3].latitude=g,p[3].longitude=h;const y=(f+h)*.5,T=(_+g)*.5;p[4].latitude=g,p[4].longitude=y,p[5].latitude=_,p[5].longitude=y,p[6].latitude=T,p[6].longitude=f,p[7].latitude=T,p[7].longitude=h;let b=Number.POSITIVE_INFINITY,x=Number.NEGATIVE_INFINITY,v=Number.POSITIVE_INFINITY,D=Number.NEGATIVE_INFINITY;for(let M=0;M<8;M++){p[M].height=n;const H=ve.toCartesian(p[M],t,o9);N.multiplyByPoint(u,H,H),H.z=0,b=Math.min(b,H.x),x=Math.max(x,H.x),v=Math.min(v,H.y),D=Math.max(D,H.y)}const L=i;L.x=b,L.y=v,L.z=0,N.multiplyByPoint(c,L,L);const B=o;B.x=x,B.y=v,B.z=0,N.multiplyByPoint(c,B,B),d.subtract(B,L,o);const V=r;V.x=b,V.y=D,V.z=0,N.multiplyByPoint(c,V,V),d.subtract(V,L,r)}const vqe=new d,Dqe=new d,Iqe=new Zn;Ys.getPlanarTextureCoordinateAttributes=function(e,t,n,i,o){E.typeOf.object("boundingRectangle",e),E.defined("textureCoordinateRotationPoints",t),E.typeOf.object("ellipsoid",n),E.typeOf.object("projection",i);const r=Qee,s=vqe,a=Dqe;Sqe(e,n,A(o,0),r,s,a);const c={};Kee(c,t);const u=Zn.fromCartesian(r,Iqe);return c.southWest_HIGH=new Zu({componentDatatype:oe.FLOAT,componentsPerAttribute:3,normalize:!1,value:d.pack(u.high,[0,0,0])}),c.southWest_LOW=new Zu({componentDatatype:oe.FLOAT,componentsPerAttribute:3,normalize:!1,value:d.pack(u.low,[0,0,0])}),c.eastward=new Zu({componentDatatype:oe.FLOAT,componentsPerAttribute:3,normalize:!1,value:d.pack(s,[0,0,0])}),c.northward=new Zu({componentDatatype:oe.FLOAT,componentsPerAttribute:3,normalize:!1,value:d.pack(a,[0,0,0])}),Zee(e,i,c),c};const Pqe=new d;function r9(e,t,n,i){const o=Jee;o.latitude=e,o.longitude=t,o.height=0;const r=ve.toCartesian(o,n,Pqe),s=Math.sqrt(r.x*r.x+r.y*r.y),a=F.fastApproximateAtan2(s,r.z),c=F.fastApproximateAtan2(r.x,r.y);return i.x=a,i.y=c,i}const s9=new $;Ys.getSphericalExtentGeometryInstanceAttributes=function(e,t,n,i){E.typeOf.object("boundingRectangle",e),E.defined("textureCoordinateRotationPoints",t),E.typeOf.object("ellipsoid",n),E.typeOf.object("projection",i);const o=r9(e.south,e.west,n,s9);let r=o.x,s=o.y;const a=r9(e.north,e.east,n,s9);let c=a.x,u=a.y,f=0;s>u&&(f=F.PI-s,s=-F.PI,u+=f),r-=F.EPSILON5,s-=F.EPSILON5,c+=F.EPSILON5,u+=F.EPSILON5;const h=1/(u-s),_=1/(c-r),g={sphericalExtents:new Zu({componentDatatype:oe.FLOAT,componentsPerAttribute:4,normalize:!1,value:[r,s,_,h]}),longitudeRotation:new Zu({componentDatatype:oe.FLOAT,componentsPerAttribute:1,normalize:!1,value:[f]})};return Kee(g,t),Zee(e,i,g),g};Ys.hasAttributesForTextureCoordinatePlanes=function(e){return l(e.southWest_HIGH)&&l(e.southWest_LOW)&&l(e.northward)&&l(e.eastward)&&l(e.planes2D_HIGH)&&l(e.planes2D_LOW)&&l(e.uMaxVmax)&&l(e.uvMinAndExtents)};Ys.hasAttributesForSphericalExtents=function(e){return l(e.sphericalExtents)&&l(e.longitudeRotation)&&l(e.planes2D_HIGH)&&l(e.planes2D_LOW)&&l(e.uMaxVmax)&&l(e.uvMinAndExtents)};function Oqe(e){return Math.max(e.width,e.height)>Ys.MAX_WIDTH_FOR_PLANAR_EXTENTS}Ys.shouldUseSphericalCoordinates=function(e){return E.typeOf.object("rectangle",e),Oqe(e)};Ys.MAX_WIDTH_FOR_PLANAR_EXTENTS=F.toRadians(1);function C_(e){e=A(e,A.EMPTY_OBJECT);const t=e.geometryInstances;this.geometryInstances=t,this.show=A(e.show,!0),this.classificationType=A(e.classificationType,ir.BOTH),this.debugShowBoundingVolume=A(e.debugShowBoundingVolume,!1),this.debugShowShadowVolume=A(e.debugShowShadowVolume,!1),this._debugShowShadowVolume=!1,this._extruded=A(e._extruded,!1),this._uniformMap=e._uniformMap,this._sp=void 0,this._spStencil=void 0,this._spPick=void 0,this._spColor=void 0,this._spPick2D=void 0,this._spColor2D=void 0,this._rsStencilDepthPass=void 0,this._rsStencilDepthPass3DTiles=void 0,this._rsColorPass=void 0,this._rsPickPass=void 0,this._commandsIgnoreShow=[],this._ready=!1;const n=this;this._readyPromise=new Promise((i,o)=>{n._completeLoad=()=>{if(this._ready)return;this._ready=!0,this.releaseGeometryInstances&&(this.geometryInstances=void 0);const r=this._error;l(r)?o(r):i(this)}}),this._primitive=void 0,this._pickPrimitive=e._pickPrimitive,this._hasSphericalExtentsAttribute=!1,this._hasPlanarExtentsAttributes=!1,this._hasPerColorAttribute=!1,this.appearance=e.appearance,this._createBoundingVolumeFunction=e._createBoundingVolumeFunction,this._updateAndQueueCommandsFunction=e._updateAndQueueCommandsFunction,this._usePickOffsets=!1,this._primitiveOptions={geometryInstances:void 0,appearance:void 0,vertexCacheOptimize:A(e.vertexCacheOptimize,!1),interleave:A(e.interleave,!1),releaseGeometryInstances:A(e.releaseGeometryInstances,!0),allowPicking:A(e.allowPicking,!0),asynchronous:A(e.asynchronous,!0),compressVertices:A(e.compressVertices,!0),_createBoundingVolumeFunction:void 0,_createRenderStatesFunction:void 0,_createShaderProgramFunction:void 0,_createCommandsFunction:void 0,_updateAndQueueCommandsFunction:void 0,_createPickOffsets:!0}}Object.defineProperties(C_.prototype,{vertexCacheOptimize:{get:function(){return this._primitiveOptions.vertexCacheOptimize}},interleave:{get:function(){return this._primitiveOptions.interleave}},releaseGeometryInstances:{get:function(){return this._primitiveOptions.releaseGeometryInstances}},allowPicking:{get:function(){return this._primitiveOptions.allowPicking}},asynchronous:{get:function(){return this._primitiveOptions.asynchronous}},compressVertices:{get:function(){return this._primitiveOptions.compressVertices}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise}},_needs2DShader:{get:function(){return this._hasPlanarExtentsAttributes||this._hasSphericalExtentsAttribute}}});C_.isSupported=function(e){return e.context.stencilBuffer};function mA(e,t){const n=t?Ni.EQUAL:Ni.ALWAYS;return{colorMask:{red:!1,green:!1,blue:!1,alpha:!1},stencilTest:{enabled:e,frontFunction:n,frontOperation:{fail:It.KEEP,zFail:It.DECREMENT_WRAP,zPass:It.KEEP},backFunction:n,backOperation:{fail:It.KEEP,zFail:It.INCREMENT_WRAP,zPass:It.KEEP},reference:Kt.CESIUM_3D_TILE_MASK,mask:Kt.CESIUM_3D_TILE_MASK},stencilMask:Kt.CLASSIFICATION_MASK,depthTest:{enabled:!0,func:ty.LESS_OR_EQUAL},depthMask:!1}}function zF(e){return{stencilTest:{enabled:e,frontFunction:Ni.NOT_EQUAL,frontOperation:{fail:It.ZERO,zFail:It.ZERO,zPass:It.ZERO},backFunction:Ni.NOT_EQUAL,backOperation:{fail:It.ZERO,zFail:It.ZERO,zPass:It.ZERO},reference:0,mask:Kt.CLASSIFICATION_MASK},stencilMask:Kt.CLASSIFICATION_MASK,depthTest:{enabled:!1},depthMask:!1,blending:fo.PRE_MULTIPLIED_ALPHA_BLEND}}const Lqe={stencilTest:{enabled:!0,frontFunction:Ni.NOT_EQUAL,frontOperation:{fail:It.ZERO,zFail:It.ZERO,zPass:It.ZERO},backFunction:Ni.NOT_EQUAL,backOperation:{fail:It.ZERO,zFail:It.ZERO,zPass:It.ZERO},reference:0,mask:Kt.CLASSIFICATION_MASK},stencilMask:Kt.CLASSIFICATION_MASK,depthTest:{enabled:!1},depthMask:!1};function Bqe(e,t,n,i){if(l(e._rsStencilDepthPass))return;const o=!e.debugShowShadowVolume;e._rsStencilDepthPass=ht.fromCache(mA(o,!1)),e._rsStencilDepthPass3DTiles=ht.fromCache(mA(o,!0)),e._rsColorPass=ht.fromCache(zF(o)),e._rsPickPass=ht.fromCache(Lqe)}function Rqe(e,t){if(!e.compressVertices)return t;if(t.search(/attribute\s+vec3\s+extrudeDirection;/g)!==-1){const n="compressedAttributes",i=`attribute vec2 ${n};`,o=`vec3 extrudeDirection;
|
||
`,r=` extrudeDirection = czm_octDecode(${n}, 65535.0);
|
||
`;let s=t;s=s.replace(/attribute\s+vec3\s+extrudeDirection;/g,""),s=nt.replaceMain(s,"czm_non_compressed_main");const a=`void main()
|
||
{
|
||
${r} czm_non_compressed_main();
|
||
}`;return[i,o,s,a].join(`
|
||
`)}}function Nqe(e,t){const n=t.context,i=e._primitive;let o=qOe;o=e._primitive._batchTable.getVertexShaderCallback()(o),o=fn._appendDistanceDisplayConditionToShader(i,o),o=fn._modifyShaderPosition(e,o,t.scene3DOnly),o=fn._updateColorAttribute(i,o);const r=e._hasPlanarExtentsAttributes,s=r||e._hasSphericalExtentsAttribute;e._extruded&&(o=Rqe(i,o));const a=e._extruded?"EXTRUDED_GEOMETRY":"";let c=new nt({defines:[a],sources:[o]});const u=new nt({sources:[YM]}),f=e._primitive._attributeLocations,h=new Ys(s,r,e.appearance);if(e._spStencil=Hn.replaceCache({context:n,shaderProgram:e._spStencil,vertexShaderSource:c,fragmentShaderSource:u,attributeLocations:f}),e._primitive.allowPicking){let p=nt.createPickVertexShaderSource(o);p=fn._appendShowToShader(i,p),p=fn._updatePickColorAttribute(p);const y=h.createPickFragmentShader(!1),T=h.createPickVertexShader([a],p,!1,t.mapProjection);if(e._spPick=Hn.replaceCache({context:n,shaderProgram:e._spPick,vertexShaderSource:T,fragmentShaderSource:y,attributeLocations:f}),s){let b=n.shaderCache.getDerivedShaderProgram(e._spPick,"2dPick");if(!l(b)){const x=h.createPickFragmentShader(!0),v=h.createPickVertexShader([a],p,!0,t.mapProjection);b=n.shaderCache.createDerivedShaderProgram(e._spPick,"2dPick",{vertexShaderSource:v,fragmentShaderSource:x,attributeLocations:f})}e._spPick2D=b}}else e._spPick=Hn.fromCache({context:n,vertexShaderSource:c,fragmentShaderSource:u,attributeLocations:f});o=fn._appendShowToShader(i,o),c=new nt({defines:[a],sources:[o]}),e._sp=Hn.replaceCache({context:n,shaderProgram:e._sp,vertexShaderSource:c,fragmentShaderSource:u,attributeLocations:f});const _=h.createFragmentShader(!1),g=h.createVertexShader([a],o,!1,t.mapProjection);if(e._spColor=Hn.replaceCache({context:n,shaderProgram:e._spColor,vertexShaderSource:g,fragmentShaderSource:_,attributeLocations:f}),s){let p=n.shaderCache.getDerivedShaderProgram(e._spColor,"2dColor");if(!l(p)){const y=h.createFragmentShader(!0),T=h.createVertexShader([a],o,!0,t.mapProjection);p=n.shaderCache.createDerivedShaderProgram(e._spColor,"2dColor",{vertexShaderSource:T,fragmentShaderSource:y,attributeLocations:f})}e._spColor2D=p}}function Mqe(e,t){const n=e._primitive;let i=n._va.length*2;t.length=i;let o,r,s,a=0,c=n._batchTable.getUniformMapCallback()(e._uniformMap);const u=e._needs2DShader;for(o=0;o<i;o+=2){const g=n._va[a++];r=t[o],l(r)||(r=t[o]=new Dt({owner:e,primitiveType:n._primitiveType})),r.vertexArray=g,r.renderState=e._rsStencilDepthPass,r.shaderProgram=e._sp,r.uniformMap=c,r.pass=We.TERRAIN_CLASSIFICATION,s=Dt.shallowClone(r,r.derivedCommands.tileset),s.renderState=e._rsStencilDepthPass3DTiles,s.pass=We.CESIUM_3D_TILE_CLASSIFICATION,r.derivedCommands.tileset=s,r=t[o+1],l(r)||(r=t[o+1]=new Dt({owner:e,primitiveType:n._primitiveType})),r.vertexArray=g,r.renderState=e._rsColorPass,r.shaderProgram=e._spColor,r.pass=We.TERRAIN_CLASSIFICATION;const y=e.appearance.material;if(l(y)&&(c=Ln(c,y._uniforms)),r.uniformMap=c,s=Dt.shallowClone(r,r.derivedCommands.tileset),s.pass=We.CESIUM_3D_TILE_CLASSIFICATION,r.derivedCommands.tileset=s,u){let T=Dt.shallowClone(r,r.derivedCommands.appearance2D);T.shaderProgram=e._spColor2D,r.derivedCommands.appearance2D=T,T=Dt.shallowClone(s,s.derivedCommands.appearance2D),T.shaderProgram=e._spColor2D,s.derivedCommands.appearance2D=T}}const f=e._commandsIgnoreShow,h=e._spStencil;let _=0;i=f.length=i/2;for(let g=0;g<i;++g){const p=f[g]=Dt.shallowClone(t[_],f[g]);p.shaderProgram=h,p.pass=We.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW,_+=2}}function Fqe(e,t){const n=e._usePickOffsets,i=e._primitive;let o=i._va.length*2,r,s=0,a;n&&(r=i._pickOffsets,o=r.length*2),t.length=o;let c,u,f,h=0;const _=i._batchTable.getUniformMapCallback()(e._uniformMap),g=e._needs2DShader;for(c=0;c<o;c+=2){let p=i._va[h++];if(n&&(a=r[s++],p=i._va[a.index]),u=t[c],l(u)||(u=t[c]=new Dt({owner:e,primitiveType:i._primitiveType,pickOnly:!0})),u.vertexArray=p,u.renderState=e._rsStencilDepthPass,u.shaderProgram=e._sp,u.uniformMap=_,u.pass=We.TERRAIN_CLASSIFICATION,n&&(u.offset=a.offset,u.count=a.count),f=Dt.shallowClone(u,u.derivedCommands.tileset),f.renderState=e._rsStencilDepthPass3DTiles,f.pass=We.CESIUM_3D_TILE_CLASSIFICATION,u.derivedCommands.tileset=f,u=t[c+1],l(u)||(u=t[c+1]=new Dt({owner:e,primitiveType:i._primitiveType,pickOnly:!0})),u.vertexArray=p,u.renderState=e._rsPickPass,u.shaderProgram=e._spPick,u.uniformMap=_,u.pass=We.TERRAIN_CLASSIFICATION,n&&(u.offset=a.offset,u.count=a.count),f=Dt.shallowClone(u,u.derivedCommands.tileset),f.pass=We.CESIUM_3D_TILE_CLASSIFICATION,u.derivedCommands.tileset=f,g){let y=Dt.shallowClone(u,u.derivedCommands.pick2D);y.shaderProgram=e._spPick2D,u.derivedCommands.pick2D=y,y=Dt.shallowClone(f,f.derivedCommands.pick2D),y.shaderProgram=e._spPick2D,f.derivedCommands.pick2D=y}}}function zqe(e,t,n,i,o,r,s){Mqe(e,r),Fqe(e,s)}function a9(e,t){return Math.floor(e%t/2)}function pR(e,t,n,i,o,r){e.modelMatrix=n,e.boundingVolume=o,e.cull=i,e.debugShowBoundingVolume=r,t.commandList.push(e)}function c9(e,t,n,i,o){e.modelMatrix=n,e.boundingVolume=o,e.cull=i,t.commandList.push(e)}function Uqe(e,t,n,i,o,r,s,a){const c=e._primitive;fn._updateBoundingVolumes(c,t,o);let u;t.mode===me.SCENE3D?u=c._boundingSphereWC:t.mode===me.COLUMBUS_VIEW?u=c._boundingSphereCV:t.mode===me.SCENE2D&&l(c._boundingSphere2D)?u=c._boundingSphere2D:l(c._boundingSphereMorph)&&(u=c._boundingSphereMorph);const f=e.classificationType,h=f!==ir.CESIUM_3D_TILE,_=f!==ir.TERRAIN,g=t.passes;let p,y,T;if(g.render){const b=n.length;for(p=0;p<b;++p)y=u[a9(p,b)],h&&(T=n[p],pR(T,t,o,r,y,s)),_&&(T=n[p].derivedCommands.tileset,pR(T,t,o,r,y,s));if(t.invertClassification){const x=e._commandsIgnoreShow,v=x.length;for(p=0;p<v;++p)y=u[p],T=x[p],pR(T,t,o,r,y,s)}}if(g.pick){const b=i.length,x=c._pickOffsets;for(p=0;p<b;++p){const v=x[a9(p,b)];y=u[v.index],h&&(T=i[p],c9(T,t,o,r,y)),_&&(T=i[p].derivedCommands.tileset,c9(T,t,o,r,y))}}}C_.prototype.update=function(e){if(!l(this._primitive)&&!l(this.geometryInstances))return;let t=this.appearance;l(t)&&l(t.material)&&t.material.update(e.context);const n=this,i=this._primitiveOptions;if(!l(this._primitive)){const o=Array.isArray(this.geometryInstances)?this.geometryInstances:[this.geometryInstances],r=o.length;let s,a,c,u=!1,f=!0,h,_=!1,g=!1;for(r>0&&(c=o[0].attributes,_=Ys.hasAttributesForSphericalExtents(c),g=Ys.hasAttributesForTextureCoordinatePlanes(c),h=c.color),s=0;s<r;s++){a=o[s];const y=a.attributes.color;if(l(y))u=!0;else if(u)throw new w("All GeometryInstances must have color attributes to use per-instance color.");f=f&&l(y)&&Bn.equals(h,y)}if(!f&&!_&&!g)throw new w("All GeometryInstances must have the same color attribute except via GroundPrimitives");if(u&&!l(t)&&(t=new kn({flat:!0}),this.appearance=t),!u&&t instanceof kn)throw new w("PerInstanceColorAppearance requires color GeometryInstanceAttributes on all GeometryInstances");if(l(t.material)&&!_&&!g)throw new w("Materials on ClassificationPrimitives are not supported except via GroundPrimitives");this._usePickOffsets=!_&&!g,this._hasSphericalExtentsAttribute=_,this._hasPlanarExtentsAttributes=g,this._hasPerColorAttribute=u;const p=new Array(r);for(s=0;s<r;++s)a=o[s],p[s]=new xn({geometry:a.geometry,attributes:a.attributes,modelMatrix:a.modelMatrix,id:a.id,pickPrimitive:A(this._pickPrimitive,n)});i.appearance=t,i.geometryInstances=p,l(this._createBoundingVolumeFunction)&&(i._createBoundingVolumeFunction=function(y,T){n._createBoundingVolumeFunction(y,T)}),i._createRenderStatesFunction=function(y,T,b,x){Bqe(n)},i._createShaderProgramFunction=function(y,T,b){Nqe(n,T)},i._createCommandsFunction=function(y,T,b,x,v,D,L){zqe(n,void 0,void 0,!0,!1,D,L)},l(this._updateAndQueueCommandsFunction)?i._updateAndQueueCommandsFunction=function(y,T,b,x,v,D,L,B){n._updateAndQueueCommandsFunction(y,T,b,x,v,D,L,B)}:i._updateAndQueueCommandsFunction=function(y,T,b,x,v,D,L,B){Uqe(n,T,b,x,v,D,L)},this._primitive=new fn(i)}if(this.debugShowShadowVolume&&!this._debugShowShadowVolume&&this._ready?(this._debugShowShadowVolume=!0,this._rsStencilDepthPass=ht.fromCache(mA(!1,!1)),this._rsStencilDepthPass3DTiles=ht.fromCache(mA(!1,!0)),this._rsColorPass=ht.fromCache(zF(!1))):!this.debugShowShadowVolume&&this._debugShowShadowVolume&&(this._debugShowShadowVolume=!1,this._rsStencilDepthPass=ht.fromCache(mA(!0,!1)),this._rsStencilDepthPass3DTiles=ht.fromCache(mA(!0,!0)),this._rsColorPass=ht.fromCache(zF(!0))),this._primitive.appearance!==t){if(!this._hasSphericalExtentsAttribute&&!this._hasPlanarExtentsAttributes&&l(t.material))throw new w("Materials on ClassificationPrimitives are not supported except via GroundPrimitive");if(!this._hasPerColorAttribute&&t instanceof kn)throw new w("PerInstanceColorAppearance requires color GeometryInstanceAttribute");this._primitive.appearance=t}this._primitive.show=this.show,this._primitive.debugShowBoundingVolume=this.debugShowBoundingVolume,this._primitive.update(e),e.afterRender.push(()=>{l(this._primitive)&&this._primitive.ready&&this._completeLoad()})};C_.prototype.getGeometryInstanceAttributes=function(e){if(!l(this._primitive))throw new w("must call update before calling getGeometryInstanceAttributes");return this._primitive.getGeometryInstanceAttributes(e)};C_.prototype.isDestroyed=function(){return!1};C_.prototype.destroy=function(){return this._primitive=this._primitive&&this._primitive.destroy(),this._sp=this._sp&&this._sp.destroy(),this._spPick=this._spPick&&this._spPick.destroy(),this._spColor=this._spColor&&this._spColor.destroy(),this._spPick2D=void 0,this._spColor2D=void 0,Je(this)};const Hqe={u_globeMinimumAltitude:function(){return 55e3}};function vs(e){e=A(e,A.EMPTY_OBJECT);let t=e.appearance;const n=e.geometryInstances;if(!l(t)&&l(n)){const r=Array.isArray(n)?n:[n],s=r.length;for(let a=0;a<s;a++){const c=r[a].attributes;if(l(c)&&l(c.color)){t=new kn({flat:!0});break}}}this.appearance=t,this.geometryInstances=e.geometryInstances,this.show=A(e.show,!0),this.classificationType=A(e.classificationType,ir.BOTH),this.debugShowBoundingVolume=A(e.debugShowBoundingVolume,!1),this.debugShowShadowVolume=A(e.debugShowShadowVolume,!1),this._boundingVolumes=[],this._boundingVolumes2D=[],this._ready=!1;const i=this;this._readyPromise=new Promise((r,s)=>{i._completeLoad=()=>{if(this._ready)return;this._ready=!0,this.releaseGeometryInstances&&(this.geometryInstances=void 0);const a=this._error;l(a)?s(a):r(this)}}),this._primitive=void 0,this._maxHeight=void 0,this._minHeight=void 0,this._maxTerrainHeight=Ro._defaultMaxTerrainHeight,this._minTerrainHeight=Ro._defaultMinTerrainHeight,this._boundingSpheresKeys=[],this._boundingSpheres=[],this._useFragmentCulling=!1,this._zIndex=void 0;const o=this;this._classificationPrimitiveOptions={geometryInstances:void 0,appearance:void 0,vertexCacheOptimize:A(e.vertexCacheOptimize,!1),interleave:A(e.interleave,!1),releaseGeometryInstances:A(e.releaseGeometryInstances,!0),allowPicking:A(e.allowPicking,!0),asynchronous:A(e.asynchronous,!0),compressVertices:A(e.compressVertices,!0),_createBoundingVolumeFunction:void 0,_updateAndQueueCommandsFunction:void 0,_pickPrimitive:o,_extruded:!0,_uniformMap:Hqe}}Object.defineProperties(vs.prototype,{vertexCacheOptimize:{get:function(){return this._classificationPrimitiveOptions.vertexCacheOptimize}},interleave:{get:function(){return this._classificationPrimitiveOptions.interleave}},releaseGeometryInstances:{get:function(){return this._classificationPrimitiveOptions.releaseGeometryInstances}},allowPicking:{get:function(){return this._classificationPrimitiveOptions.allowPicking}},asynchronous:{get:function(){return this._classificationPrimitiveOptions.asynchronous}},compressVertices:{get:function(){return this._classificationPrimitiveOptions.compressVertices}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise}}});vs.isSupported=C_.isSupported;function l9(e){return function(t,n){const i=n.maximumRadius,o=i/Math.cos(t*.5)-i;return e._maxHeight+o}}function u9(e){return function(t,n){return e._minHeight}}const Vqe=new d,kqe=new d,Gqe=new d,Wqe=new ve,qqe=new Ee;function WD(e,t){const n=e.mapProjection.ellipsoid;if(!l(t.attributes)||!l(t.attributes.position3DHigh))return l(t.rectangle)?t.rectangle:void 0;const i=t.attributes.position3DHigh.values,o=t.attributes.position3DLow.values,r=i.length;let s=Number.POSITIVE_INFINITY,a=Number.POSITIVE_INFINITY,c=Number.NEGATIVE_INFINITY,u=Number.NEGATIVE_INFINITY;for(let h=0;h<r;h+=3){const _=d.unpack(i,h,Vqe),g=d.unpack(o,h,kqe),p=d.add(_,g,Gqe),y=n.cartesianToCartographic(p,Wqe),T=y.latitude,b=y.longitude;s=Math.min(s,T),a=Math.min(a,b),c=Math.max(c,T),u=Math.max(u,b)}const f=qqe;return f.north=c,f.south=s,f.east=u,f.west=a,f}function jqe(e,t,n){const i=Ro.getMinimumMaximumHeights(t,n);e._minTerrainHeight=i.minimumTerrainHeight,e._maxTerrainHeight=i.maximumTerrainHeight}function Yqe(e,t,n){const i=t.mapProjection.ellipsoid,o=WD(t,n),r=Zt.fromRectangle(o,e._minHeight,e._maxHeight,i);if(e._boundingVolumes.push(r),!t.scene3DOnly){const s=t.mapProjection,a=Ae.fromRectangleWithHeights2D(o,s,e._maxHeight,e._minHeight);d.fromElements(a.center.z,a.center.x,a.center.y,a.center),e._boundingVolumes2D.push(a)}}function mR(e,t){return Math.floor(e%t/2)}function _R(e,t,n,i,o,r,s){const a=e._primitive;n.mode!==me.SCENE3D&&t.shaderProgram===a._spColor&&a._needs2DShader&&(t=t.derivedCommands.appearance2D),t.owner=e,t.modelMatrix=i,t.boundingVolume=r,t.cull=o,t.debugShowBoundingVolume=s,n.commandList.push(t)}function f9(e,t,n,i,o,r){const s=e._primitive;n.mode!==me.SCENE3D&&t.shaderProgram===s._spPick&&s._needs2DShader&&(t=t.derivedCommands.pick2D),t.owner=e,t.modelMatrix=i,t.boundingVolume=r,t.cull=o,n.commandList.push(t)}function $qe(e,t,n,i,o,r,s,a){let c;t.mode===me.SCENE3D?c=e._boundingVolumes:c=e._boundingVolumes2D;const u=e.classificationType,f=u!==ir.CESIUM_3D_TILE,h=u!==ir.TERRAIN,_=t.passes,g=e._primitive;let p,y,T;if(_.render){const b=n.length;for(p=0;p<b;++p)y=c[mR(p,b)],f&&(T=n[p],_R(e,T,t,o,r,y,s)),h&&(T=n[p].derivedCommands.tileset,_R(e,T,t,o,r,y,s));if(t.invertClassification){const x=g._commandsIgnoreShow,v=x.length;for(p=0;p<v;++p)y=c[p],T=x[p],_R(e,T,t,o,r,y,s)}}if(_.pick){const b=i.length;let x;for(e._useFragmentCulling||(x=g._primitive._pickOffsets),p=0;p<b;++p){if(y=c[mR(p,b)],!e._useFragmentCulling){const v=x[mR(p,b)];y=c[v.index]}f&&(T=i[p],f9(e,T,t,o,r,y)),h&&(T=i[p].derivedCommands.tileset,f9(e,T,t,o,r,y))}}}vs.initializeTerrainHeights=function(){return Ro.initialize()};vs.prototype.update=function(e){if(!l(this._primitive)&&!l(this.geometryInstances))return;if(!Ro.initialized){if(!this.asynchronous)throw new w("For synchronous GroundPrimitives, you must call GroundPrimitive.initializeTerrainHeights() and wait for the returned promise to resolve.");vs.initializeTerrainHeights();return}const t=this,n=this._classificationPrimitiveOptions;if(!l(this._primitive)){const i=e.mapProjection.ellipsoid;let o,r,s;const a=Array.isArray(this.geometryInstances)?this.geometryInstances:[this.geometryInstances],c=a.length,u=new Array(c);let f,h;for(f=0;f<c;++f){o=a[f],r=o.geometry;const y=WD(e,r);l(h)?l(y)&&Ee.union(h,y,h):h=Ee.clone(y);const T=o.id;if(l(T)&&l(y)){const b=Ro.getBoundingSphere(y,i);this._boundingSpheresKeys.push(T),this._boundingSpheres.push(b)}if(s=r.constructor,!l(s)||!l(s.createShadowVolume))throw new w("Not all of the geometry instances have GroundPrimitive support.")}jqe(this,h,i);const _=e.terrainExaggeration,g=e.terrainExaggerationRelativeHeight;this._minHeight=Fm.getHeight(this._minTerrainHeight,_,g),this._maxHeight=Fm.getHeight(this._maxTerrainHeight,_,g);const p=vs._supportsMaterials(e.context);if(this._useFragmentCulling=p,p){let y,T=!0;for(f=0;f<c;++f)if(o=a[f],r=o.geometry,h=WD(e,r),Ys.shouldUseSphericalCoordinates(h)){T=!1;break}for(f=0;f<c;++f){o=a[f],r=o.geometry,s=r.constructor;const b=WD(e,r),x=r.textureCoordinateRotationPoints;T?y=Ys.getPlanarTextureCoordinateAttributes(b,x,i,e.mapProjection,this._maxHeight):y=Ys.getSphericalExtentGeometryInstanceAttributes(b,x,i,e.mapProjection);const v=o.attributes;for(const D in v)v.hasOwnProperty(D)&&(y[D]=v[D]);u[f]=new xn({geometry:s.createShadowVolume(r,u9(this),l9(this)),attributes:y,id:o.id})}}else for(f=0;f<c;++f)o=a[f],r=o.geometry,s=r.constructor,u[f]=new xn({geometry:s.createShadowVolume(r,u9(this),l9(this)),attributes:o.attributes,id:o.id});n.geometryInstances=u,n.appearance=this.appearance,n._createBoundingVolumeFunction=function(y,T){Yqe(t,y,T)},n._updateAndQueueCommandsFunction=function(y,T,b,x,v,D,L,B){$qe(t,T,b,x,v,D,L)},this._primitive=new C_(n)}this._primitive.appearance=this.appearance,this._primitive.show=this.show,this._primitive.debugShowShadowVolume=this.debugShowShadowVolume,this._primitive.debugShowBoundingVolume=this.debugShowBoundingVolume,this._primitive.update(e),e.afterRender.push(()=>{l(this._primitive)&&this._primitive.ready&&this._completeLoad()})};vs.prototype.getBoundingSphere=function(e){const t=this._boundingSpheresKeys.indexOf(e);if(t!==-1)return this._boundingSpheres[t]};vs.prototype.getGeometryInstanceAttributes=function(e){if(!l(this._primitive))throw new w("must call update before calling getGeometryInstanceAttributes");return this._primitive.getGeometryInstanceAttributes(e)};vs.prototype.isDestroyed=function(){return!1};vs.prototype.destroy=function(){return this._primitive=this._primitive&&this._primitive.destroy(),Je(this)};vs._supportsMaterials=function(e){return e.depthTexture};vs.supportsMaterials=function(e){return E.typeOf.object("scene",e),vs._supportsMaterials(e.frameState.context)};function ls(){w.throwInstantiationError()}Object.defineProperties(ls.prototype,{isConstant:{get:w.throwInstantiationError},definitionChanged:{get:w.throwInstantiationError}});ls.prototype.getType=w.throwInstantiationError;ls.prototype.getValue=w.throwInstantiationError;ls.prototype.equals=w.throwInstantiationError;ls.getValue=function(e,t,n){let i;return l(t)&&(i=t.getType(e),l(i))?((!l(n)||n.type!==i)&&(n=$e.fromType(i)),t.getValue(e,n.uniforms),n):((!l(n)||n.type!==$e.ColorType)&&(n=$e.fromType($e.ColorType)),k.clone(k.WHITE,n.uniforms.color),n)};function Mi(e,t,n){E.defined("geometryUpdater",e),E.defined("primitives",t),E.defined("orderedGroundPrimitives",n),this._primitives=t,this._orderedGroundPrimitives=n,this._primitive=void 0,this._outlinePrimitive=void 0,this._geometryUpdater=e,this._options=e._options,this._entity=e._entity,this._material=void 0}Mi.prototype._isHidden=function(e,t,n){return!e.isShowing||!e.isAvailable(n)||!ie.getValueOrDefault(t.show,n,!0)};Mi.prototype._setOptions=w.throwInstantiationError;Mi.prototype.update=function(e){E.defined("time",e);const t=this._geometryUpdater,n=t._onTerrain,i=this._primitives,o=this._orderedGroundPrimitives;n?o.remove(this._primitive):(i.removeAndDestroy(this._primitive),i.removeAndDestroy(this._outlinePrimitive),this._outlinePrimitive=void 0),this._primitive=void 0;const r=this._entity,s=r[this._geometryUpdater._geometryPropertyName];if(this._setOptions(r,s,e),this._isHidden(r,s,e))return;const a=this._geometryUpdater.shadowsProperty.getValue(e),c=this._options;if(!l(s.fill)||s.fill.getValue(e)){const u=t.fillMaterialProperty,f=u instanceof An;let h;const _=t._getIsClosed(c);if(f)h=new kn({closed:_,flat:n&&!t._supportsMaterialsforEntitiesOnTerrain});else{const g=ls.getValue(e,u,this._material);this._material=g,h=new Dr({material:g,translucent:g.isTranslucent(),closed:_})}if(n)c.vertexFormat=kn.VERTEX_FORMAT,this._primitive=o.add(new vs({geometryInstances:this._geometryUpdater.createFillGeometryInstance(e),appearance:h,asynchronous:!1,shadows:a,classificationType:this._geometryUpdater.classificationTypeProperty.getValue(e)}),ie.getValueOrUndefined(this._geometryUpdater.zIndex,e));else{c.vertexFormat=h.vertexFormat;const g=this._geometryUpdater.createFillGeometryInstance(e);f&&(h.translucent=g.attributes.color.value[3]!==255),this._primitive=i.add(new fn({geometryInstances:g,appearance:h,asynchronous:!1,shadows:a}))}}if(!n&&l(s.outline)&&s.outline.getValue(e)){const u=this._geometryUpdater.createOutlineGeometryInstance(e),f=ie.getValueOrDefault(s.outlineWidth,e,1);this._outlinePrimitive=i.add(new fn({geometryInstances:u,appearance:new kn({flat:!0,translucent:u.attributes.color.value[3]!==255,renderState:{lineWidth:t._scene.clampLineWidth(f)}}),asynchronous:!1,shadows:a}))}};Mi.prototype.getBoundingSphere=function(e){if(!l(e))throw new w("result is required.");const t=this._entity,n=this._primitive,i=this._outlinePrimitive;let o;return l(n)&&n.show&&n.ready&&(o=n.getGeometryInstanceAttributes(t),l(o)&&l(o.boundingSphere))||l(i)&&i.show&&i.ready&&(o=i.getGeometryInstanceAttributes(t),l(o)&&l(o.boundingSphere))?(Ae.clone(o.boundingSphere,e),Ot.DONE):l(n)&&!n.ready||l(i)&&!i.ready?Ot.PENDING:Ot.FAILED};Mi.prototype.isDestroyed=function(){return!1};Mi.prototype.destroy=function(){const e=this._primitives,t=this._orderedGroundPrimitives;this._geometryUpdater._onTerrain?t.remove(this._primitive):e.removeAndDestroy(this._primitive),e.removeAndDestroy(this._outlinePrimitive),Je(this)};const Xqe={NONE:0,GEODESIC:1,RHUMB:2},Kn=Object.freeze(Xqe),d9=F.EPSILON10;function Ya(e,t,n,i){if(E.defined("equalsEpsilon",t),!l(e))return;n=A(n,!1);const o=l(i),r=e.length;if(r<2)return e;let s,a=e[0],c,u,f=0,h=-1;for(s=1;s<r;++s)c=e[s],t(a,c,d9)?(l(u)||(u=e.slice(0,s),f=s-1,h=0),o&&i.push(s)):(l(u)&&(u.push(c),f=s,o&&(h=i.length)),a=c);return n&&t(e[0],e[r-1],d9)&&(o&&(l(u)?i.splice(h,0,f):i.push(r-1)),l(u)?u.length-=1:u=e.slice(0,-1)),l(u)?u:e}const nU=[Or,Ii],Kqe=nU.length,ete=Math.cos(F.toRadians(30)),h9=Math.cos(F.toRadians(150)),tte=0,nte=1e3;function Qh(e){e=A(e,A.EMPTY_OBJECT);const t=e.positions;if(!l(t)||t.length<2)throw new w("At least two positions are required.");if(l(e.arcType)&&e.arcType!==Kn.GEODESIC&&e.arcType!==Kn.RHUMB)throw new w("Valid options for arcType are ArcType.GEODESIC and ArcType.RHUMB.");this.width=A(e.width,1),this._positions=t,this.granularity=A(e.granularity,9999),this.loop=A(e.loop,!1),this.arcType=A(e.arcType,Kn.GEODESIC),this._ellipsoid=be.WGS84,this._projectionIndex=0,this._workerName="createGroundPolylineGeometry",this._scene3DOnly=!1}Object.defineProperties(Qh.prototype,{packedLength:{get:function(){return 1+this._positions.length*3+1+1+1+be.packedLength+1+1}}});Qh.setProjectionAndEllipsoid=function(e,t){let n=0;for(let i=0;i<Kqe;i++)if(t instanceof nU[i]){n=i;break}e._projectionIndex=n,e._ellipsoid=t.ellipsoid};const Jqe=new d,p9=new d,m9=new d;function UF(e,t,n,i,o){const r=cc(i,e,0,Jqe),s=cc(i,e,n,p9),a=cc(i,t,0,m9),c=Zh(s,r,p9),u=Zh(a,r,m9);return d.cross(u,c,o),d.normalize(o,o)}const Qqe=new ve,Zqe=new d,eje=new d,tje=new d;function gR(e,t,n,i,o,r,s,a,c,u,f){if(o===0)return;let h;r===Kn.GEODESIC?h=new fp(e,t,s):r===Kn.RHUMB&&(h=new js(e,t,s));const _=h.surfaceDistance;if(_<o)return;const g=UF(e,t,i,s,tje),p=Math.ceil(_/o),y=_/p;let T=y;const b=p-1;let x=a.length;for(let v=0;v<b;v++){const D=h.interpolateUsingSurfaceDistance(T,Qqe),L=cc(s,D,n,Zqe),B=cc(s,D,i,eje);d.pack(g,a,x),d.pack(L,c,x),d.pack(B,u,x),f.push(D.latitude),f.push(D.longitude),x+=3,T+=y}}const yR=new ve;function cc(e,t,n,i){return ve.clone(t,yR),yR.height=n,ve.toCartesian(yR,e,i)}Qh.pack=function(e,t,n){E.typeOf.object("value",e),E.defined("array",t);let i=A(n,0);const o=e._positions,r=o.length;t[i++]=r;for(let s=0;s<r;++s){const a=o[s];d.pack(a,t,i),i+=3}return t[i++]=e.granularity,t[i++]=e.loop?1:0,t[i++]=e.arcType,be.pack(e._ellipsoid,t,i),i+=be.packedLength,t[i++]=e._projectionIndex,t[i++]=e._scene3DOnly?1:0,t};Qh.unpack=function(e,t,n){E.defined("array",e);let i=A(t,0);const o=e[i++],r=new Array(o);for(let _=0;_<o;_++)r[_]=d.unpack(e,i),i+=3;const s=e[i++],a=e[i++]===1,c=e[i++],u=be.unpack(e,i);i+=be.packedLength;const f=e[i++],h=e[i++]===1;return l(n)||(n=new Qh({positions:r})),n._positions=r,n.granularity=s,n.loop=a,n.arcType=c,n._ellipsoid=u,n._projectionIndex=f,n._scene3DOnly=h,n};function Zh(e,t,n){return d.subtract(e,t,n),d.normalize(n,n),n}function _9(e,t,n,i){return i=Zh(e,t,i),i=d.cross(i,n,i),i=d.normalize(i,i),i=d.cross(n,i,i),i}const nje=new d,ije=new d,oje=new d,ite=new d,rje=0,sje=-1;function AR(e,t,n,i,o){const r=Zh(n,t,ite),s=_9(e,t,r,nje),a=_9(i,t,r,ije);if(F.equalsEpsilon(d.dot(s,a),sje,F.EPSILON5))return o=d.cross(r,s,o),o=d.normalize(o,o),o;o=d.add(a,s,o),o=d.normalize(o,o);const c=d.cross(r,o,oje);return d.dot(a,c)<rje&&(o=d.negate(o,o)),o}const jI=Wt.fromPointNormal(d.ZERO,d.UNIT_Y),aje=new d,cje=new d,lje=new d,uje=new d,fje=new d,Av=new d,Tv=new ve,g9=new ve,y9=new ve;Qh.createGeometry=function(e){const t=!e._scene3DOnly;let n=e.loop;const i=e._ellipsoid,o=e.granularity,r=e.arcType,s=new nU[e._projectionIndex](i),a=tte,c=nte;let u,f;const h=e._positions,_=h.length;_===2&&(n=!1);let g,p,y,T;const b=new js(void 0,void 0,i);let x,v,D;const L=[h[0]];for(f=0;f<_-1;f++)g=h[f],p=h[f+1],x=qr.lineSegmentPlane(g,p,jI,Av),l(x)&&!d.equalsEpsilon(x,g,F.EPSILON7)&&!d.equalsEpsilon(x,p,F.EPSILON7)&&(e.arcType===Kn.GEODESIC?L.push(d.clone(x)):e.arcType===Kn.RHUMB&&(D=i.cartesianToCartographic(x,Tv).longitude,y=i.cartesianToCartographic(g,Tv),T=i.cartesianToCartographic(p,g9),b.setEndPoints(y,T),v=b.findIntersectionWithLongitude(D,y9),x=i.cartographicToCartesian(v,Av),l(x)&&!d.equalsEpsilon(x,g,F.EPSILON7)&&!d.equalsEpsilon(x,p,F.EPSILON7)&&L.push(d.clone(x)))),L.push(p);n&&(g=h[_-1],p=h[0],x=qr.lineSegmentPlane(g,p,jI,Av),l(x)&&!d.equalsEpsilon(x,g,F.EPSILON7)&&!d.equalsEpsilon(x,p,F.EPSILON7)&&(e.arcType===Kn.GEODESIC?L.push(d.clone(x)):e.arcType===Kn.RHUMB&&(D=i.cartesianToCartographic(x,Tv).longitude,y=i.cartesianToCartographic(g,Tv),T=i.cartesianToCartographic(p,g9),b.setEndPoints(y,T),v=b.findIntersectionWithLongitude(D,y9),x=i.cartographicToCartesian(v,Av),l(x)&&!d.equalsEpsilon(x,g,F.EPSILON7)&&!d.equalsEpsilon(x,p,F.EPSILON7)&&L.push(d.clone(x)))));let B=L.length,V=new Array(B);for(f=0;f<B;f++){const K=ve.fromCartesian(L[f],i);K.height=0,V[f]=K}if(V=Ya(V,ve.equalsEpsilon),B=V.length,B<2)return;const M=[],H=[],G=[],I=[];let O=aje,m=cje,P=lje,R=uje,U=fje;const W=V[0],q=V[1],Y=V[B-1];for(O=cc(i,Y,a,O),R=cc(i,q,a,R),m=cc(i,W,a,m),P=cc(i,W,c,P),n?U=AR(O,m,P,R,U):U=UF(W,q,c,i,U),d.pack(U,H,0),d.pack(m,G,0),d.pack(P,I,0),M.push(W.latitude),M.push(W.longitude),gR(W,q,a,c,o,r,i,H,G,I,M),f=1;f<B-1;++f){O=d.clone(m,O),m=d.clone(R,m);const K=V[f];cc(i,K,c,P),cc(i,V[f+1],a,R),AR(O,m,P,R,U),u=H.length,d.pack(U,H,u),d.pack(m,G,u),d.pack(P,I,u),M.push(K.latitude),M.push(K.longitude),gR(V[f],V[f+1],a,c,o,r,i,H,G,I,M)}const j=V[B-1],ee=V[B-2];if(m=cc(i,j,a,m),P=cc(i,j,c,P),n){const K=V[0];O=cc(i,ee,a,O),R=cc(i,K,a,R),U=AR(O,m,P,R,U)}else U=UF(ee,j,c,i,U);if(u=H.length,d.pack(U,H,u),d.pack(m,G,u),d.pack(P,I,u),M.push(j.latitude),M.push(j.longitude),n){for(gR(j,W,a,c,o,r,i,H,G,I,M),u=H.length,f=0;f<3;++f)H[u+f]=H[f],G[u+f]=G[f],I[u+f]=I[f];M.push(W.latitude),M.push(W.longitude)}return Fje(n,s,G,I,H,M,t)};const dje=new d,hje=new te,pje=new De;function A9(e,t,n,i){const o=Zh(n,t,dje),r=d.dot(o,e);if(r>ete||r<h9){const s=Zh(i,n,ite),a=r<h9?F.PI_OVER_TWO:-F.PI_OVER_TWO,c=De.fromAxisAngle(s,a,pje),u=te.fromQuaternion(c,hje);return te.multiplyByVector(u,e,e),!0}return!1}const T9=new ve,mje=new d,C9=new d;function bb(e,t,n,i,o){const r=ve.toCartesian(t,e._ellipsoid,mje);let s=d.add(r,n,C9),a=!1;const c=e._ellipsoid;let u=c.cartesianToCartographic(s,T9);Math.abs(t.longitude-u.longitude)>F.PI_OVER_TWO&&(a=!0,s=d.subtract(r,n,C9),u=c.cartesianToCartographic(s,T9)),u.height=0;const f=e.project(u,o);return o=d.subtract(f,i,o),o.z=0,o=d.normalize(o,o),a&&d.negate(o,o),o}const _je=new d,b9=new d;function E9(e,t,n,i,o,r){const s=d.subtract(t,e,_je);d.normalize(s,s);const a=n-tte;let c=d.multiplyByScalar(s,a,b9);d.add(e,c,o);const u=i-nte;c=d.multiplyByScalar(s,u,b9),d.add(t,c,r)}const gje=new d;function Cv(e,t){const n=Wt.getPointDistance(jI,e),i=Wt.getPointDistance(jI,t);let o=gje;F.equalsEpsilon(n,0,F.EPSILON2)?(o=Zh(t,e,o),d.multiplyByScalar(o,F.EPSILON2,o),d.add(e,o,e)):F.equalsEpsilon(i,0,F.EPSILON2)&&(o=Zh(e,t,o),d.multiplyByScalar(o,F.EPSILON2,o),d.add(t,o,t))}function yje(e,t){const n=Math.abs(e.longitude),i=Math.abs(t.longitude);if(F.equalsEpsilon(n,F.PI,F.EPSILON11)){const o=F.sign(t.longitude);return e.longitude=o*(n-F.EPSILON11),1}else if(F.equalsEpsilon(i,F.PI,F.EPSILON11)){const o=F.sign(e.longitude);return t.longitude=o*(i-F.EPSILON11),2}return 0}const ote=new ve,rte=new ve,x9=new d,TR=new d,w9=new d,S9=new d,Aje=new d,v9=new d,Tje=[ote,rte],Cje=new Ee,bje=new d,Eje=new d,xje=new d,wje=new d,Sje=new d,vje=new d,CR=new d,bR=new d,Dje=new d,Ije=new d,Pje=new d,D9=new d,Oje=new d,Lje=new d,Bje=new Zn,Rje=new Zn,I9=new d,Nje=new d,P9=new d,Mje=[new Ae,new Ae],ste=[0,2,1,0,3,2,0,7,3,0,4,7,0,5,4,0,1,5,5,7,4,5,6,7,5,2,6,5,1,2,3,6,2,3,7,6],O9=ste.length;function Fje(e,t,n,i,o,r,s){let a,c;const u=t._ellipsoid,f=n.length/3-1,h=f*8,_=h*4,g=f*36,p=h>65535?new Uint32Array(g):new Uint16Array(g),y=new Float64Array(h*3),T=new Float32Array(_),b=new Float32Array(_),x=new Float32Array(_),v=new Float32Array(_),D=new Float32Array(_);let L,B,V,M;s&&(L=new Float32Array(_),B=new Float32Array(_),V=new Float32Array(_),M=new Float32Array(h*2));const H=r.length/2;let G=0;const I=ote;I.height=0;const O=rte;O.height=0;let m=x9,P=TR;if(s)for(c=0,a=1;a<H;a++)I.latitude=r[c],I.longitude=r[c+1],O.latitude=r[c+2],O.longitude=r[c+3],m=t.project(I,m),P=t.project(O,P),G+=d.distance(m,P),c+=2;const R=i.length/3;P=d.unpack(i,0,P);let U=0;for(c=3,a=1;a<R;a++)m=d.clone(P,m),P=d.unpack(i,c,P),U+=d.distance(m,P),c+=3;let W;c=3;let q=0,Y=0,j=0,ee=0,K=!1,se=d.unpack(n,0,S9),Q=d.unpack(i,0,TR),Z=d.unpack(o,0,v9);if(e){const ae=d.unpack(n,n.length-6,w9);A9(Z,ae,se,Q)&&(Z=d.negate(Z,Z))}let J=0,de=0,_e=0;for(a=0;a<f;a++){const ae=d.clone(se,w9),ye=d.clone(Q,x9);let Ce=d.clone(Z,Aje);K&&(Ce=d.negate(Ce,Ce)),se=d.unpack(n,c,S9),Q=d.unpack(i,c,TR),Z=d.unpack(o,c,v9),K=A9(Z,ae,se,Q),I.latitude=r[q],I.longitude=r[q+1],O.latitude=r[q+2],O.longitude=r[q+3];let Be,Le,Ve,Ie;if(s){const wn=yje(I,O);Be=t.project(I,Sje),Le=t.project(O,vje);const ti=Zh(Le,Be,I9);ti.y=Math.abs(ti.y),Ve=CR,Ie=bR,wn===0||d.dot(ti,d.UNIT_Y)>ete?(Ve=bb(t,I,Ce,Be,CR),Ie=bb(t,O,Z,Le,bR)):wn===1?(Ie=bb(t,O,Z,Le,bR),Ve.x=0,Ve.y=F.sign(I.longitude-Math.abs(O.longitude)),Ve.z=0):(Ve=bb(t,I,Ce,Be,CR),Ie.x=0,Ie.y=F.sign(I.longitude-O.longitude),Ie.z=0)}const He=d.distance(ye,Q),Me=Zn.fromCartesian(ae,Bje),qe=d.subtract(se,ae,Dje),Ne=d.normalize(qe,D9);let ke=d.subtract(ye,ae,Ije);ke=d.normalize(ke,ke);let Qe=d.cross(Ne,ke,D9);Qe=d.normalize(Qe,Qe);let Ge=d.cross(ke,Ce,Oje);Ge=d.normalize(Ge,Ge);let Pt=d.subtract(Q,se,Pje);Pt=d.normalize(Pt,Pt);let Lt=d.cross(Z,Pt,Lje);Lt=d.normalize(Lt,Lt);const qt=He/U,zn=J/U;let Gn=0,Dn,hn,jt,In=0,Rn=0;if(s){Gn=d.distance(Be,Le),Dn=Zn.fromCartesian(Be,Rje),hn=d.subtract(Le,Be,I9),jt=d.normalize(hn,Nje);const wn=jt.x;jt.x=jt.y,jt.y=-wn,In=Gn/G,Rn=de/G}for(W=0;W<8;W++){const wn=ee+W*4,ti=Y+W*2,Jn=wn+3,Tn=W<4?1:-1,Rt=W===2||W===3||W===6||W===7?1:-1;d.pack(Me.high,T,wn),T[Jn]=qe.x,d.pack(Me.low,b,wn),b[Jn]=qe.y,d.pack(Ge,x,wn),x[Jn]=qe.z,d.pack(Lt,v,wn),v[Jn]=qt*Tn,d.pack(Qe,D,wn);let et=zn*Rt;et===0&&Rt<0&&(et=9),D[Jn]=et,s&&(L[wn]=Dn.high.x,L[wn+1]=Dn.high.y,L[wn+2]=Dn.low.x,L[wn+3]=Dn.low.y,V[wn]=-Ve.y,V[wn+1]=Ve.x,V[wn+2]=Ie.y,V[wn+3]=-Ie.x,B[wn]=hn.x,B[wn+1]=hn.y,B[wn+2]=jt.x,B[wn+3]=jt.y,M[ti]=In*Tn,et=Rn*Rt,et===0&&Rt<0&&(et=9),M[ti+1]=et)}const Jt=xje,ln=wje,ei=bje,bi=Eje,pn=Ee.fromCartographicArray(Tje,Cje),Fi=Ro.getMinimumMaximumHeights(pn,u),Co=Fi.minimumTerrainHeight,Xi=Fi.maximumTerrainHeight;_e+=Co,_e+=Xi,E9(ae,ye,Co,Xi,Jt,ei),E9(se,Q,Co,Xi,ln,bi);let gi=d.multiplyByScalar(Qe,F.EPSILON5,P9);d.add(Jt,gi,Jt),d.add(ln,gi,ln),d.add(ei,gi,ei),d.add(bi,gi,bi),Cv(Jt,ln),Cv(ei,bi),d.pack(Jt,y,j),d.pack(ln,y,j+3),d.pack(bi,y,j+6),d.pack(ei,y,j+9),gi=d.multiplyByScalar(Qe,-2*F.EPSILON5,P9),d.add(Jt,gi,Jt),d.add(ln,gi,ln),d.add(ei,gi,ei),d.add(bi,gi,bi),Cv(Jt,ln),Cv(ei,bi),d.pack(Jt,y,j+12),d.pack(ln,y,j+15),d.pack(bi,y,j+18),d.pack(ei,y,j+21),q+=2,c+=3,Y+=16,j+=24,ee+=32,J+=He,de+=Gn}c=0;let le=0;for(a=0;a<f;a++){for(W=0;W<O9;W++)p[c+W]=ste[W]+le;le+=8,c+=O9}const Te=Mje;Ae.fromVertices(n,d.ZERO,3,Te[0]),Ae.fromVertices(i,d.ZERO,3,Te[1]);const pe=Ae.fromBoundingSpheres(Te);pe.radius+=_e/(f*2);const ne={position:new Xe({componentDatatype:oe.DOUBLE,componentsPerAttribute:3,normalize:!1,values:y}),startHiAndForwardOffsetX:Qp(T),startLoAndForwardOffsetY:Qp(b),startNormalAndForwardOffsetZ:Qp(x),endNormalAndTextureCoordinateNormalizationX:Qp(v),rightNormalAndTextureCoordinateNormalizationY:Qp(D)};return s&&(ne.startHiLo2D=Qp(L),ne.offsetAndRight2D=Qp(B),ne.startEndNormals2D=Qp(V),ne.texcoordNormalization2D=new Xe({componentDatatype:oe.FLOAT,componentsPerAttribute:2,normalize:!1,values:M})),new $t({attributes:ne,indices:p,boundingSphere:pe})}function Qp(e){return new Xe({componentDatatype:oe.FLOAT,componentsPerAttribute:4,normalize:!1,values:e})}Qh._projectNormal=bb;const zje=`attribute vec3 position3DHigh;
|
||
attribute vec3 position3DLow;
|
||
attribute vec3 prevPosition3DHigh;
|
||
attribute vec3 prevPosition3DLow;
|
||
attribute vec3 nextPosition3DHigh;
|
||
attribute vec3 nextPosition3DLow;
|
||
attribute vec2 expandAndWidth;
|
||
attribute vec4 color;
|
||
attribute float batchId;
|
||
|
||
varying vec4 v_color;
|
||
|
||
void main()
|
||
{
|
||
float expandDir = expandAndWidth.x;
|
||
float width = abs(expandAndWidth.y) + 0.5;
|
||
bool usePrev = expandAndWidth.y < 0.0;
|
||
|
||
vec4 p = czm_computePosition();
|
||
vec4 prev = czm_computePrevPosition();
|
||
vec4 next = czm_computeNextPosition();
|
||
|
||
float angle;
|
||
vec4 positionWC = getPolylineWindowCoordinates(p, prev, next, expandDir, width, usePrev, angle);
|
||
gl_Position = czm_viewportOrthographic * positionWC;
|
||
|
||
v_color = color;
|
||
}
|
||
`;let HF=`${mx}
|
||
${zje}`;const Uje=JJ;Mn.isInternetExplorer()||(HF=`#define CLIP_POLYLINE
|
||
${HF}`);function Na(e){e=A(e,A.EMPTY_OBJECT);const t=A(e.translucent,!0),n=!1,i=Na.VERTEX_FORMAT;this.material=void 0,this.translucent=t,this._vertexShaderSource=A(e.vertexShaderSource,HF),this._fragmentShaderSource=A(e.fragmentShaderSource,Uje),this._renderState=ns.getDefaultRenderState(t,n,e.renderState),this._closed=n,this._vertexFormat=i}Object.defineProperties(Na.prototype,{vertexShaderSource:{get:function(){return this._vertexShaderSource}},fragmentShaderSource:{get:function(){return this._fragmentShaderSource}},renderState:{get:function(){return this._renderState}},closed:{get:function(){return this._closed}},vertexFormat:{get:function(){return this._vertexFormat}}});Na.VERTEX_FORMAT=Ye.POSITION_ONLY;Na.prototype.getFragmentShaderSource=ns.prototype.getFragmentShaderSource;Na.prototype.isTranslucent=ns.prototype.isTranslucent;Na.prototype.getRenderState=ns.prototype.getRenderState;const Hje=`attribute vec3 position3DHigh;
|
||
attribute vec3 position3DLow;
|
||
attribute vec3 prevPosition3DHigh;
|
||
attribute vec3 prevPosition3DLow;
|
||
attribute vec3 nextPosition3DHigh;
|
||
attribute vec3 nextPosition3DLow;
|
||
attribute vec2 expandAndWidth;
|
||
attribute vec2 st;
|
||
attribute float batchId;
|
||
|
||
varying float v_width;
|
||
varying vec2 v_st;
|
||
varying float v_polylineAngle;
|
||
|
||
void main()
|
||
{
|
||
float expandDir = expandAndWidth.x;
|
||
float width = abs(expandAndWidth.y) + 0.5;
|
||
bool usePrev = expandAndWidth.y < 0.0;
|
||
|
||
vec4 p = czm_computePosition();
|
||
vec4 prev = czm_computePrevPosition();
|
||
vec4 next = czm_computeNextPosition();
|
||
|
||
float angle;
|
||
vec4 positionWC = getPolylineWindowCoordinates(p, prev, next, expandDir, width, usePrev, angle);
|
||
gl_Position = czm_viewportOrthographic * positionWC;
|
||
|
||
v_width = width;
|
||
v_st.s = st.s;
|
||
v_st.t = czm_writeNonPerspective(st.t, gl_Position.w);
|
||
v_polylineAngle = angle;
|
||
}
|
||
`;let VF=`${mx}
|
||
${Hje}`;const Vje=XK;Mn.isInternetExplorer()||(VF=`#define CLIP_POLYLINE
|
||
${VF}`);function ca(e){e=A(e,A.EMPTY_OBJECT);const t=A(e.translucent,!0),n=!1,i=ca.VERTEX_FORMAT;this.material=l(e.material)?e.material:$e.fromType($e.ColorType),this.translucent=t,this._vertexShaderSource=A(e.vertexShaderSource,VF),this._fragmentShaderSource=A(e.fragmentShaderSource,Vje),this._renderState=ns.getDefaultRenderState(t,n,e.renderState),this._closed=n,this._vertexFormat=i}Object.defineProperties(ca.prototype,{vertexShaderSource:{get:function(){let e=this._vertexShaderSource;return this.material.shaderSource.search(/varying\s+float\s+v_polylineAngle;/g)!==-1&&(e=`#define POLYLINE_DASH
|
||
${e}`),e}},fragmentShaderSource:{get:function(){return this._fragmentShaderSource}},renderState:{get:function(){return this._renderState}},closed:{get:function(){return this._closed}},vertexFormat:{get:function(){return this._vertexFormat}}});ca.VERTEX_FORMAT=Ye.POSITION_AND_ST;ca.prototype.getFragmentShaderSource=ns.prototype.getFragmentShaderSource;ca.prototype.isTranslucent=ns.prototype.isTranslucent;ca.prototype.getRenderState=ns.prototype.getRenderState;function gu(e){e=A(e,A.EMPTY_OBJECT),this.geometryInstances=e.geometryInstances,this._hasPerInstanceColors=!0;let t=e.appearance;l(t)||(t=new ca),this.appearance=t,this.show=A(e.show,!0),this.classificationType=A(e.classificationType,ir.BOTH),this.debugShowBoundingVolume=A(e.debugShowBoundingVolume,!1),this._debugShowShadowVolume=A(e.debugShowShadowVolume,!1),this._primitiveOptions={geometryInstances:void 0,appearance:void 0,vertexCacheOptimize:!1,interleave:A(e.interleave,!1),releaseGeometryInstances:A(e.releaseGeometryInstances,!0),allowPicking:A(e.allowPicking,!0),asynchronous:A(e.asynchronous,!0),compressVertices:!1,_createShaderProgramFunction:void 0,_createCommandsFunction:void 0,_updateAndQueueCommandsFunction:void 0},this._zIndex=void 0,this._ready=!1;const n=this;this._readyPromise=new Promise((i,o)=>{n._completeLoad=()=>{this._ready=!0,this.releaseGeometryInstances&&(this.geometryInstances=void 0);const r=this._error;l(r)?o(r):i(this)}}),this._primitive=void 0,this._sp=void 0,this._sp2D=void 0,this._spMorph=void 0,this._renderState=L9(!1),this._renderState3DTiles=L9(!0),this._renderStateMorph=ht.fromCache({cull:{enabled:!0,face:mr.FRONT},depthTest:{enabled:!0},blending:fo.PRE_MULTIPLIED_ALPHA_BLEND,depthMask:!1})}Object.defineProperties(gu.prototype,{interleave:{get:function(){return this._primitiveOptions.interleave}},releaseGeometryInstances:{get:function(){return this._primitiveOptions.releaseGeometryInstances}},allowPicking:{get:function(){return this._primitiveOptions.allowPicking}},asynchronous:{get:function(){return this._primitiveOptions.asynchronous}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise}},debugShowShadowVolume:{get:function(){return this._debugShowShadowVolume}}});gu.initializeTerrainHeights=function(){return Ro.initialize()};function kje(e,t,n){const i=t.context,o=e._primitive,r=o._attributeLocations;let s=o._batchTable.getVertexShaderCallback()(VOe);s=fn._appendShowToShader(o,s),s=fn._appendDistanceDisplayConditionToShader(o,s),s=fn._modifyShaderPosition(e,s,t.scene3DOnly);let a=o._batchTable.getVertexShaderCallback()(HOe);a=fn._appendShowToShader(o,a),a=fn._appendDistanceDisplayConditionToShader(o,a),a=fn._modifyShaderPosition(e,a,t.scene3DOnly);let c=o._batchTable.getVertexShaderCallback()(zOe);const u=[`GLOBE_MINIMUM_ALTITUDE ${t.mapProjection.ellipsoid.minimumRadius.toFixed(1)}`];let f="",h="";l(n.material)?(h=l(n.material)?n.material.shaderSource:"",h.search(/varying\s+float\s+v_polylineAngle;/g)!==-1&&u.push("ANGLE_VARYING"),h.search(/varying\s+float\s+v_width;/g)!==-1&&u.push("WIDTH_VARYING")):f="PER_INSTANCE_COLOR",u.push(f);const _=e.debugShowShadowVolume?["DEBUG_SHOW_VOLUME",f]:[f],g=new nt({defines:u,sources:[s]}),p=new nt({defines:_,sources:[h,c]});e._sp=Hn.replaceCache({context:i,shaderProgram:o._sp,vertexShaderSource:g,fragmentShaderSource:p,attributeLocations:r});let y=i.shaderCache.getDerivedShaderProgram(e._sp,"2dColor");if(!l(y)){const b=new nt({defines:u.concat(["COLUMBUS_VIEW_2D"]),sources:[s]});y=i.shaderCache.createDerivedShaderProgram(e._sp,"2dColor",{context:i,shaderProgram:e._sp2D,vertexShaderSource:b,fragmentShaderSource:p,attributeLocations:r})}e._sp2D=y;let T=i.shaderCache.getDerivedShaderProgram(e._sp,"MorphColor");if(!l(T)){const b=new nt({defines:u.concat([`MAX_TERRAIN_HEIGHT ${Ro._defaultMaxTerrainHeight.toFixed(1)}`]),sources:[a]});c=o._batchTable.getVertexShaderCallback()(UOe);const x=new nt({defines:_,sources:[h,c]});T=i.shaderCache.createDerivedShaderProgram(e._sp,"MorphColor",{context:i,shaderProgram:e._spMorph,vertexShaderSource:b,fragmentShaderSource:x,attributeLocations:r})}e._spMorph=T}function L9(e){return ht.fromCache({cull:{enabled:!0},blending:fo.PRE_MULTIPLIED_ALPHA_BLEND,depthMask:!1,stencilTest:{enabled:e,frontFunction:Ni.EQUAL,frontOperation:{fail:It.KEEP,zFail:It.KEEP,zPass:It.KEEP},backFunction:Ni.EQUAL,backOperation:{fail:It.KEEP,zFail:It.KEEP,zPass:It.KEEP},reference:Kt.CESIUM_3D_TILE_MASK,mask:Kt.CESIUM_3D_TILE_MASK}})}function Gje(e,t,n,i,o,r){const s=e._primitive,a=s._va.length;o.length=a,r.length=a;const u=t instanceof Na?{}:n._uniforms,f=s._batchTable.getUniformMapCallback()(u);for(let h=0;h<a;h++){const _=s._va[h];let g=o[h];l(g)||(g=o[h]=new Dt({owner:e,primitiveType:s._primitiveType})),g.vertexArray=_,g.renderState=e._renderState,g.shaderProgram=e._sp,g.uniformMap=f,g.pass=We.TERRAIN_CLASSIFICATION,g.pickId="czm_batchTable_pickColor(v_endPlaneNormalEcAndBatchId.w)";const p=Dt.shallowClone(g,g.derivedCommands.tileset);p.renderState=e._renderState3DTiles,p.pass=We.CESIUM_3D_TILE_CLASSIFICATION,g.derivedCommands.tileset=p;const y=Dt.shallowClone(g,g.derivedCommands.color2D);y.shaderProgram=e._sp2D,g.derivedCommands.color2D=y;const T=Dt.shallowClone(p,p.derivedCommands.color2D);T.shaderProgram=e._sp2D,p.derivedCommands.color2D=T;const b=Dt.shallowClone(g,g.derivedCommands.colorMorph);b.renderState=e._renderStateMorph,b.shaderProgram=e._spMorph,b.pickId="czm_batchTable_pickColor(v_batchId)",g.derivedCommands.colorMorph=b}}function B9(e,t,n,i,o,r,s){n.mode===me.MORPHING?t=t.derivedCommands.colorMorph:n.mode!==me.SCENE3D&&(t=t.derivedCommands.color2D),t.modelMatrix=i,t.boundingVolume=r,t.cull=o,t.debugShowBoundingVolume=s,n.commandList.push(t)}function Wje(e,t,n,i,o,r,s){const a=e._primitive;fn._updateBoundingVolumes(a,t,o);let c;t.mode===me.SCENE3D?c=a._boundingSphereWC:t.mode===me.COLUMBUS_VIEW?c=a._boundingSphereCV:t.mode===me.SCENE2D&&l(a._boundingSphere2D)?c=a._boundingSphere2D:l(a._boundingSphereMorph)&&(c=a._boundingSphereMorph);const u=t.mode===me.MORPHING,f=e.classificationType,h=f!==ir.CESIUM_3D_TILE,_=f!==ir.TERRAIN&&!u;let g;const p=t.passes;if(p.render||p.pick&&a.allowPicking){const y=n.length;for(let T=0;T<y;++T){const b=c[T];h&&(g=n[T],B9(e,g,t,o,r,b,s)),_&&(g=n[T].derivedCommands.tileset,B9(e,g,t,o,r,b,s))}}}gu.prototype.update=function(e){if(!l(this._primitive)&&!l(this.geometryInstances))return;if(!Ro.initialized){if(!this.asynchronous)throw new w("For synchronous GroundPolylinePrimitives, you must call GroundPolylinePrimitives.initializeTerrainHeights() and wait for the returned promise to resolve.");gu.initializeTerrainHeights();return}let t;const n=this,i=this._primitiveOptions;if(!l(this._primitive)){const o=Array.isArray(this.geometryInstances)?this.geometryInstances:[this.geometryInstances],r=o.length,s=new Array(r);let a;for(t=0;t<r;++t)if(a=o[t].attributes,!l(a)||!l(a.color)){this._hasPerInstanceColors=!1;break}for(t=0;t<r;++t){const c=o[t];a={};const u=c.attributes;for(const f in u)u.hasOwnProperty(f)&&(a[f]=u[f]);l(a.width)||(a.width=new Zu({componentDatatype:oe.UNSIGNED_BYTE,componentsPerAttribute:1,value:[c.geometry.width]})),c.geometry._scene3DOnly=e.scene3DOnly,Qh.setProjectionAndEllipsoid(c.geometry,e.mapProjection),s[t]=new xn({geometry:c.geometry,attributes:a,id:c.id,pickPrimitive:n})}i.geometryInstances=s,i.appearance=this.appearance,i._createShaderProgramFunction=function(c,u,f){kje(n,u,f)},i._createCommandsFunction=function(c,u,f,h,_,g,p){Gje(n,u,f,h,g,p)},i._updateAndQueueCommandsFunction=function(c,u,f,h,_,g,p,y){Wje(n,u,f,h,_,g,p)},this._primitive=new fn(i),this._primitive.readyPromise.then(this._completeLoad)}if(this.appearance instanceof Na&&!this._hasPerInstanceColors)throw new w("All GeometryInstances must have color attributes to use PolylineColorAppearance with GroundPolylinePrimitive.");this._primitive.appearance=this.appearance,this._primitive.show=this.show,this._primitive.debugShowBoundingVolume=this.debugShowBoundingVolume,this._primitive.update(e)};gu.prototype.getGeometryInstanceAttributes=function(e){if(!l(this._primitive))throw new w("must call update before calling getGeometryInstanceAttributes");return this._primitive.getGeometryInstanceAttributes(e)};gu.isSupported=function(e){return e.frameState.context.depthTexture};gu.prototype.isDestroyed=function(){return!1};gu.prototype.destroy=function(){return this._primitive=this._primitive&&this._primitive.destroy(),this._sp=this._sp&&this._sp.destroy(),this._sp2D=void 0,this._spMorph=void 0,Je(this)};const qje=new $(1,1),jje=!1,Yje=k.WHITE;function rT(e){e=A(e,A.EMPTY_OBJECT),this._definitionChanged=new lt,this._image=void 0,this._imageSubscription=void 0,this._repeat=void 0,this._repeatSubscription=void 0,this._color=void 0,this._colorSubscription=void 0,this._transparent=void 0,this._transparentSubscription=void 0,this.image=e.image,this.repeat=e.repeat,this.color=e.color,this.transparent=e.transparent}Object.defineProperties(rT.prototype,{isConstant:{get:function(){return ie.isConstant(this._image)&&ie.isConstant(this._repeat)}},definitionChanged:{get:function(){return this._definitionChanged}},image:xe("image"),repeat:xe("repeat"),color:xe("color"),transparent:xe("transparent")});rT.prototype.getType=function(e){return"Image"};rT.prototype.getValue=function(e,t){return l(t)||(t={}),t.image=ie.getValueOrUndefined(this._image,e),t.repeat=ie.getValueOrClonedDefault(this._repeat,e,qje,t.repeat),t.color=ie.getValueOrClonedDefault(this._color,e,Yje,t.color),ie.getValueOrDefault(this._transparent,e,jje)&&(t.color.alpha=Math.min(.99,t.color.alpha)),t};rT.prototype.equals=function(e){return this===e||e instanceof rT&&ie.equals(this._image,e._image)&&ie.equals(this._repeat,e._repeat)&&ie.equals(this._color,e._color)&&ie.equals(this._transparent,e._transparent)};function $je(e){if(e instanceof k)return new An(e);if(typeof e=="string"||e instanceof je||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement){const t=new rT;return t.image=e,t}throw new w(`Unable to infer material type: ${e}`)}function gl(e,t){return xe(e,t,$je)}function LE(e){this._definitionChanged=new lt,this._show=void 0,this._showSubscription=void 0,this._dimensions=void 0,this._dimensionsSubscription=void 0,this._heightReference=void 0,this._heightReferenceSubscription=void 0,this._fill=void 0,this._fillSubscription=void 0,this._material=void 0,this._materialSubscription=void 0,this._outline=void 0,this._outlineSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this._shadows=void 0,this._shadowsSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this.merge(A(e,A.EMPTY_OBJECT))}Object.defineProperties(LE.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:xe("show"),dimensions:xe("dimensions"),heightReference:xe("heightReference"),fill:xe("fill"),material:gl("material"),outline:xe("outline"),outlineColor:xe("outlineColor"),outlineWidth:xe("outlineWidth"),shadows:xe("shadows"),distanceDisplayCondition:xe("distanceDisplayCondition")});LE.prototype.clone=function(e){return l(e)?(e.show=this.show,e.dimensions=this.dimensions,e.heightReference=this.heightReference,e.fill=this.fill,e.material=this.material,e.outline=this.outline,e.outlineColor=this.outlineColor,e.outlineWidth=this.outlineWidth,e.shadows=this.shadows,e.distanceDisplayCondition=this.distanceDisplayCondition,e):new LE(this)};LE.prototype.merge=function(e){if(!l(e))throw new w("source is required.");this.show=A(this.show,e.show),this.dimensions=A(this.dimensions,e.dimensions),this.heightReference=A(this.heightReference,e.heightReference),this.fill=A(this.fill,e.fill),this.material=A(this.material,e.material),this.outline=A(this.outline,e.outline),this.outlineColor=A(this.outlineColor,e.outlineColor),this.outlineWidth=A(this.outlineWidth,e.outlineWidth),this.shadows=A(this.shadows,e.shadows),this.distanceDisplayCondition=A(this.distanceDisplayCondition,e.distanceDisplayCondition)};const Xje={FIXED:0,INERTIAL:1},$a=Object.freeze(Xje);function b_(){w.throwInstantiationError()}Object.defineProperties(b_.prototype,{isConstant:{get:w.throwInstantiationError},definitionChanged:{get:w.throwInstantiationError},referenceFrame:{get:w.throwInstantiationError}});b_.prototype.getValue=w.throwInstantiationError;b_.prototype.getValueInReferenceFrame=w.throwInstantiationError;b_.prototype.equals=w.throwInstantiationError;const ER=new te;b_.convertToReferenceFrame=function(e,t,n,i,o){if(!l(t))return t;if(l(o)||(o=new d),n===i)return d.clone(t,o);let r=En.computeIcrfToFixedMatrix(e,ER);if(l(r)||(r=En.computeTemeToPseudoFixedMatrix(e,ER)),n===$a.INERTIAL)return te.multiplyByVector(r,t,o);if(n===$a.FIXED)return te.multiplyByVector(te.transpose(r,ER),t,o)};function ep(e,t){this._definitionChanged=new lt,this._value=d.clone(e),this._referenceFrame=A(t,$a.FIXED)}Object.defineProperties(ep.prototype,{isConstant:{get:function(){return!l(this._value)||this._referenceFrame===$a.FIXED}},definitionChanged:{get:function(){return this._definitionChanged}},referenceFrame:{get:function(){return this._referenceFrame}}});ep.prototype.getValue=function(e,t){return this.getValueInReferenceFrame(e,$a.FIXED,t)};ep.prototype.setValue=function(e,t){let n=!1;d.equals(this._value,e)||(n=!0,this._value=d.clone(e)),l(t)&&this._referenceFrame!==t&&(n=!0,this._referenceFrame=t),n&&this._definitionChanged.raiseEvent(this)};ep.prototype.getValueInReferenceFrame=function(e,t,n){if(!l(e))throw new w("time is required.");if(!l(t))throw new w("referenceFrame is required.");return b_.convertToReferenceFrame(e,this._value,this._referenceFrame,t,n)};ep.prototype.equals=function(e){return this===e||e instanceof ep&&d.equals(this._value,e._value)&&this._referenceFrame===e._referenceFrame};function BE(e){this._definitionChanged=new lt,this._show=void 0,this._showSubscription=void 0,this._positions=void 0,this._positionsSubscription=void 0,this._width=void 0,this._widthSubscription=void 0,this._height=void 0,this._heightSubscription=void 0,this._heightReference=void 0,this._heightReferenceSubscription=void 0,this._extrudedHeight=void 0,this._extrudedHeightSubscription=void 0,this._extrudedHeightReference=void 0,this._extrudedHeightReferenceSubscription=void 0,this._cornerType=void 0,this._cornerTypeSubscription=void 0,this._granularity=void 0,this._granularitySubscription=void 0,this._fill=void 0,this._fillSubscription=void 0,this._material=void 0,this._materialSubscription=void 0,this._outline=void 0,this._outlineSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this._shadows=void 0,this._shadowsSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this._classificationType=void 0,this._classificationTypeSubscription=void 0,this._zIndex=void 0,this._zIndexSubscription=void 0,this.merge(A(e,A.EMPTY_OBJECT))}Object.defineProperties(BE.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:xe("show"),positions:xe("positions"),width:xe("width"),height:xe("height"),heightReference:xe("heightReference"),extrudedHeight:xe("extrudedHeight"),extrudedHeightReference:xe("extrudedHeightReference"),cornerType:xe("cornerType"),granularity:xe("granularity"),fill:xe("fill"),material:gl("material"),outline:xe("outline"),outlineColor:xe("outlineColor"),outlineWidth:xe("outlineWidth"),shadows:xe("shadows"),distanceDisplayCondition:xe("distanceDisplayCondition"),classificationType:xe("classificationType"),zIndex:xe("zIndex")});BE.prototype.clone=function(e){return l(e)?(e.show=this.show,e.positions=this.positions,e.width=this.width,e.height=this.height,e.heightReference=this.heightReference,e.extrudedHeight=this.extrudedHeight,e.extrudedHeightReference=this.extrudedHeightReference,e.cornerType=this.cornerType,e.granularity=this.granularity,e.fill=this.fill,e.material=this.material,e.outline=this.outline,e.outlineColor=this.outlineColor,e.outlineWidth=this.outlineWidth,e.shadows=this.shadows,e.distanceDisplayCondition=this.distanceDisplayCondition,e.classificationType=this.classificationType,e.zIndex=this.zIndex,e):new BE(this)};BE.prototype.merge=function(e){if(!l(e))throw new w("source is required.");this.show=A(this.show,e.show),this.positions=A(this.positions,e.positions),this.width=A(this.width,e.width),this.height=A(this.height,e.height),this.heightReference=A(this.heightReference,e.heightReference),this.extrudedHeight=A(this.extrudedHeight,e.extrudedHeight),this.extrudedHeightReference=A(this.extrudedHeightReference,e.extrudedHeightReference),this.cornerType=A(this.cornerType,e.cornerType),this.granularity=A(this.granularity,e.granularity),this.fill=A(this.fill,e.fill),this.material=A(this.material,e.material),this.outline=A(this.outline,e.outline),this.outlineColor=A(this.outlineColor,e.outlineColor),this.outlineWidth=A(this.outlineWidth,e.outlineWidth),this.shadows=A(this.shadows,e.shadows),this.distanceDisplayCondition=A(this.distanceDisplayCondition,e.distanceDisplayCondition),this.classificationType=A(this.classificationType,e.classificationType),this.zIndex=A(this.zIndex,e.zIndex)};function Kje(e){return e}function kF(e,t){return xe(e,t,Kje)}function RE(e){this._definitionChanged=new lt,this._show=void 0,this._showSubscription=void 0,this._length=void 0,this._lengthSubscription=void 0,this._topRadius=void 0,this._topRadiusSubscription=void 0,this._bottomRadius=void 0,this._bottomRadiusSubscription=void 0,this._heightReference=void 0,this._heightReferenceSubscription=void 0,this._fill=void 0,this._fillSubscription=void 0,this._material=void 0,this._materialSubscription=void 0,this._outline=void 0,this._outlineSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this._numberOfVerticalLines=void 0,this._numberOfVerticalLinesSubscription=void 0,this._slices=void 0,this._slicesSubscription=void 0,this._shadows=void 0,this._shadowsSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this.merge(A(e,A.EMPTY_OBJECT))}Object.defineProperties(RE.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:xe("show"),length:xe("length"),topRadius:xe("topRadius"),bottomRadius:xe("bottomRadius"),heightReference:xe("heightReference"),fill:xe("fill"),material:gl("material"),outline:xe("outline"),outlineColor:xe("outlineColor"),outlineWidth:xe("outlineWidth"),numberOfVerticalLines:xe("numberOfVerticalLines"),slices:xe("slices"),shadows:xe("shadows"),distanceDisplayCondition:xe("distanceDisplayCondition")});RE.prototype.clone=function(e){return l(e)?(e.show=this.show,e.length=this.length,e.topRadius=this.topRadius,e.bottomRadius=this.bottomRadius,e.heightReference=this.heightReference,e.fill=this.fill,e.material=this.material,e.outline=this.outline,e.outlineColor=this.outlineColor,e.outlineWidth=this.outlineWidth,e.numberOfVerticalLines=this.numberOfVerticalLines,e.slices=this.slices,e.shadows=this.shadows,e.distanceDisplayCondition=this.distanceDisplayCondition,e):new RE(this)};RE.prototype.merge=function(e){if(!l(e))throw new w("source is required.");this.show=A(this.show,e.show),this.length=A(this.length,e.length),this.topRadius=A(this.topRadius,e.topRadius),this.bottomRadius=A(this.bottomRadius,e.bottomRadius),this.heightReference=A(this.heightReference,e.heightReference),this.fill=A(this.fill,e.fill),this.material=A(this.material,e.material),this.outline=A(this.outline,e.outline),this.outlineColor=A(this.outlineColor,e.outlineColor),this.outlineWidth=A(this.outlineWidth,e.outlineWidth),this.numberOfVerticalLines=A(this.numberOfVerticalLines,e.numberOfVerticalLines),this.slices=A(this.slices,e.slices),this.shadows=A(this.shadows,e.shadows),this.distanceDisplayCondition=A(this.distanceDisplayCondition,e.distanceDisplayCondition)};function NE(e){this._definitionChanged=new lt,this._show=void 0,this._showSubscription=void 0,this._semiMajorAxis=void 0,this._semiMajorAxisSubscription=void 0,this._semiMinorAxis=void 0,this._semiMinorAxisSubscription=void 0,this._height=void 0,this._heightSubscription=void 0,this._heightReference=void 0,this._heightReferenceSubscription=void 0,this._extrudedHeight=void 0,this._extrudedHeightSubscription=void 0,this._extrudedHeightReference=void 0,this._extrudedHeightReferenceSubscription=void 0,this._rotation=void 0,this._rotationSubscription=void 0,this._stRotation=void 0,this._stRotationSubscription=void 0,this._granularity=void 0,this._granularitySubscription=void 0,this._fill=void 0,this._fillSubscription=void 0,this._material=void 0,this._materialSubscription=void 0,this._outline=void 0,this._outlineSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this._numberOfVerticalLines=void 0,this._numberOfVerticalLinesSubscription=void 0,this._shadows=void 0,this._shadowsSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this._classificationType=void 0,this._classificationTypeSubscription=void 0,this._zIndex=void 0,this._zIndexSubscription=void 0,this.merge(A(e,A.EMPTY_OBJECT))}Object.defineProperties(NE.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:xe("show"),semiMajorAxis:xe("semiMajorAxis"),semiMinorAxis:xe("semiMinorAxis"),height:xe("height"),heightReference:xe("heightReference"),extrudedHeight:xe("extrudedHeight"),extrudedHeightReference:xe("extrudedHeightReference"),rotation:xe("rotation"),stRotation:xe("stRotation"),granularity:xe("granularity"),fill:xe("fill"),material:gl("material"),outline:xe("outline"),outlineColor:xe("outlineColor"),outlineWidth:xe("outlineWidth"),numberOfVerticalLines:xe("numberOfVerticalLines"),shadows:xe("shadows"),distanceDisplayCondition:xe("distanceDisplayCondition"),classificationType:xe("classificationType"),zIndex:xe("zIndex")});NE.prototype.clone=function(e){return l(e)?(e.show=this.show,e.semiMajorAxis=this.semiMajorAxis,e.semiMinorAxis=this.semiMinorAxis,e.height=this.height,e.heightReference=this.heightReference,e.extrudedHeight=this.extrudedHeight,e.extrudedHeightReference=this.extrudedHeightReference,e.rotation=this.rotation,e.stRotation=this.stRotation,e.granularity=this.granularity,e.fill=this.fill,e.material=this.material,e.outline=this.outline,e.outlineColor=this.outlineColor,e.outlineWidth=this.outlineWidth,e.numberOfVerticalLines=this.numberOfVerticalLines,e.shadows=this.shadows,e.distanceDisplayCondition=this.distanceDisplayCondition,e.classificationType=this.classificationType,e.zIndex=this.zIndex,e):new NE(this)};NE.prototype.merge=function(e){if(!l(e))throw new w("source is required.");this.show=A(this.show,e.show),this.semiMajorAxis=A(this.semiMajorAxis,e.semiMajorAxis),this.semiMinorAxis=A(this.semiMinorAxis,e.semiMinorAxis),this.height=A(this.height,e.height),this.heightReference=A(this.heightReference,e.heightReference),this.extrudedHeight=A(this.extrudedHeight,e.extrudedHeight),this.extrudedHeightReference=A(this.extrudedHeightReference,e.extrudedHeightReference),this.rotation=A(this.rotation,e.rotation),this.stRotation=A(this.stRotation,e.stRotation),this.granularity=A(this.granularity,e.granularity),this.fill=A(this.fill,e.fill),this.material=A(this.material,e.material),this.outline=A(this.outline,e.outline),this.outlineColor=A(this.outlineColor,e.outlineColor),this.outlineWidth=A(this.outlineWidth,e.outlineWidth),this.numberOfVerticalLines=A(this.numberOfVerticalLines,e.numberOfVerticalLines),this.shadows=A(this.shadows,e.shadows),this.distanceDisplayCondition=A(this.distanceDisplayCondition,e.distanceDisplayCondition),this.classificationType=A(this.classificationType,e.classificationType),this.zIndex=A(this.zIndex,e.zIndex)};function ME(e){this._definitionChanged=new lt,this._show=void 0,this._showSubscription=void 0,this._radii=void 0,this._radiiSubscription=void 0,this._innerRadii=void 0,this._innerRadiiSubscription=void 0,this._minimumClock=void 0,this._minimumClockSubscription=void 0,this._maximumClock=void 0,this._maximumClockSubscription=void 0,this._minimumCone=void 0,this._minimumConeSubscription=void 0,this._maximumCone=void 0,this._maximumConeSubscription=void 0,this._heightReference=void 0,this._heightReferenceSubscription=void 0,this._fill=void 0,this._fillSubscription=void 0,this._material=void 0,this._materialSubscription=void 0,this._outline=void 0,this._outlineSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this._stackPartitions=void 0,this._stackPartitionsSubscription=void 0,this._slicePartitions=void 0,this._slicePartitionsSubscription=void 0,this._subdivisions=void 0,this._subdivisionsSubscription=void 0,this._shadows=void 0,this._shadowsSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this.merge(A(e,A.EMPTY_OBJECT))}Object.defineProperties(ME.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:xe("show"),radii:xe("radii"),innerRadii:xe("innerRadii"),minimumClock:xe("minimumClock"),maximumClock:xe("maximumClock"),minimumCone:xe("minimumCone"),maximumCone:xe("maximumCone"),heightReference:xe("heightReference"),fill:xe("fill"),material:gl("material"),outline:xe("outline"),outlineColor:xe("outlineColor"),outlineWidth:xe("outlineWidth"),stackPartitions:xe("stackPartitions"),slicePartitions:xe("slicePartitions"),subdivisions:xe("subdivisions"),shadows:xe("shadows"),distanceDisplayCondition:xe("distanceDisplayCondition")});ME.prototype.clone=function(e){return l(e)?(e.show=this.show,e.radii=this.radii,e.innerRadii=this.innerRadii,e.minimumClock=this.minimumClock,e.maximumClock=this.maximumClock,e.minimumCone=this.minimumCone,e.maximumCone=this.maximumCone,e.heightReference=this.heightReference,e.fill=this.fill,e.material=this.material,e.outline=this.outline,e.outlineColor=this.outlineColor,e.outlineWidth=this.outlineWidth,e.stackPartitions=this.stackPartitions,e.slicePartitions=this.slicePartitions,e.subdivisions=this.subdivisions,e.shadows=this.shadows,e.distanceDisplayCondition=this.distanceDisplayCondition,e):new ME(this)};ME.prototype.merge=function(e){if(!l(e))throw new w("source is required.");this.show=A(this.show,e.show),this.radii=A(this.radii,e.radii),this.innerRadii=A(this.innerRadii,e.innerRadii),this.minimumClock=A(this.minimumClock,e.minimumClock),this.maximumClock=A(this.maximumClock,e.maximumClock),this.minimumCone=A(this.minimumCone,e.minimumCone),this.maximumCone=A(this.maximumCone,e.maximumCone),this.heightReference=A(this.heightReference,e.heightReference),this.fill=A(this.fill,e.fill),this.material=A(this.material,e.material),this.outline=A(this.outline,e.outline),this.outlineColor=A(this.outlineColor,e.outlineColor),this.outlineWidth=A(this.outlineWidth,e.outlineWidth),this.stackPartitions=A(this.stackPartitions,e.stackPartitions),this.slicePartitions=A(this.slicePartitions,e.slicePartitions),this.subdivisions=A(this.subdivisions,e.subdivisions),this.shadows=A(this.shadows,e.shadows),this.distanceDisplayCondition=A(this.distanceDisplayCondition,e.distanceDisplayCondition)};function FE(e){this._definitionChanged=new lt,this._show=void 0,this._showSubscription=void 0,this._text=void 0,this._textSubscription=void 0,this._font=void 0,this._fontSubscription=void 0,this._style=void 0,this._styleSubscription=void 0,this._scale=void 0,this._scaleSubscription=void 0,this._showBackground=void 0,this._showBackgroundSubscription=void 0,this._backgroundColor=void 0,this._backgroundColorSubscription=void 0,this._backgroundPadding=void 0,this._backgroundPaddingSubscription=void 0,this._pixelOffset=void 0,this._pixelOffsetSubscription=void 0,this._eyeOffset=void 0,this._eyeOffsetSubscription=void 0,this._horizontalOrigin=void 0,this._horizontalOriginSubscription=void 0,this._verticalOrigin=void 0,this._verticalOriginSubscription=void 0,this._heightReference=void 0,this._heightReferenceSubscription=void 0,this._fillColor=void 0,this._fillColorSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this._translucencyByDistance=void 0,this._translucencyByDistanceSubscription=void 0,this._pixelOffsetScaleByDistance=void 0,this._pixelOffsetScaleByDistanceSubscription=void 0,this._scaleByDistance=void 0,this._scaleByDistanceSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this._disableDepthTestDistance=void 0,this._disableDepthTestDistanceSubscription=void 0,this.merge(A(e,A.EMPTY_OBJECT))}Object.defineProperties(FE.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:xe("show"),text:xe("text"),font:xe("font"),style:xe("style"),scale:xe("scale"),showBackground:xe("showBackground"),backgroundColor:xe("backgroundColor"),backgroundPadding:xe("backgroundPadding"),pixelOffset:xe("pixelOffset"),eyeOffset:xe("eyeOffset"),horizontalOrigin:xe("horizontalOrigin"),verticalOrigin:xe("verticalOrigin"),heightReference:xe("heightReference"),fillColor:xe("fillColor"),outlineColor:xe("outlineColor"),outlineWidth:xe("outlineWidth"),translucencyByDistance:xe("translucencyByDistance"),pixelOffsetScaleByDistance:xe("pixelOffsetScaleByDistance"),scaleByDistance:xe("scaleByDistance"),distanceDisplayCondition:xe("distanceDisplayCondition"),disableDepthTestDistance:xe("disableDepthTestDistance")});FE.prototype.clone=function(e){return l(e)?(e.show=this.show,e.text=this.text,e.font=this.font,e.style=this.style,e.scale=this.scale,e.showBackground=this.showBackground,e.backgroundColor=this.backgroundColor,e.backgroundPadding=this.backgroundPadding,e.pixelOffset=this.pixelOffset,e.eyeOffset=this.eyeOffset,e.horizontalOrigin=this.horizontalOrigin,e.verticalOrigin=this.verticalOrigin,e.heightReference=this.heightReference,e.fillColor=this.fillColor,e.outlineColor=this.outlineColor,e.outlineWidth=this.outlineWidth,e.translucencyByDistance=this.translucencyByDistance,e.pixelOffsetScaleByDistance=this.pixelOffsetScaleByDistance,e.scaleByDistance=this.scaleByDistance,e.distanceDisplayCondition=this.distanceDisplayCondition,e.disableDepthTestDistance=this.disableDepthTestDistance,e):new FE(this)};FE.prototype.merge=function(e){if(!l(e))throw new w("source is required.");this.show=A(this.show,e.show),this.text=A(this.text,e.text),this.font=A(this.font,e.font),this.style=A(this.style,e.style),this.scale=A(this.scale,e.scale),this.showBackground=A(this.showBackground,e.showBackground),this.backgroundColor=A(this.backgroundColor,e.backgroundColor),this.backgroundPadding=A(this.backgroundPadding,e.backgroundPadding),this.pixelOffset=A(this.pixelOffset,e.pixelOffset),this.eyeOffset=A(this.eyeOffset,e.eyeOffset),this.horizontalOrigin=A(this.horizontalOrigin,e.horizontalOrigin),this.verticalOrigin=A(this.verticalOrigin,e.verticalOrigin),this.heightReference=A(this.heightReference,e.heightReference),this.fillColor=A(this.fillColor,e.fillColor),this.outlineColor=A(this.outlineColor,e.outlineColor),this.outlineWidth=A(this.outlineWidth,e.outlineWidth),this.translucencyByDistance=A(this.translucencyByDistance,e.translucencyByDistance),this.pixelOffsetScaleByDistance=A(this.pixelOffsetScaleByDistance,e.pixelOffsetScaleByDistance),this.scaleByDistance=A(this.scaleByDistance,e.scaleByDistance),this.distanceDisplayCondition=A(this.distanceDisplayCondition,e.distanceDisplayCondition),this.disableDepthTestDistance=A(this.disableDepthTestDistance,e.disableDepthTestDistance)};const Jje=new d(1,1,1),Qje=d.ZERO,Zje=De.IDENTITY;function AP(e,t,n){this.translation=d.clone(A(e,Qje)),this.rotation=De.clone(A(t,Zje)),this.scale=d.clone(A(n,Jje))}AP.prototype.equals=function(e){return this===e||l(e)&&d.equals(this.translation,e.translation)&&De.equals(this.rotation,e.rotation)&&d.equals(this.scale,e.scale)};const xR=new AP;function zE(e){e=A(e,A.EMPTY_OBJECT),this._definitionChanged=new lt,this._translation=void 0,this._translationSubscription=void 0,this._rotation=void 0,this._rotationSubscription=void 0,this._scale=void 0,this._scaleSubscription=void 0,this.translation=e.translation,this.rotation=e.rotation,this.scale=e.scale}Object.defineProperties(zE.prototype,{isConstant:{get:function(){return ie.isConstant(this._translation)&&ie.isConstant(this._rotation)&&ie.isConstant(this._scale)}},definitionChanged:{get:function(){return this._definitionChanged}},translation:xe("translation"),rotation:xe("rotation"),scale:xe("scale")});zE.prototype.getValue=function(e,t){return l(t)||(t=new AP),t.translation=ie.getValueOrClonedDefault(this._translation,e,xR.translation,t.translation),t.rotation=ie.getValueOrClonedDefault(this._rotation,e,xR.rotation,t.rotation),t.scale=ie.getValueOrClonedDefault(this._scale,e,xR.scale,t.scale),t};zE.prototype.equals=function(e){return this===e||e instanceof zE&&ie.equals(this._translation,e._translation)&&ie.equals(this._rotation,e._rotation)&&ie.equals(this._scale,e._scale)};function yl(e,t){this._propertyNames=[],this._definitionChanged=new lt,l(e)&&this.merge(e,t)}Object.defineProperties(yl.prototype,{propertyNames:{get:function(){return this._propertyNames}},isConstant:{get:function(){const e=this._propertyNames;for(let t=0,n=e.length;t<n;t++)if(!ie.isConstant(this[e[t]]))return!1;return!0}},definitionChanged:{get:function(){return this._definitionChanged}}});yl.prototype.hasProperty=function(e){return this._propertyNames.indexOf(e)!==-1};function e7e(e){return new Cr(e)}yl.prototype.addProperty=function(e,t,n){const i=this._propertyNames;if(!l(e))throw new w("propertyName is required.");if(i.indexOf(e)!==-1)throw new w(`${e} is already a registered property.`);i.push(e),Object.defineProperty(this,e,xe(e,!0,A(n,e7e))),l(t)&&(this[e]=t),this._definitionChanged.raiseEvent(this)};yl.prototype.removeProperty=function(e){const n=this._propertyNames.indexOf(e);if(!l(e))throw new w("propertyName is required.");if(n===-1)throw new w(`${e} is not a registered property.`);this._propertyNames.splice(n,1),delete this[e],this._definitionChanged.raiseEvent(this)};yl.prototype.getValue=function(e,t){if(!l(e))throw new w("time is required.");l(t)||(t={});const n=this._propertyNames;for(let i=0,o=n.length;i<o;i++){const r=n[i];t[r]=ie.getValueOrUndefined(this[r],e,t[r])}return t};yl.prototype.merge=function(e,t){if(!l(e))throw new w("source is required.");const n=this._propertyNames,i=l(e._propertyNames)?e._propertyNames:Object.keys(e);for(let o=0,r=i.length;o<r;o++){const s=i[o],a=this[s],c=e[s];a===void 0&&n.indexOf(s)===-1&&this.addProperty(s,void 0,t),c!==void 0&&(a!==void 0?l(a)&&l(a.merge)&&a.merge(c):l(c)&&l(c.merge)&&l(c.clone)?this[s]=c.clone():this[s]=c)}};function t7e(e,t){const n=e._propertyNames,i=t._propertyNames,o=n.length;if(o!==i.length)return!1;for(let r=0;r<o;++r){const s=n[r];if(i.indexOf(s)===-1||!ie.equals(e[s],t[s]))return!1}return!0}yl.prototype.equals=function(e){return this===e||e instanceof yl&&t7e(this,e)};function ate(e){return new zE(e)}function n7e(e){return new yl(e,ate)}function i7e(e){return new yl(e)}function UE(e){this._definitionChanged=new lt,this._show=void 0,this._showSubscription=void 0,this._uri=void 0,this._uriSubscription=void 0,this._scale=void 0,this._scaleSubscription=void 0,this._minimumPixelSize=void 0,this._minimumPixelSizeSubscription=void 0,this._maximumScale=void 0,this._maximumScaleSubscription=void 0,this._incrementallyLoadTextures=void 0,this._incrementallyLoadTexturesSubscription=void 0,this._runAnimations=void 0,this._runAnimationsSubscription=void 0,this._clampAnimations=void 0,this._clampAnimationsSubscription=void 0,this._shadows=void 0,this._shadowsSubscription=void 0,this._heightReference=void 0,this._heightReferenceSubscription=void 0,this._silhouetteColor=void 0,this._silhouetteColorSubscription=void 0,this._silhouetteSize=void 0,this._silhouetteSizeSubscription=void 0,this._color=void 0,this._colorSubscription=void 0,this._colorBlendMode=void 0,this._colorBlendModeSubscription=void 0,this._colorBlendAmount=void 0,this._colorBlendAmountSubscription=void 0,this._imageBasedLightingFactor=void 0,this._imageBasedLightingFactorSubscription=void 0,this._lightColor=void 0,this._lightColorSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this._nodeTransformations=void 0,this._nodeTransformationsSubscription=void 0,this._articulations=void 0,this._articulationsSubscription=void 0,this._clippingPlanes=void 0,this._clippingPlanesSubscription=void 0,this._customShader=void 0,this._customShaderSubscription=void 0,this.merge(A(e,A.EMPTY_OBJECT))}Object.defineProperties(UE.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:xe("show"),uri:xe("uri"),scale:xe("scale"),minimumPixelSize:xe("minimumPixelSize"),maximumScale:xe("maximumScale"),incrementallyLoadTextures:xe("incrementallyLoadTextures"),runAnimations:xe("runAnimations"),clampAnimations:xe("clampAnimations"),shadows:xe("shadows"),heightReference:xe("heightReference"),silhouetteColor:xe("silhouetteColor"),silhouetteSize:xe("silhouetteSize"),color:xe("color"),colorBlendMode:xe("colorBlendMode"),colorBlendAmount:xe("colorBlendAmount"),imageBasedLightingFactor:xe("imageBasedLightingFactor"),lightColor:xe("lightColor"),distanceDisplayCondition:xe("distanceDisplayCondition"),nodeTransformations:xe("nodeTransformations",void 0,n7e),articulations:xe("articulations",void 0,i7e),clippingPlanes:xe("clippingPlanes"),customShader:xe("customShader")});UE.prototype.clone=function(e){return l(e)?(e.show=this.show,e.uri=this.uri,e.scale=this.scale,e.minimumPixelSize=this.minimumPixelSize,e.maximumScale=this.maximumScale,e.incrementallyLoadTextures=this.incrementallyLoadTextures,e.runAnimations=this.runAnimations,e.clampAnimations=this.clampAnimations,e.heightReference=this._heightReference,e.silhouetteColor=this.silhouetteColor,e.silhouetteSize=this.silhouetteSize,e.color=this.color,e.colorBlendMode=this.colorBlendMode,e.colorBlendAmount=this.colorBlendAmount,e.imageBasedLightingFactor=this.imageBasedLightingFactor,e.lightColor=this.lightColor,e.distanceDisplayCondition=this.distanceDisplayCondition,e.nodeTransformations=this.nodeTransformations,e.articulations=this.articulations,e.clippingPlanes=this.clippingPlanes,e.customShader=this.customShader,e):new UE(this)};UE.prototype.merge=function(e){if(!l(e))throw new w("source is required.");this.show=A(this.show,e.show),this.uri=A(this.uri,e.uri),this.scale=A(this.scale,e.scale),this.minimumPixelSize=A(this.minimumPixelSize,e.minimumPixelSize),this.maximumScale=A(this.maximumScale,e.maximumScale),this.incrementallyLoadTextures=A(this.incrementallyLoadTextures,e.incrementallyLoadTextures),this.runAnimations=A(this.runAnimations,e.runAnimations),this.clampAnimations=A(this.clampAnimations,e.clampAnimations),this.shadows=A(this.shadows,e.shadows),this.heightReference=A(this.heightReference,e.heightReference),this.silhouetteColor=A(this.silhouetteColor,e.silhouetteColor),this.silhouetteSize=A(this.silhouetteSize,e.silhouetteSize),this.color=A(this.color,e.color),this.colorBlendMode=A(this.colorBlendMode,e.colorBlendMode),this.colorBlendAmount=A(this.colorBlendAmount,e.colorBlendAmount),this.imageBasedLightingFactor=A(this.imageBasedLightingFactor,e.imageBasedLightingFactor),this.lightColor=A(this.lightColor,e.lightColor),this.distanceDisplayCondition=A(this.distanceDisplayCondition,e.distanceDisplayCondition),this.clippingPlanes=A(this.clippingPlanes,e.clippingPlanes),this.customShader=A(this.customShader,e.customShader);const t=e.nodeTransformations;if(l(t)){const i=this.nodeTransformations;l(i)?i.merge(t):this.nodeTransformations=new yl(t,ate)}const n=e.articulations;if(l(n)){const i=this.articulations;l(i)?i.merge(n):this.articulations=new yl(n)}};function HE(e){this._definitionChanged=new lt,this._show=void 0,this._showSubscription=void 0,this._uri=void 0,this._uriSubscription=void 0,this._maximumScreenSpaceError=void 0,this._maximumScreenSpaceErrorSubscription=void 0,this.merge(A(e,A.EMPTY_OBJECT))}Object.defineProperties(HE.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:xe("show"),uri:xe("uri"),maximumScreenSpaceError:xe("maximumScreenSpaceError")});HE.prototype.clone=function(e){return l(e)?(e.show=this.show,e.uri=this.uri,e.maximumScreenSpaceError=this.maximumScreenSpaceError,e):new HE(this)};HE.prototype.merge=function(e){if(!l(e))throw new w("source is required.");this.show=A(this.show,e.show),this.uri=A(this.uri,e.uri),this.maximumScreenSpaceError=A(this.maximumScreenSpaceError,e.maximumScreenSpaceError)};function sT(e){this._definitionChanged=new lt,this._show=void 0,this._showSubscription=void 0,this._leadTime=void 0,this._leadTimeSubscription=void 0,this._trailTime=void 0,this._trailTimeSubscription=void 0,this._width=void 0,this._widthSubscription=void 0,this._resolution=void 0,this._resolutionSubscription=void 0,this._material=void 0,this._materialSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this.merge(A(e,A.EMPTY_OBJECT))}Object.defineProperties(sT.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:xe("show"),leadTime:xe("leadTime"),trailTime:xe("trailTime"),width:xe("width"),resolution:xe("resolution"),material:gl("material"),distanceDisplayCondition:xe("distanceDisplayCondition")});sT.prototype.clone=function(e){return l(e)?(e.show=this.show,e.leadTime=this.leadTime,e.trailTime=this.trailTime,e.width=this.width,e.resolution=this.resolution,e.material=this.material,e.distanceDisplayCondition=this.distanceDisplayCondition,e):new sT(this)};sT.prototype.merge=function(e){if(!l(e))throw new w("source is required.");this.show=A(this.show,e.show),this.leadTime=A(this.leadTime,e.leadTime),this.trailTime=A(this.trailTime,e.trailTime),this.width=A(this.width,e.width),this.resolution=A(this.resolution,e.resolution),this.material=A(this.material,e.material),this.distanceDisplayCondition=A(this.distanceDisplayCondition,e.distanceDisplayCondition)};function VE(e){this._definitionChanged=new lt,this._show=void 0,this._showSubscription=void 0,this._plane=void 0,this._planeSubscription=void 0,this._dimensions=void 0,this._dimensionsSubscription=void 0,this._fill=void 0,this._fillSubscription=void 0,this._material=void 0,this._materialSubscription=void 0,this._outline=void 0,this._outlineSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this._shadows=void 0,this._shadowsSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this.merge(A(e,A.EMPTY_OBJECT))}Object.defineProperties(VE.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:xe("show"),plane:xe("plane"),dimensions:xe("dimensions"),fill:xe("fill"),material:gl("material"),outline:xe("outline"),outlineColor:xe("outlineColor"),outlineWidth:xe("outlineWidth"),shadows:xe("shadows"),distanceDisplayCondition:xe("distanceDisplayCondition")});VE.prototype.clone=function(e){return l(e)?(e.show=this.show,e.plane=this.plane,e.dimensions=this.dimensions,e.fill=this.fill,e.material=this.material,e.outline=this.outline,e.outlineColor=this.outlineColor,e.outlineWidth=this.outlineWidth,e.shadows=this.shadows,e.distanceDisplayCondition=this.distanceDisplayCondition,e):new VE(this)};VE.prototype.merge=function(e){if(!l(e))throw new w("source is required.");this.show=A(this.show,e.show),this.plane=A(this.plane,e.plane),this.dimensions=A(this.dimensions,e.dimensions),this.fill=A(this.fill,e.fill),this.material=A(this.material,e.material),this.outline=A(this.outline,e.outline),this.outlineColor=A(this.outlineColor,e.outlineColor),this.outlineWidth=A(this.outlineWidth,e.outlineWidth),this.shadows=A(this.shadows,e.shadows),this.distanceDisplayCondition=A(this.distanceDisplayCondition,e.distanceDisplayCondition)};function kE(e){this._definitionChanged=new lt,this._show=void 0,this._showSubscription=void 0,this._pixelSize=void 0,this._pixelSizeSubscription=void 0,this._heightReference=void 0,this._heightReferenceSubscription=void 0,this._color=void 0,this._colorSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this._scaleByDistance=void 0,this._scaleByDistanceSubscription=void 0,this._translucencyByDistance=void 0,this._translucencyByDistanceSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this._disableDepthTestDistance=void 0,this._disableDepthTestDistanceSubscription=void 0,this.merge(A(e,A.EMPTY_OBJECT))}Object.defineProperties(kE.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:xe("show"),pixelSize:xe("pixelSize"),heightReference:xe("heightReference"),color:xe("color"),outlineColor:xe("outlineColor"),outlineWidth:xe("outlineWidth"),scaleByDistance:xe("scaleByDistance"),translucencyByDistance:xe("translucencyByDistance"),distanceDisplayCondition:xe("distanceDisplayCondition"),disableDepthTestDistance:xe("disableDepthTestDistance")});kE.prototype.clone=function(e){return l(e)?(e.show=this.show,e.pixelSize=this.pixelSize,e.heightReference=this.heightReference,e.color=this.color,e.outlineColor=this.outlineColor,e.outlineWidth=this.outlineWidth,e.scaleByDistance=this.scaleByDistance,e.translucencyByDistance=this._translucencyByDistance,e.distanceDisplayCondition=this.distanceDisplayCondition,e.disableDepthTestDistance=this.disableDepthTestDistance,e):new kE(this)};kE.prototype.merge=function(e){if(!l(e))throw new w("source is required.");this.show=A(this.show,e.show),this.pixelSize=A(this.pixelSize,e.pixelSize),this.heightReference=A(this.heightReference,e.heightReference),this.color=A(this.color,e.color),this.outlineColor=A(this.outlineColor,e.outlineColor),this.outlineWidth=A(this.outlineWidth,e.outlineWidth),this.scaleByDistance=A(this.scaleByDistance,e.scaleByDistance),this.translucencyByDistance=A(this._translucencyByDistance,e.translucencyByDistance),this.distanceDisplayCondition=A(this.distanceDisplayCondition,e.distanceDisplayCondition),this.disableDepthTestDistance=A(this.disableDepthTestDistance,e.disableDepthTestDistance)};function o7e(e,t){this.positions=l(e)?e:[],this.holes=l(t)?t:[]}function r7e(e){return Array.isArray(e)&&(e=new o7e(e)),new Cr(e)}function GE(e){this._definitionChanged=new lt,this._show=void 0,this._showSubscription=void 0,this._hierarchy=void 0,this._hierarchySubscription=void 0,this._height=void 0,this._heightSubscription=void 0,this._heightReference=void 0,this._heightReferenceSubscription=void 0,this._extrudedHeight=void 0,this._extrudedHeightSubscription=void 0,this._extrudedHeightReference=void 0,this._extrudedHeightReferenceSubscription=void 0,this._stRotation=void 0,this._stRotationSubscription=void 0,this._granularity=void 0,this._granularitySubscription=void 0,this._fill=void 0,this._fillSubscription=void 0,this._material=void 0,this._materialSubscription=void 0,this._outline=void 0,this._outlineSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this._perPositionHeight=void 0,this._perPositionHeightSubscription=void 0,this._closeTop=void 0,this._closeTopSubscription=void 0,this._closeBottom=void 0,this._closeBottomSubscription=void 0,this._arcType=void 0,this._arcTypeSubscription=void 0,this._shadows=void 0,this._shadowsSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this._classificationType=void 0,this._classificationTypeSubscription=void 0,this._zIndex=void 0,this._zIndexSubscription=void 0,this._textureCoordinates=void 0,this._textureCoordinatesSubscription=void 0,this.merge(A(e,A.EMPTY_OBJECT))}Object.defineProperties(GE.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:xe("show"),hierarchy:xe("hierarchy",void 0,r7e),height:xe("height"),heightReference:xe("heightReference"),extrudedHeight:xe("extrudedHeight"),extrudedHeightReference:xe("extrudedHeightReference"),stRotation:xe("stRotation"),granularity:xe("granularity"),fill:xe("fill"),material:gl("material"),outline:xe("outline"),outlineColor:xe("outlineColor"),outlineWidth:xe("outlineWidth"),perPositionHeight:xe("perPositionHeight"),closeTop:xe("closeTop"),closeBottom:xe("closeBottom"),arcType:xe("arcType"),shadows:xe("shadows"),distanceDisplayCondition:xe("distanceDisplayCondition"),classificationType:xe("classificationType"),zIndex:xe("zIndex"),textureCoordinates:xe("textureCoordinates")});GE.prototype.clone=function(e){return l(e)?(e.show=this.show,e.hierarchy=this.hierarchy,e.height=this.height,e.heightReference=this.heightReference,e.extrudedHeight=this.extrudedHeight,e.extrudedHeightReference=this.extrudedHeightReference,e.stRotation=this.stRotation,e.granularity=this.granularity,e.fill=this.fill,e.material=this.material,e.outline=this.outline,e.outlineColor=this.outlineColor,e.outlineWidth=this.outlineWidth,e.perPositionHeight=this.perPositionHeight,e.closeTop=this.closeTop,e.closeBottom=this.closeBottom,e.arcType=this.arcType,e.shadows=this.shadows,e.distanceDisplayCondition=this.distanceDisplayCondition,e.classificationType=this.classificationType,e.zIndex=this.zIndex,e.textureCoordinates=this.textureCoordinates,e):new GE(this)};GE.prototype.merge=function(e){if(!l(e))throw new w("source is required.");this.show=A(this.show,e.show),this.hierarchy=A(this.hierarchy,e.hierarchy),this.height=A(this.height,e.height),this.heightReference=A(this.heightReference,e.heightReference),this.extrudedHeight=A(this.extrudedHeight,e.extrudedHeight),this.extrudedHeightReference=A(this.extrudedHeightReference,e.extrudedHeightReference),this.stRotation=A(this.stRotation,e.stRotation),this.granularity=A(this.granularity,e.granularity),this.fill=A(this.fill,e.fill),this.material=A(this.material,e.material),this.outline=A(this.outline,e.outline),this.outlineColor=A(this.outlineColor,e.outlineColor),this.outlineWidth=A(this.outlineWidth,e.outlineWidth),this.perPositionHeight=A(this.perPositionHeight,e.perPositionHeight),this.closeTop=A(this.closeTop,e.closeTop),this.closeBottom=A(this.closeBottom,e.closeBottom),this.arcType=A(this.arcType,e.arcType),this.shadows=A(this.shadows,e.shadows),this.distanceDisplayCondition=A(this.distanceDisplayCondition,e.distanceDisplayCondition),this.classificationType=A(this.classificationType,e.classificationType),this.zIndex=A(this.zIndex,e.zIndex),this.textureCoordinates=A(this.textureCoordinates,e.textureCoordinates)};function WE(e){this._definitionChanged=new lt,this._show=void 0,this._showSubscription=void 0,this._positions=void 0,this._positionsSubscription=void 0,this._width=void 0,this._widthSubscription=void 0,this._granularity=void 0,this._granularitySubscription=void 0,this._material=void 0,this._materialSubscription=void 0,this._depthFailMaterial=void 0,this._depthFailMaterialSubscription=void 0,this._arcType=void 0,this._arcTypeSubscription=void 0,this._clampToGround=void 0,this._clampToGroundSubscription=void 0,this._shadows=void 0,this._shadowsSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this._classificationType=void 0,this._classificationTypeSubscription=void 0,this._zIndex=void 0,this._zIndexSubscription=void 0,this.merge(A(e,A.EMPTY_OBJECT))}Object.defineProperties(WE.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:xe("show"),positions:xe("positions"),width:xe("width"),granularity:xe("granularity"),material:gl("material"),depthFailMaterial:gl("depthFailMaterial"),arcType:xe("arcType"),clampToGround:xe("clampToGround"),shadows:xe("shadows"),distanceDisplayCondition:xe("distanceDisplayCondition"),classificationType:xe("classificationType"),zIndex:xe("zIndex")});WE.prototype.clone=function(e){return l(e)?(e.show=this.show,e.positions=this.positions,e.width=this.width,e.granularity=this.granularity,e.material=this.material,e.depthFailMaterial=this.depthFailMaterial,e.arcType=this.arcType,e.clampToGround=this.clampToGround,e.shadows=this.shadows,e.distanceDisplayCondition=this.distanceDisplayCondition,e.classificationType=this.classificationType,e.zIndex=this.zIndex,e):new WE(this)};WE.prototype.merge=function(e){if(!l(e))throw new w("source is required.");this.show=A(this.show,e.show),this.positions=A(this.positions,e.positions),this.width=A(this.width,e.width),this.granularity=A(this.granularity,e.granularity),this.material=A(this.material,e.material),this.depthFailMaterial=A(this.depthFailMaterial,e.depthFailMaterial),this.arcType=A(this.arcType,e.arcType),this.clampToGround=A(this.clampToGround,e.clampToGround),this.shadows=A(this.shadows,e.shadows),this.distanceDisplayCondition=A(this.distanceDisplayCondition,e.distanceDisplayCondition),this.classificationType=A(this.classificationType,e.classificationType),this.zIndex=A(this.zIndex,e.zIndex)};function qE(e){this._definitionChanged=new lt,this._show=void 0,this._showSubscription=void 0,this._positions=void 0,this._positionsSubscription=void 0,this._shape=void 0,this._shapeSubscription=void 0,this._cornerType=void 0,this._cornerTypeSubscription=void 0,this._granularity=void 0,this._granularitySubscription=void 0,this._fill=void 0,this._fillSubscription=void 0,this._material=void 0,this._materialSubscription=void 0,this._outline=void 0,this._outlineSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this._shadows=void 0,this._shadowsSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubsription=void 0,this.merge(A(e,A.EMPTY_OBJECT))}Object.defineProperties(qE.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:xe("show"),positions:xe("positions"),shape:xe("shape"),cornerType:xe("cornerType"),granularity:xe("granularity"),fill:xe("fill"),material:gl("material"),outline:xe("outline"),outlineColor:xe("outlineColor"),outlineWidth:xe("outlineWidth"),shadows:xe("shadows"),distanceDisplayCondition:xe("distanceDisplayCondition")});qE.prototype.clone=function(e){return l(e)?(e.show=this.show,e.positions=this.positions,e.shape=this.shape,e.cornerType=this.cornerType,e.granularity=this.granularity,e.fill=this.fill,e.material=this.material,e.outline=this.outline,e.outlineColor=this.outlineColor,e.outlineWidth=this.outlineWidth,e.shadows=this.shadows,e.distanceDisplayCondition=this.distanceDisplayCondition,e):new qE(this)};qE.prototype.merge=function(e){if(!l(e))throw new w("source is required.");this.show=A(this.show,e.show),this.positions=A(this.positions,e.positions),this.shape=A(this.shape,e.shape),this.cornerType=A(this.cornerType,e.cornerType),this.granularity=A(this.granularity,e.granularity),this.fill=A(this.fill,e.fill),this.material=A(this.material,e.material),this.outline=A(this.outline,e.outline),this.outlineColor=A(this.outlineColor,e.outlineColor),this.outlineWidth=A(this.outlineWidth,e.outlineWidth),this.shadows=A(this.shadows,e.shadows),this.distanceDisplayCondition=A(this.distanceDisplayCondition,e.distanceDisplayCondition)};function jE(e){this._definitionChanged=new lt,this._show=void 0,this._showSubscription=void 0,this._coordinates=void 0,this._coordinatesSubscription=void 0,this._height=void 0,this._heightSubscription=void 0,this._heightReference=void 0,this._heightReferenceSubscription=void 0,this._extrudedHeight=void 0,this._extrudedHeightSubscription=void 0,this._extrudedHeightReference=void 0,this._extrudedHeightReferenceSubscription=void 0,this._rotation=void 0,this._rotationSubscription=void 0,this._stRotation=void 0,this._stRotationSubscription=void 0,this._granularity=void 0,this._granularitySubscription=void 0,this._fill=void 0,this._fillSubscription=void 0,this._material=void 0,this._materialSubscription=void 0,this._outline=void 0,this._outlineSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this._shadows=void 0,this._shadowsSubscription=void 0,this._distanceDisplayCondition=void 0,this._distancedisplayConditionSubscription=void 0,this._classificationType=void 0,this._classificationTypeSubscription=void 0,this._zIndex=void 0,this._zIndexSubscription=void 0,this.merge(A(e,A.EMPTY_OBJECT))}Object.defineProperties(jE.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:xe("show"),coordinates:xe("coordinates"),height:xe("height"),heightReference:xe("heightReference"),extrudedHeight:xe("extrudedHeight"),extrudedHeightReference:xe("extrudedHeightReference"),rotation:xe("rotation"),stRotation:xe("stRotation"),granularity:xe("granularity"),fill:xe("fill"),material:gl("material"),outline:xe("outline"),outlineColor:xe("outlineColor"),outlineWidth:xe("outlineWidth"),shadows:xe("shadows"),distanceDisplayCondition:xe("distanceDisplayCondition"),classificationType:xe("classificationType"),zIndex:xe("zIndex")});jE.prototype.clone=function(e){return l(e)?(e.show=this.show,e.coordinates=this.coordinates,e.height=this.height,e.heightReference=this.heightReference,e.extrudedHeight=this.extrudedHeight,e.extrudedHeightReference=this.extrudedHeightReference,e.rotation=this.rotation,e.stRotation=this.stRotation,e.granularity=this.granularity,e.fill=this.fill,e.material=this.material,e.outline=this.outline,e.outlineColor=this.outlineColor,e.outlineWidth=this.outlineWidth,e.shadows=this.shadows,e.distanceDisplayCondition=this.distanceDisplayCondition,e.classificationType=this.classificationType,e.zIndex=this.zIndex,e):new jE(this)};jE.prototype.merge=function(e){if(!l(e))throw new w("source is required.");this.show=A(this.show,e.show),this.coordinates=A(this.coordinates,e.coordinates),this.height=A(this.height,e.height),this.heightReference=A(this.heightReference,e.heightReference),this.extrudedHeight=A(this.extrudedHeight,e.extrudedHeight),this.extrudedHeightReference=A(this.extrudedHeightReference,e.extrudedHeightReference),this.rotation=A(this.rotation,e.rotation),this.stRotation=A(this.stRotation,e.stRotation),this.granularity=A(this.granularity,e.granularity),this.fill=A(this.fill,e.fill),this.material=A(this.material,e.material),this.outline=A(this.outline,e.outline),this.outlineColor=A(this.outlineColor,e.outlineColor),this.outlineWidth=A(this.outlineWidth,e.outlineWidth),this.shadows=A(this.shadows,e.shadows),this.distanceDisplayCondition=A(this.distanceDisplayCondition,e.distanceDisplayCondition),this.classificationType=A(this.classificationType,e.classificationType),this.zIndex=A(this.zIndex,e.zIndex)};function YE(e){this._definitionChanged=new lt,this._show=void 0,this._showSubscription=void 0,this._positions=void 0,this._positionsSubscription=void 0,this._minimumHeights=void 0,this._minimumHeightsSubscription=void 0,this._maximumHeights=void 0,this._maximumHeightsSubscription=void 0,this._granularity=void 0,this._granularitySubscription=void 0,this._fill=void 0,this._fillSubscription=void 0,this._material=void 0,this._materialSubscription=void 0,this._outline=void 0,this._outlineSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this._shadows=void 0,this._shadowsSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this.merge(A(e,A.EMPTY_OBJECT))}Object.defineProperties(YE.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:xe("show"),positions:xe("positions"),minimumHeights:xe("minimumHeights"),maximumHeights:xe("maximumHeights"),granularity:xe("granularity"),fill:xe("fill"),material:gl("material"),outline:xe("outline"),outlineColor:xe("outlineColor"),outlineWidth:xe("outlineWidth"),shadows:xe("shadows"),distanceDisplayCondition:xe("distanceDisplayCondition")});YE.prototype.clone=function(e){return l(e)?(e.show=this.show,e.positions=this.positions,e.minimumHeights=this.minimumHeights,e.maximumHeights=this.maximumHeights,e.granularity=this.granularity,e.fill=this.fill,e.material=this.material,e.outline=this.outline,e.outlineColor=this.outlineColor,e.outlineWidth=this.outlineWidth,e.shadows=this.shadows,e.distanceDisplayCondition=this.distanceDisplayCondition,e):new YE(this)};YE.prototype.merge=function(e){if(!l(e))throw new w("source is required.");this.show=A(this.show,e.show),this.positions=A(this.positions,e.positions),this.minimumHeights=A(this.minimumHeights,e.minimumHeights),this.maximumHeights=A(this.maximumHeights,e.maximumHeights),this.granularity=A(this.granularity,e.granularity),this.fill=A(this.fill,e.fill),this.material=A(this.material,e.material),this.outline=A(this.outline,e.outline),this.outlineColor=A(this.outlineColor,e.outlineColor),this.outlineWidth=A(this.outlineWidth,e.outlineWidth),this.shadows=A(this.shadows,e.shadows),this.distanceDisplayCondition=A(this.distanceDisplayCondition,e.distanceDisplayCondition)};const s7e=new ve;function a7e(e){return new ep(e)}function c7e(e){return xe(e,void 0,a7e)}function Ns(e,t){return xe(e,void 0,function(n){return n instanceof t?n:new t(n)})}function hs(e){e=A(e,A.EMPTY_OBJECT);let t=e.id;l(t)||(t=ma()),this._availability=void 0,this._id=t,this._definitionChanged=new lt,this._name=e.name,this._show=A(e.show,!0),this._parent=void 0,this._propertyNames=["billboard","box","corridor","cylinder","description","ellipse","ellipsoid","label","model","tileset","orientation","path","plane","point","polygon","polyline","polylineVolume","position","properties","rectangle","viewFrom","wall"],this._billboard=void 0,this._billboardSubscription=void 0,this._box=void 0,this._boxSubscription=void 0,this._corridor=void 0,this._corridorSubscription=void 0,this._cylinder=void 0,this._cylinderSubscription=void 0,this._description=void 0,this._descriptionSubscription=void 0,this._ellipse=void 0,this._ellipseSubscription=void 0,this._ellipsoid=void 0,this._ellipsoidSubscription=void 0,this._label=void 0,this._labelSubscription=void 0,this._model=void 0,this._modelSubscription=void 0,this._tileset=void 0,this._tilesetSubscription=void 0,this._orientation=void 0,this._orientationSubscription=void 0,this._path=void 0,this._pathSubscription=void 0,this._plane=void 0,this._planeSubscription=void 0,this._point=void 0,this._pointSubscription=void 0,this._polygon=void 0,this._polygonSubscription=void 0,this._polyline=void 0,this._polylineSubscription=void 0,this._polylineVolume=void 0,this._polylineVolumeSubscription=void 0,this._position=void 0,this._positionSubscription=void 0,this._properties=void 0,this._propertiesSubscription=void 0,this._rectangle=void 0,this._rectangleSubscription=void 0,this._viewFrom=void 0,this._viewFromSubscription=void 0,this._wall=void 0,this._wallSubscription=void 0,this._children=[],this.entityCollection=void 0,this.parent=e.parent,this.merge(e)}function GF(e,t,n){const i=t.length;for(let o=0;o<i;o++){const r=t[o],s=r._show;(!n&&s)!==(n&&s)&&GF(r,r._children,n)}e._definitionChanged.raiseEvent(e,"isShowing",n,!n)}Object.defineProperties(hs.prototype,{availability:kF("availability"),id:{get:function(){return this._id}},definitionChanged:{get:function(){return this._definitionChanged}},name:kF("name"),show:{get:function(){return this._show},set:function(e){if(!l(e))throw new w("value is required.");if(e===this._show)return;const t=this.isShowing;this._show=e;const n=this.isShowing;t!==n&&GF(this,this._children,n),this._definitionChanged.raiseEvent(this,"show",e,!e)}},isShowing:{get:function(){return this._show&&(!l(this.entityCollection)||this.entityCollection.show)&&(!l(this._parent)||this._parent.isShowing)}},parent:{get:function(){return this._parent},set:function(e){const t=this._parent;if(t===e)return;const n=this.isShowing;if(l(t)){const o=t._children.indexOf(this);t._children.splice(o,1)}this._parent=e,l(e)&&e._children.push(this);const i=this.isShowing;n!==i&&GF(this,this._children,i),this._definitionChanged.raiseEvent(this,"parent",e,t)}},propertyNames:{get:function(){return this._propertyNames}},billboard:Ns("billboard",OE),box:Ns("box",LE),corridor:Ns("corridor",BE),cylinder:Ns("cylinder",RE),description:xe("description"),ellipse:Ns("ellipse",NE),ellipsoid:Ns("ellipsoid",ME),label:Ns("label",FE),model:Ns("model",UE),tileset:Ns("tileset",HE),orientation:xe("orientation"),path:Ns("path",sT),plane:Ns("plane",VE),point:Ns("point",kE),polygon:Ns("polygon",GE),polyline:Ns("polyline",WE),polylineVolume:Ns("polylineVolume",qE),properties:Ns("properties",yl),position:c7e("position"),rectangle:Ns("rectangle",jE),viewFrom:xe("viewFrom"),wall:Ns("wall",YE)});hs.prototype.isAvailable=function(e){if(!l(e))throw new w("time is required.");const t=this._availability;return!l(t)||t.contains(e)};hs.prototype.addProperty=function(e){const t=this._propertyNames;if(!l(e))throw new w("propertyName is required.");if(t.indexOf(e)!==-1)throw new w(`${e} is already a registered property.`);if(e in this)throw new w(`${e} is a reserved property name.`);t.push(e),Object.defineProperty(this,e,kF(e,!0))};hs.prototype.removeProperty=function(e){const n=this._propertyNames.indexOf(e);if(!l(e))throw new w("propertyName is required.");if(n===-1)throw new w(`${e} is not a registered property.`);this._propertyNames.splice(n,1),delete this[e]};hs.prototype.merge=function(e){if(!l(e))throw new w("source is required.");this.name=A(this.name,e.name),this.availability=A(this.availability,e.availability);const t=this._propertyNames,n=l(e._propertyNames)?e._propertyNames:Object.keys(e),i=n.length;for(let o=0;o<i;o++){const r=n[o];if(r==="parent"||r==="name"||r==="availability")continue;const s=this[r],a=e[r];!l(s)&&t.indexOf(r)===-1&&this.addProperty(r),l(a)&&(l(s)?l(s.merge)&&s.merge(a):l(a.merge)&&l(a.clone)?this[r]=a.clone():this[r]=a)}};const cte=new te,lte=new d,ute=new De;hs.prototype.computeModelMatrix=function(e,t){E.typeOf.object("time",e);const n=ie.getValueOrUndefined(this._position,e,lte);if(!l(n))return;const i=ie.getValueOrUndefined(this._orientation,e,ute);return l(i)?t=N.fromRotationTranslation(te.fromQuaternion(i,cte),n,t):t=En.eastNorthUpToFixedFrame(n,void 0,t),t};hs.prototype.computeModelMatrixForHeightReference=function(e,t,n,i,o){E.typeOf.object("time",e);const r=ie.getValueOrDefault(t,e,Ht.NONE);let s=ie.getValueOrUndefined(this._position,e,lte);if(r===Ht.NONE||!l(s)||d.equalsEpsilon(s,d.ZERO,F.EPSILON8))return this.computeModelMatrix(e,o);const a=i.cartesianToCartographic(s,s7e);r===Ht.CLAMP_TO_GROUND?a.height=n:a.height+=n,s=i.cartographicToCartesian(a,s);const c=ie.getValueOrUndefined(this._orientation,e,ute);return l(c)?o=N.fromRotationTranslation(te.fromQuaternion(c,cte),s,o):o=En.eastNorthUpToFixedFrame(s,void 0,o),o};hs.supportsMaterialsforEntitiesOnTerrain=function(e){return vs.supportsMaterials(e)};hs.supportsPolylinesOnTerrain=function(e){return gu.isSupported(e)};const l7e=new An(k.WHITE),u7e=new Cr(!0),f7e=new Cr(!0),d7e=new Cr(!1),h7e=new Cr(k.BLACK),p7e=new Cr(sr.DISABLED),m7e=new Cr(new sn),_7e=new Cr(ir.BOTH);function li(e){E.defined("options.entity",e.entity),E.defined("options.scene",e.scene),E.defined("options.geometryOptions",e.geometryOptions),E.defined("options.geometryPropertyName",e.geometryPropertyName),E.defined("options.observedPropertyNames",e.observedPropertyNames);const t=e.entity,n=e.geometryPropertyName;this._entity=t,this._scene=e.scene,this._fillEnabled=!1,this._isClosed=!1,this._onTerrain=!1,this._dynamic=!1,this._outlineEnabled=!1,this._geometryChanged=new lt,this._showProperty=void 0,this._materialProperty=void 0,this._showOutlineProperty=void 0,this._outlineColorProperty=void 0,this._outlineWidth=1,this._shadowsProperty=void 0,this._distanceDisplayConditionProperty=void 0,this._classificationTypeProperty=void 0,this._options=e.geometryOptions,this._geometryPropertyName=n,this._id=`${n}-${t.id}`,this._observedPropertyNames=e.observedPropertyNames,this._supportsMaterialsforEntitiesOnTerrain=hs.supportsMaterialsforEntitiesOnTerrain(e.scene)}Object.defineProperties(li.prototype,{id:{get:function(){return this._id}},entity:{get:function(){return this._entity}},fillEnabled:{get:function(){return this._fillEnabled}},hasConstantFill:{get:function(){return!this._fillEnabled||!l(this._entity.availability)&&ie.isConstant(this._showProperty)&&ie.isConstant(this._fillProperty)}},fillMaterialProperty:{get:function(){return this._materialProperty}},outlineEnabled:{get:function(){return this._outlineEnabled}},hasConstantOutline:{get:function(){return!this._outlineEnabled||!l(this._entity.availability)&&ie.isConstant(this._showProperty)&&ie.isConstant(this._showOutlineProperty)}},outlineColorProperty:{get:function(){return this._outlineColorProperty}},outlineWidth:{get:function(){return this._outlineWidth}},shadowsProperty:{get:function(){return this._shadowsProperty}},distanceDisplayConditionProperty:{get:function(){return this._distanceDisplayConditionProperty}},classificationTypeProperty:{get:function(){return this._classificationTypeProperty}},isDynamic:{get:function(){return this._dynamic}},isClosed:{get:function(){return this._isClosed}},onTerrain:{get:function(){return this._onTerrain}},geometryChanged:{get:function(){return this._geometryChanged}}});li.prototype.isOutlineVisible=function(e){const t=this._entity,n=this._outlineEnabled&&t.isAvailable(e)&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e);return A(n,!1)};li.prototype.isFilled=function(e){const t=this._entity,n=this._fillEnabled&&t.isAvailable(e)&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e);return A(n,!1)};li.prototype.createFillGeometryInstance=w.throwInstantiationError;li.prototype.createOutlineGeometryInstance=w.throwInstantiationError;li.prototype.isDestroyed=function(){return!1};li.prototype.destroy=function(){Je(this)};li.prototype._isHidden=function(e,t){const n=t.show;return l(n)&&n.isConstant&&!n.getValue(wt.MINIMUM_VALUE)};li.prototype._isOnTerrain=function(e,t){return!1};li.prototype._getIsClosed=function(e){return!0};li.prototype._isDynamic=w.throwInstantiationError;li.prototype._setStaticOptions=w.throwInstantiationError;li.prototype._onEntityPropertyChanged=function(e,t,n,i){if(this._observedPropertyNames.indexOf(t)===-1)return;const o=this._entity[this._geometryPropertyName];if(!l(o)){(this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this));return}const r=o.fill,s=l(r)&&r.isConstant?r.getValue(wt.MINIMUM_VALUE):!0,a=o.outline;let c=l(a);if(c&&a.isConstant&&(c=a.getValue(wt.MINIMUM_VALUE)),!s&&!c){(this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this));return}const u=o.show;if(this._isHidden(e,o)){(this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this));return}this._materialProperty=A(o.material,l7e),this._fillProperty=A(r,f7e),this._showProperty=A(u,u7e),this._showOutlineProperty=A(o.outline,d7e),this._outlineColorProperty=c?A(o.outlineColor,h7e):void 0,this._shadowsProperty=A(o.shadows,p7e),this._distanceDisplayConditionProperty=A(o.distanceDisplayCondition,m7e),this._classificationTypeProperty=A(o.classificationType,_7e),this._fillEnabled=s;const f=this._isOnTerrain(e,o)&&(this._supportsMaterialsforEntitiesOnTerrain||this._materialProperty instanceof An);if(c&&f&&(uo(uo.geometryOutlines),c=!1),this._onTerrain=f,this._outlineEnabled=c,this._isDynamic(e,o))this._dynamic||(this._dynamic=!0,this._geometryChanged.raiseEvent(this));else{this._setStaticOptions(e,o),this._isClosed=this._getIsClosed(this._options);const h=o.outlineWidth;this._outlineWidth=l(h)?h.getValue(wt.MINIMUM_VALUE):1,this._dynamic=!1,this._geometryChanged.raiseEvent(this)}};li.prototype.createDynamicUpdater=function(e,t){if(E.defined("primitives",e),E.defined("groundPrimitives",t),!this._dynamic)throw new w("This instance does not represent dynamic geometry.");return new this.constructor.DynamicGeometryUpdater(this,e,t)};function cy(e,t){this._callback=void 0,this._isConstant=void 0,this._definitionChanged=new lt,this.setCallback(e,t)}Object.defineProperties(cy.prototype,{isConstant:{get:function(){return this._isConstant}},definitionChanged:{get:function(){return this._definitionChanged}}});cy.prototype.getValue=function(e,t){return this._callback(e,t)};cy.prototype.setCallback=function(e,t){if(!l(e))throw new w("callback is required.");if(!l(t))throw new w("isConstant is required.");const n=this._callback!==e||this._isConstant!==t;this._callback=e,this._isConstant=t,n&&this._definitionChanged.raiseEvent(this)};cy.prototype.equals=function(e){return this===e||e instanceof cy&&this._callback===e._callback&&this._isConstant===e._isConstant};const fte=new d,g7e=new ve;function ky(e,t,n,i){E.defined("scene",e),E.defined("positionProperty",t),this._scene=e,this._heightReference=n,this._extrudedHeightReference=i,this._positionProperty=t,this._position=new d,this._cartographicPosition=new ve,this._normal=new d,this._definitionChanged=new lt,this._terrainHeight=0,this._removeCallbackFunc=void 0,this._removeEventListener=void 0,this._removeModeListener=void 0;const o=this;if(l(e.globe)&&(this._removeEventListener=e.terrainProviderChanged.addEventListener(function(){o._updateClamping()}),this._removeModeListener=e.morphComplete.addEventListener(function(){o._updateClamping()})),t.isConstant){const r=t.getValue(wt.MINIMUM_VALUE,fte);if(!l(r)||d.equals(r,d.ZERO)||!l(e.globe))return;this._position=d.clone(r,this._position),this._updateClamping(),this._normal=e.globe.ellipsoid.geodeticSurfaceNormal(r,this._normal)}}Object.defineProperties(ky.prototype,{isConstant:{get:function(){return!1}},definitionChanged:{get:function(){return this._definitionChanged}}});ky.prototype._updateClamping=function(){l(this._removeCallbackFunc)&&this._removeCallbackFunc();const e=this._scene,t=e.globe,n=this._position;if(!l(t)||d.equals(n,d.ZERO)){this._terrainHeight=0;return}const i=t.ellipsoid,o=t._surface,r=this,s=i.cartesianToCartographic(n,this._cartographicPosition),a=t.getHeight(s);l(a)?this._terrainHeight=a:this._terrainHeight=0;function c(u){if(e.mode===me.SCENE3D){const f=i.cartesianToCartographic(u,g7e);r._terrainHeight=f.height}else r._terrainHeight=u.x;r.definitionChanged.raiseEvent()}this._removeCallbackFunc=o.updateHeight(s,c)};ky.prototype.getValue=function(e,t){const n=ie.getValueOrDefault(this._heightReference,e,Ht.NONE),i=ie.getValueOrDefault(this._extrudedHeightReference,e,Ht.NONE);if(n===Ht.NONE&&i!==Ht.RELATIVE_TO_GROUND)return this._position=d.clone(d.ZERO,this._position),d.clone(d.ZERO,t);if(this._positionProperty.isConstant)return d.multiplyByScalar(this._normal,this._terrainHeight,t);const o=this._scene,r=this._positionProperty.getValue(e,fte);if(!l(r)||d.equals(r,d.ZERO)||!l(o.globe))return d.clone(d.ZERO,t);if(d.equalsEpsilon(this._position,r,F.EPSILON10))return d.multiplyByScalar(this._normal,this._terrainHeight,t);this._position=d.clone(r,this._position),this._updateClamping();const s=o.globe.ellipsoid.geodeticSurfaceNormal(r,this._normal);return d.multiplyByScalar(s,this._terrainHeight,t)};ky.prototype.isDestroyed=function(){return!1};ky.prototype.destroy=function(){return l(this._removeEventListener)&&this._removeEventListener(),l(this._removeModeListener)&&this._removeModeListener(),l(this._removeCallbackFunc)&&this._removeCallbackFunc(),Je(this)};function iU(e,t,n,i){if(li.prototype._onEntityPropertyChanged.call(this,e,t,n,i),this._observedPropertyNames.indexOf(t)===-1)return;const o=this._entity[this._geometryPropertyName];if(!l(o))return;l(this._terrainOffsetProperty)&&(this._terrainOffsetProperty.destroy(),this._terrainOffsetProperty=void 0);const r=o.heightReference;if(l(r)){const s=new cy(this._computeCenter.bind(this),!this._dynamic);this._terrainOffsetProperty=new ky(this._scene,s,r)}}const dte=d.ZERO,hte=new d,y7e=new d,pte=new k;function A7e(e){this.id=e,this.vertexFormat=void 0,this.dimensions=void 0,this.offsetAttribute=void 0}function ll(e,t){li.call(this,{entity:e,scene:t,geometryOptions:new A7e(e),geometryPropertyName:"box",observedPropertyNames:["availability","position","orientation","box"]}),this._onEntityPropertyChanged(e,"box",e.box,void 0)}l(Object.create)&&(ll.prototype=Object.create(li.prototype),ll.prototype.constructor=ll);Object.defineProperties(ll.prototype,{terrainOffsetProperty:{get:function(){return this._terrainOffsetProperty}}});ll.prototype.createFillGeometryInstance=function(e){if(E.defined("time",e),!this._fillEnabled)throw new w("This instance does not represent a filled geometry.");const t=this._entity,n=t.isAvailable(e),i=new pi(n&&t.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),o=this._distanceDisplayConditionProperty.getValue(e),r=Yi.fromDistanceDisplayCondition(o),s={show:i,distanceDisplayCondition:r,color:void 0,offset:void 0};if(this._materialProperty instanceof An){let a;l(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(a=this._materialProperty.color.getValue(e,pte)),l(a)||(a=k.WHITE),s.color=Bn.fromColor(a)}return l(this._options.offsetAttribute)&&(s.offset=Ar.fromCartesian3(ie.getValueOrDefault(this._terrainOffsetProperty,e,dte,hte))),new xn({id:t,geometry:Ss.fromDimensions(this._options),modelMatrix:t.computeModelMatrixForHeightReference(e,t.box.heightReference,this._options.dimensions.z*.5,this._scene.mapProjection.ellipsoid),attributes:s})};ll.prototype.createOutlineGeometryInstance=function(e){if(E.defined("time",e),!this._outlineEnabled)throw new w("This instance does not represent an outlined geometry.");const t=this._entity,n=t.isAvailable(e),i=ie.getValueOrDefault(this._outlineColorProperty,e,k.BLACK,pte),o=this._distanceDisplayConditionProperty.getValue(e),r={show:new pi(n&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:Bn.fromColor(i),distanceDisplayCondition:Yi.fromDistanceDisplayCondition(o),offset:void 0};return l(this._options.offsetAttribute)&&(r.offset=Ar.fromCartesian3(ie.getValueOrDefault(this._terrainOffsetProperty,e,dte,hte))),new xn({id:t,geometry:pl.fromDimensions(this._options),modelMatrix:t.computeModelMatrixForHeightReference(e,t.box.heightReference,this._options.dimensions.z*.5,this._scene.mapProjection.ellipsoid),attributes:r})};ll.prototype._computeCenter=function(e,t){return ie.getValueOrUndefined(this._entity.position,e,t)};ll.prototype._isHidden=function(e,t){return!l(t.dimensions)||!l(e.position)||li.prototype._isHidden.call(this,e,t)};ll.prototype._isDynamic=function(e,t){return!e.position.isConstant||!ie.isConstant(e.orientation)||!t.dimensions.isConstant||!ie.isConstant(t.outlineWidth)};ll.prototype._setStaticOptions=function(e,t){const n=ie.getValueOrDefault(t.heightReference,wt.MINIMUM_VALUE,Ht.NONE),i=this._options;i.vertexFormat=this._materialProperty instanceof An?kn.VERTEX_FORMAT:Dr.MaterialSupport.TEXTURED.vertexFormat,i.dimensions=t.dimensions.getValue(wt.MINIMUM_VALUE,i.dimensions),i.offsetAttribute=n!==Ht.NONE?Fn.ALL:void 0};ll.prototype._onEntityPropertyChanged=iU;ll.DynamicGeometryUpdater=DA;function DA(e,t,n){Mi.call(this,e,t,n)}l(Object.create)&&(DA.prototype=Object.create(Mi.prototype),DA.prototype.constructor=DA);DA.prototype._isHidden=function(e,t,n){const i=ie.getValueOrUndefined(e.position,n,y7e),o=this._options.dimensions;return!l(i)||!l(o)||Mi.prototype._isHidden.call(this,e,t,n)};DA.prototype._setOptions=function(e,t,n){const i=ie.getValueOrDefault(t.heightReference,n,Ht.NONE),o=this._options;o.dimensions=ie.getValueOrUndefined(t.dimensions,n,o.dimensions),o.offsetAttribute=i!==Ht.NONE?Fn.ALL:void 0};function vT(e){e=A(e,A.EMPTY_OBJECT);const t=l(e.imageBasedLightingFactor)?$.clone(e.imageBasedLightingFactor):new $(1,1);E.typeOf.object("options.imageBasedLightingFactor",t),E.typeOf.number.greaterThanOrEquals("options.imageBasedLightingFactor.x",t.x,0),E.typeOf.number.lessThanOrEquals("options.imageBasedLightingFactor.x",t.x,1),E.typeOf.number.greaterThanOrEquals("options.imageBasedLightingFactor.y",t.y,0),E.typeOf.number.lessThanOrEquals("options.imageBasedLightingFactor.y",t.y,1),this._imageBasedLightingFactor=t;const n=A(e.luminanceAtZenith,.2);E.typeOf.number("options.luminanceAtZenith",n),this._luminanceAtZenith=n;const i=e.sphericalHarmonicCoefficients;if(l(i)&&(!Array.isArray(i)||i.length!==9))throw new w("options.sphericalHarmonicCoefficients must be an array of 9 Cartesian3 values.");this._sphericalHarmonicCoefficients=i,this._specularEnvironmentMaps=e.specularEnvironmentMaps,this._specularEnvironmentMapAtlas=void 0,this._specularEnvironmentMapAtlasDirty=!0,this._specularEnvironmentMapLoaded=!1,this._previousSpecularEnvironmentMapLoaded=!1,this._useDefaultSpecularMaps=!1,this._useDefaultSphericalHarmonics=!1,this._shouldRegenerateShaders=!1,this._previousFrameNumber=void 0,this._previousImageBasedLightingFactor=$.clone(t),this._previousLuminanceAtZenith=n,this._previousSphericalHarmonicCoefficients=i}Object.defineProperties(vT.prototype,{imageBasedLightingFactor:{get:function(){return this._imageBasedLightingFactor},set:function(e){E.typeOf.object("imageBasedLightingFactor",e),E.typeOf.number.greaterThanOrEquals("imageBasedLightingFactor.x",e.x,0),E.typeOf.number.lessThanOrEquals("imageBasedLightingFactor.x",e.x,1),E.typeOf.number.greaterThanOrEquals("imageBasedLightingFactor.y",e.y,0),E.typeOf.number.lessThanOrEquals("imageBasedLightingFactor.y",e.y,1),this._previousImageBasedLightingFactor=$.clone(this._imageBasedLightingFactor,this._previousImageBasedLightingFactor),this._imageBasedLightingFactor=$.clone(e,this._imageBasedLightingFactor)}},luminanceAtZenith:{get:function(){return this._luminanceAtZenith},set:function(e){this._previousLuminanceAtZenith=this._luminanceAtZenith,this._luminanceAtZenith=e}},sphericalHarmonicCoefficients:{get:function(){return this._sphericalHarmonicCoefficients},set:function(e){if(l(e)&&(!Array.isArray(e)||e.length!==9))throw new w("sphericalHarmonicCoefficients must be an array of 9 Cartesian3 values.");this._previousSphericalHarmonicCoefficients=this._sphericalHarmonicCoefficients,this._sphericalHarmonicCoefficients=e}},specularEnvironmentMaps:{get:function(){return this._specularEnvironmentMaps},set:function(e){e!==this._specularEnvironmentMaps&&(this._specularEnvironmentMapAtlasDirty=this._specularEnvironmentMapAtlasDirty||e!==this._specularEnvironmentMaps,this._specularEnvironmentMapLoaded=!1),this._specularEnvironmentMaps=e}},enabled:{get:function(){return this._imageBasedLightingFactor.x>0||this._imageBasedLightingFactor.y>0}},shouldRegenerateShaders:{get:function(){return this._shouldRegenerateShaders}},useDefaultSphericalHarmonics:{get:function(){return this._useDefaultSphericalHarmonics}},useSphericalHarmonicCoefficients:{get:function(){return l(this._sphericalHarmonicCoefficients)||this._useDefaultSphericalHarmonics}},specularEnvironmentMapAtlas:{get:function(){return this._specularEnvironmentMapAtlas}},useDefaultSpecularMaps:{get:function(){return this._useDefaultSpecularMaps}},useSpecularEnvironmentMaps:{get:function(){return l(this._specularEnvironmentMapAtlas)&&this._specularEnvironmentMapAtlas.ready||this._useDefaultSpecularMaps}}});function T7e(e,t){if(gf.isSupported(t)){if(e._specularEnvironmentMapAtlas=e._specularEnvironmentMapAtlas&&e._specularEnvironmentMapAtlas.destroy(),l(e._specularEnvironmentMaps)){const n=new gf(e._specularEnvironmentMaps);e._specularEnvironmentMapAtlas=n,n.readyPromise.then(function(){e._specularEnvironmentMapLoaded=!0}).catch(function(i){console.error(`Error loading specularEnvironmentMaps: ${i}`)})}e._shouldRegenerateShaders=!0}}vT.prototype.update=function(e){if(e.frameNumber===this._previousFrameNumber)return;this._previousFrameNumber=e.frameNumber;const t=e.context;e.brdfLutGenerator.update(e),this._shouldRegenerateShaders=!1;const n=this._imageBasedLightingFactor,i=this._previousImageBasedLightingFactor;$.equals(n,i)||(this._shouldRegenerateShaders=n.x>0&&i.x===0||n.x===0&&i.x>0,this._shouldRegenerateShaders=this._shouldRegenerateShaders||n.y>0&&i.y===0||n.y===0&&i.y>0,this._previousImageBasedLightingFactor=$.clone(this._imageBasedLightingFactor,this._previousImageBasedLightingFactor)),this._luminanceAtZenith!==this._previousLuminanceAtZenith&&(this._shouldRegenerateShaders=this._shouldRegenerateShaders||l(this._luminanceAtZenith)!==l(this._previousLuminanceAtZenith),this._previousLuminanceAtZenith=this._luminanceAtZenith),this._previousSphericalHarmonicCoefficients!==this._sphericalHarmonicCoefficients&&(this._shouldRegenerateShaders=this._shouldRegenerateShaders||l(this._previousSphericalHarmonicCoefficients)!==l(this._sphericalHarmonicCoefficients),this._previousSphericalHarmonicCoefficients=this._sphericalHarmonicCoefficients),this._shouldRegenerateShaders=this._shouldRegenerateShaders||this._previousSpecularEnvironmentMapLoaded!==this._specularEnvironmentMapLoaded,this._previousSpecularEnvironmentMapLoaded=this._specularEnvironmentMapLoaded,this._specularEnvironmentMapAtlasDirty&&(T7e(this,t),this._specularEnvironmentMapAtlasDirty=!1),l(this._specularEnvironmentMapAtlas)&&this._specularEnvironmentMapAtlas.update(e);const o=!l(this._specularEnvironmentMapAtlas)&&l(e.specularEnvironmentMaps)&&!this._useDefaultSpecularMaps,r=!l(e.specularEnvironmentMaps)&&this._useDefaultSpecularMaps,s=!l(this._sphericalHarmonicCoefficients)&&l(e.sphericalHarmonicCoefficients)&&!this._useDefaultSphericalHarmonics,a=!l(e.sphericalHarmonicCoefficients)&&this._useDefaultSphericalHarmonics;this._shouldRegenerateShaders=this._shouldRegenerateShaders||o||r||s||a,this._useDefaultSpecularMaps=!l(this._specularEnvironmentMapAtlas)&&l(e.specularEnvironmentMaps),this._useDefaultSphericalHarmonics=!l(this._sphericalHarmonicCoefficients)&&l(e.sphericalHarmonicCoefficients)};vT.prototype.isDestroyed=function(){return!1};vT.prototype.destroy=function(){return this._specularEnvironmentMapAtlas=this._specularEnvironmentMapAtlas&&this._specularEnvironmentMapAtlas.destroy(),Je(this)};function oU(e){e=A(e,A.EMPTY_OBJECT),E.typeOf.object("options.metadata",e.metadata),this._metadata=e.metadata}Object.defineProperties(oU.prototype,{metadata:{get:function(){return this._metadata}}});function nl(e,t,n){if(!l(e))throw new w("uint8Array is required.");if(t<0)throw new w("byteOffset cannot be negative.");if(n<0)throw new w("byteLength cannot be negative.");if(t+n>e.byteLength)throw new w("sub-region exceeds array bounds.");return t=A(t,0),n=A(n,e.byteLength-t),e=e.subarray(t,t+n),nl.decode(e)}nl.decodeWithTextDecoder=function(e){return new TextDecoder("utf-8").decode(e)};nl.decodeWithFromCharCode=function(e){let t="";const n=C7e(e),i=n.length;for(let o=0;o<i;++o){let r=n[o];r<=65535?t+=String.fromCharCode(r):(r-=65536,t+=String.fromCharCode((r>>10)+55296,(r&1023)+56320))}return t};function HC(e,t,n){return t<=e&&e<=n}function C7e(e){let t=0,n=0,i=0,o=128,r=191;const s=[],a=e.length;for(let c=0;c<a;++c){const u=e[c];if(i===0){if(HC(u,0,127)){s.push(u);continue}if(HC(u,194,223)){i=1,t=u&31;continue}if(HC(u,224,239)){u===224&&(o=160),u===237&&(r=159),i=2,t=u&15;continue}if(HC(u,240,244)){u===240&&(o=144),u===244&&(r=143),i=3,t=u&7;continue}throw new Fe("String decoding failed.")}if(!HC(u,o,r)){t=i=n=0,o=128,r=191,--c;continue}o=128,r=191,t=t<<6|u&63,++n,n===i&&(s.push(t),t=i=n=0)}return s}typeof TextDecoder<"u"?nl.decode=nl.decodeWithTextDecoder:nl.decode=nl.decodeWithFromCharCode;function TP(e,t){return t=A(t,0),nl(e,t,Math.min(4,e.length))}function mp(e,t,n,i,o,r){this._tileset=e,this._tile=t,this._resource=n,this._contents=[],this._metadata=void 0,this._group=void 0,this._readyPromise=b7e(this,i,o,r)}Object.defineProperties(mp.prototype,{featurePropertiesDirty:{get:function(){const e=this._contents,t=e.length;for(let n=0;n<t;++n)if(e[n].featurePropertiesDirty)return!0;return!1},set:function(e){const t=this._contents,n=t.length;for(let i=0;i<n;++i)t[i].featurePropertiesDirty=e}},featuresLength:{get:function(){return 0}},pointsLength:{get:function(){return 0}},trianglesLength:{get:function(){return 0}},geometryByteLength:{get:function(){return 0}},texturesByteLength:{get:function(){return 0}},batchTableByteLength:{get:function(){return 0}},innerContents:{get:function(){return this._contents}},readyPromise:{get:function(){return this._readyPromise}},tileset:{get:function(){return this._tileset}},tile:{get:function(){return this._tile}},url:{get:function(){return this._resource.getUrlComponent(!0)}},metadata:{get:function(){return this._metadata},set:function(e){this._metadata=e;const t=this._contents,n=t.length;for(let i=0;i<n;++i)t[i].metadata=e}},batchTable:{get:function(){}},group:{get:function(){return this._group},set:function(e){this._group=e;const t=this._contents,n=t.length;for(let i=0;i<n;++i)t[i].group=e}}});const VC=Uint32Array.BYTES_PER_ELEMENT;function b7e(e,t,n,i){n=A(n,0);const o=new Uint8Array(t),r=new DataView(t);n+=VC;const s=r.getUint32(n,!0);if(s!==1)throw new Fe(`Only Composite Tile version 1 is supported. Version ${s} is not.`);n+=VC,n+=VC;const a=r.getUint32(n,!0);n+=VC;const c=[],u=e._resource;let f=u.queryParameters.compositeIndex;l(f)?f=`${f}_`:f="";for(let h=0;h<a;++h){const _=TP(o,n),g=r.getUint32(n+VC*2,!0),p=i[_],y=`${f}${h}`,T=u.getDerivedResource({queryParameters:{compositeIndex:y}});if(l(p)){const b=p(e._tileset,e._tile,T,t,n);e._contents.push(b),c.push(b.readyPromise)}else throw new Fe(`Unknown tile content type, ${_}, inside Composite tile`);n+=g}return Promise.all(c).then(function(){return e})}mp.prototype.hasProperty=function(e,t){return!1};mp.prototype.getFeature=function(e){};mp.prototype.applyDebugSettings=function(e,t){const n=this._contents,i=n.length;for(let o=0;o<i;++o)n[o].applyDebugSettings(e,t)};mp.prototype.applyStyle=function(e){const t=this._contents,n=t.length;for(let i=0;i<n;++i)t[i].applyStyle(e)};mp.prototype.update=function(e,t){const n=this._contents,i=n.length;for(let o=0;o<i;++o)n[o].update(e,t)};mp.prototype.isDestroyed=function(){return!1};mp.prototype.destroy=function(){const e=this._contents,t=e.length;for(let n=0;n<t;++n)e[n].destroy();return Je(this)};function zc(e,t,n){return JSON.parse(nl(e,t,n))}function er(e){E.typeOf.number("options.featuresLength",e.featuresLength),E.typeOf.object("options.owner",e.owner),this._id=ma();const t=e.featuresLength;this._showAlphaProperties=void 0,this._batchValues=void 0,this._batchValuesDirty=!1,this._batchTexture=void 0,this._defaultTexture=void 0,this._pickTexture=void 0,this._pickIds=[];let n,i;if(t>0){const o=Math.min(t,Gt.maximumTextureSize),r=Math.ceil(t/Gt.maximumTextureSize),s=1/o,a=s*.5,c=1/r,u=c*.5;n=new $(o,r),i=new ue(s,a,c,u)}this._translucentFeaturesLength=0,this._featuresLength=t,this._textureDimensions=n,this._textureStep=i,this._owner=e.owner,this._statistics=e.statistics,this._colorChangedCallback=e.colorChangedCallback}Object.defineProperties(er.prototype,{translucentFeaturesLength:{get:function(){return this._translucentFeaturesLength}},byteLength:{get:function(){let e=0;return l(this._pickTexture)&&(e+=this._pickTexture.sizeInBytes),l(this._batchTexture)&&(e+=this._batchTexture.sizeInBytes),e}},textureDimensions:{get:function(){return this._textureDimensions}},textureStep:{get:function(){return this._textureStep}},batchTexture:{get:function(){return this._batchTexture}},defaultTexture:{get:function(){return this._defaultTexture}},pickTexture:{get:function(){return this._pickTexture}}});er.DEFAULT_COLOR_VALUE=k.WHITE;er.DEFAULT_SHOW_VALUE=!0;function mte(e){const t=e._textureDimensions;return t.x*t.y*4}function _te(e){if(!l(e._batchValues)){const t=mte(e),n=new Uint8Array(t).fill(255);e._batchValues=n}return e._batchValues}function gte(e){if(!l(e._showAlphaProperties)){const t=2*e._featuresLength,n=new Uint8Array(t).fill(255);e._showAlphaProperties=n}return e._showAlphaProperties}function Px(e,t){if(!l(e)||e<0||e>=t)throw new w(`batchId is required and between zero and featuresLength - 1 (${t}`-+").")}er.prototype.setShow=function(e,t){if(Px(e,this._featuresLength),E.typeOf.bool("show",t),t&&!l(this._showAlphaProperties))return;const n=gte(this),i=e*2,o=t?255:0;if(n[i]!==o){n[i]=o;const r=_te(this),s=e*4+3;r[s]=t?n[i+1]:0,this._batchValuesDirty=!0}};er.prototype.setAllShow=function(e){E.typeOf.bool("show",e);const t=this._featuresLength;for(let n=0;n<t;++n)this.setShow(n,e)};er.prototype.getShow=function(e){if(Px(e,this._featuresLength),!l(this._showAlphaProperties))return!0;const t=e*2;return this._showAlphaProperties[t]===255};const E7e=new Array(4);er.prototype.setColor=function(e,t){if(Px(e,this._featuresLength),E.typeOf.object("color",t),k.equals(t,er.DEFAULT_COLOR_VALUE)&&!l(this._batchValues))return;const n=t.toBytes(E7e),i=n[3],o=_te(this),r=e*4,s=gte(this),a=e*2;if(o[r]!==n[0]||o[r+1]!==n[1]||o[r+2]!==n[2]||s[a+1]!==i){o[r]=n[0],o[r+1]=n[1],o[r+2]=n[2];const c=s[a+1]!==255,u=s[a]!==0;o[r+3]=u?i:0,s[a+1]=i;const f=i!==255;f&&!c?++this._translucentFeaturesLength:!f&&c&&--this._translucentFeaturesLength,this._batchValuesDirty=!0,l(this._colorChangedCallback)&&this._colorChangedCallback(e,t)}};er.prototype.setAllColor=function(e){E.typeOf.object("color",e);const t=this._featuresLength;for(let n=0;n<t;++n)this.setColor(n,e)};er.prototype.getColor=function(e,t){if(Px(e,this._featuresLength),E.typeOf.object("result",t),!l(this._batchValues))return k.clone(er.DEFAULT_COLOR_VALUE,t);const n=this._batchValues,i=e*4,o=this._showAlphaProperties,r=e*2;return k.fromBytes(n[i],n[i+1],n[i+2],o[r+1],t)};er.prototype.getPickColor=function(e){return Px(e,this._featuresLength),this._pickIds[e]};function yte(e,t,n){const i=e._textureDimensions;return new rn({context:t,pixelFormat:yt.RGBA,pixelDatatype:ft.UNSIGNED_BYTE,source:{width:i.x,height:i.y,arrayBufferView:n},flipY:!1,sampler:Ci.NEAREST})}function x7e(e,t){const n=e._featuresLength;if(!l(e._pickTexture)&&n>0){const i=e._pickIds,o=mte(e),r=new Uint8Array(o),s=e._owner,a=e._statistics;for(let c=0;c<n;++c){const u=t.createPickId(s.getFeature(c));i.push(u);const f=u.color,h=c*4;r[h]=k.floatToByte(f.red),r[h+1]=k.floatToByte(f.green),r[h+2]=k.floatToByte(f.blue),r[h+3]=k.floatToByte(f.alpha)}e._pickTexture=yte(e,t,r),l(a)&&(a.batchTableByteLength+=e._pickTexture.sizeInBytes)}}function w7e(e){const t=e._textureDimensions;e._batchTexture.copyFrom({source:{width:t.x,height:t.y,arrayBufferView:e._batchValues}})}er.prototype.update=function(e,t){const n=t.context;this._defaultTexture=n.defaultTexture;const i=t.passes;(i.pick||i.postProcess)&&x7e(this,n),this._batchValuesDirty&&(this._batchValuesDirty=!1,l(this._batchTexture)||(this._batchTexture=yte(this,n,this._batchValues),l(this._statistics)&&(this._statistics.batchTableByteLength+=this._batchTexture.sizeInBytes)),w7e(this))};er.prototype.isDestroyed=function(){return!1};er.prototype.destroy=function(){this._batchTexture=this._batchTexture&&this._batchTexture.destroy(),this._pickTexture=this._pickTexture&&this._pickTexture.destroy();const e=this._pickIds,t=e.length;for(let n=0;n<t;++n)e[n].destroy();return Je(this)};const S7e={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},v7e={SCALAR:void 0,VEC2:$,VEC3:d,VEC4:ue,MAT2:Et,MAT3:te,MAT4:N};function Gg(e){const t=e.componentType;let n;typeof t=="string"?n=oe.fromName(t):n=t;const i=S7e[e.type],o=v7e[e.type];return{componentsPerAttribute:i,classType:o,createArrayBufferView:function(r,s,a){return oe.createArrayBufferView(n,r,s,i*a)}}}function Ud(e){this._classes=void 0,this._classIds=void 0,this._classIndexes=void 0,this._parentCounts=void 0,this._parentIndexes=void 0,this._parentIds=void 0,this._byteLength=0,E.typeOf.object("options.extension",e.extension),D7e(this,e.extension,e.binaryBody),L7e(this)}Object.defineProperties(Ud.prototype,{byteLength:{get:function(){return this._byteLength}}});function D7e(e,t,n){let i,o,r;const s=t.instancesLength,a=t.classes;let c=t.classIds,u=t.parentCounts,f=t.parentIds,h=s,_=0;l(c.byteOffset)&&(c.componentType=A(c.componentType,oe.UNSIGNED_SHORT),c.type=Nn.SCALAR,r=Gg(c),c=r.createArrayBufferView(n.buffer,n.byteOffset+c.byteOffset,s),_+=c.byteLength);let g;if(l(u)){for(l(u.byteOffset)&&(u.componentType=A(u.componentType,oe.UNSIGNED_SHORT),u.type=Nn.SCALAR,r=Gg(u),u=r.createArrayBufferView(n.buffer,n.byteOffset+u.byteOffset,s),_+=u.byteLength),g=new Uint16Array(s),h=0,i=0;i<s;++i)g[i]=h,h+=u[i];_+=g.byteLength}l(f)&&l(f.byteOffset)&&(f.componentType=A(f.componentType,oe.UNSIGNED_SHORT),f.type=Nn.SCALAR,r=Gg(f),f=r.createArrayBufferView(n.buffer,n.byteOffset+f.byteOffset,h),_+=f.byteLength);const p=a.length;for(i=0;i<p;++i){const b=a[i].length,x=a[i].instances,v=I7e(b,x,n);_+=P7e(v),a[i].instances=Ln(v,x)}const y=new Array(p).fill(0),T=new Uint16Array(s);for(i=0;i<s;++i)o=c[i],T[i]=y[o],++y[o];_+=T.byteLength,e._classes=a,e._classIds=c,e._classIndexes=T,e._parentCounts=u,e._parentIndexes=g,e._parentIds=f,e._byteLength=_}function I7e(e,t,n){let i;for(const o in t)if(t.hasOwnProperty(o)){const r=t[o],s=r.byteOffset;if(l(s)){const a=r.componentType,c=r.type;if(!l(a))throw new Fe("componentType is required.");if(!l(c))throw new Fe("type is required.");if(!l(n))throw new Fe(`Property ${o} requires a batch table binary.`);const u=Gg(r),f=u.componentsPerAttribute,h=u.classType,_=u.createArrayBufferView(n.buffer,n.byteOffset+s,e);l(i)||(i={}),i[o]={typedArray:_,componentCount:f,type:h}}}return i}function P7e(e){let t=0;for(const n in e)e.hasOwnProperty(n)&&(t+=e[n].typedArray.byteLength);return t}const O7e=[];function L7e(e){const t=O7e;t.length=0;const i=e._classIds.length;for(let o=0;o<i;++o)Ate(e,o,t)}function Ate(e,t,n){const i=e._parentCounts,o=e._parentIds,r=e._parentIndexes,a=e._classIds.length;if(!l(o))return;if(t>=a)throw new w(`Parent index ${t} exceeds the total number of instances: ${a}`);if(n.indexOf(t)>-1)throw new w("Circular dependency detected in the batch table hierarchy.");n.push(t);const c=l(i)?i[t]:1,u=l(i)?r[t]:t;for(let f=0;f<c;++f){const h=o[u+f];h!==t&&Ate(e,h,n)}n.pop(t)}const B7e=[],R7e=[];let N7e=0;function M7e(e,t,n){const i=e._classIds,o=e._parentCounts,r=e._parentIds,s=e._parentIndexes,a=i.length,c=B7e;c.length=Math.max(c.length,a);const u=++N7e,f=R7e;for(f.length=0,f.push(t);f.length>0;){if(t=f.pop(),c[t]===u)continue;c[t]=u;const h=n(e,t);if(l(h))return h;const _=o[t],g=s[t];for(let p=0;p<_;++p){const y=r[g+p];y!==t&&f.push(y)}}}function F7e(e,t,n){let i=!0;for(;i;){const o=n(e,t);if(l(o))return o;const r=e._parentIds[t];i=r!==t,t=r}}function Ox(e,t,n){const i=e._parentCounts,o=e._parentIds;if(l(o)){if(l(i))return M7e(e,t,n)}else return n(e,t);return F7e(e,t,n)}Ud.prototype.hasProperty=function(e,t){const n=Ox(this,e,function(i,o){const r=i._classIds[o],s=i._classes[r].instances;if(l(s[t]))return!0});return l(n)};Ud.prototype.propertyExists=function(e){const t=this._classes,n=t.length;for(let i=0;i<n;++i){const o=t[i].instances;if(l(o[e]))return!0}return!1};Ud.prototype.getPropertyIds=function(e,t){return t=l(t)?t:[],t.length=0,Ox(this,e,function(n,i){const o=n._classIds[i],r=n._classes[o].instances;for(const s in r)r.hasOwnProperty(s)&&t.indexOf(s)===-1&&t.push(s)}),t};Ud.prototype.getProperty=function(e,t){return Ox(this,e,function(n,i){const o=n._classIds[i],r=n._classes[o],s=n._classIndexes[i],a=r.instances[t];if(l(a))return l(a.typedArray)?z7e(a,s):St(a[s],!0)})};function z7e(e,t){const n=e.typedArray,i=e.componentCount;return i===1?n[t]:e.type.unpack(n,t*i)}Ud.prototype.setProperty=function(e,t,n){const i=Ox(this,e,function(o,r){const s=o._classIds[r],a=o._classes[s],c=o._classIndexes[r],u=a.instances[t];if(l(u)){if(r!==e)throw new w(`Inherited property "${t}" is read-only.`);return l(u.typedArray)?U7e(u,c,n):u[c]=St(n,!0),!0}});return l(i)};function U7e(e,t,n){const i=e.typedArray,o=e.componentCount;o===1?i[t]=n:e.type.pack(n,i,t*o)}Ud.prototype.isClass=function(e,t){const n=Ox(this,e,function(i,o){const r=i._classIds[o];if(i._classes[r].name===t)return!0});return l(n)};Ud.prototype.getClassName=function(e){const t=this._classIds[e];return this._classes[t].name};const H7e={HIGHLIGHT:0,REPLACE:1,MIX:2},qD=Object.freeze(H7e),wR=er.DEFAULT_COLOR_VALUE,SR=er.DEFAULT_SHOW_VALUE;function $i(e,t,n,i,o){this.featuresLength=t;let r;l(n)&&(r=n.extensions),this._extensions=A(r,{});const s=V7e(n);this._properties=s,this._batchTableHierarchy=k7e(this,n,i);const a=Tte(t,s,i);this._binaryPropertiesByteLength=G7e(a),this._batchTableBinaryProperties=a,this._content=e,this._batchTexture=new er({featuresLength:t,colorChangedCallback:o,owner:e,statistics:e.tileset.statistics})}$i._deprecationWarning=p_;Object.defineProperties($i.prototype,{batchTableByteLength:{get:function(){let e=this._binaryPropertiesByteLength;return l(this._batchTableHierarchy)&&(e+=this._batchTableHierarchy.byteLength),e+=this._batchTexture.byteLength,e}}});function V7e(e){const t={};if(!l(e))return t;for(const n in e)e.hasOwnProperty(n)&&n!=="HIERARCHY"&&n!=="extensions"&&n!=="extras"&&(t[n]=St(e[n],!0));return t}function k7e(e,t,n){if(!l(t))return;let i=e._extensions["3DTILES_batch_table_hierarchy"];const o=t.HIERARCHY;if(l(o)&&($i._deprecationWarning("batchTableHierarchyExtension","The batch table HIERARCHY property has been moved to an extension. Use extensions.3DTILES_batch_table_hierarchy instead."),e._extensions["3DTILES_batch_table_hierarchy"]=o,i=o),!!l(i))return new Ud({extension:i,binaryBody:n})}function Tte(e,t,n){let i;for(const o in t)if(t.hasOwnProperty(o)){const r=t[o],s=r.byteOffset;if(l(s)){const a=r.componentType,c=r.type;if(!l(a))throw new Fe("componentType is required.");if(!l(c))throw new Fe("type is required.");if(!l(n))throw new Fe(`Property ${o} requires a batch table binary.`);const u=Gg(r),f=u.componentsPerAttribute,h=u.classType,_=u.createArrayBufferView(n.buffer,n.byteOffset+s,e);l(i)||(i={}),i[o]={typedArray:_,componentCount:f,type:h}}}return i}function G7e(e){if(!l(e))return 0;let t=0;for(const n in e)e.hasOwnProperty(n)&&(t+=e[n].typedArray.byteLength);return t}$i.getBinaryProperties=function(e,t,n){return Tte(e,t,n)};$i.prototype.setShow=function(e,t){this._batchTexture.setShow(e,t)};$i.prototype.setAllShow=function(e){this._batchTexture.setAllShow(e)};$i.prototype.getShow=function(e){return this._batchTexture.getShow(e)};$i.prototype.setColor=function(e,t){this._batchTexture.setColor(e,t)};$i.prototype.setAllColor=function(e){this._batchTexture.setAllColor(e)};$i.prototype.getColor=function(e,t){return this._batchTexture.getColor(e,t)};$i.prototype.getPickColor=function(e){return this._batchTexture.getPickColor(e)};const W7e=new k;$i.prototype.applyStyle=function(e){if(!l(e)){this.setAllColor(wR),this.setAllShow(SR);return}const t=this._content,n=this.featuresLength;for(let i=0;i<n;++i){const o=t.getFeature(i),r=l(e.color)?A(e.color.evaluateColor(o,W7e),wR):wR,s=l(e.show)?A(e.show.evaluate(o),SR):SR;this.setColor(i,r),this.setShow(i,s)}};function q7e(e,t){const n=e.typedArray,i=e.componentCount;return i===1?n[t]:e.type.unpack(n,t*i)}function j7e(e,t,n){const i=e.typedArray,o=e.componentCount;o===1?i[t]=n:e.type.pack(n,i,t*o)}function DT(e,t){if(!l(e)||e<0||e>=t)throw new w(`batchId is required and must be between zero and featuresLength - 1 (${t}`-+").")}$i.prototype.isClass=function(e,t){DT(e,this.featuresLength),E.typeOf.string("className",t);const n=this._batchTableHierarchy;return l(n)?n.isClass(e,t):!1};$i.prototype.isExactClass=function(e,t){return E.typeOf.string("className",t),this.getExactClassName(e)===t};$i.prototype.getExactClassName=function(e){DT(e,this.featuresLength);const t=this._batchTableHierarchy;if(l(t))return t.getClassName(e)};$i.prototype.hasProperty=function(e,t){return DT(e,this.featuresLength),E.typeOf.string("name",t),l(this._properties[t])||l(this._batchTableHierarchy)&&this._batchTableHierarchy.hasProperty(e,t)};$i.prototype.hasPropertyBySemantic=function(){return!1};$i.prototype.getPropertyIds=function(e,t){DT(e,this.featuresLength),t=l(t)?t:[],t.length=0;const n=Object.keys(this._properties);return t.push.apply(t,n),l(this._batchTableHierarchy)&&t.push.apply(t,this._batchTableHierarchy.getPropertyIds(e,n)),t};$i.prototype.getPropertyBySemantic=function(e,t){};$i.prototype.getProperty=function(e,t){if(DT(e,this.featuresLength),E.typeOf.string("name",t),l(this._batchTableBinaryProperties)){const i=this._batchTableBinaryProperties[t];if(l(i))return q7e(i,e)}const n=this._properties[t];if(l(n))return St(n[e],!0);if(l(this._batchTableHierarchy)){const i=this._batchTableHierarchy.getProperty(e,t);if(l(i))return i}};$i.prototype.setProperty=function(e,t,n){const i=this.featuresLength;if(DT(e,i),E.typeOf.string("name",t),l(this._batchTableBinaryProperties)){const r=this._batchTableBinaryProperties[t];if(l(r)){j7e(r,e,n);return}}if(l(this._batchTableHierarchy)&&this._batchTableHierarchy.setProperty(e,t,n))return;let o=this._properties[t];l(o)||(this._properties[t]=new Array(i),o=this._properties[t]),o[e]=St(n,!0)};function Y7e(e){return e._batchTexture.textureDimensions.y===1?`uniform vec4 tile_textureStep;
|
||
vec2 computeSt(float batchId)
|
||
{
|
||
float stepX = tile_textureStep.x;
|
||
float centerX = tile_textureStep.y;
|
||
return vec2(centerX + (batchId * stepX), 0.5);
|
||
}
|
||
`:`uniform vec4 tile_textureStep;
|
||
uniform vec2 tile_textureDimensions;
|
||
vec2 computeSt(float batchId)
|
||
{
|
||
float stepX = tile_textureStep.x;
|
||
float centerX = tile_textureStep.y;
|
||
float stepY = tile_textureStep.z;
|
||
float centerY = tile_textureStep.w;
|
||
float xId = mod(batchId, tile_textureDimensions.x);
|
||
float yId = floor(batchId / tile_textureDimensions.x);
|
||
return vec2(centerX + (xId * stepX), centerY + (yId * stepY));
|
||
}
|
||
`}$i.prototype.getVertexShaderCallback=function(e,t,n){if(this.featuresLength===0)return;const i=this;return function(o){const r=Cte(o,n,!1);let s;return Gt.maximumVertexTextureImageUnits>0?(s="",e&&(s+=`uniform bool tile_translucentCommand;
|
||
`),s+=`uniform sampler2D tile_batchTexture;
|
||
varying vec4 tile_featureColor;
|
||
varying vec2 tile_featureSt;
|
||
void main()
|
||
{
|
||
vec2 st = computeSt(${t});
|
||
vec4 featureProperties = texture2D(tile_batchTexture, st);
|
||
tile_color(featureProperties);
|
||
float show = ceil(featureProperties.a);
|
||
gl_Position *= show;
|
||
`,e&&(s+=` bool isStyleTranslucent = (featureProperties.a != 1.0);
|
||
if (czm_pass == czm_passTranslucent)
|
||
{
|
||
if (!isStyleTranslucent && !tile_translucentCommand)
|
||
{
|
||
gl_Position *= 0.0;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
if (isStyleTranslucent)
|
||
{
|
||
gl_Position *= 0.0;
|
||
}
|
||
}
|
||
`),s+=` tile_featureColor = featureProperties;
|
||
tile_featureSt = st;
|
||
}`):s=`varying vec2 tile_featureSt;
|
||
void main()
|
||
{
|
||
tile_color(vec4(1.0));
|
||
tile_featureSt = computeSt(${t});
|
||
}`,`${r}
|
||
${Y7e(i)}${s}`}};function R9(e,t){return e=nt.replaceMain(e,"tile_main"),t?`${e}uniform float tile_colorBlend;
|
||
void tile_color(vec4 tile_featureColor)
|
||
{
|
||
tile_main();
|
||
tile_featureColor = czm_gammaCorrect(tile_featureColor);
|
||
gl_FragColor.a *= tile_featureColor.a;
|
||
float highlight = ceil(tile_colorBlend);
|
||
gl_FragColor.rgb *= mix(tile_featureColor.rgb, vec3(1.0), highlight);
|
||
}
|
||
`:`${e}void tile_color(vec4 tile_featureColor)
|
||
{
|
||
tile_main();
|
||
}
|
||
`}function $7e(e,t){const n=`texture2D(${t}`;let i=0,o=e.indexOf(n,i),r;for(;o>-1;){let s=0;for(let u=o;u<e.length;++u){const f=e.charAt(u);if(f==="(")++s;else if(f===")"&&(--s,s===0)){r=u+1;break}}const c=`tile_diffuse_final(${e.slice(o,r)}, tile_diffuse)`;e=e.slice(0,o)+c+e.slice(r),i=o+c.length,o=e.indexOf(n,i)}return e}function Cte(e,t,n){if(!l(t))return R9(e,n);let i=new RegExp(`(uniform|attribute|in)\\s+(vec[34]|sampler2D)\\s+${t};`);const o=e.match(i);if(!l(o))return R9(e,n);const r=o[0],s=o[2];e=nt.replaceMain(e,"tile_main"),e=e.replace(r,"");const a=`bool isWhite(vec3 color)
|
||
{
|
||
return all(greaterThan(color, vec3(1.0 - czm_epsilon3)));
|
||
}
|
||
vec4 tile_diffuse_final(vec4 sourceDiffuse, vec4 tileDiffuse)
|
||
{
|
||
vec4 blendDiffuse = mix(sourceDiffuse, tileDiffuse, tile_colorBlend);
|
||
vec4 diffuse = isWhite(tileDiffuse.rgb) ? sourceDiffuse : blendDiffuse;
|
||
return vec4(diffuse.rgb, sourceDiffuse.a);
|
||
}
|
||
`,c=` tile_featureColor = czm_gammaCorrect(tile_featureColor);
|
||
gl_FragColor.a *= tile_featureColor.a;
|
||
float highlight = ceil(tile_colorBlend);
|
||
gl_FragColor.rgb *= mix(tile_featureColor.rgb, vec3(1.0), highlight);
|
||
`;let u;if(s==="vec3"||s==="vec4"){const f=s==="vec3"?`vec4(${t}, 1.0)`:t,h=s==="vec3"?"tile_diffuse.xyz":"tile_diffuse";i=new RegExp(t,"g"),e=e.replace(i,h),u=` vec4 source = ${f};
|
||
tile_diffuse = tile_diffuse_final(source, tile_featureColor);
|
||
tile_main();
|
||
`}else s==="sampler2D"&&(e=$7e(e,t),u=` tile_diffuse = tile_featureColor;
|
||
tile_main();
|
||
`);return e=`uniform float tile_colorBlend;
|
||
vec4 tile_diffuse = vec4(1.0);
|
||
${a}${r}
|
||
${e}
|
||
void tile_color(vec4 tile_featureColor)
|
||
{
|
||
${u}`,n&&(e+=c),e+=`}
|
||
`,e}$i.prototype.getFragmentShaderCallback=function(e,t,n){if(this.featuresLength!==0)return function(i){return i=Cte(i,t,!0),Gt.maximumVertexTextureImageUnits>0?(i+=`uniform sampler2D tile_pickTexture;
|
||
varying vec2 tile_featureSt;
|
||
varying vec4 tile_featureColor;
|
||
void main()
|
||
{
|
||
tile_color(tile_featureColor);
|
||
`,n&&(i+=` gl_FragColor.rgb *= gl_FragColor.a;
|
||
`),i+="}"):(e&&(i+=`uniform bool tile_translucentCommand;
|
||
`),i+=`uniform sampler2D tile_pickTexture;
|
||
uniform sampler2D tile_batchTexture;
|
||
varying vec2 tile_featureSt;
|
||
void main()
|
||
{
|
||
vec4 featureProperties = texture2D(tile_batchTexture, tile_featureSt);
|
||
if (featureProperties.a == 0.0) {
|
||
discard;
|
||
}
|
||
`,e&&(i+=` bool isStyleTranslucent = (featureProperties.a != 1.0);
|
||
if (czm_pass == czm_passTranslucent)
|
||
{
|
||
if (!isStyleTranslucent && !tile_translucentCommand)
|
||
{
|
||
discard;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
if (isStyleTranslucent)
|
||
{
|
||
discard;
|
||
}
|
||
}
|
||
`),i+=` tile_color(featureProperties);
|
||
`,n&&(i+=` gl_FragColor.rgb *= gl_FragColor.a;
|
||
`),i+=`}
|
||
`),i}};$i.prototype.getClassificationFragmentShaderCallback=function(){if(this.featuresLength!==0)return function(e){return e=nt.replaceMain(e,"tile_main"),Gt.maximumVertexTextureImageUnits>0?e+=`uniform sampler2D tile_pickTexture;
|
||
varying vec2 tile_featureSt;
|
||
varying vec4 tile_featureColor;
|
||
void main()
|
||
{
|
||
tile_main();
|
||
gl_FragColor = tile_featureColor;
|
||
gl_FragColor.rgb *= gl_FragColor.a;
|
||
}`:e+=`uniform sampler2D tile_batchTexture;
|
||
uniform sampler2D tile_pickTexture;
|
||
varying vec2 tile_featureSt;
|
||
void main()
|
||
{
|
||
tile_main();
|
||
vec4 featureProperties = texture2D(tile_batchTexture, tile_featureSt);
|
||
if (featureProperties.a == 0.0) {
|
||
discard;
|
||
}
|
||
gl_FragColor = featureProperties;
|
||
gl_FragColor.rgb *= gl_FragColor.a;
|
||
}
|
||
`,e}};function X7e(e){const t=e._content.tileset,n=t.colorBlendMode,i=t.colorBlendAmount;if(n===qD.HIGHLIGHT)return 0;if(n===qD.REPLACE)return 1;if(n===qD.MIX)return F.clamp(i,F.EPSILON4,1);throw new w(`Invalid color blend mode "${n}".`)}$i.prototype.getUniformMapCallback=function(){if(this.featuresLength===0)return;const e=this;return function(t){return Ln(t,{tile_batchTexture:function(){return A(e._batchTexture.batchTexture,e._batchTexture.defaultTexture)},tile_textureDimensions:function(){return e._batchTexture.textureDimensions},tile_textureStep:function(){return e._batchTexture.textureStep},tile_colorBlend:function(){return X7e(e)},tile_pickTexture:function(){return e._batchTexture.pickTexture}})}};$i.prototype.getPickId=function(){return"texture2D(tile_pickTexture, tile_featureSt)"};const Cm={ALL_OPAQUE:0,ALL_TRANSLUCENT:1,OPAQUE_AND_TRANSLUCENT:2};$i.prototype.addDerivedCommands=function(e,t){const n=e.commandList,i=n.length,o=this._content._tile,r=o._finalResolution,s=o.tileset,a=s._skipLevelOfDetail&&s._hasMixedContent&&e.context.stencilBuffer,c=K7e(this);for(let u=t;u<i;++u){const f=n[u];if(f.pass===We.COMPUTE)continue;let h=f.derivedCommands.tileset;(!l(h)||f.dirty)&&(h={},f.derivedCommands.tileset=h,h.originalCommand=J7e(f),f.dirty=!1);const _=h.originalCommand;c!==Cm.ALL_OPAQUE&&f.pass!==We.TRANSLUCENT&&(l(h.translucent)||(h.translucent=Q7e(_))),c!==Cm.ALL_TRANSLUCENT&&f.pass!==We.TRANSLUCENT&&(l(h.opaque)||(h.opaque=Z7e(_)),a&&(r||(l(h.zback)||(h.zback=tYe(e.context,_)),s._backfaceCommands.push(h.zback)),(!l(h.stencil)||o._selectionDepth!==iYe(h.stencil))&&(f.renderState.depthMask?h.stencil=nYe(_,o._selectionDepth):h.stencil=h.opaque)));const g=a?h.stencil:h.opaque,p=h.translucent;f.pass!==We.TRANSLUCENT?(c===Cm.ALL_OPAQUE&&(n[u]=g),c===Cm.ALL_TRANSLUCENT&&(n[u]=p),c===Cm.OPAQUE_AND_TRANSLUCENT&&(n[u]=g,n.push(p))):n[u]=_}};function K7e(e){const t=e._batchTexture.translucentFeaturesLength;return t===0?Cm.ALL_OPAQUE:t===e.featuresLength?Cm.ALL_TRANSLUCENT:Cm.OPAQUE_AND_TRANSLUCENT}function J7e(e){const t=Dt.shallowClone(e),n=t.pass===We.TRANSLUCENT;return t.uniformMap=l(t.uniformMap)?t.uniformMap:{},t.uniformMap.tile_translucentCommand=function(){return n},t}function Q7e(e){const t=Dt.shallowClone(e);return t.pass=We.TRANSLUCENT,t.renderState=oYe(e.renderState),t}function Z7e(e){const t=Dt.shallowClone(e);return t.renderState=rYe(e.renderState),t}function eYe(e,t){let n=e.shaderCache.getDerivedShaderProgram(t,"zBackfaceLogDepth");if(!l(n)){const i=t.fragmentShaderSource.clone();i.defines=l(i.defines)?i.defines.slice(0):[],i.defines.push("POLYGON_OFFSET"),i.sources.unshift(`#ifdef GL_OES_standard_derivatives
|
||
#extension GL_OES_standard_derivatives : enable
|
||
#endif
|
||
`),n=e.shaderCache.createDerivedShaderProgram(t,"zBackfaceLogDepth",{vertexShaderSource:t.vertexShaderSource,fragmentShaderSource:i,attributeLocations:t._attributeLocations})}return n}function tYe(e,t){const n=Dt.shallowClone(t),i=St(n.renderState,!0);i.cull.enabled=!0,i.cull.face=mr.FRONT,i.colorMask={red:!1,green:!1,blue:!1,alpha:!1},i.polygonOffset={enabled:!0,factor:5,units:5},i.stencilTest=Kt.setCesium3DTileBit(),i.stencilMask=Kt.CESIUM_3D_TILE_MASK,n.renderState=ht.fromCache(i),n.castShadows=!1,n.receiveShadows=!1,n.uniformMap=St(t.uniformMap);const o=new $(5,5);return n.uniformMap.u_polygonOffset=function(){return o},n.shaderProgram=eYe(e,t.shaderProgram),n}function nYe(e,t){const n=Dt.shallowClone(e),i=St(n.renderState,!0);return i.stencilTest.enabled=!0,i.stencilTest.mask=Kt.SKIP_LOD_MASK,i.stencilTest.reference=Kt.CESIUM_3D_TILE_MASK|t<<Kt.SKIP_LOD_BIT_SHIFT,i.stencilTest.frontFunction=Ni.GREATER_OR_EQUAL,i.stencilTest.frontOperation.zPass=It.REPLACE,i.stencilTest.backFunction=Ni.GREATER_OR_EQUAL,i.stencilTest.backOperation.zPass=It.REPLACE,i.stencilMask=Kt.CESIUM_3D_TILE_MASK|Kt.SKIP_LOD_MASK,n.renderState=ht.fromCache(i),n}function iYe(e){return(e.renderState.stencilTest.reference&Kt.SKIP_LOD_MASK)>>>Kt.SKIP_LOD_BIT_SHIFT}function oYe(e){const t=St(e,!0);return t.cull.enabled=!1,t.depthTest.enabled=!0,t.depthMask=!1,t.blending=fo.ALPHA_BLEND,t.stencilTest=Kt.setCesium3DTileBit(),t.stencilMask=Kt.CESIUM_3D_TILE_MASK,ht.fromCache(t)}function rYe(e){const t=St(e,!0);return t.stencilTest=Kt.setCesium3DTileBit(),t.stencilMask=Kt.CESIUM_3D_TILE_MASK,ht.fromCache(t)}$i.prototype.update=function(e,t){this._batchTexture.update(e,t)};$i.prototype.isDestroyed=function(){return!1};$i.prototype.destroy=function(){return this._batchTexture=this._batchTexture&&this._batchTexture.destroy(),Je(this)};function YI(e){this.offset=e.offset,this.count=e.count,this.color=e.color,this.batchIds=e.batchIds}class sYe{add(t,n,i){if(typeof arguments[0]!="string")for(let o in arguments[0])this.add(o,arguments[0][o],arguments[1]);else(Array.isArray(t)?t:[t]).forEach(function(o){this[o]=this[o]||[],n&&this[o][i?"unshift":"push"](n)},this)}run(t,n){this[t]=this[t]||[],this[t].forEach(function(i){i.call(n&&n.context?n.context:n,n)})}}class aYe{constructor(t){this.jsep=t,this.registered={}}register(...t){t.forEach(n=>{if(typeof n!="object"||!n.name||!n.init)throw new Error("Invalid JSEP plugin format");this.registered[n.name]||(n.init(this.jsep),this.registered[n.name]=n)})}}class Ze{static get version(){return"1.3.8"}static toString(){return"JavaScript Expression Parser (JSEP) v"+Ze.version}static addUnaryOp(t){return Ze.max_unop_len=Math.max(t.length,Ze.max_unop_len),Ze.unary_ops[t]=1,Ze}static addBinaryOp(t,n,i){return Ze.max_binop_len=Math.max(t.length,Ze.max_binop_len),Ze.binary_ops[t]=n,i?Ze.right_associative.add(t):Ze.right_associative.delete(t),Ze}static addIdentifierChar(t){return Ze.additional_identifier_chars.add(t),Ze}static addLiteral(t,n){return Ze.literals[t]=n,Ze}static removeUnaryOp(t){return delete Ze.unary_ops[t],t.length===Ze.max_unop_len&&(Ze.max_unop_len=Ze.getMaxKeyLen(Ze.unary_ops)),Ze}static removeAllUnaryOps(){return Ze.unary_ops={},Ze.max_unop_len=0,Ze}static removeIdentifierChar(t){return Ze.additional_identifier_chars.delete(t),Ze}static removeBinaryOp(t){return delete Ze.binary_ops[t],t.length===Ze.max_binop_len&&(Ze.max_binop_len=Ze.getMaxKeyLen(Ze.binary_ops)),Ze.right_associative.delete(t),Ze}static removeAllBinaryOps(){return Ze.binary_ops={},Ze.max_binop_len=0,Ze}static removeLiteral(t){return delete Ze.literals[t],Ze}static removeAllLiterals(){return Ze.literals={},Ze}get char(){return this.expr.charAt(this.index)}get code(){return this.expr.charCodeAt(this.index)}constructor(t){this.expr=t,this.index=0}static parse(t){return new Ze(t).parse()}static getMaxKeyLen(t){return Math.max(0,...Object.keys(t).map(n=>n.length))}static isDecimalDigit(t){return t>=48&&t<=57}static binaryPrecedence(t){return Ze.binary_ops[t]||0}static isIdentifierStart(t){return t>=65&&t<=90||t>=97&&t<=122||t>=128&&!Ze.binary_ops[String.fromCharCode(t)]||Ze.additional_identifier_chars.has(String.fromCharCode(t))}static isIdentifierPart(t){return Ze.isIdentifierStart(t)||Ze.isDecimalDigit(t)}throwError(t){const n=new Error(t+" at character "+this.index);throw n.index=this.index,n.description=t,n}runHook(t,n){if(Ze.hooks[t]){const i={context:this,node:n};return Ze.hooks.run(t,i),i.node}return n}searchHook(t){if(Ze.hooks[t]){const n={context:this};return Ze.hooks[t].find(function(i){return i.call(n.context,n),n.node}),n.node}}gobbleSpaces(){let t=this.code;for(;t===Ze.SPACE_CODE||t===Ze.TAB_CODE||t===Ze.LF_CODE||t===Ze.CR_CODE;)t=this.expr.charCodeAt(++this.index);this.runHook("gobble-spaces")}parse(){this.runHook("before-all");const t=this.gobbleExpressions(),n=t.length===1?t[0]:{type:Ze.COMPOUND,body:t};return this.runHook("after-all",n)}gobbleExpressions(t){let n=[],i,o;for(;this.index<this.expr.length;)if(i=this.code,i===Ze.SEMCOL_CODE||i===Ze.COMMA_CODE)this.index++;else if(o=this.gobbleExpression())n.push(o);else if(this.index<this.expr.length){if(i===t)break;this.throwError('Unexpected "'+this.char+'"')}return n}gobbleExpression(){const t=this.searchHook("gobble-expression")||this.gobbleBinaryExpression();return this.gobbleSpaces(),this.runHook("after-expression",t)}gobbleBinaryOp(){this.gobbleSpaces();let t=this.expr.substr(this.index,Ze.max_binop_len),n=t.length;for(;n>0;){if(Ze.binary_ops.hasOwnProperty(t)&&(!Ze.isIdentifierStart(this.code)||this.index+t.length<this.expr.length&&!Ze.isIdentifierPart(this.expr.charCodeAt(this.index+t.length))))return this.index+=n,t;t=t.substr(0,--n)}return!1}gobbleBinaryExpression(){let t,n,i,o,r,s,a,c,u;if(s=this.gobbleToken(),!s||(n=this.gobbleBinaryOp(),!n))return s;for(r={value:n,prec:Ze.binaryPrecedence(n),right_a:Ze.right_associative.has(n)},a=this.gobbleToken(),a||this.throwError("Expected expression after "+n),o=[s,r,a];n=this.gobbleBinaryOp();){if(i=Ze.binaryPrecedence(n),i===0){this.index-=n.length;break}r={value:n,prec:i,right_a:Ze.right_associative.has(n)},u=n;const f=h=>r.right_a&&h.right_a?i>h.prec:i<=h.prec;for(;o.length>2&&f(o[o.length-2]);)a=o.pop(),n=o.pop().value,s=o.pop(),t={type:Ze.BINARY_EXP,operator:n,left:s,right:a},o.push(t);t=this.gobbleToken(),t||this.throwError("Expected expression after "+u),o.push(r,t)}for(c=o.length-1,t=o[c];c>1;)t={type:Ze.BINARY_EXP,operator:o[c-1].value,left:o[c-2],right:t},c-=2;return t}gobbleToken(){let t,n,i,o;if(this.gobbleSpaces(),o=this.searchHook("gobble-token"),o)return this.runHook("after-token",o);if(t=this.code,Ze.isDecimalDigit(t)||t===Ze.PERIOD_CODE)return this.gobbleNumericLiteral();if(t===Ze.SQUOTE_CODE||t===Ze.DQUOTE_CODE)o=this.gobbleStringLiteral();else if(t===Ze.OBRACK_CODE)o=this.gobbleArray();else{for(n=this.expr.substr(this.index,Ze.max_unop_len),i=n.length;i>0;){if(Ze.unary_ops.hasOwnProperty(n)&&(!Ze.isIdentifierStart(this.code)||this.index+n.length<this.expr.length&&!Ze.isIdentifierPart(this.expr.charCodeAt(this.index+n.length)))){this.index+=i;const r=this.gobbleToken();return r||this.throwError("missing unaryOp argument"),this.runHook("after-token",{type:Ze.UNARY_EXP,operator:n,argument:r,prefix:!0})}n=n.substr(0,--i)}Ze.isIdentifierStart(t)?(o=this.gobbleIdentifier(),Ze.literals.hasOwnProperty(o.name)?o={type:Ze.LITERAL,value:Ze.literals[o.name],raw:o.name}:o.name===Ze.this_str&&(o={type:Ze.THIS_EXP})):t===Ze.OPAREN_CODE&&(o=this.gobbleGroup())}return o?(o=this.gobbleTokenProperty(o),this.runHook("after-token",o)):this.runHook("after-token",!1)}gobbleTokenProperty(t){this.gobbleSpaces();let n=this.code;for(;n===Ze.PERIOD_CODE||n===Ze.OBRACK_CODE||n===Ze.OPAREN_CODE||n===Ze.QUMARK_CODE;){let i;if(n===Ze.QUMARK_CODE){if(this.expr.charCodeAt(this.index+1)!==Ze.PERIOD_CODE)break;i=!0,this.index+=2,this.gobbleSpaces(),n=this.code}this.index++,n===Ze.OBRACK_CODE?(t={type:Ze.MEMBER_EXP,computed:!0,object:t,property:this.gobbleExpression()},this.gobbleSpaces(),n=this.code,n!==Ze.CBRACK_CODE&&this.throwError("Unclosed ["),this.index++):n===Ze.OPAREN_CODE?t={type:Ze.CALL_EXP,arguments:this.gobbleArguments(Ze.CPAREN_CODE),callee:t}:(n===Ze.PERIOD_CODE||i)&&(i&&this.index--,this.gobbleSpaces(),t={type:Ze.MEMBER_EXP,computed:!1,object:t,property:this.gobbleIdentifier()}),i&&(t.optional=!0),this.gobbleSpaces(),n=this.code}return t}gobbleNumericLiteral(){let t="",n,i;for(;Ze.isDecimalDigit(this.code);)t+=this.expr.charAt(this.index++);if(this.code===Ze.PERIOD_CODE)for(t+=this.expr.charAt(this.index++);Ze.isDecimalDigit(this.code);)t+=this.expr.charAt(this.index++);if(n=this.char,n==="e"||n==="E"){for(t+=this.expr.charAt(this.index++),n=this.char,(n==="+"||n==="-")&&(t+=this.expr.charAt(this.index++));Ze.isDecimalDigit(this.code);)t+=this.expr.charAt(this.index++);Ze.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+t+this.char+")")}return i=this.code,Ze.isIdentifierStart(i)?this.throwError("Variable names cannot start with a number ("+t+this.char+")"):(i===Ze.PERIOD_CODE||t.length===1&&t.charCodeAt(0)===Ze.PERIOD_CODE)&&this.throwError("Unexpected period"),{type:Ze.LITERAL,value:parseFloat(t),raw:t}}gobbleStringLiteral(){let t="";const n=this.index,i=this.expr.charAt(this.index++);let o=!1;for(;this.index<this.expr.length;){let r=this.expr.charAt(this.index++);if(r===i){o=!0;break}else if(r==="\\")switch(r=this.expr.charAt(this.index++),r){case"n":t+=`
|
||
`;break;case"r":t+="\r";break;case"t":t+=" ";break;case"b":t+="\b";break;case"f":t+="\f";break;case"v":t+="\v";break;default:t+=r}else t+=r}return o||this.throwError('Unclosed quote after "'+t+'"'),{type:Ze.LITERAL,value:t,raw:this.expr.substring(n,this.index)}}gobbleIdentifier(){let t=this.code,n=this.index;for(Ze.isIdentifierStart(t)?this.index++:this.throwError("Unexpected "+this.char);this.index<this.expr.length&&(t=this.code,Ze.isIdentifierPart(t));)this.index++;return{type:Ze.IDENTIFIER,name:this.expr.slice(n,this.index)}}gobbleArguments(t){const n=[];let i=!1,o=0;for(;this.index<this.expr.length;){this.gobbleSpaces();let r=this.code;if(r===t){i=!0,this.index++,t===Ze.CPAREN_CODE&&o&&o>=n.length&&this.throwError("Unexpected token "+String.fromCharCode(t));break}else if(r===Ze.COMMA_CODE){if(this.index++,o++,o!==n.length){if(t===Ze.CPAREN_CODE)this.throwError("Unexpected token ,");else if(t===Ze.CBRACK_CODE)for(let s=n.length;s<o;s++)n.push(null)}}else if(n.length!==o&&o!==0)this.throwError("Expected comma");else{const s=this.gobbleExpression();(!s||s.type===Ze.COMPOUND)&&this.throwError("Expected comma"),n.push(s)}}return i||this.throwError("Expected "+String.fromCharCode(t)),n}gobbleGroup(){this.index++;let t=this.gobbleExpressions(Ze.CPAREN_CODE);if(this.code===Ze.CPAREN_CODE)return this.index++,t.length===1?t[0]:t.length?{type:Ze.SEQUENCE_EXP,expressions:t}:!1;this.throwError("Unclosed (")}gobbleArray(){return this.index++,{type:Ze.ARRAY_EXP,elements:this.gobbleArguments(Ze.CBRACK_CODE)}}}const cYe=new sYe;Object.assign(Ze,{hooks:cYe,plugins:new aYe(Ze),COMPOUND:"Compound",SEQUENCE_EXP:"SequenceExpression",IDENTIFIER:"Identifier",MEMBER_EXP:"MemberExpression",LITERAL:"Literal",THIS_EXP:"ThisExpression",CALL_EXP:"CallExpression",UNARY_EXP:"UnaryExpression",BINARY_EXP:"BinaryExpression",ARRAY_EXP:"ArrayExpression",TAB_CODE:9,LF_CODE:10,CR_CODE:13,SPACE_CODE:32,PERIOD_CODE:46,COMMA_CODE:44,SQUOTE_CODE:39,DQUOTE_CODE:34,OPAREN_CODE:40,CPAREN_CODE:41,OBRACK_CODE:91,CBRACK_CODE:93,QUMARK_CODE:63,SEMCOL_CODE:59,COLON_CODE:58,unary_ops:{"-":1,"!":1,"~":1,"+":1},binary_ops:{"||":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10},right_associative:new Set,additional_identifier_chars:new Set(["$","_"]),literals:{true:!0,false:!1,null:null},this_str:"this"});Ze.max_unop_len=Ze.getMaxKeyLen(Ze.unary_ops);Ze.max_binop_len=Ze.getMaxKeyLen(Ze.binary_ops);const Wg=e=>new Ze(e).parse(),lYe=Object.getOwnPropertyNames(Ze);lYe.forEach(e=>{Wg[e]===void 0&&e!=="prototype"&&(Wg[e]=Ze[e])});Wg.Jsep=Ze;const uYe="ConditionalExpression";var fYe={name:"ternary",init(e){e.hooks.add("after-expression",function(n){if(n.node&&this.code===e.QUMARK_CODE){this.index++;const i=n.node,o=this.gobbleExpression();if(o||this.throwError("Expected expression"),this.gobbleSpaces(),this.code===e.COLON_CODE){this.index++;const r=this.gobbleExpression();if(r||this.throwError("Expected expression"),n.node={type:uYe,test:i,consequent:o,alternate:r},i.operator&&e.binary_ops[i.operator]<=.9){let s=i;for(;s.right.operator&&e.binary_ops[s.right.operator]<=.9;)s=s.right;n.node.test=s.right,s.right=n.node,n.node=i}}else this.throwError("Expected :")}})}};Wg.plugins.register(fYe);const dYe={VARIABLE:0,UNARY:1,BINARY:2,TERNARY:3,CONDITIONAL:4,MEMBER:5,FUNCTION_CALL:6,ARRAY:7,REGEX:8,VARIABLE_IN_STRING:9,LITERAL_NULL:10,LITERAL_BOOLEAN:11,LITERAL_NUMBER:12,LITERAL_STRING:13,LITERAL_COLOR:14,LITERAL_VECTOR:15,LITERAL_REGEX:16,LITERAL_UNDEFINED:17,BUILTIN_VARIABLE:18},bt=Object.freeze(dYe);function yf(e,t){E.typeOf.string("expression",e),this._expression=e,e=wYe(e,t),e=vYe(SYe(e)),Wg.addBinaryOp("=~",0),Wg.addBinaryOp("!~",0);let n;try{n=Wg(e)}catch(i){throw new Fe(i)}this._runtimeAst=yi(this,n)}Object.defineProperties(yf.prototype,{expression:{get:function(){return this._expression}}});const Cn={arrayIndex:0,arrayArray:[[]],cartesian2Index:0,cartesian3Index:0,cartesian4Index:0,cartesian2Array:[new $],cartesian3Array:[new d],cartesian4Array:[new ue],reset:function(){this.arrayIndex=0,this.cartesian2Index=0,this.cartesian3Index=0,this.cartesian4Index=0},getArray:function(){this.arrayIndex>=this.arrayArray.length&&this.arrayArray.push([]);const e=this.arrayArray[this.arrayIndex++];return e.length=0,e},getCartesian2:function(){return this.cartesian2Index>=this.cartesian2Array.length&&this.cartesian2Array.push(new $),this.cartesian2Array[this.cartesian2Index++]},getCartesian3:function(){return this.cartesian3Index>=this.cartesian3Array.length&&this.cartesian3Array.push(new d),this.cartesian3Array[this.cartesian3Index++]},getCartesian4:function(){return this.cartesian4Index>=this.cartesian4Array.length&&this.cartesian4Array.push(new ue),this.cartesian4Array[this.cartesian4Index++]}};yf.prototype.evaluate=function(e,t){Cn.reset();const n=this._runtimeAst.evaluate(e);return t instanceof k&&n instanceof ue?k.fromCartesian4(n,t):n instanceof $||n instanceof d||n instanceof ue?n.clone(t):n};yf.prototype.evaluateColor=function(e,t){Cn.reset();const n=this._runtimeAst.evaluate(e);return k.fromCartesian4(n,t)};yf.prototype.getShaderFunction=function(e,t,n,i){let o=this.getShaderExpression(t,n);return o=`${i} ${e}
|
||
{
|
||
return ${o};
|
||
}
|
||
`,o};yf.prototype.getShaderExpression=function(e,t){return this._runtimeAst.getShaderExpression(e,t)};yf.prototype.getVariables=function(){let e=[];return this._runtimeAst.getVariables(e),e=e.filter(function(t,n,i){return i.indexOf(t)===n}),e};const hYe=["!","-","+"],N9=["+","-","*","/","%","===","!==",">",">=","<","<=","&&","||","!~","=~"],$I=/\${(.*?)}/g,pYe=/\\/g,mYe="@#%",_Ye=/@#%/g,CP=new k,bP={abs:Ts(Math.abs),sqrt:Ts(Math.sqrt),cos:Ts(Math.cos),sin:Ts(Math.sin),tan:Ts(Math.tan),acos:Ts(Math.acos),asin:Ts(Math.asin),atan:Ts(Math.atan),radians:Ts(F.toRadians),degrees:Ts(F.toDegrees),sign:Ts(F.sign),floor:Ts(Math.floor),ceil:Ts(Math.ceil),round:Ts(Math.round),exp:Ts(Math.exp),exp2:Ts(yYe),log:Ts(Math.log),log2:Ts(AYe),fract:Ts(gYe),length:TYe,normalize:CYe},EP={atan2:bv(Math.atan2,!1),pow:bv(Math.pow,!1),min:bv(Math.min,!0),max:bv(Math.max,!0),distance:bYe,dot:EYe,cross:xYe},rU={clamp:M9(F.clamp,!0),mix:M9(F.lerp,!0)};function gYe(e){return e-Math.floor(e)}function yYe(e){return Math.pow(2,e)}function AYe(e){return F.log2(e)}function Ts(e){return function(t,n){if(typeof n=="number")return e(n);if(n instanceof $)return $.fromElements(e(n.x),e(n.y),Cn.getCartesian2());if(n instanceof d)return d.fromElements(e(n.x),e(n.y),e(n.z),Cn.getCartesian3());if(n instanceof ue)return ue.fromElements(e(n.x),e(n.y),e(n.z),e(n.w),Cn.getCartesian4());throw new Fe(`Function "${t}" requires a vector or number argument. Argument is ${n}.`)}}function bv(e,t){return function(n,i,o){if(t&&typeof o=="number"){if(typeof i=="number")return e(i,o);if(i instanceof $)return $.fromElements(e(i.x,o),e(i.y,o),Cn.getCartesian2());if(i instanceof d)return d.fromElements(e(i.x,o),e(i.y,o),e(i.z,o),Cn.getCartesian3());if(i instanceof ue)return ue.fromElements(e(i.x,o),e(i.y,o),e(i.z,o),e(i.w,o),Cn.getCartesian4())}if(typeof i=="number"&&typeof o=="number")return e(i,o);if(i instanceof $&&o instanceof $)return $.fromElements(e(i.x,o.x),e(i.y,o.y),Cn.getCartesian2());if(i instanceof d&&o instanceof d)return d.fromElements(e(i.x,o.x),e(i.y,o.y),e(i.z,o.z),Cn.getCartesian3());if(i instanceof ue&&o instanceof ue)return ue.fromElements(e(i.x,o.x),e(i.y,o.y),e(i.z,o.z),e(i.w,o.w),Cn.getCartesian4());throw new Fe(`Function "${n}" requires vector or number arguments of matching types. Arguments are ${i} and ${o}.`)}}function M9(e,t){return function(n,i,o,r){if(t&&typeof r=="number"){if(typeof i=="number"&&typeof o=="number")return e(i,o,r);if(i instanceof $&&o instanceof $)return $.fromElements(e(i.x,o.x,r),e(i.y,o.y,r),Cn.getCartesian2());if(i instanceof d&&o instanceof d)return d.fromElements(e(i.x,o.x,r),e(i.y,o.y,r),e(i.z,o.z,r),Cn.getCartesian3());if(i instanceof ue&&o instanceof ue)return ue.fromElements(e(i.x,o.x,r),e(i.y,o.y,r),e(i.z,o.z,r),e(i.w,o.w,r),Cn.getCartesian4())}if(typeof i=="number"&&typeof o=="number"&&typeof r=="number")return e(i,o,r);if(i instanceof $&&o instanceof $&&r instanceof $)return $.fromElements(e(i.x,o.x,r.x),e(i.y,o.y,r.y),Cn.getCartesian2());if(i instanceof d&&o instanceof d&&r instanceof d)return d.fromElements(e(i.x,o.x,r.x),e(i.y,o.y,r.y),e(i.z,o.z,r.z),Cn.getCartesian3());if(i instanceof ue&&o instanceof ue&&r instanceof ue)return ue.fromElements(e(i.x,o.x,r.x),e(i.y,o.y,r.y),e(i.z,o.z,r.z),e(i.w,o.w,r.w),Cn.getCartesian4());throw new Fe(`Function "${n}" requires vector or number arguments of matching types. Arguments are ${i}, ${o}, and ${r}.`)}}function TYe(e,t){if(typeof t=="number")return Math.abs(t);if(t instanceof $)return $.magnitude(t);if(t instanceof d)return d.magnitude(t);if(t instanceof ue)return ue.magnitude(t);throw new Fe(`Function "${e}" requires a vector or number argument. Argument is ${t}.`)}function CYe(e,t){if(typeof t=="number")return 1;if(t instanceof $)return $.normalize(t,Cn.getCartesian2());if(t instanceof d)return d.normalize(t,Cn.getCartesian3());if(t instanceof ue)return ue.normalize(t,Cn.getCartesian4());throw new Fe(`Function "${e}" requires a vector or number argument. Argument is ${t}.`)}function bYe(e,t,n){if(typeof t=="number"&&typeof n=="number")return Math.abs(t-n);if(t instanceof $&&n instanceof $)return $.distance(t,n);if(t instanceof d&&n instanceof d)return d.distance(t,n);if(t instanceof ue&&n instanceof ue)return ue.distance(t,n);throw new Fe(`Function "${e}" requires vector or number arguments of matching types. Arguments are ${t} and ${n}.`)}function EYe(e,t,n){if(typeof t=="number"&&typeof n=="number")return t*n;if(t instanceof $&&n instanceof $)return $.dot(t,n);if(t instanceof d&&n instanceof d)return d.dot(t,n);if(t instanceof ue&&n instanceof ue)return ue.dot(t,n);throw new Fe(`Function "${e}" requires vector or number arguments of matching types. Arguments are ${t} and ${n}.`)}function xYe(e,t,n){if(t instanceof d&&n instanceof d)return d.cross(t,n,Cn.getCartesian3());throw new Fe(`Function "${e}" requires vec3 arguments. Arguments are ${t} and ${n}.`)}function Ct(e,t,n,i,o){this._type=e,this._value=t,this._left=n,this._right=i,this._test=o,this.evaluate=void 0,FYe(this)}function wYe(e,t){if(!l(t))return e;for(const n in t)if(t.hasOwnProperty(n)){const i=new RegExp(`\\$\\{${n}\\}`,"g"),o=`(${t[n]})`;l(o)&&(e=e.replace(i,o))}return e}function SYe(e){return e.replace(pYe,mYe)}function WF(e){return e.replace(_Ye,"\\")}function vYe(e){let t=e,n="",i=t.indexOf("${");for(;i>=0;){const o=t.indexOf("'"),r=t.indexOf('"');let s;if(o>=0&&o<i)s=t.indexOf("'",o+1),n+=t.substr(0,s+1),t=t.substr(s+1),i=t.indexOf("${");else if(r>=0&&r<i)s=t.indexOf('"',r+1),n+=t.substr(0,s+1),t=t.substr(s+1),i=t.indexOf("${");else{n+=t.substr(0,i);const a=t.indexOf("}");if(a<0)throw new Fe("Unmatched {.");n+=`czm_${t.substr(i+2,a-(i+2))}`,t=t.substr(a+1),i=t.indexOf("${")}}return n+=t,n}function DYe(e){const t=typeof e.value;if(e.value===null)return new Ct(bt.LITERAL_NULL,null);if(t==="boolean")return new Ct(bt.LITERAL_BOOLEAN,e.value);if(t==="number")return new Ct(bt.LITERAL_NUMBER,e.value);if(t==="string")return e.value.indexOf("${")>=0?new Ct(bt.VARIABLE_IN_STRING,e.value):new Ct(bt.LITERAL_STRING,WF(e.value))}function IYe(e,t){const n=t.arguments,i=n.length;let o,r,s,a;if(t.callee.type==="MemberExpression"){o=t.callee.property.name;const c=t.callee.object;if(o==="test"||o==="exec"){if(!l(c.callee)||c.callee.name!=="regExp")throw new Fe(`${o} is not a function.`);return i===0?o==="test"?new Ct(bt.LITERAL_BOOLEAN,!1):new Ct(bt.LITERAL_NULL,null):(s=yi(e,c),a=yi(e,n[0]),new Ct(bt.FUNCTION_CALL,o,s,a))}else if(o==="toString")return r=yi(e,c),new Ct(bt.FUNCTION_CALL,o,r);throw new Fe(`Unexpected function call "${o}".`)}if(o=t.callee.name,o==="color"){if(i===0)return new Ct(bt.LITERAL_COLOR,o);if(r=yi(e,n[0]),l(n[1])){const c=yi(e,n[1]);return new Ct(bt.LITERAL_COLOR,o,[r,c])}return new Ct(bt.LITERAL_COLOR,o,[r])}else if(o==="rgb"||o==="hsl"){if(i<3)throw new Fe(`${o} requires three arguments.`);return r=[yi(e,n[0]),yi(e,n[1]),yi(e,n[2])],new Ct(bt.LITERAL_COLOR,o,r)}else if(o==="rgba"||o==="hsla"){if(i<4)throw new Fe(`${o} requires four arguments.`);return r=[yi(e,n[0]),yi(e,n[1]),yi(e,n[2]),yi(e,n[3])],new Ct(bt.LITERAL_COLOR,o,r)}else if(o==="vec2"||o==="vec3"||o==="vec4"){r=new Array(i);for(let c=0;c<i;++c)r[c]=yi(e,n[c]);return new Ct(bt.LITERAL_VECTOR,o,r)}else{if(o==="isNaN"||o==="isFinite")return i===0?o==="isNaN"?new Ct(bt.LITERAL_BOOLEAN,!0):new Ct(bt.LITERAL_BOOLEAN,!1):(r=yi(e,n[0]),new Ct(bt.UNARY,o,r));if(o==="isExactClass"||o==="isClass"){if(i<1||i>1)throw new Fe(`${o} requires exactly one argument.`);return r=yi(e,n[0]),new Ct(bt.UNARY,o,r)}else if(o==="getExactClassName"){if(i>0)throw new Fe(`${o} does not take any argument.`);return new Ct(bt.UNARY,o)}else if(l(bP[o])){if(i!==1)throw new Fe(`${o} requires exactly one argument.`);return r=yi(e,n[0]),new Ct(bt.UNARY,o,r)}else if(l(EP[o])){if(i!==2)throw new Fe(`${o} requires exactly two arguments.`);return s=yi(e,n[0]),a=yi(e,n[1]),new Ct(bt.BINARY,o,s,a)}else if(l(rU[o])){if(i!==3)throw new Fe(`${o} requires exactly three arguments.`);s=yi(e,n[0]),a=yi(e,n[1]);const c=yi(e,n[2]);return new Ct(bt.TERNARY,o,s,a,c)}else{if(o==="Boolean")return i===0?new Ct(bt.LITERAL_BOOLEAN,!1):(r=yi(e,n[0]),new Ct(bt.UNARY,o,r));if(o==="Number")return i===0?new Ct(bt.LITERAL_NUMBER,0):(r=yi(e,n[0]),new Ct(bt.UNARY,o,r));if(o==="String")return i===0?new Ct(bt.LITERAL_STRING,""):(r=yi(e,n[0]),new Ct(bt.UNARY,o,r));if(o==="regExp")return PYe(e,t)}}throw new Fe(`Unexpected function call "${o}".`)}function PYe(e,t){const n=t.arguments;if(n.length===0)return new Ct(bt.LITERAL_REGEX,new RegExp);const i=yi(e,n[0]);let o;if(n.length>1){const r=yi(e,n[1]);if(vR(i)&&vR(r)){try{o=new RegExp(WF(String(i._value)),r._value)}catch(s){throw new Fe(s)}return new Ct(bt.LITERAL_REGEX,o)}return new Ct(bt.REGEX,i,r)}if(vR(i)){try{o=new RegExp(WF(String(i._value)))}catch(r){throw new Fe(r)}return new Ct(bt.LITERAL_REGEX,o)}return new Ct(bt.REGEX,i)}function OYe(e){if(NYe(e.name)){const t=MYe(e.name);return t.substr(0,8)==="tiles3d_"?new Ct(bt.BUILTIN_VARIABLE,t):new Ct(bt.VARIABLE,t)}else{if(e.name==="NaN")return new Ct(bt.LITERAL_NUMBER,NaN);if(e.name==="Infinity")return new Ct(bt.LITERAL_NUMBER,1/0);if(e.name==="undefined")return new Ct(bt.LITERAL_UNDEFINED,void 0)}throw new Fe(`${e.name} is not defined.`)}function LYe(e){const t=e.property.name;if(t==="PI")return new Ct(bt.LITERAL_NUMBER,Math.PI);if(t==="E")return new Ct(bt.LITERAL_NUMBER,Math.E)}function BYe(e){if(e.property.name==="POSITIVE_INFINITY")return new Ct(bt.LITERAL_NUMBER,Number.POSITIVE_INFINITY)}function RYe(e,t){if(t.object.name==="Math")return LYe(t);if(t.object.name==="Number")return BYe(t);let n;const i=yi(e,t.object);return t.computed?(n=yi(e,t.property),new Ct(bt.MEMBER,"brackets",i,n)):(n=new Ct(bt.LITERAL_STRING,t.property.name),new Ct(bt.MEMBER,"dot",i,n))}function vR(e){return e._type>=bt.LITERAL_NULL}function NYe(e){return e.substr(0,4)==="czm_"}function MYe(e){return e.substr(4)}function yi(e,t){let n,i,o,r;if(t.type==="Literal")n=DYe(t);else if(t.type==="CallExpression")n=IYe(e,t);else if(t.type==="Identifier")n=OYe(t);else if(t.type==="UnaryExpression"){i=t.operator;const s=yi(e,t.argument);if(hYe.indexOf(i)>-1)n=new Ct(bt.UNARY,i,s);else throw new Fe(`Unexpected operator "${i}".`)}else if(t.type==="BinaryExpression")if(i=t.operator,o=yi(e,t.left),r=yi(e,t.right),N9.indexOf(i)>-1)n=new Ct(bt.BINARY,i,o,r);else throw new Fe(`Unexpected operator "${i}".`);else if(t.type==="LogicalExpression")i=t.operator,o=yi(e,t.left),r=yi(e,t.right),N9.indexOf(i)>-1&&(n=new Ct(bt.BINARY,i,o,r));else if(t.type==="ConditionalExpression"){const s=yi(e,t.test);o=yi(e,t.consequent),r=yi(e,t.alternate),n=new Ct(bt.CONDITIONAL,"?",o,r,s)}else if(t.type==="MemberExpression")n=RYe(e,t);else if(t.type==="ArrayExpression"){const s=[];for(let a=0;a<t.elements.length;a++)s[a]=yi(e,t.elements[a]);n=new Ct(bt.ARRAY,s)}else throw t.type==="Compound"?new Fe("Provide exactly one expression."):new Fe("Cannot parse expression.");return n}function FYe(e){e._type===bt.CONDITIONAL?e.evaluate=e._evaluateConditional:e._type===bt.FUNCTION_CALL?e._value==="test"?e.evaluate=e._evaluateRegExpTest:e._value==="exec"?e.evaluate=e._evaluateRegExpExec:e._value==="toString"&&(e.evaluate=e._evaluateToString):e._type===bt.UNARY?e._value==="!"?e.evaluate=e._evaluateNot:e._value==="-"?e.evaluate=e._evaluateNegative:e._value==="+"?e.evaluate=e._evaluatePositive:e._value==="isNaN"?e.evaluate=e._evaluateNaN:e._value==="isFinite"?e.evaluate=e._evaluateIsFinite:e._value==="isExactClass"?e.evaluate=e._evaluateIsExactClass:e._value==="isClass"?e.evaluate=e._evaluateIsClass:e._value==="getExactClassName"?e.evaluate=e._evaluateGetExactClassName:e._value==="Boolean"?e.evaluate=e._evaluateBooleanConversion:e._value==="Number"?e.evaluate=e._evaluateNumberConversion:e._value==="String"?e.evaluate=e._evaluateStringConversion:l(bP[e._value])&&(e.evaluate=UYe(e._value)):e._type===bt.BINARY?e._value==="+"?e.evaluate=e._evaluatePlus:e._value==="-"?e.evaluate=e._evaluateMinus:e._value==="*"?e.evaluate=e._evaluateTimes:e._value==="/"?e.evaluate=e._evaluateDivide:e._value==="%"?e.evaluate=e._evaluateMod:e._value==="==="?e.evaluate=e._evaluateEqualsStrict:e._value==="!=="?e.evaluate=e._evaluateNotEqualsStrict:e._value==="<"?e.evaluate=e._evaluateLessThan:e._value==="<="?e.evaluate=e._evaluateLessThanOrEquals:e._value===">"?e.evaluate=e._evaluateGreaterThan:e._value===">="?e.evaluate=e._evaluateGreaterThanOrEquals:e._value==="&&"?e.evaluate=e._evaluateAnd:e._value==="||"?e.evaluate=e._evaluateOr:e._value==="=~"?e.evaluate=e._evaluateRegExpMatch:e._value==="!~"?e.evaluate=e._evaluateRegExpNotMatch:l(EP[e._value])&&(e.evaluate=HYe(e._value)):e._type===bt.TERNARY?e.evaluate=VYe(e._value):e._type===bt.MEMBER?e._value==="brackets"?e.evaluate=e._evaluateMemberBrackets:e.evaluate=e._evaluateMemberDot:e._type===bt.ARRAY?e.evaluate=e._evaluateArray:e._type===bt.VARIABLE?e.evaluate=e._evaluateVariable:e._type===bt.VARIABLE_IN_STRING?e.evaluate=e._evaluateVariableString:e._type===bt.LITERAL_COLOR?e.evaluate=e._evaluateLiteralColor:e._type===bt.LITERAL_VECTOR?e.evaluate=e._evaluateLiteralVector:e._type===bt.LITERAL_STRING?e.evaluate=e._evaluateLiteralString:e._type===bt.REGEX?e.evaluate=e._evaluateRegExp:e._type===bt.BUILTIN_VARIABLE?e._value==="tiles3d_tileset_time"&&(e.evaluate=zYe):e.evaluate=e._evaluateLiteral}function zYe(e){return l(e)?e.content.tileset.timeSinceLoad:0}function UYe(e){const t=bP[e];return function(n){const i=this._left.evaluate(n);return t(e,i)}}function HYe(e){const t=EP[e];return function(n){const i=this._left.evaluate(n),o=this._right.evaluate(n);return t(e,i,o)}}function VYe(e){const t=rU[e];return function(n){const i=this._left.evaluate(n),o=this._right.evaluate(n),r=this._test.evaluate(n);return t(e,i,o,r)}}function xP(e,t){if(l(e))return e.getPropertyInherited(t)}Ct.prototype._evaluateLiteral=function(){return this._value};Ct.prototype._evaluateLiteralColor=function(e){const t=CP,n=this._left;if(this._value==="color")l(n)?n.length>1?(k.fromCssColorString(n[0].evaluate(e),t),t.alpha=n[1].evaluate(e)):k.fromCssColorString(n[0].evaluate(e),t):k.fromBytes(255,255,255,255,t);else if(this._value==="rgb")k.fromBytes(n[0].evaluate(e),n[1].evaluate(e),n[2].evaluate(e),255,t);else if(this._value==="rgba"){const i=n[3].evaluate(e)*255;k.fromBytes(n[0].evaluate(e),n[1].evaluate(e),n[2].evaluate(e),i,t)}else this._value==="hsl"?k.fromHsl(n[0].evaluate(e),n[1].evaluate(e),n[2].evaluate(e),1,t):this._value==="hsla"&&k.fromHsl(n[0].evaluate(e),n[1].evaluate(e),n[2].evaluate(e),n[3].evaluate(e),t);return ue.fromColor(t,Cn.getCartesian4())};Ct.prototype._evaluateLiteralVector=function(e){const t=Cn.getArray(),n=this._value,i=this._left,o=i.length;for(let a=0;a<o;++a){const c=i[a].evaluate(e);if(typeof c=="number")t.push(c);else if(c instanceof $)t.push(c.x,c.y);else if(c instanceof d)t.push(c.x,c.y,c.z);else if(c instanceof ue)t.push(c.x,c.y,c.z,c.w);else throw new Fe(`${n} argument must be a vector or number. Argument is ${c}.`)}const r=t.length,s=parseInt(n.charAt(3));if(r===0)throw new Fe(`Invalid ${n} constructor. No valid arguments.`);if(r<s&&r>1)throw new Fe(`Invalid ${n} constructor. Not enough arguments.`);if(r>s&&o>1)throw new Fe(`Invalid ${n} constructor. Too many arguments.`);if(r===1){const a=t[0];t.push(a,a,a)}if(n==="vec2")return $.fromArray(t,0,Cn.getCartesian2());if(n==="vec3")return d.fromArray(t,0,Cn.getCartesian3());if(n==="vec4")return ue.fromArray(t,0,Cn.getCartesian4())};Ct.prototype._evaluateLiteralString=function(){return this._value};Ct.prototype._evaluateVariableString=function(e){let t=this._value,n=$I.exec(t);for(;n!==null;){const i=n[0],o=n[1];let r=xP(e,o);l(r)||(r=""),t=t.replace(i,r),n=$I.exec(t)}return t};Ct.prototype._evaluateVariable=function(e){return xP(e,this._value)};function qg(e){return e._value==="feature"}Ct.prototype._evaluateMemberDot=function(e){if(qg(this._left))return xP(e,this._right.evaluate(e));const t=this._left.evaluate(e);if(!l(t))return;const n=this._right.evaluate(e);if(t instanceof $||t instanceof d||t instanceof ue){if(n==="r")return t.x;if(n==="g")return t.y;if(n==="b")return t.z;if(n==="a")return t.w}return t[n]};Ct.prototype._evaluateMemberBrackets=function(e){if(qg(this._left))return xP(e,this._right.evaluate(e));const t=this._left.evaluate(e);if(!l(t))return;const n=this._right.evaluate(e);if(t instanceof $||t instanceof d||t instanceof ue){if(n===0||n==="r")return t.x;if(n===1||n==="g")return t.y;if(n===2||n==="b")return t.z;if(n===3||n==="a")return t.w}return t[n]};Ct.prototype._evaluateArray=function(e){const t=[];for(let n=0;n<this._value.length;n++)t[n]=this._value[n].evaluate(e);return t};Ct.prototype._evaluateNot=function(e){const t=this._left.evaluate(e);if(typeof t!="boolean")throw new Fe(`Operator "!" requires a boolean argument. Argument is ${t}.`);return!t};Ct.prototype._evaluateNegative=function(e){const t=this._left.evaluate(e);if(t instanceof $)return $.negate(t,Cn.getCartesian2());if(t instanceof d)return d.negate(t,Cn.getCartesian3());if(t instanceof ue)return ue.negate(t,Cn.getCartesian4());if(typeof t=="number")return-t;throw new Fe(`Operator "-" requires a vector or number argument. Argument is ${t}.`)};Ct.prototype._evaluatePositive=function(e){const t=this._left.evaluate(e);if(!(t instanceof $||t instanceof d||t instanceof ue||typeof t=="number"))throw new Fe(`Operator "+" requires a vector or number argument. Argument is ${t}.`);return t};Ct.prototype._evaluateLessThan=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);if(typeof t!="number"||typeof n!="number")throw new Fe(`Operator "<" requires number arguments. Arguments are ${t} and ${n}.`);return t<n};Ct.prototype._evaluateLessThanOrEquals=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);if(typeof t!="number"||typeof n!="number")throw new Fe(`Operator "<=" requires number arguments. Arguments are ${t} and ${n}.`);return t<=n};Ct.prototype._evaluateGreaterThan=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);if(typeof t!="number"||typeof n!="number")throw new Fe(`Operator ">" requires number arguments. Arguments are ${t} and ${n}.`);return t>n};Ct.prototype._evaluateGreaterThanOrEquals=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);if(typeof t!="number"||typeof n!="number")throw new Fe(`Operator ">=" requires number arguments. Arguments are ${t} and ${n}.`);return t>=n};Ct.prototype._evaluateOr=function(e){const t=this._left.evaluate(e);if(typeof t!="boolean")throw new Fe(`Operator "||" requires boolean arguments. First argument is ${t}.`);if(t)return!0;const n=this._right.evaluate(e);if(typeof n!="boolean")throw new Fe(`Operator "||" requires boolean arguments. Second argument is ${n}.`);return t||n};Ct.prototype._evaluateAnd=function(e){const t=this._left.evaluate(e);if(typeof t!="boolean")throw new Fe(`Operator "&&" requires boolean arguments. First argument is ${t}.`);if(!t)return!1;const n=this._right.evaluate(e);if(typeof n!="boolean")throw new Fe(`Operator "&&" requires boolean arguments. Second argument is ${n}.`);return t&&n};Ct.prototype._evaluatePlus=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);if(n instanceof $&&t instanceof $)return $.add(t,n,Cn.getCartesian2());if(n instanceof d&&t instanceof d)return d.add(t,n,Cn.getCartesian3());if(n instanceof ue&&t instanceof ue)return ue.add(t,n,Cn.getCartesian4());if(typeof t=="string"||typeof n=="string")return t+n;if(typeof t=="number"&&typeof n=="number")return t+n;throw new Fe(`Operator "+" requires vector or number arguments of matching types, or at least one string argument. Arguments are ${t} and ${n}.`)};Ct.prototype._evaluateMinus=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);if(n instanceof $&&t instanceof $)return $.subtract(t,n,Cn.getCartesian2());if(n instanceof d&&t instanceof d)return d.subtract(t,n,Cn.getCartesian3());if(n instanceof ue&&t instanceof ue)return ue.subtract(t,n,Cn.getCartesian4());if(typeof t=="number"&&typeof n=="number")return t-n;throw new Fe(`Operator "-" requires vector or number arguments of matching types. Arguments are ${t} and ${n}.`)};Ct.prototype._evaluateTimes=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);if(n instanceof $&&t instanceof $)return $.multiplyComponents(t,n,Cn.getCartesian2());if(n instanceof $&&typeof t=="number")return $.multiplyByScalar(n,t,Cn.getCartesian2());if(t instanceof $&&typeof n=="number")return $.multiplyByScalar(t,n,Cn.getCartesian2());if(n instanceof d&&t instanceof d)return d.multiplyComponents(t,n,Cn.getCartesian3());if(n instanceof d&&typeof t=="number")return d.multiplyByScalar(n,t,Cn.getCartesian3());if(t instanceof d&&typeof n=="number")return d.multiplyByScalar(t,n,Cn.getCartesian3());if(n instanceof ue&&t instanceof ue)return ue.multiplyComponents(t,n,Cn.getCartesian4());if(n instanceof ue&&typeof t=="number")return ue.multiplyByScalar(n,t,Cn.getCartesian4());if(t instanceof ue&&typeof n=="number")return ue.multiplyByScalar(t,n,Cn.getCartesian4());if(typeof t=="number"&&typeof n=="number")return t*n;throw new Fe(`Operator "*" requires vector or number arguments. If both arguments are vectors they must be matching types. Arguments are ${t} and ${n}.`)};Ct.prototype._evaluateDivide=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);if(n instanceof $&&t instanceof $)return $.divideComponents(t,n,Cn.getCartesian2());if(t instanceof $&&typeof n=="number")return $.divideByScalar(t,n,Cn.getCartesian2());if(n instanceof d&&t instanceof d)return d.divideComponents(t,n,Cn.getCartesian3());if(t instanceof d&&typeof n=="number")return d.divideByScalar(t,n,Cn.getCartesian3());if(n instanceof ue&&t instanceof ue)return ue.divideComponents(t,n,Cn.getCartesian4());if(t instanceof ue&&typeof n=="number")return ue.divideByScalar(t,n,Cn.getCartesian4());if(typeof t=="number"&&typeof n=="number")return t/n;throw new Fe(`Operator "/" requires vector or number arguments of matching types, or a number as the second argument. Arguments are ${t} and ${n}.`)};Ct.prototype._evaluateMod=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);if(n instanceof $&&t instanceof $)return $.fromElements(t.x%n.x,t.y%n.y,Cn.getCartesian2());if(n instanceof d&&t instanceof d)return d.fromElements(t.x%n.x,t.y%n.y,t.z%n.z,Cn.getCartesian3());if(n instanceof ue&&t instanceof ue)return ue.fromElements(t.x%n.x,t.y%n.y,t.z%n.z,t.w%n.w,Cn.getCartesian4());if(typeof t=="number"&&typeof n=="number")return t%n;throw new Fe(`Operator "%" requires vector or number arguments of matching types. Arguments are ${t} and ${n}.`)};Ct.prototype._evaluateEqualsStrict=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);return n instanceof $&&t instanceof $||n instanceof d&&t instanceof d||n instanceof ue&&t instanceof ue?t.equals(n):t===n};Ct.prototype._evaluateNotEqualsStrict=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);return n instanceof $&&t instanceof $||n instanceof d&&t instanceof d||n instanceof ue&&t instanceof ue?!t.equals(n):t!==n};Ct.prototype._evaluateConditional=function(e){const t=this._test.evaluate(e);if(typeof t!="boolean")throw new Fe(`Conditional argument of conditional expression must be a boolean. Argument is ${t}.`);return t?this._left.evaluate(e):this._right.evaluate(e)};Ct.prototype._evaluateNaN=function(e){return isNaN(this._left.evaluate(e))};Ct.prototype._evaluateIsFinite=function(e){return isFinite(this._left.evaluate(e))};Ct.prototype._evaluateIsExactClass=function(e){return l(e)?e.isExactClass(this._left.evaluate(e)):!1};Ct.prototype._evaluateIsClass=function(e){return l(e)?e.isClass(this._left.evaluate(e)):!1};Ct.prototype._evaluateGetExactClassName=function(e){if(l(e))return e.getExactClassName()};Ct.prototype._evaluateBooleanConversion=function(e){return Boolean(this._left.evaluate(e))};Ct.prototype._evaluateNumberConversion=function(e){return Number(this._left.evaluate(e))};Ct.prototype._evaluateStringConversion=function(e){return String(this._left.evaluate(e))};Ct.prototype._evaluateRegExp=function(e){const t=this._value.evaluate(e);let n="";l(this._left)&&(n=this._left.evaluate(e));let i;try{i=new RegExp(t,n)}catch(o){throw new Fe(o)}return i};Ct.prototype._evaluateRegExpTest=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);if(!(t instanceof RegExp&&typeof n=="string"))throw new Fe(`RegExp.test requires the first argument to be a RegExp and the second argument to be a string. Arguments are ${t} and ${n}.`);return t.test(n)};Ct.prototype._evaluateRegExpMatch=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);if(t instanceof RegExp&&typeof n=="string")return t.test(n);if(n instanceof RegExp&&typeof t=="string")return n.test(t);throw new Fe(`Operator "=~" requires one RegExp argument and one string argument. Arguments are ${t} and ${n}.`)};Ct.prototype._evaluateRegExpNotMatch=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);if(t instanceof RegExp&&typeof n=="string")return!t.test(n);if(n instanceof RegExp&&typeof t=="string")return!n.test(t);throw new Fe(`Operator "!~" requires one RegExp argument and one string argument. Arguments are ${t} and ${n}.`)};Ct.prototype._evaluateRegExpExec=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);if(!(t instanceof RegExp&&typeof n=="string"))throw new Fe(`RegExp.exec requires the first argument to be a RegExp and the second argument to be a string. Arguments are ${t} and ${n}.`);const i=t.exec(n);return l(i)?i[1]:null};Ct.prototype._evaluateToString=function(e){const t=this._left.evaluate(e);if(t instanceof RegExp||t instanceof $||t instanceof d||t instanceof ue)return String(t);throw new Fe(`Unexpected function call "${this._value}".`)};function F9(e){const t=e._left,n=t.length;for(let a=0;a<n;++a)if(t[a]._type!==bt.LITERAL_NUMBER)return;const i=t[0]._value,o=t[1]._value,r=t[2]._value,s=n===4?t[3]._value:1;return k.fromHsl(i,o,r,s,CP)}function z9(e){const t=e._left,n=t.length;for(let o=0;o<n;++o)if(t[o]._type!==bt.LITERAL_NUMBER)return;const i=CP;return i.red=t[0]._value/255,i.green=t[1]._value/255,i.blue=t[2]._value/255,i.alpha=n===4?t[3]._value:1,i}function vm(e){return e%1===0?e.toFixed(1):e.toString()}function kYe(e){const t=vm(e.red),n=vm(e.green),i=vm(e.blue);return`vec3(${t}, ${n}, ${i})`}function Ev(e){const t=vm(e.red),n=vm(e.green),i=vm(e.blue),o=vm(e.alpha);return`vec4(${t}, ${n}, ${i}, ${o})`}function U9(e,t,n,i){const o=e.length,r=new Array(o);for(let s=0;s<o;++s)r[s]=e[s].getShaderExpression(t,n,i);return r}function H9(e,t){return l(t[e])?t[e]:yf.NULL_SENTINEL}yf.NULL_SENTINEL="czm_infinity";Ct.prototype.getShaderExpression=function(e,t,n){let i,o,r,s;const a=this._type;let c=this._value;l(this._left)&&(Array.isArray(this._left)?o=U9(this._left,e,t,this):o=this._left.getShaderExpression(e,t,this)),l(this._right)&&(r=this._right.getShaderExpression(e,t,this)),l(this._test)&&(s=this._test.getShaderExpression(e,t,this)),Array.isArray(this._value)&&(c=U9(this._value,e,t,this));let u,f,h;switch(a){case bt.VARIABLE:return qg(this)?void 0:H9(c,e);case bt.UNARY:if(c==="Boolean")return`bool(${o})`;if(c==="Number")return`float(${o})`;if(c==="round")return`floor(${o} + 0.5)`;if(l(bP[c]))return`${c}(${o})`;if(c==="isNaN")return`(${o} != ${o})`;if(c==="isFinite")return`(abs(${o}) < czm_infinity)`;if(c==="String"||c==="isExactClass"||c==="isClass"||c==="getExactClassName")throw new Fe(`Error generating style shader: "${c}" is not supported.`);return c+o;case bt.BINARY:return c==="%"?`mod(${o}, ${r})`:c==="==="?`(${o} == ${r})`:c==="!=="?`(${o} != ${r})`:c==="atan2"?`atan(${o}, ${r})`:l(EP[c])?`${c}(${o}, ${r})`:`(${o} ${c} ${r})`;case bt.TERNARY:if(l(rU[c]))return`${c}(${o}, ${r}, ${s})`;break;case bt.CONDITIONAL:return`(${s} ? ${o} : ${r})`;case bt.MEMBER:return qg(this._left)?H9(r,e):r==="r"||r==="x"||r==="0.0"?`${o}[0]`:r==="g"||r==="y"||r==="1.0"?`${o}[1]`:r==="b"||r==="z"||r==="2.0"?`${o}[2]`:r==="a"||r==="w"||r==="3.0"?`${o}[3]`:`${o}[int(${r})]`;case bt.FUNCTION_CALL:throw new Fe(`Error generating style shader: "${c}" is not supported.`);case bt.ARRAY:if(c.length===4)return`vec4(${c[0]}, ${c[1]}, ${c[2]}, ${c[3]})`;if(c.length===3)return`vec3(${c[0]}, ${c[1]}, ${c[2]})`;if(c.length===2)return`vec2(${c[0]}, ${c[1]})`;throw new Fe("Error generating style shader: Invalid array length. Array length should be 2, 3, or 4.");case bt.REGEX:throw new Fe("Error generating style shader: Regular expressions are not supported.");case bt.VARIABLE_IN_STRING:throw new Fe("Error generating style shader: Converting a variable to a string is not supported.");case bt.LITERAL_NULL:return yf.NULL_SENTINEL;case bt.LITERAL_BOOLEAN:return c?"true":"false";case bt.LITERAL_NUMBER:return vm(c);case bt.LITERAL_STRING:if(l(n)&&n._type===bt.MEMBER&&(c==="r"||c==="g"||c==="b"||c==="a"||c==="x"||c==="y"||c==="z"||c==="w"||qg(n._left)))return c;if(i=k.fromCssColorString(c,CP),l(i))return kYe(i);throw new Fe("Error generating style shader: String literals are not supported.");case bt.LITERAL_COLOR:if(u=o,c==="color"){if(l(u)){if(u.length>1){const _=u[0],g=u[1];return g!=="1.0"&&(t.translucent=!0),`vec4(${_}, ${g})`}}else return"vec4(1.0)";return`vec4(${u[0]}, 1.0)`}else{if(c==="rgb")return i=z9(this),l(i)?Ev(i):`vec4(${u[0]} / 255.0, ${u[1]} / 255.0, ${u[2]} / 255.0, 1.0)`;if(c==="rgba")return u[3]!=="1.0"&&(t.translucent=!0),i=z9(this),l(i)?Ev(i):`vec4(${u[0]} / 255.0, ${u[1]} / 255.0, ${u[2]} / 255.0, ${u[3]})`;if(c==="hsl")return i=F9(this),l(i)?Ev(i):`vec4(czm_HSLToRGB(vec3(${u[0]}, ${u[1]}, ${u[2]})), 1.0)`;if(c==="hsla")return i=F9(this),l(i)?(i.alpha!==1&&(t.translucent=!0),Ev(i)):(u[3]!=="1.0"&&(t.translucent=!0),`vec4(czm_HSLToRGB(vec3(${u[0]}, ${u[1]}, ${u[2]})), ${u[3]})`)}break;case bt.LITERAL_VECTOR:if(!l(o))throw new w("left should always be defined for type ExpressionNodeType.LITERAL_VECTOR");f=o.length,h=`${c}(`;for(let _=0;_<f;++_)h+=o[_],_<f-1&&(h+=", ");return h+=")",h;case bt.LITERAL_REGEX:throw new Fe("Error generating style shader: Regular expressions are not supported.");case bt.LITERAL_UNDEFINED:return yf.NULL_SENTINEL;case bt.BUILTIN_VARIABLE:if(c==="tiles3d_tileset_time")return c}};Ct.prototype.getVariables=function(e,t){let n,i,o;const r=this._type,s=this._value;if(l(this._left))if(Array.isArray(this._left))for(n=this._left,i=n.length,o=0;o<i;++o)n[o].getVariables(e,this);else this._left.getVariables(e,this);if(l(this._right)&&this._right.getVariables(e,this),l(this._test)&&this._test.getVariables(e,this),Array.isArray(this._value))for(n=this._value,i=n.length,o=0;o<i;++o)n[o].getVariables(e,this);let a;switch(r){case bt.VARIABLE:qg(this)||e.push(s);break;case bt.VARIABLE_IN_STRING:for(a=$I.exec(s);a!==null;)e.push(a[1]),a=$I.exec(s);break;case bt.LITERAL_STRING:l(t)&&t._type===bt.MEMBER&&qg(t._left)&&e.push(s);break}};function Hd(e){e=A(e,A.EMPTY_OBJECT),this._batchTable=e.batchTable,this._batchIds=e.batchIds,this._positions=e.positions,this._vertexBatchIds=e.vertexBatchIds,this._indices=e.indices,this._indexCounts=e.indexCounts,this._indexOffsets=e.indexOffsets,this._batchedIndices=e.batchedIndices,this._boundingVolume=e.boundingVolume,this._boundingVolumes=e.boundingVolumes,this._center=A(e.center,d.ZERO),this._va=void 0,this._sp=void 0,this._spStencil=void 0,this._spPick=void 0,this._uniformMap=void 0,this._vaSwap=void 0,this._rsStencilDepthPass=void 0,this._rsStencilDepthPass3DTiles=void 0,this._rsColorPass=void 0,this._rsPickPass=void 0,this._rsWireframe=void 0,this._commands=[],this._commandsIgnoreShow=[],this._pickCommands=[],this._constantColor=k.clone(k.WHITE),this._highlightColor=this._constantColor,this._batchDirty=!0,this._pickCommandsDirty=!0,this._framesSinceLastRebatch=0,this._updatingAllCommands=!1,this._trianglesLength=this._indices.length/3,this._geometryByteLength=this._indices.byteLength+this._positions.byteLength+this._vertexBatchIds.byteLength,this.debugWireframe=!1,this._debugWireframe=this.debugWireframe,this._wireframeDirty=!1,this.forceRebatch=!1,this.classificationType=A(e.classificationType,ir.BOTH),this._vertexShaderSource=e._vertexShaderSource,this._fragmentShaderSource=e._fragmentShaderSource,this._attributeLocations=e._attributeLocations,this._uniformMap=e._uniformMap,this._pickId=e._pickId,this._modelMatrix=e._modelMatrix,this._boundingSphere=e._boundingSphere,this._batchIdLookUp={};const t=this._batchIds.length;for(let n=0;n<t;++n){const i=this._batchIds[n];this._batchIdLookUp[i]=n}}Object.defineProperties(Hd.prototype,{trianglesLength:{get:function(){return this._trianglesLength}},geometryByteLength:{get:function(){return this._geometryByteLength}}});const GYe={position:0,a_batchId:1};function WYe(e,t){if(l(e._va))return;const n=Mt.createVertexBuffer({context:t,typedArray:e._positions,usage:mt.STATIC_DRAW}),i=Mt.createVertexBuffer({context:t,typedArray:e._vertexBatchIds,usage:mt.STATIC_DRAW}),o=Mt.createIndexBuffer({context:t,typedArray:e._indices,usage:mt.DYNAMIC_DRAW,indexDatatype:e._indices.BYTES_PER_ELEMENT===2?At.UNSIGNED_SHORT:At.UNSIGNED_INT}),r=[{index:0,vertexBuffer:n,componentDatatype:oe.fromTypedArray(e._positions),componentsPerAttribute:3},{index:1,vertexBuffer:i,componentDatatype:oe.fromTypedArray(e._vertexBatchIds),componentsPerAttribute:1}];e._va=new Fo({context:t,attributes:r,indexBuffer:o}),t.webgl2&&(e._vaSwap=new Fo({context:t,attributes:r,indexBuffer:Mt.createIndexBuffer({context:t,sizeInBytes:o.sizeInBytes,usage:mt.DYNAMIC_DRAW,indexDatatype:o.indexDatatype})})),e._batchedPositions=void 0,e._transferrableBatchIds=void 0,e._vertexBatchIds=void 0,e._verticesPromise=void 0}function qYe(e,t){if(l(e._sp))return;const n=e._batchTable,i=A(e._attributeLocations,GYe);let o=e._pickId;const r=e._vertexShaderSource;let s=e._fragmentShaderSource;if(l(r)){e._sp=Hn.fromCache({context:t,vertexShaderSource:r,fragmentShaderSource:s,attributeLocations:i}),e._spStencil=e._sp,s=nt.replaceMain(s,"czm_non_pick_main"),s=`${s}void main()
|
||
{
|
||
czm_non_pick_main();
|
||
gl_FragColor = ${o};
|
||
}
|
||
`,e._spPick=Hn.fromCache({context:t,vertexShaderSource:r,fragmentShaderSource:s,attributeLocations:i});return}const a=n.getVertexShaderCallback(!1,"a_batchId",void 0)(M5);let c=n.getFragmentShaderCallback(!1,void 0,!0)(YM);o=n.getPickId();let u=new nt({sources:[a]}),f=new nt({defines:["VECTOR_TILE"],sources:[c]});e._sp=Hn.fromCache({context:t,vertexShaderSource:u,fragmentShaderSource:f,attributeLocations:i}),u=new nt({sources:[M5]}),f=new nt({defines:["VECTOR_TILE"],sources:[YM]}),e._spStencil=Hn.fromCache({context:t,vertexShaderSource:u,fragmentShaderSource:f,attributeLocations:i}),c=nt.replaceMain(c,"czm_non_pick_main"),c=`${c}
|
||
void main()
|
||
{
|
||
czm_non_pick_main();
|
||
gl_FragColor = ${o};
|
||
}
|
||
`;const h=new nt({sources:[a]}),_=new nt({defines:["VECTOR_TILE"],sources:[c]});e._spPick=Hn.fromCache({context:t,vertexShaderSource:h,fragmentShaderSource:_,attributeLocations:i})}function V9(e){const t=e?Ni.EQUAL:Ni.ALWAYS;return{colorMask:{red:!1,green:!1,blue:!1,alpha:!1},stencilTest:{enabled:!0,frontFunction:t,frontOperation:{fail:It.KEEP,zFail:It.DECREMENT_WRAP,zPass:It.KEEP},backFunction:t,backOperation:{fail:It.KEEP,zFail:It.INCREMENT_WRAP,zPass:It.KEEP},reference:Kt.CESIUM_3D_TILE_MASK,mask:Kt.CESIUM_3D_TILE_MASK},stencilMask:Kt.CLASSIFICATION_MASK,depthTest:{enabled:!0,func:ty.LESS_OR_EQUAL},depthMask:!1}}const jYe={stencilTest:{enabled:!0,frontFunction:Ni.NOT_EQUAL,frontOperation:{fail:It.ZERO,zFail:It.ZERO,zPass:It.ZERO},backFunction:Ni.NOT_EQUAL,backOperation:{fail:It.ZERO,zFail:It.ZERO,zPass:It.ZERO},reference:0,mask:Kt.CLASSIFICATION_MASK},stencilMask:Kt.CLASSIFICATION_MASK,depthTest:{enabled:!1},depthMask:!1,blending:fo.PRE_MULTIPLIED_ALPHA_BLEND},YYe={stencilTest:{enabled:!0,frontFunction:Ni.NOT_EQUAL,frontOperation:{fail:It.ZERO,zFail:It.ZERO,zPass:It.ZERO},backFunction:Ni.NOT_EQUAL,backOperation:{fail:It.ZERO,zFail:It.ZERO,zPass:It.ZERO},reference:0,mask:Kt.CLASSIFICATION_MASK},stencilMask:Kt.CLASSIFICATION_MASK,depthTest:{enabled:!1},depthMask:!1};function $Ye(e){l(e._rsStencilDepthPass)||(e._rsStencilDepthPass=ht.fromCache(V9(!1)),e._rsStencilDepthPass3DTiles=ht.fromCache(V9(!0)),e._rsColorPass=ht.fromCache(jYe),e._rsPickPass=ht.fromCache(YYe))}const ng=new N,k9=new d;function XYe(e,t){if(l(e._uniformMap))return;const n={u_modifiedModelViewProjection:function(){const i=t.uniformState.view,o=t.uniformState.projection;return N.clone(i,ng),N.multiplyByPoint(ng,e._center,k9),N.setTranslation(ng,k9,ng),N.multiply(o,ng,ng),ng},u_highlightColor:function(){return e._highlightColor}};e._uniformMap=e._batchTable.getUniformMapCallback()(n)}function DR(e,t,n,i,o,r,s){const a=e.constructor.BYTES_PER_ELEMENT,c=r.length;for(let u=0;u<c;++u){const f=r[u],h=s[f],_=i[h],g=o[h],p=new e.constructor(e.buffer,a*_,g);t.set(p,n),i[h]=n,n+=g}return n}function KYe(e,t){const n=e._indices,i=e._indexOffsets,o=e._indexCounts,r=e._batchIdLookUp,s=new n.constructor(n.length);let a=t.pop();const c=[a];let u=DR(n,s,0,i,o,a.batchIds,r);for(a.offset=0,a.count=u;t.length>0;){const f=t.pop();if(k.equals(f.color,a.color))u=DR(n,s,u,i,o,f.batchIds,r),a.batchIds=a.batchIds.concat(f.batchIds),a.count=u-a.offset;else{const h=u;u=DR(n,s,u,i,o,f.batchIds,r),f.offset=h,f.count=u-h,c.push(f),a=f}}e._va.indexBuffer.copyFromArrayView(s),e._indices=s,e._batchedIndices=c}function IR(e,t,n,i,o,r,s){const a=e.bytesPerIndex,c=r.length;for(let u=0;u<c;++u){const f=r[u],h=s[f],_=i[h],g=o[h];t.copyFromBuffer(e,_*a,n*a,g*a),i[h]=n,n+=g}return n}function JYe(e,t){const n=e._indexOffsets,i=e._indexCounts,o=e._batchIdLookUp;let r=t.pop();const s=[r],a=e._va.indexBuffer,c=e._vaSwap.indexBuffer;let u=IR(a,c,0,n,i,r.batchIds,o);for(r.offset=0,r.count=u;t.length>0;){const h=t.pop();if(k.equals(h.color,r.color))u=IR(a,c,u,n,i,h.batchIds,o),r.batchIds=r.batchIds.concat(h.batchIds),r.count=u-r.offset;else{const _=u;u=IR(a,c,u,n,i,h.batchIds,o),h.offset=_,h.count=u-_,s.push(h),r=h}}const f=e._va;e._va=e._vaSwap,e._vaSwap=f,e._batchedIndices=s}function QYe(e,t){return t.color.toRgba()-e.color.toRgba()}function ZYe(e,t){if(!e._batchDirty)return!1;const n=e._batchedIndices,i=n.length;let o=!1;const r={};for(let s=0;s<i;++s){const c=n[s].color.toRgba();if(l(r[c])){o=!0;break}else r[c]=!0}if(!o)return e._batchDirty=!1,!1;if(o&&!e.forceRebatch&&e._framesSinceLastRebatch<120){++e._framesSinceLastRebatch;return}return n.sort(QYe),t.webgl2?JYe(e,n):KYe(e,n),e._framesSinceLastRebatch=0,e._batchDirty=!1,e._pickCommandsDirty=!0,e._wireframeDirty=!0,!0}function e$e(e,t){const n=ZYe(e,t),i=e._commands,o=e._batchedIndices,r=o.length,s=r*2;if(l(i)&&!n&&i.length===s)return;i.length=s;const a=e._va,c=e._sp,u=A(e._modelMatrix,N.IDENTITY),f=e._uniformMap,h=e._boundingVolume;for(let _=0;_<r;++_){const g=o[_].offset,p=o[_].count;let y=i[_*2];l(y)||(y=i[_*2]=new Dt({owner:e})),y.vertexArray=a,y.modelMatrix=u,y.offset=g,y.count=p,y.renderState=e._rsStencilDepthPass,y.shaderProgram=c,y.uniformMap=f,y.boundingVolume=h,y.cull=!1,y.pass=We.TERRAIN_CLASSIFICATION;const T=Dt.shallowClone(y,y.derivedCommands.tileset);T.renderState=e._rsStencilDepthPass3DTiles,T.pass=We.CESIUM_3D_TILE_CLASSIFICATION,y.derivedCommands.tileset=T;let b=i[_*2+1];l(b)||(b=i[_*2+1]=new Dt({owner:e})),b.vertexArray=a,b.modelMatrix=u,b.offset=g,b.count=p,b.renderState=e._rsColorPass,b.shaderProgram=c,b.uniformMap=f,b.boundingVolume=h,b.cull=!1,b.pass=We.TERRAIN_CLASSIFICATION;const x=Dt.shallowClone(b,b.derivedCommands.tileset);x.pass=We.CESIUM_3D_TILE_CLASSIFICATION,b.derivedCommands.tileset=x}e._commandsDirty=!0}function t$e(e,t){if(e.classificationType===ir.TERRAIN||!t.invertClassification||l(e._commandsIgnoreShow)&&!e._commandsDirty)return;const n=e._commands,i=e._commandsIgnoreShow,o=e._spStencil,r=n.length,s=i.length=r/2;let a=0;for(let c=0;c<s;++c){const u=i[c]=Dt.shallowClone(n[a],i[c]);u.shaderProgram=o,u.pass=We.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW,a+=2}e._commandsDirty=!1}function n$e(e){if(!e._pickCommandsDirty)return;const t=e._indexOffsets.length,n=e._pickCommands;n.length=t*2;const i=e._va,o=e._spStencil,r=e._spPick,s=A(e._modelMatrix,N.IDENTITY),a=e._uniformMap;for(let c=0;c<t;++c){const u=e._indexOffsets[c],f=e._indexCounts[c],h=l(e._boundingVolumes)?e._boundingVolumes[c]:e.boundingVolume;let _=n[c*2];l(_)||(_=n[c*2]=new Dt({owner:e,pickOnly:!0})),_.vertexArray=i,_.modelMatrix=s,_.offset=u,_.count=f,_.renderState=e._rsStencilDepthPass,_.shaderProgram=o,_.uniformMap=a,_.boundingVolume=h,_.pass=We.TERRAIN_CLASSIFICATION;const g=Dt.shallowClone(_,_.derivedCommands.tileset);g.renderState=e._rsStencilDepthPass3DTiles,g.pass=We.CESIUM_3D_TILE_CLASSIFICATION,_.derivedCommands.tileset=g;let p=n[c*2+1];l(p)||(p=n[c*2+1]=new Dt({owner:e,pickOnly:!0})),p.vertexArray=i,p.modelMatrix=s,p.offset=u,p.count=f,p.renderState=e._rsPickPass,p.shaderProgram=r,p.uniformMap=a,p.boundingVolume=h,p.pass=We.TERRAIN_CLASSIFICATION;const y=Dt.shallowClone(p,p.derivedCommands.tileset);y.pass=We.CESIUM_3D_TILE_CLASSIFICATION,p.derivedCommands.tileset=y}e._pickCommandsDirty=!1}Hd.prototype.createFeatures=function(e,t){const n=this._batchIds,i=n.length;for(let o=0;o<i;++o){const r=n[o];t[r]=new Js(e,r)}};Hd.prototype.applyDebugSettings=function(e,t){this._highlightColor=e?t:this._constantColor};function i$e(e,t){e._updatingAllCommands=!0;const n=e._batchIds;let i=n.length,o;for(o=0;o<i;++o){const s=n[o],a=t[s];a.show=!0,a.color=k.WHITE}const r=e._batchedIndices;for(i=r.length,o=0;o<i;++o)r[o].color=k.clone(k.WHITE);e._updatingAllCommands=!1,e._batchDirty=!0}const o$e=new k,r$e=k.WHITE,s$e=!0,a$e=/\$/;Hd.prototype.applyStyle=function(e,t){if(!l(e)){i$e(this,t);return}const n=e.color,i=n instanceof yf&&!a$e.test(n.expression);this._updatingAllCommands=i;const o=this._batchIds;let r=o.length,s;for(s=0;s<r;++s){const a=o[s],c=t[a];c.color=l(e.color)?e.color.evaluateColor(c,o$e):r$e,c.show=l(e.show)?e.show.evaluate(c):s$e}if(i){const a=this._batchedIndices;for(r=a.length,s=0;s<r;++s)a[s].color=k.clone(k.WHITE);this._updatingAllCommands=!1,this._batchDirty=!0}};Hd.prototype.updateCommands=function(e,t){if(this._updatingAllCommands)return;const n=this._batchIdLookUp,i=n[e];if(!l(i))return;const o=this._indexOffsets,r=this._indexCounts,s=o[i],a=r[i],c=this._batchedIndices,u=c.length;let f;for(f=0;f<u;++f){const y=c[f].offset,T=c[f].count;if(s>=y&&s<y+T)break}c.push(new YI({color:k.clone(t),offset:s,count:a,batchIds:[e]}));const h=[],_=[],g=c[f].batchIds,p=g.length;for(let y=0;y<p;++y){const T=g[y];if(T===e)continue;const b=n[T];o[b]<s?h.push(T):_.push(T)}_.length!==0&&c.push(new YI({color:k.clone(c[f].color),offset:s+a,count:c[f].offset+c[f].count-(s+a),batchIds:_})),h.length!==0?(c[f].count=s-c[f].offset,c[f].batchIds=h):c.splice(f,1),this._batchDirty=!0};function G9(e,t,n,i){const o=e.classificationType,r=o!==ir.CESIUM_3D_TILE,s=o!==ir.TERRAIN,a=t.commandList;let c=n.length,u,f;for(f=0;f<c;++f)r&&(u=n[f],u.pass=We.TERRAIN_CLASSIFICATION,a.push(u)),s&&(u=n[f].derivedCommands.tileset,u.pass=We.CESIUM_3D_TILE_CLASSIFICATION,a.push(u));if(!(!t.invertClassification||!l(i)))for(c=i.length,f=0;f<c;++f)a.push(i[f])}function c$e(e,t){const n=e.commandList,i=t.length;for(let o=0;o<i;o+=2){const r=t[o+1];r.pass=We.OPAQUE,n.push(r)}}function l$e(e){let t=e.debugWireframe===e._debugWireframe;if(t=t&&!(e.debugWireframe&&e._wireframeDirty),t)return;l(e._rsWireframe)||(e._rsWireframe=ht.fromCache({}));let n,i;e.debugWireframe?(n=e._rsWireframe,i=dt.LINES):(n=e._rsColorPass,i=dt.TRIANGLES);const o=e._commands,r=o.length;for(let s=0;s<r;s+=2){const a=o[s+1];a.renderState=n,a.primitiveType=i}e._debugWireframe=e.debugWireframe,e._wireframeDirty=!1}Hd.prototype.update=function(e){const t=e.context;WYe(this,t),qYe(this,t),$Ye(this),XYe(this,t);const n=e.passes;n.render&&(e$e(this,t),t$e(this,e),l$e(this),this._debugWireframe?c$e(e,this._commands):G9(this,e,this._commands,this._commandsIgnoreShow)),n.pick&&(n$e(this),G9(this,e,this._pickCommands))};Hd.prototype.isDestroyed=function(){return!1};Hd.prototype.destroy=function(){return this._va=this._va&&this._va.destroy(),this._sp=this._sp&&this._sp.destroy(),this._spPick=this._spPick&&this._spPick.destroy(),this._vaSwap=this._vaSwap&&this._vaSwap.destroy(),Je(this)};function la(e){this._boxes=e.boxes,this._boxBatchIds=e.boxBatchIds,this._cylinders=e.cylinders,this._cylinderBatchIds=e.cylinderBatchIds,this._ellipsoids=e.ellipsoids,this._ellipsoidBatchIds=e.ellipsoidBatchIds,this._spheres=e.spheres,this._sphereBatchIds=e.sphereBatchIds,this._modelMatrix=e.modelMatrix,this._batchTable=e.batchTable,this._boundingVolume=e.boundingVolume,this._center=e.center,l(this._center)||(l(this._boundingVolume)?this._center=d.clone(this._boundingVolume.center):this._center=d.clone(d.ZERO)),this._boundingVolumes=void 0,this._batchedIndices=void 0,this._indices=void 0,this._indexOffsets=void 0,this._indexCounts=void 0,this._positions=void 0,this._vertexBatchIds=void 0,this._batchIds=void 0,this._batchTableColors=void 0,this._packedBuffer=void 0,this._ready=!1,this._update=function(t,n){},this._readyPromise=_$e(this),this._verticesPromise=void 0,this._primitive=void 0,this.debugWireframe=!1,this.forceRebatch=!1,this.classificationType=ir.BOTH}Object.defineProperties(la.prototype,{trianglesLength:{get:function(){return l(this._primitive)?this._primitive.trianglesLength:0}},geometryByteLength:{get:function(){return l(this._primitive)?this._primitive.geometryByteLength:0}},readyPromise:{get:function(){return this._readyPromise}}});la.packedBoxLength=N.packedLength+d.packedLength;la.packedCylinderLength=N.packedLength+2;la.packedEllipsoidLength=N.packedLength+d.packedLength;la.packedSphereLength=d.packedLength+1;function u$e(e){const t=new Float64Array(N.packedLength+d.packedLength);let n=0;return d.pack(e._center,t,n),n+=d.packedLength,N.pack(e._modelMatrix,t,n),t}function f$e(e,t){let n=0;const i=t[n++],o=t[n++],r=e._boundingVolumes=new Array(o);for(let c=0;c<o;++c)r[c]=Ae.unpack(t,n),n+=Ae.packedLength;const s=t[n++],a=e._batchedIndices=new Array(s);for(let c=0;c<s;++c){const u=k.unpack(t,n);n+=k.packedLength;const f=t[n++],h=t[n++],_=t[n++],g=new Array(_);for(let p=0;p<_;++p)g[p]=t[n++];a[c]=new YI({color:u,offset:f,count:h,batchIds:g})}return i}const d$e=new lo("createVectorTileGeometries",5),h$e=new k;function p$e(e){if(!l(e._primitive)&&!l(e._verticesPromise)){let t=e._boxes,n=e._boxBatchIds,i=e._cylinders,o=e._cylinderBatchIds,r=e._ellipsoids,s=e._ellipsoidBatchIds,a=e._spheres,c=e._sphereBatchIds,u=e._batchTableColors,f=e._packedBuffer;if(!l(u)){let p=0;l(e._boxes)&&(t=e._boxes=t.slice(),n=e._boxBatchIds=n.slice(),p+=n.length),l(e._cylinders)&&(i=e._cylinders=i.slice(),o=e._cylinderBatchIds=o.slice(),p+=o.length),l(e._ellipsoids)&&(r=e._ellipsoids=r.slice(),s=e._ellipsoidBatchIds=s.slice(),p+=s.length),l(e._spheres)&&(a=e._sphere=a.slice(),c=e._sphereBatchIds=c.slice(),p+=c.length),u=e._batchTableColors=new Uint32Array(p);const y=e._batchTable;for(let T=0;T<p;++T){const b=y.getColor(T,h$e);u[T]=b.toRgba()}f=e._packedBuffer=u$e(e)}const h=[];l(t)&&h.push(t.buffer,n.buffer),l(i)&&h.push(i.buffer,o.buffer),l(r)&&h.push(r.buffer,s.buffer),l(a)&&h.push(a.buffer,c.buffer),h.push(u.buffer,f.buffer);const _={boxes:l(t)?t.buffer:void 0,boxBatchIds:l(t)?n.buffer:void 0,cylinders:l(i)?i.buffer:void 0,cylinderBatchIds:l(i)?o.buffer:void 0,ellipsoids:l(r)?r.buffer:void 0,ellipsoidBatchIds:l(r)?s.buffer:void 0,spheres:l(a)?a.buffer:void 0,sphereBatchIds:l(a)?c.buffer:void 0,batchTableColors:u.buffer,packedBuffer:f.buffer},g=e._verticesPromise=d$e.scheduleTask(_,h);return l(g)?g.then(function(p){const y=new Float64Array(p.packedBuffer);f$e(e,y)===2?e._indices=new Uint16Array(p.indices):e._indices=new Uint32Array(p.indices),e._indexOffsets=new Uint32Array(p.indexOffsets),e._indexCounts=new Uint32Array(p.indexCounts),e._positions=new Float32Array(p.positions),e._vertexBatchIds=new Uint16Array(p.vertexBatchIds),e._batchIds=new Uint16Array(p.batchIds),e._ready=!0}):void 0}}function m$e(e){e._ready&&!l(e._primitive)&&(e._primitive=new Hd({batchTable:e._batchTable,positions:e._positions,batchIds:e._batchIds,vertexBatchIds:e._vertexBatchIds,indices:e._indices,indexOffsets:e._indexOffsets,indexCounts:e._indexCounts,batchedIndices:e._batchedIndices,boundingVolume:e._boundingVolume,boundingVolumes:e._boundingVolumes,center:e._center,pickObject:A(e._pickObject,e)}),e._boxes=void 0,e._boxBatchIds=void 0,e._cylinders=void 0,e._cylinderBatchIds=void 0,e._ellipsoids=void 0,e._ellipsoidBatchIds=void 0,e._spheres=void 0,e._sphereBatchIds=void 0,e._center=void 0,e._modelMatrix=void 0,e._batchTable=void 0,e._boundingVolume=void 0,e._boundingVolumes=void 0,e._batchedIndices=void 0,e._indices=void 0,e._indexOffsets=void 0,e._indexCounts=void 0,e._positions=void 0,e._vertexBatchIds=void 0,e._batchIds=void 0,e._batchTableColors=void 0,e._packedBuffer=void 0,e._verticesPromise=void 0)}la.prototype.createFeatures=function(e,t){this._primitive.createFeatures(e,t)};la.prototype.applyDebugSettings=function(e,t){this._primitive.applyDebugSettings(e,t)};la.prototype.applyStyle=function(e,t){this._primitive.applyStyle(e,t)};la.prototype.updateCommands=function(e,t){this._primitive.updateCommands(e,t)};function _$e(e){return new Promise(function(t,n){e._update=function(i,o){const r=p$e(i);i._ready&&(i._primitive.debugWireframe=i.debugWireframe,i._primitive.forceRebatch=i.forceRebatch,i._primitive.classificationType=i.classificationType,i._primitive.update(o)),l(r)&&r.then(function(){m$e(i),t(i)}).catch(function(s){n(s)})}})}la.prototype.update=function(e){this._update(this,e)};la.prototype.isDestroyed=function(){return!1};la.prototype.destroy=function(){return this._primitive=this._primitive&&this._primitive.destroy(),Je(this)};function _p(e,t,n,i,o){this._tileset=e,this._tile=t,this._resource=n,this._geometries=void 0,this._metadata=void 0,this._batchTable=void 0,this._features=void 0,this.featurePropertiesDirty=!1,this._group=void 0,this._readyPromise=A$e(this,i,o)}Object.defineProperties(_p.prototype,{featuresLength:{get:function(){return l(this._batchTable)?this._batchTable.featuresLength:0}},pointsLength:{get:function(){return 0}},trianglesLength:{get:function(){return l(this._geometries)?this._geometries.trianglesLength:0}},geometryByteLength:{get:function(){return l(this._geometries)?this._geometries.geometryByteLength:0}},texturesByteLength:{get:function(){return 0}},batchTableByteLength:{get:function(){return l(this._batchTable)?this._batchTable.batchTableByteLength:0}},innerContents:{get:function(){}},readyPromise:{get:function(){return this._readyPromise}},tileset:{get:function(){return this._tileset}},tile:{get:function(){return this._tile}},url:{get:function(){return this._resource.getUrlComponent(!0)}},metadata:{get:function(){return this._metadata},set:function(e){this._metadata=e}},batchTable:{get:function(){return this._batchTable}},group:{get:function(){return this._group},set:function(e){this._group=e}}});function g$e(e){return function(t,n){l(e._geometries)&&e._geometries.updateCommands(t,n)}}function y$e(e,t){let n,i,o,r,s;const a=A(e.BOXES_LENGTH,0),c=A(e.CYLINDERS_LENGTH,0),u=A(e.ELLIPSOIDS_LENGTH,0),f=A(e.SPHERES_LENGTH,0);if(a>0&&l(e.BOX_BATCH_IDS)){const p=t.byteOffset+e.BOX_BATCH_IDS.byteOffset;n=new Uint16Array(t.buffer,p,a)}if(c>0&&l(e.CYLINDER_BATCH_IDS)){const p=t.byteOffset+e.CYLINDER_BATCH_IDS.byteOffset;i=new Uint16Array(t.buffer,p,c)}if(u>0&&l(e.ELLIPSOID_BATCH_IDS)){const p=t.byteOffset+e.ELLIPSOID_BATCH_IDS.byteOffset;o=new Uint16Array(t.buffer,p,u)}if(f>0&&l(e.SPHERE_BATCH_IDS)){const p=t.byteOffset+e.SPHERE_BATCH_IDS.byteOffset;r=new Uint16Array(t.buffer,p,f)}const h=l(n)||l(i)||l(o)||l(r),_=a>0&&!l(n)||c>0&&!l(i)||u>0&&!l(o)||f>0&&!l(r);if(h&&_)throw new Fe("If one group of batch ids is defined, then all batch ids must be defined.");if(!l(n)&&!l(i)&&!l(o)&&!l(r)){let p=0;if(!l(n)&&a>0)for(n=new Uint16Array(a),s=0;s<a;++s)n[s]=p++;if(!l(i)&&c>0)for(i=new Uint16Array(c),s=0;s<c;++s)i[s]=p++;if(!l(o)&&u>0)for(o=new Uint16Array(u),s=0;s<u;++s)o[s]=p++;if(!l(r)&&f>0)for(r=new Uint16Array(f),s=0;s<f;++s)r[s]=p++}return{boxes:n,cylinders:i,ellipsoids:o,spheres:r}}const ig=Uint32Array.BYTES_PER_ELEMENT;function A$e(e,t,n){n=A(n,0);const i=new Uint8Array(t),o=new DataView(t);n+=ig;const r=o.getUint32(n,!0);if(r!==1)throw new Fe(`Only Geometry tile version 1 is supported. Version ${r} is not.`);n+=ig;const s=o.getUint32(n,!0);if(n+=ig,s===0){e._readyPromise.resolve(e);return}const a=o.getUint32(n,!0);if(n+=ig,a===0)throw new Fe("Feature table must have a byte length greater than zero");const c=o.getUint32(n,!0);n+=ig;const u=o.getUint32(n,!0);n+=ig;const f=o.getUint32(n,!0);n+=ig;const h=zc(i,n,a);n+=a;const _=new Uint8Array(t,n,c);n+=c;let g,p;u>0&&(g=zc(i,n,u),n+=u,f>0&&(p=new Uint8Array(t,n,f),p=new Uint8Array(p)));const y=A(h.BOXES_LENGTH,0),T=A(h.CYLINDERS_LENGTH,0),b=A(h.ELLIPSOIDS_LENGTH,0),x=A(h.SPHERES_LENGTH,0),v=y+T+b+x,D=new $i(e,v,g,p,g$e(e));if(e._batchTable=D,v===0)return;const L=e.tile.computedTransform;let B;l(h.RTC_CENTER)&&(B=d.unpack(h.RTC_CENTER),N.multiplyByPoint(L,B,B));const V=y$e(h,_);if(y>0||T>0||b>0||x>0){let M,H,G,I;if(y>0){const O=_.byteOffset+h.BOXES.byteOffset;M=new Float32Array(_.buffer,O,la.packedBoxLength*y)}if(T>0){const O=_.byteOffset+h.CYLINDERS.byteOffset;H=new Float32Array(_.buffer,O,la.packedCylinderLength*T)}if(b>0){const O=_.byteOffset+h.ELLIPSOIDS.byteOffset;G=new Float32Array(_.buffer,O,la.packedEllipsoidLength*b)}if(x>0){const O=_.byteOffset+h.SPHERES.byteOffset;I=new Float32Array(_.buffer,O,la.packedSphereLength*x)}return e._geometries=new la({boxes:M,boxBatchIds:V.boxes,cylinders:H,cylinderBatchIds:V.cylinders,ellipsoids:G,ellipsoidBatchIds:V.ellipsoids,spheres:I,sphereBatchIds:V.spheres,center:B,modelMatrix:L,batchTable:D,boundingVolume:e.tile.boundingVolume.boundingVolume}),e._geometries.readyPromise.then(function(){return e})}return Promise.resolve(e)}function bte(e){const t=e.featuresLength;if(!l(e._features)&&t>0){const n=new Array(t);l(e._geometries)&&e._geometries.createFeatures(e,n),e._features=n}}_p.prototype.hasProperty=function(e,t){return this._batchTable.hasProperty(e,t)};_p.prototype.getFeature=function(e){const t=this.featuresLength;if(!l(e)||e<0||e>=t)throw new w(`batchId is required and between zero and featuresLength - 1 (${t-1}).`);return bte(this),this._features[e]};_p.prototype.applyDebugSettings=function(e,t){l(this._geometries)&&this._geometries.applyDebugSettings(e,t)};_p.prototype.applyStyle=function(e){bte(this),l(this._geometries)&&this._geometries.applyStyle(e,this._features)};_p.prototype.update=function(e,t){l(this._geometries)&&(this._geometries.classificationType=this._tileset.classificationType,this._geometries.debugWireframe=this._tileset.debugWireframe,this._geometries.update(t)),l(this._batchTable)&&this._geometries._ready&&this._batchTable.update(e,t)};_p.prototype.isDestroyed=function(){return!1};_p.prototype.destroy=function(){return this._geometries=this._geometries&&this._geometries.destroy(),this._batchTable=this._batchTable&&this._batchTable.destroy(),Je(this)};const sU={};sU.encode2D=function(e,t,n){const i=Math.pow(2,e);if(E.typeOf.number("level",e),E.typeOf.number("x",t),E.typeOf.number("y",n),e<1)throw new w("Hilbert level cannot be less than 1.");if(t<0||t>=i||n<0||n>=i)throw new w("Invalid coordinates for given level.");const o={x:t,y:n};let r,s,a,c=BigInt(0);for(a=i/2;a>0;a/=2)r=(o.x&a)>0?1:0,s=(o.y&a)>0?1:0,c+=BigInt((3*r^s)*a*a),Ete(i,o,r,s);return c};sU.decode2D=function(e,t){if(E.typeOf.number("level",e),E.typeOf.bigint("index",t),e<1)throw new w("Hilbert level cannot be less than 1.");if(t<BigInt(0)||t>=BigInt(Math.pow(4,e)))throw new w("Hilbert index exceeds valid maximum for given level.");const n=Math.pow(2,e),i={x:0,y:0};let o,r,s,a;for(s=1,a=t;s<n;s*=2)o=1&Number(a/BigInt(2)),r=1&Number(a^BigInt(o)),Ete(s,i,o,r),i.x+=s*o,i.y+=s*r,a/=BigInt(4);return[i.x,i.y]};function Ete(e,t,n,i){if(i!==0)return;n===1&&(t.x=e-1-t.x,t.y=e-1-t.y);const o=t.x;t.x=t.y,t.y=o}const W9=sU,E_=30,T$e=1<<E_,C$e=1<<E_+1>>>0,aU=2*E_+1,ym=4,xte=[],wte=[],b$e=[[0,1,3,2],[0,2,3,1],[3,2,0,1],[3,1,0,2]],Dm=1,_A=2,xv=[Dm,0,0,Dm|_A];function vo(e){if(!Mn.supportsBigInt())throw new Fe("S2 required BigInt support");if(!l(e))throw new w("cell ID is required.");if(!vo.isValidId(e))throw new w("cell ID is invalid.");this._cellId=e,this._level=vo.getLevel(e)}vo.fromToken=function(e){if(E.typeOf.string("token",e),!vo.isValidToken(e))throw new w("token is invalid.");return new vo(vo.getIdFromToken(e))};vo.isValidId=function(e){return E.typeOf.bigint("cellId",e),!(e<=0||e>>BigInt(aU)>5||!(e&~e+BigInt(1)&BigInt("0x1555555555555555")))};vo.isValidToken=function(e){return E.typeOf.string("token",e),/^[0-9a-fA-F]{1,16}$/.test(e)?vo.isValidId(vo.getIdFromToken(e)):!1};vo.getIdFromToken=function(e){return E.typeOf.string("token",e),BigInt("0x"+e+"0".repeat(16-e.length))};vo.getTokenFromId=function(e){E.typeOf.bigint("cellId",e);const t=Math.floor(L$e(e)/4),n=e.toString(16).replace(/0*$/,"");return Array(17-t-n.length).join("0")+n};vo.getLevel=function(e){if(E.typeOf.bigint("cellId",e),!vo.isValidId(e))throw new w;let t=0;for(;e!==BigInt(0)&&!(e&BigInt(1));)t++,e=e>>BigInt(1);return E_-(t>>1)};vo.prototype.getChild=function(e){if(E.typeOf.number("index",e),e<0||e>3)throw new w("child index must be in the range [0-3].");if(this._level===30)throw new w("cannot get child of leaf cell.");const t=Dte(this._cellId)>>BigInt(2),n=this._cellId+BigInt(2*e+1-4)*t;return new vo(n)};vo.prototype.getParent=function(){if(this._level===0)throw new w("cannot get parent of root cell.");const e=Dte(this._cellId)<<BigInt(2);return new vo(this._cellId&~e+BigInt(1)|e)};vo.prototype.getParentAtLevel=function(e){if(this._level===0||e<0||this._level<e)throw new w("cannot get parent at invalid level.");const t=P$e(e);return new vo(this._cellId&-t|t)};vo.prototype.getCenter=function(e){e=A(e,be.WGS84);let t=E$e(this._cellId,this._level);t=d.normalize(t,t);const n=new ve.fromCartesian(t,be.UNIT_SPHERE);return ve.toCartesian(n,e,new d)};vo.prototype.getVertex=function(e,t){if(E.typeOf.number("index",e),e<0||e>3)throw new w("vertex index must be in the range [0-3].");t=A(t,be.WGS84);let n=x$e(this._cellId,this._level,e);n=d.normalize(n,n);const i=new ve.fromCartesian(n,be.UNIT_SPHERE);return ve.toCartesian(i,t,new d)};vo.fromFacePositionLevel=function(e,t,n){if(E.typeOf.bigint("position",t),e<0||e>5)throw new w("Invalid S2 Face (must be within 0-5)");if(n<0||n>E_)throw new w("Invalid level (must be within 0-30)");if(t<0||t>=Math.pow(4,n))throw new w("Invalid Hilbert position for level");const i=(e<4?"0":"")+(e<2?"0":"")+e.toString(2),o=t.toString(2),r=Array(2*n-o.length+1).join("0"),s=Array(aU-2*n).join("0"),a=BigInt(`0b${i}${r}${o}1${s}`);return new vo(a)};function E$e(e,t){const n=w$e(e,t);return S$e(n[0],n[1],n[2])}function x$e(e,t,n){const i=Ste(e),o=v$e([i[1],i[2]],t),r=n>>1&1;return vte(i[0],o[0][r^n&1],o[1][r])}function w$e(e,t){const n=Ste(e),i=n[0],o=n[1],r=n[2],s=t===30,a=!s&&(BigInt(o)^e>>BigInt(2))&BigInt(1),c=s?1:a?2:0,u=(o<<1)+c,f=(r<<1)+c;return[i,u,f]}function Ste(e){xte.length===0&&I$e();const t=Number(e>>BigInt(aU));let n=t&Dm;const i=(1<<ym)-1;let o=0,r=0;for(let s=7;s>=0;s--){const c=(1<<2*(s===7?E_-7*ym:ym))-1;n+=Number(e>>BigInt(s*2*ym+1)&BigInt(c))<<2,n=wte[n];const u=s*ym;o+=n>>ym+2<<u,r+=(n>>2&i)<<u,n&=Dm|_A}return[t,o,r]}function S$e(e,t,n){const i=q9(t),o=q9(n),r=XI(i),s=XI(o);return vte(e,r,s)}function vte(e,t,n){switch(e){case 0:return new d(1,t,n);case 1:return new d(-t,1,n);case 2:return new d(-t,-n,1);case 3:return new d(-1,-n,-t);case 4:return new d(n,-1,-t);default:return new d(n,t,-1)}}function XI(e){return e>=.5?1/3*(4*e*e-1):1/3*(1-4*(1-e)*(1-e))}function q9(e){return 1/C$e*e}function v$e(e,t){const n=[[],[]],i=D$e(t);for(let o=0;o<2;++o){const r=e[o]&-i,s=r+i;n[o][0]=XI(j9(r)),n[o][1]=XI(j9(s))}return n}function D$e(e){return 1<<E_-e>>>0}function j9(e){return 1/T$e*e}function Im(e,t,n,i,o,r){if(e===ym){const s=(t<<ym)+n;xte[(s<<2)+i]=(o<<2)+r,wte[(o<<2)+i]=(s<<2)+r}else{e++,t<<=1,n<<=1,o<<=2;const s=b$e[r];Im(e,t+(s[0]>>1),n+(s[0]&1),i,o,r^xv[0]),Im(e,t+(s[1]>>1),n+(s[1]&1),i,o+1,r^xv[1]),Im(e,t+(s[2]>>1),n+(s[2]&1),i,o+2,r^xv[2]),Im(e,t+(s[3]>>1),n+(s[3]&1),i,o+3,r^xv[3])}}function I$e(){Im(0,0,0,0,0,0),Im(0,0,0,Dm,0,Dm),Im(0,0,0,_A,0,_A),Im(0,0,0,Dm|_A,0,Dm|_A)}function Dte(e){return e&~e+BigInt(1)}function P$e(e){return BigInt(1)<<BigInt(2*(E_-e))}const O$e=[64,0,1,39,2,15,40,23,3,12,16,59,41,19,24,54,4,64,13,10,17,62,60,28,42,30,20,51,25,44,55,47,5,32,65,38,14,22,11,58,18,53,63,9,61,27,29,50,43,46,31,37,21,57,52,8,26,49,45,36,56,7,48,35,6,34,33,0];function L$e(e){return O$e[(-e&e)%BigInt(67)]}function Wr(e,t){return l(e)&&l(e.extensions)&&l(e.extensions[t])}function KI(e){const t=e.lengthBits;let n=e.availableCount;E.typeOf.number("options.lengthBits",t);const i=e.constant,o=e.bitstream;if(l(i))n=t;else{const r=Math.ceil(t/8);if(o.length!==r)throw new Fe(`Availability bitstream must be exactly ${r} bytes long to store ${t} bits. Actual bitstream was ${o.length} bytes long.`);const s=A(e.computeAvailableCountEnabled,!1);!l(n)&&s&&(n=B$e(o,t))}this._lengthBits=t,this._availableCount=n,this._constant=i,this._bitstream=o}function B$e(e,t){let n=0;for(let i=0;i<t;i++){const o=i>>3,r=i%8;n+=e[o]>>r&1}return n}Object.defineProperties(KI.prototype,{lengthBits:{get:function(){return this._lengthBits}},availableCount:{get:function(){return this._availableCount}}});KI.prototype.getBit=function(e){if(e<0||e>=this._lengthBits)throw new w("Bit index out of bounds.");if(l(this._constant))return this._constant;const t=e>>3,n=e%8;return(this._bitstream[t]>>n&1)===1};function Vd(e){e=A(e,A.EMPTY_OBJECT);const t=e.metadataTable,n=e.class,i=e.entityId,o=e.propertyTableJson;E.typeOf.object("options.metadataTable",t),E.typeOf.object("options.class",n),E.typeOf.number("options.entityId",i),E.typeOf.object("options.propertyTableJson",o),this._class=n,this._metadataTable=t,this._entityId=i,this._extensions=o.extensions,this._extras=o.extras}Object.defineProperties(Vd.prototype,{class:{get:function(){return this._class}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}});Vd.prototype.hasProperty=function(e){return this._metadataTable.hasProperty(e)};Vd.prototype.hasPropertyBySemantic=function(e){return this._metadataTable.hasPropertyBySemantic(e)};Vd.prototype.getPropertyIds=function(e){return this._metadataTable.getPropertyIds(e)};Vd.prototype.getProperty=function(e){return this._metadataTable.getProperty(this._entityId,e)};Vd.prototype.setProperty=function(e,t){return this._metadataTable.setProperty(this._entityId,e,t)};Vd.prototype.getPropertyBySemantic=function(e){return this._metadataTable.getPropertyBySemantic(this._entityId,e)};Vd.prototype.setPropertyBySemantic=function(e,t){return this._metadataTable.setPropertyBySemantic(this._entityId,e,t)};const jD={QUADTREE:"QUADTREE",OCTREE:"OCTREE"};jD.getBranchingFactor=function(e){switch(e){case jD.OCTREE:return 8;case jD.QUADTREE:return 4;default:throw new w("subdivisionScheme is not a valid value.")}};const us=Object.freeze(jD);function cn(){}Object.defineProperties(cn.prototype,{class:{get:function(){w.throwInstantiationError()}}});cn.prototype.hasProperty=function(e){w.throwInstantiationError()};cn.prototype.hasPropertyBySemantic=function(e){w.throwInstantiationError()};cn.prototype.getPropertyIds=function(e){w.throwInstantiationError()};cn.prototype.getProperty=function(e){w.throwInstantiationError()};cn.prototype.setProperty=function(e,t){w.throwInstantiationError()};cn.prototype.getPropertyBySemantic=function(e){w.throwInstantiationError()};cn.prototype.setPropertyBySemantic=function(e,t){w.throwInstantiationError()};cn.hasProperty=function(e,t,n){if(E.typeOf.string("propertyId",e),E.typeOf.object("properties",t),E.typeOf.object("classDefinition",n),l(t[e]))return!0;const i=n.properties;if(!l(i))return!1;const o=i[e];return!!(l(o)&&l(o.default))};cn.hasPropertyBySemantic=function(e,t,n){E.typeOf.string("semantic",e),E.typeOf.object("properties",t),E.typeOf.object("classDefinition",n);const i=n.propertiesBySemantic;if(!l(i))return!1;const o=i[e];return l(o)};cn.getPropertyIds=function(e,t,n){E.typeOf.object("properties",e),E.typeOf.object("classDefinition",t),n=l(n)?n:[],n.length=0;for(const o in e)e.hasOwnProperty(o)&&l(e[o])&&n.push(o);const i=t.properties;if(l(i))for(const o in i)i.hasOwnProperty(o)&&!l(e[o])&&l(i[o].default)&&n.push(o);return n};cn.getProperty=function(e,t,n){if(E.typeOf.string("propertyId",e),E.typeOf.object("properties",t),E.typeOf.object("classDefinition",n),!l(n.properties[e]))throw new w(`Class definition missing property ${e}`);const i=n.properties[e];let o=t[e];Array.isArray(o)&&(o=o.slice());const r=!0;if(o=i.handleNoData(o),!l(o)&&l(i.default))return o=St(i.default,!0),i.unpackVectorAndMatrixTypes(o,r);if(l(o))return o=i.normalize(o),o=i.applyValueTransform(o),i.unpackVectorAndMatrixTypes(o,r)};cn.setProperty=function(e,t,n,i){if(E.typeOf.string("propertyId",e),E.defined("value",t),E.typeOf.object("properties",n),E.typeOf.object("classDefinition",i),!l(n[e]))return!1;Array.isArray(t)&&(t=t.slice());let o;const r=i.properties;l(r)&&(o=r[e]);const s=!0;return l(o)&&(t=o.packVectorAndMatrixTypes(t,s),t=o.unapplyValueTransform(t),t=o.unnormalize(t)),n[e]=t,!0};cn.getPropertyBySemantic=function(e,t,n){E.typeOf.string("semantic",e),E.typeOf.object("properties",t),E.typeOf.object("classDefinition",n);const i=n.propertiesBySemantic;if(!l(i))return;const o=i[e];if(l(o))return cn.getProperty(o.id,t,n)};cn.setPropertyBySemantic=function(e,t,n,i){E.typeOf.string("semantic",e),E.defined("value",t),E.typeOf.object("properties",n),E.typeOf.object("classDefinition",i);const o=i.propertiesBySemantic;if(!l(o))return!1;const r=i.propertiesBySemantic[e];return l(r)?cn.setProperty(r.id,t,n,i):!1};function gp(e){e=A(e,A.EMPTY_OBJECT);const t=e.subtreeMetadata,n=e.class;E.typeOf.object("options.subtreeMetadata",t),E.typeOf.object("options.class",n);const i=l(t.properties)?t.properties:{};this._class=n,this._properties=i,this._extras=t.extras,this._extensions=t.extensions}Object.defineProperties(gp.prototype,{class:{get:function(){return this._class}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}});gp.prototype.hasProperty=function(e){return cn.hasProperty(e,this._properties,this._class)};gp.prototype.hasPropertyBySemantic=function(e){return cn.hasPropertyBySemantic(e,this._properties,this._class)};gp.prototype.getPropertyIds=function(e){return cn.getPropertyIds(this._properties,this._class,e)};gp.prototype.getProperty=function(e){return cn.getProperty(e,this._properties,this._class)};gp.prototype.setProperty=function(e,t){return cn.setProperty(e,t,this._properties,this._class)};gp.prototype.getPropertyBySemantic=function(e){return cn.getPropertyBySemantic(e,this._properties,this._class)};gp.prototype.setPropertyBySemantic=function(e,t){return cn.setPropertyBySemantic(e,t,this._properties,this._class)};const vt={INT8:"INT8",UINT8:"UINT8",INT16:"INT16",UINT16:"UINT16",INT32:"INT32",UINT32:"UINT32",INT64:"INT64",UINT64:"UINT64",FLOAT32:"FLOAT32",FLOAT64:"FLOAT64"};vt.getMinimum=function(e){switch(E.typeOf.string("type",e),e){case vt.INT8:return-128;case vt.UINT8:return 0;case vt.INT16:return-32768;case vt.UINT16:return 0;case vt.INT32:return-2147483648;case vt.UINT32:return 0;case vt.INT64:return Mn.supportsBigInt()?BigInt("-9223372036854775808"):-Math.pow(2,63);case vt.UINT64:return Mn.supportsBigInt()?BigInt(0):0;case vt.FLOAT32:return-34028234663852886e22;case vt.FLOAT64:return-Number.MAX_VALUE}};vt.getMaximum=function(e){switch(E.typeOf.string("type",e),e){case vt.INT8:return 127;case vt.UINT8:return 255;case vt.INT16:return 32767;case vt.UINT16:return 65535;case vt.INT32:return 2147483647;case vt.UINT32:return 4294967295;case vt.INT64:return Mn.supportsBigInt()?BigInt("9223372036854775807"):Math.pow(2,63)-1;case vt.UINT64:return Mn.supportsBigInt()?BigInt("18446744073709551615"):Math.pow(2,64)-1;case vt.FLOAT32:return 34028234663852886e22;case vt.FLOAT64:return Number.MAX_VALUE}};vt.isIntegerType=function(e){switch(E.typeOf.string("type",e),e){case vt.INT8:case vt.UINT8:case vt.INT16:case vt.UINT16:case vt.INT32:case vt.UINT32:case vt.INT64:case vt.UINT64:return!0;default:return!1}};vt.isUnsignedIntegerType=function(e){switch(E.typeOf.string("type",e),e){case vt.UINT8:case vt.UINT16:case vt.UINT32:case vt.UINT64:return!0;default:return!1}};vt.isVectorCompatible=function(e){switch(E.typeOf.string("type",e),e){case vt.INT8:case vt.UINT8:case vt.INT16:case vt.UINT16:case vt.INT32:case vt.UINT32:case vt.FLOAT32:case vt.FLOAT64:return!0;default:return!1}};vt.normalize=function(e,t){if(typeof e!="number"&&typeof e!="bigint")throw new w("value must be a number or a BigInt");if(!vt.isIntegerType(t))throw new w("type must be an integer type");return Math.max(Number(e)/Number(vt.getMaximum(t)),-1)};vt.unnormalize=function(e,t){if(E.typeOf.number("value",e),!vt.isIntegerType(t))throw new w("type must be an integer type");const n=vt.getMaximum(t),i=vt.isUnsignedIntegerType(t)?0:-n;return e=F.sign(e)*Math.round(Math.abs(e)*Number(n)),(t===vt.INT64||t===vt.UINT64)&&Mn.supportsBigInt()&&(e=BigInt(e)),e>n?n:e<i?i:e};vt.applyValueTransform=function(e,t,n){return n*e+t};vt.unapplyValueTransform=function(e,t,n){return n===0?0:(e-t)/n};vt.getSizeInBytes=function(e){switch(E.typeOf.string("type",e),e){case vt.INT8:case vt.UINT8:return 1;case vt.INT16:case vt.UINT16:return 2;case vt.INT32:case vt.UINT32:return 4;case vt.INT64:case vt.UINT64:return 8;case vt.FLOAT32:return 4;case vt.FLOAT64:return 8}};vt.fromComponentDatatype=function(e){switch(E.typeOf.number("componentDatatype",e),e){case oe.BYTE:return vt.INT8;case oe.UNSIGNED_BYTE:return vt.UINT8;case oe.SHORT:return vt.INT16;case oe.UNSIGNED_SHORT:return vt.UINT16;case oe.INT:return vt.INT32;case oe.UNSIGNED_INT:return vt.UINT32;case oe.FLOAT:return vt.FLOAT32;case oe.DOUBLE:return vt.FLOAT64}};vt.toComponentDatatype=function(e){switch(E.typeOf.string("type",e),e){case vt.INT8:return oe.BYTE;case vt.UINT8:return oe.UNSIGNED_BYTE;case vt.INT16:return oe.SHORT;case vt.UINT16:return oe.UNSIGNED_SHORT;case vt.INT32:return oe.INT;case vt.UINT32:return oe.UNSIGNED_INT;case vt.FLOAT32:return oe.FLOAT;case vt.FLOAT64:return oe.DOUBLE}};const an=Object.freeze(vt),Oo={SCALAR:"SCALAR",VEC2:"VEC2",VEC3:"VEC3",VEC4:"VEC4",MAT2:"MAT2",MAT3:"MAT3",MAT4:"MAT4",BOOLEAN:"BOOLEAN",STRING:"STRING",ENUM:"ENUM"};Oo.isVectorType=function(e){switch(E.typeOf.string("type",e),e){case Oo.VEC2:case Oo.VEC3:case Oo.VEC4:return!0;default:return!1}};Oo.isMatrixType=function(e){switch(E.typeOf.string("type",e),e){case Oo.MAT2:case Oo.MAT3:case Oo.MAT4:return!0;default:return!1}};Oo.getComponentCount=function(e){switch(E.typeOf.string("type",e),e){case Oo.SCALAR:case Oo.STRING:case Oo.ENUM:case Oo.BOOLEAN:return 1;case Oo.VEC2:return 2;case Oo.VEC3:return 3;case Oo.VEC4:return 4;case Oo.MAT2:return 4;case Oo.MAT3:return 9;case Oo.MAT4:return 16;default:throw new w(`Invalid metadata type ${e}`)}};Oo.getMathType=function(e){switch(e){case Oo.VEC2:return $;case Oo.VEC3:return d;case Oo.VEC4:return ue;case Oo.MAT2:return Et;case Oo.MAT3:return te;case Oo.MAT4:return N;default:return}};const Xt=Object.freeze(Oo);function Os(e){e=A(e,A.EMPTY_OBJECT);const t=e.id,n=e.type;E.typeOf.string("options.id",t),E.typeOf.string("options.type",n);const i=e.componentType,o=e.enumType,r=l(i)&&an.isIntegerType(i)&&A(e.normalized,!1);this._id=t,this._name=e.name,this._description=e.description,this._semantic=e.semantic,this._isLegacyExtension=e.isLegacyExtension,this._type=n,this._componentType=i,this._enumType=o,this._valueType=l(o)?o.valueType:i,this._isArray=A(e.isArray,!1),this._isVariableLengthArray=A(e.isVariableLengthArray,!1),this._arrayLength=e.arrayLength,this._min=St(e.min,!0),this._max=St(e.max,!0),this._normalized=r;let s=St(e.offset,!0),a=St(e.scale,!0);const c=l(s)||l(a),u=!0;l(s)||(s=this.expandConstant(0,u)),l(a)||(a=this.expandConstant(1,u)),this._offset=s,this._scale=a,this._hasValueTransform=c,this._noData=St(e.noData,!0),this._default=St(e.default,!0),this._required=A(e.required,!0),this._extras=St(e.extras,!0),this._extensions=St(e.extensions,!0)}Os.fromJson=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.id,n=e.property;E.typeOf.string("options.id",t),E.typeOf.object("options.property",n),E.typeOf.string("options.property.type",n.type);const i=R$e(n),o=N$e(n,e.enums);let r;return l(i)?i?r=l(n.optional)?!n.optional:!0:r=A(n.required,!1):r=!1,new Os({id:t,type:o.type,componentType:o.componentType,enumType:o.enumType,isArray:o.isArray,isVariableLengthArray:o.isVariableLengthArray,arrayLength:o.arrayLength,normalized:n.normalized,min:n.min,max:n.max,offset:n.offset,scale:n.scale,noData:n.noData,default:n.default,required:r,name:n.name,description:n.description,semantic:n.semantic,extras:n.extras,extensions:n.extensions,isLegacyExtension:i})};Object.defineProperties(Os.prototype,{id:{get:function(){return this._id}},name:{get:function(){return this._name}},description:{get:function(){return this._description}},type:{get:function(){return this._type}},enumType:{get:function(){return this._enumType}},componentType:{get:function(){return this._componentType}},valueType:{get:function(){return this._valueType}},isArray:{get:function(){return this._isArray}},isVariableLengthArray:{get:function(){return this._isVariableLengthArray}},arrayLength:{get:function(){return this._arrayLength}},normalized:{get:function(){return this._normalized}},max:{get:function(){return this._max}},min:{get:function(){return this._min}},noData:{get:function(){return this._noData}},default:{get:function(){return this._default}},required:{get:function(){return this._required}},semantic:{get:function(){return this._semantic}},hasValueTransform:{get:function(){return this._hasValueTransform}},offset:{get:function(){return this._offset}},scale:{get:function(){return this._scale}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}});function R$e(e){if(e.type==="ARRAY")return!0;const t=e.type;if(t===Xt.SCALAR||Xt.isMatrixType(t)||Xt.isVectorType(t))return!1;if(l(an[t]))return!0;if(l(e.noData)||l(e.scale)||l(e.offset)||l(e.required)||l(e.count)||l(e.array)||l(e.optional))return!1}function N$e(e,t){const n=e.type,i=e.componentType,o=n==="ARRAY";let r,s,a;o?(r=!0,s=e.componentCount,a=!l(s)):e.array?(r=!0,s=e.count,a=!l(e.count)):(r=!1,s=void 0,a=!1);let c;if(l(e.enumType)&&(c=t[e.enumType]),n===Xt.ENUM)return{type:n,componentType:void 0,enumType:c,valueType:c.valueType,isArray:r,isVariableLengthArray:a,arrayLength:s};if(o&&i===Xt.ENUM)return{type:i,componentType:void 0,enumType:c,valueType:c.valueType,isArray:r,isVariableLengthArray:a,arrayLength:s};if(n===Xt.SCALAR||Xt.isMatrixType(n)||Xt.isVectorType(n))return{type:n,componentType:i,enumType:void 0,valueType:i,isArray:r,isVariableLengthArray:a,arrayLength:s};if(n===Xt.BOOLEAN||n===Xt.STRING)return{type:n,componentType:void 0,enumType:void 0,valueType:void 0,isArray:r,isVariableLengthArray:a,arrayLength:s};if(o&&(i===Xt.BOOLEAN||i===Xt.STRING))return{type:i,componentType:void 0,enumType:void 0,valueType:void 0,isArray:r,isVariableLengthArray:a,arrayLength:s};if(l(i)&&l(an[i]))return{type:Xt.SCALAR,componentType:i,enumType:void 0,valueType:i,isArray:r,isVariableLengthArray:a,arrayLength:s};if(l(an[n]))return{type:Xt.SCALAR,componentType:n,enumType:void 0,valueType:n,isArray:r,isVariableLengthArray:a,arrayLength:s};throw new w(`unknown metadata type {type: ${n}, componentType: ${i})`)}Os.prototype.normalize=function(e){return this._normalized?cU(e,this._valueType,an.normalize):e};Os.prototype.unnormalize=function(e){return this._normalized?cU(e,this._valueType,an.unnormalize):e};Os.prototype.applyValueTransform=function(e){return!this._hasValueTransform||this._isVariableLengthArray?e:Os.valueTransformInPlace(e,this._offset,this._scale,an.applyValueTransform)};Os.prototype.unapplyValueTransform=function(e){return!this._hasValueTransform||this._isVariableLengthArray?e:Os.valueTransformInPlace(e,this._offset,this._scale,an.unapplyValueTransform)};Os.prototype.expandConstant=function(e,t){t=A(t,!1);const n=this._isArray,i=this._arrayLength,o=Xt.getComponentCount(this._type),r=n&&o>1;if(!n&&o===1)return e;if(!n)return new Array(o).fill(e);if(!r)return new Array(i).fill(e);if(!t)return new Array(this._arrayLength*o).fill(e);const s=new Array(o).fill(e);return new Array(this._arrayLength).fill(s)};Os.prototype.handleNoData=function(e){const t=this._noData;if(!l(t))return e;if(!Ite(e,t))return e};function Ite(e,t){if(!Array.isArray(e))return e===t;if(!Array.isArray(t)||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!Ite(e[n],t[n]))return!1;return!0}Os.prototype.unpackVectorAndMatrixTypes=function(e,t){t=A(t,!1);const n=Xt.getMathType(this._type),i=this._isArray,o=Xt.getComponentCount(this._type),r=i&&o>1;return l(n)?t&&r?e.map(function(s){return n.unpack(s)}):i?n.unpackArray(e):n.unpack(e):e};Os.prototype.packVectorAndMatrixTypes=function(e,t){t=A(t,!1);const n=Xt.getMathType(this._type),i=this._isArray,o=Xt.getComponentCount(this._type),r=i&&o>1;return l(n)?t&&r?e.map(function(s){return n.pack(s,[])}):i?n.packArray(e,[]):n.pack(e,[]):e};Os.prototype.validate=function(e){if(!(!l(e)&&l(this._default)))return this._required&&!l(e)?"required property must have a value":this._isArray?M$e(this,e):Pte(this,e)};function M$e(e,t){if(!Array.isArray(t))return`value ${t} must be an array`;const n=t.length;if(!e._isVariableLengthArray&&n!==e._arrayLength)return"Array length does not match property.arrayLength";for(let i=0;i<n;i++){const o=Pte(e,t[i]);if(l(o))return o}}function Pte(e,t){const n=e._type,i=e._componentType,o=e._enumType,r=e._normalized;return Xt.isVectorType(n)?F$e(t,n,i):Xt.isMatrixType(n)?z$e(t,n,i):n===Xt.STRING?U$e(t):n===Xt.BOOLEAN?H$e(t):n===Xt.ENUM?V$e(t,o):k$e(t,i,r)}function F$e(e,t,n){if(!an.isVectorCompatible(n))return`componentType ${n} is incompatible with vector type ${t}`;if(t===Xt.VEC2&&!(e instanceof $))return`vector value ${e} must be a Cartesian2`;if(t===Xt.VEC3&&!(e instanceof d))return`vector value ${e} must be a Cartesian3`;if(t===Xt.VEC4&&!(e instanceof ue))return`vector value ${e} must be a Cartesian4`}function z$e(e,t,n){if(!an.isVectorCompatible(n))return`componentType ${n} is incompatible with matrix type ${t}`;if(t===Xt.MAT2&&!(e instanceof Et))return`matrix value ${e} must be a Matrix2`;if(t===Xt.MAT3&&!(e instanceof te))return`matrix value ${e} must be a Matrix3`;if(t===Xt.MAT4&&!(e instanceof N))return`matrix value ${e} must be a Matrix4`}function U$e(e){if(typeof e!="string")return JI(e,Xt.STRING)}function H$e(e){if(typeof e!="boolean")return JI(e,Xt.BOOLEAN)}function V$e(e,t){const n=typeof e;if(l(t))return n!=="string"||!l(t.valuesByName[e])?`value ${e} is not a valid enum name for ${t.id}`:void 0}function k$e(e,t,n){const i=typeof e;switch(t){case an.INT8:case an.UINT8:case an.INT16:case an.UINT16:case an.INT32:case an.UINT32:case an.FLOAT32:case an.FLOAT64:return i!=="number"?JI(e,t):isFinite(e)?$9(e,t,n):X9(e,t);case an.INT64:case an.UINT64:return i!=="number"&&i!=="bigint"?JI(e,t):i==="number"&&!isFinite(e)?X9(e,t):$9(e,t,n)}}function JI(e,t){return`value ${e} does not match type ${t}`}function Y9(e,t,n){let i=`value ${e} is out of range for type ${t}`;return n&&(i+=" (normalized)"),i}function $9(e,t,n){if(n){const i=an.isUnsignedIntegerType(t)?0:-1,o=1;return e<i||e>o?Y9(e,t,n):void 0}if(e<an.getMinimum(t)||e>an.getMaximum(t))return Y9(e,t,n)}function X9(e,t){return`value ${e} of type ${t} must be finite`}function cU(e,t,n){if(!Array.isArray(e))return n(e,t);for(let i=0;i<e.length;i++)e[i]=cU(e[i],t,n);return e}Os.valueTransformInPlace=function(e,t,n,i){if(!Array.isArray(e))return i(e,t,n);for(let o=0;o<e.length;o++)e[o]=Os.valueTransformInPlace(e[o],t[o],n[o],i);return e};function Lx(e){e=A(e,A.EMPTY_OBJECT);const t=e.count,n=e.property,i=e.classProperty,o=e.bufferViews;E.typeOf.number.greaterThan("options.count",t,0),E.typeOf.object("options.property",n),E.typeOf.object("options.classProperty",i),E.typeOf.object("options.bufferViews",o);const r=i.type,s=i.isArray,a=i.isVariableLengthArray;let c=i.valueType;const u=i.enumType,f=r===Xt.STRING,h=r===Xt.BOOLEAN;let _=0,g;if(a){let I=A(n.arrayOffsetType,n.offsetType);I=A(an[I],an.UINT32);const O=A(n.arrayOffsets,n.arrayOffsetBufferView);g=new PR(o[O],I,t+1),_+=g.typedArray.byteLength}const p=Xt.getComponentCount(r);let y;a?y=g.get(t)-g.get(0):s?y=t*i.arrayLength:y=t;const T=p*y;let b;if(f){let I=A(n.stringOffsetType,n.offsetType);I=A(an[I],an.UINT32);const O=A(n.stringOffsets,n.stringOffsetBufferView);b=new PR(o[O],I,T+1),_+=b.typedArray.byteLength}(f||h)&&(c=an.UINT8);let x;f?x=b.get(T)-b.get(0):h?x=Math.ceil(T/8):x=T;const v=A(n.values,n.bufferView),D=new PR(o[v],c,x);_+=D.typedArray.byteLength;let L=n.offset,B=n.scale;const V=i.hasValueTransform||l(L)||l(B);L=A(L,i.offset),B=A(B,i.scale),L=K9(L),B=K9(B);let M,H;const G=this;f?M=function(I){return q$e(I,G._values,G._stringOffsets)}:h?(M=function(I){return j$e(I,G._values)},H=function(I,O){Y$e(I,G._values,O)}):l(u)?(M=function(I){const O=G._values.get(I);return u.namesByValue[O]},H=function(I,O){const m=u.valuesByName[O];G._values.set(I,m)}):(M=function(I){return G._values.get(I)},H=function(I,O){G._values.set(I,O)}),this._arrayOffsets=g,this._stringOffsets=b,this._values=D,this._classProperty=i,this._count=t,this._vectorComponentCount=p,this._min=n.min,this._max=n.max,this._offset=L,this._scale=B,this._hasValueTransform=V,this._getValue=M,this._setValue=H,this._unpackedValues=void 0,this._extras=n.extras,this._extensions=n.extensions,this._byteLength=_}Object.defineProperties(Lx.prototype,{hasValueTransform:{get:function(){return this._hasValueTransform}},offset:{get:function(){return this._offset}},scale:{get:function(){return this._scale}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}},byteLength:{get:function(){return this._byteLength}}});Lx.prototype.get=function(e){Ote(this,e);let t=G$e(this,e);return t=this._classProperty.handleNoData(t),l(t)?(t=this._classProperty.normalize(t),t=tXe(this,t),this._classProperty.unpackVectorAndMatrixTypes(t)):(t=this._classProperty.default,this._classProperty.unpackVectorAndMatrixTypes(t))};Lx.prototype.set=function(e,t){const n=this._classProperty;E.defined("value",t),Ote(this,e);const i=n.validate(t);if(l(i))throw new w(i);t=n.packVectorAndMatrixTypes(t),t=nXe(this,t),t=n.unnormalize(t),W$e(this,e,t)};Lx.prototype.getTypedArray=function(){if(l(this._values))return this._values.typedArray};function K9(e){if(!Array.isArray(e))return e;const t=[];for(let n=0;n<e.length;n++){const i=e[n];Array.isArray(i)?t.push.apply(t,i):t.push(i)}return t}function Ote(e,t){const n=e._count;if(!l(t)||t<0||t>=n){const i=n-1;throw new w(`index is required and between zero and count - 1. Actual value: ${i}`)}}function G$e(e,t){Bte(e)&&Rte(e);const n=e._classProperty,i=n.isArray,o=n.type,r=Xt.getComponentCount(o);if(l(e._unpackedValues)){const s=e._unpackedValues[t];return i?St(s,!0):s}return!i&&r===1?e._getValue(t):Lte(e,n,t)}function Lte(e,t,n){let i,o;if(t.isVariableLengthArray){i=e._arrayOffsets.get(n),o=e._arrayOffsets.get(n+1)-i;const s=Xt.getComponentCount(t.type);i*=s,o*=s}else{const a=A(t.arrayLength,1)*e._vectorComponentCount;i=n*a,o=a}const r=new Array(o);for(let s=0;s<o;s++)r[s]=e._getValue(i+s);return r}function W$e(e,t,n){Z$e(e,t,n)&&Rte(e);const i=e._classProperty,o=i.isArray,r=i.type,s=Xt.getComponentCount(r);if(l(e._unpackedValues)){i.isArray&&(n=St(n,!0)),e._unpackedValues[t]=n;return}if(!o&&s===1){e._setValue(t,n);return}let a,c;if(i.isVariableLengthArray)a=e._arrayOffsets.get(t),c=e._arrayOffsets.get(t+1)-a;else{const f=A(i.arrayLength,1)*e._vectorComponentCount;a=t*f,c=f}for(let u=0;u<c;++u)e._setValue(a+u,n[u])}function q$e(e,t,n){const i=n.get(e),o=n.get(e+1)-i;return nl(t.typedArray,i,o)}function j$e(e,t){const n=e>>3,i=e%8;return(t.typedArray[n]>>i&1)===1}function Y$e(e,t,n){const i=e>>3,o=e%8;n?t.typedArray[i]|=1<<o:t.typedArray[i]&=~(1<<o)}function $$e(e,t){const n=t.dataView,i=e*8;let o=0;const r=(n.getUint8(i+7)&128)>0;let s=!0;for(let a=0;a<8;++a){let c=n.getUint8(i+a);r&&(s?c!==0&&(c=~(c-1)&255,s=!1):c=~c&255),o+=c*Math.pow(256,a)}return r&&(o=-o),o}function X$e(e,t){const n=t.dataView,i=e*8;let o=BigInt(0);const r=(n.getUint8(i+7)&128)>0;let s=!0;for(let a=0;a<8;++a){let c=n.getUint8(i+a);r&&(s?c!==0&&(c=~(c-1)&255,s=!1):c=~c&255),o+=BigInt(c)*(BigInt(1)<<BigInt(a*8))}return r&&(o=-o),o}function K$e(e,t){const n=t.dataView,i=e*8,o=n.getUint32(i,!0),r=n.getUint32(i+4,!0);return o+4294967296*r}function J$e(e,t){const n=t.dataView,i=e*8,o=BigInt(n.getUint32(i,!0)),r=BigInt(n.getUint32(i+4,!0));return o+BigInt(4294967296)*r}function Q$e(e){switch(e){case an.INT8:return oe.BYTE;case an.UINT8:return oe.UNSIGNED_BYTE;case an.INT16:return oe.SHORT;case an.UINT16:return oe.UNSIGNED_SHORT;case an.INT32:return oe.INT;case an.UINT32:return oe.UNSIGNED_INT;case an.FLOAT32:return oe.FLOAT;case an.FLOAT64:return oe.DOUBLE}}function Bte(e){if(l(e._unpackedValues))return!1;const t=e._classProperty,n=t.type,i=t.valueType;return n===Xt.STRING||i===an.INT64&&!Mn.supportsBigInt64Array()||i===an.UINT64&&!Mn.supportsBigUint64Array()}function Z$e(e,t,n){if(Bte(e))return!0;const i=e._arrayOffsets;if(l(i)){const o=i.get(t+1)-i.get(t),r=n.length;if(o!==r)return!0}return!1}function Rte(e){e._unpackedValues=eXe(e),e._arrayOffsets=void 0,e._stringOffsets=void 0,e._values=void 0}function eXe(e){const t=e._count,n=new Array(t),i=e._classProperty,o=i.isArray,r=i.type,s=Xt.getComponentCount(r);if(!o&&s===1){for(let a=0;a<t;++a)n[a]=e._getValue(a);return n}for(let a=0;a<t;a++)n[a]=Lte(e,i,a);return n}function tXe(e,t){const i=e._classProperty.isVariableLengthArray;return!e._hasValueTransform||i?t:Os.valueTransformInPlace(t,e._offset,e._scale,an.applyValueTransform)}function nXe(e,t){const i=e._classProperty.isVariableLengthArray;return!e._hasValueTransform||i?t:Os.valueTransformInPlace(t,e._offset,e._scale,an.unapplyValueTransform)}function PR(e,t,n){const i=this;let o,r,s;if(t===an.INT64)Mn.supportsBigInt()?Mn.supportsBigInt64Array()?(o=new BigInt64Array(e.buffer,e.byteOffset,n),s=function(a,c){i.typedArray[a]=BigInt(c)}):(o=new Uint8Array(e.buffer,e.byteOffset,n*8),r=function(a){return X$e(a,i)}):(uo("INT64 type is not fully supported on this platform. Values greater than 2^53 - 1 or less than -(2^53 - 1) may lose precision when read."),o=new Uint8Array(e.buffer,e.byteOffset,n*8),r=function(a){return $$e(a,i)});else if(t===an.UINT64)Mn.supportsBigInt()?Mn.supportsBigUint64Array()?(o=new BigUint64Array(e.buffer,e.byteOffset,n),s=function(a,c){i.typedArray[a]=BigInt(c)}):(o=new Uint8Array(e.buffer,e.byteOffset,n*8),r=function(a){return J$e(a,i)}):(uo("UINT64 type is not fully supported on this platform. Values greater than 2^53 - 1 may lose precision when read."),o=new Uint8Array(e.buffer,e.byteOffset,n*8),r=function(a){return K$e(a,i)});else{const a=Q$e(t);o=oe.createArrayBufferView(a,e.buffer,e.byteOffset,n),s=function(c,u){i.typedArray[c]=u}}l(r)||(r=function(a){return i.typedArray[a]}),this.typedArray=o,this.dataView=new DataView(o.buffer,o.byteOffset),this.get=r,this.set=s,this._componentType=t}function bc(e){e=A(e,A.EMPTY_OBJECT);const t=e.count,n=e.class;E.typeOf.number.greaterThan("options.count",t,0),E.typeOf.object("options.class",n);let i=0;const o={};if(l(e.properties)){for(const r in e.properties)if(e.properties.hasOwnProperty(r)){const s=new Lx({count:t,property:e.properties[r],classProperty:n.properties[r],bufferViews:e.bufferViews});o[r]=s,i+=s.byteLength}}this._count=t,this._class=n,this._properties=o,this._byteLength=i}Object.defineProperties(bc.prototype,{count:{get:function(){return this._count}},class:{get:function(){return this._class}},byteLength:{get:function(){return this._byteLength}}});bc.prototype.hasProperty=function(e){return cn.hasProperty(e,this._properties,this._class)};bc.prototype.hasPropertyBySemantic=function(e){return cn.hasPropertyBySemantic(e,this._properties,this._class)};bc.prototype.getPropertyIds=function(e){return cn.getPropertyIds(this._properties,this._class,e)};bc.prototype.getProperty=function(e,t){E.typeOf.string("propertyId",t);const n=this._properties[t];let i;return l(n)?i=n.get(e):i=iXe(this._class,t),i};bc.prototype.setProperty=function(e,t,n){E.typeOf.string("propertyId",t);const i=this._properties[t];return l(i)?(i.set(e,n),!0):!1};bc.prototype.getPropertyBySemantic=function(e,t){E.typeOf.string("semantic",t);let n;const i=this._class.propertiesBySemantic;if(l(i)&&(n=i[t]),l(n))return this.getProperty(e,n.id)};bc.prototype.setPropertyBySemantic=function(e,t,n){E.typeOf.string("semantic",t);let i;const o=this._class.propertiesBySemantic;return l(o)&&(i=o[t]),l(i)?this.setProperty(e,i.id,n):!1};bc.prototype.getPropertyTypedArray=function(e){E.typeOf.string("propertyId",e);const t=this._properties[e];if(l(t))return t.getTypedArray()};bc.prototype.getPropertyTypedArrayBySemantic=function(e){E.typeOf.string("semantic",e);let t;const n=this._class.propertiesBySemantic;if(l(n)&&(t=n[e]),l(t))return this.getPropertyTypedArray(t.id)};function iXe(e,t){const n=e.properties;if(!l(n))return;const i=n[t];if(l(i)&&l(i.default)){let o=i.default;return i.isArray&&(o=St(o,!0)),o=i.normalize(o),i.unpackVectorAndMatrixTypes(o)}}function jr(){}Object.defineProperties(jr.prototype,{promise:{get:function(){w.throwInstantiationError()}},cacheKey:{get:function(){w.throwInstantiationError()}}});jr.prototype.load=function(){w.throwInstantiationError()};jr.prototype.unload=function(){};jr.prototype.process=function(e){};jr.prototype.getError=function(e,t){E.typeOf.string("errorMessage",e),l(t)&&(e+=`
|
||
${t.message}`);const n=new Fe(e);return l(t)&&(n.stack=`Original stack:
|
||
${t.stack}
|
||
Handler stack:
|
||
${n.stack}`),n};jr.prototype.isDestroyed=function(){return!1};jr.prototype.destroy=function(){return this.unload(),Je(this)};const oXe={UNLOADED:0,LOADING:1,PROCESSING:2,READY:3,FAILED:4},Qt=Object.freeze(oXe);function sf(e){e=A(e,A.EMPTY_OBJECT);const t=e.typedArray,n=e.resource,i=e.cacheKey;if(l(t)===l(n))throw new w("One of options.typedArray and options.resource must be defined.");this._typedArray=t,this._resource=n,this._cacheKey=i,this._state=Qt.UNLOADED,this._promise=void 0}l(Object.create)&&(sf.prototype=Object.create(jr.prototype),sf.prototype.constructor=sf);Object.defineProperties(sf.prototype,{promise:{get:function(){return this._promise}},cacheKey:{get:function(){return this._cacheKey}},typedArray:{get:function(){return this._typedArray}}});sf.prototype.load=function(){return l(this._typedArray)?this._promise=Promise.resolve(this):this._promise=rXe(this),this._promise};function rXe(e){const t=e._resource;return e._state=Qt.LOADING,sf._fetchArrayBuffer(t).then(function(n){if(!e.isDestroyed())return e._typedArray=new Uint8Array(n),e._state=Qt.READY,e}).catch(function(n){if(e.isDestroyed())return;e._state=Qt.FAILED;const i=`Failed to load external buffer: ${t.url}`;return Promise.reject(e.getError(i,n))})}sf._fetchArrayBuffer=function(e){return e.fetchArrayBuffer()};sf.prototype.unload=function(){this._typedArray=void 0};(function(){var e="B9h79tEBBBENQ9gEUEU9gEUB9gBB9gVUUUUUEU9gDUUEU9gLUUUUEU9gVUUUUUB9gLUUUUB9gIUUUEU9gD99UE99I8ayDILEVLEVLOOOOORRVBWWBEdddLVE9wEIIVIEBEOWEUEC+g/KEKR/QIhO9tw9t9vv95DBh9f9f939h79t9f9j9h229f9jT9vv7BB8a9tw79o9v9wT9fw9u9j9v9kw9WwvTw949C919m9mwvBE8f9tw79o9v9wT9fw9u9j9v9kw9WwvTw949C919m9mwv9C9v919u9kBDe9tw79o9v9wT9fw9u9j9v9kw9WwvTw949Wwv79p9v9uBIy9tw79o9v9wT9fw9u9j9v9kw69u9kw949C919m9mwvBL8e9tw79o9v9wT9fw9u9j9v9kw69u9kw949C919m9mwv9C9v919u9kBV8a9tw79o9v9wT9fw9u9j9v9kw69u9kw949Wwv79p9v9uBOe9tw79o9v9wT9fw9u9j9v9kw69u9kw949Twg91w9u9jwBRA9tw79o9v9wT9fw9u9j9v9kw69u9kw949Twg91w9u9jw9C9v919u9kBWl9tw79o9v9wT9fw9u9j9v9kws9p2Twv9P9jTBdk9tw79o9v9wT9fw9u9j9v9kws9p2Twv9R919hTBQl9tw79o9v9wT9fw9u9j9v9kws9p2Twvt949wBKe9tw79o9v9wT9f9v9wT9p9t9p96w9WwvTw94j9h9j9owBpA9tw79o9v9wT9f9v9wT9p9t9p96w9WwvTw94j9h9j9ow9TTv9p9wBSA9tw79o9v9wT9f9v9wT9p9t9p96w9WwvTw94swT9j9o9Sw9t9h9wBZL79iv9rBhdWEBCEKDxcQ+1tyDBK/hKEyU8jJJJJBCJO9rGV8kJJJJBCBHODNALCEFAE0MBABCBrB+Q+KJJBC+gEv86BBAVCJDFCBCJDZ+TJJJB8aDNAItMBAVCJDFADALZmJJJB8aKABAEFHRABCEFHWAVALFCBCBCJDAL9rALCfE0eZ+TJJJB8aAVAVCJDFALZmJJJBHdCJ/ABAL9uHEDNDNALtMBAEC/wfBgGECJDAECJD6eHQCBHKINAKAI9PMEAdCJLFCBCJDZ+TJJJB8aAQAIAK9rAKAQFAI6eGXCSFGECL4CIFCD4HMADAKAL2FHpDNDNDNDNDNAEC9wgGStMBCBHZCEHhApHoAWHaXEKDNAXtMBCBHaCEHhApHcINAdAaFrBBHxAcHECBHOINAdCJLFAOFAErBBGqAx9rGxCETAxCkTCk91CR4786BBAEALFHEAqHxAOCEFGOAX9HMBKARAW9rAM6MIAWCBAMZ+TJJJBGEtMIAEAMFHWAcCEFHcAaCEFGaAL6HhAaAL9HMBXVKKARAW9rAM6MOAWCBAMZ+TJJJB8aCEHEINAWGxAMFHWALAEGOsMLDNARAW9rAM6MBAOCEFHEAWCBAMZ+TJJJB8aAxMEKKCBHWAOAL6MOXIKINDNAXtMBAdAZFrBBHxCBHEAoHOINAdCJLFAEFAOrBBGqAx9rGxCETAxCkTCk91CR4786BBAOALFHOAqHxAECEFGEAX9HMBKKARAa9rAM6MEARAaCBAMZ+TJJJBGlAMFGW9rCk6MDCBHkAdCJLFHcINAdCJLFAkFHyCWH8aCZHaCEHqINDNDNAqCE9HMBCUHOAyrBBMECBHODNINAOGECSsMEAECEFHOAcAEFCEFrBBtMBKKCUCBAECS6eHOXEKAqCETC/+fffEgHOCUAqTCU7CfEgHxCBHEINAOAxAcAEFrBB9NFHOAECEFGECZ9HMBKKAOAaAOAa6GEeHaAqA8aAEeH8aAqCETGqCW6MBKDNDNDNDNA8aCUFpDIEBKAlAkCO4FGEAErBBCDCIA8aCLseAkCI4COgTv86BBA8aCW9HMEAWAy8pBB83BBAWCWFAyCWF8pBB83BBAWCZFHWXDKAlAkCO4FGEAErBBCEAkCI4COgTv86BBKDNCWA8a9tGeMBINAWCB86BBAWCEFHWXBKKCUA8aTCU7HqCBH3AcH5INA5HEAeHxCBHOINAErBBGaAqAaAqCfEgGy6eAOCfEgA8aTvHOAECEFHEAxCUFGxMBKAWAO86BBA5AeFH5AWCEFHWA3AeFG3CZ6MBKCBHEINDNAcAEFrBBGOAy6MBAWAO86BBAWCEFHWKAECEFGECZ9HMBKKDNAkCZFGkAS9PMBAcCZFHcARAW9rCl0MEKKAkAS6MEAWtMEAoCEFHoAZCEFGZAL6HhAWHaAZALsMIXBKKCBHWAhCEgtMEXLKCBHWAhCEgMIKAdApAXCUFAL2FALZmJJJB8aAXAKFHKAWMBKCBHOXDKCBHOARAW9rCAALALCA6e6MEDNALC8f0MBAWCBCAAL9rGEZ+TJJJBAEFHWKAWAdCJDFALZmJJJBALFAB9rHOXEKCBHOKAVCJOF8kJJJJBAOK9HEEUAECAAECA0eABCJ/ABAE9uC/wfBgGDCJDADCJD6eGDFCUFAD9uAE2ADCL4CIFCD4ADv2FCEFKMBCBABbD+Q+KJJBK/YSE3U8jJJJJBC/AE9rGL8kJJJJBCBHVDNAICI9uGOChFAE0MBABCBYDn+KJJBGVC/gEv86BBALC/ABFCfECJEZ+TJJJB8aALCuFGR9CU83IBALC8wFGW9CU83IBALCYFGd9CU83IBALCAFGQ9CU83IBALCkFGK9CU83IBALCZFGX9CU83IBAL9CU83IWAL9CU83IBABAEFC9wFHMABCEFGpAOFHEDNAItMBCMCSAVCB9KGSeHZAVCE9IHhCBHoCBHaCBHcCBHxCBHqINDNAEAM9NMBCBHVXIKAqCUFHVADAcCDTFGOYDBHlAOCWFYDBHkAOCLFYDBHyCBH8aDNDNINALC/ABFAVCSgCITFGOYDLHeDNDNDNAOYDBGOAl9HMBAeAysMEKDNAOAy9HMBAeAk9HMBA8aCEFH8aXEKAOAk9HMEAeAl9HMEA8aCDFH8aKA8aC870MDAxCUFHVADA8aCIgCX2GOC+Y1JJBFYDBAcFCDTFYDBHeADAOCn1JJBFYDBAcFCDTFYDBHkADAOC+Q1JJBFYDBAcFCDTFYDBHlCBHODNINDNALAVCSgCDTFYDBAe9HMBAOHyXDKCUHyAVCUFHVAOCEFGOCZ9HMBKKAyCB9KAyAZ9IgGVCU7AeAosGOgH3DNDNDNDNDNAyCBCSAOeAVeGVCS9HMBAhMBAeAeAaAeCEFAasGVeGaCEFsMECMCSAVeHVKApAVA8aCDTC/wEgv86BBAVCS9HMEAeAa9rGVCETAVC8f917HVINAEAVCfB0CRTAVCfBgv86BBAECEFHEAVCJE6HOAVCR4HVAOtMBKAeHaXDKCpHVApA8aCDTCpv86BBAeHaKAVtMBAVAZ9IMEKALAxCDTFAebDBAxCEFCSgHxKAoA3FHoALC/ABFAqCITFGVAkbDLAVAebDBALC/ABFAqCEFCSgGVCITFGOAebDLAOAlbDBAVCEFHOXIKAVCUFHVA8aCLFG8aC/AB9HMBKKDNADCEAkAosCETAyAoseCX2GVC+Q1JJBFYDBAcFCDTFYDBGltADAVCn1JJBFYDBAcFCDTFYDBG8aCEsgADAVC+Y1JJBFYDBAcFCDTFYDBGyCDsgAoCB9HgASgG5CE9HMBAR9CU83IBAW9CU83IBAd9CU83IBAQ9CU83IBAK9CU83IBAX9CU83IBAL9CU83IWAL9CU83IBCBHoKCBHeAxCUFGVHODNINDNALAOCSgCDTFYDBA8a9HMBAeHkXDKCUHkAOCUFHOAeCEFGeCZ9HMBKKCBHODNINDNALAVCSgCDTFYDBAy9HMBAOHeXDKCUHeAVCUFHVAOCEFGOCZ9HMBKKAoAlAosG8eFH3DNDNAkCM0MBAkCEFHkXEKCBCSA8aA3sGVeHkA3AVFH3KDNDNAeCM0MBAeCEFHeXEKCBCSAyA3sGVeHeA3AVFH3KC9+CUA8eeH8fAeAkCLTvHOCBHVDNDNDNINAVCJ1JJBFrBBAOCfEgsMEAVCEFGVCZ9HMBXDKKAlAo9HAVCM0vA5vMBApAVC/wEv86BBXEKApA8f86BBAEAO86BBAECEFHEKDNA8eMBAlAa9rGVCETAVC8f917HVINAEAVCfB0GOCRTAVCfBgv86BBAVCR4HVAECEFHEAOMBKAlHaKDNAkCS9HMBA8aAa9rGVCETAVC8f917HVINAEAVCfB0GOCRTAVCfBgv86BBAVCR4HVAECEFHEAOMBKA8aHaKDNAeCS9HMBAyAa9rGVCETAVC8f917HVINAEAVCfB0GOCRTAVCfBgv86BBAVCR4HVAECEFHEAOMBKAyHaKALAxCDTFAlbDBAxCEFCSgHVDNDNAkpZBEEEEEEEEEEEEEEBEKALAVCDTFA8abDBAxCDFCSgHVKDNDNAepZBEEEEEEEEEEEEEEBEKALAVCDTFAybDBAVCEFCSgHVKALC/ABFAqCITFGOAlbDLAOA8abDBALC/ABFAqCEFCSgCITFGOA8abDLAOAybDBALC/ABFAqCDFCSgCITFGOAybDLAOAlbDBAqCIFHOAVHxA3HoKApCEFHpAOCSgHqAcCIFGcAI6MBKKCBHVAEAM0MBCBHVINAEAVFAVCJ1JJBFrBB86BBAVCEFGVCZ9HMBKAEAB9rAVFHVKALC/AEF8kJJJJBAVKzEEUCBHDDNINADCEFGDC8f0MECEADTAE6MBKKADCRFCfEgCR9uCI2CDFABCI9u2ChFKMBCBABbDn+KJJBK+cDEWU8jJJJJBCZ9rHLCBHVDNAICVFAE0MBCBHOABCBrBn+KJJBC/QEv86BBAL9CB83IWABCEFHRABAEFC98FHWDNAItMBCBHdINDNARAW6MBCBSKADAdCDTFYDBGQALCWFAOAQALCWFAOCDTFYDB9rGEAEC8f91GEFAE7C507GOCDTFGKYDB9rGEC8e91C9+gAECDT7AOvHEINARAECfB0GVCRTAECfBgv86BBAECR4HEARCEFHRAVMBKAKAQbDBAdCEFGdAI9HMBKKCBHVARAW0MBARCBbBBARAB9rCLFHVKAVKbEEUCBHDDNINADCEFGDC8f0MECEADTAE6MBKKADCWFCfEgCR9uAB2CVFK+DVLI99DUI99LUDNAEtMBCUADCETCUFTCU7+yHVDNDNCUAICUFTCU7+yGOjBBBzmGR+LjBBB9P9dtMBAR+oHWXEKCJJJJ94HWKCBHICBHdINALCLFiDBGRjBBBBjBBJzALiDBGQ+LAR+LmALCWFiDBGK+LmGR+VARjBBBB9beGRnHXAQARnHRALCXFiDBHQDNDNAKjBBBB9gtMBAXHKXEKjBBJzAR+L+TGKAK+MAXjBBBB9geHKjBBJzAX+L+TGXAX+MARjBBBB9geHRKDNDNAQjBBJ+/AQjBBJ+/9geGXjBBJzAXjBBJz9feAVnjBBBzjBBB+/AQjBBBB9gemGQ+LjBBB9P9dtMBAQ+oHMXEKCJJJJ94HMKDNDNAKjBBJ+/AKjBBJ+/9geGQjBBJzAQjBBJz9feAOnjBBBzjBBB+/AKjBBBB9gemGQ+LjBBB9P9dtMBAQ+oHpXEKCJJJJ94HpKDNDNARjBBJ+/ARjBBJ+/9geGQjBBJzAQjBBJz9feAOnjBBBzjBBB+/ARjBBBB9gemGR+LjBBB9P9dtMBAR+oHSXEKCJJJJ94HSKDNDNADCL9HMBABAdFGZAS86BBAZCIFAM86BBAZCDFAW86BBAZCEFAp86BBXEKABAIFGZAS87EBAZCOFAM87EBAZCLFAW87EBAZCDFAp87EBKALCZFHLAICWFHIAdCLFHdAECUFGEMBKKK/KLLD99EUD99EUDNAEtMBDNDNCUAICUFTCU7+yGVjBBBzmGO+LjBBB9P9dtMBAO+oHIXEKCJJJJ94HIKAIC/8fIgHRINABCOFCICDALCLFiDB+LALiDB+L9eGIALCWFiDB+LALAICDTFiDB+L9eeGIALCXFiDB+LALAICDTFiDB+L9eeGIARv87EBDNDNALAICEFCIgCDTFiDBj/zL+1znjBBJ+/jBBJzALAICDTFiDBjBBBB9deGOnGWjBBJ+/AWjBBJ+/9geGdjBBJzAdjBBJz9feAVnjBBBzjBBB+/AWjBBBB9gemGW+LjBBB9P9dtMBAW+oHQXEKCJJJJ94HQKABAQ87EBDNDNAOALAICDFCIgCDTFiDBj/zL+1znnGWjBBJ+/AWjBBJ+/9geGdjBBJzAdjBBJz9feAVnjBBBzjBBB+/AWjBBBB9gemGW+LjBBB9P9dtMBAW+oHQXEKCJJJJ94HQKABCDFAQ87EBDNDNAOALAICUFCIgCDTFiDBj/zL+1znnGOjBBJ+/AOjBBJ+/9geGWjBBJzAWjBBJz9feAVnjBBBzjBBB+/AOjBBBB9gemGO+LjBBB9P9dtMBAO+oHIXEKCJJJJ94HIKABCLFAI87EBABCWFHBALCZFHLAECUFGEMBKKK+7DDWUE998jJJJJBCZ9rGV8kJJJJBDNAEtMBADCL6MBCEAI9rHOADCD4GDCEADCE0eHRADCDTHWCBHdINC+cUHDALHIARHQINAIiDBAVCXFZ+XJJJB8aAVYDXGKADADAK9IeHDAICLFHIAQCUFGQMBKAOADFGICkTHKCBHDCBAI9rHXARHIINDNDNALADFiDBGMAXZ+WJJJBjBBBzjBBB+/AMjBBBB9gemGM+LjBBB9P9dtMBAM+oHQXEKCJJJJ94HQKABADFAQCfffRgAKvbDBADCLFHDAICUFGIMBKABAWFHBALAWFHLAdCEFGdAE9HMBKKAVCZF8kJJJJBK/tKDcUI998jJJJJBC+QD9rGV8kJJJJBAVC+oEFCBC/kBZ+TJJJB8aCBHODNADtMBCBHOAItMBDNABAE9HMBAVCUADCDTGOADCffffI0eCBYD1+KJJBhJJJJBBGEbD+oEAVCEbD1DAEABAOZmJJJB8aKAVC+YEFCWFCBbDBAV9CB83I+YEAVC+YEFAEADAIAVC+oEFZ+NJJJBCUAICDTGRAICffffI0eGWCBYD1+KJJBhJJJJBBHOAVC+oEFAVYD1DGdCDTFAObDBAVAdCEFGQbD1DAOAVYD+YEGKARZmJJJBHXAVC+oEFAQCDTFADCI9uGMCBYD1+KJJBhJJJJBBGObDBAVAdCDFGRbD1DAOCBAMZ+TJJJBHpAVC+oEFARCDTFAWCBYD1+KJJBhJJJJBBGSbDBAVAdCIFGQbD1DAXHOASHRINARALiDBALAOYDBGWCWAWCW6eCDTFC/EBFiDBmuDBAOCLFHOARCLFHRAICUFGIMBKAVC+oEFAQCDTFCUAMCDTADCffff970eCBYD1+KJJBhJJJJBBGQbDBAVAdCLFbD1DDNADCI6MBAMCEAMCE0eHIAEHOAQHRINARASAOYDBCDTFiDBASAOCLFYDBCDTFiDBmASAOCWFYDBCDTFiDBmuDBAOCXFHOARCLFHRAICUFGIMBKKAVC/MBFHZAVYD+cEHhAVYD+gEHoAVHOCBHWCBHRCBHaCEHcINAOHxCIHqAEARCI2GlCDTFGOCWFYDBHkAOYDBHDABAaCX2FGICLFAOCLFYDBGdbDBAIADbDBAICWFAkbDBApARFCE86BBAZAkbDWAZAdbDLAZADbDBAQARCDTFCBbDBDNAWtMBCIHqAxHIINDNAIYDBGOADsMBAOAdsMBAOAksMBAZAqCDTFAObDBAqCEFHqKAICLFHIAWCUFGWMBKKAaCEFHaAXADCDTFGOAOYDBCUFbDBAXAdCDTFGOAOYDBCUFbDBAXAkCDTFGOAOYDBCUFbDBCBHWINAoAhAEAWAlFCDTFYDBCDTGIFYDBCDTFGkHOAKAIFGdYDBGDHIDNADtMBDNINAOYDBARsMEAOCLFHOAICUFGItMDXBKKAOADCDTAkFC98FYDBbDBAdAdYDBCUFbDBKAWCEFGWCI9HMBKDNDNDNAqtMBCUHRjBBBBHyCBHOINASAZAOCDTFYDBCDTGIFGWiDBH8aAWALCBAOCEFGdAOCS0eCDTFiDBALAXAIFYDBGOCWAOCW6eCDTFC/EBFiDBmGeuDBDNAKAIFYDBGWtMBAeA8a+THeAoAhAIFYDBCDTFHOAWCDTHIINAQAOYDBGWCDTFGDAeADiDBmG8auDBA8aAyAyA8a9dGDeHyAWARADeHRAOCLFHOAIC98FGIMBKKAdHOAdAq9HMBKARCU9HMEKAcAM9PMEINDNApAcFrBBMBAcHRXDKAMAcCEFGc9HMBXDKKAqCZAqCZ6eHWAZHOAxHZARCU9HMEKKAVYD1DHOKAOCDTAVC+oEFFC98FHRDNINAOtMEARYDBCBYD+E+KJJBh+BJJJBBARC98FHRAOCUFHOXBKKAVC+QDF8kJJJJBK/uLEVUCUAICDTGVAICffffI0eGOCBYD1+KJJBhJJJJBBHRALALYD9gGWCDTFARbDBALAWCEFbD9gABARbDBAOCBYD1+KJJBhJJJJBBHRALALYD9gGOCDTFARbDBALAOCEFbD9gABARbDLCUADCDTADCffffI0eCBYD1+KJJBhJJJJBBHRALALYD9gGOCDTFARbDBALAOCEFbD9gABARbDWABYDBCBAVZ+TJJJB8aADCI9uHWDNADtMBABYDBHOAEHLADHRINAOALYDBCDTFGVAVYDBCEFbDBALCLFHLARCUFGRMBKKDNAItMBABYDBHLABYDLHRCBHVAIHOINARAVbDBARCLFHRALYDBAVFHVALCLFHLAOCUFGOMBKKDNADCI6MBAWCEAWCE0eHdABYDLHRABYDWHVCBHLINAECWFYDBHOAECLFYDBHDARAEYDBCDTFGWAWYDBGWCEFbDBAVAWCDTFALbDBARADCDTFGDADYDBGDCEFbDBAVADCDTFALbDBARAOCDTFGOAOYDBGOCEFbDBAVAOCDTFALbDBAECXFHEAdALCEFGL9HMBKKDNAItMBABYDLHEABYDBHLINAEAEYDBALYDB9rbDBALCLFHLAECLFHEAICUFGIMBKKKqBABAEADAIC+01JJBZ+MJJJBKqBABAEADAIC+c+JJJBZ+MJJJBK9dEEUABCfEAICDTZ+TJJJBHLCBHIDNADtMBINDNALAEYDBCDTFGBYDBCU9HMBABAIbDBAICEFHIKAECLFHEADCUFGDMBKKAIK9TEIUCBCBYD+M+KJJBGEABCIFC98gFGBbD+M+KJJBDNDNABzBCZTGD9NMBCUHIABAD9rCffIFCZ4NBCUsMEKAEHIKAIK/lEEEUDNDNAEABvCIgtMBABHIXEKDNDNADCZ9PMBABHIXEKABHIINAIAEYDBbDBAICLFAECLFYDBbDBAICWFAECWFYDBbDBAICXFAECXFYDBbDBAICZFHIAECZFHEADC9wFGDCS0MBKKADCL6MBINAIAEYDBbDBAECLFHEAICLFHIADC98FGDCI0MBKKDNADtMBINAIAErBB86BBAICEFHIAECEFHEADCUFGDMBKKABK/AEEDUDNDNABCIgtMBABHIXEKAECfEgC+B+C+EW2HLDNDNADCZ9PMBABHIXEKABHIINAIALbDBAICXFALbDBAICWFALbDBAICLFALbDBAICZFHIADC9wFGDCS0MBKKADCL6MBINAIALbDBAICLFHIADC98FGDCI0MBKKDNADtMBINAIAE86BBAICEFHIADCUFGDMBKKABK9TEIUCBCBYD+M+KJJBGEABCIFC98gFGBbD+M+KJJBDNDNABzBCZTGD9NMBCUHIABAD9rCffIFCZ4NBCUsMEKAEHIKAIK9+EIUzBHEDNDNCBYD+M+KJJBGDAECZTGI9NMBCUHEADAI9rCffIFCZ4NBCUsMEKADHEKCBABAE9rCIFC98gCBYD+M+KJJBFGDbD+M+KJJBDNADzBCZTGE9NMBADAE9rCffIFCZ4NB8aKKXBABAEZ+YJJJBK+BEEIUDNAB+8GDCl4GICfEgGLCfEsMBDNALMBDNABjBBBB9cMBAECBbDBABSKABjBBJ9fnAEZ+XJJJBHBAEAEYDBCNFbDBABSKAEAICfEgC+CUFbDBADCfff+D94gCJJJ/4Iv++HBKABK+gEBDNDNAECJE9IMBABjBBBUnHBDNAECfE9PMBAEC+BUFHEXDKABjBBBUnHBAECPDAECPD6eC+C9+FHEXEKAEC+BU9KMBABjBBJXnHBDNAEC+b9+9NMBAEC/mBFHEXEKABjBBJXnHBAEC+299AEC+2990eC/MEFHEKABAEClTCJJJ/8IF++nKK+eDDBCJWK+EDB4+H9W9n94+p+Gw+J9o+YE9pBBBBBBEBBBDBBBEBBBDBBBBBBBDBBBBBBBEBBBBBBB+L29Hz/69+9Kz/n/76z/RG97z/Z/O9Xz8j/b85z/+/U9Yz/B/K9hz+2/z9dz9E+L9Mz59a8kz+R/t3z+a+Zyz79ohz/J4++8++y+d9v8+BBBB9S+49+z8r+Hbz9m9m/m8+l/Z/O8+/8+pg89Q/X+j878r+Hq8++m+b/E87BBBBBBJzBBJzBBJz+e/v/n8++y+dSz9I/h/68+XD/r8+/H0838+/w+nOzBBBB+wv9o8+UF888+9I/h/68+9C9g/l89/N/M9M89/d8kO8+BBBBF+8Tz9M836zs+2azl/Zpzz818ez9E+LXz/u98f8+819e/68+BC+EQKXEBBBDBBBAwBB",t=new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]);if(typeof WebAssembly!="object")return{supported:!1};var n,i=WebAssembly.instantiate(o(e),{}).then(function(_){n=_.instance,n.exports.__wasm_call_ctors(),n.exports.meshopt_encodeVertexVersion(0),n.exports.meshopt_encodeIndexVersion(1)});function o(_){for(var g=new Uint8Array(_.length),p=0;p<_.length;++p){var y=_.charCodeAt(p);g[p]=y>96?y-71:y>64?y-65:y>47?y+4:y>46?63:62}for(var T=0,p=0;p<_.length;++p)g[T++]=g[p]<60?t[g[p]]:(g[p]-60)*64+g[++p];return g.buffer.slice(0,T)}function r(_){if(!_)throw new Error("Assertion failed")}function s(_){return new Uint8Array(_.buffer,_.byteOffset,_.byteLength)}function a(_,g,p){var y=n.exports.sbrk,T=y(_.length*4),b=y(g*4),x=new Uint8Array(n.exports.memory.buffer),v=s(_);x.set(v,T),p&&p(T,T,_.length,g);var D=n.exports.meshopt_optimizeVertexFetchRemap(b,T,_.length,g);x=new Uint8Array(n.exports.memory.buffer);var L=new Uint32Array(g);new Uint8Array(L.buffer).set(x.subarray(b,b+g*4)),v.set(x.subarray(T,T+_.length*4)),y(T-y(0));for(var B=0;B<_.length;++B)_[B]=L[_[B]];return[L,D]}function c(_,g,p,y,T){var b=n.exports.sbrk,x=b(g),v=b(y*T),D=new Uint8Array(n.exports.memory.buffer);D.set(s(p),v);var L=_(x,g,v,y,T),B=new Uint8Array(L);return B.set(D.subarray(x,x+L)),b(x-b(0)),B}function u(_){for(var g=0,p=0;p<_.length;++p){var y=_[p];g=g<y?y:g}return g}function f(_,g){if(r(g==2||g==4),g==4)return new Uint32Array(_.buffer,_.byteOffset,_.byteLength/4);var p=new Uint16Array(_.buffer,_.byteOffset,_.byteLength/2);return new Uint32Array(p)}function h(_,g,p,y,T,b){var x=n.exports.sbrk,v=x(p*y),D=x(p*b),L=new Uint8Array(n.exports.memory.buffer);L.set(s(g),D),_(v,p,y,T,D);var B=new Uint8Array(p*y);return B.set(L.subarray(v,v+p*y)),x(v-x(0)),B}return{ready:i,supported:!0,reorderMesh:function(_,g,p){var y=g?p?n.exports.meshopt_optimizeVertexCacheStrip:n.exports.meshopt_optimizeVertexCache:void 0;return a(_,u(_)+1,y)},encodeVertexBuffer:function(_,g,p){r(p>0&&p<=256),r(p%4==0);var y=n.exports.meshopt_encodeVertexBufferBound(g,p);return c(n.exports.meshopt_encodeVertexBuffer,y,_,g,p)},encodeIndexBuffer:function(_,g,p){r(p==2||p==4),r(g%3==0);var y=f(_,p),T=n.exports.meshopt_encodeIndexBufferBound(g,u(y)+1);return c(n.exports.meshopt_encodeIndexBuffer,T,y,g,4)},encodeIndexSequence:function(_,g,p){r(p==2||p==4);var y=f(_,p),T=n.exports.meshopt_encodeIndexSequenceBound(g,u(y)+1);return c(n.exports.meshopt_encodeIndexSequence,T,y,g,4)},encodeGltfBuffer:function(_,g,p,y){var T={ATTRIBUTES:this.encodeVertexBuffer,TRIANGLES:this.encodeIndexBuffer,INDICES:this.encodeIndexSequence};return r(T[y]),T[y](_,g,p)},encodeFilterOct:function(_,g,p,y){return r(p==4||p==8),r(y>=1&&y<=16),h(n.exports.meshopt_encodeFilterOct,_,g,p,y,16)},encodeFilterQuat:function(_,g,p,y){return r(p==8),r(y>=4&&y<=16),h(n.exports.meshopt_encodeFilterQuat,_,g,p,y,16)},encodeFilterExp:function(_,g,p,y){return r(p>0&&p%4==0),r(y>=1&&y<=24),h(n.exports.meshopt_encodeFilterExp,_,g,p,y,p)}}})();var sXe=function(){var e="B9h79tEBBBE8fV9gBB9gVUUUUUEU9gIUUUB9gEUEU9gIUUUEUIKQBEEEDDDILLVIEBEOWEUEC+Q/IEKR/LEdO9tw9t9vv95DBh9f9f939h79t9f9j9h229f9jT9vv7BB8a9tw79o9v9wT9f9kw9j9v9kw9WwvTw949C919m9mwvBEy9tw79o9v9wT9f9kw9j9v9kw69u9kw949C919m9mwvBDe9tw79o9v9wT9f9kw9j9v9kw69u9kw949Twg91w9u9jwBIl9tw79o9v9wT9f9kw9j9v9kws9p2Twv9P9jTBLk9tw79o9v9wT9f9kw9j9v9kws9p2Twv9R919hTBVl9tw79o9v9wT9f9kw9j9v9kws9p2Twvt949wBOL79iv9rBRQ+p8yQDBK/3SEZU8jJJJJBCJ/EB9rGV8kJJJJBC9+HODNADCEFAL0MBCUHOAIrBBC+gE9HMBAVAIALFGRAD9rADZ1JJJBHWCJ/ABAD9uHOAICEFHLDNADtMBAOC/wfBgGOCJDAOCJD6eHdCBHQINAQAE9PMEAdAEAQ9rAQAdFAE6eGKCSFGOCL4CIFCD4HXDNDNDNDNAOC9wgGMtMBCBHpCEHSAWCJDFHZALHhINARAh9rAX6MIDNARAhAXFGL9rCk6MBCZHOINAWCJ/CBFAOGIFGOC9wFHoDNDNDNDNDNAhAIC9wFGaCO4FrBBAaCI4COg4CIgpLBEDIBKAo9CB83IBAoCWF9CB83IBXIKAoALrBLALrBBGaCO4GcAcCIsGce86BBAOCgFALCLFAcFGorBBAaCL4CIgGcAcCIsGce86BBAOCvFAoAcFGorBBAaCD4CIgGcAcCIsGce86BBAOC7FAoAcFGorBBAaCIgGaAaCIsGae86BBAOCTFAoAaFGarBBALrBEGoCO4GcAcCIsGce86BBAOC91FAaAcFGarBBAoCL4CIgGcAcCIsGce86BBAOC4FAaAcFGarBBAoCD4CIgGcAcCIsGce86BBAOC93FAaAcFGarBBAoCIgGoAoCIsGoe86BBAOC94FAaAoFGarBBALrBDGoCO4GcAcCIsGce86BBAOC95FAaAcFGarBBAoCL4CIgGcAcCIsGce86BBAOC96FAaAcFGarBBAoCD4CIgGcAcCIsGce86BBAOC97FAaAcFGarBBAoCIgGoAoCIsGoe86BBAOC98FAaAoFGorBBALrBIGLCO4GaAaCIsGae86BBAOC99FAoAaFGorBBALCL4CIgGaAaCIsGae86BBAOC9+FAoAaFGorBBALCD4CIgGaAaCIsGae86BBAOCUFAoAaFGOrBBALCIgGLALCIsGLe86BBAOALFHLXDKAoALrBWALrBBGaCL4GcAcCSsGce86BBAOCgFALCWFAcFGorBBAaCSgGaAaCSsGae86BBAOCvFAoAaFGorBBALrBEGaCL4GcAcCSsGce86BBAOC7FAoAcFGorBBAaCSgGaAaCSsGae86BBAOCTFAoAaFGorBBALrBDGaCL4GcAcCSsGce86BBAOC91FAoAcFGorBBAaCSgGaAaCSsGae86BBAOC4FAoAaFGorBBALrBIGaCL4GcAcCSsGce86BBAOC93FAoAcFGorBBAaCSgGaAaCSsGae86BBAOC94FAoAaFGorBBALrBLGaCL4GcAcCSsGce86BBAOC95FAoAcFGorBBAaCSgGaAaCSsGae86BBAOC96FAoAaFGorBBALrBVGaCL4GcAcCSsGce86BBAOC97FAoAcFGorBBAaCSgGaAaCSsGae86BBAOC98FAoAaFGorBBALrBOGaCL4GcAcCSsGce86BBAOC99FAoAcFGorBBAaCSgGaAaCSsGae86BBAOC9+FAoAaFGorBBALrBRGLCL4GaAaCSsGae86BBAOCUFAoAaFGOrBBALCSgGLALCSsGLe86BBAOALFHLXEKAoAL8pBB83BBAoCWFALCWF8pBB83BBALCZFHLKDNAIAM9PMBAICZFHOARAL9rCl0MEKKAIAM6MIALtMIDNAKtMBAWApFrBBHoCBHOAZHIINAIAWCJ/CBFAOFrBBGaCE4CBAaCEg9r7AoFGo86BBAIADFHIAOCEFGOAK9HMBKKAZCEFHZApCEFGpAD6HSALHhApAD9HMEXVKKCBHLASCEgMDXIKALAXAD2FHcDNAKtMBCBHhCEHSAWCJDFHMINARAL9rAX6MIALtMDALAXFHLAWAhFrBBHoCBHOAMHIINAIAWCJ/CBFAOFrBBGaCE4CBAaCEg9r7AoFGo86BBAIADFHIAOCEFGOAK9HMBKAMCEFHMAhCEFGhAD6HSAhAD9HMBKAcHLXIKCBHOCEHSINARAL9rAX6MDALtMEALAXFHLAOCEFGOAD6HSADAO9HMBKAcHLXDKCBHLASCEgtMEKC9+HOXIKABAQAD2FAWCJDFAKAD2Z1JJJB8aAWAWCJDFAKCUFAD2FADZ1JJJB8aAKAQFHQALMBKC9+HOXEKCBC99ARAL9rADCAADCA0eseHOKAVCJ/EBF8kJJJJBAOK/YZEhU8jJJJJBC/AE9rGV8kJJJJBC9+HODNAECI9uGRChFAL0MBCUHOAIrBBGWC/wEgC/gE9HMBAWCSgGdCE0MBAVC/ABFCfECJEZ+JJJJB8aAVCuF9CU83IBAVC8wF9CU83IBAVCYF9CU83IBAVCAF9CU83IBAVCkF9CU83IBAVCZF9CU83IBAV9CU83IWAV9CU83IBAIALFC9wFHQAICEFGWARFHODNAEtMBCMCSAdCEseHKCBHXCBHMCBHdCBHICBHLINDNAOAQ9NMBC9+HOXIKDNDNAWrBBGRC/vE0MBAVC/ABFALARCL4CU7FCSgCITFGpYDLHSApYDBHZDNARCSgGpAK9PMBAVAIARCU7FCSgCDTFYDBAXApeHRAptHpDNDNADCD9HMBABAdCETFGhAZ87EBAhCDFAS87EBAhCLFAR87EBXEKABAdCDTFGhAZbDBAhCLFASbDBAhCWFARbDBKAXApFHXAVC/ABFALCITFGhARbDBAhASbDLAVAICDTFARbDBAVC/ABFALCEFCSgGLCITFGhAZbDBAhARbDLAIApFHIALCEFHLXDKDNDNApCSsMBAMApFApC987FCEFHMXEKAOCEFHRAO8sBBGpCfEgHhDNDNApCU9MMBARHOXEKAOCVFHOAhCfBgHhCRHpDNINAR8sBBGoCfBgApTAhvHhAoCU9KMEARCEFHRApCRFGpC8j9HMBXDKKARCEFHOKAhCE4CBAhCEg9r7AMFHMKDNDNADCD9HMBABAdCETFGRAZ87EBARCDFAS87EBARCLFAM87EBXEKABAdCDTFGRAZbDBARCLFASbDBARCWFAMbDBKAVC/ABFALCITFGRAMbDBARASbDLAVAICDTFAMbDBAVC/ABFALCEFCSgGLCITFGRAZbDBARAMbDLAICEFHIALCEFHLXEKDNARCPE0MBAXCEFGoAVAIAQARCSgFrBBGpCL49rCSgCDTFYDBApCZ6GheHRAVAIAp9rCSgCDTFYDBAoAhFGSApCSgGoeHpAotHoDNDNADCD9HMBABAdCETFGZAX87EBAZCDFAR87EBAZCLFAp87EBXEKABAdCDTFGZAXbDBAZCLFARbDBAZCWFApbDBKAVAICDTFAXbDBAVC/ABFALCITFGZARbDBAZAXbDLAVAICEFGICSgCDTFARbDBAVC/ABFALCEFCSgCITFGZApbDBAZARbDLAVAIAhFCSgGICDTFApbDBAVC/ABFALCDFCSgGLCITFGRAXbDBARApbDLALCEFHLAIAoFHIASAoFHXXEKAXCBAOrBBGZeGaARC/+EsGRFHSAZCSgHcAZCL4HxDNDNAZCS0MBASCEFHoXEKASHoAVAIAx9rCSgCDTFYDBHSKDNDNAcMBAoCEFHXXEKAoHXAVAIAZ9rCSgCDTFYDBHoKDNDNARtMBAOCEFHRXEKAOCDFHRAO8sBEGhCfEgHpDNAhCU9KMBAOCOFHaApCfBgHpCRHODNINAR8sBBGhCfBgAOTApvHpAhCU9KMEARCEFHRAOCRFGOC8j9HMBKAaHRXEKARCEFHRKApCE4CBApCEg9r7AMFGMHaKDNDNAxCSsMBARHpXEKARCEFHpAR8sBBGOCfEgHhDNAOCU9KMBARCVFHSAhCfBgHhCRHODNINAp8sBBGRCfBgAOTAhvHhARCU9KMEApCEFHpAOCRFGOC8j9HMBKASHpXEKApCEFHpKAhCE4CBAhCEg9r7AMFGMHSKDNDNAcCSsMBApHOXEKApCEFHOAp8sBBGRCfEgHhDNARCU9KMBApCVFHoAhCfBgHhCRHRDNINAO8sBBGpCfBgARTAhvHhApCU9KMEAOCEFHOARCRFGRC8j9HMBKAoHOXEKAOCEFHOKAhCE4CBAhCEg9r7AMFGMHoKDNDNADCD9HMBABAdCETFGRAa87EBARCDFAS87EBARCLFAo87EBXEKABAdCDTFGRAabDBARCLFASbDBARCWFAobDBKAVC/ABFALCITFGRASbDBARAabDLAVAICDTFAabDBAVC/ABFALCEFCSgCITFGRAobDBARASbDLAVAICEFGICSgCDTFASbDBAVC/ABFALCDFCSgCITFGRAabDBARAobDLAVAIAZCZ6AxCSsvFGICSgCDTFAobDBAIActAcCSsvFHIALCIFHLKAWCEFHWALCSgHLAICSgHIAdCIFGdAE6MBKKCBC99AOAQseHOKAVC/AEF8kJJJJBAOK+LLEVU8jJJJJBCZ9rHVC9+HODNAECVFAL0MBCUHOAIrBBC/+EgC/QE9HMBAV9CB83IWAICEFHRAIALFC98FHWDNAEtMBDNADCDsMBCBHdINDNARAW6MBC9+SKARCEFHOAR8sBBGLCfEgHIDNDNALCU9MMBAOHRXEKARCVFHRAICfBgHICRHLDNINAO8sBBGDCfBgALTAIvHIADCU9KMEAOCEFHOALCRFGLC8j9HMBXDKKAOCEFHRKABAdCDTFAICD4CBAICE4CEg9r7AVCWFAICEgCDTvGOYDBFGLbDBAOALbDBAdCEFGdAE9HMBXDKKCBHdINDNARAW6MBC9+SKARCEFHOAR8sBBGLCfEgHIDNDNALCU9MMBAOHRXEKARCVFHRAICfBgHICRHLDNINAO8sBBGDCfBgALTAIvHIADCU9KMEAOCEFHOALCRFGLC8j9HMBXDKKAOCEFHRKABAdCETFAICD4CBAICE4CEg9r7AVCWFAICEgCDTvGOYDBFGL87EBAOALbDBAdCEFGdAE9HMBKKCBC99ARAWseHOKAOK+lVOEUE99DUD99EUD99DNDNADCL9HMBAEtMEINDNDNABCDFGD8sBB+yAB8sBBGI+yGL+L+TABCEFGV8sBBGO+yGR+L+TGWjBB/+9CAWAWnjBBBBAWAWjBBBB9gGdeGQ+MGKAQAICB9IeALmGWAWnAKAQAOCB9IeARmGQAQnmm+R+VGLnjBBBzjBBB+/AdemGR+LjBBB9P9dtMBAR+oHIXEKCJJJJ94HIKADAI86BBDNDNAQALnjBBBzjBBB+/AQjBBBB9gemGQ+LjBBB9P9dtMBAQ+oHDXEKCJJJJ94HDKAVAD86BBDNDNAWALnjBBBzjBBB+/AWjBBBB9gemGW+LjBBB9P9dtMBAW+oHDXEKCJJJJ94HDKABAD86BBABCLFHBAECUFGEMBXDKKAEtMBINDNDNABCLFGD8uEB+yAB8uEBGI+yGL+L+TABCDFGV8uEBGO+yGR+L+TGWjB/+fsAWAWnjBBBBAWAWjBBBB9gGdeGQ+MGKAQAICB9IeALmGWAWnAKAQAOCB9IeARmGQAQnmm+R+VGLnjBBBzjBBB+/AdemGR+LjBBB9P9dtMBAR+oHIXEKCJJJJ94HIKADAI87EBDNDNAQALnjBBBzjBBB+/AQjBBBB9gemGQ+LjBBB9P9dtMBAQ+oHDXEKCJJJJ94HDKAVAD87EBDNDNAWALnjBBBzjBBB+/AWjBBBB9gemGW+LjBBB9P9dtMBAW+oHDXEKCJJJJ94HDKABAD87EBABCWFHBAECUFGEMBKKK/SILIUI99IUE99DNAEtMBCBHIABHLINDNDNj/zL81zALCOF8uEBGVCIv+y+VGOAL8uEB+ynGRjB/+fsnjBBBzjBBB+/ARjBBBB9gemGW+LjBBB9P9dtMBAW+oHdXEKCJJJJ94HdKALCLF8uEBHQALCDF8uEBHKABAVCEFCIgAIvCETFAd87EBDNDNAOAK+ynGWjB/+fsnjBBBzjBBB+/AWjBBBB9gemGX+LjBBB9P9dtMBAX+oHKXEKCJJJJ94HKKABAVCDFCIgAIvCETFAK87EBDNDNAOAQ+ynGOjB/+fsnjBBBzjBBB+/AOjBBBB9gemGX+LjBBB9P9dtMBAX+oHQXEKCJJJJ94HQKABAVCUFCIgAIvCETFAQ87EBDNDNjBBJzARARn+TAWAWn+TAOAOn+TGRjBBBBARjBBBB9ge+RjB/+fsnjBBBzmGR+LjBBB9P9dtMBAR+oHQXEKCJJJJ94HQKABAVCIgAIvCETFAQ87EBALCWFHLAICLFHIAECUFGEMBKKK9MBDNADCD4AE2GEtMBINABABYDBGDCWTCW91+yADCE91CJJJ/8IFCJJJ98g++nuDBABCLFHBAECUFGEMBKKK9TEIUCBCBYDJ1JJBGEABCIFC98gFGBbDJ1JJBDNDNABzBCZTGD9NMBCUHIABAD9rCffIFCZ4NBCUsMEKAEHIKAIK/lEEEUDNDNAEABvCIgtMBABHIXEKDNDNADCZ9PMBABHIXEKABHIINAIAEYDBbDBAICLFAECLFYDBbDBAICWFAECWFYDBbDBAICXFAECXFYDBbDBAICZFHIAECZFHEADC9wFGDCS0MBKKADCL6MBINAIAEYDBbDBAECLFHEAICLFHIADC98FGDCI0MBKKDNADtMBINAIAErBB86BBAICEFHIAECEFHEADCUFGDMBKKABK/AEEDUDNDNABCIgtMBABHIXEKAECfEgC+B+C+EW2HLDNDNADCZ9PMBABHIXEKABHIINAIALbDBAICXFALbDBAICWFALbDBAICLFALbDBAICZFHIADC9wFGDCS0MBKKADCL6MBINAIALbDBAICLFHIADC98FGDCI0MBKKDNADtMBINAIAE86BBAICEFHIADCUFGDMBKKABKKKEBCJWKLZ9kBB",t="B9h79tEBBBEkL9gBB9gVUUUUUEU9gIUUUB9gEUEUIKQBBEBEEDDDILVE9wEEEVIEBEOWEUEC+Q/aEKR/LEdO9tw9t9vv95DBh9f9f939h79t9f9j9h229f9jT9vv7BB8a9tw79o9v9wT9f9kw9j9v9kw9WwvTw949C919m9mwvBDy9tw79o9v9wT9f9kw9j9v9kw69u9kw949C919m9mwvBLe9tw79o9v9wT9f9kw9j9v9kw69u9kw949Twg91w9u9jwBVl9tw79o9v9wT9f9kw9j9v9kws9p2Twv9P9jTBOk9tw79o9v9wT9f9kw9j9v9kws9p2Twv9R919hTBRl9tw79o9v9wT9f9kw9j9v9kws9p2Twvt949wBWL79iv9rBdQ/T9TQLBZIK9+EVU8jJJJJBCZ9rHBCBHEINCBHDCBHIINABCWFADFAICJUAEAD4CEgGLe86BBAIALFHIADCEFGDCW9HMBKAEC+Q+YJJBFAI86BBAECITC+Q1JJBFAB8pIW83IBAECEFGECJD9HMBKK/H8jLhUD97EUO978jJJJJBCJ/KB9rGV8kJJJJBC9+HODNADCEFAL0MBCUHOAIrBBC+gE9HMBAVAIALFGRAD9rAD/8QBBCJ/ABAD9uHOAICEFHLDNADtMBAOC/wfBgGOCJDAOCJD6eHWCBHdINAdAE9PMEAWAEAd9rAdAWFAE6eGQCSFGOC9wgGKCI2HXAKCETHMAOCL4CIFCD4HpABAdAD2FHSCBHZDNINCEHhALHoCBHaDNINARAo9rAp6MIAVCJ/CBFAaAK2FHcAoApFHLCBHIDNAKC/AB6MBARAL9rC/gB6MBCBHOINAcAOFHIDNDNDNDNDNAoAOCO4FrBBGxCIgpLBEDIBKAIPXBBBBBBBBBBBBBBBBPKLBXIKAIALPBBLALPBBBGqCLP+MEAqPMBZEhDoIaLcVxOqRlGqCDP+MEAqPMBZEhDoIaLcVxOqRlPXIIIIIIIIIIIIIIIIP9OGlPXIIIIIIIIIIIIIIIIP8jGqP5B9CJf/8/4/w/g/AB9+9Cu1+nGkCITC+Q1JJBFPBIBAkC+Q+YJJBFPBBBGyAyPMBBBBBBBBBBBBBBBBAqP5E9CJf/8/4/w/g/AB9+9Cu1+nGkCITC+Q1JJBFPBIBP9uPMBEDILVORZhoacxqlPpAlAqP9SPKLBALCLFAyPqBFAkC+Q+YJJBFrBBFHLXDKAIALPBBWALPBBBGqCLP+MEAqPMBZEhDoIaLcVxOqRlPXSSSSSSSSSSSSSSSSP9OGlPXSSSSSSSSSSSSSSSSP8jGqP5B9CJf/8/4/w/g/AB9+9Cu1+nGkCITC+Q1JJBFPBIBAkC+Q+YJJBFPBBBGyAyPMBBBBBBBBBBBBBBBBAqP5E9CJf/8/4/w/g/AB9+9Cu1+nGkCITC+Q1JJBFPBIBP9uPMBEDILVORZhoacxqlPpAlAqP9SPKLBALCWFAyPqBFAkC+Q+YJJBFrBBFHLXEKAIALPBBBPKLBALCZFHLKDNDNDNDNDNAxCD4CIgpLBEDIBKAIPXBBBBBBBBBBBBBBBBPKLZXIKAIALPBBLALPBBBGqCLP+MEAqPMBZEhDoIaLcVxOqRlGqCDP+MEAqPMBZEhDoIaLcVxOqRlPXIIIIIIIIIIIIIIIIP9OGlPXIIIIIIIIIIIIIIIIP8jGqP5B9CJf/8/4/w/g/AB9+9Cu1+nGkCITC+Q1JJBFPBIBAkC+Q+YJJBFPBBBGyAyPMBBBBBBBBBBBBBBBBAqP5E9CJf/8/4/w/g/AB9+9Cu1+nGkCITC+Q1JJBFPBIBP9uPMBEDILVORZhoacxqlPpAlAqP9SPKLZALCLFAyPqBFAkC+Q+YJJBFrBBFHLXDKAIALPBBWALPBBBGqCLP+MEAqPMBZEhDoIaLcVxOqRlPXSSSSSSSSSSSSSSSSP9OGlPXSSSSSSSSSSSSSSSSP8jGqP5B9CJf/8/4/w/g/AB9+9Cu1+nGkCITC+Q1JJBFPBIBAkC+Q+YJJBFPBBBGyAyPMBBBBBBBBBBBBBBBBAqP5E9CJf/8/4/w/g/AB9+9Cu1+nGkCITC+Q1JJBFPBIBP9uPMBEDILVORZhoacxqlPpAlAqP9SPKLZALCWFAyPqBFAkC+Q+YJJBFrBBFHLXEKAIALPBBBPKLZALCZFHLKDNDNDNDNDNAxCL4CIgpLBEDIBKAIPXBBBBBBBBBBBBBBBBPKLAXIKAIALPBBLALPBBBGqCLP+MEAqPMBZEhDoIaLcVxOqRlGqCDP+MEAqPMBZEhDoIaLcVxOqRlPXIIIIIIIIIIIIIIIIP9OGlPXIIIIIIIIIIIIIIIIP8jGqP5B9CJf/8/4/w/g/AB9+9Cu1+nGkCITC+Q1JJBFPBIBAkC+Q+YJJBFPBBBGyAyPMBBBBBBBBBBBBBBBBAqP5E9CJf/8/4/w/g/AB9+9Cu1+nGkCITC+Q1JJBFPBIBP9uPMBEDILVORZhoacxqlPpAlAqP9SPKLAALCLFAyPqBFAkC+Q+YJJBFrBBFHLXDKAIALPBBWALPBBBGqCLP+MEAqPMBZEhDoIaLcVxOqRlPXSSSSSSSSSSSSSSSSP9OGlPXSSSSSSSSSSSSSSSSP8jGqP5B9CJf/8/4/w/g/AB9+9Cu1+nGkCITC+Q1JJBFPBIBAkC+Q+YJJBFPBBBGyAyPMBBBBBBBBBBBBBBBBAqP5E9CJf/8/4/w/g/AB9+9Cu1+nGkCITC+Q1JJBFPBIBP9uPMBEDILVORZhoacxqlPpAlAqP9SPKLAALCWFAyPqBFAkC+Q+YJJBFrBBFHLXEKAIALPBBBPKLAALCZFHLKDNDNDNDNDNAxCO4pLBEDIBKAIPXBBBBBBBBBBBBBBBBPKL8wXIKAIALPBBLALPBBBGqCLP+MEAqPMBZEhDoIaLcVxOqRlGqCDP+MEAqPMBZEhDoIaLcVxOqRlPXIIIIIIIIIIIIIIIIP9OGlPXIIIIIIIIIIIIIIIIP8jGqP5B9CJf/8/4/w/g/AB9+9Cu1+nGxCITC+Q1JJBFPBIBAxC+Q+YJJBFPBBBGyAyPMBBBBBBBBBBBBBBBBAqP5E9CJf/8/4/w/g/AB9+9Cu1+nGxCITC+Q1JJBFPBIBP9uPMBEDILVORZhoacxqlPpAlAqP9SPKL8wALCLFAyPqBFAxC+Q+YJJBFrBBFHLXDKAIALPBBWALPBBBGqCLP+MEAqPMBZEhDoIaLcVxOqRlPXSSSSSSSSSSSSSSSSP9OGlPXSSSSSSSSSSSSSSSSP8jGqP5B9CJf/8/4/w/g/AB9+9Cu1+nGxCITC+Q1JJBFPBIBAxC+Q+YJJBFPBBBGyAyPMBBBBBBBBBBBBBBBBAqP5E9CJf/8/4/w/g/AB9+9Cu1+nGxCITC+Q1JJBFPBIBP9uPMBEDILVORZhoacxqlPpAlAqP9SPKL8wALCWFAyPqBFAxC+Q+YJJBFrBBFHLXEKAIALPBBBPKL8wALCZFHLKAOC/ABFHIAOCJEFAK0MEAIHOARAL9rC/fB0MBKKDNDNAIAK9PMBAICI4HOINARAL9rCk6MDAcAIFHxDNDNDNDNDNAoAICO4FrBBAOCOg4CIgpLBEDIBKAxPXBBBBBBBBBBBBBBBBPKLBXIKAxALPBBLALPBBBGqCLP+MEAqPMBZEhDoIaLcVxOqRlGqCDP+MEAqPMBZEhDoIaLcVxOqRlPXIIIIIIIIIIIIIIIIP9OGlPXIIIIIIIIIIIIIIIIP8jGqP5B9CJf/8/4/w/g/AB9+9Cu1+nGkCITC+Q1JJBFPBIBAkC+Q+YJJBFPBBBGyAyPMBBBBBBBBBBBBBBBBAqP5E9CJf/8/4/w/g/AB9+9Cu1+nGkCITC+Q1JJBFPBIBP9uPMBEDILVORZhoacxqlPpAlAqP9SPKLBALCLFAyPqBFAkC+Q+YJJBFrBBFHLXDKAxALPBBWALPBBBGqCLP+MEAqPMBZEhDoIaLcVxOqRlPXSSSSSSSSSSSSSSSSP9OGlPXSSSSSSSSSSSSSSSSP8jGqP5B9CJf/8/4/w/g/AB9+9Cu1+nGkCITC+Q1JJBFPBIBAkC+Q+YJJBFPBBBGyAyPMBBBBBBBBBBBBBBBBAqP5E9CJf/8/4/w/g/AB9+9Cu1+nGkCITC+Q1JJBFPBIBP9uPMBEDILVORZhoacxqlPpAlAqP9SPKLBALCWFAyPqBFAkC+Q+YJJBFrBBFHLXEKAxALPBBBPKLBALCZFHLKAOCDFHOAICZFGIAK6MBKKALtMBAaCI6HhALHoAaCEFGOHaAOCLsMDXEKKCBHLAhCEgMDKDNAKtMBAVCJDFAZFHIAVAZFPBDBHyCBHxINAIAVCJ/CBFAxFGOPBLBGlCEP9tAlPXEEEEEEEEEEEEEEEEGqP9OP9hP9RGlAOAKFPBLBG8aCEP9tA8aAqP9OP9hP9RG8aPMBZEhDoIaLcVxOqRlGeAOAMFPBLBG3CEP9tA3AqP9OP9hP9RG3AOAXFPBLBG5CEP9tA5AqP9OP9hP9RG5PMBZEhDoIaLcVxOqRlG8ePMBEZhDIoaLVcxORqlGqAqPMBEDIBEDIBEDIBEDIAyP9uGyP9aDBBAIADFGOAyAqAqPMLVORLVORLVORLVORP9uGyP9aDBBAOADFGOAyAqAqPMWdQKWdQKWdQKWdQKP9uGyP9aDBBAOADFGOAyAqAqPMXMpSXMpSXMpSXMpSP9uGyP9aDBBAOADFGOAyAeA8ePMWdkyQK8aeXM35pS8e8fGqAqPMBEDIBEDIBEDIBEDIP9uGyP9aDBBAOADFGOAyAqAqPMLVORLVORLVORLVORP9uGyP9aDBBAOADFGOAyAqAqPMWdQKWdQKWdQKWdQKP9uGyP9aDBBAOADFGOAyAqAqPMXMpSXMpSXMpSXMpSP9uGyP9aDBBAOADFGOAyAlA8aPMWkdyQ8aKeX3M5p8eS8fGlA3A5PMWkdyQ8aKeX3M5p8eS8fG8aPMBEZhDIoaLVcxORqlGqAqPMBEDIBEDIBEDIBEDIP9uGyP9aDBBAOADFGOAyAqAqPMLVORLVORLVORLVORP9uGyP9aDBBAOADFGOAyAqAqPMWdQKWdQKWdQKWdQKP9uGyP9aDBBAOADFGOAyAqAqPMXMpSXMpSXMpSXMpSP9uGyP9aDBBAOADFGOAyAlA8aPMWdkyQK8aeXM35pS8e8fGqAqPMBEDIBEDIBEDIBEDIP9uGyP9aDBBAOADFGOAyAqAqPMLVORLVORLVORLVORP9uGyP9aDBBAOADFGOAyAqAqPMWdQKWdQKWdQKWdQKP9uGyP9aDBBAOADFGOAyAqAqPMXMpSXMpSXMpSXMpSP9uGyP9aDBBAOADFHIAxCZFGxAK6MBKKAZCLFGZAD6MBKASAVCJDFAQAD2/8QBBAVAVCJDFAQCUFAD2FAD/8QBBAQAdFHdC9+HOALMEXIKKC9+HOXEKCBC99ARAL9rADCAADCA0eseHOKAVCJ/KBF8kJJJJBAOKWBZ+BJJJBK/UZEhU8jJJJJBC/AE9rGV8kJJJJBC9+HODNAECI9uGRChFAL0MBCUHOAIrBBGWC/wEgC/gE9HMBAWCSgGdCE0MBAVC/ABFCfECJE/8KBAVCuF9CU83IBAVC8wF9CU83IBAVCYF9CU83IBAVCAF9CU83IBAVCkF9CU83IBAVCZF9CU83IBAV9CU83IWAV9CU83IBAIALFC9wFHQAICEFGWARFHODNAEtMBCMCSAdCEseHKCBHXCBHMCBHdCBHICBHLINDNAOAQ9NMBC9+HOXIKDNDNAWrBBGRC/vE0MBAVC/ABFALARCL4CU7FCSgCITFGpYDLHSApYDBHZDNARCSgGpAK9PMBAVAIARCU7FCSgCDTFYDBAXApeHRAptHpDNDNADCD9HMBABAdCETFGhAZ87EBAhCDFAS87EBAhCLFAR87EBXEKABAdCDTFGhAZbDBAhCLFASbDBAhCWFARbDBKAXApFHXAVC/ABFALCITFGhARbDBAhASbDLAVAICDTFARbDBAVC/ABFALCEFCSgGLCITFGhAZbDBAhARbDLAIApFHIALCEFHLXDKDNDNApCSsMBAMApFApC987FCEFHMXEKAOCEFHRAO8sBBGpCfEgHhDNDNApCU9MMBARHOXEKAOCVFHOAhCfBgHhCRHpDNINAR8sBBGoCfBgApTAhvHhAoCU9KMEARCEFHRApCRFGpC8j9HMBXDKKARCEFHOKAhCE4CBAhCEg9r7AMFHMKDNDNADCD9HMBABAdCETFGRAZ87EBARCDFAS87EBARCLFAM87EBXEKABAdCDTFGRAZbDBARCLFASbDBARCWFAMbDBKAVC/ABFALCITFGRAMbDBARASbDLAVAICDTFAMbDBAVC/ABFALCEFCSgGLCITFGRAZbDBARAMbDLAICEFHIALCEFHLXEKDNARCPE0MBAXCEFGoAVAIAQARCSgFrBBGpCL49rCSgCDTFYDBApCZ6GheHRAVAIAp9rCSgCDTFYDBAoAhFGSApCSgGoeHpAotHoDNDNADCD9HMBABAdCETFGZAX87EBAZCDFAR87EBAZCLFAp87EBXEKABAdCDTFGZAXbDBAZCLFARbDBAZCWFApbDBKAVAICDTFAXbDBAVC/ABFALCITFGZARbDBAZAXbDLAVAICEFGICSgCDTFARbDBAVC/ABFALCEFCSgCITFGZApbDBAZARbDLAVAIAhFCSgGICDTFApbDBAVC/ABFALCDFCSgGLCITFGRAXbDBARApbDLALCEFHLAIAoFHIASAoFHXXEKAXCBAOrBBGZeGaARC/+EsGRFHSAZCSgHcAZCL4HxDNDNAZCS0MBASCEFHoXEKASHoAVAIAx9rCSgCDTFYDBHSKDNDNAcMBAoCEFHXXEKAoHXAVAIAZ9rCSgCDTFYDBHoKDNDNARtMBAOCEFHRXEKAOCDFHRAO8sBEGhCfEgHpDNAhCU9KMBAOCOFHaApCfBgHpCRHODNINAR8sBBGhCfBgAOTApvHpAhCU9KMEARCEFHRAOCRFGOC8j9HMBKAaHRXEKARCEFHRKApCE4CBApCEg9r7AMFGMHaKDNDNAxCSsMBARHpXEKARCEFHpAR8sBBGOCfEgHhDNAOCU9KMBARCVFHSAhCfBgHhCRHODNINAp8sBBGRCfBgAOTAhvHhARCU9KMEApCEFHpAOCRFGOC8j9HMBKASHpXEKApCEFHpKAhCE4CBAhCEg9r7AMFGMHSKDNDNAcCSsMBApHOXEKApCEFHOAp8sBBGRCfEgHhDNARCU9KMBApCVFHoAhCfBgHhCRHRDNINAO8sBBGpCfBgARTAhvHhApCU9KMEAOCEFHOARCRFGRC8j9HMBKAoHOXEKAOCEFHOKAhCE4CBAhCEg9r7AMFGMHoKDNDNADCD9HMBABAdCETFGRAa87EBARCDFAS87EBARCLFAo87EBXEKABAdCDTFGRAabDBARCLFASbDBARCWFAobDBKAVC/ABFALCITFGRASbDBARAabDLAVAICDTFAabDBAVC/ABFALCEFCSgCITFGRAobDBARASbDLAVAICEFGICSgCDTFASbDBAVC/ABFALCDFCSgCITFGRAabDBARAobDLAVAIAZCZ6AxCSsvFGICSgCDTFAobDBAIActAcCSsvFHIALCIFHLKAWCEFHWALCSgHLAICSgHIAdCIFGdAE6MBKKCBC99AOAQseHOKAVC/AEF8kJJJJBAOK+LLEVU8jJJJJBCZ9rHVC9+HODNAECVFAL0MBCUHOAIrBBC/+EgC/QE9HMBAV9CB83IWAICEFHRAIALFC98FHWDNAEtMBDNADCDsMBCBHdINDNARAW6MBC9+SKARCEFHOAR8sBBGLCfEgHIDNDNALCU9MMBAOHRXEKARCVFHRAICfBgHICRHLDNINAO8sBBGDCfBgALTAIvHIADCU9KMEAOCEFHOALCRFGLC8j9HMBXDKKAOCEFHRKABAdCDTFAICD4CBAICE4CEg9r7AVCWFAICEgCDTvGOYDBFGLbDBAOALbDBAdCEFGdAE9HMBXDKKCBHdINDNARAW6MBC9+SKARCEFHOAR8sBBGLCfEgHIDNDNALCU9MMBAOHRXEKARCVFHRAICfBgHICRHLDNINAO8sBBGDCfBgALTAIvHIADCU9KMEAOCEFHOALCRFGLC8j9HMBXDKKAOCEFHRKABAdCETFAICD4CBAICE4CEg9r7AVCWFAICEgCDTvGOYDBFGL87EBAOALbDBAdCEFGdAE9HMBKKCBC99ARAWseHOKAOK+epLIUO97EUE978jJJJJBCA9rHIDNDNADCL9HMBDNAEC98gGLtMBCBHVABHDINADADPBBBGOCkP+rECkP+sEP/6EGRAOCWP+rECkP+sEP/6EARP/gEAOCZP+rECkP+sEP/6EGWP/gEP/kEP/lEGdPXBBBBBBBBBBBBBBBBP+2EGQARPXBBBJBBBJBBBJBBBJGKP9OP9RP/kEGRPXBB/+9CBB/+9CBB/+9CBB/+9CARARP/mEAdAdP/mEAWAQAWAKP9OP9RP/kEGRARP/mEP/kEP/kEP/jEP/nEGWP/mEPXBBN0BBN0BBN0BBN0GQP/kEPXfBBBfBBBfBBBfBBBP9OAOPXBBBfBBBfBBBfBBBfP9OP9QARAWP/mEAQP/kECWP+rEPXBfBBBfBBBfBBBfBBP9OP9QAdAWP/mEAQP/kECZP+rEPXBBfBBBfBBBfBBBfBP9OP9QPKBBADCZFHDAVCLFGVAL6MBKKALAE9PMEAIAECIgGVCDTGDvCBCZAD9r/8KBAIABALCDTFGLAD/8QBBDNAVtMBAIAIPBLBGOCkP+rECkP+sEP/6EGRAOCWP+rECkP+sEP/6EARP/gEAOCZP+rECkP+sEP/6EGWP/gEP/kEP/lEGdPXBBBBBBBBBBBBBBBBP+2EGQARPXBBBJBBBJBBBJBBBJGKP9OP9RP/kEGRPXBB/+9CBB/+9CBB/+9CBB/+9CARARP/mEAdAdP/mEAWAQAWAKP9OP9RP/kEGRARP/mEP/kEP/kEP/jEP/nEGWP/mEPXBBN0BBN0BBN0BBN0GQP/kEPXfBBBfBBBfBBBfBBBP9OAOPXBBBfBBBfBBBfBBBfP9OP9QARAWP/mEAQP/kECWP+rEPXBfBBBfBBBfBBBfBBP9OP9QAdAWP/mEAQP/kECZP+rEPXBBfBBBfBBBfBBBfBP9OP9QPKLBKALAIAD/8QBBSKDNAEC98gGXtMBCBHVABHDINADCZFGLALPBBBGOPXBBBBBBffBBBBBBffGKP9OADPBBBGdAOPMLVORXMpScxql358e8fPXfUBBfUBBfUBBfUBBP9OP/6EAdAOPMBEDIWdQKZhoaky8aeGOCZP+sEP/6EGRP/gEAOCZP+rECZP+sEP/6EGWP/gEP/kEP/lEGOPXB/+fsB/+fsB/+fsB/+fsAWAOPXBBBBBBBBBBBBBBBBP+2EGQAWPXBBBJBBBJBBBJBBBJGMP9OP9RP/kEGWAWP/mEAOAOP/mEARAQARAMP9OP9RP/kEGOAOP/mEP/kEP/kEP/jEP/nEGRP/mEPXBBN0BBN0BBN0BBN0GQP/kECZP+rEAWARP/mEAQP/kEPXffBBffBBffBBffBBP9OP9QGWAOARP/mEAQP/kEPXffBBffBBffBBffBBP9OGOPMWdkyQK8aeXM35pS8e8fP9QPKBBADAdAKP9OAWAOPMBEZhDIoaLVcxORqlP9QPKBBADCAFHDAVCLFGVAX6MBKKAXAE9PMBAIAECIgGVCITGDFCBCAAD9r/8KBAIABAXCITFGLAD/8QBBDNAVtMBAIAIPBLZGOPXBBBBBBffBBBBBBffGKP9OAIPBLBGdAOPMLVORXMpScxql358e8fPXfUBBfUBBfUBBfUBBP9OP/6EAdAOPMBEDIWdQKZhoaky8aeGOCZP+sEP/6EGRP/gEAOCZP+rECZP+sEP/6EGWP/gEP/kEP/lEGOPXB/+fsB/+fsB/+fsB/+fsAWAOPXBBBBBBBBBBBBBBBBP+2EGQAWPXBBBJBBBJBBBJBBBJGMP9OP9RP/kEGWAWP/mEAOAOP/mEARAQARAMP9OP9RP/kEGOAOP/mEP/kEP/kEP/jEP/nEGRP/mEPXBBN0BBN0BBN0BBN0GQP/kECZP+rEAWARP/mEAQP/kEPXffBBffBBffBBffBBP9OP9QGWAOARP/mEAQP/kEPXffBBffBBffBBffBBP9OGOPMWdkyQK8aeXM35pS8e8fP9QPKLZAIAdAKP9OAWAOPMBEZhDIoaLVcxORqlP9QPKLBKALAIAD/8QBBKK/4WLLUE97EUV978jJJJJBC8w9rHIDNAEC98gGLtMBCBHVABHOINAIAOPBBBGRAOCZFGWPBBBGdPMLVORXMpScxql358e8fGQCZP+sEGKCLP+rEPKLBAOPXBBJzBBJzBBJzBBJzPX/zL81z/zL81z/zL81z/zL81zAKPXIBBBIBBBIBBBIBBBP9QP/6EP/nEGKARAdPMBEDIWdQKZhoaky8aeGRCZP+rECZP+sEP/6EP/mEGdAdP/mEAKARCZP+sEP/6EP/mEGXAXP/mEAKAQCZP+rECZP+sEP/6EP/mEGQAQP/mEP/kEP/kEP/lEPXBBBBBBBBBBBBBBBBP+4EP/jEPXB/+fsB/+fsB/+fsB/+fsGKP/mEPXBBN0BBN0BBN0BBN0GRP/kEPXffBBffBBffBBffBBGMP9OAXAKP/mEARP/kECZP+rEP9QGXAQAKP/mEARP/kECZP+rEAdAKP/mEARP/kEAMP9OP9QGKPMBEZhDIoaLVcxORqlGRP5BAIPBLBPeB+t+J83IBAOCWFARP5EAIPBLBPeE+t+J83IBAWAXAKPMWdkyQK8aeXM35pS8e8fGKP5BAIPBLBPeD+t+J83IBAOCkFAKP5EAIPBLBPeI+t+J83IBAOCAFHOAVCLFGVAL6MBKKDNALAE9PMBAIAECIgGVCITGOFCBCAAO9r/8KBAIABALCITFGWAO/8QBBDNAVtMBAIAIPBLBGRAIPBLZGdPMLVORXMpScxql358e8fGQCZP+sEGKCLP+rEPKLAAIPXBBJzBBJzBBJzBBJzPX/zL81z/zL81z/zL81z/zL81zAKPXIBBBIBBBIBBBIBBBP9QP/6EP/nEGKARAdPMBEDIWdQKZhoaky8aeGRCZP+rECZP+sEP/6EP/mEGdAdP/mEAKARCZP+sEP/6EP/mEGXAXP/mEAKAQCZP+rECZP+sEP/6EP/mEGQAQP/mEP/kEP/kEP/lEPXBBBBBBBBBBBBBBBBP+4EP/jEPXB/+fsB/+fsB/+fsB/+fsGKP/mEPXBBN0BBN0BBN0BBN0GRP/kEPXffBBffBBffBBffBBGMP9OAXAKP/mEARP/kECZP+rEP9QGXAQAKP/mEARP/kECZP+rEAdAKP/mEARP/kEAMP9OP9QGKPMBEZhDIoaLVcxORqlGRP5BAIPBLAPeB+t+J83IBAIARP5EAIPBLAPeE+t+J83IWAIAXAKPMWdkyQK8aeXM35pS8e8fGKP5BAIPBLAPeD+t+J83IZAIAKP5EAIPBLAPeI+t+J83IkKAWAIAO/8QBBKK+pDDIUE978jJJJJBC/AB9rHIDNADCD4AE2GLC98gGVtMBCBHDABHEINAEAEPBBBGOCWP+rECWP+sEP/6EAOCEP+sEPXBBJzBBJzBBJzBBJzP+uEPXBBJfBBJfBBJfBBJfP9OP/mEPKBBAECZFHEADCLFGDAV6MBKKDNAVAL9PMBAIALCIgGDCDTGEvCBC/ABAE9r/8KBAIABAVCDTFGVAE/8QBBDNADtMBAIAIPBLBGOCWP+rECWP+sEP/6EAOCEP+sEPXBBJzBBJzBBJzBBJzP+uEPXBBJfBBJfBBJfBBJfP9OP/mEPKLBKAVAIAE/8QBBKK9TEIUCBCBYDJ1JJBGEABCIFC98gFGBbDJ1JJBDNDNABzBCZTGD9NMBCUHIABAD9rCffIFCZ4NBCUsMEKAEHIKAIKKKEBCJWKLZ9tBB",n=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),i=new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]);if(typeof WebAssembly!="object")return{supported:!1};var o=e;WebAssembly.validate(n)&&(o=t);var r,s=WebAssembly.instantiate(a(o),{}).then(function(h){r=h.instance,r.exports.__wasm_call_ctors()});function a(h){for(var _=new Uint8Array(h.length),g=0;g<h.length;++g){var p=h.charCodeAt(g);_[g]=p>96?p-71:p>64?p-65:p>47?p+4:p>46?63:62}for(var y=0,g=0;g<h.length;++g)_[y++]=_[g]<60?i[_[g]]:(_[g]-60)*64+_[++g];return _.buffer.slice(0,y)}function c(h,_,g,p,y,T){var b=r.exports.sbrk,x=g+3&-4,v=b(x*p),D=b(y.length),L=new Uint8Array(r.exports.memory.buffer);L.set(y,D);var B=h(v,g,p,D,y.length);if(B==0&&T&&T(v,x,p),_.set(L.subarray(v,v+g*p)),b(v-b(0)),B!=0)throw new Error("Malformed buffer data: "+B)}var u={0:"",1:"meshopt_decodeFilterOct",2:"meshopt_decodeFilterQuat",3:"meshopt_decodeFilterExp",NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},f={0:"meshopt_decodeVertexBuffer",1:"meshopt_decodeIndexBuffer",2:"meshopt_decodeIndexSequence",ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};return{ready:s,supported:!0,decodeVertexBuffer:function(h,_,g,p,y){c(r.exports.meshopt_decodeVertexBuffer,h,_,g,p,r.exports[u[y]])},decodeIndexBuffer:function(h,_,g,p){c(r.exports.meshopt_decodeIndexBuffer,h,_,g,p)},decodeIndexSequence:function(h,_,g,p){c(r.exports.meshopt_decodeIndexSequence,h,_,g,p)},decodeGltfBuffer:function(h,_,g,p,y,T){c(r.exports[f[y]],h,_,g,p,r.exports[u[T]])}}}();(function(){var e="B9h79tEBBBECd9gEUEU9gEUB9gBB9gQUUUUUUU99UUEU9gVUUUUUB9gLUUUUE999gIUUUE999gLUUUUEU9gIUUUEUIMXDILVORBWWBEWLVE9wEIIVIEBEOWEUECJ/JEKR7OO9tw9t9vv95DBh9f9f939h79t9f9j9h229f9jT9vv7BBZ9tw79o9v9wT9f79p9t9w29p9m95BEx9tw79o9v9wT9f79p9t9w29p9m959T9j9h2wBLA9tw79o9v9wT9f9v9wT9p9t9p96w9WwvTw94swT9j9o9Sw9t9h9wBVL79iv9rBOdWEBCEKDdQQ+stXDBK/48yIkUp99hU8jJJJJBCJ/BB9rGQ8kJJJJBAQCkFCBC/kBZ1JJJB8aCUALCDTGKALCffffI0eGXCBYD/s1JJBhJJJJBBHMAQCkFAQYD94GpCDTFAMbDBAQAMbDWAQApCEFbD94AXCBYD/s1JJBhJJJJBBHSAQCkFAQYD94GpCDTFASbDBAQASbDXAQApCEFbD94CUADCITADCffffE0eCBYD/s1JJBhJJJJBBHZAQCkFAQYD94GpCDTFAZbDBAQAZbDZAQApCEFbD94AQCWFAEADALCBZ+CJJJBAXCBYD/s1JJBhJJJJBBHhAQCkFAQYD94GpCDTFAhbDBAQApCEFbD94AXCBYD/s1JJBhJJJJBBHoAQCkFAQYD94GpCDTFAobDBAQApCEFbD94ALCD4ALFHaCEHcINAcGpCETHcApAa6MBKCBHxCUApCDTGaApCffffI0eCBYD/s1JJBhJJJJBBHcAQCkFAQYD94GqCDTFAcbDBAQAqCEFbD94AcCfEAaZ1JJJBHlDNALtMBAVCD4HkApCUFHqINAIAxAk2CDTFGyYDLGpCh4Ap7C+f+B+dd2AyYDBGpCh4Ap7C/d/o+b8j27AyYDWGpCh4Ap7C+3f/n8n27HaCBHpDNDNINAlAaAqgGaCDTFG8aYDBGcCUsMEAIAcAk2CDTFAyCXZ+LJJJBtMDApCEFGpAaFHaApAq9NMBXDKKA8aAxbDBAxHcKAhAxCDTFAcbDBAxCEFGxAL9HMBKCBHpAoHcINAcApbDBAcCLFHcALApCEFGp9HMBKCBHpAhHcAoHaINDNApAcYDBGqsMBAaAoAqCDTFGqYDBbDBAqApbDBKAcCLFHcAaCLFHaALApCEFGp9HMBKKCBHaALCBYD/s1JJBhJJJJBBHyAQCkFAQYD94GpCDTFAybDBAQApCEFbD94AXCBYD/s1JJBhJJJJBBHpAQCkFAQYD94GcCDTFApbDBAQAcCEFbD94AXCBYD/s1JJBhJJJJBBHcAQCkFAQYD94GqCDTFAcbDBAQAqCEFbD94ApCfEAKZ1JJJBHeAcCfEAKZ1JJJBH3DNALtMBAZCWFH5INDNAMAaCDTGpFYDBG8etMBAZASApFYDBCITFH8fA3ApFHAAeApFHxCBHkINDNDNA8fAkCITFYDBGlAa9HMBAxAabDBAAAabDBXEKDNAMAlCDTGKFYDBGHtMBAZASAKFYDBCITGpFYDBAasMEAHCUFH8aA5ApFHcCBHpINA8aApsMEApCEFHpAcYDBHqAcCWFHcAqAa9HMBKApAH6MEKA3AKFGpAaAlApYDBCUsebDBAxAlAaAxYDBCUsebDBKAkCEFGkA8e9HMBKKAaCEFGaAL9HMBKAhHcAoHaA3HqAeHkCBHpINDNDNApAcYDBG8a9HMBDNApAaYDBG8a9HMBAkYDBH8aDNAqYDBGlCU9HMBA8aCU9HMBAyApFCB86BBXIKAyApFHxDNApAlsMBApA8asMBAxCE86BBXIKAxCL86BBXDKDNApAoA8aCDTGlFYDB9HMBDNAqYDBGxCUsMBApAxsMBAkYDBGKCUsMBApAKsMBA3AlFYDBG8eCUsMBA8eA8asMBAeAlFYDBGlCUsMBAlA8asMBDNAhAxCDTFYDBAhAlCDTFYDB9HMBAhAKCDTFYDBAhA8eCDTFYDB9HMBAyApFCD86BBXLKAyApFCL86BBXIKAyApFCL86BBXDKAyApFCL86BBXEKAyApFAyA8aFrBB86BBKAcCLFHcAaCLFHaAqCLFHqAkCLFHkALApCEFGp9HMBKAWCEgtMBAyHpALHcINDNAprBBCE9HMBApCL86BBKApCEFHpAcCUFGcMBKKCBHkCUALCX2ALC/V+q/V+qE0eCBYD/s1JJBhJJJJBBHMAQCkFAQYD94GpCDTFAMbDBAQApCEFbD94AMAIALAVZ+DJJJB8aCUALC8s2GcALC/d/o/F8u0eCBYD/s1JJBhJJJJBBHpAQCkFAQYD94GaCDTFApbDBAQAaCEFbD94ApCBAcZ1JJJBHZDNADtMBAEHcINDNAMAcCLFYDBG8aCX2FGpiDBAMAcYDBGlCX2FGaiDBGG+TG8jAMAcCWFYDBGxCX2FGqCLFiDBAaCLFiDBG8k+TG8lnAqiDBAG+TG8mApCLFiDBA8k+TG8nn+TGYAYnA8nAqCWFiDBAaCWFiDBG8p+TGinA8lApCWFiDBA8p+TG8nn+TG8lA8lnA8nA8mnAiA8jn+TG8jA8jnmm+RG8mjBBBB9etMBAYA8m+VHYA8jA8m+VH8jA8lA8m+VH8lKAZAhAlCDTFYDBC8s2FGpA8lA8m+RG8mA8lnnG8nApiDBmuDBApA8jA8mA8jnG8rnGiApiDLmuDLApAYA8mAYnG8snGrApiDWmuDWApA8rA8lnG8rApiDXmuDXApA8sA8lnG8uApiDZmuDZApA8sA8jnG8sApiDcmuDcApA8lA8mAYA8pnA8lAGnA8kA8jnmm+MG8knGGnG8lApiDkmuDkApA8jAGnG8jApiD3muD3ApAYAGnGYApiDAmuDAApAGA8knGGApiD8kmuD8kApA8mApiDYmuDYAZAhA8aCDTFYDBC8s2FGpA8nApiDBmuDBApAiApiDLmuDLApArApiDWmuDWApA8rApiDXmuDXApA8uApiDZmuDZApA8sApiDcmuDcApA8lApiDkmuDkApA8jApiD3muD3ApAYApiDAmuDAApAGApiD8kmuD8kApA8mApiDYmuDYAZAhAxCDTFYDBC8s2FGpA8nApiDBmuDBApAiApiDLmuDLApArApiDWmuDWApA8rApiDXmuDXApA8uApiDZmuDZApA8sApiDcmuDcApA8lApiDkmuDkApA8jApiD3muD3ApAYApiDAmuDAApAGApiD8kmuD8kApA8mApiDYmuDYAcCXFHcAkCIFGkAD6MBKCBH8aAEHxINCBHcINAyAEAcC+81JJBFYDBGlA8aFCDTFYDBGaFrBBHpDNDNAyAxAcFYDBGqFrBBGkC99FCfEgCPE0MBApCEsMBApCD9HMEKDNAkCUFCfEgCE0MBAeAqCDTFYDBAa9HMEKDNApCUFCfEgCE0MBA3AaCDTFYDBAq9HMEKDNAkCV2ApFC+g1JJBFrBBtMBAhAaCDTFYDBAhAqCDTFYDB0MEKjBBACjBBJzApCEseH8mAkCEsHKAEAlCDTC+81JJBFYDBA8aFCDTFYDBHlDNAMAaCX2FGpCWFiDBAMAqCX2FGkCWFiDBG8k+TG8lA8lnApiDBAkiDBG8p+TG8jA8jnApCLFiDBAkCLFiDBG8n+TGYAYnmm+RGGjBBBB9etMBA8lAG+VH8lAYAG+VHYA8jAG+VH8jKjBBACA8mAKeH8sDNAMAlCX2FGpiDWA8k+TG8mA8lA8mA8lnApiDBA8p+TGrA8jnAYApiDLA8n+TG8rnmmGin+TG8mA8mnArA8jAin+TG8lA8lnA8rAYAin+TG8jA8jnmm+RGYjBBBB9etMBA8mAY+VH8mA8jAY+VH8jA8lAY+VH8lKAZAhAqCDTFYDBC8s2FGpA8lA8sAGnGYA8lnnGiApiDBmuDBApA8jAYA8jnG8snGrApiDLmuDLApA8mAYA8mnGGnG8rApiDWmuDWApA8sA8lnG8sApiDXmuDXApAGA8lnG8uApiDZmuDZApAGA8jnG8vApiDcmuDcApA8lAYA8mA8knA8lA8pnA8nA8jnmm+MG8knGGnG8lApiDkmuDkApA8jAGnG8jApiD3muD3ApA8mAGnG8mApiDAmuDAApAGA8knGGApiD8kmuD8kApAYApiDYmuDYAZAhAaCDTFYDBC8s2FGpAiApiDBmuDBApArApiDLmuDLApA8rApiDWmuDWApA8sApiDXmuDXApA8uApiDZmuDZApA8vApiDcmuDcApA8lApiDkmuDkApA8jApiD3muD3ApA8mApiDAmuDAApAGApiD8kmuD8kApAYApiDYmuDYKAcCLFGcCX9HMBKAxCXFHxA8aCIFG8aAD6MBKKDNABAEsMBABAEADCDTZ+HJJJB8aKCUADCX2ADC/V+q/V+qE0eCBYD/s1JJBhJJJJBBHAAQCkFAQYD94GpCDTFAAbDBAQApCEFbD94CUADCDTADCffffI0eCBYD/s1JJBhJJJJBBH5AQCkFAQYD94GpCDTFA5bDBAQApCEFbD94AXCBYD/s1JJBhJJJJBBHIAQCkFAQYD94GpCDTFAIbDBAQApCEFbD94ALCBYD/s1JJBhJJJJBBH8wAQCkFAQYD94GpCDTFA8wbDBAQApCEFbD94jBBBBHrDNADAO9NMBARARnH8sAACWFH8xAQYDZH8yAQYDXH8zAQYDWH80jBBBBHrINAQCWFABADGSALAhZ+CJJJBCBHHABHxCBHKINCBHpINDNAhAxApFYDBGaCDTGEFYDBGkAhABApC+81JJBFYDBAKFCDTFYDBGcCDTFYDBG8asMBAyAcFrBBGlCV2AyAaFrBBGqFC/Q1JJBFrBBGDAqCV2AlFG8eC/Q1JJBFrBBG8fvCfEgtMBDNA8eC+g1JJBFrBBtMBA8aAk0MEKDNAqAl9HMBAqCUFCfEgCE0MBAeAEFYDBAc9HMEKAAAHCX2FGqAcAaA8fCfEgGkebDLAqAaAcAkebDBAqADA8fgCfEgCB9HbDWAHCEFHHKApCLFGpCX9HMBKAxCXFHxAKCIFGKAS6MBKDNDNAHtMBAAHcAHH8aINAcCWFGljBBBBjBBJzAZAhAcYDBGaCDTFYDBC8s2FGpiDYG8l+VA8ljBBBB9beApiDWAMAcCLFGEYDBGqCX2FGkCWFiDBG8lnApiDZAkiDBG8jnApiDAmG8mA8mmmA8lnApiDLAkCLFiDBG8mnApiDcA8lnApiD3mG8lA8lmmA8mnApiDBA8jnApiDXA8mnApiDkmG8lA8lmmA8jnApiD8kmmm+LnGYjBBBBjBBJzAZAhAqAaAlYDBGkeGlCDTFYDBC8s2FGpiDYG8l+VA8ljBBBB9beApiDWAMAaAqAkeGxCX2FGkCWFiDBG8lnApiDZAkiDBG8jnApiDAmG8mA8mmmA8lnApiDLAkCLFiDBG8mnApiDcA8lnApiD3mG8lA8lmmA8mnApiDBA8jnApiDXA8mnApiDkmG8lA8lmmA8jnApiD8kmmm+LnG8lAYA8l9fGpeuDBAEAqAxApebDBAcAaAlApebDBAcCXFHcA8aCUFG8aMBKAQCJEFCBCJ/ABZ1JJJB8aA8xHpAHHcINAQCJEFApYDBCo4C/8zgFGaAaYDBCEFbDBApCXFHpAcCUFGcMBKCBHpCBHcINAQCJEFApFGaYDBHqAaAcbDBAqAcFHcApCLFGpCJ/AB9HMBKCBHpA8xHcINAQCJEFAcYDBCo4C/8zgFGaAaYDBGaCEFbDBA5AaCDTFApbDBAcCXFHcAHApCEFGp9HMBKASAO9rGaCI9uH81DNALtMBCBHpAIHcINAcApbDBAcCLFHcALApCEFGp9HMBKKCBHbA8wCBALZ1JJJBH83AaCo9uHuA81CE4H85CBH86CBHKDNINAAA5AKCDTFYDBCX2FGxiDWG8jA8s9eMEA86A819PMEjffUUH8lDNA85AH9PMBAAA5A85CDTFYDBCX2FiDWjBB/AznH8lKDNA8jA8l9etMBA86Au0MDKDNA83AhAxYDLG87CDTG88FYDBGaFG89rBBA83AhAxYDBGECDTG8+FYDBGzFGNrBBvMBDNA80AzCDTGpFYDBGqtMBA8yA8zApFYDBCITFHpAMAaCX2FG8eCWFHDA8eCLFHXAMAzCX2FG8fCWFHVA8fCLFHWCBHcCEHlDNINDNAIApYDBCDTFYDBGkAasMBAIApCLFYDBCDTFYDBG8aAasMBAMA8aCX2FG8aiDBAMAkCX2FGkiDBG8m+TG8lAWiDBAkCLFiDBGY+TGGnA8fiDBA8m+TG8kA8aCLFiDBAY+TG8jn+TA8lAXiDBAY+TG8pnA8eiDBA8m+TG8nA8jn+TnA8jAViDBAkCWFiDBGY+TGinAGA8aCWFiDBAY+TG8mn+TA8jADiDBAY+TGYnA8pA8mn+TnA8mA8knAiA8ln+TA8mA8nnAYA8ln+TnmmjBBBB9dMDKApCWFHpAcCEFGcAq6HlAqAc9HMBKKAlCEgtMBA85CEFH85XEKAxCWFHqAZAaC8s2FGpAZAzC8s2FGciDBApiDBmuDBApAciDLApiDLmuDLApAciDWApiDWmuDWApAciDXApiDXmuDXApAciDZApiDZmuDZApAciDcApiDcmuDcApAciDkApiDkmuDkApAciD3ApiD3muD3ApAciDAApiDAmuDAApAciD8kApiD8kmuD8kApAciDYApiDYmuDYDNDNDNDNAyAEFGcrBBC9+FpDEBDKAEHpINAIApCDTGpFAabDBAoApFYDBGpAE9HMBXIKKAoA88FYDBHpAoA8+FYDBHEAIA8+FA87bDBApH87KAIAECDTFA87bDBKANCE86BBA89CE86BBAqiDBG8lArArA8l9deHrAbCEFHbCECDAcrBBCEseA86FH86KAKCEFGKAH9HMBKKAbtMBDNALtMBCBHcAeHpINDNApYDBGaCUsMBDNAcAIAaCDTGqFYDBGa9HMBAeAqFYDBHaKApAabDBKApCLFHpALAcCEFGc9HMBKCBHcA3HpINDNApYDBGaCUsMBDNAcAIAaCDTGqFYDBGa9HMBA3AqFYDBHaKApAabDBKApCLFHpALAcCEFGc9HMBKKCBHDABHpCBHkINDNAIApYDBCDTFYDBGcAIApCLFYDBCDTFYDBGasMBAcAIApCWFYDBCDTFYDBGqsMBAaAqsMBABADCDTFG8aAcbDBA8aCLFAabDBA8aCWFAqbDBADCIFHDKApCXFHpAkCIFGkAS9PMDXBKKASHDXDKADAO0MBKKDNAdtMBAdAr+RuDBKAQYD94GpCDTAQCkFFC98FHhDNINAptMEAhYDBCBYD/w1JJBh+BJJJBBAhC98FHhApCUFHpXBKKAQCJ/BBF8kJJJJBADK/PLEOUABYDBCBAICDTZ1JJJB8aADCI9uHVDNADtMBABYDBHODNALtMBAEHRADHWINAOALARYDBCDTFYDBCDTFGdAdYDBCEFbDBARCLFHRAWCUFGWMBXDKKAEHRADHWINAOARYDBCDTFGdAdYDBCEFbDBARCLFHRAWCUFGWMBKKDNAItMBABYDBHRABYDLHWCBHdAIHOINAWAdbDBAWCLFHWARYDBAdFHdARCLFHRAOCUFGOMBKKDNADCI6MBAVCEAVCE0eHQABYDLHVABYDWHRINAECWFYDBHWAECLFYDBHdAEYDBHODNALtMBALAWCDTFYDBHWALAdCDTFYDBHdALAOCDTFYDBHOKARAVAOCDTFGDYDBCITFAdbDBARADYDBCITFAWbDLADADYDBCEFbDBARAVAdCDTFGDYDBCITFAWbDBARADYDBCITFAObDLADADYDBCEFbDBARAVAWCDTFGWYDBCITFAObDBARAWYDBCITFAdbDLAWAWYDBCEFbDBAECXFHEAQCUFGQMBKKDNAItMBABYDLHRABYDBHWINARARYDBAWYDB9rbDBAWCLFHWARCLFHRAICUFGIMBKKK+3LDOUV998jJJJJBCA9rGLCZFCWFCBYD11JJBbDBALCB8pDJ1JJB83IZALCWFCBYDn1JJBbDBALCB8pD+M1JJB83IBDNADtMBAICD4HVDNABtMBAVCDTHOCBHRAEHWINABARCX2FGIAEARAV2CDTFGdiDBuDBAIAdiDLuDLAIAdiDWuDWCBHIINALCZFAIFGdAWAIFiDBGQAdiDBGKAKAQ9eeuDBALAIFGdAQAdiDBGKAKAQ9deuDBAICLFGICX9HMBKAWAOFHWARCEFGRAD9HMBXDKKAVCDTHRCBHWINCBHIINALCZFAIFGdAEAIFiDBGQAdiDBGKAKAQ9eeuDBALAIFGdAQAdiDBGKAKAQ9deuDBAICLFGICX9HMBKAEARFHEAWCEFGWAD9HMBKKALiDBALiDZGK+TjBBBB+XGQALiDLALiDcGX+TGMAMAQ9deGQALiDWALiDkGM+TGpApAQ9deHpDNABtMBADtMBjBBBBjBBJzAp+VApjBBBB9beHQINABAQABiDBAK+TnuDBABCLFGIAQAIiDBAX+TnuDBABCWFGIAQAIiDBAM+TnuDBABCXFHBADCUFGDMBKKApK+qDIDUI99DUCBHI8jJJJJBCA9rGLCZFCWFCBYD11JJBbDBALCB8pDJ1JJB83IZALCWFCBYDn1JJBbDBALCB8pD+M1JJB83IBDNDNAEMBjBBJfHVjBBJfHOjBBJfHRXEKADCD4CDTHWINCBHDINALCZFADFGdABADFiDBGOAdiDBGRARAO9eeuDBALADFGdAOAdiDBGRARAO9deuDBADCLFGDCX9HMBKABAWFHBAICEFGIAE9HMBKALiDWALiDk+THRALiDLALiDc+THOALiDBALiDZ+THVKAVjBBBB+XGVAOAOAV9deGOARARAO9deK9dEEUABCfEAICDTZ1JJJBHLCBHIDNADtMBINDNALAEYDBCDTFGBYDBCU9HMBABAIbDBAICEFHIKAECLFHEADCUFGDMBKKAIK9TEIUCBCBYD/01JJBGEABCIFC98gFGBbD/01JJBDNDNABzBCZTGD9NMBCUHIABAD9rCffIFCZ4NBCUsMEKAEHIKAIK/lEEEUDNDNAEABvCIgtMBABHIXEKDNDNADCZ9PMBABHIXEKABHIINAIAEYDBbDBAICLFAECLFYDBbDBAICWFAECWFYDBbDBAICXFAECXFYDBbDBAICZFHIAECZFHEADC9wFGDCS0MBKKADCL6MBINAIAEYDBbDBAECLFHEAICLFHIADC98FGDCI0MBKKDNADtMBINAIAErBB86BBAICEFHIAECEFHEADCUFGDMBKKABK/AEEDUDNDNABCIgtMBABHIXEKAECfEgC+B+C+EW2HLDNDNADCZ9PMBABHIXEKABHIINAIALbDBAICXFALbDBAICWFALbDBAICLFALbDBAICZFHIADC9wFGDCS0MBKKADCL6MBINAIALbDBAICLFHIADC98FGDCI0MBKKDNADtMBINAIAE86BBAICEFHIADCUFGDMBKKABK9TEIUCBCBYD/01JJBGEABCIFC98gFGBbD/01JJBDNDNABzBCZTGD9NMBCUHIABAD9rCffIFCZ4NBCUsMEKAEHIKAIK9+EIUzBHEDNDNCBYD/01JJBGDAECZTGI9NMBCUHEADAI9rCffIFCZ4NBCUsMEKADHEKCBABAE9rCIFC98gCBYD/01JJBFGDbD/01JJBDNADzBCZTGE9NMBADAE9rCffIFCZ4NB8aKK6EIUCBHIDNADtMBDNINABrBBGLAErBBGV9HMEAECEFHEABCEFHBADCUFGDMBXDKKALAV9rHIKAIKK+CEDBCJWK9pffUUffUUffUUffUfffUfffUfBBBBBBBBEEEBEEBEBBEEEBEBBBBBEBEBBBBBEBBBDBBBBBBBBBBBBBBBEEEEEBEBBBBBEBBBBBEEBBBBBBC/sWKXEBBBDBBBJ9kBB",t=new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]);if(typeof WebAssembly!="object")return{supported:!1};var n,i=WebAssembly.instantiate(o(e),{}).then(function(_){n=_.instance,n.exports.__wasm_call_ctors()});function o(_){for(var g=new Uint8Array(_.length),p=0;p<_.length;++p){var y=_.charCodeAt(p);g[p]=y>96?y-71:y>64?y-65:y>47?y+4:y>46?63:62}for(var T=0,p=0;p<_.length;++p)g[T++]=g[p]<60?t[g[p]]:(g[p]-60)*64+g[++p];return g.buffer.slice(0,T)}function r(_){if(!_)throw new Error("Assertion failed")}function s(_){return new Uint8Array(_.buffer,_.byteOffset,_.byteLength)}function a(_,g){var p=n.exports.sbrk,y=p(_.length*4),T=p(g*4),b=new Uint8Array(n.exports.memory.buffer),x=s(_);b.set(x,y);var v=n.exports.meshopt_optimizeVertexFetchRemap(T,y,_.length,g);b=new Uint8Array(n.exports.memory.buffer);var D=new Uint32Array(g);new Uint8Array(D.buffer).set(b.subarray(T,T+g*4)),x.set(b.subarray(y,y+_.length*4)),p(y-p(0));for(var L=0;L<_.length;++L)_[L]=D[_[L]];return[D,v]}function c(_){for(var g=0,p=0;p<_.length;++p){var y=_[p];g=g<y?y:g}return g}function u(_,g,p,y,T,b,x,v,D){var L=n.exports.sbrk,B=L(4),V=L(p*4),M=L(T*b),H=L(p*4),G=new Uint8Array(n.exports.memory.buffer);G.set(s(y),M),G.set(s(g),H);var I=_(V,H,p,M,T,b,x,v,D,B);G=new Uint8Array(n.exports.memory.buffer);var O=new Uint32Array(I);s(O).set(G.subarray(V,V+I*4));var m=new Float32Array(1);return s(m).set(G.subarray(B,B+4)),L(B-L(0)),[O,m[0]]}function f(_,g,p,y){var T=n.exports.sbrk,b=T(p*y),x=new Uint8Array(n.exports.memory.buffer);x.set(s(g),b);var v=_(b,p,y);return T(b-T(0)),v}var h={LockBorder:1};return{ready:i,supported:!0,compactMesh:function(_){r(_ instanceof Uint32Array||_ instanceof Int32Array||_ instanceof Uint16Array||_ instanceof Int16Array),r(_.length%3==0);var g=_.BYTES_PER_ELEMENT==4?_:new Uint32Array(_);return a(g,c(_)+1)},simplify:function(_,g,p,y,T,b){r(_ instanceof Uint32Array||_ instanceof Int32Array||_ instanceof Uint16Array||_ instanceof Int16Array),r(_.length%3==0),r(g instanceof Float32Array),r(g.length%p==0),r(p>=3),r(y%3==0);for(var x=0,v=0;v<(b?b.length:0);++v)x|=h[b[v]];var D=_.BYTES_PER_ELEMENT==4?_:new Uint32Array(_),L=u(n.exports.meshopt_simplify,D,_.length,g,g.length,p*4,y,T,x);return L[0]=_ instanceof Uint32Array?L[0]:new _.constructor(L[0]),L},getScale:function(_,g){return r(_ instanceof Float32Array),r(_.length%g==0),f(n.exports.meshopt_simplifyScale,_,_.length,g*4)}}})();function zh(e){e=A(e,A.EMPTY_OBJECT);const t=e.resourceCache,n=e.gltf,i=e.bufferViewId,o=e.gltfResource,r=e.baseResource,s=e.cacheKey;E.typeOf.func("options.resourceCache",t),E.typeOf.object("options.gltf",n),E.typeOf.number("options.bufferViewId",i),E.typeOf.object("options.gltfResource",o),E.typeOf.object("options.baseResource",r);const a=n.bufferViews[i];let c=a.buffer,u=a.byteOffset,f=a.byteLength,h=!1,_,g,p,y;if(Wr(a,"EXT_meshopt_compression")){const b=a.extensions.EXT_meshopt_compression;c=b.buffer,u=A(b.byteOffset,0),f=b.byteLength,h=!0,_=b.byteStride,g=b.count,p=b.mode,y=A(b.filter,"NONE")}const T=n.buffers[c];this._hasMeshopt=h,this._meshoptByteStride=_,this._meshoptCount=g,this._meshoptMode=p,this._meshoptFilter=y,this._resourceCache=t,this._gltfResource=o,this._baseResource=r,this._buffer=T,this._bufferId=c,this._byteOffset=u,this._byteLength=f,this._cacheKey=s,this._bufferLoader=void 0,this._typedArray=void 0,this._state=Qt.UNLOADED,this._promise=void 0,this._process=function(b,x){}}l(Object.create)&&(zh.prototype=Object.create(jr.prototype),zh.prototype.constructor=zh);Object.defineProperties(zh.prototype,{promise:{get:function(){return this._promise}},cacheKey:{get:function(){return this._cacheKey}},typedArray:{get:function(){return this._typedArray}}});zh.prototype.load=function(){const e=aXe(this);this._bufferLoader=e,this._state=Qt.LOADING;const t=this,n=new Promise(function(i){t._process=function(o,r){if(!o._hasMeshopt||!l(o._typedArray)||o._state!==Qt.PROCESSING)return;const s=o._meshoptCount,a=o._meshoptByteStride,c=new Uint8Array(s*a);sXe.decodeGltfBuffer(c,s,a,o._typedArray,o._meshoptMode,o._meshoptFilter),o._typedArray=c,o._state=Qt.READY,i(o)}});return this._promise=e.promise.then(function(){if(t.isDestroyed())return;const i=e.typedArray,o=new Uint8Array(i.buffer,i.byteOffset+t._byteOffset,t._byteLength);return t.unload(),t._typedArray=o,t._hasMeshopt?(t._state=Qt.PROCESSING,n):(t._state=Qt.READY,t)}).catch(function(i){if(t.isDestroyed())return;t.unload(),t._state=Qt.FAILED;const o="Failed to load buffer view";return Promise.reject(t.getError(o,i))}),this._promise};function aXe(e){const t=e._resourceCache,n=e._buffer;if(l(n.uri)){const o=e._baseResource.getDerivedResource({url:n.uri});return t.loadExternalBuffer({resource:o})}return t.loadEmbeddedBuffer({parentResource:e._gltfResource,bufferId:e._bufferId})}zh.prototype.process=function(e){return E.typeOf.object("frameState",e),this._process(this,e)};zh.prototype.unload=function(){l(this._bufferLoader)&&this._resourceCache.unload(this._bufferLoader),this._bufferLoader=void 0,this._typedArray=void 0};function ks(){}ks._maxDecodingConcurrency=Math.max(Mn.hardwareConcurrency-1,1);ks._decoderTaskProcessor=void 0;ks._taskProcessorReady=!1;ks._getDecoderTaskProcessor=function(){if(!l(ks._decoderTaskProcessor)){const e=new lo("decodeDraco",ks._maxDecodingConcurrency);e.initWebAssemblyModule({modulePath:"ThirdParty/Workers/draco_decoder_nodejs.js",wasmBinaryFile:"ThirdParty/draco_decoder.wasm"}).then(function(){ks._taskProcessorReady=!0}),ks._decoderTaskProcessor=e}return ks._decoderTaskProcessor};ks.decodePointCloud=function(e){const t=ks._getDecoderTaskProcessor();if(ks._taskProcessorReady)return t.scheduleTask(e,[e.buffer.buffer])};ks.decodeBufferView=function(e){const t=ks._getDecoderTaskProcessor();if(ks._taskProcessorReady)return t.scheduleTask(e,[e.array.buffer])};function Uh(e){e=A(e,A.EMPTY_OBJECT);const t=e.resourceCache,n=e.gltf,i=e.draco,o=e.gltfResource,r=e.baseResource,s=e.cacheKey;E.typeOf.func("options.resourceCache",t),E.typeOf.object("options.gltf",n),E.typeOf.object("options.draco",i),E.typeOf.object("options.gltfResource",o),E.typeOf.object("options.baseResource",r),this._resourceCache=t,this._gltfResource=o,this._baseResource=r,this._gltf=n,this._draco=i,this._cacheKey=s,this._bufferViewLoader=void 0,this._bufferViewTypedArray=void 0,this._decodePromise=void 0,this._decodedData=void 0,this._state=Qt.UNLOADED,this._promise=void 0,this._process=function(a,c){}}l(Object.create)&&(Uh.prototype=Object.create(jr.prototype),Uh.prototype.constructor=Uh);Object.defineProperties(Uh.prototype,{promise:{get:function(){return this._promise}},cacheKey:{get:function(){return this._cacheKey}},decodedData:{get:function(){return this._decodedData}}});Uh.prototype.load=function(){const t=this._resourceCache.loadBufferView({gltf:this._gltf,bufferViewId:this._draco.bufferView,gltfResource:this._gltfResource,baseResource:this._baseResource});this._bufferViewLoader=t,this._state=Qt.LOADING;const n=this,i=new Promise(function(o,r){n._process=function(s,a){if(!l(s._bufferViewTypedArray)||l(s._decodePromise))return;const c=s._draco,f=s._gltf.bufferViews,h=c.bufferView,_=f[h],g=c.attributes,p={array:new Uint8Array(s._bufferViewTypedArray),bufferView:_,compressedAttributes:g,dequantizeInShader:!0},y=ks.decodeBufferView(p);l(y)&&(s._decodePromise=y.then(function(T){if(s.isDestroyed()){o();return}s.unload(),s._decodedData={indices:T.indexArray,vertexAttributes:T.attributeData},s._state=Qt.READY,o(s)}).catch(function(T){if(s.isDestroyed()){o();return}r(T)}))}});return this._promise=t.promise.then(function(){if(!n.isDestroyed())return n._bufferViewTypedArray=t.typedArray,n._state=Qt.PROCESSING,i}).catch(function(o){if(!n.isDestroyed())return cXe(n,o)}),this._promise};function cXe(e,t){e.unload(),e._state=Qt.FAILED;const n="Failed to load Draco";return Promise.reject(e.getError(n,t))}Uh.prototype.process=function(e){return E.typeOf.object("frameState",e),this._process(this,e)};Uh.prototype.unload=function(){l(this._bufferViewLoader)&&this._resourceCache.unload(this._bufferViewLoader),this._bufferViewLoader=void 0,this._bufferViewTypedArray=void 0,this._decodedData=void 0,this._gltf=void 0};function lXe(e){const t=e.uint8Array,n=e.format,i=e.request,o=A(e.flipY,!1),r=A(e.skipColorSpaceConversion,!1);E.typeOf.object("uint8Array",t),E.typeOf.string("format",n);const s=new Blob([t],{type:n});let a;return je.supportsImageBitmapOptions().then(function(c){return c?Promise.resolve(je.createImageBitmapFromBlob(s,{flipY:o,premultiplyAlpha:!1,skipColorSpaceConversion:r})):(a=window.URL.createObjectURL(s),new je({url:a,request:i}).fetchImage({flipY:o,skipColorSpaceConversion:r}))}).then(function(c){return l(a)&&window.URL.revokeObjectURL(a),c}).catch(function(c){return l(a)&&window.URL.revokeObjectURL(a),Promise.reject(c)})}function hd(e){e=A(e,A.EMPTY_OBJECT);const t=e.resourceCache,n=e.gltf,i=e.imageId,o=e.gltfResource,r=e.baseResource,s=e.cacheKey;E.typeOf.func("options.resourceCache",t),E.typeOf.object("options.gltf",n),E.typeOf.number("options.imageId",i),E.typeOf.object("options.gltfResource",o),E.typeOf.object("options.baseResource",r);const a=n.images[i],c=a.bufferView,u=a.uri;this._resourceCache=t,this._gltfResource=o,this._baseResource=r,this._gltf=n,this._bufferViewId=c,this._uri=u,this._cacheKey=s,this._bufferViewLoader=void 0,this._image=void 0,this._mipLevels=void 0,this._state=Qt.UNLOADED,this._promise=void 0}l(Object.create)&&(hd.prototype=Object.create(jr.prototype),hd.prototype.constructor=hd);Object.defineProperties(hd.prototype,{promise:{get:function(){return this._promise}},cacheKey:{get:function(){return this._cacheKey}},image:{get:function(){return this._image}},mipLevels:{get:function(){return this._mipLevels}}});hd.prototype.load=function(){return l(this._bufferViewId)?(this._promise=uXe(this),this._promise):(this._promise=fXe(this),this._promise)};function Nte(e){let t;return Array.isArray(e)&&(t=e.slice(1,e.length).map(function(n){return n.bufferView}),e=e[0]),{image:e,mipLevels:t}}function uXe(e){const n=e._resourceCache.loadBufferView({gltf:e._gltf,bufferViewId:e._bufferViewId,gltfResource:e._gltfResource,baseResource:e._baseResource});return e._bufferViewLoader=n,e._state=Qt.LOADING,n.promise.then(function(){if(e.isDestroyed())return;const i=n.typedArray;return hXe(i).then(function(o){if(e.isDestroyed())return;const r=Nte(o);return e.unload(),e._image=r.image,e._mipLevels=r.mipLevels,e._state=Qt.READY,e})}).catch(function(i){if(!e.isDestroyed())return Mte(e,i,"Failed to load embedded image")})}function fXe(e){const t=e._baseResource,n=e._uri,i=t.getDerivedResource({url:n});return e._state=Qt.LOADING,mXe(i).then(function(o){if(e.isDestroyed())return;const r=Nte(o);return e.unload(),e._image=r.image,e._mipLevels=r.mipLevels,e._state=Qt.READY,e}).catch(function(o){if(!e.isDestroyed())return Mte(e,o,`Failed to load image: ${n}`)})}function Mte(e,t,n){return e.unload(),e._state=Qt.FAILED,Promise.reject(e.getError(n,t))}function dXe(e){const t=e.subarray(0,2),n=e.subarray(0,4),i=e.subarray(8,12);if(t[0]===255&&t[1]===216)return"image/jpeg";if(t[0]===137&&t[1]===80)return"image/png";if(t[0]===171&&t[1]===75)return"image/ktx2";if(n[0]===82&&n[1]===73&&n[2]===70&&n[3]===70&&i[0]===87&&i[1]===69&&i[2]===66&&i[3]===80)return"image/webp";throw new Fe("Image format is not recognized")}function hXe(e){const t=dXe(e);if(t==="image/ktx2"){const n=new Uint8Array(e);return Sy(n)}return hd._loadImageFromTypedArray({uint8Array:e,format:t,flipY:!1,skipColorSpaceConversion:!0})}const pXe=/(^data:image\/ktx2)|(\.ktx2$)/i;function mXe(e){const t=e.getUrlComponent(!1,!0);return pXe.test(t)?Sy(e):e.fetchImage({skipColorSpaceConversion:!0,preferImageBitmap:!0})}hd.prototype.unload=function(){l(this._bufferViewLoader)&&this._resourceCache.unload(this._bufferViewLoader),this._bufferViewLoader=void 0,this._uri=void 0,this._image=void 0,this._mipLevels=void 0,this._gltf=void 0};hd._loadImageFromTypedArray=lXe;function Hh(e){e=A(e,A.EMPTY_OBJECT);const t=e.resourceCache,n=e.gltf,i=e.accessorId,o=e.gltfResource,r=e.baseResource,s=e.draco,a=e.cacheKey,c=A(e.asynchronous,!0),u=A(e.loadBuffer,!1),f=A(e.loadTypedArray,!1);if(E.typeOf.func("options.resourceCache",t),E.typeOf.object("options.gltf",n),E.typeOf.number("options.accessorId",i),E.typeOf.object("options.gltfResource",o),E.typeOf.object("options.baseResource",r),!u&&!f)throw new w("At least one of loadBuffer and loadTypedArray must be true.");const h=n.accessors[i].componentType;this._resourceCache=t,this._gltfResource=o,this._baseResource=r,this._gltf=n,this._accessorId=i,this._indexDatatype=h,this._draco=s,this._cacheKey=a,this._asynchronous=c,this._loadBuffer=u,this._loadTypedArray=f,this._bufferViewLoader=void 0,this._dracoLoader=void 0,this._typedArray=void 0,this._buffer=void 0,this._state=Qt.UNLOADED,this._promise=void 0,this._process=function(_,g){}}l(Object.create)&&(Hh.prototype=Object.create(jr.prototype),Hh.prototype.constructor=Hh);Object.defineProperties(Hh.prototype,{promise:{get:function(){return this._promise}},cacheKey:{get:function(){return this._cacheKey}},buffer:{get:function(){return this._buffer}},typedArray:{get:function(){return this._typedArray}},indexDatatype:{get:function(){return this._indexDatatype}}});const _Xe=new lU;Hh.prototype.load=function(){let e;l(this._draco)?e=gXe(this):e=yXe(this);const t=this,n=new Promise(function(i){t._process=function(o,r){if(o._state===Qt.READY)return;const s=o._typedArray,a=o._indexDatatype;if(l(o._dracoLoader)&&o._dracoLoader.process(r),l(o._bufferViewLoader)&&o._bufferViewLoader.process(r),!l(s))return;let c;if(o._loadBuffer&&o._asynchronous){const u=_Xe;if(u.set(s,a,r.context),!r.jobScheduler.execute(u,ju.BUFFER))return;c=u.buffer}else o._loadBuffer&&(c=Fte(s,a,r.context));o.unload(),o._buffer=c,o._typedArray=o._loadTypedArray?s:void 0,o._state=Qt.READY,i(o)}});return this._promise=e.then(function(){if(!t.isDestroyed())return n}).catch(function(i){if(!t.isDestroyed())return TXe(t,i)}),this._promise};function gXe(e){const n=e._resourceCache.loadDraco({gltf:e._gltf,draco:e._draco,gltfResource:e._gltfResource,baseResource:e._baseResource});return e._dracoLoader=n,e._state=Qt.LOADING,n.promise.then(function(){if(e.isDestroyed())return;const i=n.decodedData.indices.typedArray;return e._typedArray=i,e._indexDatatype=oe.fromTypedArray(i),e._state=Qt.PROCESSING,e})}function yXe(e){const t=e._gltf,n=e._accessorId,o=t.accessors[n].bufferView,s=e._resourceCache.loadBufferView({gltf:t,bufferViewId:o,gltfResource:e._gltfResource,baseResource:e._baseResource});return e._state=Qt.LOADING,e._bufferViewLoader=s,s.promise.then(function(){if(e.isDestroyed())return;const a=s.typedArray;return e._typedArray=AXe(e,a),e._state=Qt.PROCESSING,e})}function AXe(e,t){const n=e._gltf,i=e._accessorId,o=n.accessors[i],r=o.count,s=o.componentType,a=At.getSizeInBytes(s);let c=t.buffer,u=t.byteOffset+o.byteOffset;if(u%a!==0){const h=r*a,_=new Uint8Array(c,u,h);c=new Uint8Array(_).buffer,u=0,p_("index-buffer-unaligned",`The index array is not aligned to a ${a}-byte boundary.`)}let f;return s===At.UNSIGNED_BYTE?f=new Uint8Array(c,u,r):s===At.UNSIGNED_SHORT?f=new Uint16Array(c,u,r):s===At.UNSIGNED_INT&&(f=new Uint32Array(c,u,r)),f}function TXe(e,t){e.unload(),e._state=Qt.FAILED;const n="Failed to load index buffer";return t=e.getError(n,t),Promise.reject(t)}function lU(){this.typedArray=void 0,this.indexDatatype=void 0,this.context=void 0,this.buffer=void 0}lU.prototype.set=function(e,t,n){this.typedArray=e,this.indexDatatype=t,this.context=n};lU.prototype.execute=function(){this.buffer=Fte(this.typedArray,this.indexDatatype,this.context)};function Fte(e,t,n){const i=Mt.createIndexBuffer({typedArray:e,context:n,usage:mt.STATIC_DRAW,indexDatatype:t});return i.vertexArrayDestroyable=!1,i}Hh.prototype.process=function(e){return E.typeOf.object("frameState",e),this._process(this,e)};Hh.prototype.unload=function(){l(this._buffer)&&this._buffer.destroy();const e=this._resourceCache;l(this._bufferViewLoader)&&e.unload(this._bufferViewLoader),l(this._dracoLoader)&&e.unload(this._dracoLoader),this._bufferViewLoader=void 0,this._dracoLoader=void 0,this._typedArray=void 0,this._buffer=void 0,this._gltf=void 0};function ef(e,t,n){if(n=A(n,!1),n){const i=e.indexOf(t);if(i>-1)return i}return e.push(t),e.length-1}function $s(e,t){return l(e.extensionsUsed)&&e.extensionsUsed.indexOf(t)>=0}function Se(){}Se.objectLegacy=function(e,t){if(l(e)){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)){const i=e[n],o=t(i,n);if(l(o))return o}}};Se.object=function(e,t){if(l(e)){const n=e.length;for(let i=0;i<n;i++){const o=e[i],r=t(o,i);if(l(r))return r}}};Se.topLevel=function(e,t,n){const i=e[t];return l(i)&&!Array.isArray(i)?Se.objectLegacy(i,n):Se.object(i,n)};Se.accessor=function(e,t){return Se.topLevel(e,"accessors",t)};Se.accessorWithSemantic=function(e,t,n){const i={};return Se.mesh(e,function(o){return Se.meshPrimitive(o,function(r){const s=Se.meshPrimitiveAttribute(r,function(a,c){if(c.indexOf(t)===0&&!l(i[a])){i[a]=!0;const u=n(a);if(l(u))return u}});return l(s)?s:Se.meshPrimitiveTarget(r,function(a){return Se.meshPrimitiveTargetAttribute(a,function(c,u){if(u.indexOf(t)===0&&!l(i[c])){i[c]=!0;const f=n(c);if(l(f))return f}})})})})};Se.accessorContainingVertexAttributeData=function(e,t){const n={};return Se.mesh(e,function(i){return Se.meshPrimitive(i,function(o){const r=Se.meshPrimitiveAttribute(o,function(s){if(!l(n[s])){n[s]=!0;const a=t(s);if(l(a))return a}});return l(r)?r:Se.meshPrimitiveTarget(o,function(s){return Se.meshPrimitiveTargetAttribute(s,function(a){if(!l(n[a])){n[a]=!0;const c=t(a);if(l(c))return c}})})})})};Se.accessorContainingIndexData=function(e,t){const n={};return Se.mesh(e,function(i){return Se.meshPrimitive(i,function(o){const r=o.indices;if(l(r)&&!l(n[r])){n[r]=!0;const s=t(r);if(l(s))return s}})})};Se.animation=function(e,t){return Se.topLevel(e,"animations",t)};Se.animationChannel=function(e,t){const n=e.channels;return Se.object(n,t)};Se.animationSampler=function(e,t){const n=e.samplers;return Se.object(n,t)};Se.buffer=function(e,t){return Se.topLevel(e,"buffers",t)};Se.bufferView=function(e,t){return Se.topLevel(e,"bufferViews",t)};Se.camera=function(e,t){return Se.topLevel(e,"cameras",t)};Se.image=function(e,t){return Se.topLevel(e,"images",t)};Se.material=function(e,t){return Se.topLevel(e,"materials",t)};Se.materialValue=function(e,t){let n=e.values;l(e.extensions)&&l(e.extensions.KHR_techniques_webgl)&&(n=e.extensions.KHR_techniques_webgl.values);for(const i in n)if(Object.prototype.hasOwnProperty.call(n,i)){const o=t(n[i],i);if(l(o))return o}};Se.mesh=function(e,t){return Se.topLevel(e,"meshes",t)};Se.meshPrimitive=function(e,t){const n=e.primitives;if(l(n)){const i=n.length;for(let o=0;o<i;o++){const r=n[o],s=t(r,o);if(l(s))return s}}};Se.meshPrimitiveAttribute=function(e,t){const n=e.attributes;for(const i in n)if(Object.prototype.hasOwnProperty.call(n,i)){const o=t(n[i],i);if(l(o))return o}};Se.meshPrimitiveTarget=function(e,t){const n=e.targets;if(l(n)){const i=n.length;for(let o=0;o<i;++o){const r=t(n[o],o);if(l(r))return r}}};Se.meshPrimitiveTargetAttribute=function(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)){const i=e[n],o=t(i,n);if(l(o))return o}};Se.node=function(e,t){return Se.topLevel(e,"nodes",t)};Se.nodeInTree=function(e,t,n){const i=e.nodes;if(l(i)){const o=t.length;for(let r=0;r<o;r++){const s=t[r],a=i[s];if(l(a)){let c=n(a,s);if(l(c))return c;const u=a.children;if(l(u)&&(c=Se.nodeInTree(e,u,n),l(c)))return c}}}};Se.nodeInScene=function(e,t,n){const i=t.nodes;if(l(i))return Se.nodeInTree(e,i,n)};Se.program=function(e,t){return $s(e,"KHR_techniques_webgl")?Se.object(e.extensions.KHR_techniques_webgl.programs,t):Se.topLevel(e,"programs",t)};Se.sampler=function(e,t){return Se.topLevel(e,"samplers",t)};Se.scene=function(e,t){return Se.topLevel(e,"scenes",t)};Se.shader=function(e,t){return $s(e,"KHR_techniques_webgl")?Se.object(e.extensions.KHR_techniques_webgl.shaders,t):Se.topLevel(e,"shaders",t)};Se.skin=function(e,t){return Se.topLevel(e,"skins",t)};Se.skinJoint=function(e,t){const n=e.joints;if(l(n)){const i=n.length;for(let o=0;o<i;o++){const r=n[o],s=t(r);if(l(s))return s}}};Se.techniqueAttribute=function(e,t){const n=e.attributes;for(const i in n)if(Object.prototype.hasOwnProperty.call(n,i)){const o=t(n[i],i);if(l(o))return o}};Se.techniqueUniform=function(e,t){const n=e.uniforms;for(const i in n)if(Object.prototype.hasOwnProperty.call(n,i)){const o=t(n[i],i);if(l(o))return o}};Se.techniqueParameter=function(e,t){const n=e.parameters;for(const i in n)if(Object.prototype.hasOwnProperty.call(n,i)){const o=t(n[i],i);if(l(o))return o}};Se.technique=function(e,t){return $s(e,"KHR_techniques_webgl")?Se.object(e.extensions.KHR_techniques_webgl.techniques,t):Se.topLevel(e,"techniques",t)};Se.texture=function(e,t){return Se.topLevel(e,"textures",t)};function Bx(e){switch(e){case"SCALAR":return 1;case"VEC2":return 2;case"VEC3":return 3;case"VEC4":case"MAT2":return 4;case"MAT3":return 9;case"MAT4":return 16}}function IT(e,t){const n=t.bufferView;if(l(n)){const i=e.bufferViews[n];if(l(i.byteStride)&&i.byteStride>0)return i.byteStride}return oe.getSizeInBytes(t.componentType)*Bx(t.type)}function CXe(e){Se.accessor(e,function(n){l(n.bufferView)&&(n.byteOffset=A(n.byteOffset,0))}),Se.bufferView(e,function(n){l(n.buffer)&&(n.byteOffset=A(n.byteOffset,0))}),Se.mesh(e,function(n){Se.meshPrimitive(n,function(i){if(i.mode=A(i.mode,fe.TRIANGLES),!l(i.material)){l(e.materials)||(e.materials=[]);const o={name:"default"};i.material=ef(e.materials,o)}})}),Se.accessorContainingVertexAttributeData(e,function(n){const i=e.accessors[n],o=i.bufferView;if(i.normalized=A(i.normalized,!1),l(o)){const r=e.bufferViews[o];r.byteStride=IT(e,i),r.target=fe.ARRAY_BUFFER}}),Se.accessorContainingIndexData(e,function(n){const o=e.accessors[n].bufferView;if(l(o)){const r=e.bufferViews[o];r.target=fe.ELEMENT_ARRAY_BUFFER}}),Se.material(e,function(n){const i=A(n.extensions,A.EMPTY_OBJECT),o=i.KHR_materials_common;if(l(o)){const c=o.technique,u=l(o.values)?o.values:{};o.values=u,u.ambient=l(u.ambient)?u.ambient:[0,0,0,1],u.emission=l(u.emission)?u.emission:[0,0,0,1],u.transparency=A(u.transparency,1),c!=="CONSTANT"&&(u.diffuse=l(u.diffuse)?u.diffuse:[0,0,0,1],c!=="LAMBERT"&&(u.specular=l(u.specular)?u.specular:[0,0,0,1],u.shininess=A(u.shininess,0))),o.transparent=A(o.transparent,!1),o.doubleSided=A(o.doubleSided,!1);return}n.emissiveFactor=A(n.emissiveFactor,[0,0,0]),n.alphaMode=A(n.alphaMode,"OPAQUE"),n.doubleSided=A(n.doubleSided,!1),n.alphaMode==="MASK"&&(n.alphaCutoff=A(n.alphaCutoff,.5));const r=i.KHR_techniques_webgl;l(r)&&Se.materialValue(n,function(c){l(c.index)&&og(c)}),og(n.emissiveTexture),og(n.normalTexture),og(n.occlusionTexture);const s=n.pbrMetallicRoughness;l(s)&&(s.baseColorFactor=A(s.baseColorFactor,[1,1,1,1]),s.metallicFactor=A(s.metallicFactor,1),s.roughnessFactor=A(s.roughnessFactor,1),og(s.baseColorTexture),og(s.metallicRoughnessTexture));const a=i.KHR_materials_pbrSpecularGlossiness;l(a)&&(a.diffuseFactor=A(a.diffuseFactor,[1,1,1,1]),a.specularFactor=A(a.specularFactor,[1,1,1]),a.glossinessFactor=A(a.glossinessFactor,1),og(a.specularGlossinessTexture))}),Se.animation(e,function(n){Se.animationSampler(n,function(i){i.interpolation=A(i.interpolation,"LINEAR")})});const t=bXe(e);return Se.node(e,function(n,i){l(t[i])||l(n.translation)||l(n.rotation)||l(n.scale)?(n.translation=A(n.translation,[0,0,0]),n.rotation=A(n.rotation,[0,0,0,1]),n.scale=A(n.scale,[1,1,1])):n.matrix=A(n.matrix,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}),Se.sampler(e,function(n){n.wrapS=A(n.wrapS,fe.REPEAT),n.wrapT=A(n.wrapT,fe.REPEAT)}),l(e.scenes)&&!l(e.scene)&&(e.scene=0),e}function bXe(e){const t={};return Se.animation(e,function(n){Se.animationChannel(n,function(i){const o=i.target,r=o.node,s=o.path;(s==="translation"||s==="rotation"||s==="scale")&&(t[r]=!0)})}),t}function og(e){l(e)&&(e.texCoord=A(e.texCoord,0))}function uU(e){return Se.shader(e,function(t){wv(t)}),Se.buffer(e,function(t){wv(t)}),Se.image(e,function(t){wv(t)}),wv(e),e}function wv(e){e.extras=l(e.extras)?e.extras:{},e.extras._pipeline=l(e.extras._pipeline)?e.extras._pipeline:{}}function EXe(e,t){const n=e.extensionsRequired;if(l(n)){const i=n.indexOf(t);i>=0&&n.splice(i,1),n.length===0&&delete e.extensionsRequired}}function zte(e,t){const n=e.extensionsUsed;if(l(n)){const i=n.indexOf(t);i>=0&&n.splice(i,1),EXe(e,t),n.length===0&&delete e.extensionsUsed}}const xXe=4;function wXe(e){if(TP(e)!=="glTF")throw new Fe("File is not valid binary glTF");const n=Ute(e,0,5),i=n[1];if(i!==1&&i!==2)throw new Fe("Binary glTF version is not 1 or 2");return i===1?SXe(e,n):vXe(e,n)}function Ute(e,t,n){const i=new DataView(e.buffer),o=new Array(n);for(let r=0;r<n;++r)o[r]=i.getUint32(e.byteOffset+t+r*xXe,!0);return o}function SXe(e,t){const n=t[2],i=t[3];if(t[4]!==0)throw new Fe("Binary glTF scene format is not JSON");const r=20,s=r+i,a=nl(e,r,i),c=JSON.parse(a);uU(c);const u=e.subarray(s,n),f=c.buffers;if(l(f)&&Object.keys(f).length>0){const h=A(f.binary_glTF,f.KHR_binary_glTF);l(h)&&(h.extras._pipeline.source=u,delete h.uri)}return zte(c,"KHR_binary_glTF"),c}function vXe(e,t){const n=t[2];let i=12,o,r;for(;i<n;){const s=Ute(e,i,2),a=s[0],c=s[1];i+=8;const u=e.subarray(i,i+a);if(i+=a,c===1313821514){const f=nl(u);o=JSON.parse(f),uU(o)}else c===5130562&&(r=u)}if(l(o)&&l(r)){const s=o.buffers;if(l(s)&&s.length>0){const a=s[0];a.extras._pipeline.source=r}}return o}function DXe(e){return Se.shader(e,function(t){Sv(t)}),Se.buffer(e,function(t){Sv(t)}),Se.image(e,function(t){Sv(t)}),Sv(e),e}function Sv(e){l(e.extras)&&(l(e.extras._pipeline)&&delete e.extras._pipeline,Object.keys(e.extras).length===0&&delete e.extras)}function Rx(e,t){let n=e.extensionsUsed;l(n)||(n=[],e.extensionsUsed=n),ef(n,t,!0)}function fU(e){switch(e){case oe.BYTE:return function(t,n,i,o,r){for(let s=0;s<i;++s)r[s]=t.getInt8(n+s*o)};case oe.UNSIGNED_BYTE:return function(t,n,i,o,r){for(let s=0;s<i;++s)r[s]=t.getUint8(n+s*o)};case oe.SHORT:return function(t,n,i,o,r){for(let s=0;s<i;++s)r[s]=t.getInt16(n+s*o,!0)};case oe.UNSIGNED_SHORT:return function(t,n,i,o,r){for(let s=0;s<i;++s)r[s]=t.getUint16(n+s*o,!0)};case oe.INT:return function(t,n,i,o,r){for(let s=0;s<i;++s)r[s]=t.getInt32(n+s*o,!0)};case oe.UNSIGNED_INT:return function(t,n,i,o,r){for(let s=0;s<i;++s)r[s]=t.getUint32(n+s*o,!0)};case oe.FLOAT:return function(t,n,i,o,r){for(let s=0;s<i;++s)r[s]=t.getFloat32(n+s*o,!0)};case oe.DOUBLE:return function(t,n,i,o,r){for(let s=0;s<i;++s)r[s]=t.getFloat64(n+s*o,!0)}}}function dU(e,t){const n=e.bufferViews,i=e.buffers,o=t.bufferView,r=Bx(t.type);if(!l(t.bufferView))return{min:new Array(r).fill(0),max:new Array(r).fill(0)};const s=new Array(r).fill(Number.POSITIVE_INFINITY),a=new Array(r).fill(Number.NEGATIVE_INFINITY),c=n[o],u=c.buffer,h=i[u].extras._pipeline.source,_=t.count,g=IT(e,t);let p=t.byteOffset+c.byteOffset+h.byteOffset;const y=t.componentType,T=oe.getSizeInBytes(y),b=new DataView(h.buffer),x=new Array(r),v=fU(y);for(let D=0;D<_;D++){v(b,p,r,T,x);for(let L=0;L<r;L++){const B=x[L];s[L]=Math.min(s[L],B),a[L]=Math.max(a[L],B)}p+=g}return{min:s,max:a}}const IXe=[fe.FUNC_ADD,fe.FUNC_ADD],PXe=[fe.ONE,fe.ZERO,fe.ONE,fe.ZERO];function J9(e,t){const n=e.enable;return l(n)?n.indexOf(t)>-1:!1}const OXe=[fe.ZERO,fe.ONE,fe.SRC_COLOR,fe.ONE_MINUS_SRC_COLOR,fe.SRC_ALPHA,fe.ONE_MINUS_SRC_ALPHA,fe.DST_ALPHA,fe.ONE_MINUS_DST_ALPHA,fe.DST_COLOR,fe.ONE_MINUS_DST_COLOR];function LXe(e,t){if(!l(e))return t;for(let n=0;n<4;n++)if(OXe.indexOf(e[n])===-1)return t;return e}function BXe(e){const t={},n={},i=e.techniques;return l(i)&&(Se.technique(e,function(o,r){const s=o.states;if(l(s)){const a=n[r]={};if(J9(s,fe.BLEND)){a.alphaMode="BLEND";const c=s.functions;l(c)&&(l(c.blendEquationSeparate)||l(c.blendFuncSeparate))&&(t[r]={blendEquation:A(c.blendEquationSeparate,IXe),blendFactors:LXe(c.blendFuncSeparate,PXe)})}J9(s,fe.CULL_FACE)||(a.doubleSided=!0),delete o.states}}),Object.keys(t).length>0&&(l(e.extensions)||(e.extensions={}),Rx(e,"KHR_blend")),Se.material(e,function(o){if(l(o.technique)){const r=n[o.technique];Se.objectLegacy(r,function(a,c){o[c]=a});const s=t[o.technique];l(s)&&(l(o.extensions)||(o.extensions={}),o.extensions.KHR_blend=s)}})),e}function RXe(e,t){let n=e.extensionsRequired;l(n)||(n=[],e.extensionsRequired=n),ef(n,t,!0),Rx(e,t)}function NXe(e){const t=e.techniques,n={},i={},o={};if(l(t)){const r={programs:[],shaders:[],techniques:[]},s=e.glExtensionsUsed;delete e.glExtensionsUsed,Se.technique(e,function(a,c){const u={name:a.name,program:void 0,attributes:{},uniforms:{}};let f;if(Se.techniqueAttribute(a,function(h,_){f=a.parameters[h],u.attributes[_]={semantic:f.semantic}}),Se.techniqueUniform(a,function(h,_){f=a.parameters[h],u.uniforms[_]={count:f.count,node:f.node,type:f.type,semantic:f.semantic,value:f.value},l(n[c])||(n[c]={}),n[c][h]=_}),l(o[a.program]))u.program=o[a.program];else{const h=e.programs[a.program],_={name:h.name,fragmentShader:void 0,vertexShader:void 0,glExtensions:s},g=e.shaders[h.fragmentShader];_.fragmentShader=ef(r.shaders,g,!0);const p=e.shaders[h.vertexShader];_.vertexShader=ef(r.shaders,p,!0),u.program=ef(r.programs,_),o[a.program]=u.program}i[c]=ef(r.techniques,u)}),r.techniques.length>0&&(l(e.extensions)||(e.extensions={}),e.extensions.KHR_techniques_webgl=r,Rx(e,"KHR_techniques_webgl"),RXe(e,"KHR_techniques_webgl"))}return Se.material(e,function(r){if(l(r.technique)){const s={technique:i[r.technique]};Se.objectLegacy(r.values,function(a,c){l(s.values)||(s.values={});const u=n[r.technique][c];l(u)&&(s.values[u]=a)}),l(r.extensions)||(r.extensions={}),r.extensions.KHR_techniques_webgl=s}delete r.technique,delete r.values}),delete e.techniques,delete e.programs,delete e.shaders,e}function Hte(e,t){E.typeOf.object("material",e),E.defined("handler",t);const n=e.pbrMetallicRoughness;if(l(n)){if(l(n.baseColorTexture)){const o=n.baseColorTexture,r=t(o.index,o);if(l(r))return r}if(l(n.metallicRoughnessTexture)){const o=n.metallicRoughnessTexture,r=t(o.index,o);if(l(r))return r}}if(l(e.extensions)){const o=e.extensions.KHR_materials_pbrSpecularGlossiness;if(l(o)){if(l(o.diffuseTexture)){const s=o.diffuseTexture,a=t(s.index,s);if(l(a))return a}if(l(o.specularGlossinessTexture)){const s=o.specularGlossinessTexture,a=t(s.index,s);if(l(a))return a}}const r=e.extensions.KHR_materials_common;if(l(r)&&l(r.values)){const s=r.values.diffuse,a=r.values.ambient,c=r.values.emission,u=r.values.specular;if(l(s)&&l(s.index)){const f=t(s.index,s);if(l(f))return f}if(l(a)&&l(a.index)){const f=t(a.index,a);if(l(f))return f}if(l(c)&&l(c.index)){const f=t(c.index,c);if(l(f))return f}if(l(u)&&l(u.index)){const f=t(u.index,u);if(l(f))return f}}}const i=Se.materialValue(e,function(o){if(l(o.index)){const r=t(o.index,o);if(l(r))return r}});if(l(i))return i;if(l(e.emissiveTexture)){const o=e.emissiveTexture,r=t(o.index,o);if(l(r))return r}if(l(e.normalTexture)){const o=e.normalTexture,r=t(o.index,o);if(l(r))return r}if(l(e.occlusionTexture)){const o=e.occlusionTexture,r=t(o.index,o);if(l(r))return r}}const Q9=["mesh","node","material","accessor","bufferView","buffer","texture","sampler","image"];function MXe(e,t){return t=A(t,Q9),Q9.forEach(function(n){t.indexOf(n)>-1&&zXe(e,n)}),e}const FXe={accessor:"accessors",buffer:"buffers",bufferView:"bufferViews",image:"images",node:"nodes",material:"materials",mesh:"meshes",sampler:"samplers",texture:"textures"};function zXe(e,t){const n=FXe[t],i=e[n];if(l(i)){let o=0;const r=Gd[t](e),s=i.length;for(let a=0;a<s;++a)r[a]||(kd[t](e,a-o),o++)}}function kd(){}kd.accessor=function(e,t){e.accessors.splice(t,1),Se.mesh(e,function(i){Se.meshPrimitive(i,function(o){Se.meshPrimitiveAttribute(o,function(s,a){s>t&&o.attributes[a]--}),Se.meshPrimitiveTarget(o,function(s){Se.meshPrimitiveTargetAttribute(s,function(a,c){a>t&&s[c]--})});const r=o.indices;l(r)&&r>t&&o.indices--})}),Se.skin(e,function(i){l(i.inverseBindMatrices)&&i.inverseBindMatrices>t&&i.inverseBindMatrices--}),Se.animation(e,function(i){Se.animationSampler(i,function(o){l(o.input)&&o.input>t&&o.input--,l(o.output)&&o.output>t&&o.output--})})};kd.buffer=function(e,t){e.buffers.splice(t,1),Se.bufferView(e,function(i){l(i.buffer)&&i.buffer>t&&i.buffer--,l(i.extensions)&&l(i.extensions.EXT_meshopt_compression)&&i.extensions.EXT_meshopt_compression.buffer--})};kd.bufferView=function(e,t){if(e.bufferViews.splice(t,1),Se.accessor(e,function(i){l(i.bufferView)&&i.bufferView>t&&i.bufferView--}),Se.shader(e,function(i){l(i.bufferView)&&i.bufferView>t&&i.bufferView--}),Se.image(e,function(i){l(i.bufferView)&&i.bufferView>t&&i.bufferView--}),$s(e,"KHR_draco_mesh_compression")&&Se.mesh(e,function(i){Se.meshPrimitive(i,function(o){l(o.extensions)&&l(o.extensions.KHR_draco_mesh_compression)&&o.extensions.KHR_draco_mesh_compression.bufferView>t&&o.extensions.KHR_draco_mesh_compression.bufferView--})}),$s(e,"EXT_feature_metadata")){const o=e.extensions.EXT_feature_metadata.featureTables;for(const r in o)if(o.hasOwnProperty(r)){const a=o[r].properties;if(l(a)){for(const c in a)if(a.hasOwnProperty(c)){const u=a[c];l(u.bufferView)&&u.bufferView>t&&u.bufferView--,l(u.arrayOffsetBufferView)&&u.arrayOffsetBufferView>t&&u.arrayOffsetBufferView--,l(u.stringOffsetBufferView)&&u.stringOffsetBufferView>t&&u.stringOffsetBufferView--}}}}if($s(e,"EXT_structural_metadata")){const o=e.extensions.EXT_structural_metadata.propertyTables;if(l(o)){const r=o.length;for(let s=0;s<r;++s){const c=o[s].properties;for(const u in c)if(c.hasOwnProperty(u)){const f=c[u];l(f.values)&&f.values>t&&f.values--,l(f.arrayOffsets)&&f.arrayOffsets>t&&f.arrayOffsets--,l(f.stringOffsets)&&f.stringOffsets>t&&f.stringOffsets--}}}}};kd.image=function(e,t){e.images.splice(t,1),Se.texture(e,function(i){l(i.source)&&i.source>t&&--i.source;const o=i.extensions;l(o)&&l(o.EXT_texture_webp)&&o.EXT_texture_webp.source>t?--i.extensions.EXT_texture_webp.source:l(o)&&l(o.KHR_texture_basisu)&&o.KHR_texture_basisu.source>t&&--i.extensions.KHR_texture_basisu.source})};kd.mesh=function(e,t){e.meshes.splice(t,1),Se.node(e,function(i){l(i.mesh)&&(i.mesh>t?i.mesh--:i.mesh===t&&delete i.mesh)})};kd.node=function(e,t){e.nodes.splice(t,1),Se.skin(e,function(i){l(i.skeleton)&&i.skeleton>t&&i.skeleton--,i.joints=i.joints.map(function(o){return o>t?o-1:o})}),Se.animation(e,function(i){Se.animationChannel(i,function(o){l(o.target)&&l(o.target.node)&&o.target.node>t&&o.target.node--})}),Se.technique(e,function(i){Se.techniqueUniform(i,function(o){l(o.node)&&o.node>t&&o.node--})}),Se.node(e,function(i){l(i.children)&&(i.children=i.children.filter(function(o){return o!==t}).map(function(o){return o>t?o-1:o}))}),Se.scene(e,function(i){i.nodes=i.nodes.filter(function(o){return o!==t}).map(function(o){return o>t?o-1:o})})};kd.material=function(e,t){e.materials.splice(t,1),Se.mesh(e,function(i){Se.meshPrimitive(i,function(o){l(o.material)&&o.material>t&&o.material--})})};kd.sampler=function(e,t){e.samplers.splice(t,1),Se.texture(e,function(i){l(i.sampler)&&i.sampler>t&&--i.sampler})};kd.texture=function(e,t){if(e.textures.splice(t,1),Se.material(e,function(i){Hte(i,function(o,r){r.index>t&&--r.index})}),$s(e,"EXT_feature_metadata")){Se.mesh(e,function(r){Se.meshPrimitive(r,function(s){const a=s.extensions;if(l(a)&&l(a.EXT_feature_metadata)){const u=a.EXT_feature_metadata.featureIdTextures;if(l(u)){const f=u.length;for(let h=0;h<f;++h){const g=u[h].featureIds.texture;g.index>t&&--g.index}}}})});const o=e.extensions.EXT_feature_metadata.featureTextures;for(const r in o)if(o.hasOwnProperty(r)){const a=o[r].properties;if(l(a)){for(const c in a)if(a.hasOwnProperty(c)){const f=a[c].texture;f.index>t&&--f.index}}}}if($s(e,"EXT_mesh_features")&&Se.mesh(e,function(i){Se.meshPrimitive(i,function(o){const r=o.extensions;if(l(r)&&l(r.EXT_mesh_features)){const a=r.EXT_mesh_features.featureIds;if(l(a)){const c=a.length;for(let u=0;u<c;++u){const f=a[u];l(f.texture)&&f.texture.index>t&&--f.texture.index}}}})}),$s(e,"EXT_structural_metadata")){const o=e.extensions.EXT_structural_metadata.propertyTextures;if(l(o)){const r=o.length;for(let s=0;s<r;++s){const c=o[s].properties;for(const u in c)if(c.hasOwnProperty(u)){const f=c[u];f.index>t&&--f.index}}}}};function Gd(){}Gd.accessor=function(e){const t={};return Se.mesh(e,function(n){Se.meshPrimitive(n,function(i){Se.meshPrimitiveAttribute(i,function(r){t[r]=!0}),Se.meshPrimitiveTarget(i,function(r){Se.meshPrimitiveTargetAttribute(r,function(s){t[s]=!0})});const o=i.indices;l(o)&&(t[o]=!0)})}),Se.skin(e,function(n){l(n.inverseBindMatrices)&&(t[n.inverseBindMatrices]=!0)}),Se.animation(e,function(n){Se.animationSampler(n,function(i){l(i.input)&&(t[i.input]=!0),l(i.output)&&(t[i.output]=!0)})}),$s(e,"EXT_mesh_gpu_instancing")&&Se.node(e,function(n){l(n.extensions)&&l(n.extensions.EXT_mesh_gpu_instancing)&&Object.keys(n.extensions.EXT_mesh_gpu_instancing.attributes).forEach(function(i){const o=n.extensions.EXT_mesh_gpu_instancing.attributes[i];t[o]=!0})}),t};Gd.buffer=function(e){const t={};return Se.bufferView(e,function(n){l(n.buffer)&&(t[n.buffer]=!0),l(n.extensions)&&l(n.extensions.EXT_meshopt_compression)&&(t[n.extensions.EXT_meshopt_compression.buffer]=!0)}),t};Gd.bufferView=function(e){const t={};if(Se.accessor(e,function(n){l(n.bufferView)&&(t[n.bufferView]=!0)}),Se.shader(e,function(n){l(n.bufferView)&&(t[n.bufferView]=!0)}),Se.image(e,function(n){l(n.bufferView)&&(t[n.bufferView]=!0)}),$s(e,"KHR_draco_mesh_compression")&&Se.mesh(e,function(n){Se.meshPrimitive(n,function(i){l(i.extensions)&&l(i.extensions.KHR_draco_mesh_compression)&&(t[i.extensions.KHR_draco_mesh_compression.bufferView]=!0)})}),$s(e,"EXT_feature_metadata")){const i=e.extensions.EXT_feature_metadata.featureTables;for(const o in i)if(i.hasOwnProperty(o)){const s=i[o].properties;if(l(s)){for(const a in s)if(s.hasOwnProperty(a)){const c=s[a];l(c.bufferView)&&(t[c.bufferView]=!0),l(c.arrayOffsetBufferView)&&(t[c.arrayOffsetBufferView]=!0),l(c.stringOffsetBufferView)&&(t[c.stringOffsetBufferView]=!0)}}}}if($s(e,"EXT_structural_metadata")){const i=e.extensions.EXT_structural_metadata.propertyTables;if(l(i)){const o=i.length;for(let r=0;r<o;++r){const a=i[r].properties;for(const c in a)if(a.hasOwnProperty(c)){const u=a[c];l(u.values)&&(t[u.values]=!0),l(u.arrayOffsets)&&(t[u.arrayOffsets]=!0),l(u.stringOffsets)&&(t[u.stringOffsets]=!0)}}}}return t};Gd.image=function(e){const t={};return Se.texture(e,function(n){l(n.source)&&(t[n.source]=!0),l(n.extensions)&&l(n.extensions.EXT_texture_webp)?t[n.extensions.EXT_texture_webp.source]=!0:l(n.extensions)&&l(n.extensions.KHR_texture_basisu)&&(t[n.extensions.KHR_texture_basisu.source]=!0)}),t};Gd.mesh=function(e){const t={};return Se.node(e,function(n){if(l(n.mesh&&l(e.meshes))){const i=e.meshes[n.mesh];l(i)&&l(i.primitives)&&i.primitives.length>0&&(t[n.mesh]=!0)}}),t};function Vte(e,t,n){const i=e.nodes[t];return l(i.mesh)||l(i.camera)||l(i.skin)||l(i.weights)||l(i.extras)||l(i.extensions)&&Object.keys(i.extensions).length!==0||l(n[t])?!1:!l(i.children)||i.children.filter(function(o){return!Vte(e,o,n)}).length===0}Gd.node=function(e){const t={};return Se.skin(e,function(n){l(n.skeleton)&&(t[n.skeleton]=!0),Se.skinJoint(n,function(i){t[i]=!0})}),Se.animation(e,function(n){Se.animationChannel(n,function(i){l(i.target)&&l(i.target.node)&&(t[i.target.node]=!0)})}),Se.technique(e,function(n){Se.techniqueUniform(n,function(i){l(i.node)&&(t[i.node]=!0)})}),Se.node(e,function(n,i){Vte(e,i,t)||(t[i]=!0)}),t};Gd.material=function(e){const t={};return Se.mesh(e,function(n){Se.meshPrimitive(n,function(i){l(i.material)&&(t[i.material]=!0)})}),t};Gd.texture=function(e){const t={};if(Se.material(e,function(n){Hte(n,function(i){t[i]=!0})}),$s(e,"EXT_feature_metadata")){Se.mesh(e,function(o){Se.meshPrimitive(o,function(r){const s=r.extensions;if(l(s)&&l(s.EXT_feature_metadata)){const c=s.EXT_feature_metadata.featureIdTextures;if(l(c)){const u=c.length;for(let f=0;f<u;++f){const _=c[f].featureIds.texture;t[_.index]=!0}}}})});const i=e.extensions.EXT_feature_metadata.featureTextures;for(const o in i)if(i.hasOwnProperty(o)){const s=i[o].properties;if(l(s)){for(const a in s)if(s.hasOwnProperty(a)){const u=s[a].texture;t[u.index]=!0}}}}if($s(e,"EXT_mesh_features")&&Se.mesh(e,function(n){Se.meshPrimitive(n,function(i){const o=i.extensions;if(l(o)&&l(o.EXT_mesh_features)){const s=o.EXT_mesh_features.featureIds;if(l(s)){const a=s.length;for(let c=0;c<a;++c){const u=s[c];l(u.texture)&&(t[u.texture.index]=!0)}}}})}),$s(e,"EXT_structural_metadata")){const i=e.extensions.EXT_structural_metadata.propertyTextures;if(l(i)){const o=i.length;for(let r=0;r<o;++r){const a=i[r].properties;for(const c in a)if(a.hasOwnProperty(c)){const u=a[c];t[u.index]=!0}}}}return t};Gd.sampler=function(e){const t={};return Se.texture(e,function(n){l(n.sampler)&&(t[n.sampler]=!0)}),t};function UXe(e,t){const n={byteLength:t.length,extras:{_pipeline:{source:t}}},o={buffer:ef(e.buffers,n),byteOffset:0,byteLength:t.length};return ef(e.bufferViews,o)}function HXe(e,t){const n=IT(e,t),i=oe.getSizeInBytes(t.componentType),o=Bx(t.type),r=t.count,s=new Array(o*r);if(!l(t.bufferView))return s.fill(0);const a=e.bufferViews[t.bufferView],c=e.buffers[a.buffer].extras._pipeline.source;let u=t.byteOffset+a.byteOffset+c.byteOffset;const f=new DataView(c.buffer),h=new Array(o),_=fU(t.componentType);for(let g=0;g<r;++g){_(f,u,o,i,h);for(let p=0;p<o;++p)s[g*o+p]=h[p];u+=n}return s}function VXe(e){let t;return Se.accessorWithSemantic(e,"JOINTS_0",function(n){const i=e.accessors[n];t=i.componentType,t===fe.BYTE?vv(e,i,oe.UNSIGNED_BYTE):t!==fe.UNSIGNED_BYTE&&t!==fe.UNSIGNED_SHORT&&vv(e,i,oe.UNSIGNED_SHORT)}),Se.accessorWithSemantic(e,"WEIGHTS_0",function(n){const i=e.accessors[n];t=i.componentType,t===fe.BYTE?vv(e,i,oe.UNSIGNED_BYTE):t===fe.SHORT&&vv(e,i,oe.UNSIGNED_SHORT)}),e}function vv(e,t,n){const i=oe.createTypedArray(n,HXe(e,t)),o=new Uint8Array(i.buffer);t.bufferView=UXe(e,o),t.componentType=n,t.byteOffset=0}function qF(e,t){return zte(e,t),t==="CESIUM_RTC"&&kXe(e),jF(e,t)}function kXe(e){Se.technique(e,function(t){Se.techniqueUniform(t,function(n){n.semantic==="CESIUM_RTC_MODELVIEW"&&(n.semantic="MODELVIEW")})})}function jF(e,t){if(Array.isArray(e)){const n=e.length;for(let i=0;i<n;++i)jF(e[i],t)}else if(e!==null&&typeof e=="object"&&e.constructor===Object){const n=e.extensions;let i;l(n)&&(i=n[t],l(i)&&(delete n[t],Object.keys(n).length===0&&delete e.extensions));for(const o in e)Object.prototype.hasOwnProperty.call(e,o)&&jF(e[o],t);return i}}const Dv={.8:$Xe,"1.0":mKe,"2.0":void 0};function GXe(e,t){t=A(t,A.EMPTY_OBJECT);const n=t.targetVersion;let i=e.version;e.asset=A(e.asset,{version:"1.0"}),e.asset.version=A(e.asset.version,"1.0"),i=A(i,e.asset.version).toString(),Object.prototype.hasOwnProperty.call(Dv,i)||(l(i)&&(i=i.substring(0,3)),Object.prototype.hasOwnProperty.call(Dv,i)||(i="1.0"));let o=Dv[i];for(;l(o)&&i!==n;)o(e,t),i=e.asset.version,o=Dv[i];return t.keepLegacyExtensions||(yKe(e),AKe(e)),e}function kte(e){const t=e.materials;for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)){const i=t[n],o=i.instanceTechnique;l(o)&&(i.technique=o.technique,i.values=o.values,delete i.instanceTechnique)}}function WXe(e){const t=e.meshes;for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)){const o=t[n].primitives;if(l(o)){const r=o.length;for(let s=0;s<r;++s){const a=o[s],c=A(a.primitive,fe.TRIANGLES);a.mode=A(a.mode,c),delete a.primitive}}}}function qXe(e){const t=e.nodes,n=new d,i=new De;for(const o in t)if(Object.prototype.hasOwnProperty.call(t,o)){const r=t[o];if(l(r.rotation)){const a=r.rotation;d.fromArray(a,0,n),De.fromAxisAngle(n,a[3],i),r.rotation=[i.x,i.y,i.z,i.w]}const s=r.instanceSkin;l(s)&&(r.skeletons=s.skeletons,r.skin=s.skin,r.meshes=s.meshes,delete r.instanceSkin)}}function jXe(e){const t=e.animations,n=e.accessors,i=e.bufferViews,o=e.buffers,r={},s=new d,a=new De;for(const c in t)if(Object.prototype.hasOwnProperty.call(t,c)){const u=t[c],f=u.channels,h=u.parameters,_=u.samplers;if(l(f)){const g=f.length;for(let p=0;p<g;++p){const y=f[p];if(y.target.path==="rotation"){const T=h[_[y.sampler].output];if(l(r[T]))continue;r[T]=!0;const b=n[T],x=i[b.bufferView],D=o[x.buffer].extras._pipeline.source,L=D.byteOffset+x.byteOffset+b.byteOffset,B=b.componentType,V=b.count,M=Bx(b.type),H=b.count*M,G=oe.createArrayBufferView(B,D.buffer,L,H);for(let I=0;I<V;I++){const O=I*M;d.unpack(G,O,s);const m=G[O+3];De.fromAxisAngle(s,m,a),De.pack(a,G,O)}}}}}}function YXe(e){const t=e.techniques;for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)){const i=t[n],o=i.passes;if(l(o)){const r=A(i.pass,"defaultPass");if(Object.prototype.hasOwnProperty.call(o,r)){const s=o[r],a=s.instanceProgram;i.attributes=A(i.attributes,a.attributes),i.program=A(i.program,a.program),i.uniforms=A(i.uniforms,a.uniforms),i.states=A(i.states,s.states)}delete i.passes,delete i.pass}}}function $Xe(e){l(e.asset)||(e.asset={});const t=e.asset;if(t.version="1.0",typeof t.profile=="string"){const n=t.profile.split(" ");t.profile={api:n[0],version:n[1]}}else t.profile={};if(l(e.version)&&delete e.version,kte(e),WXe(e),qXe(e),jXe(e),YXe(e),l(e.allExtensions)&&(e.extensionsUsed=e.allExtensions,delete e.allExtensions),l(e.lights)){const n=A(e.extensions,{});e.extensions=n;const i=A(n.KHR_materials_common,{});n.KHR_materials_common=i,i.lights=e.lights,delete e.lights,Rx(e,"KHR_materials_common")}}function XXe(e){const t=e.animations;for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)){const i=t[n],o=i.parameters;if(l(o)){const r=i.samplers;for(const s in r)if(Object.prototype.hasOwnProperty.call(r,s)){const a=r[s];a.input=o[a.input],a.output=o[a.output]}delete i.parameters}}}function Z9(e,t){const n=[];for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)){const o=e[i];t[i]=n.length,n.push(o),l(o.name)||(o.name=i)}return n}function KXe(e){let t;const n={accessors:{},animations:{},buffers:{},bufferViews:{},cameras:{},images:{},materials:{},meshes:{},nodes:{},programs:{},samplers:{},scenes:{},shaders:{},skins:{},textures:{},techniques:{}};let i;const o={},r=e.nodes;for(const s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i=r[s].jointName,l(i)&&(o[i]=s));for(const s in e)if(Object.prototype.hasOwnProperty.call(e,s)&&l(n[s])){const a={},c=e[s];e[s]=Z9(c,a),n[s]=a}for(i in o)Object.prototype.hasOwnProperty.call(o,i)&&(o[i]=n.nodes[o[i]]);l(e.scene)&&(e.scene=n.scenes[e.scene]),Se.bufferView(e,function(s){l(s.buffer)&&(s.buffer=n.buffers[s.buffer])}),Se.accessor(e,function(s){l(s.bufferView)&&(s.bufferView=n.bufferViews[s.bufferView])}),Se.shader(e,function(s){const a=s.extensions;if(l(a)){const c=a.KHR_binary_glTF;l(c)&&(s.bufferView=n.bufferViews[c.bufferView],delete a.KHR_binary_glTF),Object.keys(a).length===0&&delete s.extensions}}),Se.program(e,function(s){l(s.vertexShader)&&(s.vertexShader=n.shaders[s.vertexShader]),l(s.fragmentShader)&&(s.fragmentShader=n.shaders[s.fragmentShader])}),Se.technique(e,function(s){l(s.program)&&(s.program=n.programs[s.program]),Se.techniqueParameter(s,function(a){l(a.node)&&(a.node=n.nodes[a.node]);const c=a.value;typeof c=="string"&&(a.value={index:n.textures[c]})})}),Se.mesh(e,function(s){Se.meshPrimitive(s,function(a){l(a.indices)&&(a.indices=n.accessors[a.indices]),Se.meshPrimitiveAttribute(a,function(c,u){a.attributes[u]=n.accessors[c]}),l(a.material)&&(a.material=n.materials[a.material])})}),Se.node(e,function(s){let a=s.children;if(l(a)){const c=a.length;for(t=0;t<c;++t)a[t]=n.nodes[a[t]]}if(l(s.meshes)){const c=s.meshes,u=c.length;if(u>0)for(s.mesh=n.meshes[c[0]],t=1;t<u;++t){const f={mesh:n.meshes[c[t]]},h=ef(e.nodes,f);l(a)||(a=[],s.children=a),a.push(h)}delete s.meshes}if(l(s.camera)&&(s.camera=n.cameras[s.camera]),l(s.skin)&&(s.skin=n.skins[s.skin]),l(s.skeletons)){const c=s.skeletons;if(c.length>0&&l(s.skin)){const f=e.skins[s.skin];f.skeleton=n.nodes[c[0]]}delete s.skeletons}l(s.jointName)&&delete s.jointName}),Se.skin(e,function(s){l(s.inverseBindMatrices)&&(s.inverseBindMatrices=n.accessors[s.inverseBindMatrices]);const a=s.jointNames;if(l(a)){const c=[],u=a.length;for(t=0;t<u;++t)c[t]=o[a[t]];s.joints=c,delete s.jointNames}}),Se.scene(e,function(s){const a=s.nodes;if(l(a)){const c=a.length;for(t=0;t<c;++t)a[t]=n.nodes[a[t]]}}),Se.animation(e,function(s){const a={};s.samplers=Z9(s.samplers,a),Se.animationSampler(s,function(c){c.input=n.accessors[c.input],c.output=n.accessors[c.output]}),Se.animationChannel(s,function(c){c.sampler=a[c.sampler];const u=c.target;l(u)&&(u.node=n.nodes[u.id],delete u.id)})}),Se.material(e,function(s){l(s.technique)&&(s.technique=n.techniques[s.technique]),Se.materialValue(s,function(c,u){typeof c=="string"&&(s.values[u]={index:n.textures[c]})});const a=s.extensions;if(l(a)){const c=a.KHR_materials_common;l(c)&&l(c.values)&&Se.materialValue(c,function(u,f){typeof u=="string"&&(c.values[f]={index:n.textures[u]})})}}),Se.image(e,function(s){const a=s.extensions;if(l(a)){const c=a.KHR_binary_glTF;l(c)&&(s.bufferView=n.bufferViews[c.bufferView],s.mimeType=c.mimeType,delete a.KHR_binary_glTF),Object.keys(a).length===0&&delete s.extensions}}),Se.texture(e,function(s){l(s.sampler)&&(s.sampler=n.samplers[s.sampler]),l(s.source)&&(s.source=n.images[s.source])})}function JXe(e){Se.animation(e,function(t){Se.animationSampler(t,function(n){delete n.name})})}function QXe(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)){const n=e[t];Array.isArray(n)&&n.length===0&&delete e[t]}Se.node(e,function(t){l(t.children)&&t.children.length===0&&delete t.children})}function ZXe(e){const t=e.asset;delete t.profile,delete t.premultipliedAlpha}const eKe={CESIUM_RTC:!0,KHR_materials_common:!0,WEB3D_quantized_attributes:!0};function tKe(e){const t=e.extensionsUsed;if(e.extensionsRequired=A(e.extensionsRequired,[]),l(t)){const n=t.length;for(let i=0;i<n;++i){const o=t[i];l(eKe[o])&&e.extensionsRequired.push(o)}}}function nKe(e){Se.buffer(e,function(t){delete t.type})}function iKe(e){Se.texture(e,function(t){delete t.format,delete t.internalFormat,delete t.target,delete t.type})}function oKe(e){Se.mesh(e,function(t){Se.meshPrimitive(t,function(n){Se.meshPrimitiveAttribute(n,function(i,o){o==="TEXCOORD"?n.attributes.TEXCOORD_0=i:o==="COLOR"&&(n.attributes.COLOR_0=i)}),delete n.attributes.TEXCOORD,delete n.attributes.COLOR})}),Se.technique(e,function(t){Se.techniqueParameter(t,function(n){const i=n.semantic;l(i)&&(i==="TEXCOORD"?n.semantic="TEXCOORD_0":i==="COLOR"&&(n.semantic="COLOR_0"))})})}const rKe={POSITION:!0,NORMAL:!0,TANGENT:!0},sKe={COLOR:"COLOR",JOINT:"JOINTS",JOINTS:"JOINTS",TEXCOORD:"TEXCOORD",WEIGHT:"WEIGHTS",WEIGHTS:"WEIGHTS"};function aKe(e){const t={};Se.mesh(e,function(n){Se.meshPrimitive(n,function(i){Se.meshPrimitiveAttribute(i,function(o,r){if(r.charAt(0)!=="_"){const s=r.search(/_[0-9]+/g);let a=r,c="_0";s>=0&&(a=r.substring(0,s),c=r.substring(s));let u;const f=sKe[a];l(f)?(u=f+c,t[r]=u):l(rKe[a])||(u=`_${r}`,t[r]=u)}});for(const o in t)if(Object.prototype.hasOwnProperty.call(t,o)){const r=t[o],s=i.attributes[o];l(s)&&(delete i.attributes[o],i.attributes[r]=s)}})}),Se.technique(e,function(n){Se.techniqueParameter(n,function(i){const o=t[i.semantic];l(o)&&(i.semantic=o)})})}function cKe(e){Se.camera(e,function(t){const n=t.perspective;if(l(n)){const i=n.aspectRatio;l(i)&&i===0&&delete n.aspectRatio;const o=n.yfov;l(o)&&o===0&&(n.yfov=1)}})}function YF(e,t){return l(t.byteStride)&&t.byteStride!==0?t.byteStride:IT(e,t)}function lKe(e){Se.buffer(e,function(t){l(t.byteLength)||(t.byteLength=t.extras._pipeline.source.length)}),Se.accessor(e,function(t){const n=t.bufferView;if(l(n)){const i=e.bufferViews[n],o=YF(e,t),r=t.byteOffset+t.count*o;i.byteLength=Math.max(A(i.byteLength,0),r)}})}function uKe(e){let t,n,i;const o=e.bufferViews,r={};Se.accessorContainingVertexAttributeData(e,function(a){const c=e.accessors[a];l(c.bufferView)&&(r[c.bufferView]=!0)});const s={};Se.accessor(e,function(a){l(a.bufferView)&&(s[a.bufferView]=A(s[a.bufferView],[]),s[a.bufferView].push(a))});for(const a in s)if(Object.prototype.hasOwnProperty.call(s,a)){i=o[a];const c=s[a];c.sort(function(_,g){return _.byteOffset-g.byteOffset});let u=0,f=0;const h=c.length;for(t=0;t<h;++t){let _=c[t];const g=YF(e,_),p=_.byteOffset,y=_.count*g;delete _.byteStride;const T=t<h-1,b=T?YF(e,c[t+1]):void 0;if(g!==b){const x=St(i,!0);r[a]&&(x.byteStride=g),x.byteOffset+=u,x.byteLength=p+y-u;const v=ef(o,x);for(n=f;n<=t;++n)_=c[n],_.bufferView=v,_.byteOffset=_.byteOffset-u;u=T?c[t+1].byteOffset:void 0,f=t+1}}}MXe(e,["accessor","bufferView","buffer"])}function fKe(e){Se.accessorWithSemantic(e,"POSITION",function(t){const n=e.accessors[t];if(!l(n.min)||!l(n.max)){const i=dU(e,n);n.min=i.min,n.max=i.max}})}function Gte(e){return(!l(e.children)||e.children.length===0)&&(!l(e.meshes)||e.meshes.length===0)&&!l(e.camera)&&!l(e.skin)&&!l(e.skeletons)&&!l(e.jointName)&&(!l(e.translation)||d.fromArray(e.translation).equals(d.ZERO))&&(!l(e.scale)||d.fromArray(e.scale).equals(new d(1,1,1)))&&(!l(e.rotation)||ue.fromArray(e.rotation).equals(new ue(0,0,0,1)))&&(!l(e.matrix)||N.fromColumnMajorArray(e.matrix).equals(N.IDENTITY))&&!l(e.extensions)&&!l(e.extras)}function Wte(e,t){Se.scene(e,function(n){const i=n.nodes;if(l(i)){const o=i.length;for(let r=o;r>=0;--r)if(i[r]===t){i.splice(r,1);return}}}),Se.node(e,function(n,i){if(l(n.children)){const o=n.children.indexOf(t);o>-1&&(n.children.splice(o,1),Gte(n)&&Wte(e,i))}}),delete e.nodes[t]}function dKe(e){return Se.node(e,function(t,n){Gte(t)&&Wte(e,n)}),e}function hKe(e){Se.animation(e,function(t){Se.animationSampler(t,function(n){const i=e.accessors[n.input];if(!l(i.min)||!l(i.max)){const o=dU(e,i);i.min=o.min,i.max=o.max}})})}function pKe(e){Se.accessor(e,function(t){if(l(t.min)||l(t.max)){const n=dU(e,t);l(t.min)&&(t.min=n.min),l(t.max)&&(t.max=n.max)}})}function mKe(e){e.asset=A(e.asset,{}),e.asset.version="2.0",kte(e),XXe(e),dKe(e),KXe(e),JXe(e),ZXe(e),tKe(e),lKe(e),uKe(e),fKe(e),hKe(e),pKe(e),nKe(e),iKe(e),oKe(e),aKe(e),VXe(e),cKe(e),BXe(e),NXe(e),QXe(e)}const _Ke=["u_tex","u_diffuse","u_emission"],gKe=["u_diffuse"];function $F(e){e.pbrMetallicRoughness=l(e.pbrMetallicRoughness)?e.pbrMetallicRoughness:{},e.pbrMetallicRoughness.roughnessFactor=1,e.pbrMetallicRoughness.metallicFactor=0}function YD(e){return l(e.index)}function $D(e){return Array.isArray(e)&&e.length===4}function qte(e){const t=new Array(4);t[3]=e[3];for(let n=0;n<3;n++){const i=e[n];i<=.04045?t[n]=e[n]*.07739938080495357:t[n]=Math.pow((i+.055)*.9478672985781991,2.4)}return t}function yKe(e){Se.material(e,function(t){Se.materialValue(t,function(n,i){_Ke.indexOf(i)!==-1&&YD(n)?($F(t),t.pbrMetallicRoughness.baseColorTexture=n):gKe.indexOf(i)!==-1&&$D(n)&&($F(t),t.pbrMetallicRoughness.baseColorFactor=qte(n))})}),qF(e,"KHR_techniques_webgl"),qF(e,"KHR_blend")}function AKe(e){Se.material(e,function(t){const n=A(t.extensions,A.EMPTY_OBJECT).KHR_materials_common;if(l(n)){n.technique==="CONSTANT"&&(Rx(e,"KHR_materials_unlit"),t.extensions=l(t.extensions)?t.extensions:{},t.extensions.KHR_materials_unlit={});const o=l(n.values)?n.values:{},r=o.ambient,s=o.diffuse,a=o.emission,c=o.transparency,u=n.doubleSided,f=n.transparent;$F(t),l(r)&&($D(r)?t.emissiveFactor=r.slice(0,3):YD(r)&&(t.emissiveTexture=r)),l(s)&&($D(s)?t.pbrMetallicRoughness.baseColorFactor=qte(s):YD(s)&&(t.pbrMetallicRoughness.baseColorTexture=s)),l(u)&&(t.doubleSided=u),l(a)&&($D(a)?t.emissiveFactor=a.slice(0,3):YD(a)&&(t.emissiveTexture=a)),l(c)&&(l(t.pbrMetallicRoughness.baseColorFactor)?t.pbrMetallicRoughness.baseColorFactor[3]*=c:t.pbrMetallicRoughness.baseColorFactor=[1,1,1,c]),l(f)&&(t.alphaMode=f?"BLEND":"OPAQUE")}}),qF(e,"KHR_materials_common")}function Vh(e){e=A(e,A.EMPTY_OBJECT);const t=e.resourceCache,n=e.gltfResource,i=e.baseResource,o=e.typedArray,r=e.gltfJson,s=e.cacheKey;E.typeOf.func("options.resourceCache",t),E.typeOf.object("options.gltfResource",n),E.typeOf.object("options.baseResource",i),this._resourceCache=t,this._gltfResource=n,this._baseResource=i,this._typedArray=o,this._gltfJson=r,this._cacheKey=s,this._gltf=void 0,this._bufferLoaders=[],this._state=Qt.UNLOADED,this._promise=void 0}l(Object.create)&&(Vh.prototype=Object.create(jr.prototype),Vh.prototype.constructor=Vh);Object.defineProperties(Vh.prototype,{promise:{get:function(){return this._promise}},cacheKey:{get:function(){return this._cacheKey}},gltf:{get:function(){return this._gltf}}});Vh.prototype.load=function(){this._state=Qt.LOADING;let e;l(this._gltfJson)?e=jte(this,this._gltfJson):l(this._typedArray)?e=Yte(this,this._typedArray):e=TKe(this);const t=this;return this._promise=e.then(function(n){if(!t.isDestroyed())return t._gltf=n,t._state=Qt.READY,t}).catch(function(n){if(!t.isDestroyed())return CKe(t,n)}),this._promise};function TKe(e){return e._fetchGltf().then(function(t){if(e.isDestroyed())return;const n=new Uint8Array(t);return Yte(e,n)})}function CKe(e,t){e.unload(),e._state=Qt.FAILED;const n=`Failed to load glTF: ${e._gltfResource.url}`;return Promise.reject(e.getError(n,t))}function bKe(e,t){if(l(t.asset)&&t.asset.version==="2.0"&&!$s(t,"KHR_techniques_webgl")&&!$s(t,"KHR_materials_common"))return Promise.resolve();const n=[];return Se.buffer(t,function(i){if(!l(i.extras._pipeline.source)&&l(i.uri)){const o=e._baseResource.getDerivedResource({url:i.uri}),s=e._resourceCache.loadExternalBuffer({resource:o});e._bufferLoaders.push(s),n.push(s.promise.then(function(a){i.extras._pipeline.source=a.typedArray}))}}),Promise.all(n).then(function(){GXe(t)})}function EKe(e){const t=[];return Se.buffer(e,function(n){const i=n.uri;!l(n.extras._pipeline.source)&&l(i)&&z3(i)&&(delete n.uri,t.push(je.fetchArrayBuffer(i).then(function(o){n.extras._pipeline.source=new Uint8Array(o)})))}),Promise.all(t)}function xKe(e,t){const n=[];return Se.buffer(t,function(i,o){const r=i.extras._pipeline.source;if(l(r)&&!l(i.uri)){const a=e._resourceCache.loadEmbeddedBuffer({parentResource:e._gltfResource,bufferId:o,typedArray:r});e._bufferLoaders.push(a),n.push(a.promise)}}),Promise.all(n)}function jte(e,t){return uU(t),EKe(t).then(function(){return bKe(e,t)}).then(function(){return CXe(t),xKe(e,t)}).then(function(){return DXe(t),t})}function Yte(e,t){let n;return TP(t)==="glTF"?n=wXe(t):n=zc(t),jte(e,n)}Vh.prototype.unload=function(){const e=this._bufferLoaders,t=e.length;for(let n=0;n<t;++n)this._resourceCache.unload(e[n]);this._bufferLoaders.length=0,this._gltf=void 0};Vh.prototype._fetchGltf=function(){return this._gltfResource.fetchArrayBuffer()};const wKe={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"},QI=Object.freeze(wKe),jo={};function SKe(){this.octEncoded=!1,this.octEncodedZXY=!1,this.normalizationRange=void 0,this.quantizedVolumeOffset=void 0,this.quantizedVolumeDimensions=void 0,this.quantizedVolumeStepSize=void 0,this.componentDatatype=void 0,this.type=void 0}function vKe(){this.name=void 0,this.semantic=void 0,this.setIndex=void 0,this.componentDatatype=void 0,this.type=void 0,this.normalized=!1,this.count=void 0,this.min=void 0,this.max=void 0,this.constant=void 0,this.quantization=void 0,this.typedArray=void 0,this.buffer=void 0,this.byteOffset=0,this.byteStride=void 0}function DKe(){this.indexDatatype=void 0,this.count=void 0,this.buffer=void 0,this.typedArray=void 0}function IKe(){this.featureCount=void 0,this.nullFeatureId=void 0,this.propertyTableId=void 0,this.setIndex=void 0,this.label=void 0,this.positionalLabel=void 0}function PKe(){this.featureCount=void 0,this.nullFeatureId=void 0,this.propertyTableId=void 0,this.offset=0,this.repeat=void 0,this.label=void 0,this.positionalLabel=void 0}function OKe(){this.featureCount=void 0,this.nullFeatureId=void 0,this.propertyTableId=void 0,this.textureReader=void 0,this.label=void 0,this.positionalLabel=void 0}function LKe(){this.attributes=[]}function BKe(){this.attributes=[],this.morphTargets=[],this.indices=void 0,this.material=void 0,this.primitiveType=void 0,this.featureIds=[],this.propertyTextureIds=[],this.propertyAttributeIds=[],this.outlineCoordinates=void 0}function RKe(){this.attributes=[],this.featureIds=[],this.transformInWorldSpace=!1}function NKe(){this.index=void 0,this.joints=[],this.inverseBindMatrices=[]}function MKe(){this.name=void 0,this.index=void 0,this.children=[],this.primitives=[],this.instances=void 0,this.skin=void 0,this.matrix=void 0,this.translation=void 0,this.rotation=void 0,this.scale=void 0,this.morphWeights=[],this.articulationName=void 0}function FKe(){this.nodes=[]}const zKe={TRANSLATION:"translation",ROTATION:"rotation",SCALE:"scale",WEIGHTS:"weights"};function UKe(){this.input=[],this.interpolation=void 0,this.output=[]}function HKe(){this.node=void 0,this.path=void 0}function VKe(){this.sampler=void 0,this.target=void 0}function kKe(){this.name=void 0,this.samplers=[],this.channels=[]}function GKe(){this.name=void 0,this.type=void 0,this.minimumValue=void 0,this.maximumValue=void 0,this.initialValue=void 0}function WKe(){this.name=void 0,this.stages=[]}function $te(){this.credits=[]}function qKe(){this.asset=new $te,this.scene=void 0,this.nodes=[],this.skins=[],this.animations=[],this.articulations=[],this.structuralMetadata=void 0,this.upAxis=void 0,this.forwardAxis=void 0,this.transform=N.clone(N.IDENTITY)}function jKe(){this.texture=void 0,this.index=void 0,this.texCoord=0,this.transform=te.clone(te.IDENTITY),this.channels=void 0}function Um(){this.baseColorTexture=void 0,this.metallicRoughnessTexture=void 0,this.baseColorFactor=ue.clone(Um.DEFAULT_BASE_COLOR_FACTOR),this.metallicFactor=Um.DEFAULT_METALLIC_FACTOR,this.roughnessFactor=Um.DEFAULT_ROUGHNESS_FACTOR}Um.DEFAULT_BASE_COLOR_FACTOR=ue.ONE;Um.DEFAULT_METALLIC_FACTOR=1;Um.DEFAULT_ROUGHNESS_FACTOR=1;function jg(){this.diffuseTexture=void 0,this.specularGlossinessTexture=void 0,this.diffuseFactor=ue.clone(jg.DEFAULT_DIFFUSE_FACTOR),this.specularFactor=d.clone(jg.DEFAULT_SPECULAR_FACTOR),this.glossinessFactor=jg.DEFAULT_GLOSSINESS_FACTOR}jg.DEFAULT_DIFFUSE_FACTOR=ue.ONE;jg.DEFAULT_SPECULAR_FACTOR=d.ONE;jg.DEFAULT_GLOSSINESS_FACTOR=1;function hU(){this.metallicRoughness=new Um,this.specularGlossiness=void 0,this.emissiveTexture=void 0,this.normalTexture=void 0,this.occlusionTexture=void 0,this.emissiveFactor=d.clone(hU.DEFAULT_EMISSIVE_FACTOR),this.alphaMode=QI.OPAQUE,this.alphaCutoff=.5,this.doubleSided=!1,this.unlit=!1}hU.DEFAULT_EMISSIVE_FACTOR=d.ZERO;jo.Quantization=SKe;jo.Attribute=vKe;jo.Indices=DKe;jo.FeatureIdAttribute=IKe;jo.FeatureIdTexture=OKe;jo.FeatureIdImplicitRange=PKe;jo.MorphTarget=LKe;jo.Primitive=BKe;jo.Instances=RKe;jo.Skin=NKe;jo.Node=MKe;jo.Scene=FKe;jo.AnimatedPropertyType=Object.freeze(zKe);jo.AnimationSampler=UKe;jo.AnimationTarget=HKe;jo.AnimationChannel=VKe;jo.Animation=kKe;jo.ArticulationStage=GKe;jo.Articulation=WKe;jo.Asset=$te;jo.Components=qKe;jo.TextureReader=jKe;jo.MetallicRoughness=Um;jo.SpecularGlossiness=jg;jo.Material=hU;const Yt=jo,wP={};wP.getImageIdFromTexture=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.gltf,n=e.textureId,i=e.supportedImageFormats;E.typeOf.object("options.gltf",t),E.typeOf.number("options.textureId",n),E.typeOf.object("options.supportedImageFormats",i);const o=t.textures[n],r=o.extensions;if(l(r)){if(i.webp&&l(r.EXT_texture_webp))return r.EXT_texture_webp.source;if(i.basis&&l(r.KHR_texture_basisu))return r.KHR_texture_basisu.source}return o.source};wP.createSampler=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.gltf,n=e.textureInfo,i=A(e.compressedTextureNoMipmap,!1);E.typeOf.object("options.gltf",t),E.typeOf.object("options.textureInfo",n);let o=io.REPEAT,r=io.REPEAT,s=Wn.LINEAR,a=Ps.LINEAR;const c=n.index,f=t.textures[c].sampler;if(l(f)){const g=t.samplers[f];o=A(g.wrapS,o),r=A(g.wrapT,r),s=A(g.minFilter,s),a=A(g.magFilter,a)}let h=!1;const _=n.extensions;return l(_)&&l(_.KHR_texture_transform)&&(h=!0),(i||h)&&s!==Wn.LINEAR&&s!==Wn.NEAREST&&(s===Wn.NEAREST_MIPMAP_NEAREST||s===Wn.NEAREST_MIPMAP_LINEAR?s=Wn.NEAREST:s=Wn.LINEAR),new Ci({wrapS:o,wrapT:r,minificationFilter:s,magnificationFilter:a})};const YKe=new $(1,1);wP.createModelTextureReader=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.textureInfo,n=e.channels,i=e.texture;E.typeOf.object("options.textureInfo",t);let o=A(t.texCoord,0),r;const s=A(t.extensions,A.EMPTY_OBJECT).KHR_texture_transform;if(l(s)){o=A(s.texCoord,o);const c=l(s.offset)?$.unpack(s.offset):$.ZERO;let u=A(s.rotation,0);const f=l(s.scale)?$.unpack(s.scale):YKe;u=-u,r=new te(Math.cos(u)*f.x,-Math.sin(u)*f.y,c.x,Math.sin(u)*f.x,Math.cos(u)*f.y,c.y,0,0,1)}const a=new Yt.TextureReader;return a.index=t.index,a.texture=i,a.texCoord=o,a.transform=r,a.channels=n,a};const ly=wP;function XF(e){const t=document.createElement("canvas");return t.width=F.nextPowerOfTwo(e.width),t.height=F.nextPowerOfTwo(e.height),t.getContext("2d").drawImage(e,0,0,e.width,e.height,0,0,t.width,t.height),t}function kh(e){e=A(e,A.EMPTY_OBJECT);const t=e.resourceCache,n=e.gltf,i=e.textureInfo,o=e.gltfResource,r=e.baseResource,s=e.supportedImageFormats,a=e.cacheKey,c=A(e.asynchronous,!0);E.typeOf.func("options.resourceCache",t),E.typeOf.object("options.gltf",n),E.typeOf.object("options.textureInfo",i),E.typeOf.object("options.gltfResource",o),E.typeOf.object("options.baseResource",r),E.typeOf.object("options.supportedImageFormats",s);const u=i.index,f=ly.getImageIdFromTexture({gltf:n,textureId:u,supportedImageFormats:s});this._resourceCache=t,this._gltf=n,this._textureInfo=i,this._imageId=f,this._gltfResource=o,this._baseResource=r,this._cacheKey=a,this._asynchronous=c,this._imageLoader=void 0,this._image=void 0,this._mipLevels=void 0,this._texture=void 0,this._state=Qt.UNLOADED,this._promise=void 0,this._process=function(h,_){}}l(Object.create)&&(kh.prototype=Object.create(jr.prototype),kh.prototype.constructor=kh);Object.defineProperties(kh.prototype,{promise:{get:function(){return this._promise}},cacheKey:{get:function(){return this._cacheKey}},texture:{get:function(){return this._texture}}});const $Ke=new pU;kh.prototype.load=function(){const t=this._resourceCache.loadImage({gltf:this._gltf,imageId:this._imageId,gltfResource:this._gltfResource,baseResource:this._baseResource});this._imageLoader=t,this._state=Qt.LOADING;const n=this,i=new Promise(function(o){n._process=function(r,s){if(l(r._texture)||!l(r._image))return;let a;if(r._asynchronous){const c=$Ke;if(c.set(r._gltf,r._textureInfo,r._image,r._mipLevels,s.context),!s.jobScheduler.execute(c,ju.TEXTURE))return;a=c.texture}else a=Xte(r._gltf,r._textureInfo,r._image,r._mipLevels,s.context);r.unload(),r._texture=a,r._state=Qt.READY,o(r)}});return this._promise=t.promise.then(function(){if(!n.isDestroyed())return n._image=t.image,n._mipLevels=t.mipLevels,n._state=Qt.PROCESSING,i}).catch(function(o){if(n.isDestroyed())return;n.unload(),n._state=Qt.FAILED;const r="Failed to load texture";return Promise.reject(n.getError(r,o))}),this._promise};function pU(){this.gltf=void 0,this.textureInfo=void 0,this.image=void 0,this.context=void 0,this.texture=void 0}pU.prototype.set=function(e,t,n,i,o){this.gltf=e,this.textureInfo=t,this.image=n,this.mipLevels=i,this.context=o};pU.prototype.execute=function(){this.texture=Xte(this.gltf,this.textureInfo,this.image,this.mipLevels,this.context)};function Xte(e,t,n,i,o){const r=n.internalFormat;let s=!1;yt.isCompressedFormat(r)&&!l(i)&&(s=!0);const a=ly.createSampler({gltf:e,textureInfo:t,compressedTextureNoMipmap:s}),c=a.minificationFilter,u=a.wrapS,f=a.wrapT,h=c===Wn.NEAREST_MIPMAP_NEAREST||c===Wn.NEAREST_MIPMAP_LINEAR||c===Wn.LINEAR_MIPMAP_NEAREST||c===Wn.LINEAR_MIPMAP_LINEAR,_=!l(r)&&h,g=_||u===io.REPEAT||u===io.MIRRORED_REPEAT||f===io.REPEAT||f===io.MIRRORED_REPEAT,p=!F.isPowerOfTwo(n.width)||!F.isPowerOfTwo(n.height),y=g&&p;let T;return l(r)?(!o.webgl2&&yt.isCompressedFormat(r)&&p&&g&&console.warn("Compressed texture uses REPEAT or MIRRORED_REPEAT texture wrap mode and dimensions are not powers of two. The texture may be rendered incorrectly."),T=rn.create({context:o,source:{arrayBufferView:n.bufferView,mipLevels:i},width:n.width,height:n.height,pixelFormat:n.internalFormat,sampler:a})):(y&&(n=XF(n)),T=rn.create({context:o,source:n,sampler:a,flipY:!1,skipColorSpaceConversion:!0})),_&&T.generateMipmap(),T}kh.prototype.process=function(e){return E.typeOf.object("frameState",e),this._process(this,e)};kh.prototype.unload=function(){l(this._texture)&&this._texture.destroy(),l(this._imageLoader)&&this._resourceCache.unload(this._imageLoader),this._imageLoader=void 0,this._image=void 0,this._mipLevels=void 0,this._texture=void 0,this._gltf=void 0};function Gh(e){e=A(e,A.EMPTY_OBJECT);const t=e.resourceCache,n=e.gltf,i=e.gltfResource,o=e.baseResource,r=e.bufferViewId,s=e.draco,a=e.attributeSemantic,c=e.accessorId,u=e.cacheKey,f=A(e.asynchronous,!0),h=A(e.loadBuffer,!1),_=A(e.loadTypedArray,!1);if(E.typeOf.func("options.resourceCache",t),E.typeOf.object("options.gltf",n),E.typeOf.object("options.gltfResource",i),E.typeOf.object("options.baseResource",o),!h&&!_)throw new w("At least one of loadBuffer and loadTypedArray must be true.");const g=l(r),p=Kte(s,a),y=l(a),T=l(c);if(g===p)throw new w("One of options.bufferViewId and options.draco must be defined.");if(p&&!y)throw new w("When options.draco is defined options.attributeSemantic must also be defined.");if(p&&!T)throw new w("When options.draco is defined options.accessorId must also be defined.");p&&(E.typeOf.object("options.draco",s),E.typeOf.string("options.attributeSemantic",a),E.typeOf.number("options.accessorId",c)),this._resourceCache=t,this._gltfResource=i,this._baseResource=o,this._gltf=n,this._bufferViewId=r,this._draco=s,this._attributeSemantic=a,this._accessorId=c,this._cacheKey=u,this._asynchronous=f,this._loadBuffer=h,this._loadTypedArray=_,this._bufferViewLoader=void 0,this._dracoLoader=void 0,this._quantization=void 0,this._typedArray=void 0,this._buffer=void 0,this._state=Qt.UNLOADED,this._promise=void 0,this._process=function(b,x){}}l(Object.create)&&(Gh.prototype=Object.create(jr.prototype),Gh.prototype.constructor=Gh);Object.defineProperties(Gh.prototype,{promise:{get:function(){return this._promise}},cacheKey:{get:function(){return this._cacheKey}},buffer:{get:function(){return this._buffer}},typedArray:{get:function(){return this._typedArray}},quantization:{get:function(){return this._quantization}}});function Kte(e,t){return l(e)&&l(e.attributes)&&l(e.attributes[t])}Gh.prototype.load=function(){let e;Kte(this._draco,this._attributeSemantic)?e=KKe(this):e=JKe(this);const t=this,n=new mU,i=new Promise(function(o){t._process=function(r,s){if(r._state===Qt.READY)return;const a=r._typedArray;if(l(r._dracoLoader)&&r._dracoLoader.process(s),l(r._bufferViewLoader)&&r._bufferViewLoader.process(s),!l(a))return;let c;if(r._loadBuffer&&r._asynchronous){const u=n;if(u.set(a,s.context),!s.jobScheduler.execute(u,ju.BUFFER))return;c=u.buffer}else r._loadBuffer&&(c=Jte(a,s.context));r.unload(),r._buffer=c,r._typedArray=r._loadTypedArray?a:void 0,r._state=Qt.READY,o(r)}});return this._promise=e.then(function(){if(!t.isDestroyed())return i}).catch(function(o){if(!t.isDestroyed())return QKe(t,o)}),this._promise};function XKe(e,t,n,i){const r=(1<<e.quantizationBits)-1,s=1/r,a=new Yt.Quantization;if(a.componentDatatype=t,a.octEncoded=e.octEncoded,a.octEncodedZXY=!0,a.type=i,a.octEncoded)a.type=Nn.VEC2,a.normalizationRange=r;else{const c=Nn.getMathType(i);if(c===Number){const u=e.range;a.quantizedVolumeOffset=e.minValues[0],a.quantizedVolumeDimensions=u,a.normalizationRange=r,a.quantizedVolumeStepSize=u*s}else{a.quantizedVolumeOffset=c.unpack(e.minValues),a.normalizationRange=c.unpack(new Array(n).fill(r));const u=new Array(n).fill(e.range);a.quantizedVolumeDimensions=c.unpack(u);const f=u.map(function(h){return h*s});a.quantizedVolumeStepSize=c.unpack(f)}}return a}function KKe(e){const n=e._resourceCache.loadDraco({gltf:e._gltf,draco:e._draco,gltfResource:e._gltfResource,baseResource:e._baseResource});return e._dracoLoader=n,e._state=Qt.LOADING,n.promise.then(function(){if(e.isDestroyed())return;const i=n.decodedData.vertexAttributes,o=e._attributeSemantic,r=i[o],s=e._accessorId,c=e._gltf.accessors[s].type,u=r.array,f=r.data.quantization;return l(f)&&(e._quantization=XKe(f,r.data.componentDatatype,r.data.componentsPerAttribute,c)),e._typedArray=new Uint8Array(u.buffer,u.byteOffset,u.byteLength),e._state=Qt.PROCESSING,e})}function JKe(e){const n=e._resourceCache.loadBufferView({gltf:e._gltf,bufferViewId:e._bufferViewId,gltfResource:e._gltfResource,baseResource:e._baseResource});return e._state=Qt.LOADING,e._bufferViewLoader=n,n.promise.then(function(){if(!e.isDestroyed())return e._typedArray=n.typedArray,e._state=Qt.PROCESSING,e})}function QKe(e,t){e.unload(),e._state=Qt.FAILED;const n="Failed to load vertex buffer";return t=e.getError(n,t),Promise.reject(t)}function mU(){this.typedArray=void 0,this.context=void 0,this.buffer=void 0}mU.prototype.set=function(e,t){this.typedArray=e,this.context=t};mU.prototype.execute=function(){this.buffer=Jte(this.typedArray,this.context)};function Jte(e,t){const n=Mt.createVertexBuffer({typedArray:e,context:t,usage:mt.STATIC_DRAW});return n.vertexArrayDestroyable=!1,n}Gh.prototype.process=function(e){return E.typeOf.object("frameState",e),this._process(this,e)};Gh.prototype.unload=function(){l(this._buffer)&&this._buffer.destroy();const e=this._resourceCache;l(this._bufferViewLoader)&&e.unload(this._bufferViewLoader),l(this._dracoLoader)&&e.unload(this._dracoLoader),this._bufferViewLoader=void 0,this._dracoLoader=void 0,this._typedArray=void 0,this._buffer=void 0,this._gltf=void 0};function i_(e){e=A(e,A.EMPTY_OBJECT);const t=e.id;E.typeOf.string("options.id",t);const n=A(e.properties,{}),i={};for(const o in n)if(n.hasOwnProperty(o)){const r=n[o];l(r.semantic)&&(i[r.semantic]=r)}this._id=t,this._name=e.name,this._description=e.description,this._properties=n,this._propertiesBySemantic=i,this._extras=St(e.extras,!0),this._extensions=St(e.extensions,!0)}i_.fromJson=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.id,n=e.class;E.typeOf.string("options.id",t),E.typeOf.object("options.class",n);const i={};for(const o in n.properties)if(n.properties.hasOwnProperty(o)){const r=Os.fromJson({id:o,property:n.properties[o],enums:e.enums});i[o]=r}return new i_({id:t,name:n.name,description:n.description,properties:i,extras:n.extras,extensions:n.extensions})};Object.defineProperties(i_.prototype,{properties:{get:function(){return this._properties}},propertiesBySemantic:{get:function(){return this._propertiesBySemantic}},id:{get:function(){return this._id}},name:{get:function(){return this._name}},description:{get:function(){return this._description}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}});i_.BATCH_TABLE_CLASS_NAME="_batchTable";function ZI(e){e=A(e,A.EMPTY_OBJECT);const t=e.value,n=e.name;E.typeOf.number("options.value",t),E.typeOf.string("options.name",n),this._value=t,this._name=n,this._description=e.description,this._extras=St(e.extras,!0),this._extensions=St(e.extensions,!0)}ZI.fromJson=function(e){return E.typeOf.object("value",e),new ZI({value:e.value,name:e.name,description:e.description,extras:e.extras,extensions:e.extensions})};Object.defineProperties(ZI.prototype,{value:{get:function(){return this._value}},name:{get:function(){return this._name}},description:{get:function(){return this._description}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}});function e1(e){e=A(e,A.EMPTY_OBJECT);const t=e.id,n=e.values;E.typeOf.string("options.id",t),E.defined("options.values",n);const i={},o={},r=n.length;for(let a=0;a<r;++a){const c=n[a];i[c.value]=c.name,o[c.name]=c.value}const s=A(e.valueType,an.UINT16);this._values=n,this._namesByValue=i,this._valuesByName=o,this._valueType=s,this._id=t,this._name=e.name,this._description=e.description,this._extras=St(e.extras,!0),this._extensions=St(e.extensions,!0)}e1.fromJson=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.id,n=e.enum;E.typeOf.string("options.id",t),E.typeOf.object("options.enum",n);const i=n.values.map(function(o){return ZI.fromJson(o)});return new e1({id:t,values:i,valueType:an[n.valueType],name:n.name,description:n.description,extras:n.extras,extensions:n.extensions})};Object.defineProperties(e1.prototype,{values:{get:function(){return this._values}},namesByValue:{get:function(){return this._namesByValue}},valuesByName:{get:function(){return this._valuesByName}},valueType:{get:function(){return this._valueType}},id:{get:function(){return this._id}},name:{get:function(){return this._name}},description:{get:function(){return this._description}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}});function o_(e){e=A(e,A.EMPTY_OBJECT);const t=A(e.classes,{}),n=A(e.enums,{});this._classes=t,this._enums=n,this._id=e.id,this._name=e.name,this._description=e.description,this._version=e.version,this._extras=St(e.extras,!0),this._extensions=St(e.extensions,!0)}o_.fromJson=function(e){E.typeOf.object("schema",e);const t={};if(l(e.enums))for(const i in e.enums)e.enums.hasOwnProperty(i)&&(t[i]=e1.fromJson({id:i,enum:e.enums[i]}));const n={};if(l(e.classes))for(const i in e.classes)e.classes.hasOwnProperty(i)&&(n[i]=i_.fromJson({id:i,class:e.classes[i],enums:t}));return new o_({id:e.id,name:e.name,description:e.description,version:e.version,classes:n,enums:t,extras:e.extras,extensions:e.extensions})};Object.defineProperties(o_.prototype,{classes:{get:function(){return this._classes}},enums:{get:function(){return this._enums}},id:{get:function(){return this._id}},name:{get:function(){return this._name}},description:{get:function(){return this._description}},version:{get:function(){return this._version}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}});function Hm(e){e=A(e,A.EMPTY_OBJECT);const t=e.schema,n=e.resource,i=e.cacheKey;if(l(t)===l(n))throw new w("One of options.schema and options.resource must be defined.");this._schema=l(t)?o_.fromJson(t):void 0,this._resource=n,this._cacheKey=i,this._state=Qt.UNLOADED,this._promise=void 0}l(Object.create)&&(Hm.prototype=Object.create(jr.prototype),Hm.prototype.constructor=Hm);Object.defineProperties(Hm.prototype,{promise:{get:function(){return this._promise}},cacheKey:{get:function(){return this._cacheKey}},schema:{get:function(){return this._schema}}});Hm.prototype.load=function(){return l(this._schema)?this._promise=Promise.resolve(this):this._promise=ZKe(this),this._promise};function ZKe(e){const t=e._resource;return e._state=Qt.LOADING,t.fetchJson().then(function(n){if(!e.isDestroyed())return e._schema=o_.fromJson(n),e._state=Qt.READY,e}).catch(function(n){if(e.isDestroyed())return;e._state=Qt.FAILED;const i=`Failed to load schema: ${t.url}`;return Promise.reject(e.getError(i,n))})}Hm.prototype.unload=function(){this._schema=void 0};const Pf={};function Nx(e){return hx(e.url)}function SP(e){let t=e.byteOffset,n=e.byteLength;if(Wr(e,"EXT_meshopt_compression")){const i=e.extensions.EXT_meshopt_compression;t=A(i.byteOffset,0),n=i.byteLength}return`${t}-${t+n}`}function eJe(e,t){const n=t.byteOffset+e.byteOffset,i=e.componentType,o=e.type,r=e.count;return`${n}-${i}-${o}-${r}`}function Qte(e){return Nx(e)}function Zte(e,t){return`${Nx(e)}-buffer-id-${t}`}function Mx(e,t,n,i){if(l(e.uri)){const o=i.getDerivedResource({url:e.uri});return Qte(o)}return Zte(n,t)}function _U(e,t,n,i){const o=t.bufferView,r=e.bufferViews[o],s=r.buffer,a=e.buffers[s],c=Mx(a,s,n,i),u=SP(r);return`${c}-range-${u}`}function ene(e,t,n,i){const o=e.images[t],r=o.bufferView,s=o.uri;if(l(s)){const _=i.getDerivedResource({url:s});return Nx(_)}const a=e.bufferViews[r],c=a.buffer,u=e.buffers[c],f=Mx(u,c,n,i),h=SP(a);return`${f}-range-${h}`}function tJe(e,t){const n=ly.createSampler({gltf:e,textureInfo:t});return`${n.wrapS}-${n.wrapT}-${n.minificationFilter}-${n.magnificationFilter}`}Pf.getSchemaCacheKey=function(e){const t=e.schema,n=e.resource;if(l(t)===l(n))throw new w("One of options.schema and options.resource must be defined.");return l(t)?`embedded-schema:${JSON.stringify(t)}`:`external-schema:${Nx(n)}`};Pf.getExternalBufferCacheKey=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.resource;return E.typeOf.object("options.resource",t),`external-buffer:${Qte(t)}`};Pf.getEmbeddedBufferCacheKey=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.parentResource,n=e.bufferId;return E.typeOf.object("options.parentResource",t),E.typeOf.number("options.bufferId",n),`embedded-buffer:${Zte(t,n)}`};Pf.getGltfCacheKey=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.gltfResource;return E.typeOf.object("options.gltfResource",t),`gltf:${Nx(t)}`};Pf.getBufferViewCacheKey=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.gltf,n=e.bufferViewId,i=e.gltfResource,o=e.baseResource;E.typeOf.object("options.gltf",t),E.typeOf.number("options.bufferViewId",n),E.typeOf.object("options.gltfResource",i),E.typeOf.object("options.baseResource",o);const r=t.bufferViews[n];let s=r.buffer;const a=t.buffers[s];Wr(r,"EXT_meshopt_compression")&&(s=r.extensions.EXT_meshopt_compression.buffer);const c=Mx(a,s,i,o),u=SP(r);return`buffer-view:${c}-range-${u}`};Pf.getDracoCacheKey=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.gltf,n=e.draco,i=e.gltfResource,o=e.baseResource;return E.typeOf.object("options.gltf",t),E.typeOf.object("options.draco",n),E.typeOf.object("options.gltfResource",i),E.typeOf.object("options.baseResource",o),`draco:${_U(t,n,i,o)}`};Pf.getVertexBufferCacheKey=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.gltf,n=e.gltfResource,i=e.baseResource,o=e.frameState,r=e.bufferViewId,s=e.draco,a=e.attributeSemantic,c=A(e.dequantize,!1),u=A(e.loadBuffer,!1),f=A(e.loadTypedArray,!1);E.typeOf.object("options.gltf",t),E.typeOf.object("options.gltfResource",n),E.typeOf.object("options.baseResource",i),E.typeOf.object("options.frameState",o);const h=l(r),_=nJe(s,a),g=l(a);if(h===_)throw new w("One of options.bufferViewId and options.draco must be defined.");if(_&&!g)throw new w("When options.draco is defined options.attributeSemantic must also be defined.");if(_&&(E.typeOf.object("options.draco",s),E.typeOf.string("options.attributeSemantic",a)),!u&&!f)throw new w("At least one of loadBuffer and loadTypedArray must be true.");let p="";if(c&&(p+="-dequantize"),u&&(p+="-buffer",p+=`-context-${o.context.id}`),f&&(p+="-typed-array"),l(s))return`vertex-buffer:${_U(t,s,n,i)}-draco-${a}${p}`;const y=t.bufferViews[r],T=y.buffer,b=t.buffers[T],x=Mx(b,T,n,i),v=SP(y);return`vertex-buffer:${x}-range-${v}${p}`};function nJe(e,t){return l(e)&&l(e.attributes)&&l(e.attributes[t])}Pf.getIndexBufferCacheKey=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.gltf,n=e.accessorId,i=e.gltfResource,o=e.baseResource,r=e.frameState,s=e.draco,a=A(e.loadBuffer,!1),c=A(e.loadTypedArray,!1);if(E.typeOf.object("options.gltf",t),E.typeOf.number("options.accessorId",n),E.typeOf.object("options.gltfResource",i),E.typeOf.object("options.baseResource",o),E.typeOf.object("options.frameState",r),!a&&!c)throw new w("At least one of loadBuffer and loadTypedArray must be true.");let u="";if(a&&(u+="-buffer",u+=`-context-${r.context.id}`),c&&(u+="-typed-array"),l(s))return`index-buffer:${_U(t,s,i,o)}-draco${u}`;const f=t.accessors[n],h=f.bufferView,_=t.bufferViews[h],g=_.buffer,p=t.buffers[g],y=Mx(p,g,i,o),T=eJe(f,_);return`index-buffer:${y}-accessor-${T}${u}`};Pf.getImageCacheKey=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.gltf,n=e.imageId,i=e.gltfResource,o=e.baseResource;return E.typeOf.object("options.gltf",t),E.typeOf.number("options.imageId",n),E.typeOf.object("options.gltfResource",i),E.typeOf.object("options.baseResource",o),`image:${ene(t,n,i,o)}`};Pf.getTextureCacheKey=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.gltf,n=e.textureInfo,i=e.gltfResource,o=e.baseResource,r=e.supportedImageFormats,s=e.frameState;E.typeOf.object("options.gltf",t),E.typeOf.object("options.textureInfo",n),E.typeOf.object("options.gltfResource",i),E.typeOf.object("options.baseResource",o),E.typeOf.object("options.supportedImageFormats",r),E.typeOf.object("options.frameState",s);const a=n.index,c=ly.getImageIdFromTexture({gltf:t,textureId:a,supportedImageFormats:r}),u=ene(t,c,i,o),f=tJe(t,n);return`texture:${u}-sampler-${f}-context-${s.context.id}`};const Wd=Pf;function Fx(){this.geometryByteLength=0,this.texturesByteLength=0,this._geometrySizes={},this._textureSizes={}}Fx.prototype.clear=function(){this.geometryByteLength=0,this.texturesByteLength=0,this._geometrySizes={},this._textureSizes={}};Fx.prototype.addGeometryLoader=function(e){E.typeOf.object("loader",e);const t=e.cacheKey;if(this._geometrySizes.hasOwnProperty(t))return;this._geometrySizes[t]=0;const n=this;return e.promise.then(function(i){if(!n._geometrySizes.hasOwnProperty(t))return;const o=i.buffer,r=i.typedArray;let s=0;l(o)&&(s+=o.sizeInBytes),l(r)&&(s+=r.byteLength),n.geometryByteLength+=s,n._geometrySizes[t]=s}).catch(function(){delete n._geometrySizes[t]})};Fx.prototype.addTextureLoader=function(e){E.typeOf.object("loader",e);const t=e.cacheKey;if(this._textureSizes.hasOwnProperty(t))return;this._textureSizes[t]=0;const n=this;return e.promise.then(function(i){if(!n._textureSizes.hasOwnProperty(t))return;const o=i.texture.sizeInBytes;n.texturesByteLength+=i.texture.sizeInBytes,n._textureSizes[t]=o}).catch(function(){delete n._textureSizes[t]})};Fx.prototype.removeLoader=function(e){E.typeOf.object("loader",e);const t=e.cacheKey,n=this._geometrySizes[t];delete this._geometrySizes[t],l(n)&&(this.geometryByteLength-=n);const i=this._textureSizes[t];delete this._textureSizes[t],l(i)&&(this.texturesByteLength-=i)};function Bt(){}Bt.cacheEntries={};Bt.statistics=new Fx;function iJe(e){this.referenceCount=1,this.resourceLoader=e,this._statisticsPromise=void 0}Bt.get=function(e){E.typeOf.string("cacheKey",e);const t=Bt.cacheEntries[e];if(l(t))return++t.referenceCount,t.resourceLoader};Bt.load=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.resourceLoader;E.typeOf.object("options.resourceLoader",t);const n=t.cacheKey;if(E.typeOf.string("options.resourceLoader.cacheKey",n),l(Bt.cacheEntries[n]))throw new w(`Resource with this cacheKey is already in the cache: ${n}`);Bt.cacheEntries[n]=new iJe(t),t.load()};Bt.unload=function(e){E.typeOf.object("resourceLoader",e);const t=e.cacheKey,n=Bt.cacheEntries[t];if(!l(n))throw new w(`Resource is not in the cache: ${t}`);--n.referenceCount,n.referenceCount===0&&(Bt.statistics.removeLoader(e),e.destroy(),delete Bt.cacheEntries[t])};Bt.loadSchema=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.schema,n=e.resource;if(l(t)===l(n))throw new w("One of options.schema and options.resource must be defined.");const i=Wd.getSchemaCacheKey({schema:t,resource:n});let o=Bt.get(i);return l(o)||(o=new Hm({schema:t,resource:n,cacheKey:i}),Bt.load({resourceLoader:o})),o};Bt.loadEmbeddedBuffer=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.parentResource,n=e.bufferId,i=e.typedArray;E.typeOf.object("options.parentResource",t),E.typeOf.number("options.bufferId",n);const o=Wd.getEmbeddedBufferCacheKey({parentResource:t,bufferId:n});let r=Bt.get(o);return l(r)||(E.typeOf.object("options.typedArray",i),r=new sf({typedArray:i,cacheKey:o}),Bt.load({resourceLoader:r})),r};Bt.loadExternalBuffer=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.resource;E.typeOf.object("options.resource",t);const n=Wd.getExternalBufferCacheKey({resource:t});let i=Bt.get(n);return l(i)||(i=new sf({resource:t,cacheKey:n}),Bt.load({resourceLoader:i})),i};Bt.loadGltfJson=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.gltfResource,n=e.baseResource,i=e.typedArray,o=e.gltfJson;E.typeOf.object("options.gltfResource",t),E.typeOf.object("options.baseResource",n);const r=Wd.getGltfCacheKey({gltfResource:t});let s=Bt.get(r);return l(s)||(s=new Vh({resourceCache:Bt,gltfResource:t,baseResource:n,typedArray:i,gltfJson:o,cacheKey:r}),Bt.load({resourceLoader:s})),s};Bt.loadBufferView=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.gltf,n=e.bufferViewId,i=e.gltfResource,o=e.baseResource;E.typeOf.object("options.gltf",t),E.typeOf.number("options.bufferViewId",n),E.typeOf.object("options.gltfResource",i),E.typeOf.object("options.baseResource",o);const r=Wd.getBufferViewCacheKey({gltf:t,bufferViewId:n,gltfResource:i,baseResource:o});let s=Bt.get(r);return l(s)||(s=new zh({resourceCache:Bt,gltf:t,bufferViewId:n,gltfResource:i,baseResource:o,cacheKey:r}),Bt.load({resourceLoader:s})),s};Bt.loadDraco=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.gltf,n=e.draco,i=e.gltfResource,o=e.baseResource;E.typeOf.object("options.gltf",t),E.typeOf.object("options.draco",n),E.typeOf.object("options.gltfResource",i),E.typeOf.object("options.baseResource",o);const r=Wd.getDracoCacheKey({gltf:t,draco:n,gltfResource:i,baseResource:o});let s=Bt.get(r);return l(s)||(s=new Uh({resourceCache:Bt,gltf:t,draco:n,gltfResource:i,baseResource:o,cacheKey:r}),Bt.load({resourceLoader:s})),s};Bt.loadVertexBuffer=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.gltf,n=e.gltfResource,i=e.baseResource,o=e.frameState,r=e.bufferViewId,s=e.draco,a=e.attributeSemantic,c=e.accessorId,u=A(e.asynchronous,!0),f=A(e.dequantize,!1),h=A(e.loadBuffer,!1),_=A(e.loadTypedArray,!1);if(E.typeOf.object("options.gltf",t),E.typeOf.object("options.gltfResource",n),E.typeOf.object("options.baseResource",i),E.typeOf.object("options.frameState",o),!h&&!_)throw new w("At least one of loadBuffer and loadTypedArray must be true.");const g=l(r),p=oJe(s,a),y=l(a),T=l(c);if(g===p)throw new w("One of options.bufferViewId and options.draco must be defined.");if(p&&!y)throw new w("When options.draco is defined options.attributeSemantic must also be defined.");if(p&&!T)throw new w("When options.draco is defined options.haAccessorId must also be defined.");p&&(E.typeOf.object("options.draco",s),E.typeOf.string("options.attributeSemantic",a),E.typeOf.number("options.accessorId",c));const b=Wd.getVertexBufferCacheKey({gltf:t,gltfResource:n,baseResource:i,frameState:o,bufferViewId:r,draco:s,attributeSemantic:a,dequantize:f,loadBuffer:h,loadTypedArray:_});let x=Bt.get(b);if(l(x))return x;x=new Gh({resourceCache:Bt,gltf:t,gltfResource:n,baseResource:i,bufferViewId:r,draco:s,attributeSemantic:a,accessorId:c,cacheKey:b,asynchronous:u,dequantize:f,loadBuffer:h,loadTypedArray:_}),Bt.load({resourceLoader:x});const v=Bt.statistics.addGeometryLoader(x);return Bt.cacheEntries[b]._statisticsPromise=v,x};function oJe(e,t){return l(e)&&l(e.attributes)&&l(e.attributes[t])}Bt.loadIndexBuffer=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.gltf,n=e.accessorId,i=e.gltfResource,o=e.baseResource,r=e.frameState,s=e.draco,a=A(e.asynchronous,!0),c=A(e.loadBuffer,!1),u=A(e.loadTypedArray,!1);if(E.typeOf.object("options.gltf",t),E.typeOf.number("options.accessorId",n),E.typeOf.object("options.gltfResource",i),E.typeOf.object("options.baseResource",o),E.typeOf.object("options.frameState",r),!c&&!u)throw new w("At least one of loadBuffer and loadTypedArray must be true.");const f=Wd.getIndexBufferCacheKey({gltf:t,accessorId:n,gltfResource:i,baseResource:o,frameState:r,draco:s,loadBuffer:c,loadTypedArray:u});let h=Bt.get(f);if(l(h))return h;h=new Hh({resourceCache:Bt,gltf:t,accessorId:n,gltfResource:i,baseResource:o,draco:s,cacheKey:f,asynchronous:a,loadBuffer:c,loadTypedArray:u}),Bt.load({resourceLoader:h});const _=Bt.statistics.addGeometryLoader(h);return Bt.cacheEntries[f]._statisticsPromise=_,h};Bt.loadImage=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.gltf,n=e.imageId,i=e.gltfResource,o=e.baseResource;E.typeOf.object("options.gltf",t),E.typeOf.number("options.imageId",n),E.typeOf.object("options.gltfResource",i),E.typeOf.object("options.baseResource",o);const r=Wd.getImageCacheKey({gltf:t,imageId:n,gltfResource:i,baseResource:o});let s=Bt.get(r);return l(s)||(s=new hd({resourceCache:Bt,gltf:t,imageId:n,gltfResource:i,baseResource:o,cacheKey:r}),Bt.load({resourceLoader:s})),s};Bt.loadTexture=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.gltf,n=e.textureInfo,i=e.gltfResource,o=e.baseResource,r=e.supportedImageFormats,s=e.frameState,a=A(e.asynchronous,!0);E.typeOf.object("options.gltf",t),E.typeOf.object("options.textureInfo",n),E.typeOf.object("options.gltfResource",i),E.typeOf.object("options.baseResource",o),E.typeOf.object("options.supportedImageFormats",r),E.typeOf.object("options.frameState",s);const c=Wd.getTextureCacheKey({gltf:t,textureInfo:n,gltfResource:i,baseResource:o,supportedImageFormats:r,frameState:s});let u=Bt.get(c);if(l(u))return u;u=new kh({resourceCache:Bt,gltf:t,textureInfo:n,gltfResource:i,baseResource:o,supportedImageFormats:r,cacheKey:c,asynchronous:a}),Bt.load({resourceLoader:u});const f=Bt.statistics.addTextureLoader(u);return Bt.cacheEntries[c]._statisticsPromise=f,u};Bt.clearForSpecs=function(){const e=[Gh,Hh,Uh,kh,hd,zh,sf,Hm,Vh];let t;const n=Bt.cacheEntries,i=[];for(t in n)n.hasOwnProperty(t)&&i.push(n[t]);i.sort(function(r,s){const a=e.indexOf(r.resourceLoader.constructor),c=e.indexOf(s.resourceLoader.constructor);return a-c});const o=i.length;for(let r=0;r<o;++r){const s=i[r];t=s.resourceLoader.cacheKey,l(n[t])&&(s.resourceLoader.destroy(),delete n[t])}Bt.statistics.clear()};function ec(e,t,n,i,o){if(E.typeOf.object("resource",e),l(t)===l(n))throw new w("One of json and subtreeView must be defined.");E.typeOf.object("implicitTileset",i),E.typeOf.object("implicitCoordinates",o),this._resource=e,this._subtreeJson=void 0,this._bufferLoader=void 0,this._tileAvailability=void 0,this._contentAvailabilityBitstreams=[],this._childSubtreeAvailability=void 0,this._implicitCoordinates=o,this._subtreeLevels=i.subtreeLevels,this._subdivisionScheme=i.subdivisionScheme,this._branchingFactor=i.branchingFactor,this._metadata=void 0,this._tileMetadataTable=void 0,this._tilePropertyTableJson=void 0,this._contentMetadataTables=[],this._contentPropertyTableJsons=[],this._tileJumpBuffer=void 0,this._contentJumpBuffers=[],this._readyPromise=rJe(this,t,n,i)}Object.defineProperties(ec.prototype,{readyPromise:{get:function(){return this._readyPromise}},metadata:{get:function(){return this._metadata}},tileMetadataTable:{get:function(){return this._tileMetadataTable}},tilePropertyTableJson:{get:function(){return this._tilePropertyTableJson}},contentMetadataTables:{get:function(){return this._contentMetadataTables}},contentPropertyTableJsons:{get:function(){return this._contentPropertyTableJsons}},implicitCoordinates:{get:function(){return this._implicitCoordinates}}});ec.prototype.tileIsAvailableAtIndex=function(e){return this._tileAvailability.getBit(e)};ec.prototype.tileIsAvailableAtCoordinates=function(e){const t=this.getTileIndex(e);return this.tileIsAvailableAtIndex(t)};ec.prototype.contentIsAvailableAtIndex=function(e,t){if(t=A(t,0),t<0||t>=this._contentAvailabilityBitstreams.length)throw new w("contentIndex out of bounds.");return this._contentAvailabilityBitstreams[t].getBit(e)};ec.prototype.contentIsAvailableAtCoordinates=function(e,t){const n=this.getTileIndex(e);return this.contentIsAvailableAtIndex(n,t)};ec.prototype.childSubtreeIsAvailableAtIndex=function(e){return this._childSubtreeAvailability.getBit(e)};ec.prototype.childSubtreeIsAvailableAtCoordinates=function(e){const t=this.getChildSubtreeIndex(e);return this.childSubtreeIsAvailableAtIndex(t)};ec.prototype.getLevelOffset=function(e){const t=this._branchingFactor;return(Math.pow(t,e)-1)/(t-1)};ec.prototype.getParentMortonIndex=function(e){let t=2;return this._subdivisionScheme===us.OCTREE&&(t=3),e>>t};function rJe(e,t,n,i){let o;l(t)?o={json:t,binary:void 0}:o=sJe(n);const r=o.json;e._subtreeJson=r;let s;if(Wr(r,"3DTILES_metadata"))s=r.extensions["3DTILES_metadata"];else if(l(r.tileMetadata)){const p=r.tileMetadata;s=r.propertyTables[p]}const a=[];if(l(r.contentMetadata)){const p=r.contentMetadata.length;for(let y=0;y<p;y++){const T=r.contentMetadata[y];a.push(r.propertyTables[T])}}let c;const u=i.metadataSchema,f=r.subtreeMetadata;if(l(f)){const p=f.class,y=u.classes[p];c=new gp({subtreeMetadata:f,class:y})}e._metadata=c,e._tilePropertyTableJson=s,e._contentPropertyTableJsons=a;const h={constant:0};r.contentAvailabilityHeaders=[],Wr(r,"3DTILES_multiple_contents")?r.contentAvailabilityHeaders=r.extensions["3DTILES_multiple_contents"].contentAvailability:Array.isArray(r.contentAvailability)?r.contentAvailabilityHeaders=r.contentAvailability:r.contentAvailabilityHeaders.push(A(r.contentAvailability,h));const _=aJe(r.buffers),g=cJe(r.bufferViews,_);lJe(r,g),l(s)&&eq(s,g);for(let p=0;p<a.length;p++){const y=a[p];eq(y,g)}return uJe(e,_,o.binary).then(function(p){const y=dJe(g,p);return hJe(e,r,i,y),l(s)&&(pJe(e,i,y),_Je(e)),mJe(e,i,y),gJe(e),e})}function sJe(e){const n=new DataView(e.buffer,e.byteOffset);let i=8;const o=n.getUint32(i,!0);i+=8;const r=n.getUint32(i,!0);i+=8;const s=zc(e,i,o);i+=o;const a=e.subarray(i,i+r);return{json:s,binary:a}}function aJe(e){e=l(e)?e:[];for(let t=0;t<e.length;t++){const n=e[t];n.isExternal=l(n.uri),n.isActive=!1}return e}function cJe(e,t){e=l(e)?e:[];for(let n=0;n<e.length;n++){const i=e[n],o=t[i.buffer];i.bufferHeader=o,i.isActive=!1}return e}function lJe(e,t){let n;const i=e.tileAvailability;l(i.bitstream)?n=t[i.bitstream]:l(i.bufferView)&&(n=t[i.bufferView]),l(n)&&(n.isActive=!0,n.bufferHeader.isActive=!0);const o=e.contentAvailabilityHeaders;for(let s=0;s<o.length;s++)n=void 0,l(o[s].bitstream)?n=t[o[s].bitstream]:l(o[s].bufferView)&&(n=t[o[s].bufferView]),l(n)&&(n.isActive=!0,n.bufferHeader.isActive=!0);n=void 0;const r=e.childSubtreeAvailability;l(r.bitstream)?n=t[r.bitstream]:l(r.bufferView)&&(n=t[r.bufferView]),l(n)&&(n.isActive=!0,n.bufferHeader.isActive=!0)}function eq(e,t){const n=e.properties;let i;for(const o in n)if(n.hasOwnProperty(o)){const r=n[o],s=A(r.values,r.bufferView);i=t[s],i.isActive=!0,i.bufferHeader.isActive=!0;const a=A(r.stringOffsets,r.stringOffsetBufferView);l(a)&&(i=t[a],i.isActive=!0,i.bufferHeader.isActive=!0);const c=A(r.arrayOffsets,r.arrayOffsetBufferView);l(c)&&(i=t[c],i.isActive=!0,i.bufferHeader.isActive=!0)}}function uJe(e,t,n){const i=[];for(let o=0;o<t.length;o++){const r=t[o];if(!r.isActive)i.push(Promise.resolve(void 0));else if(r.isExternal){const s=fJe(e,r);i.push(s)}else i.push(Promise.resolve(n))}return Promise.all(i).then(function(o){const r={};for(let s=0;s<o.length;s++){const a=o[s];l(a)&&(r[s]=a)}return r})}function fJe(e,t){const i=e._resource.getDerivedResource({url:t.uri}),o=Bt.loadExternalBuffer({resource:i});return e._bufferLoader=o,o.promise.then(function(r){return r.typedArray})}function dJe(e,t){const n={};for(let i=0;i<e.length;i++){const o=e[i];if(!o.isActive)continue;const r=o.byteOffset,s=r+o.byteLength,c=t[o.buffer].subarray(r,s);n[i]=c}return n}function hJe(e,t,n,i){const o=n.branchingFactor,r=n.subtreeLevels,s=(Math.pow(o,r)-1)/(o-1),a=Math.pow(o,r),c=Wr(t,"3DTILES_metadata"),u=l(e._tilePropertyTableJson);let f=c||u;e._tileAvailability=OR(t.tileAvailability,i,s,f);const h=e._contentPropertyTableJsons.length>0;f=f||h;for(let _=0;_<t.contentAvailabilityHeaders.length;_++){const g=OR(t.contentAvailabilityHeaders[_],i,s,f);e._contentAvailabilityBitstreams.push(g)}e._childSubtreeAvailability=OR(t.childSubtreeAvailability,i,a)}function OR(e,t,n,i){if(l(e.constant))return new KI({constant:Boolean(e.constant),lengthBits:n,availableCount:e.availableCount});let o;return l(e.bitstream)?o=t[e.bitstream]:l(e.bufferView)&&(o=t[e.bufferView]),new KI({bitstream:o,lengthBits:n,availableCount:e.availableCount,computeAvailableCountEnabled:i})}function pJe(e,t,n){const i=e._tilePropertyTableJson,o=e._tileAvailability.availableCount,r=t.metadataSchema,s=i.class,a=r.classes[s];e._tileMetadataTable=new bc({class:a,count:o,properties:i.properties,bufferViews:n})}function mJe(e,t,n){const i=e._contentPropertyTableJsons,o=e._contentAvailabilityBitstreams,r=t.metadataSchema,s=e._contentMetadataTables;for(let a=0;a<i.length;a++){const c=i[a],f=o[a].availableCount,h=c.class,_=r.classes[h],g=new bc({class:_,count:f,properties:c.properties,bufferViews:n});s.push(g)}}function tne(e){let t=0;const n=e.lengthBits,i=e.availableCount;let o;i<256?o=new Uint8Array(n):i<65536?o=new Uint16Array(n):o=new Uint32Array(n);for(let r=0;r<e.lengthBits;r++)e.getBit(r)&&(o[r]=t,t++);return o}function _Je(e){const t=tne(e._tileAvailability);e._tileJumpBuffer=t}function gJe(e){const t=e._contentJumpBuffers,n=e._contentAvailabilityBitstreams;for(let i=0;i<n.length;i++){const o=n[i],r=tne(o);t.push(r)}}ec.prototype.getTileIndex=function(e){const t=e.level-this._implicitCoordinates.level;if(t<0||this._subtreeLevels<=t)throw new Fe("level is out of bounds for this subtree");return e.getSubtreeCoordinates().getOffsetCoordinates(e).tileIndex};ec.prototype.getChildSubtreeIndex=function(e){if(e.level-this._implicitCoordinates.level!==this._implicitCoordinates.subtreeLevels)throw new Fe("level is out of bounds for this subtree");return e.getParentSubtreeCoordinates().getOffsetCoordinates(e).mortonIndex};function yJe(e,t){if(!l(e._tileMetadataTable))return;const n=e.getTileIndex(t);if(e._tileAvailability.getBit(n))return e._tileJumpBuffer[n]}function AJe(e,t,n){const i=e._contentMetadataTables;if(!l(i))return;const o=i[n];if(!l(o))return;const r=e._contentAvailabilityBitstreams[n],s=e.getTileIndex(t);if(r.getBit(s))return e._contentJumpBuffers[n][s]}ec.prototype.getTileMetadataView=function(e){const t=yJe(this,e);if(!l(t))return;const n=this._tileMetadataTable;return new Vd({class:n.class,metadataTable:n,entityId:t,propertyTableJson:this._tilePropertyTableJson})};ec.prototype.getContentMetadataView=function(e,t){const n=AJe(this,e,t);if(!l(n))return;const i=this._contentMetadataTables[t],o=this._contentPropertyTableJsons[t];return new Vd({class:i.class,metadataTable:i,entityId:n,contentIndex:t,propertyTableJson:o})};ec.prototype.isDestroyed=function(){return!1};ec.prototype.destroy=function(){return l(this._bufferLoader)&&Bt.unload(this._bufferLoader),Je(this)};const TJe={ID:"ID",NAME:"NAME",DESCRIPTION:"DESCRIPTION",TILE_BOUNDING_BOX:"TILE_BOUNDING_BOX",TILE_BOUNDING_REGION:"TILE_BOUNDING_REGION",TILE_BOUNDING_SPHERE:"TILE_BOUNDING_SPHERE",TILE_MINIMUM_HEIGHT:"TILE_MINIMUM_HEIGHT",TILE_MAXIMUM_HEIGHT:"TILE_MAXIMUM_HEIGHT",TILE_HORIZON_OCCLUSION_POINT:"TILE_HORIZON_OCCLUSION_POINT",TILE_GEOMETRIC_ERROR:"TILE_GEOMETRIC_ERROR",CONTENT_BOUNDING_BOX:"CONTENT_BOUNDING_BOX",CONTENT_BOUNDING_REGION:"CONTENT_BOUNDING_REGION",CONTENT_BOUNDING_SPHERE:"CONTENT_BOUNDING_SPHERE",CONTENT_MINIMUM_HEIGHT:"CONTENT_MINIMUM_HEIGHT",CONTENT_MAXIMUM_HEIGHT:"CONTENT_MAXIMUM_HEIGHT",CONTENT_HORIZON_OCCLUSION_POINT:"CONTENT_HORIZON_OCCLUSION_POINT"},CJe=Object.freeze(TJe);function bJe(e){return E.typeOf.object("tileMetadata",e),{tile:{boundingVolume:tq("TILE",e),minimumHeight:nq("TILE",e),maximumHeight:iq("TILE",e)},content:{boundingVolume:tq("CONTENT",e),minimumHeight:nq("CONTENT",e),maximumHeight:iq("CONTENT",e)}}}function tq(e,t){const n=`${e}_BOUNDING_BOX`,i=t.getPropertyBySemantic(n);if(l(i))return{box:i};const o=`${e}_BOUNDING_REGION`,r=t.getPropertyBySemantic(o);if(l(r))return{region:r};const s=`${e}_BOUNDING_SPHERE`,a=t.getPropertyBySemantic(s);if(l(a))return{sphere:a}}function nq(e,t){const n=`${e}_MINIMUM_HEIGHT`;return t.getPropertyBySemantic(n)}function iq(e,t){const n=`${e}_MAXIMUM_HEIGHT`;return t.getPropertyBySemantic(n)}function Al(e,t,n,i,o,r){if(E.defined("tile.implicitTileset",t.implicitTileset),E.defined("tile.implicitCoordinates",t.implicitCoordinates),l(i)===l(o))throw new w("One of json and arrayBuffer must be defined.");const s=t.implicitTileset,a=t.implicitCoordinates;this._implicitTileset=s,this._implicitCoordinates=a,this._implicitSubtree=void 0,this._tileset=e,this._tile=t,this._resource=n,this._metadata=void 0,this.featurePropertiesDirty=!1,this._group=void 0;const c=a.getTemplateValues(),u=s.subtreeUriTemplate.getDerivedResource({templateValues:c});this._url=u.getUrlComponent(!0),this._readyPromise=EJe(this,i,o,r)}Object.defineProperties(Al.prototype,{featuresLength:{get:function(){return 0}},pointsLength:{get:function(){return 0}},trianglesLength:{get:function(){return 0}},geometryByteLength:{get:function(){return 0}},texturesByteLength:{get:function(){return 0}},batchTableByteLength:{get:function(){return 0}},innerContents:{get:function(){}},readyPromise:{get:function(){return this._readyPromise}},tileset:{get:function(){return this._tileset}},tile:{get:function(){return this._tile}},url:{get:function(){return this._url}},metadata:{get:function(){},set:function(){throw new w("Implicit3DTileContent cannot have metadata")}},batchTable:{get:function(){}},group:{get:function(){return this._group},set:function(e){this._group=e}}});function EJe(e,t,n,i){i=A(i,0);let o;l(n)&&(o=new Uint8Array(n,i));const r=new ec(e._resource,t,o,e._implicitTileset,e._implicitCoordinates);return e._implicitSubtree=r,r.readyPromise.then(function(){return xJe(e,r),e})}function xJe(e,t){const n=e._tile,i=e._implicitCoordinates.childIndex,o=SJe(e,t,n,i),r=e._tileset.statistics;n.children.push(o.rootTile),r.numberOfTilesTotal++;const s=wJe(e,t,o.bottomRow);for(let a=0;a<s.length;a++){const c=s[a],u=c.tile,f=NJe(e,u,c.childIndex);u.children.push(f),r.numberOfTilesTotal++}}function wJe(e,t,n){const i=[],o=e._implicitTileset.branchingFactor;for(let r=0;r<n.length;r++){const s=n[r];if(l(s))for(let a=0;a<o;a++){const c=r*o+a;t.childSubtreeIsAvailableAtIndex(c)&&i.push({tile:s,childIndex:a})}}return i}function SJe(e,t,n,i){const s=oq(e,t,n,i,0,!0),a=e._tileset.statistics;let c=[s],u=[];const f=e._implicitTileset;for(let h=1;h<f.subtreeLevels;h++){const _=t.getLevelOffset(h),g=f.branchingFactor*c.length;for(let p=0;p<g;p++){const y=_+p;if(!t.tileIsAvailableAtIndex(y)){u.push(void 0);continue}const T=t.getParentMortonIndex(p),b=c[T],x=p%f.branchingFactor,v=oq(e,t,b,x,y);b.children.push(v),a.numberOfTilesTotal++,u.push(v)}c=u,u=[]}return{rootTile:s,bottomRow:c}}function nne(e,t,n){const i=CJe.TILE_GEOMETRIC_ERROR;return l(e)&&e.hasPropertyBySemantic(i)?e.getPropertyBySemantic(i):t.geometricError/Math.pow(2,n.level)}function oq(e,t,n,i,o,r){const s=e._implicitTileset;let a;A(r,!1)?a=n.implicitCoordinates:a=n.implicitCoordinates.getChildCoordinates(i);let c,u,f;if(l(t.tilePropertyTableJson)){c=t.getTileMetadataView(a);const B=bJe(c);u=B.tile,f=B.content}const _=t.contentPropertyTableJsons.length;let g=!1;for(let B=0;B<_;B++)if(t.contentIsAvailableAtCoordinates(a,B)){g=!0;break}const p=IJe(s,a,i,r,n,u),y=[];for(let B=0;B<s.contentCount;B++){if(!t.contentIsAvailableAtIndex(o,B))continue;const H={uri:s.contentUriTemplates[B].getDerivedResource({templateValues:a.getTemplateValues()}).url},G=PJe(p,f);l(G)&&(H.boundingVolume=G),y.push(Ln(H,s.contentHeaders[B]))}const T=nne(c,s,a),b={boundingVolume:p,geometricError:T,refine:s.refine,contents:y},x=!0,v=St(s.tileHeader,x);delete v.boundingVolume,delete v.transform;const D=Ln(b,v,x),L=ane(e,s.baseResource,D,n);return L.implicitCoordinates=a,L.implicitSubtree=t,L.metadata=c,L.hasImplicitContentMetadata=g,L}function t1(e,t){return l(e)&&l(t)&&(l(t.minimumHeight)||l(t.maximumHeight))&&(Wr(e,"3DTILES_bounding_volume_S2")||l(e.region))}function KF(e,t){l(t)&&(Wr(e,"3DTILES_bounding_volume_S2")?DJe(e.extensions["3DTILES_bounding_volume_S2"],t.minimumHeight,t.maximumHeight):l(e.region)&&vJe(e.region,t.minimumHeight,t.maximumHeight))}function vJe(e,t,n){l(t)&&(e[4]=t),l(n)&&(e[5]=n)}function DJe(e,t,n){l(t)&&(e.minimumHeight=t),l(n)&&(e.maximumHeight=n)}function IJe(e,t,n,i,o,r){let s;return!l(r)||!l(r.boundingVolume)||!t1(r.boundingVolume,r)&&t1(e.boundingVolume,r)?s=ine(e,t,n,A(i,!1),o):s=r.boundingVolume,KF(s,r),s}function PJe(e,t){let n;return l(t)&&(n=t.boundingVolume),t1(n,t)?KF(n,t):t1(e,t)&&(n=St(e,!0),KF(n,t)),n}function ine(e,t,n,i,o){const r=e.boundingVolume;return Wr(r,"3DTILES_bounding_volume_S2")?one(i,o,n,t.level,t.x,t.y,t.z):l(r.region)?{region:sne(r.region,t.level,t.x,t.y,t.z)}:{box:rne(r.box,t.level,t.x,t.y,t.z)}}function one(e,t,n,i,o,r,s){E.typeOf.bool("parentIsPlaceholderTile",e),E.typeOf.object("parentTile",t),E.typeOf.number("childIndex",n),E.typeOf.number("level",i),E.typeOf.number("x",o),E.typeOf.number("y",r),l(s)&&E.typeOf.number("z",s);const a=t._boundingVolume;if(e)return{extensions:{"3DTILES_bounding_volume_S2":{token:vo.getTokenFromId(a.s2Cell._cellId),minimumHeight:a.minimumHeight,maximumHeight:a.maximumHeight}}};const c=Number(t._boundingVolume.s2Cell._cellId>>BigInt(61)),u=c%2===0?W9.encode2D(i,o,r):W9.encode2D(i,r,o),f=vo.fromFacePositionLevel(c,BigInt(u),i);let h,_;if(l(s)){const g=(a.maximumHeight+a.minimumHeight)/2;h=n<4?a.minimumHeight:g,_=n<4?g:a.maximumHeight}else h=a.minimumHeight,_=a.maximumHeight;return{extensions:{"3DTILES_bounding_volume_S2":{token:vo.getTokenFromId(f._cellId),minimumHeight:h,maximumHeight:_}}}}const OJe=new d,LJe=new d,LR=new d,BJe=new te;function rne(e,t,n,i,o){if(E.typeOf.object("rootBox",e),E.typeOf.number("level",t),E.typeOf.number("x",n),E.typeOf.number("y",i),l(o)&&E.typeOf.number("z",o),t===0)return e;const r=d.unpack(e,0,LJe),s=te.unpack(e,3,BJe),a=Math.pow(2,-t),c=-1+(2*n+1)*a,u=-1+(2*i+1)*a;let f=0;const h=d.fromElements(a,a,1,OJe);l(o)&&(f=-1+(2*o+1)*a,h.z=a);let _=d.fromElements(c,u,f,LR);_=te.multiplyByVector(s,_,LR),_=d.add(_,r,LR);let g=te.clone(s);g=te.multiplyByScale(g,h,g);const p=new Array(12);return d.pack(_,p),te.pack(g,p,3),p}const RJe=new Ee;function sne(e,t,n,i,o){if(E.typeOf.object("rootRegion",e),E.typeOf.number("level",t),E.typeOf.number("x",n),E.typeOf.number("y",i),l(o)&&E.typeOf.number("z",o),t===0)return e.slice();const r=Ee.unpack(e,0,RJe),s=e[4],a=e[5],c=Math.pow(2,-t),u=c*r.width,f=F.negativePiToPi(r.west+n*u),h=F.negativePiToPi(f+u),_=c*r.height,g=F.negativePiToPi(r.south+i*_),p=F.negativePiToPi(g+_);let y=s,T=a;if(l(o)){const b=c*(a-s);y+=o*b,T=y+b}return[f,g,h,p,y,T]}function NJe(e,t,n){const i=e._implicitTileset,o=t.implicitCoordinates.getChildCoordinates(n),r=ine(i,o,n,!1,t),s=nne(void 0,i,o),a=i.subtreeUriTemplate.getDerivedResource({templateValues:o.getTemplateValues()}).url,c={boundingVolume:r,geometricError:s,refine:i.refine,contents:[{uri:a}]},u=ane(e,i.baseResource,c,t);return u.implicitTileset=i,u.implicitCoordinates=o,u}function ane(e,t,n,i){const o=e._tile.constructor;return new o(e._tileset,t,n,i)}Al.prototype.hasProperty=function(e,t){return!1};Al.prototype.getFeature=function(e){};Al.prototype.applyDebugSettings=function(e,t){};Al.prototype.applyStyle=function(e){};Al.prototype.update=function(e,t){};Al.prototype.isDestroyed=function(){return!1};Al.prototype.destroy=function(){return this._implicitSubtree=this._implicitSubtree&&this._implicitSubtree.destroy(),Je(this)};Al._deriveBoundingBox=rne;Al._deriveBoundingRegion=sne;Al._deriveBoundingVolumeS2=one;const MJe={NONE:0,REPEAT:1,MIRRORED_REPEAT:2},Dh=Object.freeze(MJe),Eb={HIGHLIGHT:0,REPLACE:1,MIX:2};Eb.getColorBlend=function(e,t){if(e===Eb.HIGHLIGHT)return 0;if(e===Eb.REPLACE)return 1;if(e===Eb.MIX)return F.clamp(t,F.EPSILON4,1)};const vP=Object.freeze(Eb),FJe={XTRANSLATE:"xTranslate",YTRANSLATE:"yTranslate",ZTRANSLATE:"zTranslate",XROTATE:"xRotate",YROTATE:"yRotate",ZROTATE:"zRotate",XSCALE:"xScale",YSCALE:"yScale",ZSCALE:"zScale",UNIFORMSCALE:"uniformScale"},Gu=Object.freeze(FJe),zJe={STEP:0,LINEAR:1,CUBICSPLINE:2},IA=Object.freeze(zJe),cne={};function Gy(e){E.typeOf.number.greaterThan("options.count",e.count,0),E.typeOf.object("options.properties",e.properties),this._count=e.count,this._properties=St(e.properties,!0)}Gy.prototype.hasProperty=function(e){return cn.hasProperty(e,this._properties,cne)};Gy.prototype.getPropertyIds=function(e){return cn.getPropertyIds(this._properties,cne,e)};Gy.prototype.getProperty=function(e,t){if(E.typeOf.number("index",e),E.typeOf.string("propertyId",t),e<0||e>=this._count)throw new w(`index must be in the range [0, ${this._count})`);const n=this._properties[t];if(l(n))return St(n[e],!0)};Gy.prototype.setProperty=function(e,t,n){if(E.typeOf.number("index",e),E.typeOf.string("propertyId",t),e<0||e>=this._count)throw new w(`index must be in the range [0, ${this._count})`);let i=this._properties[t];l(i)||(i=new Array(this._count),this._properties[t]=i),i[e]=St(n,!0)};function is(e){e=A(e,A.EMPTY_OBJECT),E.typeOf.number("options.count",e.count),this._name=e.name,this._id=e.id,this._count=e.count,this._extras=e.extras,this._extensions=e.extensions,this._metadataTable=e.metadataTable,this._jsonMetadataTable=e.jsonMetadataTable,this._batchTableHierarchy=e.batchTableHierarchy}Object.defineProperties(is.prototype,{name:{get:function(){return this._name}},id:{get:function(){return this._id}},count:{get:function(){return this._count}},class:{get:function(){if(l(this._metadataTable))return this._metadataTable.class}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}},byteLength:{get:function(){let e=0;return l(this._metadataTable)&&(e+=this._metadataTable.byteLength),l(this._batchTableHierarchy)&&(e+=this._batchTableHierarchy.byteLength),e}}});is.prototype.hasProperty=function(e,t){return E.typeOf.number("index",e),E.typeOf.string("propertyId",t),!!(l(this._metadataTable)&&this._metadataTable.hasProperty(t)||l(this._batchTableHierarchy)&&this._batchTableHierarchy.hasProperty(e,t)||l(this._jsonMetadataTable)&&this._jsonMetadataTable.hasProperty(t))};is.prototype.hasPropertyBySemantic=function(e,t){return E.typeOf.number("index",e),E.typeOf.string("semantic",t),l(this._metadataTable)?this._metadataTable.hasPropertyBySemantic(t):!1};is.prototype.propertyExists=function(e){return E.typeOf.string("propertyId",e),!!(l(this._metadataTable)&&this._metadataTable.hasProperty(e)||l(this._batchTableHierarchy)&&this._batchTableHierarchy.propertyExists(e)||l(this._jsonMetadataTable)&&this._jsonMetadataTable.hasProperty(e))};is.prototype.propertyExistsBySemantic=function(e){return E.typeOf.string("semantic",e),l(this._metadataTable)?this._metadataTable.hasPropertyBySemantic(e):!1};const BR=[];is.prototype.getPropertyIds=function(e,t){return t=l(t)?t:[],t.length=0,l(this._metadataTable)&&t.push.apply(t,this._metadataTable.getPropertyIds(BR)),l(this._batchTableHierarchy)&&t.push.apply(t,this._batchTableHierarchy.getPropertyIds(e,BR)),l(this._jsonMetadataTable)&&t.push.apply(t,this._jsonMetadataTable.getPropertyIds(BR)),t};is.prototype.getProperty=function(e,t){let n;if(l(this._metadataTable)&&(n=this._metadataTable.getProperty(e,t),l(n))||l(this._batchTableHierarchy)&&(n=this._batchTableHierarchy.getProperty(e,t),l(n))||l(this._jsonMetadataTable)&&(n=this._jsonMetadataTable.getProperty(e,t),l(n)))return n};is.prototype.setProperty=function(e,t,n){l(this._metadataTable)&&this._metadataTable.setProperty(e,t,n)||l(this._batchTableHierarchy)&&this._batchTableHierarchy.setProperty(e,t,n)||(l(this._jsonMetadataTable)||(this._jsonMetadataTable=new Gy({count:this._count,properties:{}})),this._jsonMetadataTable.setProperty(e,t,n))};is.prototype.getPropertyBySemantic=function(e,t){if(l(this._metadataTable))return this._metadataTable.getPropertyBySemantic(e,t)};is.prototype.setPropertyBySemantic=function(e,t,n){return l(this._metadataTable)?this._metadataTable.setPropertyBySemantic(e,t,n):!1};is.prototype.getPropertyTypedArray=function(e){if(E.typeOf.string("propertyId",e),l(this._metadataTable))return this._metadataTable.getPropertyTypedArray(e)};is.prototype.getPropertyTypedArrayBySemantic=function(e){if(E.typeOf.string("semantic",e),l(this._metadataTable))return this._metadataTable.getPropertyTypedArrayBySemantic(e)};function gU(e,t){if(!l(e)||e<0||e>=t)throw new w(`featureId is required and must be between zero and featuresLength - 1 (${t}`-+").")}is.prototype.isClass=function(e,t){gU(e,this.count),E.typeOf.string("className",t);const n=this._batchTableHierarchy;return l(n)?n.isClass(e,t):!1};is.prototype.isExactClass=function(e,t){return gU(e,this.count),E.typeOf.string("className",t),this.getExactClassName(e)===t};is.prototype.getExactClassName=function(e){gU(e,this.count);const t=this._batchTableHierarchy;if(l(t))return t.getClassName(e)};function zx(e){e=A(e,A.EMPTY_OBJECT);const t=e.property,n=e.classProperty,i=e.textures;E.typeOf.object("options.property",t),E.typeOf.object("options.classProperty",n),E.typeOf.object("options.textures",i);const o=l(t.channels)?t.channels:[0],r=t,s=ly.createModelTextureReader({textureInfo:r,channels:VJe(o),texture:i[r.index]});this._min=t.min,this._max=t.max;let a=t.offset,c=t.scale;const u=n.hasValueTransform||l(a)||l(c);a=A(a,n.offset),c=A(c,n.scale),a=n.unpackVectorAndMatrixTypes(a),c=n.unpackVectorAndMatrixTypes(c),this._offset=a,this._scale=c,this._hasValueTransform=u,this._textureReader=s,this._classProperty=n,this._extras=t.extras,this._extensions=t.extensions}Object.defineProperties(zx.prototype,{textureReader:{get:function(){return this._textureReader}},hasValueTransform:{get:function(){return this._hasValueTransform}},offset:{get:function(){return this._offset}},scale:{get:function(){return this._scale}},classProperty:{get:function(){return this._classProperty}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}});zx.prototype.isGpuCompatible=function(){const e=this._classProperty,t=e.type,n=e.componentType;return e.isArray?!e.isVariableLengthArray&&e.arrayLength<=4&&t===Xt.SCALAR&&n===an.UINT8:Xt.isVectorType(t)||t===Xt.SCALAR?n===an.UINT8:!1};const UJe=[void 0,"float","vec2","vec3","vec4"],HJe=[void 0,"int","ivec2","ivec3","ivec4"];zx.prototype.getGlslType=function(){const e=this._classProperty;let t=Xt.getComponentCount(e.type);return e.isArray&&(t=e.arrayLength),e.normalized?UJe[t]:HJe[t]};zx.prototype.unpackInShader=function(e){return this._classProperty.normalized?e:`${this.getGlslType()}(255.0 * ${e})`};function VJe(e){return e.map(function(t){return"rgba".charAt(t)}).join("")}function DP(e){e=A(e,A.EMPTY_OBJECT);const t=e.propertyTexture,n=e.class,i=e.textures;E.typeOf.object("options.propertyTexture",t),E.typeOf.object("options.class",n),E.typeOf.object("options.textures",i);const o=t.extensions,r=t.extras,s={};if(l(t.properties))for(const a in t.properties)t.properties.hasOwnProperty(a)&&(s[a]=new zx({property:t.properties[a],classProperty:n.properties[a],textures:i}));this._name=e.name,this._id=e.id,this._class=n,this._properties=s,this._extras=r,this._extensions=o}Object.defineProperties(DP.prototype,{name:{get:function(){return this._name}},id:{get:function(){return this._id}},class:{get:function(){return this._class}},properties:{get:function(){return this._properties}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}});DP.prototype.getProperty=function(e){return E.typeOf.string("propertyId",e),this._properties[e]};function lne(e){e=A(e,A.EMPTY_OBJECT);const t=e.property,n=e.classProperty;E.typeOf.object("options.property",t),E.typeOf.object("options.classProperty",n),this._attribute=t.attribute,this._classProperty=n,this._min=t.min,this._max=t.max;let i=t.offset,o=t.scale;const r=n.hasValueTransform||l(i)||l(o);i=A(i,n.offset),o=A(o,n.scale),i=n.unpackVectorAndMatrixTypes(i),o=n.unpackVectorAndMatrixTypes(o),this._offset=i,this._scale=o,this._hasValueTransform=r,this._extras=t.extras,this._extensions=t.extensions}Object.defineProperties(lne.prototype,{attribute:{get:function(){return this._attribute}},hasValueTransform:{get:function(){return this._hasValueTransform}},offset:{get:function(){return this._offset}},scale:{get:function(){return this._scale}},classProperty:{get:function(){return this._classProperty}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}});function IP(e){e=A(e,A.EMPTY_OBJECT);const t=e.propertyAttribute,n=e.class;E.typeOf.object("options.propertyAttribute",t),E.typeOf.object("options.class",n);const i={};if(l(t.properties))for(const o in t.properties)t.properties.hasOwnProperty(o)&&(i[o]=new lne({property:t.properties[o],classProperty:n.properties[o]}));this._name=e.name,this._id=e.id,this._class=n,this._properties=i,this._extras=t.extras,this._extensions=t.extensions}Object.defineProperties(IP.prototype,{name:{get:function(){return this._name}},id:{get:function(){return this._id}},class:{get:function(){return this._class}},properties:{get:function(){return this._properties}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}});IP.prototype.getProperty=function(e){return E.typeOf.string("propertyId",e),this._properties[e]};function Of(e){e=A(e,A.EMPTY_OBJECT),E.typeOf.object("options.schema",e.schema),this._schema=e.schema;const t=e.propertyTables;this._propertyTableCount=l(t)?t.length:0,this._propertyTables=t,this._propertyTextures=e.propertyTextures,this._propertyAttributes=e.propertyAttributes,this._statistics=e.statistics,this._extras=e.extras,this._extensions=e.extensions}Object.defineProperties(Of.prototype,{schema:{get:function(){return this._schema}},statistics:{get:function(){return this._statistics}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}},propertyTableCount:{get:function(){return this._propertyTableCount}},propertyTables:{get:function(){return this._propertyTables}},propertyTextures:{get:function(){return this._propertyTextures}},propertyAttributes:{get:function(){return this._propertyAttributes}},propertyTablesByteLength:{get:function(){if(!l(this._propertyTables))return 0;let e=0;const t=this._propertyTables.length;for(let n=0;n<t;n++)e+=this._propertyTables[n].byteLength;return e}}});Of.prototype.getPropertyTable=function(e){return E.typeOf.number("propertyTableId",e),this._propertyTables[e]};Of.prototype.getPropertyTexture=function(e){return E.typeOf.number("propertyTextureId",e),this._propertyTextures[e]};Of.prototype.getPropertyAttribute=function(e){return E.typeOf.number("propertyAttributeId",e),this._propertyAttributes[e]};function kJe(e){e=A(e,A.EMPTY_OBJECT);const t=e.extension,n=e.schema;E.typeOf.object("options.extension",t),E.typeOf.object("options.schema",n);const i=[];if(l(t.propertyTables))for(let s=0;s<t.propertyTables.length;s++){const a=t.propertyTables[s],c=n.classes[a.class],u=new bc({count:a.count,properties:a.properties,class:c,bufferViews:e.bufferViews});i.push(new is({id:s,name:a.name,count:a.count,metadataTable:u,extras:a.extras,extensions:a.extensions}))}const o=[];if(l(t.propertyTextures))for(let s=0;s<t.propertyTextures.length;s++){const a=t.propertyTextures[s];o.push(new DP({id:s,name:a.name,propertyTexture:a,class:n.classes[a.class],textures:e.textures}))}const r=[];if(l(t.propertyAttributes))for(let s=0;s<t.propertyAttributes.length;s++){const a=t.propertyAttributes[s];r.push(new IP({id:s,name:a.name,class:n.classes[a.class],propertyAttribute:a}))}return new Of({schema:n,propertyTables:i,propertyTextures:o,propertyAttributes:r,statistics:t.statistics,extras:t.extras,extensions:t.extensions})}function GJe(e){e=A(e,A.EMPTY_OBJECT);const t=e.extension,n=e.schema;E.typeOf.object("options.extension",t),E.typeOf.object("options.schema",n);let i;const o=[];let r;if(l(t.featureTables))for(r=Object.keys(t.featureTables).sort(),i=0;i<r.length;i++){const a=r[i],c=t.featureTables[a],u=n.classes[c.class],f=new bc({count:c.count,properties:c.properties,class:u,bufferViews:e.bufferViews});o.push(new is({id:a,count:c.count,metadataTable:f,extras:c.extras,extensions:c.extensions}))}const s=[];if(l(t.featureTextures))for(r=Object.keys(t.featureTextures).sort(),i=0;i<r.length;i++){const a=r[i],c=t.featureTextures[a];s.push(new DP({id:a,propertyTexture:WJe(c),class:n.classes[c.class],textures:e.textures}))}return new Of({schema:n,propertyTables:o,propertyTextures:s,statistics:t.statistics,extras:t.extras,extensions:t.extensions})}function WJe(e){const t={class:e.class,properties:{}},n=e.properties;for(const i in n)if(n.hasOwnProperty(i)){const o=n[i],r={channels:qJe(o.channels),extras:o.extras,extensions:o.extensions};t.properties[i]=Ln(o.texture,r,!0)}return t}function qJe(e){const t=e.length,n=new Array(t);for(let i=0;i<t;i++)n[i]="rgba".indexOf(e[i]);return n}function Vm(e){e=A(e,A.EMPTY_OBJECT);const t=e.gltf,n=e.extension,i=e.extensionLegacy,o=e.gltfResource,r=e.baseResource,s=e.supportedImageFormats,a=e.frameState,c=e.cacheKey,u=A(e.asynchronous,!0);if(E.typeOf.object("options.gltf",t),E.typeOf.object("options.gltfResource",o),E.typeOf.object("options.baseResource",r),E.typeOf.object("options.supportedImageFormats",s),E.typeOf.object("options.frameState",a),!l(e.extension)&&!l(e.extensionLegacy))throw new w("One of options.extension or options.extensionLegacy must be specified");this._gltfResource=o,this._baseResource=r,this._gltf=t,this._extension=n,this._extensionLegacy=i,this._supportedImageFormats=s,this._frameState=a,this._cacheKey=c,this._asynchronous=u,this._bufferViewLoaders=[],this._textureLoaders=[],this._schemaLoader=void 0,this._structuralMetadata=void 0,this._state=Qt.UNLOADED,this._promise=void 0}l(Object.create)&&(Vm.prototype=Object.create(jr.prototype),Vm.prototype.constructor=Vm);Object.defineProperties(Vm.prototype,{promise:{get:function(){return this._promise}},cacheKey:{get:function(){return this._cacheKey}},structuralMetadata:{get:function(){return this._structuralMetadata}}});Vm.prototype.load=function(){const e=KJe(this),t=tQe(this),n=nQe(this);this._gltf=void 0,this._state=Qt.LOADING;const i=this;this._promise=Promise.all([e,t,n]).then(function(o){if(i.isDestroyed())return;const r=o[0],s=o[1],a=o[2];return l(i._extension)?i._structuralMetadata=kJe({extension:i._extension,schema:a,bufferViews:r,textures:s}):i._structuralMetadata=GJe({extension:i._extensionLegacy,schema:a,bufferViews:r,textures:s}),i._state=Qt.READY,i}).catch(function(o){if(i.isDestroyed())return;i.unload(),i._state=Qt.FAILED;const r="Failed to load structural metadata";return Promise.reject(i.getError(r,o))})};function jJe(e,t){for(const n in e)if(e.hasOwnProperty(n)){const i=e[n],o=i.values,r=i.arrayOffsets,s=i.stringOffsets;l(o)&&(t[o]=!0),l(r)&&(t[r]=!0),l(s)&&(t[s]=!0)}}function YJe(e,t){for(const n in e)if(e.hasOwnProperty(n)){const i=e[n],o=i.bufferView,r=i.arrayOffsetBufferView,s=i.stringOffsetBufferView;l(o)&&(t[o]=!0),l(r)&&(t[r]=!0),l(s)&&(t[s]=!0)}}function $Je(e){const t=e.propertyTables,n={};if(l(t))for(let i=0;i<t.length;i++){const o=t[i];jJe(o.properties,n)}return n}function XJe(e){const t=e.featureTables,n={};if(l(t)){for(const i in t)if(t.hasOwnProperty(i)){const r=t[i].properties;l(r)&&YJe(r,n)}}return n}function KJe(e){let t;l(e._extension)?t=$Je(e._extension):t=XJe(e._extensionLegacy);const n=[],i={};for(const o in t)if(t.hasOwnProperty(o)){const r=Bt.loadBufferView({gltf:e._gltf,bufferViewId:parseInt(o),gltfResource:e._gltfResource,baseResource:e._baseResource});n.push(r.promise),e._bufferViewLoaders.push(r),i[o]=r}return Promise.all(n).then(function(){const o={};for(const r in i)if(i.hasOwnProperty(r)){const s=i[r],a=new Uint8Array(s.typedArray);o[r]=a}return une(e),o})}function JJe(e){const t={},n=e.propertyTextures;if(l(n))for(let i=0;i<n.length;i++){const r=n[i].properties;l(r)&&QJe(r,t)}return t}function QJe(e,t){for(const n in e)if(e.hasOwnProperty(n)){const i=e[n];t[i.index]=i}}function ZJe(e){const t={},n=e.featureTextures;if(l(n)){for(const i in n)if(n.hasOwnProperty(i)){const r=n[i].properties;l(r)&&eQe(r,t)}}return t}function eQe(e,t){for(const n in e)if(e.hasOwnProperty(n)){const o=e[n].texture;t[o.index]=o}}function tQe(e){let t;l(e._extension)?t=JJe(e._extension):t=ZJe(e._extensionLegacy);const n=e._gltf,i=e._gltfResource,o=e._baseResource,r=e._supportedImageFormats,s=e._frameState,a=e._asynchronous,c=[],u={};for(const f in t)if(t.hasOwnProperty(f)){const h=Bt.loadTexture({gltf:n,textureInfo:t[f],gltfResource:i,baseResource:o,supportedImageFormats:r,frameState:s,asynchronous:a});c.push(h.promise),e._textureLoaders.push(h),u[f]=h}return Promise.all(c).then(function(){const f={};for(const h in u)if(u.hasOwnProperty(h)){const _=u[h];f[h]=_.texture}return f})}function nQe(e){const t=A(e._extension,e._extensionLegacy);let n;if(l(t.schemaUri)){const i=e._baseResource.getDerivedResource({url:t.schemaUri});n=Bt.loadSchema({resource:i})}else n=Bt.loadSchema({schema:t.schema});return e._schemaLoader=n,n.promise.then(function(i){return i.schema})}Vm.prototype.process=function(e){if(E.typeOf.object("frameState",e),this._state!==Qt.LOADING)return;const t=this._textureLoaders,n=t.length;for(let i=0;i<n;++i)t[i].process(e)};function une(e){const t=e._bufferViewLoaders,n=t.length;for(let i=0;i<n;++i)Bt.unload(t[i]);e._bufferViewLoaders.length=0}function iQe(e){const t=e._textureLoaders,n=t.length;for(let i=0;i<n;++i)Bt.unload(t[i]);e._textureLoaders.length=0}Vm.prototype.unload=function(){une(this),iQe(this),l(this._schemaLoader)&&Bt.unload(this._schemaLoader),this._schemaLoader=void 0,this._structuralMetadata=void 0};const ni={POSITION:"POSITION",NORMAL:"NORMAL",TANGENT:"TANGENT",TEXCOORD:"TEXCOORD",COLOR:"COLOR",JOINTS:"JOINTS",WEIGHTS:"WEIGHTS",FEATURE_ID:"_FEATURE_ID"};function oQe(e){switch(e){case ni.POSITION:return"positionMC";case ni.NORMAL:return"normalMC";case ni.TANGENT:return"tangentMC";case ni.TEXCOORD:return"texCoord";case ni.COLOR:return"color";case ni.JOINTS:return"joints";case ni.WEIGHTS:return"weights";case ni.FEATURE_ID:return"featureId";default:throw new w("semantic is not a valid value.")}}ni.hasSetIndex=function(e){switch(E.typeOf.string("semantic",e),e){case ni.POSITION:case ni.NORMAL:case ni.TANGENT:return!1;case ni.TEXCOORD:case ni.COLOR:case ni.JOINTS:case ni.WEIGHTS:case ni.FEATURE_ID:return!0;default:throw new w("semantic is not a valid value.")}};ni.fromGltfSemantic=function(e){E.typeOf.string("gltfSemantic",e);let t=e;const i=/^(\w+)_\d+$/.exec(e);switch(i!==null&&(t=i[1]),t){case"POSITION":return ni.POSITION;case"NORMAL":return ni.NORMAL;case"TANGENT":return ni.TANGENT;case"TEXCOORD":return ni.TEXCOORD;case"COLOR":return ni.COLOR;case"JOINTS":return ni.JOINTS;case"WEIGHTS":return ni.WEIGHTS;case"_FEATURE_ID":return ni.FEATURE_ID}};ni.fromPntsSemantic=function(e){switch(E.typeOf.string("pntsSemantic",e),e){case"POSITION":case"POSITION_QUANTIZED":return ni.POSITION;case"RGBA":case"RGB":case"RGB565":return ni.COLOR;case"NORMAL":case"NORMAL_OCT16P":return ni.NORMAL;case"BATCH_ID":return ni.FEATURE_ID;default:throw new w("pntsSemantic is not a valid value.")}};ni.getGlslType=function(e){switch(E.typeOf.string("semantic",e),e){case ni.POSITION:case ni.NORMAL:case ni.TANGENT:return"vec3";case ni.TEXCOORD:return"vec2";case ni.COLOR:return"vec4";case ni.JOINTS:return"ivec4";case ni.WEIGHTS:return"vec4";case ni.FEATURE_ID:return"int";default:throw new w("semantic is not a valid value.")}};ni.getVariableName=function(e,t){E.typeOf.string("semantic",e);let n=oQe(e);return l(t)&&(n+=`_${t}`),n};const Ut=Object.freeze(ni);function gn(){}gn.getFailedLoadFunction=function(e,t,n){return function(i){let o=`Failed to load ${t}: ${n}`;l(i)&&(o+=`
|
||
${i.message}`);const r=new Fe(o);return l(i)&&(r.stack=`Original stack:
|
||
${i.stack}
|
||
Handler stack:
|
||
${r.stack}`),Promise.reject(r)}};gn.getNodeTransform=function(e){return l(e.matrix)?e.matrix:N.fromTranslationQuaternionRotationScale(l(e.translation)?e.translation:d.ZERO,l(e.rotation)?e.rotation:De.IDENTITY,l(e.scale)?e.scale:d.ONE)};gn.getAttributeBySemantic=function(e,t,n){const i=e.attributes,o=i.length;for(let r=0;r<o;++r){const s=i[r],a=l(n)?s.setIndex===n:!0;if(s.semantic===t&&a)return s}};gn.getAttributeByName=function(e,t){const n=e.attributes,i=n.length;for(let o=0;o<i;++o){const r=n[o];if(r.name===t)return r}};gn.getFeatureIdsByLabel=function(e,t){for(let n=0;n<e.length;n++){const i=e[n];if(i.positionalLabel===t||i.label===t)return i}};gn.hasQuantizedAttributes=function(e){if(!l(e))return!1;for(let t=0;t<e.length;t++){const n=e[t];if(l(n.quantization))return!0}return!1};gn.getAttributeInfo=function(e){const t=e.semantic,n=e.setIndex;let i,o=!1;l(t)?(i=Ut.getVariableName(t,n),o=!0):(i=e.name,i=i.replace(/^_/,""),i=i.toLowerCase());const r=/^color_\d+$/.test(i),s=e.type;let a=Nn.getGlslType(s);r&&(a="vec4");const c=l(e.quantization);let u;return c&&(u=r?"vec4":Nn.getGlslType(e.quantization.type)),{attribute:e,isQuantized:c,variableName:i,hasSemantic:o,glslType:a,quantizedGlslType:u}};const rQe=new d,sQe=new d;gn.getPositionMinMax=function(e,t,n){const i=gn.getAttributeBySemantic(e,"POSITION");let o=i.max,r=i.min;return l(n)&&l(t)&&(r=d.add(r,t,sQe),o=d.add(o,n,rQe)),{min:r,max:o}};gn.getAxisCorrectionMatrix=function(e,t,n){return n=N.clone(N.IDENTITY,n),e===Vs.Y?n=N.clone(Vs.Y_UP_TO_Z_UP,n):e===Vs.X&&(n=N.clone(Vs.X_UP_TO_Z_UP,n)),t===Vs.Z&&(n=N.multiplyTransformation(n,Vs.Z_UP_TO_X_UP,n)),n};const aQe=new te;gn.getCullFace=function(e,t){if(!dt.isTriangles(t))return mr.BACK;const n=N.getMatrix3(e,aQe);return te.determinant(n)<0?mr.FRONT:mr.BACK};gn.sanitizeGlslIdentifier=function(e){let t=e.replaceAll(/[^A-Za-z0-9]+/g,"_");return t=t.replace(/^gl_/,""),/^\d/.test(t)&&(t=`_${t}`),t};gn.supportedExtensions={AGI_articulations:!0,CESIUM_primitive_outline:!0,CESIUM_RTC:!0,EXT_feature_metadata:!0,EXT_instance_features:!0,EXT_mesh_features:!0,EXT_mesh_gpu_instancing:!0,EXT_meshopt_compression:!0,EXT_structural_metadata:!0,EXT_texture_webp:!0,KHR_blend:!0,KHR_draco_mesh_compression:!0,KHR_techniques_webgl:!0,KHR_materials_common:!0,KHR_materials_pbrSpecularGlossiness:!0,KHR_materials_unlit:!0,KHR_mesh_quantization:!0,KHR_texture_basisu:!0,KHR_texture_transform:!0,WEB3D_quantized_attributes:!0};gn.checkSupportedExtensions=function(e){const t=e.length;for(let n=0;n<t;n++){const i=e[n];if(!gn.supportedExtensions[i])throw new Fe(`Unsupported glTF Extension: ${i}`)}};const Z0={TRANSLATION:"TRANSLATION",ROTATION:"ROTATION",SCALE:"SCALE",FEATURE_ID:"_FEATURE_ID"};Z0.fromGltfSemantic=function(e){E.typeOf.string("gltfSemantic",e);let t=e;const i=/^(\w+)_\d+$/.exec(e);switch(i!==null&&(t=i[1]),t){case"TRANSLATION":return Z0.TRANSLATION;case"ROTATION":return Z0.ROTATION;case"SCALE":return Z0.SCALE;case"_FEATURE_ID":return Z0.FEATURE_ID}};const Ma=Object.freeze(Z0),cQe=65534,lQe=255;function Ux(e){e=A(e,A.EMPTY_OBJECT);const t=e.triangleIndices,n=e.outlineIndices,i=e.originalVertexCount;E.typeOf.object("options.triangleIndices",t),E.typeOf.object("options.outlineIndices",n),E.typeOf.number("options.originalVertexCount",i),this._triangleIndices=t,this._originalVertexCount=i,this._edges=new fne(n,i),this._outlineCoordinatesTypedArray=void 0,this._extraVertices=[],uQe(this)}Object.defineProperties(Ux.prototype,{updatedTriangleIndices:{get:function(){return this._triangleIndices}},outlineCoordinates:{get:function(){return this._outlineCoordinatesTypedArray}}});function uQe(e){let t=e._triangleIndices;const n=e._edges,i=[],o=e._extraVertices,r=e._originalVertexCount,s={};for(let a=0;a<t.length;a+=3){let c=t[a],u=t[a+1],f=t[a+2];const h=n.hasEdge(c,u),_=n.hasEdge(u,f),g=n.hasEdge(f,c);let p=rq(i,c,u,f,h,_,g);for(;l(p);){let y=s[p];if(!l(y)){y=r+o.length;let T=p;for(;T>=r;)T=o[T-r];o.push(T),s[p]=y}y>cQe&&(t instanceof Uint16Array||t instanceof Uint8Array)?t=new Uint32Array(t):y>lQe&&t instanceof Uint8Array&&(t=new Uint16Array(t)),p===c?(c=y,t[a]=y):p===u?(u=y,t[a+1]=y):(f=y,t[a+2]=y),p=rq(i,c,u,f,h,_,g)}}e._triangleIndices=t,e._outlineCoordinatesTypedArray=new Float32Array(i)}function rq(e,t,n,i,o,r,s){const a=s?1:0,c=o?1:0,u=0,f=RR(e,t,a,c,u);if(f===0)return t;const h=0,_=o?1:0,g=r?1:0,p=RR(e,n,h,_,g);if(p===0)return n;const y=s?1:0,T=0,b=r?1:0,x=RR(e,i,y,T,b);if(x===0)return i;const v=f&p&x;let D,L,B;if(v&1<<0)D=0,L=1,B=2;else if(v&1<<1)D=0,B=1,L=2;else if(v&1<<2)L=0,D=1,B=2;else if(v&1<<3)L=0,B=1,D=2;else if(v&1<<4)B=0,D=1,L=2;else if(v&1<<5)B=0,L=1,D=2;else{const G=NR(f),I=NR(p),O=NR(x);return G<I&&G<O?t:I<O?n:i}const V=t*3;e[V+D]=a,e[V+L]=c,e[V+B]=u;const M=n*3;e[M+D]=h,e[M+L]=_,e[M+B]=g;const H=i*3;e[H+D]=y,e[H+L]=T,e[H+B]=b}function RR(e,t,n,i,o){const r=t*3,s=e[r],a=e[r+1],c=e[r+2];return l(s)?(s===n&&a===i&&c===o)<<0|(s===n&&a===o&&c===i)<<1|(s===i&&a===n&&c===o)<<2|(s===i&&a===o&&c===n)<<3|(s===o&&a===n&&c===i)<<4|(s===o&&a===i&&c===n)<<5:63}function NR(e){return(e&1)+(e>>1&1)+(e>>2&1)+(e>>3&1)+(e>>4&1)+(e>>5&1)}Ux.prototype.updateAttribute=function(e){const t=this._extraVertices,n=e.length,i=n/this._originalVertexCount,o=t.length,r=e.constructor,s=new r(e.length+o*i);s.set(e);for(let a=0;a<o;a++){const c=t[a]*i,u=n+a*i;for(let f=0;f<i;f++)s[u+f]=s[c+f]}return s};Ux.createTexture=function(e){let t=e.cache.modelOutliningCache;if(l(t)||(t=e.cache.modelOutliningCache={}),l(t.outlineTexture))return t.outlineTexture;const n=Math.min(4096,Gt.maximumTextureSize);let i=n;const o=sq(i),r=[];for(;i>1;)i>>=1,r.push(sq(i));const s=new rn({context:e,source:{arrayBufferView:o,mipLevels:r},width:n,height:1,pixelFormat:yt.LUMINANCE,sampler:new Ci({wrapS:io.CLAMP_TO_EDGE,wrapT:io.CLAMP_TO_EDGE,minificationFilter:Wn.LINEAR_MIPMAP_LINEAR,magnificationFilter:Ps.LINEAR})});return t.outlineTexture=s,s};function sq(e){const t=new Uint8Array(e);return t[e-1]=192,e===8?t[e-1]=96:e===4?t[e-1]=48:e===2?t[e-1]=24:e===1&&(t[e-1]=12),t}function fne(e,t){this._originalVertexCount=t,this._edges=new Set;for(let n=0;n<e.length;n+=2){const i=e[n],o=e[n+1],r=Math.min(i,o),s=Math.max(i,o),a=r*this._originalVertexCount+s;this._edges.add(a)}}fne.prototype.hasEdge=function(e,t){const n=Math.min(e,t),i=Math.max(e,t),o=n*this._originalVertexCount+i;return this._edges.has(o)};function dne(e){E.typeOf.object("attribute",e),this.attribute=e,this.loadBuffer=!1,this.loadTypedArray=!1}function fQe(e){E.typeOf.object("indices",e),this.indices=e,this.loadBuffer=!1,this.loadTypedArray=!1}function PT(e){E.typeOf.object("primitive",e),this.primitive=e,this.attributePlans=[],this.indicesPlan=void 0,this.needsOutlines=!1,this.outlineIndices=void 0}PT.prototype.postProcess=function(e){this.needsOutlines&&(dQe(this),pQe(this,e))};function dQe(e){const t=e.primitive,n=t.indices,i=t.attributes[0].count,o=new Ux({triangleIndices:n.typedArray,outlineIndices:e.outlineIndices,originalVertexCount:i});n.typedArray=o.updatedTriangleIndices,n.indexDatatype=At.fromTypedArray(n.typedArray);const r=hQe(o.outlineCoordinates),s=new dne(r);s.loadBuffer=!0,s.loadTypedArray=!1,e.attributePlans.push(s),t.outlineCoordinates=s.attribute;const a=e.attributePlans,c=e.attributePlans.length;for(let u=0;u<c;u++){const f=a[u].attribute;f.typedArray=o.updateAttribute(f.typedArray)}}function hQe(e){const t=new Yt.Attribute;return t.name="_OUTLINE_COORDINATES",t.typedArray=e,t.componentDatatype=oe.FLOAT,t.type=Nn.VEC3,t.normalized=!1,t.count=e.length/3,t}function pQe(e,t){mQe(e.attributePlans,t),l(e.indicesPlan)&&_Qe(e.indicesPlan,t)}function mQe(e,t){const n=e.length;for(let i=0;i<n;i++){const o=e[i],r=o.attribute,s=r.typedArray;if(o.loadBuffer){const a=Mt.createVertexBuffer({typedArray:s,context:t,usage:mt.STATIC_DRAW});a.vertexArrayDestroyable=!1,r.buffer=a}o.loadTypedArray||(r.typedArray=void 0)}}function _Qe(e,t){const n=e.indices;if(e.loadBuffer){const i=Mt.createIndexBuffer({typedArray:n.typedArray,context:t,usage:mt.STATIC_DRAW,indexDatatype:n.indexDatatype});n.buffer=i,i.vertexArrayDestroyable=!1}e.loadTypedArray||(n.typedArray=void 0)}PT.AttributeLoadPlan=dne;PT.IndicesLoadPlan=fQe;function gQe(e){e=A(e,A.EMPTY_OBJECT),this.webp=A(e.webp,!1),this.basis=A(e.basis,!1)}const yQe=Yt.Attribute,AQe=Yt.Indices,hne=Yt.FeatureIdAttribute,pne=Yt.FeatureIdTexture,mne=Yt.FeatureIdImplicitRange,TQe=Yt.MorphTarget,CQe=Yt.Primitive,bQe=Yt.Instances,EQe=Yt.Skin,xQe=Yt.Node,wQe=Yt.AnimatedPropertyType,SQe=Yt.AnimationSampler,vQe=Yt.AnimationTarget,DQe=Yt.AnimationChannel,IQe=Yt.Animation,PQe=Yt.ArticulationStage,OQe=Yt.Articulation,LQe=Yt.Asset,BQe=Yt.Scene,RQe=Yt.Components,NQe=Yt.MetallicRoughness,MQe=Yt.SpecularGlossiness,FQe=Yt.Material,Xo={NOT_LOADED:0,LOADING:1,LOADED:2,PROCESSING:3,POST_PROCESSING:4,PROCESSED:5,READY:6,FAILED:7,UNLOADED:8};function af(e){e=A(e,A.EMPTY_OBJECT);const t=e.gltfResource;let n=e.baseResource;const i=e.typedArray,o=A(e.releaseGltfJson,!1),r=A(e.asynchronous,!0),s=A(e.incrementallyLoadTextures,!0),a=A(e.upAxis,Vs.Y),c=A(e.forwardAxis,Vs.Z),u=A(e.loadAttributesAsTypedArray,!1),f=A(e.loadAttributesFor2D,!1),h=A(e.loadIndicesForWireframe,!1),_=A(e.loadPrimitiveOutline,!0),g=A(e.loadForClassification,!1),p=A(e.renameBatchIdSemantic,!1);E.typeOf.object("options.gltfResource",t),n=l(n)?n:t.clone(),this._gltfJson=e.gltfJson,this._gltfResource=t,this._baseResource=n,this._typedArray=i,this._releaseGltfJson=o,this._asynchronous=r,this._incrementallyLoadTextures=s,this._upAxis=a,this._forwardAxis=c,this._loadAttributesAsTypedArray=u,this._loadAttributesFor2D=f,this._loadIndicesForWireframe=h,this._loadPrimitiveOutline=_,this._loadForClassification=g,this._renameBatchIdSemantic=p,this._hasKhrMeshQuantization=!1,this._sortedPropertyTableIds=void 0,this._sortedFeatureTextureIds=void 0,this._gltfJsonLoader=void 0,this._state=Xo.NOT_LOADED,this._textureState=Xo.NOT_LOADED,this._promise=void 0,this._texturesLoadedPromise=void 0,this._process=function(y,T){},this._processTextures=function(y,T){},this._primitiveLoadPlans=[],this._loaderPromises=[],this._textureLoaders=[],this._texturesPromises=[],this._bufferViewLoaders=[],this._geometryLoaders=[],this._structuralMetadataLoader=void 0,this._postProcessBuffers=[],this._components=void 0}l(Object.create)&&(af.prototype=Object.create(jr.prototype),af.prototype.constructor=af);Object.defineProperties(af.prototype,{promise:{get:function(){return this._promise}},cacheKey:{get:function(){}},components:{get:function(){return this._components}},texturesLoadedPromise:{get:function(){return this._texturesLoadedPromise}}});af.prototype.load=function(){const e=Bt.loadGltfJson({gltfResource:this._gltfResource,baseResource:this._baseResource,typedArray:this._typedArray,gltfJson:this._gltfJson});this._gltfJsonLoader=e,this._state=Xo.LOADING,this._textureState=Xo.LOADING;const t=this;let n;const i=new Promise(function(o,r){n=new Promise(function(s,a){t._process=function(c,u){if(!Mn.supportsWebP.initialized){Mn.supportsWebP.initialize();return}if(c._state===Xo.LOADED){c._state=Xo.PROCESSING;const f=new gQe({webp:Mn.supportsWebP(),basis:u.context.supportsBasis});let h;l(c._gltfJsonLoader)?h=c._gltfJsonLoader.gltf:h=c._gltfJson,BZe(c,h,f,u,r,a),l(c._gltfJsonLoader)&&c._releaseGltfJson&&(Bt.unload(c._gltfJsonLoader),c._gltfJsonLoader=void 0)}c._state===Xo.PROCESSING&&zQe(c,u),c._state===Xo.POST_PROCESSING&&(UQe(c,u.context),c._state=Xo.PROCESSED),c._state===Xo.PROCESSED&&(xne(c),c._typedArray=void 0,c._state=Xo.READY,o(c))},t._processTextures=function(c,u){if(c._textureState===Xo.LOADED&&(c._textureState=Xo.PROCESSING),c._textureState===Xo.PROCESSING){let f;const h=c._textureLoaders,_=h.length;for(f=0;f<_;++f)h[f].process(u)}c._textureState===Xo.PROCESSED&&(c._textureState=Xo.READY,s(c))}})});return this._promise=e.promise.then(function(){if(!t.isDestroyed())return t._state=Xo.LOADED,t._textureState=Xo.LOADED,i}).catch(function(o){if(!t.isDestroyed())return t._state=Xo.FAILED,t._textureState=Xo.FAILED,aq(t,o)}),this._texturesLoadedPromise=n.catch(function(o){if(!t.isDestroyed())return t._textureState=Xo.FAILED,aq(t,o)}),this._promise};function aq(e,t){e.unload();const n="Failed to load glTF";return t=e.getError(n,t),Promise.reject(t)}function zQe(e,t){const n=e._bufferViewLoaders,i=n.length;for(let s=0;s<i;++s)n[s].process(t);const o=e._geometryLoaders,r=o.length;for(let s=0;s<r;++s)o[s].process(t);l(e._structuralMetadataLoader)&&e._structuralMetadataLoader.process(t)}function UQe(e,t){const n=e._primitiveLoadPlans,i=n.length;for(let o=0;o<i;o++){const r=n[o];r.postProcess(t),r.needsOutlines&&HQe(e,r)}}function HQe(e,t){const n=e._postProcessBuffers,i=t.primitive,o=i.outlineCoordinates;l(o)&&n.push(o.buffer);const r=i.attributes,s=r.length;for(let c=0;c<s;c++){const u=r[c];l(u.buffer)&&n.push(u.buffer)}const a=i.indices;l(a)&&l(a.buffer)&&n.push(a.buffer)}af.prototype.process=function(e){E.typeOf.object("frameState",e),this._process(this,e),this._processTextures(this,e)};function VQe(e,t,n,i,o,r,s,a){const u=t.accessors[n].bufferView,f=Bt.loadVertexBuffer({gltf:t,gltfResource:e._gltfResource,baseResource:e._baseResource,frameState:a,bufferViewId:u,draco:o,attributeSemantic:i,accessorId:n,asynchronous:e._asynchronous,loadBuffer:r,loadTypedArray:s});return e._geometryLoaders.push(f),f}function kQe(e,t,n,i,o,r,s){const a=Bt.loadIndexBuffer({gltf:t,accessorId:n,gltfResource:e._gltfResource,baseResource:e._baseResource,frameState:s,draco:i,asynchronous:e._asynchronous,loadBuffer:o,loadTypedArray:r});return e._geometryLoaders.push(a),a}function GQe(e,t,n){const i=Bt.loadBufferView({gltf:t,bufferViewId:n,gltfResource:e._gltfResource,baseResource:e._baseResource});return e._bufferViewLoaders.push(i),i}function _ne(e,t,n){let i=t.byteOffset;const o=IT(e,t),r=t.count,s=Bx(t.type),a=t.componentType,c=oe.getSizeInBytes(a),u=c*s,f=r*s;if(o===u)return n=new Uint8Array(n),oe.createArrayBufferView(a,n.buffer,n.byteOffset+i,f);const h=oe.createTypedArray(a,f),_=new DataView(n.buffer),g=new Array(s),p=fU(t.componentType);i=n.byteOffset+i;for(let y=0;y<r;++y){p(_,i,s,c,g);for(let T=0;T<s;++T)h[y*s+T]=g[T];i+=o}return h}function WQe(e,t){const n=e.type;if(n===Nn.SCALAR)return t.fill(0);const i=Nn.getMathType(n);return t.fill(i.clone(i.ZERO))}function qQe(e,t,n,i){const o=e.type,r=e.count;if(o===Nn.SCALAR)for(let s=0;s<r;s++)n[s]=t[s];else if(o===Nn.VEC4&&i)for(let s=0;s<r;s++)n[s]=De.unpack(t,s*4);else{const s=Nn.getMathType(o),a=Nn.getNumberOfComponents(o);for(let c=0;c<r;c++)n[c]=s.unpack(t,c*a)}return n}function n1(e,t,n,i){const o=t.accessors[n],r=o.count,s=new Array(r),a=o.bufferView;if(l(a)){const u=GQe(e,t,a).promise.then(function(f){if(e.isDestroyed())return;const h=f.typedArray,_=_ne(t,o,h);i=A(i,!1),qQe(o,_,s,i)});return e._loaderPromises.push(u),s}return WQe(o,s)}function iu(e,t){if(l(t))return e===Number?t[0]:e.unpack(t)}function jQe(e){return e===Number?0:new e}function YQe(e){switch(e){case oe.BYTE:return 127;case oe.UNSIGNED_BYTE:return 255;case oe.SHORT:return 32767;case oe.UNSIGNED_SHORT:return 65535;default:return 1}}const $Qe={VEC2:new $(-1,-1),VEC3:new d(-1,-1,-1),VEC4:new ue(-1,-1,-1,-1)};function XQe(e,t){const n=YQe(e.componentDatatype),i=$Qe[e.type];let o=e.min;l(o)&&(o=t.divideByScalar(o,n,o),o=t.maximumByComponent(o,i,o));let r=e.max;l(r)&&(r=t.divideByScalar(r,n,r),r=t.maximumByComponent(r,i,r)),e.min=o,e.max=r}function KQe(e,t,n){const i=e.decodeMatrix,o=iu(n,e.decodedMin),r=iu(n,e.decodedMax);l(o)&&l(r)&&(t.min=o,t.max=r);const s=new Yt.Quantization;s.componentDatatype=t.componentDatatype,s.type=t.type,i.length===4?(s.quantizedVolumeOffset=i[2],s.quantizedVolumeStepSize=i[0]):i.length===9?(s.quantizedVolumeOffset=new $(i[6],i[7]),s.quantizedVolumeStepSize=new $(i[0],i[4])):i.length===16?(s.quantizedVolumeOffset=new d(i[12],i[13],i[14]),s.quantizedVolumeStepSize=new d(i[0],i[5],i[10])):i.length===25&&(s.quantizedVolumeOffset=new ue(i[20],i[21],i[22],i[23]),s.quantizedVolumeStepSize=new ue(i[0],i[6],i[12],i[18])),t.quantization=s}function JQe(e,t,n,i,o,r){const s=e.accessors[t],a=Nn.getMathType(s.type),c=A(s.normalized,!1),u=new yQe;u.name=n,u.semantic=i,u.setIndex=o,u.constant=jQe(a),u.componentDatatype=s.componentType,u.normalized=c,u.count=s.count,u.type=s.type,u.min=iu(a,s.min),u.max=iu(a,s.max),u.byteOffset=s.byteOffset,u.byteStride=IT(e,s),Wr(s,"WEB3D_quantized_attributes")&&KQe(s.extensions.WEB3D_quantized_attributes,u,a);const f=u.semantic===Ut.POSITION||u.semantic===Ut.NORMAL||u.semantic===Ut.TANGENT||u.semantic===Ut.TEXCOORD;return r&&c&&f&&XQe(u,a),u}function gne(e){const n=/^\w+_(\d+)$/.exec(e);if(n!==null)return parseInt(n[1])}const QQe={gltfSemantic:void 0,renamedSemantic:void 0,modelSemantic:void 0};function yU(e,t,n){let i=n;e._renameBatchIdSemantic&&(n==="_BATCHID"||n==="BATCHID")&&(i="_FEATURE_ID_0");const o=t.fromGltfSemantic(i),r=QQe;return r.gltfSemantic=n,r.renamedSemantic=i,r.modelSemantic=o,r}function ZQe(e){const t=e===Ut.POSITION,n=e===Ut.FEATURE_ID,i=e===Ut.TEXCOORD;return t||n||i}function eZe(e,t,n,i){if(e.byteOffset=0,e.byteStride=void 0,e.quantization=t.quantization,n&&(e.buffer=t.buffer),i){const o=l(t.quantization)?t.quantization.componentDatatype:e.componentDatatype;e.typedArray=oe.createArrayBufferView(o,t.typedArray.buffer)}}function tZe(e,t,n,i,o,r){if(o&&(n.buffer=i.buffer),r){const s=i.typedArray;n.typedArray=_ne(e,t,s),o||(n.byteOffset=0,n.byteStride=void 0)}}function yne(e,t,n,i,o,r,s,a){const c=t.accessors[n],u=c.bufferView,f=i.gltfSemantic,h=i.renamedSemantic,_=i.modelSemantic,g=l(_)?gne(h):void 0,y=JQe(t,n,f,_,g,e._hasKhrMeshQuantization);if(!l(o)&&!l(u))return y;const b=VQe(e,t,n,f,o,r,s,a).promise.then(function(x){e.isDestroyed()||(l(o)&&l(o.attributes)&&l(o.attributes[f])?eZe(y,x,r,s):tZe(t,c,y,x,r,s))});return e._loaderPromises.push(b),y}function Ane(e,t,n,i,o,r,s,a){const c=i.modelSemantic,u=c===Ut.POSITION,f=c===Ut.FEATURE_ID,h=u&&!r&&e._loadAttributesFor2D&&!a.scene3DOnly,_=e._loadForClassification&&f,g=e._loadAttributesAsTypedArray,p=!g,y=g||h||_,x=yne(e,t,n,i,o,s?!1:p,s?!0:y,a),v=new PT.AttributeLoadPlan(x);return v.loadBuffer=p,v.loadTypedArray=y,v}function nZe(e,t,n,i,o,r){const s=l(i.ROTATION),a=l(i.TRANSLATION)&&l(t.accessors[i.TRANSLATION].min)&&l(t.accessors[i.TRANSLATION].max),c=yU(e,Ma,o),u=c.modelSemantic,f=u===Ma.TRANSLATION||u===Ma.ROTATION||u===Ma.SCALE,h=u===Ma.TRANSLATION,_=e._loadAttributesAsTypedArray||s&&f||!r.context.instancedArrays,g=!_,p=e._loadAttributesFor2D&&!r.scene3DOnly;return yne(e,t,n,c,void 0,g,_||h&&(!a||p),r)}function iZe(e,t,n,i,o,r,s){const a=t.accessors[n],c=a.bufferView;if(!l(i)&&!l(c))return;const u=new AQe;u.count=a.count;const f=e._loadAttributesAsTypedArray,h=e._loadIndicesForWireframe&&!s.context.webgl2,_=e._loadForClassification&&o,p=!f,y=f||h||_,v=kQe(e,t,n,i,r?!1:p,r?!0:y,s).promise.then(function(L){e.isDestroyed()||(u.indexDatatype=L.indexDatatype,u.buffer=L.buffer,u.typedArray=L.typedArray)});e._loaderPromises.push(v);const D=new PT.IndicesLoadPlan(u);return D.loadBuffer=p,D.loadTypedArray=y,D}function yh(e,t,n,i,o,r){const s=ly.getImageIdFromTexture({gltf:t,textureId:n.index,supportedImageFormats:i});if(!l(s))return;const a=Bt.loadTexture({gltf:t,textureInfo:n,gltfResource:e._gltfResource,baseResource:e._baseResource,supportedImageFormats:i,frameState:o,asynchronous:e._asynchronous});e._textureLoaders.push(a);const c=ly.createModelTextureReader({textureInfo:n}),u=a.promise.then(function(f){e.isUnloaded()||e.isDestroyed()||(c.texture=f.texture,l(r)&&(c.texture.sampler=r))});return e._texturesPromises.push(u),c}function oZe(e,t,n,i,o){const r=new FQe,s=A(n.extensions,A.EMPTY_OBJECT),a=s.KHR_materials_pbrSpecularGlossiness,c=n.pbrMetallicRoughness;if(r.unlit=l(s.KHR_materials_unlit),l(a)){const u=new MQe;r.specularGlossiness=u,l(a.diffuseTexture)&&(u.diffuseTexture=yh(e,t,a.diffuseTexture,i,o)),l(a.specularGlossinessTexture)&&l(a.specularGlossinessTexture)&&(u.specularGlossinessTexture=yh(e,t,a.specularGlossinessTexture,i,o)),u.diffuseFactor=iu(ue,a.diffuseFactor),u.specularFactor=iu(d,a.specularFactor),u.glossinessFactor=a.glossinessFactor,r.pbrSpecularGlossiness=a}else if(l(c)){const u=new NQe;l(c.baseColorTexture)&&(u.baseColorTexture=yh(e,t,c.baseColorTexture,i,o)),l(c.metallicRoughnessTexture)&&(u.metallicRoughnessTexture=yh(e,t,c.metallicRoughnessTexture,i,o)),u.baseColorFactor=iu(ue,c.baseColorFactor),u.metallicFactor=c.metallicFactor,u.roughnessFactor=c.roughnessFactor,r.metallicRoughness=u}return l(n.emissiveTexture)&&(r.emissiveTexture=yh(e,t,n.emissiveTexture,i,o)),l(n.normalTexture)&&!e._loadForClassification&&(r.normalTexture=yh(e,t,n.normalTexture,i,o)),l(n.occlusionTexture)&&(r.occlusionTexture=yh(e,t,n.occlusionTexture,i,o)),r.emissiveFactor=iu(d,n.emissiveFactor),r.alphaMode=n.alphaMode,r.alphaCutoff=n.alphaCutoff,r.doubleSided=n.doubleSided,r}function Tne(e,t){const n=new hne;return n.featureCount=e.featureCount,n.nullFeatureId=e.nullFeatureId,n.propertyTableId=e.propertyTable,n.setIndex=e.attribute,n.label=e.label,n.positionalLabel=t,n}function Cne(e,t,n,i){const o=new hne,r=e.featureIds;return o.featureCount=n,o.propertyTableId=t,o.setIndex=gne(r.attribute),o.positionalLabel=i,o}function bne(e,t){const n=new mne;return n.propertyTableId=e.propertyTable,n.featureCount=e.featureCount,n.nullFeatureId=e.nullFeatureId,n.label=e.label,n.positionalLabel=t,n.offset=0,n.repeat=1,n}function Ene(e,t,n,i){const o=new mne,r=e.featureIds;o.propertyTableId=t,o.featureCount=n,o.offset=A(r.constant,0);const s=A(r.divisor,0);return o.repeat=s===0?void 0:s,o.positionalLabel=i,o}function rZe(e,t,n,i,o,r){const s=new pne;s.featureCount=n.featureCount,s.nullFeatureId=n.nullFeatureId,s.propertyTableId=n.propertyTable,s.label=n.label,s.positionalLabel=r;const a=n.texture;s.textureReader=yh(e,t,a,i,o,Ci.NEAREST);const u=(l(a.channels)?a.channels:[0]).map(function(f){return"rgba".charAt(f)}).join("");return s.textureReader.channels=u,s}function sZe(e,t,n,i,o,r,s,a){const c=new pne,u=n.featureIds,f=u.texture;return c.featureCount=s,c.propertyTableId=i,c.textureReader=yh(e,t,f,o,r,Ci.NEAREST),c.textureReader.channels=u.channels,c.positionalLabel=a,c}function aZe(e,t,n,i,o,r){const s=new TQe,a=void 0,c=!1;for(const u in n)if(n.hasOwnProperty(u)){const f=n[u],h=yU(e,Ut,u),_=Ane(e,t,f,h,a,c,i,r);s.attributes.push(_.attribute),o.attributePlans.push(_)}return s}function cZe(e,t,n,i,o,r){const s=new CQe,a=new PT(s);e._primitiveLoadPlans.push(a);const c=n.material;l(c)&&(s.material=oZe(e,t,t.materials[c],o,r));const u=A(n.extensions,A.EMPTY_OBJECT);let f=!1;const h=u.CESIUM_primitive_outline;e._loadPrimitiveOutline&&l(h)&&(f=!0,a.needsOutlines=!0,a.outlineIndices=lZe(e,t,h));const _=e._loadForClassification,g=u.KHR_draco_mesh_compression;let p=!1;const y=n.attributes;if(l(y)){for(const V in y)if(y.hasOwnProperty(V)){const M=y[V],H=yU(e,Ut,V),G=H.modelSemantic;if(_&&!ZQe(G))continue;G===Ut.FEATURE_ID&&(p=!0);const I=Ane(e,t,M,H,g,i,f,r);a.attributePlans.push(I),s.attributes.push(I.attribute)}}const T=n.targets;if(l(T)&&!_){const V=T.length;for(let M=0;M<V;++M)s.morphTargets.push(aZe(e,t,T[M],f,a,r))}const b=n.indices;if(l(b)){const V=iZe(e,t,b,g,p,f,r);l(V)&&(a.indicesPlan=V,s.indices=V.indices)}const x=u.EXT_structural_metadata,v=u.EXT_mesh_features,D=u.EXT_feature_metadata,L=l(D);l(v)?uZe(e,t,s,v,o,r):L&&fZe(e,t,s,D,o,r),l(x)?dZe(s,x):L&&hZe(e,s,D);const B=n.mode;if(_&&B!==dt.TRIANGLES)throw new Fe("Only triangle meshes can be used for classification.");return s.primitiveType=B,s}function lZe(e,t,n){const i=n.indices;return n1(e,t,i,!1)}function uZe(e,t,n,i,o,r){let s;l(i)&&l(i.featureIds)?s=i.featureIds:s=[];for(let a=0;a<s.length;a++){const c=s[a],u=`featureId_${a}`;let f;l(c.texture)?f=rZe(e,t,c,o,r,u):l(c.attribute)?f=Tne(c,u):f=bne(c,u),n.featureIds.push(f)}}function fZe(e,t,n,i,o,r){const s=t.extensions.EXT_feature_metadata.featureTables;let a=0;const c=i.featureIdAttributes;if(l(c)){const f=c.length;for(let h=0;h<f;++h){const _=c[h],g=_.featureTable,p=e._sortedPropertyTableIds.indexOf(g),y=s[g].count,T=`featureId_${a}`;a++;let b;l(_.featureIds.attribute)?b=Cne(_,p,y,T):b=Ene(_,p,y,T),n.featureIds.push(b)}}const u=i.featureIdTextures;if(l(u)){const f=u.length;for(let h=0;h<f;++h){const _=u[h],g=_.featureTable,p=e._sortedPropertyTableIds.indexOf(g),y=s[g].count,T=`featureId_${a}`;a++;const b=sZe(e,t,_,p,o,r,y,T);n.featureIds.push(b)}}}function dZe(e,t){l(t)&&(l(t.propertyTextures)&&(e.propertyTextureIds=t.propertyTextures),l(t.propertyAttributes)&&(e.propertyAttributeIds=t.propertyAttributes))}function hZe(e,t,n){l(n.featureTextures)&&(t.propertyTextureIds=n.featureTextures.map(function(i){return e._sortedFeatureTextureIds.indexOf(i)}))}function pZe(e,t,n,i){const o=n.EXT_mesh_gpu_instancing,r=new bQe,s=o.attributes;if(l(s)){for(const f in s)if(s.hasOwnProperty(f)){const h=s[f];r.attributes.push(nZe(e,t,h,s,f,i))}}const a=A(o.extensions,A.EMPTY_OBJECT),c=n.EXT_instance_features,u=a.EXT_feature_metadata;return l(c)?mZe(r,c):l(u)&&_Ze(t,r,u,e._sortedPropertyTableIds),r}function mZe(e,t){const n=t.featureIds;for(let i=0;i<n.length;i++){const o=n[i],r=`instanceFeatureId_${i}`;let s;l(o.attribute)?s=Tne(o,r):s=bne(o,r),e.featureIds.push(s)}}function _Ze(e,t,n,i){const o=e.extensions.EXT_feature_metadata.featureTables,r=n.featureIdAttributes;if(l(r)){const s=r.length;for(let a=0;a<s;++a){const c=r[a],u=c.featureTable,f=i.indexOf(u),h=o[u].count,_=`instanceFeatureId_${a}`;let g;l(c.featureIds.attribute)?g=Cne(c,f,h,_):g=Ene(c,f,h,_),t.featureIds.push(g)}}}function gZe(e,t,n,i,o){const r=new xQe;r.name=n.name,r.matrix=iu(N,n.matrix),r.translation=iu(d,n.translation),r.rotation=iu(De,n.rotation),r.scale=iu(d,n.scale);const s=A(n.extensions,A.EMPTY_OBJECT),a=s.EXT_mesh_gpu_instancing,c=s.AGI_articulations;if(l(a)){if(e._loadForClassification)throw new Fe("Models with the EXT_mesh_gpu_instancing extension cannot be used for classification.");r.instances=pZe(e,t,s,o)}l(c)&&(r.articulationName=c.articulationName);const u=n.mesh;if(l(u)){const f=t.meshes[u],h=f.primitives,_=h.length;for(let T=0;T<_;++T)r.primitives.push(cZe(e,t,h[T],l(r.instances),i,o));const g=A(n.weights,f.weights),y=r.primitives[0].morphTargets.length;r.morphWeights=l(g)?g.slice():new Array(y).fill(0)}return r}function yZe(e,t,n,i){if(!l(t.nodes))return[];let o,r;const s=t.nodes.length,a=new Array(s);for(o=0;o<s;++o){const c=gZe(e,t,t.nodes[o],n,i);c.index=o,a[o]=c}for(o=0;o<s;++o){const c=t.nodes[o].children;if(l(c)){const u=c.length;for(r=0;r<u;++r)a[o].children.push(a[c[r]])}}return a}function AZe(e,t,n,i){const o=new EQe,r=n.joints,s=r.length,a=new Array(s);for(let u=0;u<s;++u)a[u]=i[r[u]];o.joints=a;const c=n.inverseBindMatrices;return l(c)?o.inverseBindMatrices=n1(e,t,c):o.inverseBindMatrices=new Array(s).fill(N.IDENTITY),o}function TZe(e,t,n){const i=t.skins;if(e._loadForClassification||!l(i))return[];const o=t.skins.length,r=new Array(o);for(let a=0;a<o;++a){const c=AZe(e,t,t.skins[a],n);c.index=a,r[a]=c}const s=n.length;for(let a=0;a<s;++a){const c=t.nodes[a].skin;l(c)&&(n[a].skin=r[c])}return r}function CZe(e,t,n,i,o,r){const s=new Vm({gltf:t,extension:n,extensionLegacy:i,gltfResource:e._gltfResource,baseResource:e._baseResource,supportedImageFormats:o,frameState:r,asynchronous:e._asynchronous});return s.load(),e._structuralMetadataLoader=s,s}function bZe(e,t,n){const i=new SQe,o=n.input;i.input=n1(e,t,o);const r=n.interpolation;i.interpolation=A(IA[r],IA.LINEAR);const s=n.output;return i.output=n1(e,t,s,!0),i}function EZe(e,t){const n=new vQe,i=e.node;if(!l(i))return;n.node=t[i];const o=e.path.toUpperCase();return n.path=wQe[o],n}function xZe(e,t,n){const i=new DQe,o=e.sampler;return i.sampler=t[o],i.target=EZe(e.target,n),i}function wZe(e,t,n,i){let o;const r=new IQe;r.name=n.name;const s=n.samplers,a=s.length,c=new Array(a);for(o=0;o<a;o++){const _=bZe(e,t,s[o]);_.index=o,c[o]=_}const u=n.channels,f=u.length,h=new Array(f);for(o=0;o<f;o++)h[o]=xZe(u[o],c,i);return r.samplers=c,r.channels=h,r}function SZe(e,t,n){const i=t.animations;if(e._loadForClassification||!l(i))return[];const o=t.animations.length,r=new Array(o);for(let s=0;s<o;++s){const a=wZe(e,t,t.animations[s],n);a.index=s,r[s]=a}return r}function vZe(e){const t=new PQe;t.name=e.name;const n=e.type.toUpperCase();return t.type=Gu[n],t.minimumValue=e.minimumValue,t.maximumValue=e.maximumValue,t.initialValue=e.initialValue,t}function DZe(e){const t=new OQe;t.name=e.name;const n=e.stages,i=n.length,o=new Array(i);for(let r=0;r<i;r++){const s=vZe(n[r]);o[r]=s}return t.stages=o,t}function IZe(e){const n=A(e.extensions,A.EMPTY_OBJECT).AGI_articulations;if(!l(n))return[];const i=n.articulations;if(!l(i))return[];const o=i.length,r=new Array(o);for(let s=0;s<o;s++){const a=DZe(i[s]);r[s]=a}return r}function PZe(e){let t;return l(e.scenes)&&l(e.scene)&&(t=e.scenes[e.scene].nodes),t=A(t,e.nodes),t=l(t)?t:[],t}function OZe(e,t){const n=new BQe,i=PZe(e);return n.nodes=i.map(function(o){return t[o]}),n}const LZe=new d;function BZe(e,t,n,i,o,r){const s=t.asset.version;if(s!=="1.0"&&s!=="2.0"){const L=e._gltfResource.url;throw new Fe(`Failed to load ${L}:
|
||
Unsupported glTF version: ${s}`)}const a=t.extensionsRequired;l(a)&&(gn.checkSupportedExtensions(a),e._hasKhrMeshQuantization=a.includes("KHR_mesh_quantization"));const c=A(t.extensions,A.EMPTY_OBJECT),u=c.EXT_structural_metadata,f=c.EXT_feature_metadata,h=c.CESIUM_RTC;if(l(f)){const L=f.featureTables,B=f.featureTextures,V=l(L)?L:[],M=l(B)?B:[];e._sortedPropertyTableIds=Object.keys(V).sort(),e._sortedFeatureTextureIds=Object.keys(M).sort()}const _=yZe(e,t,n,i),g=TZe(e,t,_),p=SZe(e,t,_),y=IZe(t),T=OZe(t,_),b=new RQe,x=new LQe,v=t.asset.copyright;if(l(v)){const L=v.split(";").map(function(B){return new Si(B.trim())});x.credits=L}if(b.asset=x,b.scene=T,b.nodes=_,b.skins=g,b.animations=p,b.articulations=y,b.upAxis=e._upAxis,b.forwardAxis=e._forwardAxis,l(h)){const L=d.fromArray(h.center,0,LZe);b.transform=N.fromTranslation(L,b.transform)}if(e._components=b,l(u)||l(f)){const B=CZe(e,t,u,f,n,i).promise.then(function(V){e.isDestroyed()||(b.structuralMetadata=V.structuralMetadata)});e._loaderPromises.push(B)}const D=[];D.push.apply(D,e._loaderPromises),e._incrementallyLoadTextures||D.push.apply(D,e._texturesPromises),Promise.all(D).then(function(){e.isDestroyed()||(e._state=Xo.POST_PROCESSING)}).catch(o),Promise.all(e._texturesPromises).then(function(){e.isDestroyed()||(e._textureState=Xo.PROCESSED)}).catch(r)}function RZe(e){const t=e._textureLoaders,n=t.length;for(let i=0;i<n;++i)Bt.unload(t[i]);e._textureLoaders.length=0}function xne(e){const t=e._bufferViewLoaders,n=t.length;for(let i=0;i<n;++i)Bt.unload(t[i]);e._bufferViewLoaders.length=0}function NZe(e){const t=e._geometryLoaders,n=t.length;for(let i=0;i<n;++i)Bt.unload(t[i]);e._geometryLoaders.length=0}function MZe(e){const t=e._postProcessBuffers,n=t.length;for(let i=0;i<n;i++){const o=t[i];o.isDestroyed()||o.destroy()}t.length=0}function FZe(e){l(e._structuralMetadataLoader)&&(e._structuralMetadataLoader.destroy(),e._structuralMetadataLoader=void 0)}af.prototype.isUnloaded=function(){return this._state===Xo.UNLOADED};af.prototype.unload=function(){l(this._gltfJsonLoader)&&Bt.unload(this._gltfJsonLoader),this._gltfJsonLoader=void 0,RZe(this),xne(this),NZe(this),MZe(this),FZe(this),this._components=void 0,this._typedArray=void 0,this._state=Xo.UNLOADED};const zZe=`#extension GL_EXT_frag_depth : enable
|
||
|
||
uniform sampler2D u_pointCloud_colorGBuffer;
|
||
uniform sampler2D u_pointCloud_depthGBuffer;
|
||
uniform vec2 u_distanceAndEdlStrength;
|
||
varying vec2 v_textureCoordinates;
|
||
|
||
vec2 neighborContribution(float log2Depth, vec2 offset)
|
||
{
|
||
float dist = u_distanceAndEdlStrength.x;
|
||
vec2 texCoordOrig = v_textureCoordinates + offset * dist;
|
||
vec2 texCoord0 = v_textureCoordinates + offset * floor(dist);
|
||
vec2 texCoord1 = v_textureCoordinates + offset * ceil(dist);
|
||
|
||
float depthOrLogDepth0 = czm_unpackDepth(texture2D(u_pointCloud_depthGBuffer, texCoord0));
|
||
float depthOrLogDepth1 = czm_unpackDepth(texture2D(u_pointCloud_depthGBuffer, texCoord1));
|
||
|
||
// ignore depth values that are the clear depth
|
||
if (depthOrLogDepth0 == 0.0 || depthOrLogDepth1 == 0.0) {
|
||
return vec2(0.0);
|
||
}
|
||
|
||
// interpolate the two adjacent depth values
|
||
float depthMix = mix(depthOrLogDepth0, depthOrLogDepth1, fract(dist));
|
||
vec4 eyeCoordinate = czm_windowToEyeCoordinates(texCoordOrig, depthMix);
|
||
return vec2(max(0.0, log2Depth - log2(-eyeCoordinate.z / eyeCoordinate.w)), 1.0);
|
||
}
|
||
|
||
void main()
|
||
{
|
||
float depthOrLogDepth = czm_unpackDepth(texture2D(u_pointCloud_depthGBuffer, v_textureCoordinates));
|
||
|
||
vec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, depthOrLogDepth);
|
||
eyeCoordinate /= eyeCoordinate.w;
|
||
|
||
float log2Depth = log2(-eyeCoordinate.z);
|
||
|
||
if (depthOrLogDepth == 0.0) // 0.0 is the clear value for the gbuffer
|
||
{
|
||
discard;
|
||
}
|
||
|
||
vec4 color = texture2D(u_pointCloud_colorGBuffer, v_textureCoordinates);
|
||
|
||
// sample from neighbors left, right, down, up
|
||
vec2 texelSize = 1.0 / czm_viewport.zw;
|
||
|
||
vec2 responseAndCount = vec2(0.0);
|
||
|
||
responseAndCount += neighborContribution(log2Depth, vec2(-texelSize.x, 0.0));
|
||
responseAndCount += neighborContribution(log2Depth, vec2(+texelSize.x, 0.0));
|
||
responseAndCount += neighborContribution(log2Depth, vec2(0.0, -texelSize.y));
|
||
responseAndCount += neighborContribution(log2Depth, vec2(0.0, +texelSize.y));
|
||
|
||
float response = responseAndCount.x / responseAndCount.y;
|
||
float strength = u_distanceAndEdlStrength.y;
|
||
float shade = exp(-response * 300.0 * strength);
|
||
color.rgb *= shade;
|
||
gl_FragColor = vec4(color);
|
||
|
||
// Input and output depth are the same.
|
||
gl_FragDepthEXT = depthOrLogDepth;
|
||
}
|
||
`;function x_(){this._framebuffer=new Xn({colorAttachmentsLength:2,depth:!0,supportsDepthTexture:!0}),this._drawCommand=void 0,this._clearCommand=void 0,this._strength=1,this._radius=1}Object.defineProperties(x_.prototype,{framebuffer:{get:function(){return this._framebuffer.framebuffer}},colorGBuffer:{get:function(){return this._framebuffer.getColorTexture(0)}},depthGBuffer:{get:function(){return this._framebuffer.getColorTexture(1)}}});function UZe(e){e._framebuffer.destroy(),e._drawCommand=void 0,e._clearCommand=void 0}const MR=new $;function HZe(e,t){const n=new nt({defines:["LOG_DEPTH_WRITE"],sources:[zZe]}),i={u_pointCloud_colorGBuffer:function(){return e.colorGBuffer},u_pointCloud_depthGBuffer:function(){return e.depthGBuffer},u_distanceAndEdlStrength:function(){return MR.x=e._radius,MR.y=e._strength,MR}},o=ht.fromCache({blending:fo.ALPHA_BLEND,depthMask:!0,depthTest:{enabled:!0},stencilTest:Kt.setCesium3DTileBit(),stencilMask:Kt.CESIUM_3D_TILE_MASK});e._drawCommand=t.createViewportQuadCommand(n,{uniformMap:i,renderState:o,pass:We.CESIUM_3D_TILE,owner:e}),e._clearCommand=new Bo({framebuffer:e.framebuffer,color:new k(0,0,0,0),depth:1,renderState:ht.fromCache(),pass:We.CESIUM_3D_TILE,owner:e})}function VZe(e,t){const n=t.drawingBufferWidth,i=t.drawingBufferHeight;e._framebuffer.update(t,n,i),HZe(e,t)}function wne(e){return e.drawBuffers&&e.fragmentDepth}x_.isSupported=wne;function kZe(e,t){let n=e.shaderCache.getDerivedShaderProgram(t,"EC");if(!l(n)){const i=t._attributeLocations,o=t.fragmentShaderSource.clone();o.sources=o.sources.map(function(r){return r=nt.replaceMain(r,"czm_point_cloud_post_process_main"),r=r.replace(/gl_FragColor/g,"gl_FragData[0]"),r}),o.sources.unshift(`#extension GL_EXT_draw_buffers : enable
|
||
`),o.sources.push(`void main()
|
||
{
|
||
czm_point_cloud_post_process_main();
|
||
#ifdef LOG_DEPTH
|
||
czm_writeLogDepth();
|
||
gl_FragData[1] = czm_packDepth(gl_FragDepthEXT);
|
||
#else
|
||
gl_FragData[1] = czm_packDepth(gl_FragCoord.z);
|
||
#endif
|
||
}`),n=e.shaderCache.createDerivedShaderProgram(t,"EC",{vertexShaderSource:t.vertexShaderSource,fragmentShaderSource:o,attributeLocations:i})}return n}x_.prototype.update=function(e,t,n,i){if(!wne(e.context))return;this._strength=n.eyeDomeLightingStrength,this._radius=n.eyeDomeLightingRadius*e.pixelRatio,VZe(this,e.context);let o;const r=e.commandList,s=r.length;for(o=t;o<s;++o){const u=r[o];if(u.primitiveType!==dt.POINTS||u.pass===We.TRANSLUCENT)continue;let f,h,_=u.derivedCommands.pointCloudProcessor;l(_)&&(f=_.command,h=_.originalShaderProgram),(!l(f)||u.dirty||h!==u.shaderProgram||f.framebuffer!==this.framebuffer)&&(f=Dt.shallowClone(u,f),f.framebuffer=this.framebuffer,f.shaderProgram=kZe(e.context,u.shaderProgram),f.castShadows=!1,f.receiveShadows=!1,l(_)||(_={command:f,originalShaderProgram:u.shaderProgram},u.derivedCommands.pointCloudProcessor=_),_.originalShaderProgram=u.shaderProgram),r[o]=f}const a=this._clearCommand,c=this._drawCommand;c.boundingVolume=i,r.push(c),r.push(a)};x_.prototype.isDestroyed=function(){return!1};x_.prototype.destroy=function(){return UZe(this),Je(this)};function Hx(e){const t=A(e,{});this.attenuation=A(t.attenuation,!1),this.geometricErrorScale=A(t.geometricErrorScale,1),this.maximumAttenuation=t.maximumAttenuation,this.baseResolution=t.baseResolution,this.eyeDomeLighting=A(t.eyeDomeLighting,!0),this.eyeDomeLightingStrength=A(t.eyeDomeLightingStrength,1),this.eyeDomeLightingRadius=A(t.eyeDomeLightingRadius,1),this.backFaceCulling=A(t.backFaceCulling,!1),this.normalShading=A(t.normalShading,!0)}Hx.isSupported=function(e){return x_.isSupported(e.context)};const gA={};gA._deprecationWarning=p_;const ph=Uint32Array.BYTES_PER_ELEMENT;gA.parse=function(e,t){const n=A(t,0);E.defined("arrayBuffer",e),t=n;const i=new Uint8Array(e),o=new DataView(e);t+=ph;const r=o.getUint32(t,!0);if(r!==1)throw new Fe(`Only Batched 3D Model version 1 is supported. Version ${r} is not.`);t+=ph;const s=o.getUint32(t,!0);t+=ph;let a=o.getUint32(t,!0);t+=ph;let c=o.getUint32(t,!0);t+=ph;let u=o.getUint32(t,!0);t+=ph;let f=o.getUint32(t,!0);t+=ph;let h;u>=570425344?(t-=ph*2,h=a,u=c,f=0,a=0,c=0,gA._deprecationWarning("b3dm-legacy-header","This b3dm header is using the legacy format [batchLength] [batchTableByteLength]. The new format is [featureTableJsonByteLength] [featureTableBinaryByteLength] [batchTableJsonByteLength] [batchTableBinaryByteLength] from https://github.com/CesiumGS/3d-tiles/tree/main/specification/TileFormats/Batched3DModel.")):f>=570425344&&(t-=ph,h=u,u=a,f=c,a=0,c=0,gA._deprecationWarning("b3dm-legacy-header","This b3dm header is using the legacy format [batchTableJsonByteLength] [batchTableBinaryByteLength] [batchLength]. The new format is [featureTableJsonByteLength] [featureTableBinaryByteLength] [batchTableJsonByteLength] [batchTableBinaryByteLength] from https://github.com/CesiumGS/3d-tiles/tree/main/specification/TileFormats/Batched3DModel."));let _;a===0?_={BATCH_LENGTH:A(h,0)}:(_=zc(i,t,a),t+=a);const g=new Uint8Array(e,t,c);t+=c;let p,y;u>0&&(p=zc(i,t,u),t+=u,f>0&&(y=new Uint8Array(e,t,f),y=new Uint8Array(y),t+=f));const T=n+s-t;if(T===0)throw new Fe("glTF byte length must be greater than 0.");let b;return t%4===0?b=new Uint8Array(e,t,T):(gA._deprecationWarning("b3dm-glb-unaligned","The embedded glb is not aligned to a 4-byte boundary."),b=new Uint8Array(i.subarray(t,t+T))),{batchLength:h,featureTableJson:_,featureTableBinary:g,batchTableJson:p,batchTableBinary:y,gltf:b}};const GZe=gA;function w_(e,t){this.json=e,this.buffer=t,this._cachedTypedArrays={},this.featuresLength=0}function Sne(e,t,n,i,o,r){const s=e._cachedTypedArrays;let a=s[t];return l(a)||(a=oe.createArrayBufferView(n,e.buffer.buffer,e.buffer.byteOffset+r,o*i),s[t]=a),a}function WZe(e,t,n,i){const o=e._cachedTypedArrays;let r=o[t];return l(r)||(r=oe.createTypedArray(n,i),o[t]=r),r}w_.prototype.getGlobalProperty=function(e,t,n){const i=this.json[e];if(l(i))return l(i.byteOffset)?(t=A(t,oe.UNSIGNED_INT),n=A(n,1),Sne(this,e,t,n,1,i.byteOffset)):i};w_.prototype.hasProperty=function(e){return l(this.json[e])};w_.prototype.getPropertyArray=function(e,t,n){const i=this.json[e];if(l(i))return l(i.byteOffset)?(l(i.componentType)&&(t=oe.fromName(i.componentType)),Sne(this,e,t,n,this.featuresLength,i.byteOffset)):WZe(this,e,t,i)};w_.prototype.getProperty=function(e,t,n,i,o){const r=this.json[e];if(!l(r))return;const s=this.getPropertyArray(e,t,n);if(n===1)return s[i];for(let a=0;a<n;++a)o[a]=s[n*i+a];return o};function Wy(e){E.typeOf.number("options.count",e.count),E.typeOf.object("options.batchTable",e.batchTable);const t=e.count,n=e.batchTable,i=e.binaryBody,o=A(e.parseAsPropertyAttributes,!1),r=e.customAttributeOutput;if(o&&!l(r))throw new w("customAttributeOutput is required when parsing batch table as property attributes");const s=qZe(n);let a;l(s.jsonProperties)&&(a=new Gy({count:t,properties:s.jsonProperties}));let c;l(s.hierarchy)&&(c=new Ud({extension:s.hierarchy,binaryBody:i}));const u=i_.BATCH_TABLE_CLASS_NAME,f=s.binaryProperties;let h,_,g;if(o){const T=YZe(t,u,f,i,r);g=T.transcodedSchema,_=[new IP({propertyAttribute:T.propertyAttributeJson,class:T.transcodedClass})]}else{const T=jZe(t,u,f,i);g=T.transcodedSchema;const b=T.featureTableJson;h=new bc({count:b.count,properties:b.properties,class:T.transcodedClass,bufferViews:T.bufferViewsTypedArrays}),_=[]}const p=[];if(l(h)||l(a)||l(c)){const T=new is({id:0,name:"Batch Table",count:t,metadataTable:h,jsonMetadataTable:a,batchTableHierarchy:c});p.push(T)}const y={schema:g,propertyTables:p,propertyAttributes:_,extensions:s.extensions,extras:s.extras};return new Of(y)}function qZe(e){const t=e.HIERARCHY,n=e.extras,i=e.extensions;let o;l(t)?(Wy._deprecationWarning("batchTableHierarchyExtension","The batch table HIERARCHY property has been moved to an extension. Use extensions.3DTILES_batch_table_hierarchy instead."),o=t):l(i)&&(o=i["3DTILES_batch_table_hierarchy"]);let r;const s={};for(const a in e){if(!e.hasOwnProperty(a)||a==="HIERARCHY"||a==="extensions"||a==="extras")continue;const c=e[a];Array.isArray(c)?(r=l(r)?r:{},r[a]=c):s[a]=c}return{binaryProperties:s,jsonProperties:r,hierarchy:o,extras:n,extensions:i}}function jZe(e,t,n,i){const o={},r={},s={};let a=0;for(const h in n){if(!n.hasOwnProperty(h))continue;if(!l(i))throw new Fe(`Property ${h} requires a batch table binary.`);const _=n[h],g=Gg(_);r[h]={bufferView:a},o[h]=vne(_),s[a]=g.createArrayBufferView(i.buffer,i.byteOffset+_.byteOffset,e),a++}const c={classes:{}};c.classes[t]={properties:o};const u=o_.fromJson(c);return{featureTableJson:{class:t,count:e,properties:r},bufferViewsTypedArrays:s,transcodedSchema:u,transcodedClass:u.classes[t]}}function YZe(e,t,n,i,o){const r={},s={};let a=0;for(const h in n){if(!n.hasOwnProperty(h))continue;const _=n[h];if(!l(i)&&!l(_.typedArray))throw new Fe(`Property ${h} requires a batch table binary.`);let g=gn.sanitizeGlslIdentifier(h);(g===""||r.hasOwnProperty(g))&&(g=`property_${a}`,a++);const p=vne(_);p.name=h,r[g]=p;let y=g.toUpperCase();y.startsWith("_")||(y=`_${y}`);let T=_.typedArray;l(T)||(T=Gg(_).createArrayBufferView(i.buffer,i.byteOffset+_.byteOffset,e));const b=new Yt.Attribute;b.name=y,b.count=e,b.type=_.type;const x=oe.fromTypedArray(T);(x===oe.INT||x===oe.UNSIGNED_INT||x===oe.DOUBLE)&&(Wy._oneTimeWarning("Cast pnts property to floats",`Point cloud property "${y}" will be cast to a float array because INT, UNSIGNED_INT, and DOUBLE are not valid WebGL vertex attribute types. Some precision may be lost.`),T=new Float32Array(T)),b.componentDatatype=oe.fromTypedArray(T),b.typedArray=T,o.push(b),s[g]={attribute:y}}const c={classes:{}};c.classes[t]={properties:r};const u=o_.fromJson(c);return{class:t,propertyAttributeJson:{properties:s},transcodedSchema:u,transcodedClass:u.classes[t]}}function vne(e){const t=$Ze(e.componentType);return{type:e.type,componentType:t}}function $Ze(e){switch(e){case"BYTE":return"INT8";case"UNSIGNED_BYTE":return"UINT8";case"SHORT":return"INT16";case"UNSIGNED_SHORT":return"UINT16";case"INT":return"INT32";case"UNSIGNED_INT":return"UINT32";case"FLOAT":return"FLOAT32";case"DOUBLE":return"FLOAT64"}}Wy._deprecationWarning=p_;Wy._oneTimeWarning=uo;const Yg={UNLOADED:0,LOADING:1,PROCESSING:2,READY:3,FAILED:4},XZe=Yt.FeatureIdAttribute;function km(e){e=A(e,A.EMPTY_OBJECT);const t=e.b3dmResource;let n=e.baseResource;const i=e.arrayBuffer,o=A(e.byteOffset,0),r=A(e.releaseGltfJson,!1),s=A(e.asynchronous,!0),a=A(e.incrementallyLoadTextures,!0),c=A(e.upAxis,Vs.Y),u=A(e.forwardAxis,Vs.X),f=A(e.loadAttributesAsTypedArray,!1),h=A(e.loadAttributesFor2D,!1),_=A(e.loadIndicesForWireframe,!1),g=A(e.loadPrimitiveOutline,!0),p=A(e.loadForClassification,!1);E.typeOf.object("options.b3dmResource",t),E.typeOf.object("options.arrayBuffer",i),n=l(n)?n:t.clone(),this._b3dmResource=t,this._baseResource=n,this._arrayBuffer=i,this._byteOffset=o,this._releaseGltfJson=r,this._asynchronous=s,this._incrementallyLoadTextures=a,this._upAxis=c,this._forwardAxis=u,this._loadAttributesAsTypedArray=f,this._loadAttributesFor2D=h,this._loadIndicesForWireframe=_,this._loadPrimitiveOutline=g,this._loadForClassification=p,this._state=Yg.UNLOADED,this._promise=void 0,this._gltfLoader=void 0,this._batchLength=0,this._propertyTable=void 0,this._batchTable=void 0,this._components=void 0,this._transform=N.IDENTITY}l(Object.create)&&(km.prototype=Object.create(jr.prototype),km.prototype.constructor=km);Object.defineProperties(km.prototype,{promise:{get:function(){return this._promise}},texturesLoadedPromise:{get:function(){return this._gltfLoader.texturesLoadedPromise}},cacheKey:{get:function(){}},components:{get:function(){return this._components}}});km.prototype.load=function(){const e=GZe.parse(this._arrayBuffer,this._byteOffset);let t=e.batchLength;const n=e.featureTableJson,i=e.featureTableBinary,o=e.batchTableJson,r=e.batchTableBinary,s=new w_(n,i);t=s.getGlobalProperty("BATCH_LENGTH"),this._batchLength=t;const a=s.getGlobalProperty("RTC_CENTER",oe.FLOAT,3);l(a)&&(this._transform=N.fromTranslation(d.fromArray(a))),this._batchTable={json:o,binary:r};const c=new af({typedArray:e.gltf,upAxis:this._upAxis,forwardAxis:this._forwardAxis,gltfResource:this._b3dmResource,baseResource:this._baseResource,releaseGltfJson:this._releaseGltfJson,incrementallyLoadTextures:this._incrementallyLoadTextures,loadAttributesAsTypedArray:this._loadAttributesAsTypedArray,loadAttributesFor2D:this._loadAttributesFor2D,loadIndicesForWireframe:this._loadIndicesForWireframe,loadPrimitiveOutline:this._loadPrimitiveOutline,loadForClassification:this._loadForClassification,renameBatchIdSemantic:!0});this._gltfLoader=c,this._state=Yg.LOADING;const u=this;return c.load(),this._promise=c.promise.then(function(){if(u.isDestroyed())return;const f=c.components;return f.transform=N.multiplyTransformation(u._transform,f.transform,f.transform),JZe(u,f),u._components=f,u._arrayBuffer=void 0,u._state=Yg.READY,u}).catch(function(f){if(!u.isDestroyed())return KZe(u,f)}),this._promise};function KZe(e,t){e.unload(),e._state=Yg.FAILED;const n="Failed to load b3dm";return t=e.getError(n,t),Promise.reject(t)}km.prototype.process=function(e){E.typeOf.object("frameState",e),this._state===Yg.LOADING&&(this._state=Yg.PROCESSING),this._state===Yg.PROCESSING&&this._gltfLoader.process(e)};function JZe(e,t){const n=e._batchTable,i=e._batchLength;if(i===0)return;let o;if(l(n.json))o=Wy({count:i,batchTable:n.json,binaryBody:n.binary});else{const a=new is({name:i_.BATCH_TABLE_CLASS_NAME,count:i});o=new Of({schema:{},propertyTables:[a]})}const r=t.scene.nodes,s=r.length;for(let a=0;a<s;a++)Dne(r[a]);t.structuralMetadata=o}function Dne(e){const t=e.children.length;for(let i=0;i<t;i++)Dne(e.children[i]);const n=e.primitives.length;for(let i=0;i<n;i++){const o=e.primitives[i],r=gn.getAttributeBySemantic(o,Ut.FEATURE_ID);if(l(r)){r.setIndex=0;const s=new XZe;s.propertyTableId=0,s.setIndex=0,s.positionalLabel="featureId_0",o.featureIds.push(s)}}}km.prototype.unload=function(){l(this._gltfLoader)&&this._gltfLoader.unload(),this._components=void 0,this._arrayBuffer=void 0};function Gm(e){e=A(e,A.EMPTY_OBJECT),E.typeOf.object("options.geoJson",e.geoJson),this._geoJson=e.geoJson,this._promise=void 0,this._process=function(t,n){},this._components=void 0}l(Object.create)&&(Gm.prototype=Object.create(jr.prototype),Gm.prototype.constructor=Gm);Object.defineProperties(Gm.prototype,{promise:{get:function(){return this._promise}},cacheKey:{get:function(){}},components:{get:function(){return this._components}}});Gm.prototype.load=function(){const e=this,t=new Promise(function(n){e._process=function(i,o){l(i._components)||(i._components=fet(i._geoJson,o),i._geoJson=void 0,n(i))}});return this._promise=t,t};Gm.prototype.process=function(e){E.typeOf.object("frameState",e),this._process(this,e)};function QZe(){this.lines=void 0,this.points=void 0,this.properties=void 0}function ZZe(){this.features=[]}function AU(e){const t=e[0],n=e[1],i=A(e[2],0);return new d(t,n,i)}function TU(e){const t=e.length,n=new Array(t);for(let o=0;o<t;o++)n[o]=AU(e[o]);return[n]}function eet(e){const t=e.length,n=new Array(t);for(let i=0;i<t;i++)n[i]=TU(e[i])[0];return n}function Ine(e){const t=e.length,n=new Array(t);for(let i=0;i<t;i++)n[i]=TU(e[i])[0];return n}function tet(e){const t=e.length,n=[];for(let i=0;i<t;i++)Array.prototype.push.apply(n,Ine(e[i]));return n}function net(e){return[AU(e)]}function iet(e){const t=e.length,n=new Array(t);for(let i=0;i<t;i++)n[i]=AU(e[i]);return n}const oet={LineString:TU,MultiLineString:eet,MultiPolygon:tet,Polygon:Ine,MultiPoint:iet,Point:net},ret={LineString:dt.LINES,MultiLineString:dt.LINES,MultiPolygon:dt.LINES,Polygon:dt.LINES,MultiPoint:dt.POINTS,Point:dt.POINTS};function Pne(e,t){if(!l(e.geometry))return;const n=e.geometry.type,i=oet[n],o=ret[n],r=e.geometry.coordinates;if(!l(i)||!l(r))return;const s=new QZe;o===dt.LINES?s.lines=i(r):o===dt.POINTS&&(s.points=i(r)),s.properties=e.properties,t.features.push(s)}function set(e,t){const n=e.features,i=n.length;for(let o=0;o<i;o++)Pne(n[o],t)}const aet={FeatureCollection:set,Feature:Pne},i1=new d;function cet(e,t,n){let i=0,o=0;const r=e.length;for(let H=0;H<r;H++){const G=e[H];if(l(G.lines)){const I=G.lines.length;for(let O=0;O<I;O++){const m=G.lines[O];i+=m.length,o+=(m.length-1)*2}}}const s=new Float32Array(i*3),a=new Float32Array(i),c=At.createTypedArray(i,o),u=At.fromTypedArray(c),f=new d(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),h=new d(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);let _=0,g=0;for(let H=0;H<r;H++){const G=e[H];if(!l(G.lines))continue;const I=G.lines.length;for(let O=0;O<I;O++){const m=G.lines[O],P=m.length;for(let R=0;R<P;R++){const U=m[R],W=d.fromDegrees(U.x,U.y,U.z,be.WGS84,i1),q=N.multiplyByPoint(t,W,i1);d.minimumByComponent(f,q,f),d.maximumByComponent(h,q,h),d.pack(q,s,_*3),a[_]=H,R<P-1&&(c[g*2]=_,c[g*2+1]=_+1,g++),_++}}}const p=Mt.createVertexBuffer({typedArray:s,context:n.context,usage:mt.STATIC_DRAW});p.vertexArrayDestroyable=!1;const y=Mt.createVertexBuffer({typedArray:a,context:n.context,usage:mt.STATIC_DRAW});y.vertexArrayDestroyable=!1;const T=Mt.createIndexBuffer({typedArray:c,context:n.context,usage:mt.STATIC_DRAW,indexDatatype:u});T.vertexArrayDestroyable=!1;const b=new Yt.Attribute;b.semantic=Ut.POSITION,b.componentDatatype=oe.FLOAT,b.type=Nn.VEC3,b.count=i,b.min=f,b.max=h,b.buffer=p;const x=new Yt.Attribute;x.semantic=Ut.FEATURE_ID,x.setIndex=0,x.componentDatatype=oe.FLOAT,x.type=Nn.SCALAR,x.count=i,x.buffer=y;const v=[b,x],D=new Yt.Material;D.unlit=!0;const L=new Yt.Indices;L.indexDatatype=u,L.count=c.length,L.buffer=T;const B=new Yt.FeatureIdAttribute;B.featureCount=r,B.propertyTableId=0,B.setIndex=0,B.positionalLabel="featureId_0";const V=[B],M=new Yt.Primitive;return M.attributes=v,M.indices=L,M.featureIds=V,M.primitiveType=dt.LINES,M.material=D,M}function uet(e,t,n){let i=0;const o=e.length;for(let v=0;v<o;v++){const D=e[v];l(D.points)&&(i+=D.points.length)}const r=new Float32Array(i*3),s=new Float32Array(i),a=new d(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),c=new d(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);let u=0;for(let v=0;v<o;v++){const D=e[v];if(!l(D.points))continue;const L=D.points.length;for(let B=0;B<L;B++){const V=D.points[B],M=d.fromDegrees(V.x,V.y,V.z,be.WGS84,i1),H=N.multiplyByPoint(t,M,i1);d.minimumByComponent(a,H,a),d.maximumByComponent(c,H,c),d.pack(H,r,u*3),s[u]=v,u++}}const f=Mt.createVertexBuffer({typedArray:r,context:n.context,usage:mt.STATIC_DRAW});f.vertexArrayDestroyable=!1;const h=Mt.createVertexBuffer({typedArray:s,context:n.context,usage:mt.STATIC_DRAW});h.vertexArrayDestroyable=!1;const _=new Yt.Attribute;_.semantic=Ut.POSITION,_.componentDatatype=oe.FLOAT,_.type=Nn.VEC3,_.count=i,_.min=a,_.max=c,_.buffer=f;const g=new Yt.Attribute;g.semantic=Ut.FEATURE_ID,g.setIndex=0,g.componentDatatype=oe.FLOAT,g.type=Nn.SCALAR,g.count=i,g.buffer=h;const p=[_,g],y=new Yt.Material;y.unlit=!0;const T=new Yt.FeatureIdAttribute;T.featureCount=o,T.propertyTableId=0,T.setIndex=0,T.positionalLabel="featureId_0";const b=[T],x=new Yt.Primitive;return x.attributes=p,x.featureIds=b,x.primitiveType=dt.POINTS,x.material=y,x}function fet(e,t){const n=new ZZe,i=aet[e.type];l(i)&&i(e,n);const o=n.features,r=o.length;if(r===0)throw new Fe("GeoJSON must have at least one feature");const s={};for(let H=0;H<r;H++){const G=o[H],I=A(G.properties,A.EMPTY_OBJECT);for(const O in I)I.hasOwnProperty(O)&&(l(s[O])||(s[O]=new Array(r)))}for(let H=0;H<r;H++){const G=o[H];for(const I in s)if(s.hasOwnProperty(I)){const O=A(G.properties[I],"");s[I][H]=O}}const a=new Gy({count:r,properties:s}),u=[new is({id:0,count:r,jsonMetadataTable:a})],f=o_.fromJson({}),h=new Of({schema:f,propertyTables:u}),_=new d(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),g=new d(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);let p=!1,y=!1;for(let H=0;H<r;H++){const G=o[H];if(l(G.lines)){p=!0;const I=G.lines.length;for(let O=0;O<I;O++){const m=G.lines[O],P=m.length;for(let R=0;R<P;R++)d.minimumByComponent(_,m[R],_),d.maximumByComponent(g,m[R],g)}}if(l(G.points)){y=!0;const I=G.points.length;for(let O=0;O<I;O++){const m=G.points[O];d.minimumByComponent(_,m,_),d.maximumByComponent(g,m,g)}}}const T=d.midpoint(_,g,new d),b=d.fromDegrees(T.x,T.y,T.z,be.WGS84,new d),x=En.eastNorthUpToFixedFrame(b,be.WGS84,new N),v=N.inverseTransformation(x,new N),D=[];p&&D.push(cet(o,v,t)),y&&D.push(uet(o,v,t));const L=new Yt.Node;L.index=0,L.primitives=D;const B=[L],V=new Yt.Scene;V.nodes=B;const M=new Yt.Components;return M.scene=V,M.nodes=B,M.transform=x,M.structuralMetadata=h,M}Gm.prototype.unload=function(){this._components=void 0};const o1={};o1._deprecationWarning=p_;const Zp=Uint32Array.BYTES_PER_ELEMENT;o1.parse=function(e,t){E.defined("arrayBuffer",e);const n=A(t,0);t=n;const i=new Uint8Array(e),o=new DataView(e);t+=Zp;const r=o.getUint32(t,!0);if(r!==1)throw new Fe(`Only Instanced 3D Model version 1 is supported. Version ${r} is not.`);t+=Zp;const s=o.getUint32(t,!0);t+=Zp;const a=o.getUint32(t,!0);if(a===0)throw new Fe("featureTableJsonByteLength is zero, the feature table must be defined.");t+=Zp;const c=o.getUint32(t,!0);t+=Zp;const u=o.getUint32(t,!0);t+=Zp;const f=o.getUint32(t,!0);t+=Zp;const h=o.getUint32(t,!0);if(h!==1&&h!==0)throw new Fe(`Only glTF format 0 (uri) or 1 (embedded) are supported. Format ${h} is not.`);t+=Zp;const _=zc(i,t,a);t+=a;const g=new Uint8Array(e,t,c);t+=c;let p,y;u>0&&(p=zc(i,t,u),t+=u,f>0&&(y=new Uint8Array(e,t,f),y=new Uint8Array(y),t+=f));const T=n+s-t;if(T===0)throw new Fe("glTF byte length must be greater than 0.");let b;return t%4===0?b=new Uint8Array(e,t,T):(o1._deprecationWarning("i3dm-glb-unaligned","The embedded glb is not aligned to a 4-byte boundary."),b=new Uint8Array(i.subarray(t,t+T))),{gltfFormat:h,featureTableJson:_,featureTableBinary:g,batchTableJson:p,batchTableBinary:y,gltf:b}};const det=o1,tf={NOT_LOADED:0,LOADING:1,PROCESSING:2,POST_PROCESSING:3,READY:4,FAILED:5,UNLOADED:6},Iv=Yt.Attribute,het=Yt.FeatureIdAttribute,One=Yt.Instances;function Wh(e){e=A(e,A.EMPTY_OBJECT);const t=e.i3dmResource,n=e.arrayBuffer;let i=e.baseResource;const o=A(e.byteOffset,0),r=A(e.releaseGltfJson,!1),s=A(e.asynchronous,!0),a=A(e.incrementallyLoadTextures,!0),c=A(e.upAxis,Vs.Y),u=A(e.forwardAxis,Vs.X),f=A(e.loadAttributesAsTypedArray,!1),h=A(e.loadIndicesForWireframe,!1),_=A(e.loadPrimitiveOutline,!0);E.typeOf.object("options.i3dmResource",t),E.typeOf.object("options.arrayBuffer",n),i=l(i)?i:t.clone(),this._i3dmResource=t,this._baseResource=i,this._arrayBuffer=n,this._byteOffset=o,this._releaseGltfJson=r,this._asynchronous=s,this._incrementallyLoadTextures=a,this._upAxis=c,this._forwardAxis=u,this._loadAttributesAsTypedArray=f,this._loadIndicesForWireframe=h,this._loadPrimitiveOutline=_,this._state=tf.NOT_LOADED,this._promise=void 0,this._gltfLoader=void 0,this._gltfLoaderPromise=void 0,this._process=function(g,p){},this._postProcess=function(g,p){},this._buffers=[],this._components=void 0,this._transform=N.IDENTITY,this._batchTable=void 0,this._featureTable=void 0,this._instancesLength=0}l(Object.create)&&(Wh.prototype=Object.create(jr.prototype),Wh.prototype.constructor=Wh);Object.defineProperties(Wh.prototype,{promise:{get:function(){return this._promise}},texturesLoadedPromise:{get:function(){return this._gltfLoader.texturesLoadedPromise}},cacheKey:{get:function(){}},components:{get:function(){return this._components}}});Wh.prototype.load=function(){const e=det.parse(this._arrayBuffer,this._byteOffset),t=e.featureTableJson,n=e.featureTableBinary,i=e.batchTableJson,o=e.batchTableBinary,r=e.gltfFormat,s=new w_(t,n);this._featureTable=s;const a=s.getGlobalProperty("INSTANCES_LENGTH");if(s.featuresLength=a,!l(a))throw new Fe("Feature table global property: INSTANCES_LENGTH must be defined");this._instancesLength=a;const c=s.getGlobalProperty("RTC_CENTER",oe.FLOAT,3);l(c)&&(this._transform=N.fromTranslation(d.fromArray(c))),this._batchTable={json:i,binary:o};const u={upAxis:this._upAxis,forwardAxis:this._forwardAxis,releaseGltfJson:this._releaseGltfJson,incrementallyLoadTextures:this._incrementallyLoadTextures,loadAttributesAsTypedArray:this._loadAttributesAsTypedArray,loadIndicesForWireframe:this._loadIndicesForWireframe,loadPrimitiveOutline:this._loadPrimitiveOutline};if(r===0){let g=nl(e.gltf);g=g.replace(/[\s\0]+$/,"");const p=this._baseResource.getDerivedResource({url:g});u.gltfResource=p,u.baseResource=p}else u.gltfResource=this._i3dmResource,u.typedArray=e.gltf;const f=new af(u);this._gltfLoader=f,this._state=tf.LOADING,f.load();const h=this,_=new Promise(function(g){h._process=function(p,y){p._gltfLoader.process(y)},h._postProcess=function(p,y){const b=p._gltfLoader.components;b.transform=N.multiplyTransformation(p._transform,b.transform,b.transform),get(p,b,y),met(p,b),p._components=b,p._arrayBuffer=void 0,p._state=tf.READY,g(p)}});return this._promise=f.promise.then(function(){if(!h.isDestroyed())return h._state=tf.POST_PROCESSING,_}).catch(function(g){if(!h.isDestroyed())return pet(h,g)}),this._promise};function pet(e,t){e.unload(),e._state=tf.FAILED;const n="Failed to load i3dm";return t=e.getError(n,t),Promise.reject(t)}Wh.prototype.process=function(e){E.typeOf.object("frameState",e),this._state===tf.LOADING&&(this._state=tf.PROCESSING),this._state===tf.PROCESSING&&this._process(this,e),this._state===tf.POST_PROCESSING&&this._postProcess(this,e)};function met(e,t){const n=e._batchTable,i=e._instancesLength;if(i===0)return;let o;if(l(n.json))o=Wy({count:i,batchTable:n.json,binaryBody:n.binary});else{const r=new is({name:i_.BATCH_TABLE_CLASS_NAME,count:i});o=new Of({schema:{},propertyTables:[r]})}t.structuralMetadata=o}const Pv=new d,JF=new Array(4),_et=new N;function get(e,t,n){let i;const o=e._featureTable,r=e._instancesLength;if(r===0)return;const s=o.getGlobalProperty("RTC_CENTER",oe.FLOAT,3),a=o.getGlobalProperty("EAST_NORTH_UP"),c=o.hasProperty("NORMAL_UP")||o.hasProperty("NORMAL_UP_OCT32P")||a,u=o.hasProperty("SCALE")||o.hasProperty("SCALE_NON_UNIFORM"),f=Aet(o);let h;c&&(h=new Float32Array(4*r));let _;u&&(_=new Float32Array(3*r));const g=new Float32Array(r),p=d.unpackArray(f);let y=new d;const T=new d,b=new d,x=new d,v=new te,D=new De,L=new Array(4),B=new d,V=new Array(3),M=new N;if(!l(s)){const q=Ae.fromPoints(p);for(i=0;i<p.length;i++)d.subtract(p[i],q.center,Pv),f[3*i+0]=Pv.x,f[3*i+1]=Pv.y,f[3*i+2]=Pv.z;const Y=N.fromTranslation(q.center,_et);t.transform=N.multiplyTransformation(Y,t.transform,t.transform)}for(i=0;i<r;i++){y=d.clone(p[i]),l(s)&&d.add(y,d.unpack(s),y),c&&(Tet(o,a,i,D,y,b,T,x,v,M),De.pack(D,L,0),h[4*i+0]=L[0],h[4*i+1]=L[1],h[4*i+2]=L[2],h[4*i+3]=L[3]),u&&(Cet(o,i,B),d.pack(B,V,0),_[3*i+0]=V[0],_[3*i+1]=V[1],_[3*i+2]=V[2]);let q=o.getProperty("BATCH_ID",oe.UNSIGNED_SHORT,1,i);l(q)||(q=i),g[i]=q}const H=new One;H.transformInWorldSpace=!0;const G=e._buffers,I=new Iv;if(I.name="Instance Translation",I.semantic=Ma.TRANSLATION,I.componentDatatype=oe.FLOAT,I.type=Nn.VEC3,I.count=r,I.typedArray=f,!c){const q=Mt.createVertexBuffer({context:n.context,typedArray:f,usage:mt.STATIC_DRAW});q.vertexArrayDestroyable=!1,G.push(q),I.buffer=q}if(H.attributes.push(I),c){const q=new Iv;q.name="Instance Rotation",q.semantic=Ma.ROTATION,q.componentDatatype=oe.FLOAT,q.type=Nn.VEC4,q.count=r,q.typedArray=h,H.attributes.push(q)}if(u){const q=new Iv;if(q.name="Instance Scale",q.semantic=Ma.SCALE,q.componentDatatype=oe.FLOAT,q.type=Nn.VEC3,q.count=r,c)q.typedArray=_;else{const Y=Mt.createVertexBuffer({context:n.context,typedArray:_,usage:mt.STATIC_DRAW});Y.vertexArrayDestroyable=!1,G.push(Y),q.buffer=Y}H.attributes.push(q)}const O=new Iv;O.name="Instance Feature ID",O.setIndex=0,O.semantic=Ma.FEATURE_ID,O.componentDatatype=oe.FLOAT,O.type=Nn.SCALAR,O.count=r;const m=Mt.createVertexBuffer({context:n.context,typedArray:g,usage:mt.STATIC_DRAW});m.vertexArrayDestroyable=!1,G.push(m),O.buffer=m,H.attributes.push(O);const P=new het;P.propertyTableId=0,P.setIndex=0,P.positionalLabel="instanceFeatureId_0",H.featureIds.push(P);const R=t.nodes,U=R.length;let W=!1;for(i=0;i<U;i++){const q=R[i];q.primitives.length>0&&(q.instances=W?yet(H):H,W=!0)}}function yet(e){const t=new One;t.transformInWorldSpace=e.transformInWorldSpace;const n=e.attributes,i=n.length;for(let o=0;o<i;o++){const r=St(n[o],!1);t.attributes.push(r)}return t.featureIds=e.featureIds,t}function Aet(e,t){if(e.hasProperty("POSITION"))return e.getPropertyArray("POSITION",oe.FLOAT,3);if(e.hasProperty("POSITION_QUANTIZED")){const n=e.getPropertyArray("POSITION_QUANTIZED",oe.UNSIGNED_SHORT,3),i=e.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",oe.FLOAT,3);if(!l(i))throw new Fe("Global property: QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");const o=e.getGlobalProperty("QUANTIZED_VOLUME_SCALE",oe.FLOAT,3);if(!l(o))throw new Fe("Global property: QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");const r=new Float32Array(n.length);for(let s=0;s<n.length/3;s++)for(let a=0;a<3;a++){const c=3*s+a;r[c]=n[c]/65535*o[a]+i[a]}return r}else throw new Fe("Either POSITION or POSITION_QUANTIZED must be defined for each instance.")}const cq=new Array(4);function Tet(e,t,n,i,o,r,s,a,c,u){const f=e.getProperty("NORMAL_UP",oe.FLOAT,3,n,JF),h=e.getProperty("NORMAL_RIGHT",oe.FLOAT,3,n,cq);let _=!1;if(l(f)){if(!l(h))throw new Fe("To define a custom orientation, both NORMAL_UP and NORMAL_RIGHT must be defined.");d.unpack(f,0,r),d.unpack(h,0,s),_=!0}else{const g=e.getProperty("NORMAL_UP_OCT32P",oe.UNSIGNED_SHORT,2,n,JF),p=e.getProperty("NORMAL_RIGHT_OCT32P",oe.UNSIGNED_SHORT,2,n,cq);if(l(g)){if(!l(p))throw new Fe("To define a custom orientation with oct-encoded vectors, both NORMAL_UP_OCT32P and NORMAL_RIGHT_OCT32P must be defined.");Ri.octDecodeInRange(g[0],g[1],65535,r),Ri.octDecodeInRange(p[0],p[1],65535,s),_=!0}else t?(En.eastNorthUpToFixedFrame(o,be.WGS84,u),N.getMatrix3(u,c)):te.clone(te.IDENTITY,c)}_&&(d.cross(s,r,a),d.normalize(a,a),te.setColumn(c,0,s,c),te.setColumn(c,1,r,c),te.setColumn(c,2,a,c)),De.fromRotationMatrix(c,i)}function Cet(e,t,n){n=d.fromElements(1,1,1,n);const i=e.getProperty("SCALE",oe.FLOAT,1,t);l(i)&&d.multiplyByScalar(n,i,n);const o=e.getProperty("SCALE_NON_UNIFORM",oe.FLOAT,3,t,JF);l(o)&&(n.x*=o[0],n.y*=o[1],n.z*=o[2])}function bet(e){const t=e._buffers,n=t.length;for(let i=0;i<n;i++){const o=t[i];o.isDestroyed()||o.destroy()}t.length=0}Wh.prototype.isUnloaded=function(){return this._state===tf.UNLOADED};Wh.prototype.unload=function(){l(this._gltfLoader)&&this._gltfLoader.unload(),bet(this),this._components=void 0,this._arrayBuffer=void 0,this._state=tf.UNLOADED};const Eet={STOPPED:0,ANIMATING:1},eA=Object.freeze(Eet);function qo(){this.times=void 0,this.points=void 0,w.throwInstantiationError()}qo.getPointType=function(e){if(typeof e=="number")return Number;if(e instanceof d)return d;if(e instanceof De)return De;throw new w("point must be a Cartesian3, Quaternion, or Number.")};qo.prototype.evaluate=w.throwInstantiationError;qo.prototype.findTimeInterval=function(e,t){const n=this.times,i=n.length;if(E.typeOf.number("time",e),e<n[0]||e>n[i-1])throw new w("time is out of range.");if(t=A(t,0),e>=n[t]){if(t+1<i&&e<n[t+1])return t;if(t+2<i&&e<n[t+2])return t+1}else if(t-1>=0&&e>=n[t-1])return t-1;let o;if(e>n[t])for(o=t;o<i-1&&!(e>=n[o]&&e<n[o+1]);++o);else for(o=t-1;o>=0&&!(e>=n[o]&&e<n[o+1]);--o);return o===i-1&&(o=i-2),o};qo.prototype.wrapTime=function(e){E.typeOf.number("time",e);const t=this.times,n=t[t.length-1],i=t[0],o=n-i;let r;return e<i&&(r=Math.floor((i-e)/o)+1,e+=r*o),e>n&&(r=Math.floor((e-n)/o)+1,e-=r*o),e};qo.prototype.clampTime=function(e){E.typeOf.number("time",e);const t=this.times;return F.clamp(e,t[0],t[t.length-1])};function OT(e){this._value=e,this._valueType=qo.getPointType(e)}Object.defineProperties(OT.prototype,{value:{get:function(){return this._value}}});OT.prototype.findTimeInterval=function(e){throw new w("findTimeInterval cannot be called on a ConstantSpline.")};OT.prototype.wrapTime=function(e){return E.typeOf.number("time",e),0};OT.prototype.clampTime=function(e){return E.typeOf.number("time",e),0};OT.prototype.evaluate=function(e,t){E.typeOf.number("time",e);const n=this._value,i=this._valueType;return i===Number?n:i.clone(n,t)};function S_(e){e=A(e,A.EMPTY_OBJECT);const t=e.points,n=e.times;if(!l(t)||!l(n))throw new w("points and times are required.");if(t.length<2)throw new w("points.length must be greater than or equal to 2.");if(n.length!==t.length)throw new w("times.length must be equal to points.length.");this._times=n,this._points=t,this._pointType=qo.getPointType(t[0]),this._lastTimeIndex=0}Object.defineProperties(S_.prototype,{times:{get:function(){return this._times}},points:{get:function(){return this._points}}});S_.prototype.findTimeInterval=qo.prototype.findTimeInterval;S_.prototype.wrapTime=qo.prototype.wrapTime;S_.prototype.clampTime=qo.prototype.clampTime;S_.prototype.evaluate=function(e,t){const n=this.points,i=this.times,o=this._lastTimeIndex=this.findTimeInterval(e,this._lastTimeIndex),r=(e-i[o])/(i[o+1]-i[o]);return this._pointType===Number?(1-r)*n[o]+r*n[o+1]:(l(t)||(t=new d),d.lerp(n[o],n[o+1],r,t))};const Lne={};Lne.solve=function(e,t,n,i){if(!l(e)||!(e instanceof Array))throw new w("The array lower is required.");if(!l(t)||!(t instanceof Array))throw new w("The array diagonal is required.");if(!l(n)||!(n instanceof Array))throw new w("The array upper is required.");if(!l(i)||!(i instanceof Array))throw new w("The array right is required.");if(t.length!==i.length)throw new w("diagonal and right must have the same lengths.");if(e.length!==n.length)throw new w("lower and upper must have the same lengths.");if(e.length!==t.length-1)throw new w("lower and upper must be one less than the length of diagonal.");const o=new Array(n.length),r=new Array(i.length),s=new Array(i.length);let a;for(a=0;a<r.length;a++)r[a]=new d,s[a]=new d;o[0]=n[0]/t[0],r[0]=d.multiplyByScalar(i[0],1/t[0],r[0]);let c;for(a=1;a<o.length;++a)c=1/(t[a]-o[a-1]*e[a-1]),o[a]=n[a]*c,r[a]=d.subtract(i[a],d.multiplyByScalar(r[a-1],e[a-1],r[a]),r[a]),r[a]=d.multiplyByScalar(r[a],c,r[a]);for(c=1/(t[a]-o[a-1]*e[a-1]),r[a]=d.subtract(i[a],d.multiplyByScalar(r[a-1],e[a-1],r[a]),r[a]),r[a]=d.multiplyByScalar(r[a],c,r[a]),s[s.length-1]=r[r.length-1],a=s.length-2;a>=0;--a)s[a]=d.subtract(r[a],d.multiplyByScalar(s[a+1],o[a],s[a]),s[a]);return s};const Bne=Lne,Rne=[],Nne=[],Mne=[],Fne=[];function xet(e,t,n){const i=Rne,o=Mne,r=Nne,s=Fne;i.length=o.length=e.length-1,r.length=s.length=e.length;let a;i[0]=r[0]=1,o[0]=0;let c=s[0];for(l(c)||(c=s[0]=new d),d.clone(t,c),a=1;a<i.length-1;++a)i[a]=o[a]=1,r[a]=4,c=s[a],l(c)||(c=s[a]=new d),d.subtract(e[a+1],e[a-1],c),d.multiplyByScalar(c,3,c);return i[a]=0,o[a]=1,r[a]=4,c=s[a],l(c)||(c=s[a]=new d),d.subtract(e[a+1],e[a-1],c),d.multiplyByScalar(c,3,c),r[a+1]=1,c=s[a+1],l(c)||(c=s[a+1]=new d),d.clone(n,c),Bne.solve(i,r,o,s)}function wet(e){const t=Rne,n=Mne,i=Nne,o=Fne;t.length=n.length=e.length-1,i.length=o.length=e.length;let r;t[0]=n[0]=1,i[0]=2;let s=o[0];for(l(s)||(s=o[0]=new d),d.subtract(e[1],e[0],s),d.multiplyByScalar(s,3,s),r=1;r<t.length;++r)t[r]=n[r]=1,i[r]=4,s=o[r],l(s)||(s=o[r]=new d),d.subtract(e[r+1],e[r-1],s),d.multiplyByScalar(s,3,s);return i[r]=2,s=o[r],l(s)||(s=o[r]=new d),d.subtract(e[r],e[r-1],s),d.multiplyByScalar(s,3,s),Bne.solve(t,i,n,o)}function Uc(e){e=A(e,A.EMPTY_OBJECT);const t=e.points,n=e.times,i=e.inTangents,o=e.outTangents;if(!l(t)||!l(n)||!l(i)||!l(o))throw new w("times, points, inTangents, and outTangents are required.");if(t.length<2)throw new w("points.length must be greater than or equal to 2.");if(n.length!==t.length)throw new w("times.length must be equal to points.length.");if(i.length!==o.length||i.length!==t.length-1)throw new w("inTangents and outTangents must have a length equal to points.length - 1.");if(this._times=n,this._points=t,this._pointType=qo.getPointType(t[0]),this._pointType!==qo.getPointType(i[0])||this._pointType!==qo.getPointType(o[0]))throw new w("inTangents and outTangents must be of the same type as points.");this._inTangents=i,this._outTangents=o,this._lastTimeIndex=0}Object.defineProperties(Uc.prototype,{times:{get:function(){return this._times}},points:{get:function(){return this._points}},inTangents:{get:function(){return this._inTangents}},outTangents:{get:function(){return this._outTangents}}});Uc.createC1=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.times,n=e.points,i=e.tangents;if(!l(n)||!l(t)||!l(i))throw new w("points, times and tangents are required.");if(n.length<2)throw new w("points.length must be greater than or equal to 2.");if(t.length!==n.length||t.length!==i.length)throw new w("times, points and tangents must have the same length.");const o=i.slice(0,i.length-1),r=i.slice(1,i.length);return new Uc({times:t,points:n,inTangents:r,outTangents:o})};Uc.createNaturalCubic=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.times,n=e.points;if(!l(n)||!l(t))throw new w("points and times are required.");if(n.length<2)throw new w("points.length must be greater than or equal to 2.");if(t.length!==n.length)throw new w("times.length must be equal to points.length.");if(n.length<3)return new S_({points:n,times:t});const i=wet(n),o=i.slice(0,i.length-1),r=i.slice(1,i.length);return new Uc({times:t,points:n,inTangents:r,outTangents:o})};Uc.createClampedCubic=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.times,n=e.points,i=e.firstTangent,o=e.lastTangent;if(!l(n)||!l(t)||!l(i)||!l(o))throw new w("points, times, firstTangent and lastTangent are required.");if(n.length<2)throw new w("points.length must be greater than or equal to 2.");if(t.length!==n.length)throw new w("times.length must be equal to points.length.");const r=qo.getPointType(n[0]);if(r!==qo.getPointType(i)||r!==qo.getPointType(o))throw new w("firstTangent and lastTangent must be of the same type as points.");if(n.length<3)return new S_({points:n,times:t});const s=xet(n,i,o),a=s.slice(0,s.length-1),c=s.slice(1,s.length);return new Uc({times:t,points:n,inTangents:c,outTangents:a})};Uc.hermiteCoefficientMatrix=new N(2,-3,0,1,-2,3,0,0,1,-2,1,0,1,-1,0,0);Uc.prototype.findTimeInterval=qo.prototype.findTimeInterval;const vet=new ue,L0=new d;Uc.prototype.wrapTime=qo.prototype.wrapTime;Uc.prototype.clampTime=qo.prototype.clampTime;Uc.prototype.evaluate=function(e,t){const n=this.points,i=this.times,o=this.inTangents,r=this.outTangents;this._lastTimeIndex=this.findTimeInterval(e,this._lastTimeIndex);const s=this._lastTimeIndex,a=i[s+1]-i[s],c=(e-i[s])/a,u=vet;u.z=c,u.y=c*c,u.x=u.y*c,u.w=1;const f=N.multiplyByVector(Uc.hermiteCoefficientMatrix,u,u);f.z*=a,f.w*=a;const h=this._pointType;return h===Number?n[s]*f.x+n[s+1]*f.y+r[s]*f.z+o[s]*f.w:(l(t)||(t=new h),t=h.multiplyByScalar(n[s],f.x,t),h.multiplyByScalar(n[s+1],f.y,L0),h.add(t,L0,t),h.multiplyByScalar(r[s],f.z,L0),h.add(t,L0,t),h.multiplyByScalar(o[s],f.w,L0),h.add(t,L0,t))};function LT(e){e=A(e,A.EMPTY_OBJECT);const t=e.points,n=e.times;if(!l(t)||!l(n))throw new w("points and times are required.");if(t.length<2)throw new w("points.length must be greater than or equal to 2.");if(n.length!==t.length)throw new w("times.length must be equal to points.length.");this._times=n,this._points=t,this._pointType=qo.getPointType(t[0]),this._lastTimeIndex=0}Object.defineProperties(LT.prototype,{times:{get:function(){return this._times}},points:{get:function(){return this._points}}});LT.prototype.findTimeInterval=qo.prototype.findTimeInterval;LT.prototype.wrapTime=qo.prototype.wrapTime;LT.prototype.clampTime=qo.prototype.clampTime;LT.prototype.evaluate=function(e,t){const n=this.points;this._lastTimeIndex=this.findTimeInterval(e,this._lastTimeIndex);const i=this._lastTimeIndex,o=this._pointType;return o===Number?n[i]:(l(t)||(t=new o),o.clone(n[i],t))};function Det(e){const t=e.points,n=e.times;return function(i,o){l(o)||(o=new De);const r=e._lastTimeIndex=e.findTimeInterval(i,e._lastTimeIndex),s=(i-n[r])/(n[r+1]-n[r]),a=t[r],c=t[r+1];return De.fastSlerp(a,c,s,o)}}function BT(e){e=A(e,A.EMPTY_OBJECT);const t=e.points,n=e.times;if(!l(t)||!l(n))throw new w("points and times are required.");if(t.length<2)throw new w("points.length must be greater than or equal to 2.");if(n.length!==t.length)throw new w("times.length must be equal to points.length.");this._times=n,this._points=t,this._evaluateFunction=Det(this),this._lastTimeIndex=0}Object.defineProperties(BT.prototype,{times:{get:function(){return this._times}},points:{get:function(){return this._points}}});BT.prototype.findTimeInterval=qo.prototype.findTimeInterval;BT.prototype.wrapTime=qo.prototype.wrapTime;BT.prototype.clampTime=qo.prototype.clampTime;BT.prototype.evaluate=function(e,t){return this._evaluateFunction(e,t)};const Rg=Yt.AnimatedPropertyType;function CU(e){e=A(e,A.EMPTY_OBJECT);const t=e.channel,n=e.runtimeAnimation,i=e.runtimeNode;E.typeOf.object("options.channel",t),E.typeOf.object("options.runtimeAnimation",n),E.typeOf.object("options.runtimeNode",i),this._channel=t,this._runtimeAnimation=n,this._runtimeNode=i,this._splines=[],this._path=void 0,Oet(this)}Object.defineProperties(CU.prototype,{channel:{get:function(){return this._channel}},runtimeAnimation:{get:function(){return this._runtimeAnimation}},runtimeNode:{get:function(){return this._runtimeNode}},splines:{get:function(){return this._splines}}});function Iet(e,t){const n=[],i=[],o=[],r=t.length;for(let s=0;s<r;s+=3)i.push(t[s]),n.push(t[s+1]),o.push(t[s+2]);return i.splice(0,1),o.length=o.length-1,new Uc({times:e,points:n,inTangents:i,outTangents:o})}function lq(e,t,n,i){if(e.length===1&&t.length===1)return new OT(t[0]);switch(n){case IA.STEP:return new LT({times:e,points:t});case IA.CUBICSPLINE:return Iet(e,t);case IA.LINEAR:return i===Rg.ROTATION?new BT({times:e,points:t}):new S_({times:e,points:t})}}function Pet(e,t,n,i,o){const r=[];if(i===Rg.WEIGHTS){const a=t.length/o;let c,u;for(c=0;c<o;c++){const f=new Array(a);let h=c;if(n===IA.CUBICSPLINE)for(u=0;u<a;u+=3)f[u]=t[h],f[u+1]=t[h+o],f[u+2]=t[h+2*o],h+=o*3;else for(u=0;u<a;u++)f[u]=t[h],h+=o;r.push(lq(e,f,n,i))}}else r.push(lq(e,t,n,i));return r}let QF;function Oet(e){const t=e._channel,n=t.sampler,i=n.input,o=n.output,r=n.interpolation,a=t.target.path,c=e._runtimeNode,u=l(c.morphWeights)?c.morphWeights.length:1,f=Pet(i,o,r,a,u);switch(e._splines=f,e._path=a,a){case Rg.TRANSLATION:case Rg.SCALE:QF=new d;break;case Rg.ROTATION:QF=new De;break;case Rg.WEIGHTS:break}}CU.prototype.animate=function(e){const t=this._splines,n=this._path,i=this._runtimeAnimation.model,o=this._runtimeNode;if(n===Rg.WEIGHTS){const r=o.morphWeights,s=r.length;for(let a=0;a<s;a++){const c=t[a],u=i.clampAnimations?c.clampTime(e):c.wrapTime(e);r[a]=c.evaluate(u)}}else{if(o.userAnimated)return;{const r=t[0],s=i.clampAnimations?r.clampTime(e):r.wrapTime(e);o[n]=r.evaluate(s,QF)}}};function bU(e,t,n){this._animation=t,this._name=t.name,this._runtimeChannels=void 0,this._startTime=ce.clone(n.startTime),this._delay=A(n.delay,0),this._stopTime=ce.clone(n.stopTime),this.removeOnStop=A(n.removeOnStop,!1),this._multiplier=A(n.multiplier,1),this._reverse=A(n.reverse,!1),this._loop=A(n.loop,Dh.NONE),this._animationTime=n.animationTime,this._prevAnimationDelta=void 0,this.start=new lt,this.update=new lt,this.stop=new lt,this._state=eA.STOPPED,this._computedStartTime=void 0,this._duration=void 0;const i=this;this._raiseStartEvent=function(){i.start.raiseEvent(e,i)},this._updateEventTime=0,this._raiseUpdateEvent=function(){i.update.raiseEvent(e,i,i._updateEventTime)},this._raiseStopEvent=function(){i.stop.raiseEvent(e,i)},this._model=e,this._localStartTime=void 0,this._localStopTime=void 0,Let(this)}Object.defineProperties(bU.prototype,{animation:{get:function(){return this._animation}},name:{get:function(){return this._name}},runtimeChannels:{get:function(){return this._runtimeChannels}},model:{get:function(){return this._model}},localStartTime:{get:function(){return this._localStartTime}},localStopTime:{get:function(){return this._localStopTime}},startTime:{get:function(){return this._startTime}},delay:{get:function(){return this._delay}},stopTime:{get:function(){return this._stopTime}},multiplier:{get:function(){return this._multiplier}},reverse:{get:function(){return this._reverse}},loop:{get:function(){return this._loop}},animationTime:{get:function(){return this._animationTime}}});function Let(e){let t=Number.MAX_VALUE,n=-Number.MAX_VALUE;const i=e._model.sceneGraph,r=e._animation.channels,s=r.length,a=[];for(let c=0;c<s;c++){const u=r[c],f=u.target;if(!l(f))continue;const h=f.node.index,_=i._runtimeNodes[h],g=new CU({channel:u,runtimeAnimation:e,runtimeNode:_}),p=u.sampler.input;t=Math.min(t,p[0]),n=Math.max(n,p[p.length-1]),a.push(g)}e._runtimeChannels=a,e._localStartTime=t,e._localStopTime=n}bU.prototype.animate=function(e){const t=this._runtimeChannels,n=t.length;for(let i=0;i<n;i++)t[i].animate(e)};function yp(e){this.animationAdded=new lt,this.animationRemoved=new lt,this.animateWhilePaused=!1,this._model=e,this._runtimeAnimations=[],this._previousTime=void 0}Object.defineProperties(yp.prototype,{length:{get:function(){return this._runtimeAnimations.length}},model:{get:function(){return this._model}}});function ZF(e,t,n){const i=e._model,o=new bU(i,t,n);return e._runtimeAnimations.push(o),e.animationAdded.raiseEvent(i,o),o}yp.prototype.add=function(e){e=A(e,A.EMPTY_OBJECT);const t=this._model;if(!t.ready)throw new w("Animations are not loaded. Wait for Model.readyPromise to resolve.");const n=t.sceneGraph.components.animations;if(!l(e.name)&&!l(e.index))throw new w("Either options.name or options.index must be defined.");if(l(e.multiplier)&&e.multiplier<=0)throw new w("options.multiplier must be greater than zero.");if(l(e.index)&&(e.index>=n.length||e.index<0))throw new w("options.index must be a valid animation index.");let i=e.index;if(l(i))return ZF(this,n[i],e);const o=n.length;for(let r=0;r<o;++r)if(n[r].name===e.name){i=r;break}if(!l(i))throw new w("options.name must be a valid animation name.");return ZF(this,n[i],e)};yp.prototype.addAll=function(e){e=A(e,A.EMPTY_OBJECT);const t=this._model;if(!t.ready)throw new w("Animations are not loaded. Wait for Model.readyPromise to resolve.");if(l(e.multiplier)&&e.multiplier<=0)throw new w("options.multiplier must be greater than zero.");const n=t.sceneGraph.components.animations,i=[],o=n.length;for(let r=0;r<o;++r){const s=ZF(this,n[r],e);i.push(s)}return i};yp.prototype.remove=function(e){if(!l(e))return!1;const t=this._runtimeAnimations,n=t.indexOf(e);return n!==-1?(t.splice(n,1),this.animationRemoved.raiseEvent(this._model,e),!0):!1};yp.prototype.removeAll=function(){const e=this._model,t=this._runtimeAnimations,n=t.length;this._runtimeAnimations.length=0;for(let i=0;i<n;++i)this.animationRemoved.raiseEvent(e,t[i])};yp.prototype.contains=function(e){return l(e)?this._runtimeAnimations.indexOf(e)!==-1:!1};yp.prototype.get=function(e){if(!l(e))throw new w("index is required.");if(e>=this._runtimeAnimations.length||e<0)throw new w("index must be valid within the range of the collection");return this._runtimeAnimations[e]};const Ov=[];function Bet(e,t,n){return function(){e.animationRemoved.raiseEvent(t,n)}}yp.prototype.update=function(e){const t=this._runtimeAnimations;let n=t.length;if(n===0)return this._previousTime=void 0,!1;if(!this.animateWhilePaused&&ce.equals(e.time,this._previousTime))return!1;this._previousTime=ce.clone(e.time,this._previousTime);let i=!1;const o=e.time,r=this._model;for(let s=0;s<n;++s){const a=t[s];l(a._computedStartTime)||(a._computedStartTime=ce.addSeconds(A(a.startTime,o),a.delay,new ce)),l(a._duration)||(a._duration=a.localStopTime*(1/a.multiplier));const c=a._computedStartTime,u=a._duration,f=a.stopTime,h=ce.lessThanOrEquals(c,o),_=l(f)&&ce.greaterThan(o,f);let g=0;if(u!==0){const T=ce.secondsDifference(_?f:o,c);g=l(a._animationTime)?a._animationTime(u,T):T/u}const p=a.loop===Dh.REPEAT||a.loop===Dh.MIRRORED_REPEAT,y=(h||p&&!l(a.startTime))&&(g<=1||p)&&!_;if(g===a._prevAnimationDelta){const T=a._state===eA.STOPPED;if(y!==T)continue}if(a._prevAnimationDelta=g,y||a._state===eA.ANIMATING){if(y&&a._state===eA.STOPPED&&(a._state=eA.ANIMATING,a.start.numberOfListeners>0&&e.afterRender.push(a._raiseStartEvent)),a.loop===Dh.REPEAT)g=g-Math.floor(g);else if(a.loop===Dh.MIRRORED_REPEAT){const b=Math.floor(g),x=g-b;g=b%2===1?1-x:x}a.reverse&&(g=1-g);let T=g*u*a.multiplier;T=F.clamp(T,a.localStartTime,a.localStopTime),a.animate(T),a.update.numberOfListeners>0&&(a._updateEventTime=T,e.afterRender.push(a._raiseUpdateEvent)),i=!0,y||(a._state=eA.STOPPED,a.stop.numberOfListeners>0&&e.afterRender.push(a._raiseStopEvent),a.removeOnStop&&Ov.push(a))}}n=Ov.length;for(let s=0;s<n;++s){const a=Ov[s];t.splice(t.indexOf(a),1),e.afterRender.push(Bet(this,r,a))}return Ov.length=0,i};function qy(e){this._model=e.model,this._featureTable=e.featureTable,this._featureId=e.featureId,this._color=void 0}Object.defineProperties(qy.prototype,{show:{get:function(){return this._featureTable.getShow(this._featureId)},set:function(e){this._featureTable.setShow(this._featureId,e)}},color:{get:function(){return l(this._color)||(this._color=new k),this._featureTable.getColor(this._featureId,this._color)},set:function(e){this._featureTable.setColor(this._featureId,e)}},primitive:{get:function(){return this._model}},featureTable:{get:function(){return this._featureTable}},featureId:{get:function(){return this._featureId}}});qy.prototype.hasProperty=function(e){return this._featureTable.hasProperty(this._featureId,e)};qy.prototype.getProperty=function(e){return this._featureTable.getProperty(this._featureId,e)};qy.prototype.getPropertyInherited=function(e){return this._featureTable.hasPropertyBySemantic(this._featureId,e)?this._featureTable.getPropertyBySemantic(this._featureId,e):this._featureTable.getProperty(this._featureId,e)};qy.prototype.getPropertyIds=function(e){return this._featureTable.getPropertyIds(e)};qy.prototype.setProperty=function(e,t){return this._featureTable.setProperty(this._featureId,e,t)};const xb={ALL_OPAQUE:0,ALL_TRANSLUCENT:1,OPAQUE_AND_TRANSLUCENT:2};xb.getStyleCommandsNeeded=function(e,t){return t===0?xb.ALL_OPAQUE:t===e?xb.ALL_TRANSLUCENT:xb.OPAQUE_AND_TRANSLUCENT};const $E=Object.freeze(xb),hm={GLTF:"GLTF",TILE_GLTF:"TILE_GLTF",TILE_B3DM:"B3DM",TILE_I3DM:"I3DM",TILE_PNTS:"PNTS",TILE_GEOJSON:"TILE_GEOJSON"};hm.is3DTiles=function(e){switch(E.typeOf.string("modelType",e),e){case hm.TILE_GLTF:case hm.TILE_B3DM:case hm.TILE_I3DM:case hm.TILE_PNTS:case hm.TILE_GEOJSON:return!0;case hm.GLTF:return!1;default:throw new w("modelType is not a valid value.")}};const Xa=Object.freeze(hm);function Br(e){const t=e.model,n=e.propertyTable;E.typeOf.object("propertyTable",n),E.typeOf.object("model",t),this._propertyTable=n,this._model=t,this._features=void 0,this._featuresLength=0,this._batchTexture=void 0,this._styleCommandsNeededDirty=!1,this._styleCommandsNeeded=$E.ALL_OPAQUE,Ret(this)}Object.defineProperties(Br.prototype,{batchTexture:{get:function(){return this._batchTexture}},featuresLength:{get:function(){return this._featuresLength}},batchTextureByteLength:{get:function(){return l(this._batchTexture)?this._batchTexture.byteLength:0}},styleCommandsNeededDirty:{get:function(){return this._styleCommandsNeededDirty}}});function Ret(e){const t=e._model,n=Xa.is3DTiles(t.type),i=e._propertyTable.count;if(i===0)return;let o;const r=new Array(i);if(n){const s=t.content;for(o=0;o<i;o++)r[o]=new Js(s,o)}else for(o=0;o<i;o++)r[o]=new qy({model:t,featureId:o,featureTable:e});e._features=r,e._featuresLength=i,e._batchTexture=new er({featuresLength:i,owner:e,statistics:n?t.content.tileset.statistics:void 0})}Br.prototype.update=function(e){this._styleCommandsNeededDirty=!1,this._batchTexture.update(void 0,e);const t=$E.getStyleCommandsNeeded(this._featuresLength,this._batchTexture.translucentFeaturesLength);this._styleCommandsNeeded!==t&&(this._styleCommandsNeededDirty=!0,this._styleCommandsNeeded=t)};Br.prototype.setShow=function(e,t){this._batchTexture.setShow(e,t)};Br.prototype.setAllShow=function(e){this._batchTexture.setAllShow(e)};Br.prototype.getShow=function(e){return this._batchTexture.getShow(e)};Br.prototype.setColor=function(e,t){this._batchTexture.setColor(e,t)};Br.prototype.setAllColor=function(e){this._batchTexture.setAllColor(e)};Br.prototype.getColor=function(e,t){return this._batchTexture.getColor(e,t)};Br.prototype.getPickColor=function(e){return this._batchTexture.getPickColor(e)};Br.prototype.getFeature=function(e){return this._features[e]};Br.prototype.hasProperty=function(e,t){return this._propertyTable.hasProperty(e,t)};Br.prototype.hasPropertyBySemantic=function(e,t){return this._propertyTable.hasPropertyBySemantic(e,t)};Br.prototype.getProperty=function(e,t){return this._propertyTable.getProperty(e,t)};Br.prototype.getPropertyBySemantic=function(e,t){return this._propertyTable.getPropertyBySemantic(e,t)};Br.prototype.getPropertyIds=function(e){return this._propertyTable.getPropertyIds(e)};Br.prototype.setProperty=function(e,t,n){return this._propertyTable.setProperty(e,t,n)};Br.prototype.isClass=function(e,t){return this._propertyTable.isClass(e,t)};Br.prototype.isExactClass=function(e,t){return this._propertyTable.isExactClass(e,t)};Br.prototype.getExactClassName=function(e){return this._propertyTable.getExactClassName(e)};const Net=new k;Br.prototype.applyStyle=function(e){if(!l(e)){this.setAllColor(er.DEFAULT_COLOR_VALUE),this.setAllShow(er.DEFAULT_SHOW_VALUE);return}for(let t=0;t<this._featuresLength;t++){const n=this.getFeature(t),i=l(e.color)?A(e.color.evaluateColor(n,Net),er.DEFAULT_COLOR_VALUE):er.DEFAULT_COLOR_VALUE,o=l(e.show)?A(e.show.evaluate(n),er.DEFAULT_SHOW_VALUE):er.DEFAULT_SHOW_VALUE;this.setColor(t,i),this.setShow(t,o)}};Br.prototype.isDestroyed=function(){return!1};Br.prototype.destroy=function(e){this._batchTexture=this._batchTexture&&this._batchTexture.destroy(),Je(this)};const Met=`#if defined(HAS_NORMALS) && !defined(HAS_TANGENTS) && !defined(LIGHTING_UNLIT)
|
||
#ifdef GL_OES_standard_derivatives
|
||
#extension GL_OES_standard_derivatives : enable
|
||
#endif
|
||
#endif
|
||
|
||
czm_modelMaterial defaultModelMaterial()
|
||
{
|
||
czm_modelMaterial material;
|
||
material.diffuse = vec3(0.0);
|
||
material.specular = vec3(1.0);
|
||
material.roughness = 1.0;
|
||
material.occlusion = 1.0;
|
||
material.normalEC = vec3(0.0, 0.0, 1.0);
|
||
material.emissive = vec3(0.0);
|
||
material.alpha = 1.0;
|
||
return material;
|
||
}
|
||
|
||
vec4 handleAlpha(vec3 color, float alpha)
|
||
{
|
||
#ifdef ALPHA_MODE_MASK
|
||
if (alpha < u_alphaCutoff) {
|
||
discard;
|
||
}
|
||
#endif
|
||
|
||
return vec4(color, alpha);
|
||
}
|
||
|
||
SelectedFeature selectedFeature;
|
||
|
||
void main()
|
||
{
|
||
#ifdef HAS_MODEL_SPLITTER
|
||
modelSplitterStage();
|
||
#endif
|
||
|
||
czm_modelMaterial material = defaultModelMaterial();
|
||
|
||
ProcessedAttributes attributes;
|
||
geometryStage(attributes);
|
||
|
||
FeatureIds featureIds;
|
||
featureIdStage(featureIds, attributes);
|
||
|
||
Metadata metadata;
|
||
MetadataClass metadataClass;
|
||
MetadataStatistics metadataStatistics;
|
||
metadataStage(metadata, metadataClass, metadataStatistics, attributes);
|
||
|
||
#ifdef HAS_SELECTED_FEATURE_ID
|
||
selectedFeatureIdStage(selectedFeature, featureIds);
|
||
#endif
|
||
|
||
#ifndef CUSTOM_SHADER_REPLACE_MATERIAL
|
||
materialStage(material, attributes, selectedFeature);
|
||
#endif
|
||
|
||
#ifdef HAS_CUSTOM_FRAGMENT_SHADER
|
||
customShaderStage(material, attributes, featureIds, metadata, metadataClass, metadataStatistics);
|
||
#endif
|
||
|
||
lightingStage(material, attributes);
|
||
|
||
#ifdef HAS_SELECTED_FEATURE_ID
|
||
cpuStylingStage(material, selectedFeature);
|
||
#endif
|
||
|
||
#ifdef HAS_MODEL_COLOR
|
||
modelColorStage(material);
|
||
#endif
|
||
|
||
#ifdef HAS_PRIMITIVE_OUTLINE
|
||
primitiveOutlineStage(material);
|
||
#endif
|
||
|
||
vec4 color = handleAlpha(material.diffuse, material.alpha);
|
||
|
||
#ifdef HAS_CLIPPING_PLANES
|
||
modelClippingPlanesStage(color);
|
||
#endif
|
||
|
||
#if defined(HAS_SILHOUETTE) && defined(HAS_NORMALS)
|
||
silhouetteStage(color);
|
||
#endif
|
||
|
||
gl_FragColor = color;
|
||
}
|
||
`,Fet=`precision highp float;
|
||
|
||
czm_modelVertexOutput defaultVertexOutput(vec3 positionMC) {
|
||
czm_modelVertexOutput vsOutput;
|
||
vsOutput.positionMC = positionMC;
|
||
vsOutput.pointSize = 1.0;
|
||
return vsOutput;
|
||
}
|
||
|
||
void main()
|
||
{
|
||
// Initialize the attributes struct with all
|
||
// attributes except quantized ones.
|
||
ProcessedAttributes attributes;
|
||
initializeAttributes(attributes);
|
||
|
||
// Dequantize the quantized ones and add them to the
|
||
// attributes struct.
|
||
#ifdef USE_DEQUANTIZATION
|
||
dequantizationStage(attributes);
|
||
#endif
|
||
|
||
#ifdef HAS_MORPH_TARGETS
|
||
morphTargetsStage(attributes);
|
||
#endif
|
||
|
||
#ifdef HAS_SKINNING
|
||
skinningStage(attributes);
|
||
#endif
|
||
|
||
#ifdef HAS_PRIMITIVE_OUTLINE
|
||
primitiveOutlineStage();
|
||
#endif
|
||
|
||
// Compute the bitangent according to the formula in the glTF spec.
|
||
// Normal and tangents can be affected by morphing and skinning, so
|
||
// the bitangent should not be computed until their values are finalized.
|
||
#ifdef HAS_BITANGENTS
|
||
attributes.bitangentMC = normalize(cross(attributes.normalMC, attributes.tangentMC) * attributes.tangentSignMC);
|
||
#endif
|
||
|
||
FeatureIds featureIds;
|
||
featureIdStage(featureIds, attributes);
|
||
|
||
#ifdef HAS_SELECTED_FEATURE_ID
|
||
SelectedFeature feature;
|
||
selectedFeatureIdStage(feature, featureIds);
|
||
// Handle any show properties that come from the style.
|
||
cpuStylingStage(attributes.positionMC, feature);
|
||
#endif
|
||
|
||
#if defined(USE_2D_POSITIONS) || defined(USE_2D_INSTANCING)
|
||
// The scene mode 2D pipeline stage and instancing stage add a different
|
||
// model view matrix to accurately project the model to 2D. However, the
|
||
// output positions and normals should be transformed by the 3D matrices
|
||
// to keep the data the same for the fragment shader.
|
||
mat4 modelView = czm_modelView3D;
|
||
mat3 normal = czm_normal3D;
|
||
#else
|
||
// These are used for individual model projection because they will
|
||
// automatically change based on the scene mode.
|
||
mat4 modelView = czm_modelView;
|
||
mat3 normal = czm_normal;
|
||
#endif
|
||
|
||
// Update the position for this instance in place
|
||
#ifdef HAS_INSTANCING
|
||
|
||
// The legacy instance stage is used when rendering i3dm models that
|
||
// encode instances transforms in world space, as opposed to glTF models
|
||
// that use EXT_mesh_gpu_instancing, where instance transforms are encoded
|
||
// in object space.
|
||
#ifdef USE_LEGACY_INSTANCING
|
||
mat4 instanceModelView;
|
||
mat3 instanceModelViewInverseTranspose;
|
||
|
||
legacyInstancingStage(attributes, instanceModelView, instanceModelViewInverseTranspose);
|
||
|
||
modelView = instanceModelView;
|
||
normal = instanceModelViewInverseTranspose;
|
||
#else
|
||
instancingStage(attributes);
|
||
#endif
|
||
|
||
#ifdef USE_PICKING
|
||
v_pickColor = a_pickColor;
|
||
#endif
|
||
|
||
#endif
|
||
|
||
Metadata metadata;
|
||
MetadataClass metadataClass;
|
||
MetadataStatistics metadataStatistics;
|
||
metadataStage(metadata, metadataClass, metadataStatistics, attributes);
|
||
|
||
#ifdef HAS_CUSTOM_VERTEX_SHADER
|
||
czm_modelVertexOutput vsOutput = defaultVertexOutput(attributes.positionMC);
|
||
customShaderStage(vsOutput, attributes, featureIds, metadata, metadataClass, metadataStatistics);
|
||
#endif
|
||
|
||
// Compute the final position in each coordinate system needed.
|
||
// This returns the value that will be assigned to gl_Position.
|
||
vec4 positionClip = geometryStage(attributes, modelView, normal);
|
||
|
||
#ifdef HAS_SILHOUETTE
|
||
silhouetteStage(attributes, positionClip);
|
||
#endif
|
||
|
||
#ifdef HAS_POINT_CLOUD_SHOW_STYLE
|
||
float show = pointCloudShowStylingStage(attributes, metadata);
|
||
#else
|
||
float show = 1.0;
|
||
#endif
|
||
|
||
#ifdef HAS_POINT_CLOUD_BACK_FACE_CULLING
|
||
show *= pointCloudBackFaceCullingStage();
|
||
#endif
|
||
|
||
#ifdef HAS_POINT_CLOUD_COLOR_STYLE
|
||
v_pointCloudColor = pointCloudColorStylingStage(attributes, metadata);
|
||
#endif
|
||
|
||
#ifdef PRIMITIVE_TYPE_POINTS
|
||
#ifdef HAS_CUSTOM_VERTEX_SHADER
|
||
gl_PointSize = vsOutput.pointSize;
|
||
#elif defined(HAS_POINT_CLOUD_POINT_SIZE_STYLE) || defined(HAS_POINT_CLOUD_ATTENUATION)
|
||
gl_PointSize = pointCloudPointSizeStylingStage(attributes, metadata);
|
||
#else
|
||
gl_PointSize = 1.0;
|
||
#endif
|
||
|
||
gl_PointSize *= show;
|
||
#endif
|
||
|
||
gl_Position = show * positionClip;
|
||
}
|
||
`;function EU(e){e=A(e,A.EMPTY_OBJECT);const t=e.command,n=e.primitiveRenderResources;E.typeOf.object("options.command",t),E.typeOf.object("options.primitiveRenderResources",n);const i=n.model;this._command=t,this._model=i,this._runtimePrimitive=n.runtimePrimitive,this._modelMatrix=t.modelMatrix,this._boundingVolume=t.boundingVolume,this._cullFace=t.renderState.cull.face;const o=i.classificationType;this._classificationType=o,this._classifiesTerrain=o!==ir.CESIUM_3D_TILE,this._classifies3DTiles=o!==ir.TERRAIN,this._useDebugWireframe=i._enableDebugWireframe&&i.debugWireframe,this._pickId=n.pickId,this._commandListTerrain=[],this._commandList3DTiles=[],this._commandListIgnoreShow=[],this._commandListDebugWireframe=[],this._commandListTerrainPicking=[],this._commandList3DTilesPicking=[],Vet(this)}function zet(e){return{colorMask:{red:!1,green:!1,blue:!1,alpha:!1},stencilTest:{enabled:!0,frontFunction:e,frontOperation:{fail:It.KEEP,zFail:It.DECREMENT_WRAP,zPass:It.KEEP},backFunction:e,backOperation:{fail:It.KEEP,zFail:It.INCREMENT_WRAP,zPass:It.KEEP},reference:Kt.CESIUM_3D_TILE_MASK,mask:Kt.CESIUM_3D_TILE_MASK},stencilMask:Kt.CLASSIFICATION_MASK,depthTest:{enabled:!0,func:ty.LESS_OR_EQUAL},depthMask:!1}}const Uet={stencilTest:{enabled:!0,frontFunction:Ni.NOT_EQUAL,frontOperation:{fail:It.ZERO,zFail:It.ZERO,zPass:It.ZERO},backFunction:Ni.NOT_EQUAL,backOperation:{fail:It.ZERO,zFail:It.ZERO,zPass:It.ZERO},reference:0,mask:Kt.CLASSIFICATION_MASK},stencilMask:Kt.CLASSIFICATION_MASK,depthTest:{enabled:!1},depthMask:!1,blending:fo.PRE_MULTIPLIED_ALPHA_BLEND},Het={stencilTest:{enabled:!0,frontFunction:Ni.NOT_EQUAL,frontOperation:{fail:It.ZERO,zFail:It.ZERO,zPass:It.ZERO},backFunction:Ni.NOT_EQUAL,backOperation:{fail:It.ZERO,zFail:It.ZERO,zPass:It.ZERO},reference:0,mask:Kt.CLASSIFICATION_MASK},stencilMask:Kt.CLASSIFICATION_MASK,depthTest:{enabled:!1},depthMask:!1},zne=[];function Vet(e){const t=e._command,n=zne;if(e._useDebugWireframe){t.pass=We.OPAQUE,n.length=0,n.push(t),e._commandListDebugWireframe=Jb(e,n,e._commandListDebugWireframe);const r=e._commandListDebugWireframe,s=r.length;for(let a=0;a<s;a++){const c=r[a];c.count*=2,c.offset*=2}return}const o=e.model.allowPicking;if(e._classifiesTerrain){const r=We.TERRAIN_CLASSIFICATION,s=e2(t,r),a=uq(t,r);n.length=0,n.push(s,a),e._commandListTerrain=Jb(e,n,e._commandListTerrain),o&&(e._commandListTerrainPicking=fq(e,n,e._commandListTerrainPicking))}if(e._classifies3DTiles){const r=We.CESIUM_3D_TILE_CLASSIFICATION,s=e2(t,r),a=uq(t,r);n.length=0,n.push(s,a),e._commandList3DTiles=Jb(e,n,e._commandList3DTiles),o&&(e._commandList3DTilesPicking=fq(e,n,e._commandList3DTilesPicking))}}function Jb(e,t,n){const i=e._runtimePrimitive,o=i.batchLengths,r=i.batchOffsets,s=o.length,a=t.length;for(let c=0;c<s;c++){const u=o[c],f=r[c];for(let h=0;h<a;h++){const _=t[h],g=Dt.shallowClone(_);g.count=u,g.offset=f,n.push(g)}}return n}function e2(e,t){const n=Dt.shallowClone(e);n.cull=!1,n.pass=t;const i=t===We.TERRAIN_CLASSIFICATION?Ni.ALWAYS:Ni.EQUAL,o=zet(i);return n.renderState=ht.fromCache(o),n}function uq(e,t){const n=Dt.shallowClone(e);return n.cull=!1,n.pass=t,n.renderState=ht.fromCache(Uet),n}const ket=[];function fq(e,t,n){const i=ht.fromCache(Het),o=t[0],r=t[1],s=Dt.shallowClone(o);s.cull=!0,s.pickOnly=!0;const a=Dt.shallowClone(r);a.cull=!0,a.pickOnly=!0,a.renderState=i,a.pickId=e._pickId;const c=ket;return c.length=0,c.push(s,a),Jb(e,c,n)}Object.defineProperties(EU.prototype,{command:{get:function(){return this._command}},runtimePrimitive:{get:function(){return this._runtimePrimitive}},batchLengths:{get:function(){return this._runtimePrimitive.batchLengths}},batchOffsets:{get:function(){return this._runtimePrimitive.batchOffsets}},model:{get:function(){return this._model}},classificationType:{get:function(){return this._classificationType}},modelMatrix:{get:function(){return this._modelMatrix},set:function(e){this._modelMatrix=N.clone(e,this._modelMatrix);const t=this._runtimePrimitive.boundingSphere;this._boundingVolume=Ae.transform(t,this._modelMatrix,this._boundingVolume)}},boundingVolume:{get:function(){return this._boundingVolume}},cullFace:{get:function(){return this._cullFace},set:function(e){this._cullFace=e}}});EU.prototype.pushCommands=function(e,t){const n=e.passes;if(n.render){if(this._useDebugWireframe){t.push.apply(t,this._commandListDebugWireframe);return}if(this._classifiesTerrain&&t.push.apply(t,this._commandListTerrain),this._classifies3DTiles&&t.push.apply(t,this._commandList3DTiles),e.invertClassification&&this._classifies3DTiles){if(this._commandListIgnoreShow.length===0){const o=We.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW,r=e2(this._command,o),s=zne;s.length=0,s.push(r),this._commandListIgnoreShow=Jb(this,s,this._commandListIgnoreShow)}t.push.apply(t,this._commandListIgnoreShow)}}return n.pick&&(this._classifiesTerrain&&t.push.apply(t,this._commandListTerrainPicking),this._classifies3DTiles&&t.push.apply(t,this._commandList3DTilesPicking)),t};function PP(e){e=A(e,A.EMPTY_OBJECT);const t=e.command,n=e.primitiveRenderResources;E.typeOf.object("options.command",t),E.typeOf.object("options.primitiveRenderResources",n);const i=n.model;this._model=i;const o=n.runtimePrimitive;this._runtimePrimitive=o;const r=t.pass===We.TRANSLUCENT,a=!o.primitive.material.doubleSided&&!r,c=n.hasSilhouette,u=!r&&!c,f=n.hasSkipLevelOfDetail&&!r,h=c;this._command=t,this._modelMatrix=N.clone(t.modelMatrix),this._boundingVolume=Ae.clone(t.boundingVolume),this._modelMatrix2D=new N,this._boundingVolume2D=new Ae,this._modelMatrix2DDirty=!1,this._backFaceCulling=t.renderState.cull.enabled,this._cullFace=t.renderState.cull.face,this._shadows=i.shadows,this._debugShowBoundingVolume=t.debugShowBoundingVolume,this._usesBackFaceCulling=a,this._needsTranslucentCommand=u,this._needsSkipLevelOfDetailCommands=f,this._needsSilhouetteCommands=h,this._originalCommand=void 0,this._translucentCommand=void 0,this._skipLodBackfaceCommand=void 0,this._skipLodStencilCommand=void 0,this._silhouetteModelCommand=void 0,this._silhouetteColorCommand=void 0,this._derivedCommands=[],this._has2DCommands=!1,Get(this)}function Eh(e){this.command=e.command,this.updateShadows=e.updateShadows,this.updateBackFaceCulling=e.updateBackFaceCulling,this.updateCullFace=e.updateCullFace,this.updateDebugShowBoundingVolume=e.updateDebugShowBoundingVolume,this.is2D=A(e.is2D,!1),this.derivedCommand2D=void 0}Eh.clone=function(e){return new Eh({command:e.command,updateShadows:e.updateShadows,updateBackFaceCulling:e.updateBackFaceCulling,updateCullFace:e.updateCullFace,updateDebugShowBoundingVolume:e.updateDebugShowBoundingVolume,is2D:e.is2D,derivedCommand2D:e.derivedCommand2D})};function Get(e){const t=e._command;t.modelMatrix=e._modelMatrix,t.boundingVolume=e._boundingVolume;const n=e._model,i=e._usesBackFaceCulling,o=e._derivedCommands;e._originalCommand=new Eh({command:t,updateShadows:!0,updateBackFaceCulling:i,updateCullFace:i,updateDebugShowBoundingVolume:!0,is2D:!1}),o.push(e._originalCommand),e._needsTranslucentCommand&&(e._translucentCommand=new Eh({command:Ket(t),updateShadows:!0,updateBackFaceCulling:!1,updateCullFace:!1,updateDebugShowBoundingVolume:!0}),o.push(e._translucentCommand)),e._needsSkipLevelOfDetailCommands&&(e._skipLodBackfaceCommand=new Eh({command:ntt(t),updateShadows:!1,updateBackFaceCulling:!1,updateCullFace:i,updateDebugShowBoundingVolume:!1}),e._skipLodStencilCommand=new Eh({command:itt(t),updateShadows:!0,updateBackFaceCulling:i,updateCullFace:i,updateDebugShowBoundingVolume:!0}),o.push(e._skipLodBackfaceCommand),o.push(e._skipLodStencilCommand)),e._needsSilhouetteCommands&&(e._silhouetteModelCommand=new Eh({command:Jet(t,n),updateShadows:!0,updateBackFaceCulling:i,updateCullFace:i,updateDebugShowBoundingVolume:!0}),e._silhouetteColorCommand=new Eh({command:Qet(t,n),updateShadows:!1,updateBackFaceCulling:!1,updateCullFace:!1,updateDebugShowBoundingVolume:!1}),o.push(e._silhouetteModelCommand),o.push(e._silhouetteColorCommand))}Object.defineProperties(PP.prototype,{command:{get:function(){return this._command}},runtimePrimitive:{get:function(){return this._runtimePrimitive}},model:{get:function(){return this._model}},primitiveType:{get:function(){return this._command.primitiveType}},modelMatrix:{get:function(){return this._modelMatrix},set:function(e){this._modelMatrix=N.clone(e,this._modelMatrix),this._modelMatrix2DDirty=!0,this._boundingVolume=Ae.transform(this.runtimePrimitive.boundingSphere,this._modelMatrix,this._boundingVolume)}},boundingVolume:{get:function(){return this._boundingVolume}},shadows:{get:function(){return this._shadows},set:function(e){this._shadows=e,qet(this)}},backFaceCulling:{get:function(){return this._backFaceCulling},set:function(e){this._backFaceCulling!==e&&(this._backFaceCulling=e,jet(this))}},cullFace:{get:function(){return this._cullFace},set:function(e){this._cullFace!==e&&(this._cullFace=e,Yet(this))}},debugShowBoundingVolume:{get:function(){return this._debugShowBoundingVolume},set:function(e){this._debugShowBoundingVolume!==e&&(this._debugShowBoundingVolume=e,$et(this))}}});function Wet(e,t){const n=e._modelMatrix;e._modelMatrix2D=N.clone(n,e._modelMatrix2D),e._modelMatrix2D[13]-=F.sign(n[13])*2*F.PI*t.mapProjection.ellipsoid.maximumRadius,e._boundingVolume2D=Ae.transform(e.runtimePrimitive.boundingSphere,e._modelMatrix2D,e._boundingVolume2D)}function qet(e){const t=e.shadows,n=sr.castShadows(t),i=sr.receiveShadows(t),o=e._derivedCommands,r=o.length;for(let s=0;s<r;++s){const a=o[s];if(a.updateShadows){const c=a.command;c.castShadows=n,c.receiveShadows=i}}}function jet(e){const t=e.backFaceCulling,n=e._derivedCommands,i=n.length;for(let o=0;o<i;++o){const r=n[o];if(r.updateBackFaceCulling){const s=r.command,a=St(s.renderState,!0);a.cull.enabled=t,s.renderState=ht.fromCache(a)}}}function Yet(e){const t=e.cullFace,n=e._derivedCommands,i=n.length;for(let o=0;o<i;++o){const r=n[o];if(r.updateCullFace){const s=r.command,a=St(s.renderState,!0);a.cull.face=t,s.renderState=ht.fromCache(a)}}}function $et(e){const t=e.debugShowBoundingVolume,n=e._derivedCommands,i=n.length;for(let o=0;o<i;++o){const r=n[o];if(r.updateDebugShowBoundingVolume){const s=r.command;s.debugShowBoundingVolume=t}}}PP.prototype.pushCommands=function(e,t){const n=Une(this,e);n&&!this._has2DCommands&&(Xet(this),this._has2DCommands=!0,this._modelMatrix2DDirty=!0),this._modelMatrix2DDirty&&(Wet(this,e),this._modelMatrix2DDirty=!1);const i=this.model.styleCommandsNeeded;if(!(this._needsTranslucentCommand&&l(i)&&(i!==$E.ALL_OPAQUE&&tA(t,this._translucentCommand,n),i===$E.ALL_TRANSLUCENT))){if(this._needsSkipLevelOfDetailCommands){const o=this._model.content,r=o.tileset,s=o.tile,a=r._hasMixedContent,c=s._finalResolution;if(a){c||tA(r._backfaceCommands,this._skipLodBackfaceCommand,n),Zet(this,s,n),tA(t,this._skipLodStencilCommand,n);return}}if(this._needsSilhouetteCommands){tA(t,this._silhouetteModelCommand,n);return}return tA(t,this._originalCommand,n),t}};PP.prototype.pushSilhouetteCommands=function(e,t){const n=Une(this,e);return tA(t,this._silhouetteColorCommand,n),t};function tA(e,t,n){e.push(t.command),n&&e.push(t.derivedCommand2D.command)}function Une(e,t){if(t.mode!==me.SCENE2D||e.model._projectTo2D)return!1;const i=e.model.sceneGraph._boundingSphere2D,o=i.center.y-i.radius,r=i.center.y+i.radius,s=t.mapProjection.ellipsoid.maximumRadius*F.PI;return o<s&&r>s||o<-s&&r>-s}function B0(e,t){if(!l(t))return;const n=Eh.clone(t),i=Dt.shallowClone(t.command);return i.modelMatrix=e._modelMatrix2D,i.boundingVolume=e._boundingVolume2D,n.command=i,n.updateShadows=!1,n.is2D=!0,t.derivedCommand2D=n,e._derivedCommands.push(n),n}function Xet(e){B0(e,e._originalCommand),B0(e,e._translucentCommand),B0(e,e._skipLodBackfaceCommand),B0(e,e._skipLodStencilCommand),B0(e,e._silhouetteModelCommand),B0(e,e._silhouetteColorCommand)}function Ket(e){const t=Dt.shallowClone(e);t.pass=We.TRANSLUCENT;const n=St(e.renderState,!0);return n.cull.enabled=!1,n.depthMask=!1,n.blending=fo.ALPHA_BLEND,t.renderState=ht.fromCache(n),t}function Jet(e,t){const n=t._silhouetteId%255,i=Dt.shallowClone(e),o=St(e.renderState,!0);return o.stencilTest={enabled:!0,frontFunction:fe.ALWAYS,backFunction:fe.ALWAYS,reference:n,mask:-1,frontOperation:{fail:fe.KEEP,zFail:fe.KEEP,zPass:fe.REPLACE},backOperation:{fail:fe.KEEP,zFail:fe.KEEP,zPass:fe.REPLACE}},t.isInvisible()&&(o.colorMask={red:!1,green:!1,blue:!1,alpha:!1}),i.renderState=ht.fromCache(o),i}function Qet(e,t){const n=t._silhouetteId%255,i=Dt.shallowClone(e),o=St(e.renderState,!0);o.cull.enabled=!1,(e.pass===We.TRANSLUCENT||t.silhouetteColor.alpha<1)&&(i.pass=We.TRANSLUCENT,o.depthMask=!1,o.blending=fo.ALPHA_BLEND),o.stencilTest={enabled:!0,frontFunction:fe.NOTEQUAL,backFunction:fe.NOTEQUAL,reference:n,mask:-1,frontOperation:{fail:fe.KEEP,zFail:fe.KEEP,zPass:fe.KEEP},backOperation:{fail:fe.KEEP,zFail:fe.KEEP,zPass:fe.KEEP}};const s=St(e.uniformMap);return s.model_silhouettePass=function(){return!0},i.renderState=ht.fromCache(o),i.uniformMap=s,i.castShadows=!1,i.receiveShadows=!1,i}function Zet(e,t,n){const i=e._skipLodStencilCommand,o=i.command,r=t._selectionDepth,s=ett(o);if(r!==s){const a=ttt(r),c=St(o.renderState,!0);c.stencilTest.reference=a,o.renderState=ht.fromCache(c),n&&(i.derivedCommand2D.renderState=c)}}function ett(e){return(e.renderState.stencilTest.reference&Kt.SKIP_LOD_MASK)>>>Kt.SKIP_LOD_BIT_SHIFT}function ttt(e){return Kt.CESIUM_3D_TILE_MASK|e<<Kt.SKIP_LOD_BIT_SHIFT}function ntt(e){const t=Dt.shallowClone(e),n=St(e.renderState,!0);n.cull.enabled=!0,n.cull.face=mr.FRONT,n.colorMask={red:!1,green:!1,blue:!1,alpha:!1},n.polygonOffset={enabled:!0,factor:5,units:5};const i=St(t.uniformMap),o=new $(5,5);return i.u_polygonOffset=function(){return o},t.renderState=ht.fromCache(n),t.uniformMap=i,t.castShadows=!1,t.receiveShadows=!1,t}function itt(e){const t=Dt.shallowClone(e),n=St(e.renderState,!0);return n.stencilTest.enabled=!0,n.stencilTest.mask=Kt.SKIP_LOD_MASK,n.stencilTest.reference=Kt.CESIUM_3D_TILE_MASK,n.stencilTest.frontFunction=Ni.GREATER_OR_EQUAL,n.stencilTest.frontOperation.zPass=It.REPLACE,n.stencilTest.backFunction=Ni.GREATER_OR_EQUAL,n.stencilTest.backOperation.zPass=It.REPLACE,n.stencilMask=Kt.CESIUM_3D_TILE_MASK|Kt.SKIP_LOD_MASK,t.renderState=ht.fromCache(n),t}function ott(e,t){const n=e.shaderBuilder;n.addVertexLines(Fet),n.addFragmentLines(Met);const i=rtt(e),o=new Fo({context:t.context,indexBuffer:i,attributes:e.attributes}),r=e.model;r._pipelineResources.push(o);const s=n.buildShaderProgram(t.context);r._pipelineResources.push(s);const a=e.alphaOptions.pass,c=r.sceneGraph,u=t.mode===me.SCENE3D;let f,h;if(!u&&!t.scene3DOnly&&r._projectTo2D)f=N.multiplyTransformation(c._computedModelMatrix,e.runtimeNode.computedTransform,new N),h=e.runtimePrimitive.boundingSphere2D;else{const x=u?c._computedModelMatrix:c._computedModelMatrix2D;f=N.multiplyTransformation(x,e.runtimeNode.computedTransform,new N),h=Ae.transform(e.boundingSphere,f,e.boundingSphere)}let _=St(ht.fromCache(e.renderStateOptions),!0);_.cull.face=gn.getCullFace(f,e.primitiveType),_=ht.fromCache(_);const g=l(r.classificationType),p=g?!1:sr.castShadows(r.shadows),y=g?!1:sr.receiveShadows(r.shadows),T=g?void 0:e.pickId,b=new Dt({boundingVolume:h,modelMatrix:f,uniformMap:e.uniformMap,renderState:_,vertexArray:o,shaderProgram:s,cull:r.cull,pass:a,count:e.count,owner:r,pickId:T,instanceCount:e.instanceCount,primitiveType:e.primitiveType,debugShowBoundingVolume:r.debugShowBoundingVolume,castShadows:p,receiveShadows:y});return g?new EU({primitiveRenderResources:e,command:b}):new PP({primitiveRenderResources:e,command:b})}function rtt(e){const t=e.wireframeIndexBuffer;if(l(t))return t;const n=e.indices;if(l(n)){if(!l(n.buffer))throw new w("Indices must be provided as a Buffer");return n.buffer}}const Hne={name:"TilesetPipelineStage"};Hne.process=function(e,t,n){if(t.hasSkipLevelOfDetail(n)){e.shaderBuilder.addDefine("POLYGON_OFFSET",void 0,Re.FRAGMENT);const r={u_polygonOffset:function(){return $.ZERO}};e.uniformMap=Ln(r,e.uniformMap),e.hasSkipLevelOfDetail=!0}const i=e.renderStateOptions;i.stencilTest=Kt.setCesium3DTileBit(),i.stencilMask=Kt.CESIUM_3D_TILE_MASK};const stt=Hne,att=`vec3 proceduralIBL(
|
||
vec3 positionEC,
|
||
vec3 normalEC,
|
||
vec3 lightDirectionEC,
|
||
vec3 lightColorHdr,
|
||
czm_pbrParameters pbrParameters
|
||
) {
|
||
vec3 v = -positionEC;
|
||
vec3 positionWC = vec3(czm_inverseView * vec4(positionEC, 1.0));
|
||
vec3 vWC = -normalize(positionWC);
|
||
vec3 l = normalize(lightDirectionEC);
|
||
vec3 n = normalEC;
|
||
vec3 r = normalize(czm_inverseViewRotation * normalize(reflect(v, n)));
|
||
|
||
float NdotL = clamp(dot(n, l), 0.001, 1.0);
|
||
float NdotV = abs(dot(n, v)) + 0.001;
|
||
|
||
// Figure out if the reflection vector hits the ellipsoid
|
||
float vertexRadius = length(positionWC);
|
||
float horizonDotNadir = 1.0 - min(1.0, czm_ellipsoidRadii.x / vertexRadius);
|
||
float reflectionDotNadir = dot(r, normalize(positionWC));
|
||
// Flipping the X vector is a cheap way to get the inverse of czm_temeToPseudoFixed, since that's a rotation about Z.
|
||
r.x = -r.x;
|
||
r = -normalize(czm_temeToPseudoFixed * r);
|
||
r.x = -r.x;
|
||
|
||
vec3 diffuseColor = pbrParameters.diffuseColor;
|
||
float roughness = pbrParameters.roughness;
|
||
vec3 specularColor = pbrParameters.f0;
|
||
|
||
float inverseRoughness = 1.04 - roughness;
|
||
inverseRoughness *= inverseRoughness;
|
||
vec3 sceneSkyBox = textureCube(czm_environmentMap, r).rgb * inverseRoughness;
|
||
|
||
float atmosphereHeight = 0.05;
|
||
float blendRegionSize = 0.1 * ((1.0 - inverseRoughness) * 8.0 + 1.1 - horizonDotNadir);
|
||
float blendRegionOffset = roughness * -1.0;
|
||
float farAboveHorizon = clamp(horizonDotNadir - blendRegionSize * 0.5 + blendRegionOffset, 1.0e-10 - blendRegionSize, 0.99999);
|
||
float aroundHorizon = clamp(horizonDotNadir + blendRegionSize * 0.5, 1.0e-10 - blendRegionSize, 0.99999);
|
||
float farBelowHorizon = clamp(horizonDotNadir + blendRegionSize * 1.5, 1.0e-10 - blendRegionSize, 0.99999);
|
||
float smoothstepHeight = smoothstep(0.0, atmosphereHeight, horizonDotNadir);
|
||
vec3 belowHorizonColor = mix(vec3(0.1, 0.15, 0.25), vec3(0.4, 0.7, 0.9), smoothstepHeight);
|
||
vec3 nadirColor = belowHorizonColor * 0.5;
|
||
vec3 aboveHorizonColor = mix(vec3(0.9, 1.0, 1.2), belowHorizonColor, roughness * 0.5);
|
||
vec3 blueSkyColor = mix(vec3(0.18, 0.26, 0.48), aboveHorizonColor, reflectionDotNadir * inverseRoughness * 0.5 + 0.75);
|
||
vec3 zenithColor = mix(blueSkyColor, sceneSkyBox, smoothstepHeight);
|
||
vec3 blueSkyDiffuseColor = vec3(0.7, 0.85, 0.9);
|
||
float diffuseIrradianceFromEarth = (1.0 - horizonDotNadir) * (reflectionDotNadir * 0.25 + 0.75) * smoothstepHeight;
|
||
float diffuseIrradianceFromSky = (1.0 - smoothstepHeight) * (1.0 - (reflectionDotNadir * 0.25 + 0.25));
|
||
vec3 diffuseIrradiance = blueSkyDiffuseColor * clamp(diffuseIrradianceFromEarth + diffuseIrradianceFromSky, 0.0, 1.0);
|
||
float notDistantRough = (1.0 - horizonDotNadir * roughness * 0.8);
|
||
vec3 specularIrradiance = mix(zenithColor, aboveHorizonColor, smoothstep(farAboveHorizon, aroundHorizon, reflectionDotNadir) * notDistantRough);
|
||
specularIrradiance = mix(specularIrradiance, belowHorizonColor, smoothstep(aroundHorizon, farBelowHorizon, reflectionDotNadir) * inverseRoughness);
|
||
specularIrradiance = mix(specularIrradiance, nadirColor, smoothstep(farBelowHorizon, 1.0, reflectionDotNadir) * inverseRoughness);
|
||
|
||
// Luminance model from page 40 of http://silviojemma.com/public/papers/lighting/spherical-harmonic-lighting.pdf
|
||
#ifdef USE_SUN_LUMINANCE
|
||
// Angle between sun and zenith
|
||
float LdotZenith = clamp(dot(normalize(czm_inverseViewRotation * l), vWC), 0.001, 1.0);
|
||
float S = acos(LdotZenith);
|
||
// Angle between zenith and current pixel
|
||
float NdotZenith = clamp(dot(normalize(czm_inverseViewRotation * n), vWC), 0.001, 1.0);
|
||
// Angle between sun and current pixel
|
||
float gamma = acos(NdotL);
|
||
float numerator = ((0.91 + 10.0 * exp(-3.0 * gamma) + 0.45 * pow(NdotL, 2.0)) * (1.0 - exp(-0.32 / NdotZenith)));
|
||
float denominator = (0.91 + 10.0 * exp(-3.0 * S) + 0.45 * pow(LdotZenith,2.0)) * (1.0 - exp(-0.32));
|
||
float luminance = model_luminanceAtZenith * (numerator / denominator);
|
||
#endif
|
||
|
||
vec2 brdfLut = texture2D(czm_brdfLut, vec2(NdotV, roughness)).rg;
|
||
vec3 iblColor = (diffuseIrradiance * diffuseColor * model_iblFactor.x) + (specularIrradiance * czm_srgbToLinear(specularColor * brdfLut.x + brdfLut.y) * model_iblFactor.y);
|
||
float maximumComponent = max(max(lightColorHdr.x, lightColorHdr.y), lightColorHdr.z);
|
||
vec3 lightColor = lightColorHdr / max(maximumComponent, 1.0);
|
||
iblColor *= lightColor;
|
||
|
||
#ifdef USE_SUN_LUMINANCE
|
||
iblColor *= luminance;
|
||
#endif
|
||
|
||
return iblColor;
|
||
}
|
||
|
||
#if defined(DIFFUSE_IBL) || defined(SPECULAR_IBL)
|
||
vec3 textureIBL(
|
||
vec3 positionEC,
|
||
vec3 normalEC,
|
||
vec3 lightDirectionEC,
|
||
czm_pbrParameters pbrParameters
|
||
) {
|
||
vec3 diffuseColor = pbrParameters.diffuseColor;
|
||
float roughness = pbrParameters.roughness;
|
||
vec3 specularColor = pbrParameters.f0;
|
||
|
||
vec3 v = -positionEC;
|
||
vec3 n = normalEC;
|
||
vec3 l = normalize(lightDirectionEC);
|
||
vec3 h = normalize(v + l);
|
||
|
||
float NdotV = abs(dot(n, v)) + 0.001;
|
||
float VdotH = clamp(dot(v, h), 0.0, 1.0);
|
||
|
||
const mat3 yUpToZUp = mat3(
|
||
-1.0, 0.0, 0.0,
|
||
0.0, 0.0, -1.0,
|
||
0.0, 1.0, 0.0
|
||
);
|
||
vec3 cubeDir = normalize(yUpToZUp * model_iblReferenceFrameMatrix * normalize(reflect(-v, n)));
|
||
|
||
#ifdef DIFFUSE_IBL
|
||
#ifdef CUSTOM_SPHERICAL_HARMONICS
|
||
vec3 diffuseIrradiance = czm_sphericalHarmonics(cubeDir, model_sphericalHarmonicCoefficients);
|
||
#else
|
||
vec3 diffuseIrradiance = czm_sphericalHarmonics(cubeDir, czm_sphericalHarmonicCoefficients);
|
||
#endif
|
||
#else
|
||
vec3 diffuseIrradiance = vec3(0.0);
|
||
#endif
|
||
|
||
#ifdef SPECULAR_IBL
|
||
vec3 r0 = specularColor.rgb;
|
||
float reflectance = max(max(r0.r, r0.g), r0.b);
|
||
vec3 r90 = vec3(clamp(reflectance * 25.0, 0.0, 1.0));
|
||
vec3 F = fresnelSchlick2(r0, r90, VdotH);
|
||
|
||
vec2 brdfLut = texture2D(czm_brdfLut, vec2(NdotV, roughness)).rg;
|
||
#ifdef CUSTOM_SPECULAR_IBL
|
||
vec3 specularIBL = czm_sampleOctahedralProjection(model_specularEnvironmentMaps, model_specularEnvironmentMapsSize, cubeDir, roughness * model_specularEnvironmentMapsMaximumLOD, model_specularEnvironmentMapsMaximumLOD);
|
||
#else
|
||
vec3 specularIBL = czm_sampleOctahedralProjection(czm_specularEnvironmentMaps, czm_specularEnvironmentMapSize, cubeDir, roughness * czm_specularEnvironmentMapsMaximumLOD, czm_specularEnvironmentMapsMaximumLOD);
|
||
#endif
|
||
specularIBL *= F * brdfLut.x + brdfLut.y;
|
||
#else
|
||
vec3 specularIBL = vec3(0.0);
|
||
#endif
|
||
|
||
return diffuseColor * diffuseIrradiance + specularColor * specularIBL;
|
||
}
|
||
#endif
|
||
|
||
vec3 imageBasedLightingStage(
|
||
vec3 positionEC,
|
||
vec3 normalEC,
|
||
vec3 lightDirectionEC,
|
||
vec3 lightColorHdr,
|
||
czm_pbrParameters pbrParameters
|
||
) {
|
||
#if defined(DIFFUSE_IBL) || defined(SPECULAR_IBL)
|
||
// Environment maps were provided, use them for IBL
|
||
return textureIBL(
|
||
positionEC,
|
||
normalEC,
|
||
lightDirectionEC,
|
||
pbrParameters
|
||
);
|
||
#else
|
||
// Use the procedural IBL if there are no environment maps
|
||
return proceduralIBL(
|
||
positionEC,
|
||
normalEC,
|
||
lightDirectionEC,
|
||
lightColorHdr,
|
||
pbrParameters
|
||
);
|
||
#endif
|
||
}`,Vne={name:"ImageBasedLightingPipelineStage"};Vne.process=function(e,t,n){const i=t.imageBasedLighting,o=e.shaderBuilder;o.addDefine("USE_IBL_LIGHTING",void 0,Re.FRAGMENT),o.addUniform("vec2","model_iblFactor",Re.FRAGMENT),gf.isSupported(n.context)&&((i.useSphericalHarmonics||i.useSpecularEnvironmentMaps||i.enabled)&&o.addUniform("mat3","model_iblReferenceFrameMatrix",Re.FRAGMENT),l(i.sphericalHarmonicCoefficients)?(o.addDefine("DIFFUSE_IBL",void 0,Re.FRAGMENT),o.addDefine("CUSTOM_SPHERICAL_HARMONICS",void 0,Re.FRAGMENT),o.addUniform("vec3","model_sphericalHarmonicCoefficients[9]",Re.FRAGMENT)):i.useDefaultSphericalHarmonics&&o.addDefine("DIFFUSE_IBL",void 0,Re.FRAGMENT),l(i.specularEnvironmentMapAtlas)&&i.specularEnvironmentMapAtlas.ready?(o.addDefine("SPECULAR_IBL",void 0,Re.FRAGMENT),o.addDefine("CUSTOM_SPECULAR_IBL",void 0,Re.FRAGMENT),o.addUniform("sampler2D","model_specularEnvironmentMaps",Re.FRAGMENT),o.addUniform("vec2","model_specularEnvironmentMapsSize",Re.FRAGMENT),o.addUniform("float","model_specularEnvironmentMapsMaximumLOD",Re.FRAGMENT)):t.useDefaultSpecularMaps&&o.addDefine("SPECULAR_IBL",void 0,Re.FRAGMENT)),l(i.luminanceAtZenith)&&(o.addDefine("USE_SUN_LUMINANCE",void 0,Re.FRAGMENT),o.addUniform("float","model_luminanceAtZenith",Re.FRAGMENT)),o.addFragmentLines(att);const r={model_iblFactor:function(){return i.imageBasedLightingFactor},model_iblReferenceFrameMatrix:function(){return t._iblReferenceFrameMatrix},model_luminanceAtZenith:function(){return i.luminanceAtZenith},model_sphericalHarmonicCoefficients:function(){return i.sphericalHarmonicCoefficients},model_specularEnvironmentMaps:function(){return i.specularEnvironmentMapAtlas.texture},model_specularEnvironmentMapsSize:function(){return i.specularEnvironmentMapAtlas.texture.dimensions},model_specularEnvironmentMapsMaximumLOD:function(){return i.specularEnvironmentMapAtlas.maximumMipmapLevel}};e.uniformMap=Ln(r,e.uniformMap)};const ctt=Vne,ltt=F.EPSILON16;function xU(e){e=A(e,A.EMPTY_OBJECT);const t=e.stage,n=e.runtimeArticulation;E.typeOf.object("options.stage",t),E.typeOf.object("options.runtimeArticulation",n),this._stage=t,this._runtimeArticulation=n,this._name=t.name,this._type=t.type,this._minimumValue=t.minimumValue,this._maximumValue=t.maximumValue,this._currentValue=t.initialValue}Object.defineProperties(xU.prototype,{stage:{get:function(){return this._stage}},runtimeArticulation:{get:function(){return this._runtimeArticulation}},name:{get:function(){return this._name}},type:{get:function(){return this._type}},minimumValue:{get:function(){return this._minimumValue}},maximumValue:{get:function(){return this._maximumValue}},currentValue:{get:function(){return this._currentValue},set:function(e){E.typeOf.number("value",e),e=F.clamp(e,this.minimumValue,this.maximumValue),F.equalsEpsilon(this._currentValue,e,ltt)||(this._currentValue=e,this.runtimeArticulation._dirty=!0)}}});const utt=new d,FR=new te;xU.prototype.applyStageToMatrix=function(e){E.typeOf.object("result",e);const t=this.type,n=this.currentValue,i=utt;let o;switch(t){case Gu.XROTATE:o=te.fromRotationX(F.toRadians(n),FR),e=N.multiplyByMatrix3(e,o,e);break;case Gu.YROTATE:o=te.fromRotationY(F.toRadians(n),FR),e=N.multiplyByMatrix3(e,o,e);break;case Gu.ZROTATE:o=te.fromRotationZ(F.toRadians(n),FR),e=N.multiplyByMatrix3(e,o,e);break;case Gu.XTRANSLATE:i.x=n,i.y=0,i.z=0,e=N.multiplyByTranslation(e,i,e);break;case Gu.YTRANSLATE:i.x=0,i.y=n,i.z=0,e=N.multiplyByTranslation(e,i,e);break;case Gu.ZTRANSLATE:i.x=0,i.y=0,i.z=n,e=N.multiplyByTranslation(e,i,e);break;case Gu.XSCALE:i.x=n,i.y=1,i.z=1,e=N.multiplyByScale(e,i,e);break;case Gu.YSCALE:i.x=1,i.y=n,i.z=1,e=N.multiplyByScale(e,i,e);break;case Gu.ZSCALE:i.x=1,i.y=1,i.z=n,e=N.multiplyByScale(e,i,e);break;case Gu.UNIFORMSCALE:e=N.multiplyByUniformScale(e,n,e);break}return e};function OP(e){e=A(e,A.EMPTY_OBJECT);const t=e.articulation,n=e.sceneGraph;E.typeOf.object("options.articulation",t),E.typeOf.object("options.sceneGraph",n),this._articulation=t,this._sceneGraph=n,this._name=t.name,this._runtimeStages=[],this._runtimeStagesByName={},this._runtimeNodes=[],this._dirty=!0,ftt(this)}Object.defineProperties(OP.prototype,{articulation:{get:function(){return this._articulation}},sceneGraph:{get:function(){return this._sceneGraph}},name:{get:function(){return this._name}},runtimeStages:{get:function(){return this._runtimeStages}},runtimeNodes:{get:function(){return this._runtimeNodes}}});function ftt(e){const n=e.articulation.stages,i=n.length,o=e._runtimeStages,r=e._runtimeStagesByName;for(let s=0;s<i;s++){const a=n[s],c=new xU({stage:a,runtimeArticulation:e});o.push(c);const u=a.name;r[u]=c}}OP.prototype.setArticulationStage=function(e,t){const n=this._runtimeStagesByName[e];l(n)&&(n.currentValue=t)};const dtt=new N,htt=new N;OP.prototype.apply=function(){if(!this._dirty)return;this._dirty=!1;let e=N.clone(N.IDENTITY,dtt),t;const n=this._runtimeStages,i=n.length;for(t=0;t<i;t++)e=n[t].applyStageToMatrix(e);const o=this._runtimeNodes,r=o.length;for(t=0;t<r;t++){const s=o[t],a=N.multiplyTransformation(s.originalTransform,e,htt);s.transform=a}};const ptt=`void modelColorStage(inout czm_modelMaterial material)
|
||
{
|
||
material.diffuse = mix(material.diffuse, model_color.rgb, model_colorBlend);
|
||
float highlight = ceil(model_colorBlend);
|
||
material.diffuse *= mix(model_color.rgb, vec3(1.0), highlight);
|
||
material.alpha *= model_color.a;
|
||
}`,nA={name:"ModelColorPipelineStage",COLOR_UNIFORM_NAME:"model_color",COLOR_BLEND_UNIFORM_NAME:"model_colorBlend"};nA.process=function(e,t,n){const i=e.shaderBuilder;i.addDefine("HAS_MODEL_COLOR",void 0,Re.FRAGMENT),i.addFragmentLines(ptt);const o={},r=t.color;r.alpha===0&&!t.hasSilhouette(n)&&(e.renderStateOptions.colorMask={red:!1,green:!1,blue:!1,alpha:!1}),r.alpha<1&&(e.alphaOptions.pass=We.TRANSLUCENT),i.addUniform("vec4",nA.COLOR_UNIFORM_NAME,Re.FRAGMENT),o[nA.COLOR_UNIFORM_NAME]=function(){return t.color},i.addUniform("float",nA.COLOR_BLEND_UNIFORM_NAME,Re.FRAGMENT),o[nA.COLOR_BLEND_UNIFORM_NAME]=function(){return vP.getColorBlend(t.colorBlendMode,t.colorBlendAmount)},e.uniformMap=Ln(o,e.uniformMap)};const t2=nA,mtt=`#ifdef USE_CLIPPING_PLANES_FLOAT_TEXTURE
|
||
vec4 getClippingPlane(
|
||
highp sampler2D packedClippingPlanes,
|
||
int clippingPlaneNumber,
|
||
mat4 transform
|
||
) {
|
||
int pixY = clippingPlaneNumber / CLIPPING_PLANES_TEXTURE_WIDTH;
|
||
int pixX = clippingPlaneNumber - (pixY * CLIPPING_PLANES_TEXTURE_WIDTH);
|
||
float pixelWidth = 1.0 / float(CLIPPING_PLANES_TEXTURE_WIDTH);
|
||
float pixelHeight = 1.0 / float(CLIPPING_PLANES_TEXTURE_HEIGHT);
|
||
float u = (float(pixX) + 0.5) * pixelWidth; // sample from center of pixel
|
||
float v = (float(pixY) + 0.5) * pixelHeight;
|
||
vec4 plane = texture2D(packedClippingPlanes, vec2(u, v));
|
||
return czm_transformPlane(plane, transform);
|
||
}
|
||
#else
|
||
// Handle uint8 clipping texture instead
|
||
vec4 getClippingPlane(
|
||
highp sampler2D packedClippingPlanes,
|
||
int clippingPlaneNumber,
|
||
mat4 transform
|
||
) {
|
||
int clippingPlaneStartIndex = clippingPlaneNumber * 2; // clipping planes are two pixels each
|
||
int pixY = clippingPlaneStartIndex / CLIPPING_PLANES_TEXTURE_WIDTH;
|
||
int pixX = clippingPlaneStartIndex - (pixY * CLIPPING_PLANES_TEXTURE_WIDTH);
|
||
float pixelWidth = 1.0 / float(CLIPPING_PLANES_TEXTURE_WIDTH);
|
||
float pixelHeight = 1.0 / float(CLIPPING_PLANES_TEXTURE_HEIGHT);
|
||
float u = (float(pixX) + 0.5) * pixelWidth; // sample from center of pixel
|
||
float v = (float(pixY) + 0.5) * pixelHeight;
|
||
vec4 oct32 = texture2D(packedClippingPlanes, vec2(u, v)) * 255.0;
|
||
vec2 oct = vec2(oct32.x * 256.0 + oct32.y, oct32.z * 256.0 + oct32.w);
|
||
vec4 plane;
|
||
plane.xyz = czm_octDecode(oct, 65535.0);
|
||
plane.w = czm_unpackFloat(texture2D(packedClippingPlanes, vec2(u + pixelWidth, v)));
|
||
return czm_transformPlane(plane, transform);
|
||
}
|
||
#endif
|
||
|
||
float clip(vec4 fragCoord, sampler2D clippingPlanes, mat4 clippingPlanesMatrix) {
|
||
vec4 position = czm_windowToEyeCoordinates(fragCoord);
|
||
vec3 clipNormal = vec3(0.0);
|
||
vec3 clipPosition = vec3(0.0);
|
||
float pixelWidth = czm_metersPerPixel(position);
|
||
|
||
#ifdef UNION_CLIPPING_REGIONS
|
||
float clipAmount; // For union planes, we want to get the min distance. So we set the initial value to the first plane distance in the loop below.
|
||
#else
|
||
float clipAmount = 0.0;
|
||
bool clipped = true;
|
||
#endif
|
||
|
||
for (int i = 0; i < CLIPPING_PLANES_LENGTH; ++i) {
|
||
vec4 clippingPlane = getClippingPlane(clippingPlanes, i, clippingPlanesMatrix);
|
||
clipNormal = clippingPlane.xyz;
|
||
clipPosition = -clippingPlane.w * clipNormal;
|
||
float amount = dot(clipNormal, (position.xyz - clipPosition)) / pixelWidth;
|
||
|
||
#ifdef UNION_CLIPPING_REGIONS
|
||
clipAmount = czm_branchFreeTernary(i == 0, amount, min(amount, clipAmount));
|
||
if (amount <= 0.0) {
|
||
discard;
|
||
}
|
||
#else
|
||
clipAmount = max(amount, clipAmount);
|
||
clipped = clipped && (amount <= 0.0);
|
||
#endif
|
||
}
|
||
|
||
#ifndef UNION_CLIPPING_REGIONS
|
||
if (clipped) {
|
||
discard;
|
||
}
|
||
#endif
|
||
|
||
return clipAmount;
|
||
}
|
||
|
||
void modelClippingPlanesStage(inout vec4 color)
|
||
{
|
||
float clipDistance = clip(gl_FragCoord, model_clippingPlanes, model_clippingPlanesMatrix);
|
||
vec4 clippingPlanesEdgeColor = vec4(1.0);
|
||
clippingPlanesEdgeColor.rgb = model_clippingPlanesEdgeStyle.rgb;
|
||
float clippingPlanesEdgeWidth = model_clippingPlanesEdgeStyle.a;
|
||
|
||
if (clipDistance > 0.0 && clipDistance < clippingPlanesEdgeWidth) {
|
||
color = clippingPlanesEdgeColor;
|
||
}
|
||
}
|
||
`,kne={name:"ModelClippingPlanesPipelineStage"},_tt=new $;kne.process=function(e,t,n){const i=t.clippingPlanes,o=n.context,r=e.shaderBuilder;r.addDefine("HAS_CLIPPING_PLANES",void 0,Re.FRAGMENT),r.addDefine("CLIPPING_PLANES_LENGTH",i.length,Re.FRAGMENT),i.unionClippingRegions&&r.addDefine("UNION_CLIPPING_REGIONS",void 0,Re.FRAGMENT),rr.useFloatTexture(o)&&r.addDefine("USE_CLIPPING_PLANES_FLOAT_TEXTURE",void 0,Re.FRAGMENT);const s=rr.getTextureResolution(i,o,_tt);r.addDefine("CLIPPING_PLANES_TEXTURE_WIDTH",s.x,Re.FRAGMENT),r.addDefine("CLIPPING_PLANES_TEXTURE_HEIGHT",s.y,Re.FRAGMENT),r.addUniform("sampler2D","model_clippingPlanes",Re.FRAGMENT),r.addUniform("vec4","model_clippingPlanesEdgeStyle",Re.FRAGMENT),r.addUniform("mat4","model_clippingPlanesMatrix",Re.FRAGMENT),r.addFragmentLines(mtt);const a={model_clippingPlanes:function(){return i.texture},model_clippingPlanesEdgeStyle:function(){const c=k.clone(i.edgeColor);return c.alpha=i.edgeWidth,c},model_clippingPlanesMatrix:function(){return t._clippingPlanesMatrix}};e.uniformMap=Ln(a,e.uniformMap)};const gtt=kne;function Gne(e,t){E.typeOf.object("model",e),E.typeOf.object("runtimeNode",t),this._model=e,this._runtimeNode=t}Object.defineProperties(Gne.prototype,{name:{get:function(){return this._runtimeNode._name}},id:{get:function(){return this._runtimeNode._id}},show:{get:function(){return this._runtimeNode.show},set:function(e){this._runtimeNode.show=e}},matrix:{get:function(){return this._runtimeNode.transform},set:function(e){l(e)?(this._runtimeNode.transform=e,this._runtimeNode.userAnimated=!0,this._model._userAnimationDirty=!0):(this._runtimeNode.transform=this.originalMatrix,this._runtimeNode.userAnimated=!1)}},originalMatrix:{get:function(){return this._runtimeNode.originalTransform}}});const ytt=`mat4 getInstancingTransform()
|
||
{
|
||
mat4 instancingTransform;
|
||
|
||
#ifdef HAS_INSTANCE_MATRICES
|
||
instancingTransform = mat4(
|
||
a_instancingTransformRow0.x, a_instancingTransformRow1.x, a_instancingTransformRow2.x, 0.0, // Column 1
|
||
a_instancingTransformRow0.y, a_instancingTransformRow1.y, a_instancingTransformRow2.y, 0.0, // Column 2
|
||
a_instancingTransformRow0.z, a_instancingTransformRow1.z, a_instancingTransformRow2.z, 0.0, // Column 3
|
||
a_instancingTransformRow0.w, a_instancingTransformRow1.w, a_instancingTransformRow2.w, 1.0 // Column 4
|
||
);
|
||
#else
|
||
vec3 translation = vec3(0.0, 0.0, 0.0);
|
||
vec3 scale = vec3(1.0, 1.0, 1.0);
|
||
|
||
#ifdef HAS_INSTANCE_TRANSLATION
|
||
translation = a_instanceTranslation;
|
||
#endif
|
||
#ifdef HAS_INSTANCE_SCALE
|
||
scale = a_instanceScale;
|
||
#endif
|
||
|
||
instancingTransform = mat4(
|
||
scale.x, 0.0, 0.0, 0.0,
|
||
0.0, scale.y, 0.0, 0.0,
|
||
0.0, 0.0, scale.z, 0.0,
|
||
translation.x, translation.y, translation.z, 1.0
|
||
);
|
||
#endif
|
||
|
||
return instancingTransform;
|
||
}
|
||
|
||
#ifdef USE_2D_INSTANCING
|
||
mat4 getInstancingTransform2D()
|
||
{
|
||
mat4 instancingTransform2D;
|
||
|
||
#ifdef HAS_INSTANCE_MATRICES
|
||
instancingTransform2D = mat4(
|
||
a_instancingTransform2DRow0.x, a_instancingTransform2DRow1.x, a_instancingTransform2DRow2.x, 0.0, // Column 1
|
||
a_instancingTransform2DRow0.y, a_instancingTransform2DRow1.y, a_instancingTransform2DRow2.y, 0.0, // Column 2
|
||
a_instancingTransform2DRow0.z, a_instancingTransform2DRow1.z, a_instancingTransform2DRow2.z, 0.0, // Column 3
|
||
a_instancingTransform2DRow0.w, a_instancingTransform2DRow1.w, a_instancingTransform2DRow2.w, 1.0 // Column 4
|
||
);
|
||
#else
|
||
vec3 translation2D = vec3(0.0, 0.0, 0.0);
|
||
vec3 scale = vec3(1.0, 1.0, 1.0);
|
||
|
||
#ifdef HAS_INSTANCE_TRANSLATION
|
||
translation2D = a_instanceTranslation2D;
|
||
#endif
|
||
#ifdef HAS_INSTANCE_SCALE
|
||
scale = a_instanceScale;
|
||
#endif
|
||
|
||
instancingTransform2D = mat4(
|
||
scale.x, 0.0, 0.0, 0.0,
|
||
0.0, scale.y, 0.0, 0.0,
|
||
0.0, 0.0, scale.z, 0.0,
|
||
translation2D.x, translation2D.y, translation2D.z, 1.0
|
||
);
|
||
#endif
|
||
|
||
return instancingTransform2D;
|
||
}
|
||
#endif
|
||
`,Att=`void instancingStage(inout ProcessedAttributes attributes)
|
||
{
|
||
vec3 positionMC = attributes.positionMC;
|
||
|
||
mat4 instancingTransform = getInstancingTransform();
|
||
|
||
attributes.positionMC = (instancingTransform * vec4(positionMC, 1.0)).xyz;
|
||
|
||
#ifdef HAS_NORMALS
|
||
vec3 normalMC = attributes.normalMC;
|
||
attributes.normalMC = (instancingTransform * vec4(normalMC, 0.0)).xyz;
|
||
#endif
|
||
|
||
#ifdef USE_2D_INSTANCING
|
||
mat4 instancingTransform2D = getInstancingTransform2D();
|
||
attributes.position2D = (instancingTransform2D * vec4(positionMC, 1.0)).xyz;
|
||
#endif
|
||
}
|
||
`,Ttt=`void legacyInstancingStage(
|
||
inout ProcessedAttributes attributes,
|
||
out mat4 instanceModelView,
|
||
out mat3 instanceModelViewInverseTranspose)
|
||
{
|
||
vec3 positionMC = attributes.positionMC;
|
||
|
||
mat4 instancingTransform = getInstancingTransform();
|
||
|
||
mat4 instanceModel = instancingTransform * u_instance_nodeTransform;
|
||
instanceModelView = u_instance_modifiedModelView;
|
||
instanceModelViewInverseTranspose = mat3(u_instance_modifiedModelView * instanceModel);
|
||
|
||
attributes.positionMC = (instanceModel * vec4(positionMC, 1.0)).xyz;
|
||
|
||
#ifdef USE_2D_INSTANCING
|
||
mat4 instancingTransform2D = getInstancingTransform2D();
|
||
attributes.position2D = (instancingTransform2D * vec4(positionMC, 1.0)).xyz;
|
||
#endif
|
||
}
|
||
`,Lv=new N,Ctt=new N,btt=new N,Wne={name:"InstancingPipelineStage",_getInstanceTransformsAsMatrices:Xne,_transformsToTypedArray:n2};Wne.process=function(e,t,n){const i=t.instances,o=i.attributes[0].count,r=e.shaderBuilder;r.addDefine("HAS_INSTANCING"),r.addVertexLines(ytt);const s=e.model,a=s.sceneGraph,c=e.runtimeNode,u=n.mode!==me.SCENE3D&&!n.scene3DOnly&&s._projectTo2D,f=[];Rtt(e,n,i,f,u),Ftt(e,n,i,f);const h={};if(i.transformInWorldSpace?(r.addDefine("USE_LEGACY_INSTANCING",void 0,Re.VERTEX),r.addUniform("mat4","u_instance_modifiedModelView",Re.VERTEX),r.addUniform("mat4","u_instance_nodeTransform",Re.VERTEX),h.u_instance_modifiedModelView=function(){let _=N.multiplyTransformation(s.modelMatrix,a.components.transform,Lv);return u?N.multiplyTransformation(n.context.uniformState.view3D,_,Lv):(n.mode!==me.SCENE3D&&(_=En.basisTo2D(n.mapProjection,_,Lv)),N.multiplyTransformation(n.context.uniformState.view,_,Lv))},h.u_instance_nodeTransform=function(){return N.multiplyTransformation(a.axisCorrectionMatrix,c.computedTransform,Ctt)},r.addVertexLines(Ttt)):r.addVertexLines(Att),u){r.addDefine("USE_2D_INSTANCING",void 0,Re.VERTEX),r.addUniform("mat4","u_modelView2D",Re.VERTEX);const _=n.context,g=N.fromTranslation(c.instancingReferencePoint2D,new N);h.u_modelView2D=function(){return N.multiplyTransformation(_.uniformState.view,g,btt)}}e.uniformMap=Ln(h,e.uniformMap),e.instanceCount=o,e.attributes.push.apply(e.attributes,f)};const Qb=new N,Ett=new d;function xtt(e,t,n,i,o){let r=N.multiplyTransformation(t,e,Qb);return r=N.multiplyTransformation(r,n,Qb),o=En.basisTo2D(i.mapProjection,r,o),o}function wtt(e,t,n,i,o){const r=N.fromTranslation(e,Qb);let s=N.multiplyTransformation(t,r,Qb);s=N.multiplyTransformation(s,n,Qb);const a=N.getTranslation(s,Ett);return o=es.computeActualWgs84Position(i,a,o),o}function qne(e,t,n){const i=e.model,o=i.sceneGraph;e.runtimeNode.node.instances.transformInWorldSpace?(t=N.multiplyTransformation(i.modelMatrix,o.components.transform,t),n=N.multiplyTransformation(o.axisCorrectionMatrix,e.runtimeNode.computedTransform,n)):(t=N.clone(o.computedModelMatrix,t),t=N.multiplyTransformation(t,e.runtimeNode.computedTransform,t),n=N.clone(N.IDENTITY,n))}const jne=new N,Yne=new N,Stt=new N,vtt=new d;function Dtt(e,t,n,i){const o=jne,r=Yne;qne(t,o,r);const a=t.runtimeNode.instancingReferencePoint2D,c=e.length;for(let u=0;u<c;u++){const f=e[u],h=xtt(f,o,r,n,Stt),_=N.getTranslation(h,vtt),g=d.subtract(_,a,_);i[u]=N.setTranslation(h,g,i[u])}return i}function Itt(e,t,n,i){const o=jne,r=Yne;qne(t,o,r);const a=t.runtimeNode.instancingReferencePoint2D,c=e.length;for(let u=0;u<c;u++){const f=e[u],h=wtt(f,o,r,n,f);i[u]=d.subtract(h,a,i[u])}return i}const Ptt=new d,Ott=new d;function $ne(e,t){const n=e.runtimeNode,i=e.model.sceneGraph.computedModelMatrix,o=N.multiplyByPoint(i,n.instancingTranslationMin,Ptt),r=es.computeActualWgs84Position(t,o,o),s=N.multiplyByPoint(i,n.instancingTranslationMax,Ott),a=es.computeActualWgs84Position(t,s,s);n.instancingReferencePoint2D=d.lerp(r,a,.5,new d)}function n2(e){const n=e.length,i=new Float32Array(n*12);for(let o=0;o<n;o++){const r=e[o],s=12*o;i[s+0]=r[0],i[s+1]=r[4],i[s+2]=r[8],i[s+3]=r[12],i[s+4]=r[1],i[s+5]=r[5],i[s+6]=r[9],i[s+7]=r[13],i[s+8]=r[2],i[s+9]=r[6],i[s+10]=r[10],i[s+11]=r[14]}return i}function Ltt(e){const n=e.length,i=new Float32Array(n*3);for(let o=0;o<n;o++){const r=e[o],s=3*o;i[s+0]=r[0],i[s+1]=r[4],i[s+2]=r[8]}return i}new d;new De;new d;function Xne(e,t,n){const i=new Array(t),o=gn.getAttributeBySemantic(e,Ma.TRANSLATION),r=gn.getAttributeBySemantic(e,Ma.ROTATION),s=gn.getAttributeBySemantic(e,Ma.SCALE),a=new d(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE),c=new d(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),u=l(o),f=l(r),h=l(s),_=u?o.typedArray:new Float32Array(t*3);let g=f?r.typedArray:new Float32Array(t*4);f&&r.normalized&&(g=Ri.dequantize(g,r.componentDatatype,r.type,t));let p;h?p=s.typedArray:(p=new Float32Array(t*3),p.fill(1));for(let T=0;T<t;T++){const b=new d(_[T*3],_[T*3+1],_[T*3+2]);d.maximumByComponent(a,b,a),d.minimumByComponent(c,b,c);const x=new De(g[T*4],g[T*4+1],g[T*4+2],f?g[T*4+3]:1),v=new d(p[T*3],p[T*3+1],p[T*3+2]),D=N.fromTranslationQuaternionRotationScale(b,x,v,new N);i[T]=D}const y=n.runtimeNode;return y.instancingTranslationMin=c,y.instancingTranslationMax=a,u&&(o.typedArray=void 0),f&&(r.typedArray=void 0),h&&(s.typedArray=void 0),i}function Btt(e,t,n){const i=new Array(t),o=e.typedArray,r=new d(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),s=new d(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE);for(let c=0;c<t;c++){const u=new d(o[c*3],o[c*3+1],o[c*3+2]);i[c]=u,d.minimumByComponent(r,u,r),d.maximumByComponent(s,u,s)}const a=n.runtimeNode;return a.instancingTranslationMin=r,a.instancingTranslationMax=s,e.typedArray=void 0,i}function i2(e,t){const n=Mt.createVertexBuffer({context:t.context,typedArray:e,usage:mt.STATIC_DRAW});return n.vertexArrayDestroyable=!1,n}function Rtt(e,t,n,i,o){const r=gn.getAttributeBySemantic(n,Ma.ROTATION);l(r)?Ntt(e,n,i,t,o):Mtt(e,n,i,t,o)}function Ntt(e,t,n,i,o){const r=e.shaderBuilder,s=t.attributes[0].count,a=e.model,c=e.runtimeNode;r.addDefine("HAS_INSTANCE_MATRICES");const u="Transform";let f,h=c.instancingTransformsBuffer;if(!l(h)){f=Xne(t,s,e);const y=n2(f);h=i2(y,i),a._modelResources.push(h),c.instancingTransformsBuffer=h}if(dq(e,h,n,u),!o)return;const _=St(i);_.mode=me.COLUMBUS_VIEW,$ne(e,_);let g=c.instancingTransformsBuffer2D;if(!l(g)){const y=Dtt(f,e,_,f),T=n2(y);g=i2(T,i),a._modelResources.push(g),c.instancingTransformsBuffer2D=g}dq(e,g,n,"Transform2D")}function Mtt(e,t,n,i,o){const r=e.shaderBuilder,s=e.runtimeNode,a=gn.getAttributeBySemantic(t,Ma.TRANSLATION),c=gn.getAttributeBySemantic(t,Ma.SCALE);if(l(c)){r.addDefine("HAS_INSTANCE_SCALE");const b="Scale";zR(e,c.buffer,c.byteOffset,c.byteStride,n,b)}if(!l(a))return;let u;const f=a.typedArray;l(f)?u=Btt(a,a.count,e):l(s.instancingTranslationMin)||(s.instancingTranslationMin=a.min,s.instancingTranslationMax=a.max),r.addDefine("HAS_INSTANCE_TRANSLATION");const h="Translation";if(zR(e,a.buffer,a.byteOffset,a.byteStride,n,h),!o)return;const _=St(i);_.mode=me.COLUMBUS_VIEW,$ne(e,_);let g=s.instancingTranslationBuffer2D;if(!l(g)){const b=Itt(u,e,_,u),x=Ltt(b);g=i2(x,i),e.model._modelResources.push(g),s.instancingTranslationBuffer2D=g}zR(e,g,0,void 0,n,"Translation2D")}function dq(e,t,n,i){const r=oe.getSizeInBytes(oe.FLOAT),s=r*12,a=[{index:e.attributeIndex++,vertexBuffer:t,componentsPerAttribute:4,componentDatatype:oe.FLOAT,normalize:!1,offsetInBytes:0,strideInBytes:s,instanceDivisor:1},{index:e.attributeIndex++,vertexBuffer:t,componentsPerAttribute:4,componentDatatype:oe.FLOAT,normalize:!1,offsetInBytes:r*4,strideInBytes:s,instanceDivisor:1},{index:e.attributeIndex++,vertexBuffer:t,componentsPerAttribute:4,componentDatatype:oe.FLOAT,normalize:!1,offsetInBytes:r*8,strideInBytes:s,instanceDivisor:1}],c=e.shaderBuilder;c.addAttribute("vec4",`a_instancing${i}Row0`),c.addAttribute("vec4",`a_instancing${i}Row1`),c.addAttribute("vec4",`a_instancing${i}Row2`),n.push.apply(n,a)}function zR(e,t,n,i,o,r){o.push({index:e.attributeIndex++,vertexBuffer:t,componentsPerAttribute:3,componentDatatype:oe.FLOAT,normalize:!1,offsetInBytes:n,strideInBytes:i,instanceDivisor:1}),e.shaderBuilder.addAttribute("vec3",`a_instance${r}`)}function Ftt(e,t,n,i){const o=n.attributes,r=e.shaderBuilder;for(let s=0;s<o.length;s++){const a=o[s];a.semantic===Ma.FEATURE_ID&&(a.setIndex>=e.featureIdVertexAttributeSetIndex&&(e.featureIdVertexAttributeSetIndex=a.setIndex+1),i.push({index:e.attributeIndex++,vertexBuffer:a.buffer,componentsPerAttribute:Nn.getNumberOfComponents(a.type),componentDatatype:a.componentDatatype,normalize:!1,offsetInBytes:a.byteOffset,strideInBytes:a.byteStride,instanceDivisor:1}),r.addAttribute("float",`a_instanceFeatureId_${a.setIndex}`))}}const ztt=Wne,wU={};wU.name="ModelMatrixUpdateStage";wU.update=function(e,t,n){const i=n.mode!==me.SCENE3D;if(!(i&&t._model._projectTo2D)&&e._transformDirty){const o=i?t._computedModelMatrix2D:t._computedModelMatrix;Kne(e,t,o,e.transformToRoot),e._transformDirty=!1}};function Kne(e,t,n,i){let o;i=N.multiplyTransformation(i,e.transform,new N),e.updateComputedTransform();const r=e.runtimePrimitives.length;for(o=0;o<r;o++){const c=e.runtimePrimitives[o].drawCommand;c.modelMatrix=N.multiplyTransformation(n,i,c.modelMatrix),c.cullFace=gn.getCullFace(c.modelMatrix,c.primitiveType)}const s=e.children.length;for(o=0;o<s;o++){const a=t._runtimeNodes[e.children[o]];a._transformToRoot=N.clone(i,a._transformToRoot),Kne(a,t,n,i),a._transformDirty=!1}}const Utt=wU,Jne={name:"NodeStatisticsPipelineStage",_countInstancingAttributes:Qne,_countGeneratedBuffers:Zne};Jne.process=function(e,t,n){const i=e.model.statistics,o=t.instances,r=e.runtimeNode;Qne(i,o),Zne(i,r)};function Qne(e,t){if(!l(t))return;const n=t.attributes,i=n.length;for(let o=0;o<i;o++){const r=n[o];l(r.buffer)&&e.addBuffer(r.buffer,!1)}}function Zne(e,t){l(t.instancingTransformsBuffer)&&e.addBuffer(t.instancingTransformsBuffer,!1),l(t.instancingTransformsBuffer2D)&&e.addBuffer(t.instancingTransformsBuffer2D,!1),l(t.instancingTranslationBuffer2D)&&e.addBuffer(t.instancingTranslationBuffer2D,!1)}const Htt=Jne;function RT(e){e=A(e,A.EMPTY_OBJECT);const t=e.node,n=e.transform,i=e.transformToRoot,o=e.sceneGraph,r=e.children;E.typeOf.object("options.node",t),E.typeOf.object("options.transform",n),E.typeOf.object("options.transformToRoot",i),E.typeOf.object("options.sceneGraph",o),E.typeOf.object("options.children",r),this._node=t,this._name=t.name,this._id=t.index,this._sceneGraph=o,this._children=r,this._originalTransform=N.clone(n,this._originalTransform),this._transform=N.clone(n,this._transform),this._transformToRoot=N.clone(i,this._transformToRoot),this._computedTransform=new N,this._transformDirty=!1,this._transformParameters=void 0,this._morphWeights=[],this._runtimeSkin=void 0,this._computedJointMatrices=[],this.show=!0,this.userAnimated=!1,this.pipelineStages=[],this.runtimePrimitives=[],this.updateStages=[],this.instancingTranslationMin=void 0,this.instancingTranslationMax=void 0,this.instancingTransformsBuffer=void 0,this.instancingTransformsBuffer2D=void 0,this.instancingTranslationBuffer2D=void 0,this.instancingReferencePoint2D=void 0,Vtt(this)}Object.defineProperties(RT.prototype,{node:{get:function(){return this._node}},sceneGraph:{get:function(){return this._sceneGraph}},children:{get:function(){return this._children}},transform:{get:function(){return this._transform},set:function(e){this._transformDirty=!0,this._transform=N.clone(e,this._transform)}},transformToRoot:{get:function(){return this._transformToRoot}},computedTransform:{get:function(){return this._computedTransform}},originalTransform:{get:function(){return this._originalTransform}},translation:{get:function(){return l(this._transformParameters)?this._transformParameters.translation:void 0},set:function(e){const t=this._transformParameters;if(!l(t))throw new w("The translation of a node cannot be set if it was defined using a matrix in the model.");const n=t.translation;d.equals(n,e)||(t.translation=d.clone(e,t.translation),UR(this,t))}},rotation:{get:function(){return l(this._transformParameters)?this._transformParameters.rotation:void 0},set:function(e){const t=this._transformParameters;if(!l(t))throw new w("The rotation of a node cannot be set if it was defined using a matrix in the model.");const n=t.rotation;De.equals(n,e)||(t.rotation=De.clone(e,t.rotation),UR(this,t))}},scale:{get:function(){return l(this._transformParameters)?this._transformParameters.scale:void 0},set:function(e){const t=this._transformParameters;if(!l(t))throw new w("The scale of a node cannot be set if it was defined using a matrix in the model.");const n=t.scale;d.equals(n,e)||(t.scale=d.clone(e,t.scale),UR(this,t))}},morphWeights:{get:function(){return this._morphWeights},set:function(e){const t=e.length;if(this._morphWeights.length!==t)throw new w("value must have the same length as the original weights array.");for(let n=0;n<t;n++)this._morphWeights[n]=e[n]}},runtimeSkin:{get:function(){return this._runtimeSkin}},computedJointMatrices:{get:function(){return this._computedJointMatrices}}});function Vtt(e){const t=e.transform,n=e.transformToRoot,i=e._computedTransform;e._computedTransform=N.multiply(n,t,i);const o=e.node;l(o.matrix)||(e._transformParameters=new AP(o.translation,o.rotation,o.scale)),l(o.morphWeights)&&(e._morphWeights=o.morphWeights.slice());const r=o.articulationName;if(l(r)){const c=e.sceneGraph._runtimeArticulations[r];l(c)&&c.runtimeNodes.push(e)}}function UR(e,t){e._transformDirty=!0,e._transform=N.fromTranslationRotationScale(t,e._transform)}RT.prototype.getChild=function(e){if(E.typeOf.number("index",e),e<0||e>=this.children.length)throw new w("index must be greater than or equal to 0 and less than the number of children.");return this.sceneGraph._runtimeNodes[this.children[e]]};RT.prototype.configurePipeline=function(){const e=this.node,t=this.pipelineStages;t.length=0;const n=this.updateStages;n.length=0,l(e.instances)&&t.push(ztt),t.push(Htt),n.push(Utt)};RT.prototype.updateComputedTransform=function(){this._computedTransform=N.multiply(this._transformToRoot,this._transform,this._computedTransform)};RT.prototype.updateJointMatrices=function(){const e=this._runtimeSkin;if(!l(e))return;e.updateJointMatrices();const t=this._computedJointMatrices,n=e.jointMatrices,i=n.length;for(let o=0;o<i;o++){l(t[o])||(t[o]=new N);const r=N.multiplyTransformation(this.transformToRoot,this.transform,t[o]),s=N.inverseTransformation(r,t[o]);t[o]=N.multiplyTransformation(s,n[o],t[o])}};const eie={name:"AlphaPipelineStage"};eie.process=function(e,t,n){const i=e.alphaOptions,o=e.model;i.pass=A(i.pass,o.opaquePass);const r=e.renderStateOptions;i.pass===We.TRANSLUCENT&&(r.cull.enabled=!1,r.depthMask=!1,r.blending=fo.ALPHA_BLEND);const s=e.shaderBuilder,a=e.uniformMap;l(i.alphaCutoff)&&(s.addDefine("ALPHA_MODE_MASK",void 0,Re.FRAGMENT),s.addUniform("float","u_alphaCutoff",Re.FRAGMENT),a.u_alphaCutoff=function(){return i.alphaCutoff})};const ktt=eie,tie={name:"BatchTexturePipelineStage"};tie.process=function(e,t,n){const i=e.shaderBuilder,o={},r=e.model,s=r.featureTables[r.featureTableId],a=s.featuresLength;i.addUniform("int","model_featuresLength"),o.model_featuresLength=function(){return a};const c=s.batchTexture;i.addUniform("sampler2D","model_batchTexture"),o.model_batchTexture=function(){return A(c.batchTexture,c.defaultTexture)},i.addUniform("vec4","model_textureStep"),o.model_textureStep=function(){return c.textureStep},c.textureDimensions.y>1&&(i.addDefine("MULTILINE_BATCH_TEXTURE"),i.addUniform("vec2","model_textureDimensions"),o.model_textureDimensions=function(){return c.textureDimensions}),e.uniformMap=Ln(o,e.uniformMap)};const Gtt=tie,nie={name:"ClassificationPipelineStage"};nie.process=function(e,t,n){e.shaderBuilder.addDefine("HAS_CLASSIFICATION",void 0,Re.BOTH);const o=e.runtimePrimitive;l(o.batchLengths)||Wtt(t,o)};function Wtt(e,t){const n=gn.getAttributeBySemantic(e,Ut.POSITION);if(!l(n))throw new Fe("Primitives must have a position attribute to be used for classification.");let i;const o=e.indices,r=l(o);r&&(i=o.typedArray,o.typedArray=void 0);const s=r?o.count:n.count,a=gn.getAttributeBySemantic(e,Ut.FEATURE_ID,0);if(!l(a)){t.batchLengths=[s],t.batchOffsets=[0];return}const c=a.typedArray;a.typedArray=void 0;const u=[],f=[0],h=r?i[0]:0;let _=c[h],g=0;for(let y=1;y<s;y++){const T=r?i[y]:y,b=c[T];if(b!==_){const x=y-g,v=y;u.push(x),f.push(v),g=v,_=b}}const p=s-g;u.push(p),t.batchLengths=u,t.batchOffsets=f}const qtt=nie,jtt=`void filterByPassType(inout vec3 positionMC, vec4 featureColor)
|
||
{
|
||
bool styleTranslucent = (featureColor.a != 1.0);
|
||
// Only render translucent features in the translucent pass (if the style or the original command has translucency).
|
||
if (czm_pass == czm_passTranslucent && !styleTranslucent && !model_commandTranslucent)
|
||
{
|
||
// If the model has a translucent silhouette, it needs to render during the silhouette color command,
|
||
// (i.e. the command where model_silhouettePass = true), even if the model isn't translucent.
|
||
#ifdef HAS_SILHOUETTE
|
||
positionMC *= float(model_silhouettePass);
|
||
#else
|
||
positionMC *= 0.0;
|
||
#endif
|
||
}
|
||
// If the current pass is not the translucent pass and the style is not translucent, don't render the feature.
|
||
else if (czm_pass != czm_passTranslucent && styleTranslucent)
|
||
{
|
||
positionMC *= 0.0;
|
||
}
|
||
}
|
||
|
||
void cpuStylingStage(inout vec3 positionMC, inout SelectedFeature feature)
|
||
{
|
||
float show = ceil(feature.color.a);
|
||
positionMC *= show;
|
||
|
||
#if defined(HAS_SELECTED_FEATURE_ID_ATTRIBUTE) && !defined(HAS_CLASSIFICATION)
|
||
filterByPassType(positionMC, feature.color);
|
||
#endif
|
||
}
|
||
`,Ytt=`void filterByPassType(vec4 featureColor)
|
||
{
|
||
bool styleTranslucent = (featureColor.a != 1.0);
|
||
// Only render translucent features in the translucent pass (if the style or the original command has translucency).
|
||
if (czm_pass == czm_passTranslucent && !styleTranslucent && !model_commandTranslucent)
|
||
{
|
||
// If the model has a translucent silhouette, it needs to render during the silhouette color command,
|
||
// (i.e. the command where model_silhouettePass = true), even if the model isn't translucent.
|
||
#ifdef HAS_SILHOUETTE
|
||
if(!model_silhouettePass) {
|
||
discard;
|
||
}
|
||
#else
|
||
discard;
|
||
#endif
|
||
}
|
||
// If the current pass is not the translucent pass and the style is not translucent, don't render the feature.
|
||
else if (czm_pass != czm_passTranslucent && styleTranslucent)
|
||
{
|
||
discard;
|
||
}
|
||
}
|
||
|
||
void cpuStylingStage(inout czm_modelMaterial material, SelectedFeature feature)
|
||
{
|
||
vec4 featureColor = feature.color;
|
||
if (featureColor.a == 0.0)
|
||
{
|
||
discard;
|
||
}
|
||
|
||
// If a feature ID vertex attribute is used, the pass type filter is applied in the vertex shader.
|
||
// So, we only apply in in the fragment shader if the feature ID texture is used.
|
||
#if defined(HAS_SELECTED_FEATURE_ID_TEXTURE) && !defined(HAS_CLASSIFICATION)
|
||
filterByPassType(featureColor);
|
||
#endif
|
||
|
||
featureColor = czm_gammaCorrect(featureColor);
|
||
|
||
// Classification models compute the diffuse differently.
|
||
#ifdef HAS_CLASSIFICATION
|
||
material.diffuse = featureColor.rgb * featureColor.a;
|
||
#else
|
||
float highlight = ceil(model_colorBlend);
|
||
material.diffuse *= mix(featureColor.rgb, vec3(1.0), highlight);
|
||
#endif
|
||
|
||
material.alpha *= featureColor.a;
|
||
}
|
||
`,iie={name:"CPUStylingPipelineStage"};iie.process=function(e,t,n){const i=e.model,o=e.shaderBuilder;o.addVertexLines(jtt),o.addFragmentLines(Ytt),o.addDefine("USE_CPU_STYLING",void 0,Re.BOTH),l(i.color)||(o.addUniform("float",t2.COLOR_BLEND_UNIFORM_NAME,Re.FRAGMENT),e.uniformMap[t2.COLOR_BLEND_UNIFORM_NAME]=function(){return vP.getColorBlend(i.colorBlendMode,i.colorBlendAmount)}),o.addUniform("bool","model_commandTranslucent",Re.BOTH),e.uniformMap.model_commandTranslucent=function(){return e.alphaOptions.pass===We.TRANSLUCENT}};const $tt=iie,oie={MODIFY_MATERIAL:"MODIFY_MATERIAL",REPLACE_MATERIAL:"REPLACE_MATERIAL"};oie.getDefineName=function(e){return`CUSTOM_SHADER_${e}`};const SU=Object.freeze(oie),Xtt=`void customShaderStage(
|
||
inout czm_modelVertexOutput vsOutput,
|
||
inout ProcessedAttributes attributes,
|
||
FeatureIds featureIds,
|
||
Metadata metadata,
|
||
MetadataClass metadataClass,
|
||
MetadataStatistics metadataStatistics
|
||
) {
|
||
// VertexInput and initializeInputStruct() are dynamically generated in JS,
|
||
// see CustomShaderPipelineStage.js
|
||
VertexInput vsInput;
|
||
initializeInputStruct(vsInput, attributes);
|
||
vsInput.featureIds = featureIds;
|
||
vsInput.metadata = metadata;
|
||
vsInput.metadataClass = metadataClass;
|
||
vsInput.metadataStatistics = metadataStatistics;
|
||
vertexMain(vsInput, vsOutput);
|
||
attributes.positionMC = vsOutput.positionMC;
|
||
}
|
||
`,Ktt=`void customShaderStage(
|
||
inout czm_modelMaterial material,
|
||
ProcessedAttributes attributes,
|
||
FeatureIds featureIds,
|
||
Metadata metadata,
|
||
MetadataClass metadataClass,
|
||
MetadataStatistics metadataStatistics
|
||
) {
|
||
// FragmentInput and initializeInputStruct() are dynamically generated in JS,
|
||
// see CustomShaderPipelineStage.js
|
||
FragmentInput fsInput;
|
||
initializeInputStruct(fsInput, attributes);
|
||
fsInput.featureIds = featureIds;
|
||
fsInput.metadata = metadata;
|
||
fsInput.metadataClass = metadataClass;
|
||
fsInput.metadataStatistics = metadataStatistics;
|
||
fragmentMain(fsInput, material);
|
||
}
|
||
`,Jtt=`void featureIdStage(out FeatureIds featureIds, ProcessedAttributes attributes) {
|
||
initializeFeatureIds(featureIds, attributes);
|
||
initializeFeatureIdAliases(featureIds);
|
||
}
|
||
`,Qtt=`void featureIdStage(out FeatureIds featureIds, ProcessedAttributes attributes)
|
||
{
|
||
initializeFeatureIds(featureIds, attributes);
|
||
initializeFeatureIdAliases(featureIds);
|
||
setFeatureIdVaryings();
|
||
}
|
||
`,Di={name:"FeatureIdPipelineStage",STRUCT_ID_FEATURE_IDS_VS:"FeatureIdsVS",STRUCT_ID_FEATURE_IDS_FS:"FeatureIdsFS",STRUCT_NAME_FEATURE_IDS:"FeatureIds",FUNCTION_ID_INITIALIZE_FEATURE_IDS_VS:"initializeFeatureIdsVS",FUNCTION_ID_INITIALIZE_FEATURE_IDS_FS:"initializeFeatureIdsFS",FUNCTION_ID_INITIALIZE_FEATURE_ID_ALIASES_VS:"initializeFeatureIdAliasesVS",FUNCTION_ID_INITIALIZE_FEATURE_ID_ALIASES_FS:"initializeFeatureIdAliasesFS",FUNCTION_SIGNATURE_INITIALIZE_FEATURE_IDS:"void initializeFeatureIds(out FeatureIds featureIds, ProcessedAttributes attributes)",FUNCTION_SIGNATURE_INITIALIZE_FEATURE_ID_ALIASES:"void initializeFeatureIdAliases(inout FeatureIds featureIds)",FUNCTION_ID_SET_FEATURE_ID_VARYINGS:"setFeatureIdVaryings",FUNCTION_SIGNATURE_SET_FEATURE_ID_VARYINGS:"void setFeatureIdVaryings()"};Di.process=function(e,t,n){const i=e.shaderBuilder;Ztt(i);const o=e.runtimeNode.node.instances;l(o)&&ent(e,o,n),tnt(e,t,n),i.addVertexLines(Qtt),i.addFragmentLines(Jtt)};function Ztt(e){e.addStruct(Di.STRUCT_ID_FEATURE_IDS_VS,Di.STRUCT_NAME_FEATURE_IDS,Re.VERTEX),e.addStruct(Di.STRUCT_ID_FEATURE_IDS_FS,Di.STRUCT_NAME_FEATURE_IDS,Re.FRAGMENT),e.addFunction(Di.FUNCTION_ID_INITIALIZE_FEATURE_IDS_VS,Di.FUNCTION_SIGNATURE_INITIALIZE_FEATURE_IDS,Re.VERTEX),e.addFunction(Di.FUNCTION_ID_INITIALIZE_FEATURE_IDS_FS,Di.FUNCTION_SIGNATURE_INITIALIZE_FEATURE_IDS,Re.FRAGMENT),e.addFunction(Di.FUNCTION_ID_INITIALIZE_FEATURE_ID_ALIASES_VS,Di.FUNCTION_SIGNATURE_INITIALIZE_FEATURE_ID_ALIASES,Re.VERTEX),e.addFunction(Di.FUNCTION_ID_INITIALIZE_FEATURE_ID_ALIASES_FS,Di.FUNCTION_SIGNATURE_INITIALIZE_FEATURE_ID_ALIASES,Re.FRAGMENT),e.addFunction(Di.FUNCTION_ID_SET_FEATURE_ID_VARYINGS,Di.FUNCTION_SIGNATURE_SET_FEATURE_ID_VARYINGS,Re.VERTEX)}function ent(e,t,n){const i=t.featureIds,o=t.attributes[0].count;for(let r=0;r<i.length;r++){const s=i[r],a=s.positionalLabel;s instanceof Yt.FeatureIdAttribute?nnt(e,s,a):rie(e,s,a,o,1,n);const c=s.label;l(c)&&sie(e,a,c,Re.BOTH)}}function tnt(e,t,n){const i=t.featureIds,r=gn.getAttributeBySemantic(t,Ut.POSITION).count;for(let s=0;s<i.length;s++){const a=i[s],c=a.positionalLabel;let u=Re.BOTH;a instanceof Yt.FeatureIdAttribute?int(e,a,c):a instanceof Yt.FeatureIdImplicitRange?rie(e,a,c,r,void 0,n):(ont(e,a,c,s,n),u=Re.FRAGMENT);const f=a.label;l(f)&&sie(e,c,f,u)}}function nnt(e,t,n){const i=e.shaderBuilder;i.addStructField(Di.STRUCT_ID_FEATURE_IDS_VS,"int",n),i.addStructField(Di.STRUCT_ID_FEATURE_IDS_FS,"int",n);const o=t.setIndex,r=n.replace(/_\d+$/,"_"),s=`a_${r}${o}`,a=`v_${r}${o}`,c=`featureIds.${n} = int(czm_round(${s}));`,u=`featureIds.${n} = int(czm_round(${a}));`;i.addFunctionLines(Di.FUNCTION_ID_INITIALIZE_FEATURE_IDS_VS,[c]),i.addFunctionLines(Di.FUNCTION_ID_INITIALIZE_FEATURE_IDS_FS,[u]),i.addVarying("float",a),i.addFunctionLines(Di.FUNCTION_ID_SET_FEATURE_ID_VARYINGS,[`${a} = ${s};`])}function int(e,t,n){const i=e.shaderBuilder;i.addStructField(Di.STRUCT_ID_FEATURE_IDS_VS,"int",n),i.addStructField(Di.STRUCT_ID_FEATURE_IDS_FS,"int",n);const o=t.setIndex,r=n.replace(/_\d+$/,"_"),s=[`featureIds.${n} = int(czm_round(attributes.${r}${o}));`];i.addFunctionLines(Di.FUNCTION_ID_INITIALIZE_FEATURE_IDS_VS,s),i.addFunctionLines(Di.FUNCTION_ID_INITIALIZE_FEATURE_IDS_FS,s)}function rie(e,t,n,i,o,r){rnt(e,t,i,o,r);const s=e.shaderBuilder,a=`a_implicit_${n}`;s.addAttribute("float",a);const c=`v_implicit_${n}`;s.addVarying("float",c),s.addStructField(Di.STRUCT_ID_FEATURE_IDS_VS,"int",n),s.addStructField(Di.STRUCT_ID_FEATURE_IDS_FS,"int",n),s.addFunctionLines(Di.FUNCTION_ID_SET_FEATURE_ID_VARYINGS,[`${c} = ${a};`]),s.addFunctionLines(Di.FUNCTION_ID_INITIALIZE_FEATURE_IDS_VS,[`featureIds.${n} = int(czm_round(${a}));`]),s.addFunctionLines(Di.FUNCTION_ID_INITIALIZE_FEATURE_IDS_FS,[`featureIds.${n} = int(czm_round(${c}));`])}function ont(e,t,n,i,o){const r=`u_featureIdTexture_${i}`,s=e.uniformMap,a=t.textureReader;s[r]=function(){return A(a.texture,o.context.defaultTexture)};const c=a.channels,u=e.shaderBuilder;u.addStructField(Di.STRUCT_ID_FEATURE_IDS_FS,"int",n),u.addUniform("sampler2D",r,Re.FRAGMENT);const f=`v_texCoord_${a.texCoord}`,h=`texture2D(${r}, ${f}).${c}`,_=`featureIds.${n} = czm_unpackUint(${h});`;u.addFunctionLines(Di.FUNCTION_ID_INITIALIZE_FEATURE_IDS_FS,[_])}function sie(e,t,n,i){const o=e.shaderBuilder,r=Re.includesVertexShader(i);r&&o.addStructField(Di.STRUCT_ID_FEATURE_IDS_VS,"int",n),o.addStructField(Di.STRUCT_ID_FEATURE_IDS_FS,"int",n);const s=[`featureIds.${n} = featureIds.${t};`];r&&o.addFunctionLines(Di.FUNCTION_ID_INITIALIZE_FEATURE_ID_ALIASES_VS,s),o.addFunctionLines(Di.FUNCTION_ID_INITIALIZE_FEATURE_ID_ALIASES_FS,s)}function rnt(e,t,n,i,o){const r=e.model;let s,a;if(l(t.repeat)){const u=snt(t,n);s=Mt.createVertexBuffer({context:o.context,typedArray:u,usage:mt.STATIC_DRAW}),s.vertexArrayDestroyable=!1,r._pipelineResources.push(s);const f=!1;r.statistics.addBuffer(s,f)}else a=[t.offset];const c={index:e.attributeIndex++,instanceDivisor:i,value:a,vertexBuffer:s,normalize:!1,componentsPerAttribute:1,componentDatatype:oe.FLOAT,strideInBytes:oe.getSizeInBytes(oe.FLOAT),offsetInBytes:0};e.attributes.push(c)}function snt(e,t){const n=e.offset,i=e.repeat,o=new Float32Array(t);for(let r=0;r<t;r++)o[r]=n+Math.floor(r/i);return o}const vU=Di,ant=`void metadataStage(
|
||
out Metadata metadata,
|
||
out MetadataClass metadataClass,
|
||
out MetadataStatistics metadataStatistics,
|
||
ProcessedAttributes attributes
|
||
)
|
||
{
|
||
initializeMetadata(metadata, metadataClass, metadataStatistics, attributes);
|
||
}
|
||
`,cnt=`void metadataStage(
|
||
out Metadata metadata,
|
||
out MetadataClass metadataClass,
|
||
out MetadataStatistics metadataStatistics,
|
||
ProcessedAttributes attributes
|
||
)
|
||
{
|
||
initializeMetadata(metadata, metadataClass, metadataStatistics, attributes);
|
||
setMetadataVaryings();
|
||
}
|
||
`,Ai={name:"MetadataPipelineStage",STRUCT_ID_METADATA_VS:"MetadataVS",STRUCT_ID_METADATA_FS:"MetadataFS",STRUCT_NAME_METADATA:"Metadata",STRUCT_ID_METADATA_CLASS_VS:"MetadataClassVS",STRUCT_ID_METADATA_CLASS_FS:"MetadataClassFS",STRUCT_NAME_METADATA_CLASS:"MetadataClass",STRUCT_ID_METADATA_STATISTICS_VS:"MetadataStatisticsVS",STRUCT_ID_METADATA_STATISTICS_FS:"MetadataStatisticsFS",STRUCT_NAME_METADATA_STATISTICS:"MetadataStatistics",FUNCTION_ID_INITIALIZE_METADATA_VS:"initializeMetadataVS",FUNCTION_ID_INITIALIZE_METADATA_FS:"initializeMetadataFS",FUNCTION_SIGNATURE_INITIALIZE_METADATA:"void initializeMetadata(out Metadata metadata, out MetadataClass metadataClass, out MetadataStatistics metadataStatistics, ProcessedAttributes attributes)",FUNCTION_ID_SET_METADATA_VARYINGS:"setMetadataVaryings",FUNCTION_SIGNATURE_SET_METADATA_VARYINGS:"void setMetadataVaryings()",METADATA_CLASS_FIELDS:[{specName:"noData",shaderName:"noData"},{specName:"default",shaderName:"defaultValue"},{specName:"min",shaderName:"minValue"},{specName:"max",shaderName:"maxValue"}],METADATA_STATISTICS_FIELDS:[{specName:"min",shaderName:"minValue"},{specName:"max",shaderName:"maxValue"},{specName:"mean",shaderName:"mean",type:"float"},{specName:"median",shaderName:"median"},{specName:"standardDeviation",shaderName:"standardDeviation",type:"float"},{specName:"variance",shaderName:"variance",type:"float"},{specName:"sum",shaderName:"sum"}]};Ai.process=function(e,t,n){var h;const{shaderBuilder:i,model:o}=e,{structuralMetadata:r={},content:s}=o,a=(h=s==null?void 0:s.tileset.metadataExtension)==null?void 0:h.statistics,c=lnt(r.propertyAttributes,t,a),u=fnt(r.propertyTextures,a),f=c.concat(u);hnt(i,f),_nt(i),i.addVertexLines(cnt),i.addFragmentLines(ant);for(let _=0;_<c.length;_++){const g=c[_];gnt(e,g)}for(let _=0;_<u.length;_++){const g=u[_];Ant(e,g)}};function lnt(e,t,n){return l(e)?e.flatMap(i=>unt(i,t,n)):[]}function unt(e,t,n){const{getAttributeByName:i,getAttributeInfo:o,sanitizeGlslIdentifier:r}=gn,s=e.class.id,a=n==null?void 0:n.classes[s],c=Object.entries(e.properties),u=new Array(c.length);for(let f=0;f<c.length;f++){const[h,_]=c[f],g=i(t,_.attribute),{glslType:p,variableName:y}=o(g);u[f]={metadataVariable:r(h),property:_,type:_.classProperty.type,glslType:p,variableName:y,propertyStatistics:a==null?void 0:a.properties[h],shaderDestination:Re.BOTH}}return u}function fnt(e,t){return l(e)?e.flatMap(n=>dnt(n,t)):[]}function dnt(e,t){const{sanitizeGlslIdentifier:n}=gn,i=e.class.id,o=t==null?void 0:t.classes[i],r=Object.entries(e.properties).filter(([a,c])=>c.isGpuCompatible()),s=new Array(r.length);for(let a=0;a<r.length;a++){const[c,u]=r[a];s[a]={metadataVariable:n(c),property:u,type:u.classProperty.type,glslType:u.getGlslType(),propertyStatistics:o==null?void 0:o.properties[c],shaderDestination:Re.FRAGMENT}}return s}function hnt(e,t){const n=new Set,i=new Set;for(let a=0;a<t.length;a++){const{type:c,glslType:u,propertyStatistics:f}=t[a];n.add(u),l(f)&&c!==Xt.ENUM&&i.add(u)}const o=Ai.METADATA_CLASS_FIELDS;for(const a of n){const c=`${a}MetadataClass`;s(c,a,o)}const r=Ai.METADATA_STATISTICS_FIELDS;for(const a of i){const c=`${a}MetadataStatistics`;s(c,a,r)}function s(a,c,u){e.addStruct(a,a,Re.BOTH);for(let f=0;f<u.length;f++){const{shaderName:h}=u[f],_=u[f].type==="float"?mnt(c):c;e.addStructField(a,_,h)}}}const pnt={int:"float",ivec2:"vec2",ivec3:"vec3",ivec4:"vec4"};function mnt(e){const t=pnt[e];return l(t)?t:e}function _nt(e){e.addStruct(Ai.STRUCT_ID_METADATA_VS,Ai.STRUCT_NAME_METADATA,Re.VERTEX),e.addStruct(Ai.STRUCT_ID_METADATA_FS,Ai.STRUCT_NAME_METADATA,Re.FRAGMENT),e.addStruct(Ai.STRUCT_ID_METADATA_CLASS_VS,Ai.STRUCT_NAME_METADATA_CLASS,Re.VERTEX),e.addStruct(Ai.STRUCT_ID_METADATA_CLASS_FS,Ai.STRUCT_NAME_METADATA_CLASS,Re.FRAGMENT),e.addStruct(Ai.STRUCT_ID_METADATA_STATISTICS_VS,Ai.STRUCT_NAME_METADATA_STATISTICS,Re.VERTEX),e.addStruct(Ai.STRUCT_ID_METADATA_STATISTICS_FS,Ai.STRUCT_NAME_METADATA_STATISTICS,Re.FRAGMENT),e.addFunction(Ai.FUNCTION_ID_INITIALIZE_METADATA_VS,Ai.FUNCTION_SIGNATURE_INITIALIZE_METADATA,Re.VERTEX),e.addFunction(Ai.FUNCTION_ID_INITIALIZE_METADATA_FS,Ai.FUNCTION_SIGNATURE_INITIALIZE_METADATA,Re.FRAGMENT),e.addFunction(Ai.FUNCTION_ID_SET_METADATA_VARYINGS,Ai.FUNCTION_SIGNATURE_SET_METADATA_VARYINGS,Re.VERTEX)}function gnt(e,t){ynt(e,t),aie(e.shaderBuilder,t),cie(e.shaderBuilder,t)}function ynt(e,t){const{shaderBuilder:n}=e,{metadataVariable:i,property:o,glslType:r}=t,s=uie({valueExpression:`attributes.${t.variableName}`,renderResources:e,glslType:r,metadataVariable:i,shaderDestination:Re.BOTH,property:o});n.addStructField(Ai.STRUCT_ID_METADATA_VS,r,i),n.addStructField(Ai.STRUCT_ID_METADATA_FS,r,i);const a=`metadata.${i} = ${s};`;n.addFunctionLines(Ai.FUNCTION_ID_INITIALIZE_METADATA_VS,[a]),n.addFunctionLines(Ai.FUNCTION_ID_INITIALIZE_METADATA_FS,[a])}function Ant(e,t){Tnt(e,t),aie(e.shaderBuilder,t),cie(e.shaderBuilder,t)}function Tnt(e,t){const{shaderBuilder:n,uniformMap:i}=e,{metadataVariable:o,glslType:r,property:s}=t,{texCoord:a,channels:c,index:u,texture:f}=s.textureReader,h=`u_propertyTexture_${u}`;i.hasOwnProperty(h)||(n.addUniform("sampler2D",h,Re.FRAGMENT),i[h]=()=>f),n.addStructField(Ai.STRUCT_ID_METADATA_FS,r,o);const _=`attributes.texCoord_${a}`,g=`texture2D(${h}, ${_}).${c}`,p=s.unpackInShader(g),y=uie({valueExpression:p,renderResources:e,glslType:r,metadataVariable:o,shaderDestination:Re.FRAGMENT,property:s}),T=`metadata.${o} = ${y};`;n.addFunctionLines(Ai.FUNCTION_ID_INITIALIZE_METADATA_FS,[T])}function aie(e,t){const{classProperty:n}=t.property,{metadataVariable:i,glslType:o,shaderDestination:r}=t,s=lie(Ai.METADATA_CLASS_FIELDS,n,`metadataClass.${i}`,o),a=`${o}MetadataClass`;e.addStructField(Ai.STRUCT_ID_METADATA_CLASS_FS,a,i),e.addFunctionLines(Ai.FUNCTION_ID_INITIALIZE_METADATA_FS,s),Re.includesVertexShader(r)&&(e.addStructField(Ai.STRUCT_ID_METADATA_CLASS_VS,a,i),e.addFunctionLines(Ai.FUNCTION_ID_INITIALIZE_METADATA_VS,s))}function cie(e,t){const{propertyStatistics:n}=t;if(!l(n))return;const{metadataVariable:i,type:o,glslType:r}=t;if(o===Xt.ENUM)return;const s=Ai.METADATA_STATISTICS_FIELDS,a=`metadataStatistics.${i}`,c=lie(s,n,a,r),u=`${r}MetadataStatistics`;e.addStructField(Ai.STRUCT_ID_METADATA_STATISTICS_FS,u,i),e.addFunctionLines(Ai.FUNCTION_ID_INITIALIZE_METADATA_FS,c),Re.includesVertexShader(t.shaderDestination)&&(e.addStructField(Ai.STRUCT_ID_METADATA_STATISTICS_VS,u,i),e.addFunctionLines(Ai.FUNCTION_ID_INITIALIZE_METADATA_VS,c))}function lie(e,t,n,i){return l(t)?e.map(o).filter(l):[];function o(r){const s=t[r.specName];if(l(s))return`${n}.${r.shaderName} = ${i}(${s});`}}function uie(e){const{valueExpression:t,property:n}=e;if(!n.hasValueTransform)return t;const i=e.metadataVariable,o=`u_${i}_offset`,r=`u_${i}_scale`,{shaderBuilder:s,uniformMap:a}=e.renderResources,{glslType:c,shaderDestination:u}=e;s.addUniform(c,o,u),s.addUniform(c,r,u);const{offset:f,scale:h}=n;return a[o]=()=>f,a[r]=()=>h,`czm_valueTransform(${o}, ${r}, ${t})`}const $g=Ai,Cnt={INHERIT:0,OPAQUE:1,TRANSLUCENT:2},o2=Object.freeze(Cnt),Us={name:"CustomShaderPipelineStage",STRUCT_ID_ATTRIBUTES_VS:"AttributesVS",STRUCT_ID_ATTRIBUTES_FS:"AttributesFS",STRUCT_NAME_ATTRIBUTES:"Attributes",STRUCT_ID_VERTEX_INPUT:"VertexInput",STRUCT_NAME_VERTEX_INPUT:"VertexInput",STRUCT_ID_FRAGMENT_INPUT:"FragmentInput",STRUCT_NAME_FRAGMENT_INPUT:"FragmentInput",FUNCTION_ID_INITIALIZE_INPUT_STRUCT_VS:"initializeInputStructVS",FUNCTION_SIGNATURE_INITIALIZE_INPUT_STRUCT_VS:"void initializeInputStruct(out VertexInput vsInput, ProcessedAttributes attributes)",FUNCTION_ID_INITIALIZE_INPUT_STRUCT_FS:"initializeInputStructFS",FUNCTION_SIGNATURE_INITIALIZE_INPUT_STRUCT_FS:"void initializeInputStruct(out FragmentInput fsInput, ProcessedAttributes attributes)",_oneTimeWarning:uo};Us.process=function(e,t,n){const i=e.shaderBuilder,o=e.model.customShader;l(o.lightingModel)&&(e.lightingOptions.lightingModel=o.lightingModel);const r=e.alphaOptions;o.translucencyMode===o2.TRANSLUCENT?r.pass=We.TRANSLUCENT:o.translucencyMode===o2.OPAQUE&&(r.pass=void 0);const s=Int(o,t);if(!s.customShaderEnabled)return;if(Bnt(i,o,s),s.shouldComputePositionWC&&i.addDefine("COMPUTE_POSITION_WC_CUSTOM_SHADER",void 0,Re.BOTH),l(o.vertexShaderText)&&i.addDefine("HAS_CUSTOM_VERTEX_SHADER",void 0,Re.VERTEX),l(o.fragmentShaderText)){i.addDefine("HAS_CUSTOM_FRAGMENT_SHADER",void 0,Re.FRAGMENT);const u=SU.getDefineName(o.mode);i.addDefine(u,void 0,Re.FRAGMENT)}const a=o.uniforms;for(const u in a)if(a.hasOwnProperty(u)){const f=a[u];i.addUniform(f.type,u)}const c=o.varyings;for(const u in c)if(c.hasOwnProperty(u)){const f=c[u];i.addVarying(f,u)}e.uniformMap=Ln(e.uniformMap,o.uniformMap)};function bnt(e){const t={};for(let n=0;n<e.length;n++){const i=e[n],o=gn.getAttributeInfo(i);t[o.variableName]=o}return t}const Ent={position:"vec3",normal:"vec3",tangent:"vec3",bitangent:"vec3",texCoord:"vec2",color:"vec4",joints:"ivec4",weights:"vec4"},xnt={position:"vec3(0.0)",normal:"vec3(0.0, 0.0, 1.0)",tangent:"vec3(1.0, 0.0, 0.0)",bitangent:"vec3(0.0, 1.0, 0.0)",texCoord:"vec2(0.0)",color:"vec4(1.0)",joints:"ivec4(0)",weights:"vec4(0.0)"};function fie(e){let t=e.replace(/_[0-9]+$/,"");t=t.replace(/(MC|EC)$/,"");const n=Ent[t],i=xnt[t];if(l(n))return{attributeField:[n,e],value:i}}function wnt(e,t,n){const i=die(t,e.usedVariablesVertex.attributeSet,!1),o=i.addToShader,r=i.missingAttributes;let s,a;const c=[],u=[];for(s in o)if(o.hasOwnProperty(s)){const h=[o[s].glslType,s];c.push(h),a=`vsInput.attributes.${s} = attributes.${s};`,u.push(a)}for(let f=0;f<r.length;f++){s=r[f];const h=fie(s);if(!l(h)){Us._oneTimeWarning("CustomShaderPipelineStage.incompatiblePrimitiveVS",`Primitive is missing attribute ${s}, disabling custom vertex shader`);return}c.push(h.attributeField),a=`vsInput.attributes.${s} = ${h.value};`,u.push(a)}n.enabled=!0,n.attributeFields=c,n.initializationLines=u}function Snt(e){const t=[],n=[],i=e.usedVariablesFragment.attributeSet;return i.hasOwnProperty("positionWC")&&(t.push(["vec3","positionWC"]),n.push("fsInput.attributes.positionWC = attributes.positionWC;")),i.hasOwnProperty("positionEC")&&(t.push(["vec3","positionEC"]),n.push("fsInput.attributes.positionEC = attributes.positionEC;")),{attributeFields:t,initializationLines:n}}function vnt(e,t,n){const i=die(t,e.usedVariablesFragment.attributeSet,!0),o=i.addToShader,r=i.missingAttributes;let s,a;const c=[],u=[];for(s in o)if(o.hasOwnProperty(s)){const _=[o[s].glslType,s];c.push(_),a=`fsInput.attributes.${s} = attributes.${s};`,u.push(a)}for(let h=0;h<r.length;h++){s=r[h];const _=fie(s);if(!l(_)){Us._oneTimeWarning("CustomShaderPipelineStage.incompatiblePrimitiveFS",`Primitive is missing attribute ${s}, disabling custom fragment shader.`);return}c.push(_.attributeField),a=`fsInput.attributes.${s} = ${_.value};`,u.push(a)}const f=Snt(e);n.enabled=!0,n.attributeFields=c.concat(f.attributeFields),n.initializationLines=f.initializationLines.concat(u)}const Dnt={positionWC:!0,positionEC:!0};function die(e,t,n){let i,o;const r={};for(o in e)if(e.hasOwnProperty(o)){const a=e[o];i=o,n&&o==="normalMC"?i="normalEC":n&&o==="tangentMC"&&(i="tangentEC"),t.hasOwnProperty(i)&&(r[i]=a)}const s=[];for(o in t)if(t.hasOwnProperty(o)){if(Dnt.hasOwnProperty(o))continue;i=o,n&&o==="normalEC"?i="normalMC":n&&o==="tangentEC"&&(i="tangentMC"),e.hasOwnProperty(i)||s.push(o)}return{addToShader:r,missingAttributes:s}}function Int(e,t){const n={enabled:!1},i={enabled:!1},o=bnt(t.attributes);l(e.vertexShaderText)&&wnt(e,o,n),l(e.fragmentShaderText)&&vnt(e,o,i);const s=e.usedVariablesFragment.attributeSet.hasOwnProperty("positionWC")&&i.enabled;return{vertexLines:n,fragmentLines:i,vertexLinesEnabled:n.enabled,fragmentLinesEnabled:i.enabled,customShaderEnabled:n.enabled||i.enabled,shouldComputePositionWC:s}}function Pnt(e,t){let n,i=Us.STRUCT_ID_ATTRIBUTES_VS;e.addStruct(i,Us.STRUCT_NAME_ATTRIBUTES,Re.VERTEX);const o=t.attributeFields;for(n=0;n<o.length;n++){const a=o[n],c=a[0],u=a[1];e.addStructField(i,c,u)}i=Us.STRUCT_ID_VERTEX_INPUT,e.addStruct(i,Us.STRUCT_NAME_VERTEX_INPUT,Re.VERTEX),e.addStructField(i,Us.STRUCT_NAME_ATTRIBUTES,"attributes"),e.addStructField(i,vU.STRUCT_NAME_FEATURE_IDS,"featureIds"),e.addStructField(i,$g.STRUCT_NAME_METADATA,"metadata"),e.addStructField(i,$g.STRUCT_NAME_METADATA_CLASS,"metadataClass"),e.addStructField(i,$g.STRUCT_NAME_METADATA_STATISTICS,"metadataStatistics");const r=Us.FUNCTION_ID_INITIALIZE_INPUT_STRUCT_VS;e.addFunction(r,Us.FUNCTION_SIGNATURE_INITIALIZE_INPUT_STRUCT_VS,Re.VERTEX);const s=t.initializationLines;e.addFunctionLines(r,s)}function Ont(e,t){let n,i=Us.STRUCT_ID_ATTRIBUTES_FS;e.addStruct(i,Us.STRUCT_NAME_ATTRIBUTES,Re.FRAGMENT);let o,r,s;const a=t.attributeFields;for(n=0;n<a.length;n++)o=a[n],r=o[0],s=o[1],e.addStructField(i,r,s);i=Us.STRUCT_ID_FRAGMENT_INPUT,e.addStruct(i,Us.STRUCT_NAME_FRAGMENT_INPUT,Re.FRAGMENT),e.addStructField(i,Us.STRUCT_NAME_ATTRIBUTES,"attributes"),e.addStructField(i,vU.STRUCT_NAME_FEATURE_IDS,"featureIds"),e.addStructField(i,$g.STRUCT_NAME_METADATA,"metadata"),e.addStructField(i,$g.STRUCT_NAME_METADATA_CLASS,"metadataClass"),e.addStructField(i,$g.STRUCT_NAME_METADATA_STATISTICS,"metadataStatistics");const c=Us.FUNCTION_ID_INITIALIZE_INPUT_STRUCT_FS;e.addFunction(c,Us.FUNCTION_SIGNATURE_INITIALIZE_INPUT_STRUCT_FS,Re.FRAGMENT);const u=t.initializationLines;e.addFunctionLines(c,u)}const Lnt=[];function Bnt(e,t,n){const i=n.vertexLines,o=Lnt;i.enabled&&(Pnt(e,i),o.length=0,o.push("#line 0",t.vertexShaderText,Xtt),e.addVertexLines(o));const r=n.fragmentLines;r.enabled&&(Ont(e,r),o.length=0,o.push("#line 0",t.fragmentShaderText,Ktt),e.addFragmentLines(o))}const Rnt=Us,Zb={name:"DequantizationPipelineStage",FUNCTION_ID_DEQUANTIZATION_STAGE_VS:"dequantizationStage",FUNCTION_SIGNATURE_DEQUANTIZATION_STAGE_VS:"void dequantizationStage(inout ProcessedAttributes attributes)"};Zb.process=function(e,t,n){const i=e.shaderBuilder,o=e.model,r=l(o.classificationType);i.addDefine("USE_DEQUANTIZATION",void 0,Re.VERTEX),i.addFunction(Zb.FUNCTION_ID_DEQUANTIZATION_STAGE_VS,Zb.FUNCTION_SIGNATURE_DEQUANTIZATION_STAGE_VS,Re.VERTEX);const s=t.attributes;for(let a=0;a<s.length;a++){const c=s[a],u=c.quantization;if(!l(u))continue;const f=c.semantic===Ut.POSITION,h=c.semantic===Ut.TEXCOORD;if(r&&!f&&!h)continue;const _=gn.getAttributeInfo(c);Mnt(i,_),Nnt(e,_)}};function Nnt(e,t){const n=e.shaderBuilder,i=e.uniformMap,o=t.variableName,r=t.attribute.quantization;if(r.octEncoded){const s=`model_normalizationRange_${o}`;n.addUniform("float",s,Re.VERTEX),i[s]=function(){return r.normalizationRange}}else{const s=`model_quantizedVolumeOffset_${o}`,a=`model_quantizedVolumeStepSize_${o}`,c=t.glslType;n.addUniform(c,s,Re.VERTEX),n.addUniform(c,a,Re.VERTEX);let u=r.quantizedVolumeOffset,f=r.quantizedVolumeStepSize;/^color_\d+$/.test(o)&&(u=hq(u,0),f=hq(f,1)),i[s]=function(){return u},i[a]=function(){return f}}}function hq(e,t){return e instanceof ue?e:new ue(e.x,e.y,e.z,t)}function Mnt(e,t){const n=t.variableName,i=t.attribute.quantization;let o;i.octEncoded?o=Fnt(n,i):o=znt(n),e.addFunctionLines(Zb.FUNCTION_ID_DEQUANTIZATION_STAGE_VS,[o])}function Fnt(e,t){const n=`attributes.${e}`,i=`a_quantized_${e}`,o=`model_normalizationRange_${e}`,r=t.octEncodedZXY?".zxy":".xyz";return`${n} = czm_octDecode(${i}, ${o})${r};`}function znt(e){const t=`attributes.${e}`,n=`a_quantized_${e}`,i=`model_quantizedVolumeOffset_${e}`,o=`model_quantizedVolumeStepSize_${e}`;return`${t} = ${i} + ${n} * ${o};`}const Unt=Zb,Hnt=`void geometryStage(out ProcessedAttributes attributes)
|
||
{
|
||
attributes.positionMC = v_positionMC;
|
||
attributes.positionEC = v_positionEC;
|
||
|
||
#ifdef COMPUTE_POSITION_WC_CUSTOM_SHADER
|
||
attributes.positionWC = v_positionWC;
|
||
#endif
|
||
|
||
#ifdef HAS_NORMALS
|
||
// renormalize after interpolation
|
||
attributes.normalEC = normalize(v_normalEC);
|
||
#endif
|
||
|
||
#ifdef HAS_TANGENTS
|
||
attributes.tangentEC = normalize(v_tangentEC);
|
||
#endif
|
||
|
||
#ifdef HAS_BITANGENTS
|
||
attributes.bitangentEC = normalize(v_bitangentEC);
|
||
#endif
|
||
|
||
// Everything else is dynamically generated in GeometryPipelineStage
|
||
setDynamicVaryings(attributes);
|
||
}
|
||
`,Vnt=`vec4 geometryStage(inout ProcessedAttributes attributes, mat4 modelView, mat3 normal)
|
||
{
|
||
vec4 computedPosition;
|
||
|
||
// Compute positions in different coordinate systems
|
||
vec3 positionMC = attributes.positionMC;
|
||
v_positionMC = positionMC;
|
||
v_positionEC = (modelView * vec4(positionMC, 1.0)).xyz;
|
||
|
||
#if defined(USE_2D_POSITIONS) || defined(USE_2D_INSTANCING)
|
||
vec3 position2D = attributes.position2D;
|
||
vec3 positionEC = (u_modelView2D * vec4(position2D, 1.0)).xyz;
|
||
computedPosition = czm_projection * vec4(positionEC, 1.0);
|
||
#else
|
||
computedPosition = czm_projection * vec4(v_positionEC, 1.0);
|
||
#endif
|
||
|
||
// Sometimes the custom shader and/or style needs this
|
||
#if defined(COMPUTE_POSITION_WC_CUSTOM_SHADER) || defined(COMPUTE_POSITION_WC_STYLE)
|
||
// Note that this is a 32-bit position which may result in jitter on small
|
||
// scales.
|
||
v_positionWC = (czm_model * vec4(positionMC, 1.0)).xyz;
|
||
#endif
|
||
|
||
#ifdef HAS_NORMALS
|
||
v_normalEC = normalize(normal * attributes.normalMC);
|
||
#endif
|
||
|
||
#ifdef HAS_TANGENTS
|
||
v_tangentEC = normalize(normal * attributes.tangentMC);
|
||
#endif
|
||
|
||
#ifdef HAS_BITANGENTS
|
||
v_bitangentEC = normalize(normal * attributes.bitangentMC);
|
||
#endif
|
||
|
||
// All other varyings need to be dynamically generated in
|
||
// GeometryPipelineStage
|
||
setDynamicVaryings(attributes);
|
||
|
||
return computedPosition;
|
||
}
|
||
`,pq=`vec2 computeSt(float featureId)
|
||
{
|
||
float stepX = model_textureStep.x;
|
||
float centerX = model_textureStep.y;
|
||
|
||
#ifdef MULTILINE_BATCH_TEXTURE
|
||
float stepY = model_textureStep.z;
|
||
float centerY = model_textureStep.w;
|
||
|
||
float xId = mod(featureId, model_textureDimensions.x);
|
||
float yId = floor(featureId / model_textureDimensions.x);
|
||
|
||
return vec2(centerX + (xId * stepX), centerY + (yId * stepY));
|
||
#else
|
||
return vec2(centerX + (featureId * stepX), 0.5);
|
||
#endif
|
||
}
|
||
|
||
void selectedFeatureIdStage(out SelectedFeature feature, FeatureIds featureIds)
|
||
{
|
||
int featureId = featureIds.SELECTED_FEATURE_ID;
|
||
|
||
|
||
if (featureId < model_featuresLength)
|
||
{
|
||
vec2 featureSt = computeSt(float(featureId));
|
||
|
||
feature.id = featureId;
|
||
feature.st = featureSt;
|
||
feature.color = texture2D(model_batchTexture, featureSt);
|
||
}
|
||
// Floating point comparisons can be unreliable in GLSL, so we
|
||
// increment the feature ID to make sure it's always greater
|
||
// then the model_featuresLength - a condition we check for in the
|
||
// pick ID, to avoid sampling the pick texture if the feature ID is
|
||
// greater than the number of features.
|
||
else
|
||
{
|
||
feature.id = model_featuresLength + 1;
|
||
feature.st = vec2(0.0);
|
||
feature.color = vec4(1.0);
|
||
}
|
||
|
||
#ifdef HAS_NULL_FEATURE_ID
|
||
if (featureId == model_nullFeatureId) {
|
||
feature.id = featureId;
|
||
feature.st = vec2(0.0);
|
||
feature.color = vec4(1.0);
|
||
}
|
||
#endif
|
||
}
|
||
`,eE={name:"SelectedFeatureIdPipelineStage",STRUCT_ID_SELECTED_FEATURE:"SelectedFeature",STRUCT_NAME_SELECTED_FEATURE:"SelectedFeature",FUNCTION_ID_FEATURE_VARYINGS_VS:"updateFeatureStructVS",FUNCTION_ID_FEATURE_VARYINGS_FS:"updateFeatureStructFS",FUNCTION_SIGNATURE_UPDATE_FEATURE:"void updateFeatureStruct(inout SelectedFeature feature)"};eE.process=function(e,t,n){const i=e.shaderBuilder;e.hasPropertyTable=!0;const o=e.model,r=e.runtimeNode.node,s=knt(o,r,t),a=s.shaderDestination;i.addDefine("HAS_SELECTED_FEATURE_ID",void 0,a),i.addDefine("SELECTED_FEATURE_ID",s.variableName,a),i.addDefine(s.featureIdDefine,void 0,a),Gnt(i);const c=s.featureIds.nullFeatureId,u=e.uniformMap;l(c)&&(i.addDefine("HAS_NULL_FEATURE_ID",void 0,a),i.addUniform("int","model_nullFeatureId",a),u.model_nullFeatureId=function(){return c}),s.shaderDestination===Re.BOTH&&i.addVertexLines(pq),i.addFragmentLines(pq)};function mq(e){return e instanceof Yt.FeatureIdTexture?"HAS_SELECTED_FEATURE_ID_TEXTURE":"HAS_SELECTED_FEATURE_ID_ATTRIBUTE"}function _q(e){return e instanceof Yt.FeatureIdTexture?Re.FRAGMENT:Re.BOTH}function knt(e,t,n){let i,o;return l(t.instances)&&(o=gn.getFeatureIdsByLabel(t.instances.featureIds,e.instanceFeatureIdLabel),l(o))?(i=A(o.label,o.positionalLabel),{featureIds:o,variableName:i,shaderDestination:_q(o),featureIdDefine:mq(o)}):(o=gn.getFeatureIdsByLabel(n.featureIds,e.featureIdLabel),i=A(o.label,o.positionalLabel),{featureIds:o,variableName:i,shaderDestination:_q(o),featureIdDefine:mq(o)})}function Gnt(e){e.addStructField(eE.STRUCT_ID_SELECTED_FEATURE,"int","id"),e.addStructField(eE.STRUCT_ID_SELECTED_FEATURE,"vec2","st"),e.addStructField(eE.STRUCT_ID_SELECTED_FEATURE,"vec4","color")}const r2=eE,bs={name:"GeometryPipelineStage",STRUCT_ID_PROCESSED_ATTRIBUTES_VS:"ProcessedAttributesVS",STRUCT_ID_PROCESSED_ATTRIBUTES_FS:"ProcessedAttributesFS",STRUCT_NAME_PROCESSED_ATTRIBUTES:"ProcessedAttributes",FUNCTION_ID_INITIALIZE_ATTRIBUTES:"initializeAttributes",FUNCTION_SIGNATURE_INITIALIZE_ATTRIBUTES:"void initializeAttributes(out ProcessedAttributes attributes)",FUNCTION_ID_SET_DYNAMIC_VARYINGS_VS:"setDynamicVaryingsVS",FUNCTION_ID_SET_DYNAMIC_VARYINGS_FS:"setDynamicVaryingsFS",FUNCTION_SIGNATURE_SET_DYNAMIC_VARYINGS:"void setDynamicVaryings(inout ProcessedAttributes attributes)"};bs.process=function(e,t,n){const i=e.shaderBuilder,o=e.model;i.addStruct(bs.STRUCT_ID_PROCESSED_ATTRIBUTES_VS,"ProcessedAttributes",Re.VERTEX),i.addStruct(bs.STRUCT_ID_PROCESSED_ATTRIBUTES_FS,"ProcessedAttributes",Re.FRAGMENT),i.addStruct(r2.STRUCT_ID_SELECTED_FEATURE,r2.STRUCT_NAME_SELECTED_FEATURE,Re.BOTH),i.addFunction(bs.FUNCTION_ID_INITIALIZE_ATTRIBUTES,bs.FUNCTION_SIGNATURE_INITIALIZE_ATTRIBUTES,Re.VERTEX),i.addVarying("vec3","v_positionWC"),i.addVarying("vec3","v_positionEC"),i.addStructField(bs.STRUCT_ID_PROCESSED_ATTRIBUTES_FS,"vec3","positionWC"),i.addStructField(bs.STRUCT_ID_PROCESSED_ATTRIBUTES_FS,"vec3","positionEC"),i.addFunction(bs.FUNCTION_ID_SET_DYNAMIC_VARYINGS_VS,bs.FUNCTION_SIGNATURE_SET_DYNAMIC_VARYINGS,Re.VERTEX),i.addFunction(bs.FUNCTION_ID_SET_DYNAMIC_VARYINGS_FS,bs.FUNCTION_SIGNATURE_SET_DYNAMIC_VARYINGS,Re.FRAGMENT),o.type===Xa.TILE_PNTS&&i.addDefine("HAS_SRGB_COLOR",void 0,Re.FRAGMENT);const s=n.mode!==me.SCENE3D&&!n.scene3DOnly&&o._projectTo2D,a=l(e.runtimeNode.node.instances),c=s&&!a,u=t.attributes.length;for(let f=0;f<u;f++){const h=t.attributes[f],_=Nn.getAttributeLocationCount(h.type);if(!l(h.buffer)&&!l(h.constant))throw new w("Attributes must be provided as a Buffer or constant value");const g=h.semantic===Ut.POSITION;let p;_>1?(p=e.attributeIndex,e.attributeIndex+=_):g&&!c?p=0:p=e.attributeIndex++,Wnt(e,h,p,_,s,a)}Znt(i,t.attributes),t.primitiveType===dt.POINTS&&i.addDefine("PRIMITIVE_TYPE_POINTS"),i.addVertexLines(Vnt),i.addFragmentLines(Hnt)};function Wnt(e,t,n,i,o,r){const s=e.shaderBuilder,a=gn.getAttributeInfo(t),c=o&&!r;i>1?Ynt(e,t,n,i):jnt(e,t,n,c),Xnt(s,a,c),$nt(s,a),l(t.semantic)&&qnt(s,t),Knt(s,a,o),Jnt(s,a,c),Qnt(s,a)}function qnt(e,t){const n=t.semantic,i=t.setIndex;switch(n){case Ut.NORMAL:e.addDefine("HAS_NORMALS");break;case Ut.TANGENT:e.addDefine("HAS_TANGENTS");break;case Ut.FEATURE_ID:e.addDefine(`HAS${n}_${i}`);break;case Ut.TEXCOORD:case Ut.COLOR:e.addDefine(`HAS_${n}_${i}`)}}function jnt(e,t,n,i){const o=t.quantization;let r,s;l(o)?(r=o.type,s=o.componentDatatype):(r=t.type,s=t.componentDatatype);const a=t.semantic,c=t.setIndex;a===Ut.FEATURE_ID&&c>=e.featureIdVertexAttributeSetIndex&&(e.featureIdVertexAttributeSetIndex=c+1);const u=a===Ut.POSITION,f=u?0:n,h=Nn.getNumberOfComponents(r),_={index:f,value:l(t.buffer)?void 0:t.constant,vertexBuffer:t.buffer,count:t.count,componentsPerAttribute:h,componentDatatype:s,offsetInBytes:t.byteOffset,strideInBytes:t.byteStride,normalize:t.normalized};if(e.attributes.push(_),!u||!i)return;const g=e.runtimePrimitive.positionBuffer2D,p={index:n,vertexBuffer:g,count:t.count,componentsPerAttribute:h,componentDatatype:oe.FLOAT,offsetInBytes:0,strideInBytes:void 0,normalize:t.normalized};e.attributes.push(p)}function Ynt(e,t,n,i){const o=t.quantization;let r,s;l(o)?(r=o.type,s=o.componentDatatype):(r=t.type,s=t.componentDatatype);const a=t.normalized,u=Nn.getNumberOfComponents(r)/i,f=oe.getSizeInBytes(s),h=u*f,_=t.byteStride;for(let g=0;g<i;g++){const p=t.byteOffset+g*h,y={index:n+g,vertexBuffer:t.buffer,componentsPerAttribute:u,componentDatatype:s,offsetInBytes:p,strideInBytes:_,normalize:a};e.attributes.push(y)}}function $nt(e,t){const n=t.variableName;let i=`v_${n}`,o;n==="normalMC"?(i="v_normalEC",o=t.glslType):n==="tangentMC"?(o="vec3",i="v_tangentEC"):o=t.glslType,e.addVarying(o,i)}function Xnt(e,t,n){const i=t.attribute.semantic,o=t.variableName;let r,s;t.isQuantized?(r=`a_quantized_${o}`,s=t.quantizedGlslType):(r=`a_${o}`,s=t.glslType);const a=i===Ut.POSITION;a?e.setPositionAttribute(s,r):e.addAttribute(s,r),a&&n&&e.addAttribute("vec3","a_position2D")}function Knt(e,t,n){const i=bs.STRUCT_ID_PROCESSED_ATTRIBUTES_VS,o=bs.STRUCT_ID_PROCESSED_ATTRIBUTES_FS,r=t.variableName;r==="tangentMC"?(e.addStructField(i,"vec3","tangentMC"),e.addStructField(i,"float","tangentSignMC"),e.addStructField(o,"vec3","tangentEC")):r==="normalMC"?(e.addStructField(i,"vec3","normalMC"),e.addStructField(o,"vec3","normalEC")):(e.addStructField(i,t.glslType,r),e.addStructField(o,t.glslType,r)),r==="positionMC"&&n&&e.addStructField(i,"vec3","position2D")}function Jnt(e,t,n){const i=bs.FUNCTION_ID_INITIALIZE_ATTRIBUTES,o=t.variableName;if(o==="positionMC"&&n){const a="attributes.position2D = a_position2D;";e.addFunctionLines(i,[a])}if(t.isQuantized)return;const s=[];o==="tangentMC"?(s.push("attributes.tangentMC = a_tangentMC.xyz;"),s.push("attributes.tangentSignMC = a_tangentMC.w;")):s.push(`attributes.${o} = a_${o};`),e.addFunctionLines(i,s)}function Qnt(e,t){const n=t.attribute.semantic,i=t.attribute.setIndex;if(l(n)&&!l(i))return;let o=bs.FUNCTION_ID_SET_DYNAMIC_VARYINGS_VS;const r=t.variableName;let s=`v_${r} = attributes.${r};`;e.addFunctionLines(o,[s]),o=bs.FUNCTION_ID_SET_DYNAMIC_VARYINGS_FS,s=`attributes.${r} = v_${r};`,e.addFunctionLines(o,[s])}function Znt(e,t){let n=!1,i=!1;for(let o=0;o<t.length;o++){const r=t[o];r.semantic===Ut.NORMAL?n=!0:r.semantic===Ut.TANGENT&&(i=!0)}!n||!i||(e.addDefine("HAS_BITANGENTS"),e.addVarying("vec3","v_bitangentEC"),e.addStructField(bs.STRUCT_ID_PROCESSED_ATTRIBUTES_VS,"vec3","bitangentMC"),e.addStructField(bs.STRUCT_ID_PROCESSED_ATTRIBUTES_FS,"vec3","bitangentEC"))}const eit=bs,tit=`#ifdef LIGHTING_PBR
|
||
vec3 computePbrLighting(czm_modelMaterial inputMaterial, ProcessedAttributes attributes)
|
||
{
|
||
czm_pbrParameters pbrParameters;
|
||
pbrParameters.diffuseColor = inputMaterial.diffuse;
|
||
pbrParameters.f0 = inputMaterial.specular;
|
||
pbrParameters.roughness = inputMaterial.roughness;
|
||
|
||
#ifdef USE_CUSTOM_LIGHT_COLOR
|
||
vec3 lightColorHdr = model_lightColorHdr;
|
||
#else
|
||
vec3 lightColorHdr = czm_lightColorHdr;
|
||
#endif
|
||
|
||
vec3 color = inputMaterial.diffuse;
|
||
#ifdef HAS_NORMALS
|
||
color = czm_pbrLighting(
|
||
attributes.positionEC,
|
||
inputMaterial.normalEC,
|
||
czm_lightDirectionEC,
|
||
lightColorHdr,
|
||
pbrParameters
|
||
);
|
||
|
||
#ifdef USE_IBL_LIGHTING
|
||
color += imageBasedLightingStage(
|
||
attributes.positionEC,
|
||
inputMaterial.normalEC,
|
||
czm_lightDirectionEC,
|
||
lightColorHdr,
|
||
pbrParameters
|
||
);
|
||
#endif
|
||
#endif
|
||
|
||
color *= inputMaterial.occlusion;
|
||
color += inputMaterial.emissive;
|
||
|
||
// In HDR mode, the frame buffer is in linear color space. The
|
||
// post-processing stages (see PostProcessStageCollection) will handle
|
||
// tonemapping. However, if HDR is not enabled, we must tonemap else large
|
||
// values may be clamped to 1.0
|
||
#ifndef HDR
|
||
color = czm_acesTonemapping(color);
|
||
#endif
|
||
|
||
return color;
|
||
}
|
||
#endif
|
||
|
||
void lightingStage(inout czm_modelMaterial material, ProcessedAttributes attributes)
|
||
{
|
||
// Even though the lighting will only set the diffuse color,
|
||
// pass all other properties so further stages have access to them.
|
||
vec3 color = vec3(0.0);
|
||
|
||
#ifdef LIGHTING_PBR
|
||
color = computePbrLighting(material, attributes);
|
||
#else // unlit
|
||
color = material.diffuse;
|
||
#endif
|
||
|
||
#ifdef HAS_POINT_CLOUD_COLOR_STYLE
|
||
// The colors resulting from point cloud styles are adjusted differently.
|
||
color = czm_gammaCorrect(color);
|
||
#elif !defined(HDR)
|
||
// If HDR is not enabled, the frame buffer stores sRGB colors rather than
|
||
// linear colors so the linear value must be converted.
|
||
color = czm_linearToSrgb(color);
|
||
#endif
|
||
|
||
material.diffuse = color;
|
||
}
|
||
`,nit={UNLIT:0,PBR:1},r1=Object.freeze(nit),hie={name:"LightingPipelineStage"};hie.process=function(e,t){const n=e.model,i=e.lightingOptions,o=e.shaderBuilder;if(l(n.lightColor)){o.addDefine("USE_CUSTOM_LIGHT_COLOR",void 0,Re.FRAGMENT),o.addUniform("vec3","model_lightColorHdr",Re.FRAGMENT);const s=e.uniformMap;s.model_lightColorHdr=function(){return n.lightColor}}i.lightingModel===r1.PBR?o.addDefine("LIGHTING_PBR",void 0,Re.FRAGMENT):o.addDefine("LIGHTING_UNLIT",void 0,Re.FRAGMENT),o.addFragmentLines(tit)};const iit=hie,oit=`// If the style color is white, it implies the feature has not been styled.
|
||
bool isDefaultStyleColor(vec3 color)
|
||
{
|
||
return all(greaterThan(color, vec3(1.0 - czm_epsilon3)));
|
||
}
|
||
|
||
vec3 blend(vec3 sourceColor, vec3 styleColor, float styleColorBlend)
|
||
{
|
||
vec3 blendColor = mix(sourceColor, styleColor, styleColorBlend);
|
||
vec3 color = isDefaultStyleColor(styleColor.rgb) ? sourceColor : blendColor;
|
||
return color;
|
||
}
|
||
|
||
vec2 computeTextureTransform(vec2 texCoord, mat3 textureTransform)
|
||
{
|
||
return vec2(textureTransform * vec3(texCoord, 1.0));
|
||
}
|
||
|
||
#ifdef HAS_NORMALS
|
||
vec3 computeNormal(ProcessedAttributes attributes)
|
||
{
|
||
// Geometry normal. This is already normalized
|
||
vec3 ng = attributes.normalEC;
|
||
|
||
vec3 normal = ng;
|
||
#if defined(HAS_NORMAL_TEXTURE) && !defined(HAS_WIREFRAME)
|
||
vec2 normalTexCoords = TEXCOORD_NORMAL;
|
||
#ifdef HAS_NORMAL_TEXTURE_TRANSFORM
|
||
normalTexCoords = computeTextureTransform(normalTexCoords, u_normalTextureTransform);
|
||
#endif
|
||
|
||
// If HAS_BITANGENTS is set, then HAS_TANGENTS is also set
|
||
#ifdef HAS_BITANGENTS
|
||
vec3 t = attributes.tangentEC;
|
||
vec3 b = attributes.bitangentEC;
|
||
mat3 tbn = mat3(t, b, ng);
|
||
vec3 n = texture2D(u_normalTexture, normalTexCoords).rgb;
|
||
normal = normalize(tbn * (2.0 * n - 1.0));
|
||
#elif defined(GL_OES_standard_derivatives)
|
||
// Compute tangents
|
||
vec3 positionEC = attributes.positionEC;
|
||
vec3 pos_dx = dFdx(positionEC);
|
||
vec3 pos_dy = dFdy(positionEC);
|
||
vec3 tex_dx = dFdx(vec3(normalTexCoords,0.0));
|
||
vec3 tex_dy = dFdy(vec3(normalTexCoords,0.0));
|
||
vec3 t = (tex_dy.t * pos_dx - tex_dx.t * pos_dy) / (tex_dx.s * tex_dy.t - tex_dy.s * tex_dx.t);
|
||
t = normalize(t - ng * dot(ng, t));
|
||
vec3 b = normalize(cross(ng, t));
|
||
mat3 tbn = mat3(t, b, ng);
|
||
vec3 n = texture2D(u_normalTexture, normalTexCoords).rgb;
|
||
normal = normalize(tbn * (2.0 * n - 1.0));
|
||
#endif
|
||
#endif
|
||
|
||
#ifdef HAS_DOUBLE_SIDED_MATERIAL
|
||
if (czm_backFacing()) {
|
||
normal = -normal;
|
||
}
|
||
#endif
|
||
|
||
return normal;
|
||
}
|
||
#endif
|
||
|
||
void materialStage(inout czm_modelMaterial material, ProcessedAttributes attributes, SelectedFeature feature)
|
||
{
|
||
#ifdef HAS_NORMALS
|
||
material.normalEC = computeNormal(attributes);
|
||
#endif
|
||
|
||
vec4 baseColorWithAlpha = vec4(1.0);
|
||
// Regardless of whether we use PBR, set a base color
|
||
#ifdef HAS_BASE_COLOR_TEXTURE
|
||
vec2 baseColorTexCoords = TEXCOORD_BASE_COLOR;
|
||
|
||
#ifdef HAS_BASE_COLOR_TEXTURE_TRANSFORM
|
||
baseColorTexCoords = computeTextureTransform(baseColorTexCoords, u_baseColorTextureTransform);
|
||
#endif
|
||
|
||
baseColorWithAlpha = czm_srgbToLinear(texture2D(u_baseColorTexture, baseColorTexCoords));
|
||
|
||
#ifdef HAS_BASE_COLOR_FACTOR
|
||
baseColorWithAlpha *= u_baseColorFactor;
|
||
#endif
|
||
#elif defined(HAS_BASE_COLOR_FACTOR)
|
||
baseColorWithAlpha = u_baseColorFactor;
|
||
#endif
|
||
|
||
#ifdef HAS_POINT_CLOUD_COLOR_STYLE
|
||
baseColorWithAlpha = v_pointCloudColor;
|
||
#elif defined(HAS_COLOR_0)
|
||
vec4 color = attributes.color_0;
|
||
// .pnts files store colors in the sRGB color space
|
||
#ifdef HAS_SRGB_COLOR
|
||
color = czm_srgbToLinear(color);
|
||
#endif
|
||
baseColorWithAlpha *= color;
|
||
#endif
|
||
|
||
material.diffuse = baseColorWithAlpha.rgb;
|
||
material.alpha = baseColorWithAlpha.a;
|
||
|
||
#ifdef USE_CPU_STYLING
|
||
material.diffuse = blend(material.diffuse, feature.color.rgb, model_colorBlend);
|
||
#endif
|
||
|
||
#ifdef HAS_OCCLUSION_TEXTURE
|
||
vec2 occlusionTexCoords = TEXCOORD_OCCLUSION;
|
||
#ifdef HAS_OCCLUSION_TEXTURE_TRANSFORM
|
||
occlusionTexCoords = computeTextureTransform(occlusionTexCoords, u_occlusionTextureTransform);
|
||
#endif
|
||
material.occlusion = texture2D(u_occlusionTexture, occlusionTexCoords).r;
|
||
#endif
|
||
|
||
#ifdef HAS_EMISSIVE_TEXTURE
|
||
vec2 emissiveTexCoords = TEXCOORD_EMISSIVE;
|
||
#ifdef HAS_EMISSIVE_TEXTURE_TRANSFORM
|
||
emissiveTexCoords = computeTextureTransform(emissiveTexCoords, u_emissiveTextureTransform);
|
||
#endif
|
||
|
||
vec3 emissive = czm_srgbToLinear(texture2D(u_emissiveTexture, emissiveTexCoords).rgb);
|
||
#ifdef HAS_EMISSIVE_FACTOR
|
||
emissive *= u_emissiveFactor;
|
||
#endif
|
||
material.emissive = emissive;
|
||
#elif defined(HAS_EMISSIVE_FACTOR)
|
||
material.emissive = u_emissiveFactor;
|
||
#endif
|
||
|
||
#if defined(LIGHTING_PBR) && defined(USE_SPECULAR_GLOSSINESS)
|
||
#ifdef HAS_SPECULAR_GLOSSINESS_TEXTURE
|
||
vec2 specularGlossinessTexCoords = TEXCOORD_SPECULAR_GLOSSINESS;
|
||
#ifdef HAS_SPECULAR_GLOSSINESS_TEXTURE_TRANSFORM
|
||
specularGlossinessTexCoords = computeTextureTransform(specularGlossinessTexCoords, u_specularGlossinessTextureTransform);
|
||
#endif
|
||
|
||
vec4 specularGlossiness = czm_srgbToLinear(texture2D(u_specularGlossinessTexture, specularGlossinessTexCoords));
|
||
vec3 specular = specularGlossiness.rgb;
|
||
float glossiness = specularGlossiness.a;
|
||
#ifdef HAS_SPECULAR_FACTOR
|
||
specular *= u_specularFactor;
|
||
#endif
|
||
|
||
#ifdef HAS_GLOSSINESS_FACTOR
|
||
glossiness *= u_glossinessFactor;
|
||
#endif
|
||
#else
|
||
#ifdef HAS_SPECULAR_FACTOR
|
||
vec3 specular = clamp(u_specularFactor, vec3(0.0), vec3(1.0));
|
||
#else
|
||
vec3 specular = vec3(1.0);
|
||
#endif
|
||
|
||
#ifdef HAS_GLOSSINESS_FACTOR
|
||
float glossiness = clamp(u_glossinessFactor, 0.0, 1.0);
|
||
#else
|
||
float glossiness = 1.0;
|
||
#endif
|
||
#endif
|
||
|
||
#ifdef HAS_DIFFUSE_TEXTURE
|
||
vec2 diffuseTexCoords = TEXCOORD_DIFFUSE;
|
||
#ifdef HAS_DIFFUSE_TEXTURE_TRANSFORM
|
||
diffuseTexCoords = computeTextureTransform(diffuseTexCoords, u_diffuseTextureTransform);
|
||
#endif
|
||
|
||
vec4 diffuse = czm_srgbToLinear(texture2D(u_diffuseTexture, diffuseTexCoords));
|
||
#ifdef HAS_DIFFUSE_FACTOR
|
||
diffuse *= u_diffuseFactor;
|
||
#endif
|
||
#elif defined(HAS_DIFFUSE_FACTOR)
|
||
vec4 diffuse = clamp(u_diffuseFactor, vec4(0.0), vec4(1.0));
|
||
#else
|
||
vec4 diffuse = vec4(1.0);
|
||
#endif
|
||
czm_pbrParameters parameters = czm_pbrSpecularGlossinessMaterial(
|
||
diffuse.rgb,
|
||
specular,
|
||
glossiness
|
||
);
|
||
material.diffuse = parameters.diffuseColor;
|
||
// the specular glossiness extension's alpha overrides anything set
|
||
// by the base material.
|
||
material.alpha = diffuse.a;
|
||
material.specular = parameters.f0;
|
||
material.roughness = parameters.roughness;
|
||
#elif defined(LIGHTING_PBR)
|
||
#ifdef HAS_METALLIC_ROUGHNESS_TEXTURE
|
||
vec2 metallicRoughnessTexCoords = TEXCOORD_METALLIC_ROUGHNESS;
|
||
#ifdef HAS_METALLIC_ROUGHNESS_TEXTURE_TRANSFORM
|
||
metallicRoughnessTexCoords = computeTextureTransform(metallicRoughnessTexCoords, u_metallicRoughnessTextureTransform);
|
||
#endif
|
||
|
||
vec3 metallicRoughness = texture2D(u_metallicRoughnessTexture, metallicRoughnessTexCoords).rgb;
|
||
float metalness = clamp(metallicRoughness.b, 0.0, 1.0);
|
||
float roughness = clamp(metallicRoughness.g, 0.04, 1.0);
|
||
#ifdef HAS_METALLIC_FACTOR
|
||
metalness *= u_metallicFactor;
|
||
#endif
|
||
|
||
#ifdef HAS_ROUGHNESS_FACTOR
|
||
roughness *= u_roughnessFactor;
|
||
#endif
|
||
#else
|
||
#ifdef HAS_METALLIC_FACTOR
|
||
float metalness = clamp(u_metallicFactor, 0.0, 1.0);
|
||
#else
|
||
float metalness = 1.0;
|
||
#endif
|
||
|
||
#ifdef HAS_ROUGHNESS_FACTOR
|
||
float roughness = clamp(u_roughnessFactor, 0.04, 1.0);
|
||
#else
|
||
float roughness = 1.0;
|
||
#endif
|
||
#endif
|
||
czm_pbrParameters parameters = czm_pbrMetallicRoughnessMaterial(
|
||
material.diffuse,
|
||
metalness,
|
||
roughness
|
||
);
|
||
material.diffuse = parameters.diffuseColor;
|
||
material.specular = parameters.f0;
|
||
material.roughness = parameters.roughness;
|
||
#endif
|
||
}
|
||
`,rit=Yt.Material,HR=Yt.MetallicRoughness,VR=Yt.SpecularGlossiness,pie={name:"MaterialPipelineStage",_processTexture:Wm,_processTextureTransform:mie};pie.process=function(e,t,n){const i=t.material,o=e.model,r=l(o.classificationType),s=r,a=e.uniformMap,c=e.shaderBuilder,u=n.context.defaultTexture,f=n.context.defaultNormalTexture,h=n.context.defaultEmissiveTexture;sit(i,a,c,u,f,h,s),l(i.specularGlossiness)?ait(i,a,c,u,s):cit(i,a,c,u,s);const _=gn.getAttributeBySemantic(t,Ut.NORMAL),g=e.lightingOptions;i.unlit||!_||r?g.lightingModel=r1.UNLIT:g.lightingModel=r1.PBR;const p=o.backFaceCulling&&!i.doubleSided;e.renderStateOptions.cull.enabled=p;const y=e.alphaOptions;i.alphaMode===QI.BLEND?y.pass=We.TRANSLUCENT:i.alphaMode===QI.MASK&&(y.alphaCutoff=i.alphaCutoff),c.addFragmentLines(oit),i.doubleSided&&c.addDefine("HAS_DOUBLE_SIDED_MATERIAL",void 0,Re.BOTH)};function mie(e,t,n,i,o){const r=`HAS_${o}_TEXTURE_TRANSFORM`;e.addDefine(r,void 0,Re.FRAGMENT);const s=`${i}Transform`;e.addUniform("mat3",s,Re.FRAGMENT),t[s]=function(){return n.transform}}function Wm(e,t,n,i,o,r){e.addUniform("sampler2D",i,Re.FRAGMENT),t[i]=function(){return A(n.texture,r)};const s=`HAS_${o}_TEXTURE`;e.addDefine(s,void 0,Re.FRAGMENT);const c=`v_texCoord_${n.texCoord}`,u=`TEXCOORD_${o}`;e.addDefine(u,c,Re.FRAGMENT);const f=n.transform;l(f)&&!te.equals(f,te.IDENTITY)&&mie(e,t,n,i,o)}function sit(e,t,n,i,o,r,s){const a=e.emissiveTexture;l(a)&&!s&&Wm(n,t,a,"u_emissiveTexture","EMISSIVE",r);const c=e.emissiveFactor;l(c)&&!d.equals(c,rit.DEFAULT_EMISSIVE_FACTOR)&&(n.addUniform("vec3","u_emissiveFactor",Re.FRAGMENT),t.u_emissiveFactor=function(){return e.emissiveFactor},n.addDefine("HAS_EMISSIVE_FACTOR",void 0,Re.FRAGMENT));const u=e.normalTexture;l(u)&&!s&&Wm(n,t,u,"u_normalTexture","NORMAL",o);const f=e.occlusionTexture;l(f)&&!s&&Wm(n,t,f,"u_occlusionTexture","OCCLUSION",i)}function ait(e,t,n,i,o){const r=e.specularGlossiness;n.addDefine("USE_SPECULAR_GLOSSINESS",void 0,Re.FRAGMENT);const s=r.diffuseTexture;l(s)&&!o&&Wm(n,t,s,"u_diffuseTexture","DIFFUSE",i);const a=r.diffuseFactor;l(a)&&!ue.equals(a,VR.DEFAULT_DIFFUSE_FACTOR)&&(n.addUniform("vec4","u_diffuseFactor",Re.FRAGMENT),t.u_diffuseFactor=function(){return r.diffuseFactor},n.addDefine("HAS_DIFFUSE_FACTOR",void 0,Re.FRAGMENT));const c=r.specularGlossinessTexture;l(c)&&!o&&Wm(n,t,c,"u_specularGlossinessTexture","SPECULAR_GLOSSINESS",i);const u=r.specularFactor;l(u)&&!d.equals(u,VR.DEFAULT_SPECULAR_FACTOR)&&(n.addUniform("vec3","u_specularFactor",Re.FRAGMENT),t.u_specularFactor=function(){return r.specularFactor},n.addDefine("HAS_SPECULAR_FACTOR",void 0,Re.FRAGMENT));const f=r.glossinessFactor;l(f)&&f!==VR.DEFAULT_GLOSSINESS_FACTOR&&(n.addUniform("float","u_glossinessFactor",Re.FRAGMENT),t.u_glossinessFactor=function(){return r.glossinessFactor},n.addDefine("HAS_GLOSSINESS_FACTOR",void 0,Re.FRAGMENT))}function cit(e,t,n,i,o){const r=e.metallicRoughness;n.addDefine("USE_METALLIC_ROUGHNESS",void 0,Re.FRAGMENT);const s=r.baseColorTexture;l(s)&&!o&&Wm(n,t,s,"u_baseColorTexture","BASE_COLOR",i);const a=r.baseColorFactor;l(a)&&!ue.equals(a,HR.DEFAULT_BASE_COLOR_FACTOR)&&(n.addUniform("vec4","u_baseColorFactor",Re.FRAGMENT),t.u_baseColorFactor=function(){return r.baseColorFactor},n.addDefine("HAS_BASE_COLOR_FACTOR",void 0,Re.FRAGMENT));const c=r.metallicRoughnessTexture;l(c)&&!o&&Wm(n,t,c,"u_metallicRoughnessTexture","METALLIC_ROUGHNESS",i);const u=r.metallicFactor;l(u)&&u!==HR.DEFAULT_METALLIC_FACTOR&&(n.addUniform("float","u_metallicFactor",Re.FRAGMENT),t.u_metallicFactor=function(){return r.metallicFactor},n.addDefine("HAS_METALLIC_FACTOR",void 0,Re.FRAGMENT));const f=r.roughnessFactor;l(f)&&f!==HR.DEFAULT_ROUGHNESS_FACTOR&&(n.addUniform("float","u_roughnessFactor",Re.FRAGMENT),t.u_roughnessFactor=function(){return r.roughnessFactor},n.addDefine("HAS_ROUGHNESS_FACTOR",void 0,Re.FRAGMENT))}const lit=pie,uit=`void morphTargetsStage(inout ProcessedAttributes attributes)
|
||
{
|
||
vec3 positionMC = attributes.positionMC;
|
||
attributes.positionMC = getMorphedPosition(positionMC);
|
||
|
||
#ifdef HAS_NORMALS
|
||
vec3 normalMC = attributes.normalMC;
|
||
attributes.normalMC = getMorphedNormal(normalMC);
|
||
#endif
|
||
|
||
#ifdef HAS_TANGENTS
|
||
vec3 tangentMC = attributes.tangentMC;
|
||
attributes.tangentMC = getMorphedTangent(tangentMC);
|
||
#endif
|
||
}`,oa={name:"MorphTargetsPipelineStage",FUNCTION_ID_GET_MORPHED_POSITION:"getMorphedPosition",FUNCTION_SIGNATURE_GET_MORPHED_POSITION:"vec3 getMorphedPosition(in vec3 position)",FUNCTION_ID_GET_MORPHED_NORMAL:"getMorphedNormal",FUNCTION_SIGNATURE_GET_MORPHED_NORMAL:"vec3 getMorphedNormal(in vec3 normal)",FUNCTION_ID_GET_MORPHED_TANGENT:"getMorphedTangent",FUNCTION_SIGNATURE_GET_MORPHED_TANGENT:"vec3 getMorphedTangent(in vec3 tangent)"};oa.process=function(e,t){const n=e.shaderBuilder;n.addDefine("HAS_MORPH_TARGETS",void 0,Re.VERTEX),_it(n);const i=t.morphTargets.length;for(let a=0;a<i;a++){const c=t.morphTargets[a].attributes,u=c.length;for(let f=0;f<u;f++){const h=c[f],_=h.semantic;_!==Ut.POSITION&&_!==Ut.NORMAL&&_!==Ut.TANGENT||(dit(e,h,e.attributeIndex,a),e.attributeIndex++)}}git(n);const r=e.runtimeNode.morphWeights.length;n.addUniform("float",`u_morphWeights[${r}]`,Re.VERTEX),n.addVertexLines(uit);const s={u_morphWeights:function(){return e.runtimeNode.morphWeights}};e.uniformMap=Ln(s,e.uniformMap)};const fit={attributeString:void 0,functionId:void 0};function dit(e,t,n,i){const o=e.shaderBuilder;hit(e,t,n);const r=pit(t,fit);mit(o,r,i)}function hit(e,t,n){const i={index:n,value:l(t.buffer)?void 0:t.constant,vertexBuffer:t.buffer,componentsPerAttribute:Nn.getNumberOfComponents(t.type),componentDatatype:t.componentDatatype,offsetInBytes:t.byteOffset,strideInBytes:t.byteStride,normalize:t.normalized};e.attributes.push(i)}function pit(e,t){switch(e.semantic){case Ut.POSITION:t.attributeString="Position",t.functionId=oa.FUNCTION_ID_GET_MORPHED_POSITION;break;case Ut.NORMAL:t.attributeString="Normal",t.functionId=oa.FUNCTION_ID_GET_MORPHED_NORMAL;break;case Ut.TANGENT:t.attributeString="Tangent",t.functionId=oa.FUNCTION_ID_GET_MORPHED_TANGENT;break}return t}function mit(e,t,n){const i=t.attributeString,o=`a_target${i}_${n}`,r=`morphed${i} += u_morphWeights[${n}] * a_target${i}_${n};`;e.addAttribute("vec3",o),e.addFunctionLines(t.functionId,[r])}function _it(e){e.addFunction(oa.FUNCTION_ID_GET_MORPHED_POSITION,oa.FUNCTION_SIGNATURE_GET_MORPHED_POSITION,Re.VERTEX);const t="vec3 morphedPosition = position;";e.addFunctionLines(oa.FUNCTION_ID_GET_MORPHED_POSITION,[t]),e.addFunction(oa.FUNCTION_ID_GET_MORPHED_NORMAL,oa.FUNCTION_SIGNATURE_GET_MORPHED_NORMAL,Re.VERTEX);const n="vec3 morphedNormal = normal;";e.addFunctionLines(oa.FUNCTION_ID_GET_MORPHED_NORMAL,[n]),e.addFunction(oa.FUNCTION_ID_GET_MORPHED_TANGENT,oa.FUNCTION_SIGNATURE_GET_MORPHED_TANGENT,Re.VERTEX);const i="vec3 morphedTangent = tangent;";e.addFunctionLines(oa.FUNCTION_ID_GET_MORPHED_TANGENT,[i])}function git(e){const t="return morphedPosition;";e.addFunctionLines(oa.FUNCTION_ID_GET_MORPHED_POSITION,[t]);const n="return morphedNormal;";e.addFunctionLines(oa.FUNCTION_ID_GET_MORPHED_NORMAL,[n]);const i="return morphedTangent;";e.addFunctionLines(oa.FUNCTION_ID_GET_MORPHED_TANGENT,[i])}const yit=oa,_ie={name:"PickingPipelineStage"};_ie.process=function(e,t,n){const i=n.context,o=e.runtimeNode,r=e.shaderBuilder,s=e.model,a=o.node.instances;if(e.hasPropertyTable)Ait(e,t,a);else if(l(a))Tit(e,i);else{const c=gie(e),u=i.createPickId(c);s._pipelineResources.push(u),s._pickIds.push(u),r.addUniform("vec4","czm_pickColor",Re.FRAGMENT);const f=e.uniformMap;f.czm_pickColor=function(){return u.color},e.pickId="czm_pickColor"}};function gie(e,t){const n=e.model;if(l(n.pickObject))return n.pickObject;const i={model:n,node:e.runtimeNode,primitive:e.runtimePrimitive};let o;if(Xa.is3DTiles(n.type)){const r=n.content;o={content:r,primitive:r.tileset,detail:i}}else o={primitive:n,detail:i};return o.id=n.id,l(t)&&(o.instanceId=t),o}function Ait(e,t,n){const i=e.model;let o,r;const s=i.featureIdLabel,a=i.instanceFeatureIdLabel;l(i.featureTableId)?o=i.featureTableId:l(n)?(r=gn.getFeatureIdsByLabel(n.featureIds,a),o=r.propertyTableId):(r=gn.getFeatureIdsByLabel(t.featureIds,s),o=r.propertyTableId);const c=i.featureTables[o];e.shaderBuilder.addUniform("sampler2D","model_pickTexture",Re.FRAGMENT);const f=c.batchTexture;e.uniformMap.model_pickTexture=function(){return A(f.pickTexture,f.defaultTexture)},e.pickId="((selectedFeature.id < int(model_featuresLength)) ? texture2D(model_pickTexture, selectedFeature.st) : vec4(0.0))"}function Tit(e,t){const n=e.instanceCount,i=new Array(n),o=new Uint8Array(n*4),r=e.model,s=r._pipelineResources;for(let h=0;h<n;h++){const _=gie(e,h),g=t.createPickId(_);s.push(g),i[h]=g;const p=g.color;o[h*4+0]=k.floatToByte(p.red),o[h*4+1]=k.floatToByte(p.green),o[h*4+2]=k.floatToByte(p.blue),o[h*4+3]=k.floatToByte(p.alpha)}r._pickIds=i;const a=Mt.createVertexBuffer({context:t,typedArray:o,usage:mt.STATIC_DRAW});a.vertexArrayDestroyable=!1;const c=!1;r.statistics.addBuffer(a,c),s.push(a);const u={index:e.attributeIndex++,vertexBuffer:a,componentsPerAttribute:4,componentDatatype:oe.UNSIGNED_BYTE,normalize:!0,offsetInBytes:0,strideInBytes:0,instanceDivisor:1};e.attributes.push(u);const f=e.shaderBuilder;f.addDefine("USE_PICKING",void 0,Re.BOTH),f.addAttribute("vec4","a_pickColor"),f.addVarying("vec4","v_pickColor"),e.pickId="v_pickColor"}const Cit=_ie,bit=`float getPointSizeFromAttenuation(vec3 positionEC) {
|
||
// Variables are packed into a single vector to minimize gl.uniformXXX() calls
|
||
float pointSize = model_pointCloudParameters.x;
|
||
float geometricError = model_pointCloudParameters.y;
|
||
float depthMultiplier = model_pointCloudParameters.z;
|
||
|
||
float depth = -positionEC.z;
|
||
return min((geometricError / depth) * depthMultiplier, pointSize);
|
||
}
|
||
|
||
#ifdef HAS_POINT_CLOUD_SHOW_STYLE
|
||
float pointCloudShowStylingStage(in ProcessedAttributes attributes, in Metadata metadata) {
|
||
float tiles3d_tileset_time = model_pointCloudParameters.w;
|
||
return float(getShowFromStyle(attributes, metadata, tiles3d_tileset_time));
|
||
}
|
||
#endif
|
||
|
||
#ifdef HAS_POINT_CLOUD_COLOR_STYLE
|
||
vec4 pointCloudColorStylingStage(in ProcessedAttributes attributes, in Metadata metadata) {
|
||
float tiles3d_tileset_time = model_pointCloudParameters.w;
|
||
return getColorFromStyle(attributes, metadata, tiles3d_tileset_time);
|
||
}
|
||
#endif
|
||
|
||
#ifdef HAS_POINT_CLOUD_POINT_SIZE_STYLE
|
||
float pointCloudPointSizeStylingStage(in ProcessedAttributes attributes, in Metadata metadata) {
|
||
float tiles3d_tileset_time = model_pointCloudParameters.w;
|
||
return float(getPointSizeFromStyle(attributes, metadata, tiles3d_tileset_time));
|
||
}
|
||
#elif defined(HAS_POINT_CLOUD_ATTENUATION)
|
||
float pointCloudPointSizeStylingStage(in ProcessedAttributes attributes, in Metadata metadata) {
|
||
return getPointSizeFromAttenuation(v_positionEC);
|
||
}
|
||
#endif
|
||
|
||
#ifdef HAS_POINT_CLOUD_BACK_FACE_CULLING
|
||
float pointCloudBackFaceCullingStage() {
|
||
#if defined(HAS_NORMALS) && !defined(HAS_DOUBLE_SIDED_MATERIAL)
|
||
// This needs to be computed in eye coordinates so we can't use attributes.normalMC
|
||
return step(-v_normalEC.z, 0.0);
|
||
#else
|
||
return 1.0;
|
||
#endif
|
||
}
|
||
#endif`,Eit=new ue,yie={name:"PointCloudStylingPipelineStage"};yie.process=function(e,t,n){const i=e.shaderBuilder,o=e.model,r=o.style,s=o.structuralMetadata,a=l(s)?s.propertyAttributes:void 0,c=l(o.featureTableId)&&o.featureTables[o.featureTableId].featuresLength>0,u=!l(a)&&c;if(l(r)&&!u){const y=vit(a),T=Dit(r,y);Iit(i,T);const x=Pit(T).indexOf("normalMC")>=0,v=gn.getAttributeBySemantic(t,Ut.NORMAL);if(x&&!v)throw new Fe("Style references the NORMAL semantic but the point cloud does not have normals");i.addDefine("COMPUTE_POSITION_WC_STYLE",void 0,Re.VERTEX),T.styleTranslucent&&(e.alphaOptions.pass=We.TRANSLUCENT)}const f=o.pointCloudShading;f.attenuation&&i.addDefine("HAS_POINT_CLOUD_ATTENUATION",void 0,Re.VERTEX),f.backFaceCulling&&i.addDefine("HAS_POINT_CLOUD_BACK_FACE_CULLING",void 0,Re.VERTEX);let h,_,g;Xa.is3DTiles(o.type)&&(_=!0,h=o.content,g=h.tile.refine===_c.ADD),i.addUniform("vec4","model_pointCloudParameters",Re.VERTEX),i.addVertexLines(bit);const p=e.uniformMap;p.model_pointCloudParameters=function(){const y=Eit;let T=1;_&&(T=g?5:h.tileset.maximumScreenSpaceError),y.x=A(f.maximumAttenuation,T),y.x*=n.pixelRatio;const b=xit(e,t,f,h);y.y=b*f.geometricErrorScale;const x=n.context,v=n.camera.frustum;let D;return n.mode===me.SCENE2D||v instanceof nn?D=Number.POSITIVE_INFINITY:D=x.drawingBufferHeight/n.camera.frustum.sseDenominator,y.z=D,_&&(y.w=h.tileset.timeSinceLoad),y}};const gq=new d;function xit(e,t,n,i){if(l(i)){const f=i.tile.geometricError;if(f>0)return f}if(l(n.baseResolution))return n.baseResolution;const o=gn.getAttributeBySemantic(t,Ut.POSITION),r=o.count,s=e.runtimeNode.transform;let a=d.subtract(o.max,o.min,gq);a=N.multiplyByPointAsVector(s,a,gq);const c=a.x*a.y*a.z;return F.cbrt(c/r)}const wit={colorStyleFunction:void 0,showStyleFunction:void 0,pointSizeStyleFunction:void 0,styleTranslucent:!1},Sit={POSITION:"attributes.positionMC",POSITION_ABSOLUTE:"v_positionWC",COLOR:"attributes.color_0",NORMAL:"attributes.normalMC"};function vit(e){const t=St(Sit);if(!l(e))return t;for(let n=0;n<e.length;n++){const o=e[n].properties;for(const r in o)o.hasOwnProperty(r)&&(t[r]=`metadata.${r}`)}return t}const kR="ProcessedAttributes attributes, Metadata metadata, float tiles3d_tileset_time";function Dit(e,t){const n=wit,i={translucent:!1};return n.colorStyleFunction=e.getColorShaderFunction(`getColorFromStyle(${kR})`,t,i),n.showStyleFunction=e.getShowShaderFunction(`getShowFromStyle(${kR})`,t,i),n.pointSizeStyleFunction=e.getPointSizeShaderFunction(`getPointSizeFromStyle(${kR})`,t,i),n.styleTranslucent=l(n.colorStyleFunction)&&i.translucent,n}function Iit(e,t){const n=t.colorStyleFunction;l(n)&&(e.addDefine("HAS_POINT_CLOUD_COLOR_STYLE",void 0,Re.BOTH),e.addVertexLines(n),e.addVarying("vec4","v_pointCloudColor"));const i=t.showStyleFunction;l(i)&&(e.addDefine("HAS_POINT_CLOUD_SHOW_STYLE",void 0,Re.VERTEX),e.addVertexLines(i));const o=t.pointSizeStyleFunction;l(o)&&(e.addDefine("HAS_POINT_CLOUD_POINT_SIZE_STYLE",void 0,Re.VERTEX),e.addVertexLines(o))}function GR(e,t){const n=/attributes\.(\w+)/g;let i=n.exec(e);for(;i!==null;){const o=i[1];t.indexOf(o)===-1&&t.push(o),i=n.exec(e)}}function Pit(e){const t=e.colorStyleFunction,n=e.showStyleFunction,i=e.pointSizeStyleFunction,o=[];return l(t)&&GR(t,o),l(n)&&GR(n,o),l(i)&&GR(i,o),o}const Oit=yie,Lit=`void primitiveOutlineStage() {
|
||
v_outlineCoordinates = a_outlineCoordinates;
|
||
}
|
||
`,Bit=`void primitiveOutlineStage(inout czm_modelMaterial material) {
|
||
if (!model_showOutline) {
|
||
return;
|
||
}
|
||
|
||
float outlineX =
|
||
texture2D(model_outlineTexture, vec2(v_outlineCoordinates.x, 0.5)).r;
|
||
float outlineY =
|
||
texture2D(model_outlineTexture, vec2(v_outlineCoordinates.y, 0.5)).r;
|
||
float outlineZ =
|
||
texture2D(model_outlineTexture, vec2(v_outlineCoordinates.z, 0.5)).r;
|
||
float outlineness = max(outlineX, max(outlineY, outlineZ));
|
||
|
||
material.diffuse = mix(material.diffuse, model_outlineColor.rgb, model_outlineColor.a * outlineness);
|
||
}
|
||
|
||
`,Aie={name:"PrimitiveOutlinePipelineStage"};Aie.process=function(e,t,n){const i=e.shaderBuilder,o=e.uniformMap;i.addDefine("HAS_PRIMITIVE_OUTLINE",void 0,Re.BOTH),i.addAttribute("vec3","a_outlineCoordinates"),i.addVarying("vec3","v_outlineCoordinates");const r=t.outlineCoordinates,s={index:e.attributeIndex++,vertexBuffer:r.buffer,componentsPerAttribute:Nn.getNumberOfComponents(r.type),componentDatatype:r.componentDatatype,offsetInBytes:r.byteOffset,strideInBytes:r.byteStride,normalize:r.normalized};e.attributes.push(s),i.addUniform("sampler2D","model_outlineTexture",Re.FRAGMENT);const a=Ux.createTexture(n.context);o.model_outlineTexture=function(){return a};const c=e.model;i.addUniform("vec4","model_outlineColor",Re.FRAGMENT),o.model_outlineColor=function(){return c.outlineColor},i.addUniform("bool","model_showOutline",Re.FRAGMENT),o.model_showOutline=function(){return c.showOutline},i.addVertexLines(Lit),i.addFragmentLines(Bit)};const Rit=Aie,Tie={name:"PrimitiveStatisticsPipelineStage",_countGeometry:Cie,_count2DPositions:bie,_countMorphTargetAttributes:Eie,_countMaterialTextures:xie,_countFeatureIdTextures:wie,_countBinaryMetadata:Sie};Tie.process=function(e,t,n){const i=e.model,o=i.statistics;Cie(o,t),bie(o,e.runtimePrimitive),Eie(o,t),xie(o,t.material),wie(o,t.featureIds),Sie(o,i)};function Cie(e,t){const n=l(t.indices)?t.indices.count:gn.getAttributeBySemantic(t,"POSITION").count,i=t.primitiveType;i===dt.POINTS?e.pointsLength+=n:dt.isTriangles(i)&&(e.trianglesLength+=Nit(i,n));const o=t.attributes,r=o.length;for(let c=0;c<r;c++){const u=o[c];if(l(u.buffer)){const f=l(u.typedArray);e.addBuffer(u.buffer,f)}}const s=t.outlineCoordinates;l(s)&&l(s.buffer)&&e.addBuffer(s.buffer,!1);const a=t.indices;if(l(a)&&l(a.buffer)){const c=l(a.typedArray);e.addBuffer(a.buffer,c)}}function Nit(e,t){switch(e){case dt.TRIANGLES:return t/3;case dt.TRIANGLE_STRIP:case dt.TRIANGLE_FAN:return Math.max(t-2,0);default:return 0}}function bie(e,t){const n=t.positionBuffer2D;l(n)&&e.addBuffer(n,!0)}function Eie(e,t){const n=t.morphTargets;if(!l(n))return;const i=!1,o=n.length;for(let r=0;r<o;r++){const s=n[r].attributes,a=s.length;for(let c=0;c<a;c++){const u=s[c];l(u.buffer)&&e.addBuffer(u.buffer,i)}}}function xie(e,t){const n=Mit(t),i=n.length;for(let o=0;o<i;o++){const r=n[o];l(r)&&l(r.texture)&&e.addTexture(r.texture)}}function Mit(e){const t=e.metallicRoughness,n=[e.emissiveTexture,e.normalTexture,e.occlusionTexture,t.baseColorTexture,t.metallicRoughnessTexture],i=e.specularGlossiness;return l(i)&&(n.push(i.diffuseTexture),n.push(i.specularGlossinessTexture)),n}function wie(e,t){const n=t.length;for(let i=0;i<n;i++){const o=t[i];if(o instanceof Yt.FeatureIdTexture){const r=o.textureReader;l(r.texture)&&e.addTexture(r.texture)}}}function Sie(e,t){const n=t.structuralMetadata;l(n)&&(Fit(e,n),e.propertyTablesByteLength+=n.propertyTablesByteLength);const i=t.featureTables;if(!l(i))return;const o=i.length;for(let r=0;r<o;r++){const s=i[r];e.addBatchTexture(s.batchTexture)}}function Fit(e,t){const n=t.propertyTextures;if(!l(n))return;const i=n.length;for(let o=0;o<i;o++){const s=n[o].properties;for(const a in s)if(s.hasOwnProperty(a)){const u=s[a].textureReader;l(u.texture)&&e.addTexture(u.texture)}}}const zit=Tie,Uit=new N,Hit=new N,vie={name:"SceneMode2DPipelineStage"};vie.process=function(e,t,n){const i=gn.getAttributeBySemantic(t,Ut.POSITION),o=e.shaderBuilder,r=e.model,s=r.sceneGraph.computedModelMatrix,a=e.runtimeNode.computedTransform,c=N.multiplyTransformation(s,a,Uit),u=Git(e,c,n),f=e.runtimePrimitive;f.boundingSphere2D=u;const h=e.runtimeNode.node.instances;if(l(h))return;if(l(i.typedArray)){const y=jit(i,c,u,n);f.positionBuffer2D=y,r._modelResources.push(y),i.typedArray=void 0}o.addDefine("USE_2D_POSITIONS",void 0,Re.VERTEX),o.addUniform("mat4","u_modelView2D",Re.VERTEX);const _=N.fromTranslation(u.center,new N),g=n.context,p={u_modelView2D:function(){return N.multiplyTransformation(g.uniformState.view,_,Hit)}};e.uniformMap=Ln(p,e.uniformMap)};const Vit=new d,kit=new d;function Git(e,t,n){const i=N.multiplyByPoint(t,e.positionMin,Vit),o=es.computeActualWgs84Position(n,i,i),r=N.multiplyByPoint(t,e.positionMax,kit),s=es.computeActualWgs84Position(n,r,r);return Ae.fromCornerPoints(o,s,new Ae)}const Die=new d;function Wit(e,t){const n=e.length,i=new Float32Array(n),o=t.quantizedVolumeOffset,r=t.quantizedVolumeStepSize;for(let s=0;s<n;s+=3){const a=d.fromArray(e,s,Die),c=d.multiplyComponents(a,r,a),u=d.add(c,o,c);i[s]=u.x,i[s+1]=u.y,i[s+2]=u.z}return i}function qit(e,t,n,i){let o;l(e.quantization)?o=Wit(e.typedArray,e.quantization):o=e.typedArray.slice();const r=e.byteOffset/Float32Array.BYTES_PER_ELEMENT,s=o.length,a=l(e.byteStride)?e.byteStride/Float32Array.BYTES_PER_ELEMENT:3;for(let c=r;c<s;c+=a){const u=d.fromArray(o,c,Die);if(isNaN(u.x)||isNaN(u.y)||isNaN(u.z))continue;const f=N.multiplyByPoint(t,u,u),h=es.computeActualWgs84Position(i,f,f),_=d.subtract(h,n,h);o[c]=_.x,o[c+1]=_.y,o[c+2]=_.z}return o}function jit(e,t,n,i){const o=St(i);o.mode=me.COLUMBUS_VIEW;const r=n.center,s=qit(e,t,r,o),a=Mt.createVertexBuffer({context:i.context,typedArray:s,usage:mt.STATIC_DRAW});return a.vertexArrayDestroyable=!1,a}const Yit=vie,$it=`void skinningStage(inout ProcessedAttributes attributes)
|
||
{
|
||
mat4 skinningMatrix = getSkinningMatrix();
|
||
mat3 skinningMatrixMat3 = mat3(skinningMatrix);
|
||
|
||
vec4 positionMC = vec4(attributes.positionMC, 1.0);
|
||
attributes.positionMC = vec3(skinningMatrix * positionMC);
|
||
|
||
#ifdef HAS_NORMALS
|
||
vec3 normalMC = attributes.normalMC;
|
||
attributes.normalMC = skinningMatrixMat3 * normalMC;
|
||
#endif
|
||
|
||
#ifdef HAS_TANGENTS
|
||
vec3 tangentMC = attributes.tangentMC;
|
||
attributes.tangentMC = skinningMatrixMat3 * tangentMC;
|
||
#endif
|
||
}`,Ig={name:"SkinningPipelineStage",FUNCTION_ID_GET_SKINNING_MATRIX:"getSkinningMatrix",FUNCTION_SIGNATURE_GET_SKINNING_MATRIX:"mat4 getSkinningMatrix()"};Ig.process=function(e,t){const n=e.shaderBuilder;n.addDefine("HAS_SKINNING",void 0,Re.VERTEX),Kit(n,t);const i=e.runtimeNode,o=i.computedJointMatrices;n.addUniform("mat4",`u_jointMatrices[${o.length}]`,Re.VERTEX),n.addVertexLines($it);const r={u_jointMatrices:function(){return i.computedJointMatrices}};e.uniformMap=Ln(r,e.uniformMap)};function Xit(e){let t=-1;const n=e.attributes,i=n.length;for(let o=0;o<i;o++){const r=n[o];(r.semantic===Ut.JOINTS||r.semantic===Ut.WEIGHTS)&&(t=Math.max(t,r.setIndex))}return t}function Kit(e,t){e.addFunction(Ig.FUNCTION_ID_GET_SKINNING_MATRIX,Ig.FUNCTION_SIGNATURE_GET_SKINNING_MATRIX,Re.VERTEX);const n="mat4 skinnedMatrix = mat4(0);";e.addFunctionLines(Ig.FUNCTION_ID_GET_SKINNING_MATRIX,[n]);let i,o;const r=["x","y","z","w"],s=Xit(t);for(i=0;i<=s;i++)for(o=0;o<=3;o++){const c=r[o],u=`skinnedMatrix += a_weights_${i}.${c} * u_jointMatrices[int(a_joints_${i}.${c})];`;e.addFunctionLines(Ig.FUNCTION_ID_GET_SKINNING_MATRIX,[u])}const a="return skinnedMatrix;";e.addFunctionLines(Ig.FUNCTION_ID_GET_SKINNING_MATRIX,[a])}const Jit=Ig,DU={};function Qit(e){const t=At.createTypedArray(e,e*2),n=e;let i=0;for(let o=0;o<n;o+=3)t[i++]=o,t[i++]=o+1,t[i++]=o+1,t[i++]=o+2,t[i++]=o+2,t[i++]=o;return t}function Zit(e,t){const n=t.length,i=At.createTypedArray(e,n*2);let o=0;for(let r=0;r<n;r+=3){const s=t[r],a=t[r+1],c=t[r+2];i[o++]=s,i[o++]=a,i[o++]=a,i[o++]=c,i[o++]=c,i[o++]=s}return i}function eot(e){const t=e-2,n=2+t*4,i=At.createTypedArray(e,n);let o=0;i[o++]=0,i[o++]=1;for(let r=0;r<t;r++)i[o++]=r+1,i[o++]=r+2,i[o++]=r+2,i[o++]=r;return i}function tot(e,t){const i=t.length-2,o=2+i*4,r=At.createTypedArray(e,o);let s=0;r[s++]=t[0],r[s++]=t[1];for(let a=0;a<i;a++){const c=t[a],u=t[a+1],f=t[a+2];r[s++]=u,r[s++]=f,r[s++]=f,r[s++]=c}return r}function not(e){const t=e-2,n=2+t*4,i=At.createTypedArray(e,n);let o=0;i[o++]=0,i[o++]=1;for(let r=0;r<t;r++)i[o++]=r+1,i[o++]=r+2,i[o++]=r+2,i[o++]=0;return i}function iot(e,t){const i=t.length-2,o=2+i*4,r=At.createTypedArray(e,o);let s=0;const a=t[0];r[s++]=a,r[s++]=t[1];for(let c=0;c<i;c++){const u=t[c+1],f=t[c+2];r[s++]=u,r[s++]=f,r[s++]=f,r[s++]=a}return r}DU.createWireframeIndices=function(e,t,n){const i=l(n);if(e===dt.TRIANGLES)return i?Zit(t,n):Qit(t);if(e===dt.TRIANGLE_STRIP)return i?tot(t,n):eot(t);if(e===dt.TRIANGLE_FAN)return i?iot(t,n):not(t)};DU.getWireframeIndicesCount=function(e,t){return e===dt.TRIANGLES?t*2:e===dt.TRIANGLE_STRIP||e===dt.TRIANGLE_FAN?2+(t-2)*4:t};const Iie=DU,Pie={name:"WireframePipelineStage"};Pie.process=function(e,t,n){e.shaderBuilder.addDefine("HAS_WIREFRAME",void 0,Re.FRAGMENT);const o=e.model,r=oot(t,e.indices,n);o._pipelineResources.push(r),e.wireframeIndexBuffer=r;const s=!1;o.statistics.addBuffer(r,s);const a=e.primitiveType,c=e.count;e.primitiveType=dt.LINES,e.count=Iie.getWireframeIndicesCount(a,c)};function oot(e,t,n){const o=gn.getAttributeBySemantic(e,Ut.POSITION).count,r=n.context.webgl2;let s;if(l(t)){const f=t.buffer,h=t.count;l(f)&&r?(s=f.sizeInBytes===h?new Uint8Array(h):At.createTypedArray(o,h),f.getBufferData(s)):s=t.typedArray}const a=e.primitiveType,c=Iie.createWireframeIndices(a,o,s),u=At.fromSizeInBytes(c.BYTES_PER_ELEMENT);return Mt.createIndexBuffer({context:n.context,typedArray:c,usage:mt.STATIC_DRAW,indexDatatype:u})}const rot=Pie;function Oie(e){e=A(e,A.EMPTY_OBJECT);const t=e.primitive,n=e.node,i=e.model;E.typeOf.object("options.primitive",t),E.typeOf.object("options.node",n),E.typeOf.object("options.model",i),this.primitive=t,this.node=n,this.model=i,this.pipelineStages=[],this.drawCommand=void 0,this.boundingSphere=void 0,this.boundingSphere2D=void 0,this.positionBuffer2D=void 0,this.batchLengths=void 0,this.batchOffsets=void 0,this.updateStages=[]}Oie.prototype.configurePipeline=function(e){const t=this.pipelineStages;t.length=0;const n=this.primitive,i=this.node,o=this.model,r=o.customShader,s=o.style,a=e.context.webgl2,u=e.mode!==me.SCENE3D&&!e.scene3DOnly&&o._projectTo2D,f=l(n.morphTargets)&&n.morphTargets.length>0,h=l(i.skin),_=l(r),p=!(_&&l(r.fragmentShaderText))||r.mode!==SU.REPLACE_MATERIAL,y=gn.hasQuantizedAttributes(n.attributes),T=o.debugWireframe&&dt.isTriangles(n.primitiveType)&&(o._enableDebugWireframe||a),b=o.pointCloudShading,x=l(b)&&b.attenuation,v=l(b)&&b.backFaceCulling,D=n.primitiveType===dt.POINTS&&(l(s)||x||v),L=o._enableShowOutline&&l(n.outlineCoordinates),B=sot(o,i,n),V=l(o.classificationType);u&&t.push(Yit),t.push(eit),T&&t.push(rot),V&&t.push(qtt),f&&t.push(yit),h&&t.push(Jit),D&&t.push(Oit),y&&t.push(Unt),p&&t.push(lit),t.push(vU),t.push($g),B.hasPropertyTable&&(t.push(r2),t.push(Gtt),t.push($tt)),_&&t.push(Rnt),t.push(iit),o.allowPicking&&t.push(Cit),L&&t.push(Rit),t.push(ktt),t.push(zit)};function sot(e,t,n){let i;return l(t.instances)&&(i=gn.getFeatureIdsByLabel(t.instances.featureIds,e.instanceFeatureIdLabel),l(i))?{hasFeatureIds:!0,hasPropertyTable:l(i.propertyTableId)}:(i=gn.getFeatureIdsByLabel(n.featureIds,e.featureIdLabel),l(i)?{hasFeatureIds:!0,hasPropertyTable:l(i.propertyTableId)}:{hasFeatureIds:!1,hasPropertyTable:!1})}function IU(e){e=A(e,A.EMPTY_OBJECT),E.typeOf.object("options.skin",e.skin),E.typeOf.object("options.sceneGraph",e.sceneGraph),this._sceneGraph=e.sceneGraph;const t=e.skin;this._skin=t,this._inverseBindMatrices=void 0,this._joints=[],this._jointMatrices=[],aot(this)}Object.defineProperties(IU.prototype,{skin:{get:function(){return this._skin}},sceneGraph:{get:function(){return this._sceneGraph}},inverseBindMatrices:{get:function(){return this._inverseBindMatrices}},joints:{get:function(){return this._joints}},jointMatrices:{get:function(){return this._jointMatrices}}});function aot(e){const t=e.skin,n=t.inverseBindMatrices;e._inverseBindMatrices=n;const i=t.joints,o=i.length,r=e.sceneGraph._runtimeNodes,s=e.joints,a=e._jointMatrices;for(let c=0;c<o;c++){const u=i[c].index,f=r[u];s.push(f);const h=n[c],_=Lie(f,h,new N);a.push(_)}}function Lie(e,t,n){const i=N.multiplyTransformation(e.transformToRoot,e.transform,n);return n=N.multiplyTransformation(i,t,n),n}IU.prototype.updateJointMatrices=function(){const e=this._jointMatrices,t=e.length;for(let n=0;n<t;n++){const i=this.joints[n],o=this.inverseBindMatrices[n];e[n]=Lie(i,o,e[n])}};function cot(){this.pass=void 0,this.alphaCutoff=void 0}function lot(e){E.typeOf.object("model",e),this.shaderBuilder=new Qa,this.model=e,this.uniformMap={},this.alphaOptions=new cot,this.renderStateOptions=ht.getState(ht.fromCache({depthTest:{enabled:!0,func:ty.LESS_OR_EQUAL}})),this.hasSilhouette=!1,this.hasSkipLevelOfDetail=!1}const uot=`void silhouetteStage(inout vec4 color) {
|
||
if(model_silhouettePass) {
|
||
color = czm_gammaCorrect(model_silhouetteColor);
|
||
}
|
||
}`,fot=`void silhouetteStage(in ProcessedAttributes attributes, inout vec4 positionClip) {
|
||
#ifdef HAS_NORMALS
|
||
if(model_silhouettePass) {
|
||
vec3 normal = normalize(czm_normal3D * attributes.normalMC);
|
||
normal.x *= czm_projection[0][0];
|
||
normal.y *= czm_projection[1][1];
|
||
positionClip.xy += normal.xy * positionClip.w * model_silhouetteSize * czm_pixelRatio / czm_viewport.z;
|
||
}
|
||
#endif
|
||
}
|
||
`,s1={name:"ModelSilhouettePipelineStage"};s1.silhouettesLength=0;s1.process=function(e,t,n){l(t._silhouetteId)||(t._silhouetteId=++s1.silhouettesLength);const i=e.shaderBuilder;i.addDefine("HAS_SILHOUETTE",void 0,Re.BOTH),i.addVertexLines(fot),i.addFragmentLines(uot),i.addUniform("vec4","model_silhouetteColor",Re.FRAGMENT),i.addUniform("float","model_silhouetteSize",Re.VERTEX),i.addUniform("bool","model_silhouettePass",Re.BOTH);const o={model_silhouetteColor:function(){return t.silhouetteColor},model_silhouetteSize:function(){return t.silhouetteSize},model_silhouettePass:function(){return!1}};e.uniformMap=Ln(o,e.uniformMap),e.hasSilhouette=!0};const dot=s1,hot=`void modelSplitterStage()
|
||
{
|
||
// Don't split when rendering the shadow map, because it is rendered from
|
||
// the perspective of a totally different camera.
|
||
#ifndef SHADOW_MAP
|
||
if (model_splitDirection < 0.0 && gl_FragCoord.x > czm_splitPosition) discard;
|
||
if (model_splitDirection > 0.0 && gl_FragCoord.x < czm_splitPosition) discard;
|
||
#endif
|
||
}
|
||
`,XD={name:"ModelSplitterPipelineStage",SPLIT_DIRECTION_UNIFORM_NAME:"model_splitDirection"};XD.process=function(e,t,n){const i=e.shaderBuilder;i.addDefine("HAS_MODEL_SPLITTER",void 0,Re.FRAGMENT),i.addFragmentLines(hot);const o={};i.addUniform("float",XD.SPLIT_DIRECTION_UNIFORM_NAME,Re.FRAGMENT),o[XD.SPLIT_DIRECTION_UNIFORM_NAME]=function(){return t.splitDirection},e.uniformMap=Ln(o,e.uniformMap)};const pot=XD;function mot(e,t){E.typeOf.object("modelRenderResources",e),E.typeOf.object("runtimeNode",t),this.model=e.model,this.shaderBuilder=e.shaderBuilder.clone(),this.uniformMap=St(e.uniformMap),this.alphaOptions=St(e.alphaOptions),this.renderStateOptions=St(e.renderStateOptions,!0),this.hasSilhouette=e.hasSilhouette,this.hasSkipLevelOfDetail=e.hasSkipLevelOfDetail,this.runtimeNode=t,this.attributes=[],this.attributeIndex=1,this.featureIdVertexAttributeSetIndex=0,this.instanceCount=0}function _ot(e){e=A(e,A.EMPTY_OBJECT),this.lightingModel=A(e.lightingModel,r1.UNLIT)}function got(e,t){E.typeOf.object("nodeRenderResources",e),E.typeOf.object("runtimePrimitive",t),this.model=e.model,this.runtimeNode=e.runtimeNode,this.attributes=e.attributes.slice(),this.attributeIndex=e.attributeIndex,this.featureIdVertexAttributeSetIndex=e.featureIdVertexAttributeSetIndex,this.uniformMap=St(e.uniformMap),this.alphaOptions=St(e.alphaOptions),this.renderStateOptions=St(e.renderStateOptions,!0),this.hasSilhouette=e.hasSilhouette,this.hasSkipLevelOfDetail=e.hasSkipLevelOfDetail,this.shaderBuilder=e.shaderBuilder.clone(),this.instanceCount=e.instanceCount,this.runtimePrimitive=t;const n=t.primitive;this.count=l(n.indices)?n.indices.count:gn.getAttributeBySemantic(n,"POSITION").count,this.hasPropertyTable=!1,this.indices=n.indices,this.wireframeIndexBuffer=void 0,this.primitiveType=n.primitiveType;const i=gn.getPositionMinMax(n,this.runtimeNode.instancingTranslationMin,this.runtimeNode.instancingTranslationMax);this.positionMin=d.clone(i.min,new d),this.positionMax=d.clone(i.max,new d),this.boundingSphere=Ae.fromCornerPoints(this.positionMin,this.positionMax,new Ae),this.lightingOptions=new _ot,this.pickId=void 0}function wl(e){e=A(e,A.EMPTY_OBJECT);const t=e.modelComponents;E.typeOf.object("options.model",e.model),E.typeOf.object("options.modelComponents",t),this._model=e.model,this._components=t,this._pipelineStages=[],this._updateStages=[],this._runtimeNodes=[],this._rootNodes=[],this._skinnedNodes=[],this._runtimeSkins=[],this.modelPipelineStages=[],this._boundingSphere=void 0,this._boundingSphere2D=void 0,this._computedModelMatrix=N.clone(N.IDENTITY),this._computedModelMatrix2D=N.clone(N.IDENTITY),this._axisCorrectionMatrix=gn.getAxisCorrectionMatrix(t.upAxis,t.forwardAxis,new N),this._runtimeArticulations={},yot(this)}Object.defineProperties(wl.prototype,{components:{get:function(){return this._components}},computedModelMatrix:{get:function(){return this._computedModelMatrix}},axisCorrectionMatrix:{get:function(){return this._axisCorrectionMatrix}},boundingSphere:{get:function(){return this._boundingSphere}}});function yot(e){const t=e._components,n=t.scene,o=e._model.modelMatrix;Bie(e,o);const r=t.articulations,s=r.length,a=e._runtimeArticulations;for(let x=0;x<s;x++){const v=r[x],D=new OP({articulation:v,sceneGraph:e}),L=D.name;a[L]=D}const c=t.nodes,u=c.length;e._runtimeNodes=new Array(u);const h=n.nodes.length,_=N.IDENTITY;for(let x=0;x<h;x++){const v=n.nodes[x],D=Rie(e,v,_);e._rootNodes.push(D)}const g=t.skins,p=e._runtimeSkins,y=g.length;for(let x=0;x<y;x++){const v=g[x];p.push(new IU({skin:v,sceneGraph:e}))}const T=e._skinnedNodes,b=T.length;for(let x=0;x<b;x++){const v=T[x],D=e._runtimeNodes[v],B=c[v].skin.index;D._runtimeSkin=p[B],D.updateJointMatrices()}e.applyArticulations()}function Bie(e,t){const n=e._components,i=e._model;e._computedModelMatrix=N.multiplyTransformation(t,n.transform,e._computedModelMatrix),e._computedModelMatrix=N.multiplyTransformation(e._computedModelMatrix,e._axisCorrectionMatrix,e._computedModelMatrix),e._computedModelMatrix=N.multiplyByUniformScale(e._computedModelMatrix,i.computedScale,e._computedModelMatrix)}const Aot=new d;function Tot(e,t){const n=e._computedModelMatrix,i=N.getTranslation(n,Aot);if(!d.equals(i,d.ZERO))e._computedModelMatrix2D=En.basisTo2D(t.mapProjection,n,e._computedModelMatrix2D);else{const o=e.boundingSphere.center,r=En.wgs84To2DModelMatrix(t.mapProjection,o,e._computedModelMatrix2D);e._computedModelMatrix2D=N.multiply(r,n,e._computedModelMatrix2D)}e._boundingSphere2D=Ae.transform(e._boundingSphere,e._computedModelMatrix2D,e._boundingSphere2D)}function Rie(e,t,n){const i=[],o=gn.getNodeTransform(t),r=t.children.length;for(let f=0;f<r;f++){const h=t.children[f],_=N.multiplyTransformation(n,o,new N),g=Rie(e,h,_);i.push(g)}const s=new RT({node:t,transform:o,transformToRoot:n,children:i,sceneGraph:e}),a=t.primitives.length;for(let f=0;f<a;f++)s.runtimePrimitives.push(new Oie({primitive:t.primitives[f],node:t,model:e._model}));const c=t.index;e._runtimeNodes[c]=s,l(t.skin)&&e._skinnedNodes.push(c);const u=t.name;if(l(u)){const f=e._model,h=new Gne(f,s);f._nodesByName[u]=h}return c}const Cot=new d,bot=new d,Eot=new d,xot=new d;wl.prototype.buildDrawCommands=function(e){const t=this._model,n=new lot(t);t.statistics.clear(),this.configurePipeline(e);const i=this.modelPipelineStages;let o,r,s;for(o=0;o<i.length;o++)i[o].process(n,t,e);const a=d.fromElements(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,Cot),c=d.fromElements(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE,bot);for(o=0;o<this._runtimeNodes.length;o++){const u=this._runtimeNodes[o];if(!l(u))continue;u.configurePipeline();const f=u.pipelineStages,h=new mot(n,u);for(r=0;r<f.length;r++)f[r].process(h,u.node,e);const _=u.computedTransform;for(r=0;r<u.runtimePrimitives.length;r++){const g=u.runtimePrimitives[r];g.configurePipeline(e);const p=g.pipelineStages,y=new got(h,g);for(s=0;s<p.length;s++)p[s].process(y,g.primitive,e);g.boundingSphere=Ae.clone(y.boundingSphere,new Ae);const T=N.multiplyByPoint(_,y.positionMin,Eot),b=N.multiplyByPoint(_,y.positionMax,xot);d.minimumByComponent(a,T,a),d.maximumByComponent(c,b,c);const x=ott(y,e);g.drawCommand=x}}this._boundingSphere=Ae.fromCornerPoints(a,c,new Ae),this._boundingSphere=Ae.transformWithoutScale(this._boundingSphere,this._axisCorrectionMatrix,this._boundingSphere),this._boundingSphere=Ae.transform(this._boundingSphere,this._components.transform,this._boundingSphere),t._boundingSphere=Ae.transform(this._boundingSphere,t.modelMatrix,t._boundingSphere),t._initialRadius=t._boundingSphere.radius,t._boundingSphere.radius*=t._clampedScale};wl.prototype.configurePipeline=function(e){const t=this.modelPipelineStages;t.length=0;const n=this._model;l(n.color)&&t.push(t2),!l(n.classificationType)&&(n.imageBasedLighting.enabled&&t.push(ctt),n.isClippingEnabled()&&t.push(gtt),n.hasSilhouette(e)&&t.push(dot),l(n.splitDirection)&&n.splitDirection!==Py.NONE&&t.push(pot),Xa.is3DTiles(n.type)&&t.push(stt))};wl.prototype.update=function(e,t){let n,i,o;for(n=0;n<this._runtimeNodes.length;n++){const r=this._runtimeNodes[n];if(!l(r))continue;for(i=0;i<r.updateStages.length;i++)r.updateStages[i].update(r,this,e);const s=e.mode!==me.SCENE3D&&this._model._projectTo2D;for(t&&!s&&this.updateJointMatrices(),i=0;i<r.runtimePrimitives.length;i++){const a=r.runtimePrimitives[i];for(o=0;o<a.updateStages.length;o++)a.updateStages[o].update(a,this)}}};wl.prototype.updateModelMatrix=function(e,t){Bie(this,e),t.mode!==me.SCENE3D&&Tot(this,t);const n=this._rootNodes;for(let i=0;i<n.length;i++){const o=this._runtimeNodes[n[i]];o._transformDirty=!0}};wl.prototype.updateJointMatrices=function(){const e=this._skinnedNodes,t=e.length;for(let n=0;n<t;n++){const i=e[n];this._runtimeNodes[i].updateJointMatrices()}};function Nie(e,t,n,i,o){if(n&&!t.show)return;const r=t.children.length;for(let c=0;c<r;c++){const u=t.getChild(c);Nie(e,u,n,i,o)}const s=t.runtimePrimitives,a=s.length;for(let c=0;c<a;c++){const u=s[c];i(u,o)}}function LP(e,t,n,i){const o=e._rootNodes,r=o.length;for(let s=0;s<r;s++){const a=o[s],c=e._runtimeNodes[a];Nie(e,c,t,n,i)}}const wot={backFaceCulling:void 0};wl.prototype.updateBackFaceCulling=function(e){const t=wot;t.backFaceCulling=e,LP(this,!1,Sot,t)};function Sot(e,t){const n=e.drawCommand;n.backFaceCulling=t.backFaceCulling}const vot={shadowMode:void 0};wl.prototype.updateShadows=function(e){const t=vot;t.shadowMode=e,LP(this,!1,Dot,t)};function Dot(e,t){const n=e.drawCommand;n.shadows=t.shadowMode}const Iot={debugShowBoundingVolume:void 0};wl.prototype.updateShowBoundingVolume=function(e){const t=Iot;t.debugShowBoundingVolume=e,LP(this,!1,Pot,t)};function Pot(e,t){const n=e.drawCommand;n.debugShowBoundingVolume=t.debugShowBoundingVolume}const Mie=[],Oot={frameState:void 0,hasSilhouette:void 0};wl.prototype.pushDrawCommands=function(e){const t=Mie;t.length=0;const n=Oot;n.hasSilhouette=this._model.hasSilhouette(e),n.frameState=e,LP(this,!0,Lot,n),e.commandList.push.apply(e.commandList,t)};function Lot(e,t){const n=t.frameState,i=t.hasSilhouette,o=n.passes,r=Mie,s=e.drawCommand;s.pushCommands(n,n.commandList),i&&!o.pick&&s.pushSilhouetteCommands(n,r)}wl.prototype.setArticulationStage=function(e,t){const n=e.split(" ");if(n.length!==2)return;const i=n[0],o=n[1],r=this._runtimeArticulations[i];l(r)&&r.setArticulationStage(o,t)};wl.prototype.applyArticulations=function(){const e=this._runtimeArticulations;for(const t in e)e.hasOwnProperty(t)&&e[t].apply()};function NT(){this.pointsLength=0,this.trianglesLength=0,this.geometryByteLength=0,this.texturesByteLength=0,this.propertyTablesByteLength=0,this._bufferIdSet={},this._textureIdSet={},this._batchTextureIdMap=new Vt}Object.defineProperties(NT.prototype,{batchTexturesByteLength:{get:function(){const e=this._batchTextureIdMap.length,t=this._batchTextureIdMap.values;let n=0;for(let i=0;i<e;i++)n+=t[i].byteLength;return n}}});NT.prototype.clear=function(){this.pointsLength=0,this.trianglesLength=0,this.geometryByteLength=0,this.texturesByteLength=0,this.propertyTablesByteLength=0,this._bufferIdSet={},this._textureIdSet={},this._batchTextureIdMap.removeAll()};NT.prototype.addBuffer=function(e,t){if(E.typeOf.object("buffer",e),E.typeOf.bool("hasCpuCopy",t),!this._bufferIdSet.hasOwnProperty(e._id)){const n=t?2:1;this.geometryByteLength+=e.sizeInBytes*n}this._bufferIdSet[e._id]=!0};NT.prototype.addTexture=function(e){E.typeOf.object("texture",e),this._textureIdSet.hasOwnProperty(e._id)||(this.texturesByteLength+=e.sizeInBytes),this._textureIdSet[e._id]=!0};NT.prototype.addBatchTexture=function(e){E.typeOf.object("batchTexture",e),this._batchTextureIdMap.contains(e._id)||this._batchTextureIdMap.set(e._id,e)};const Fie={},rg=Uint32Array.BYTES_PER_ELEMENT;Fie.parse=function(e,t){t=A(t,0),E.defined("arrayBuffer",e);const n=new Uint8Array(e),i=new DataView(e);t+=rg;const o=i.getUint32(t,!0);if(o!==1)throw new Fe(`Only Point Cloud tile version 1 is supported. Version ${o} is not.`);t+=rg,t+=rg;const r=i.getUint32(t,!0);if(r===0)throw new Fe("Feature table must have a byte length greater than zero");t+=rg;const s=i.getUint32(t,!0);t+=rg;const a=i.getUint32(t,!0);t+=rg;const c=i.getUint32(t,!0);t+=rg;const u=zc(n,t,r);t+=r;const f=new Uint8Array(e,t,s);t+=s;let h,_;a>0&&(h=zc(n,t,a),t+=a,c>0&&(_=new Uint8Array(e,t,c),t+=c));const g=new w_(u,f),p=g.getGlobalProperty("POINTS_LENGTH");if(g.featuresLength=p,!l(p))throw new Fe("Feature table global property: POINTS_LENGTH must be defined");let y=g.getGlobalProperty("RTC_CENTER",oe.FLOAT,3);l(y)&&(y=d.unpack(y));const T=Bot(g,h);if(T.rtcCenter=y,T.pointsLength=p,!T.hasPositions){const b=Rot(g);T.positions=b,T.hasPositions=T.hasPositions||l(b)}if(!T.hasPositions)throw new Fe("Either POSITION or POSITION_QUANTIZED must be defined.");if(!T.hasNormals){const b=Mot(g);T.normals=b,T.hasNormals=T.hasNormals||l(b)}if(!T.hasColors){const b=Not(g);T.colors=b,T.hasColors=T.hasColors||l(b),T.hasConstantColor=l(T.constantColor),T.isTranslucent=l(b)&&b.isTranslucent}if(!T.hasBatchIds){const b=Fot(g);T.batchIds=b,T.hasBatchIds=T.hasBatchIds||l(b)}if(T.hasBatchIds){const b=g.getGlobalProperty("BATCH_LENGTH");if(!l(b))throw new Fe("Global property: BATCH_LENGTH must be defined when BATCH_ID is defined.");T.batchLength=b}return l(_)&&(_=new Uint8Array(_),T.batchTableJson=h,T.batchTableBinary=_),T};function Bot(e,t){const n=e.json;let i,o,r;const s=l(n.extensions)?n.extensions["3DTILES_draco_point_compression"]:void 0,a=l(t)&&l(t.extensions)?t.extensions["3DTILES_draco_point_compression"]:void 0;l(a)&&(r=a.properties);let c,u,f,h,_;if(l(s)){o=s.properties;const p=s.byteOffset,y=s.byteLength;if(!l(o)||!l(p)||!l(y))throw new Fe("Draco properties, byteOffset, and byteLength must be defined");i=e.buffer.slice(p,p+y),c=l(o.POSITION),u=l(o.RGB)||l(o.RGBA),f=l(o.NORMAL),h=l(o.BATCH_ID),_=l(o.RGBA)}let g;return l(i)&&(g={buffer:i,featureTableProperties:o,batchTableProperties:r,properties:Ln(o,r),dequantizeInShader:!0}),{draco:g,hasPositions:c,hasColors:u,isTranslucent:_,hasNormals:f,hasBatchIds:h}}function Rot(e){const t=e.json;let n;if(l(t.POSITION))return n=e.getPropertyArray("POSITION",oe.FLOAT,3),{name:Ut.POSITION,semantic:Ut.POSITION,typedArray:n,isQuantized:!1,componentDatatype:oe.FLOAT,type:Nn.VEC3};if(l(t.POSITION_QUANTIZED)){n=e.getPropertyArray("POSITION_QUANTIZED",oe.UNSIGNED_SHORT,3);const i=e.getGlobalProperty("QUANTIZED_VOLUME_SCALE",oe.FLOAT,3);if(!l(i))throw new Fe("Global property: QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");const o=(1<<16)-1,r=e.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",oe.FLOAT,3);if(!l(r))throw new Fe("Global property: QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");return{name:Ut.POSITION,semantic:Ut.POSITION,typedArray:n,isQuantized:!0,componentDatatype:oe.FLOAT,type:Nn.VEC3,quantizedRange:o,quantizedVolumeOffset:d.unpack(r),quantizedVolumeScale:d.unpack(i),quantizedComponentDatatype:oe.UNSIGNED_SHORT,quantizedType:Nn.VEC3}}}function Not(e){const t=e.json;let n;if(l(t.RGBA))return n=e.getPropertyArray("RGBA",oe.UNSIGNED_BYTE,4),{name:Ut.COLOR,semantic:Ut.COLOR,setIndex:0,typedArray:n,componentDatatype:oe.UNSIGNED_BYTE,type:Nn.VEC4,normalized:!0,isRGB565:!1,isTranslucent:!0};if(l(t.RGB))return n=e.getPropertyArray("RGB",oe.UNSIGNED_BYTE,3),{name:"COLOR",semantic:Ut.COLOR,setIndex:0,typedArray:n,componentDatatype:oe.UNSIGNED_BYTE,type:Nn.VEC3,normalized:!0,isRGB565:!1,isTranslucent:!1};if(l(t.RGB565))return n=e.getPropertyArray("RGB565",oe.UNSIGNED_SHORT,1),{name:"COLOR",semantic:Ut.COLOR,setIndex:0,typedArray:n,componentDatatype:oe.FLOAT,type:Nn.VEC3,normalized:!1,isRGB565:!0,isTranslucent:!1};if(l(t.CONSTANT_RGBA)){const i=e.getGlobalProperty("CONSTANT_RGBA",oe.UNSIGNED_BYTE,4),o=i[3],r=k.fromBytes(i[0],i[1],i[2],o),s=o<255;return{name:Ut.COLOR,semantic:Ut.COLOR,setIndex:0,constantColor:r,componentDatatype:oe.FLOAT,type:Nn.VEC4,isQuantized:!1,isTranslucent:s}}}function Mot(e){const t=e.json;let n;if(l(t.NORMAL))return n=e.getPropertyArray("NORMAL",oe.FLOAT,3),{name:Ut.NORMAL,semantic:Ut.NORMAL,typedArray:n,octEncoded:!1,octEncodedZXY:!1,componentDatatype:oe.FLOAT,type:Nn.VEC3};if(l(t.NORMAL_OCT16P)){n=e.getPropertyArray("NORMAL_OCT16P",oe.UNSIGNED_BYTE,2);const i=8;return{name:Ut.NORMAL,semantic:Ut.NORMAL,typedArray:n,octEncoded:!0,octEncodedZXY:!1,quantizedRange:(1<<i)-1,quantizedType:Nn.VEC2,quantizedComponentDatatype:oe.UNSIGNED_BYTE,componentDatatype:oe.FLOAT,type:Nn.VEC3}}}function Fot(e){const t=e.json;if(l(t.BATCH_ID)){const n=e.getPropertyArray("BATCH_ID",oe.UNSIGNED_SHORT,1);return{name:Ut.FEATURE_ID,semantic:Ut.FEATURE_ID,setIndex:0,typedArray:n,componentDatatype:oe.fromTypedArray(n),type:Nn.SCALAR}}}const zie=Fie,zot=Yt.Components,Uot=Yt.Scene,Hot=Yt.Node,Vot=Yt.Primitive,kot=Yt.Attribute,yq=Yt.Quantization,Got=Yt.FeatureIdAttribute,Wot=Yt.Material,qot=Yt.MetallicRoughness;function qm(e){e=A(e,A.EMPTY_OBJECT);const t=e.arrayBuffer,n=A(e.byteOffset,0);E.typeOf.object("options.arrayBuffer",t),this._arrayBuffer=t,this._byteOffset=n,this._loadAttributesFor2D=A(e.loadAttributesFor2D,!1),this._parsedContent=void 0,this._decodePromise=void 0,this._decodedAttributes=void 0,this._promise=void 0,this._process=function(i){},this._state=Qt.UNLOADED,this._buffers=[],this._components=void 0,this._transform=N.IDENTITY}l(Object.create)&&(qm.prototype=Object.create(jr.prototype),qm.prototype.constructor=qm);Object.defineProperties(qm.prototype,{promise:{get:function(){return this._promise}},cacheKey:{get:function(){}},components:{get:function(){return this._components}},transform:{get:function(){return this._transform}}});qm.prototype.load=function(){this._parsedContent=zie.parse(this._arrayBuffer,this._byteOffset),this._state=Qt.PROCESSING;const e=this;this._promise=new Promise(function(t,n){e._process=function(i){if(e._state===Qt.PROCESSING){if(l(e._decodePromise))return;const o=jot(e,i.context);l(o)&&o.then(t).catch(n)}}})};qm.prototype.process=function(e){this._process(e)};function jot(e,t){const i=e._parsedContent.draco;let o;if(l(i)?o=ks.decodePointCloud(i,t):o=Promise.resolve(),!!l(o))return e._decodePromise=o,o.then(function(r){if(!e.isDestroyed())return l(r)&&Yot(e,i,r),ort(e,t),e._state=Qt.READY,e}).catch(function(r){e.unload(),e._state=Qt.FAILED;const s="Failed to load Draco pnts";return Promise.reject(e.getError(s,r))})}function Yot(e,t,n){e._state=Qt.READY;const i=e._parsedContent;let o;if(l(n.POSITION)){if(o={name:"POSITION",semantic:Ut.POSITION,typedArray:n.POSITION.array,componentDatatype:oe.FLOAT,type:Nn.VEC3,isQuantized:!1},l(n.POSITION.data.quantization)){const a=n.POSITION.data.quantization,c=a.range,u=d.fromElements(c,c,c),f=d.unpack(a.minValues),h=(1<<a.quantizationBits)-1;o.isQuantized=!0,o.quantizedRange=h,o.quantizedVolumeOffset=f,o.quantizedVolumeScale=u,o.quantizedComponentDatatype=h<=255?oe.UNSIGNED_BYTE:oe.UNSIGNED_SHORT,o.quantizedType=Nn.VEC3}i.positions=o}if(l(n.NORMAL)){if(o={name:"NORMAL",semantic:Ut.NORMAL,typedArray:n.NORMAL.array,componentDatatype:oe.FLOAT,type:Nn.VEC3,isQuantized:!1,octEncoded:!1,octEncodedZXY:!1},l(n.NORMAL.data.quantization)){const a=(1<<n.NORMAL.data.quantization.quantizationBits)-1;o.quantizedRange=a,o.octEncoded=!0,o.octEncodedZXY=!0,o.quantizedComponentDatatype=oe.UNSIGNED_BYTE,o.quantizedType=Nn.VEC2}i.normals=o}if(l(n.RGBA)?i.colors={name:"COLOR",semantic:Ut.COLOR,setIndex:0,typedArray:n.RGBA.array,componentDatatype:oe.UNSIGNED_BYTE,type:Nn.VEC4,normalized:!0,isTranslucent:!0}:l(n.RGB)&&(i.colors={name:"COLOR",semantic:Ut.COLOR,setIndex:0,typedArray:n.RGB.array,componentDatatype:oe.UNSIGNED_BYTE,type:Nn.VEC3,normalized:!0,isTranslucent:!1}),l(n.BATCH_ID)){const a=n.BATCH_ID.array;i.batchIds={name:"_FEATURE_ID",semantic:Ut.FEATURE_ID,setIndex:0,typedArray:a,componentDatatype:oe.fromTypedArray(a),type:Nn.SCALAR}}let r=i.batchTableJson;const s=t.batchTableProperties;for(const a in s)if(s.hasOwnProperty(a)){const c=n[a];l(r)||(r={}),i.hasDracoBatchTable=!0;const u=c.data;r[a]={byteOffset:u.byteOffset,type:$ot(u.componentsPerAttribute),componentType:Xot(u.componentDatatype),typedArray:c.array}}i.batchTableJson=r}function $ot(e){switch(e){case 1:return"SCALAR";case 2:return"VEC2";case 3:return"VEC3";case 4:return"VEC4";default:throw new w("componentsPerAttribute must be a number from 1-4")}}function Xot(e){switch(e){case fe.BYTE:return"BYTE";case fe.UNSIGNED_BYTE:return"UNSIGNED_BYTE";case fe.SHORT:return"SHORT";case fe.UNSIGNED_SHORT:return"UNSIGNED_SHORT";case fe.INT:return"INT";case fe.UNSIGNED_INT:return"UNSIGNED_INT";case fe.DOUBLE:return"DOUBLE";case fe.FLOAT:return"FLOAT";default:throw new w("value is not a valid WebGL constant")}}function kC(e,t,n){let i=t.typedArray,o;if(t.octEncoded&&(o=new yq,o.octEncoded=t.octEncoded,o.octEncodedZXY=t.octEncodedZXY,o.normalizationRange=t.quantizedRange,o.type=t.quantizedType,o.componentDatatype=t.quantizedComponentDatatype),t.isQuantized){o=new yq;const a=t.quantizedRange;o.normalizationRange=a,o.quantizedVolumeOffset=d.ZERO;const c=t.quantizedVolumeScale;o.quantizedVolumeDimensions=c,o.quantizedVolumeStepSize=d.divideByScalar(c,a,new d),o.componentDatatype=t.quantizedComponentDatatype,o.type=t.quantizedType}const r=new kot;if(r.name=t.name,r.semantic=t.semantic,r.setIndex=t.setIndex,r.componentDatatype=t.componentDatatype,r.type=t.type,r.normalized=A(t.normalized,!1),r.min=t.min,r.max=t.max,r.quantization=o,t.isRGB565&&(i=Ri.decodeRGB565(i)),l(t.constantColor)){const a=new Array(4);r.constant=k.pack(t.constantColor,a)}else{const a=Mt.createVertexBuffer({typedArray:i,context:n,usage:mt.STATIC_DRAW});a.vertexArrayDestroyable=!1,e._buffers.push(a),r.buffer=a}const s=e._loadAttributesFor2D;return r.semantic===Ut.POSITION&&s&&(r.typedArray=i),r}let Aq,Bv;function Kot(e){if(!l(Bv)){Aq=new V1(0),Bv=new Array(e);for(let t=0;t<e;++t)Bv[t]=Aq.random()}return Bv}const Jot=new d,Qot=new d,Zot=new d;function ert(e){const t=e.typedArray,n=20,i=t.length/3,o=Math.min(i,n),r=Kot(n),s=Number.MAX_VALUE,a=-Number.MAX_VALUE;let c=d.fromElements(s,s,s,Jot),u=d.fromElements(a,a,a,Qot),f,h,_;if(e.isQuantized)c=d.ZERO,u=e.quantizedVolumeScale;else for(f=0;f<o;++f)h=Math.floor(r[f]*i),_=d.unpack(t,h*3,Zot),d.minimumByComponent(c,_,c),d.maximumByComponent(u,_,u);e.min=d.clone(c),e.max=d.clone(u)}const trt={name:Ut.COLOR,semantic:Ut.COLOR,setIndex:0,constantColor:k.DARKGRAY,componentDatatype:oe.FLOAT,type:Nn.VEC4,isQuantized:!1,isTranslucent:!1};function nrt(e,t,n){const i=[];let o;const r=t.positions;return l(r)&&(ert(r),o=kC(e,r,n),o.count=t.pointsLength,i.push(o)),l(t.normals)&&(o=kC(e,t.normals,n),i.push(o)),l(t.colors)?(o=kC(e,t.colors,n),i.push(o)):(o=kC(e,trt,n),i.push(o)),l(t.batchIds)&&(o=kC(e,t.batchIds,n),i.push(o)),i}function irt(e,t){const n=e.batchLength,i=e.pointsLength,o=e.batchTableBinary,r=!l(e.batchIds);if(l(o)||e.hasDracoBatchTable){const s=A(n,i);return Wy({count:s,batchTable:e.batchTableJson,binaryBody:o,parseAsPropertyAttributes:r,customAttributeOutput:t})}return new Of({schema:{},propertyTables:[]})}function ort(e,t){const n=e._parsedContent,i=new qot;i.metallicFactor=0,i.roughnessFactor=.9;const o=new Wot;o.metallicRoughness=i;const r=n.colors;l(r)&&r.isTranslucent&&(o.alphaMode=QI.BLEND);const s=!l(n.normals);o.unlit=s;const a=new Vot;if(a.attributes=nrt(e,n,t),a.primitiveType=dt.POINTS,a.material=o,l(n.batchIds)){const g=new Got;g.propertyTableId=0,g.setIndex=0,g.positionalLabel="featureId_0",a.featureIds.push(g)}const c=new Hot;c.index=0,c.primitives=[a];const u=new Uot;u.nodes=[c],u.upAxis=Vs.Z,u.forwardAxis=Vs.X;const f=new zot;f.scene=u,f.nodes=[c];const h=[];f.structuralMetadata=irt(n,h),h.length>0&&rrt(e,a,h,t),l(n.rtcCenter)&&(f.transform=N.multiplyByTranslation(f.transform,n.rtcCenter,f.transform));const _=n.positions;l(_)&&_.isQuantized&&(f.transform=N.multiplyByTranslation(f.transform,_.quantizedVolumeOffset,f.transform)),e._components=f,e._parsedContent=void 0,e._arrayBuffer=void 0}function rrt(e,t,n,i){const o=t.attributes,r=n.length;for(let s=0;s<r;s++){const a=n[s],c=Mt.createVertexBuffer({typedArray:a.typedArray,context:i,usage:mt.STATIC_DRAW});c.vertexArrayDestroyable=!1,e._buffers.push(c),a.buffer=c,a.typedArray=void 0,o.push(a)}t.propertyAttributeIds=[0]}qm.prototype.unload=function(){const e=this._buffers;for(let t=0;t<e.length;t++)e[t].destroy();e.length=0,this._components=void 0,this._parsedContent=void 0,this._arrayBuffer=void 0};function Vi(e){e=A(e,A.EMPTY_OBJECT),E.typeOf.object("options.loader",e.loader),E.typeOf.object("options.resource",e.resource),this._loader=e.loader,this._resource=e.resource,this.type=A(e.type,Xa.GLTF),this.modelMatrix=N.clone(A(e.modelMatrix,N.IDENTITY)),this._modelMatrix=N.clone(this.modelMatrix),this._scale=A(e.scale,1),this._minimumPixelSize=A(e.minimumPixelSize,0),this._maximumScale=e.maximumScale,this._clampedScale=l(this._maximumScale)?Math.min(this._scale,this._maximumScale):this._scale,this._computedScale=this._clampedScale,this._updateModelMatrix=!1,this.referenceMatrix=void 0,this._iblReferenceFrameMatrix=te.clone(te.IDENTITY),this._resourcesLoaded=!1,this._drawCommandsBuilt=!1,this._ready=!1,this._customShader=e.customShader,this._content=e.content,this._texturesLoaded=!1,this._defaultTexture=void 0,this._activeAnimations=new yp(this),this._clampAnimations=A(e.clampAnimations,!0),this._userAnimationDirty=!1,this._id=e.id,this._idDirty=!1,this._color=k.clone(e.color),this._colorBlendMode=A(e.colorBlendMode,vP.HIGHLIGHT),this._colorBlendAmount=A(e.colorBlendAmount,.5);const t=A(e.silhouetteColor,k.RED);this._silhouetteColor=k.clone(t),this._silhouetteSize=A(e.silhouetteSize,0),this._silhouetteDirty=!1,this._silhouetteId=void 0,this._cull=A(e.cull,!0),this._opaquePass=A(e.opaquePass,We.OPAQUE),this._allowPicking=A(e.allowPicking,!0),this._show=A(e.show,!0),this._style=void 0,this._styleDirty=!1,this._styleCommandsNeeded=void 0;let n=A(e.featureIdLabel,"featureId_0");typeof n=="number"&&(n=`featureId_${n}`),this._featureIdLabel=n;let i=A(e.instanceFeatureIdLabel,"instanceFeatureId_0");typeof i=="number"&&(i=`instanceFeatureId_${i}`),this._instanceFeatureIdLabel=i,this._featureTables=[],this._featureTableId=void 0,this._featureTableIdDirty=!0,this._pipelineResources=[],this._modelResources=[],this._pickIds=[],this._boundingSphere=new Ae,this._initialRadius=void 0,this._heightReference=A(e.heightReference,Ht.NONE),this._heightDirty=this._heightReference!==Ht.NONE,this._removeUpdateHeightCallback=void 0,this._clampedModelMatrix=void 0;const o=e.scene;l(o)&&l(o.terrainProviderChanged)&&(this._terrainProviderChangedCallback=o.terrainProviderChanged.addEventListener(function(){this._heightDirty=!0},this)),this._scene=o,this._distanceDisplayCondition=e.distanceDisplayCondition;const r=new Hx(e.pointCloudShading);this._pointCloudShading=r,this._attenuation=r.attenuation,this._pointCloudBackFaceCulling=r.backFaceCulling;const s=e.clippingPlanes;l(s)&&s.owner===void 0?rr.setOwner(s,this,"_clippingPlanes"):this._clippingPlanes=s,this._clippingPlanesState=0,this._clippingPlanesMatrix=N.clone(N.IDENTITY),this._lightColor=d.clone(e.lightColor),this._imageBasedLighting=l(e.imageBasedLighting)?e.imageBasedLighting:new vT,this._shouldDestroyImageBasedLighting=!l(e.imageBasedLighting),this._backFaceCulling=A(e.backFaceCulling,!0),this._backFaceCullingDirty=!1,this._shadows=A(e.shadows,sr.ENABLED),this._shadowsDirty=!1,this._debugShowBoundingVolumeDirty=!1,this._debugShowBoundingVolume=A(e.debugShowBoundingVolume,!1),this._enableDebugWireframe=A(e.enableDebugWireframe,!1),this._enableShowOutline=A(e.enableShowOutline,!0),this._debugWireframe=A(e.debugWireframe,!1),this._debugWireframe===!0&&this._enableDebugWireframe===!1&&this.type===Xa.GLTF&&uo("model-debug-wireframe-ignored","enableDebugWireframe must be set to true in Model.fromGltf, otherwise debugWireframe will be ignored.");let a=e.credit;typeof a=="string"&&(a=new Si(a)),this._credit=a,this._resourceCredits=[],this._gltfCredits=[],this._showCreditsOnScreen=A(e.showCreditsOnScreen,!1),this._showCreditsOnScreenDirty=!0,this._splitDirection=A(e.splitDirection,Py.NONE),this._enableShowOutline=A(e.enableShowOutline,!0),this.showOutline=A(e.showOutline,!0),this.outlineColor=A(e.outlineColor,k.BLACK),this._classificationType=e.classificationType,this._statistics=new NT,this._sceneMode=void 0,this._projectTo2D=A(e.projectTo2D,!1),this._skipLevelOfDetail=!1,this._ignoreCommands=A(e.ignoreCommands,!1),this._completeLoad=function(c,u){},this._texturesLoadedPromise=void 0,this._readyPromise=crt(this),this._sceneGraph=void 0,this._nodesByName={},this.pickObject=e.pickObject}function srt(e,t){const n=e._featureTables,i=t.propertyTables,o=i.length;for(let r=0;r<o;r++){const s=i[r],a=new Br({model:e,propertyTable:s});n.push(a)}return n}function art(e,t){const n=t._featureIdLabel,i=t._instanceFeatureIdLabel;let o,r,s,a;for(o=0;o<e.nodes.length;o++)if(a=e.nodes[o],l(a.instances)&&(s=gn.getFeatureIdsByLabel(a.instances.featureIds,i),l(s)&&l(s.propertyTableId)))return s.propertyTableId;for(o=0;o<e.nodes.length;o++)for(a=e.nodes[o],r=0;r<a.primitives.length;r++){const c=a.primitives[r],u=gn.getFeatureIdsByLabel(c.featureIds,n);if(l(u))return u.propertyTableId}if(t._featureTables.length===1)return 0}function s2(e,t){if(!l(e)&&!l(t))return!1;if(l(e)!==l(t))return!0;const n=e.alpha,i=t.alpha;return Math.floor(n)!==Math.floor(i)||Math.ceil(n)!==Math.ceil(i)}function crt(e){const t=e._loader,n=e._resource;t.load();const i=t.promise.then(function(s){if(!l(s))return;const a=s.components;if(!l(a)){if(s.isUnloaded())return;throw new Fe("Failed to load model.")}const c=a.structuralMetadata;l(c)&&c.propertyTableCount>0&&srt(e,c);const u=new wl({model:e,modelComponents:a});e._sceneGraph=u,e._gltfCredits=u.components.asset.credits;const f=e._resource.credits;if(l(f)){const h=f.length;for(let _=0;_<h;_++)e._resourceCredits.push(f[_])}e._resourcesLoaded=!0}),o=A(t.texturesLoadedPromise,Promise.resolve());e._texturesLoadedPromise=o.then(function(){!l(e)||e.isDestroyed()||(e._texturesLoaded=!0,t._incrementallyLoadTextures&&e.resetDrawCommands())}).catch(gn.getFailedLoadFunction(e,"model",n));const r=new Promise(function(s,a){e._completeLoad=function(c,u){u.afterRender.push(function(){return c._ready=!0,s(c),!0})}});return i.then(function(){return r}).catch(gn.getFailedLoadFunction(e,"model",n))}Object.defineProperties(Vi.prototype,{ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise}},texturesLoadedPromise:{get:function(){return this._texturesLoadedPromise}},loader:{get:function(){return this._loader}},statistics:{get:function(){return this._statistics}},activeAnimations:{get:function(){return this._activeAnimations}},clampAnimations:{get:function(){return this._clampAnimations},set:function(e){this._clampAnimations=e}},cull:{get:function(){return this._cull}},opaquePass:{get:function(){return this._opaquePass}},pointCloudShading:{get:function(){return this._pointCloudShading},set:function(e){E.defined("pointCloudShading",e),e!==this._pointCloudShading&&this.resetDrawCommands(),this._pointCloudShading=e}},customShader:{get:function(){return this._customShader},set:function(e){e!==this._customShader&&this.resetDrawCommands(),this._customShader=e}},sceneGraph:{get:function(){return this._sceneGraph}},content:{get:function(){return this._content}},heightReference:{get:function(){return this._heightReference},set:function(e){e!==this._heightReference&&(this._heightDirty=!0),this._heightReference=e}},distanceDisplayCondition:{get:function(){return this._distanceDisplayCondition},set:function(e){if(l(e)&&e.far<=e.near)throw new w("far must be greater than near");this._distanceDisplayCondition=sn.clone(e,this._distanceDisplayCondition)}},structuralMetadata:{get:function(){return this._sceneGraph.components.structuralMetadata}},featureTableId:{get:function(){return this._featureTableId},set:function(e){this._featureTableId=e}},featureTables:{get:function(){return this._featureTables},set:function(e){this._featureTables=e}},id:{get:function(){return this._id},set:function(e){e!==this._id&&(this._idDirty=!0),this._id=e}},allowPicking:{get:function(){return this._allowPicking}},style:{get:function(){return this._style},set:function(e){this._style=e,this._styleDirty=!0}},color:{get:function(){return this._color},set:function(e){s2(e,this._color)&&this.resetDrawCommands(),this._color=k.clone(e,this._color)}},colorBlendMode:{get:function(){return this._colorBlendMode},set:function(e){this._colorBlendMode=e}},colorBlendAmount:{get:function(){return this._colorBlendAmount},set:function(e){this._colorBlendAmount=e}},silhouetteColor:{get:function(){return this._silhouetteColor},set:function(e){if(!k.equals(e,this._silhouetteColor)){const t=s2(e,this._silhouetteColor);this._silhouetteDirty=this._silhouetteDirty||t}this._silhouetteColor=k.clone(e,this._silhouetteColor)}},silhouetteSize:{get:function(){return this._silhouetteSize},set:function(e){if(e!==this._silhouetteSize){const t=this._silhouetteSize,n=e>0&&t===0||e===0&&t>0;this._silhouetteDirty=this._silhouetteDirty||n,this._backFaceCullingDirty=this._backFaceCullingDirty||n}this._silhouetteSize=e}},boundingSphere:{get:function(){if(!this._ready)throw new w("The model is not loaded. Use Model.readyPromise or wait for Model.ready to be true.");const e=l(this._clampedModelMatrix)?this._clampedModelMatrix:this.modelMatrix;return Hie(this,e),this._boundingSphere}},debugShowBoundingVolume:{get:function(){return this._debugShowBoundingVolume},set:function(e){this._debugShowBoundingVolume!==e&&(this._debugShowBoundingVolumeDirty=!0),this._debugShowBoundingVolume=e}},debugWireframe:{get:function(){return this._debugWireframe},set:function(e){this._debugWireframe!==e&&this.resetDrawCommands(),this._debugWireframe=e,this._debugWireframe===!0&&this._enableDebugWireframe===!1&&this.type===Xa.GLTF&&uo("model-debug-wireframe-ignored","enableDebugWireframe must be set to true in Model.fromGltf, otherwise debugWireframe will be ignored.")}},show:{get:function(){return this._show},set:function(e){this._show=e}},featureIdLabel:{get:function(){return this._featureIdLabel},set:function(e){typeof e=="number"&&(e=`featureId_${e}`),E.typeOf.string("value",e),e!==this._featureIdLabel&&(this._featureTableIdDirty=!0),this._featureIdLabel=e}},instanceFeatureIdLabel:{get:function(){return this._instanceFeatureIdLabel},set:function(e){typeof e=="number"&&(e=`instanceFeatureId_${e}`),E.typeOf.string("value",e),e!==this._instanceFeatureIdLabel&&(this._featureTableIdDirty=!0),this._instanceFeatureIdLabel=e}},clippingPlanes:{get:function(){return this._clippingPlanes},set:function(e){e!==this._clippingPlanes&&(rr.setOwner(e,this,"_clippingPlanes"),this.resetDrawCommands())}},lightColor:{get:function(){return this._lightColor},set:function(e){l(e)!==l(this._lightColor)&&this.resetDrawCommands(),this._lightColor=d.clone(e,this._lightColor)}},imageBasedLighting:{get:function(){return this._imageBasedLighting},set:function(e){E.typeOf.object("imageBasedLighting",this._imageBasedLighting),e!==this._imageBasedLighting&&(this._shouldDestroyImageBasedLighting&&!this._imageBasedLighting.isDestroyed()&&this._imageBasedLighting.destroy(),this._imageBasedLighting=e,this._shouldDestroyImageBasedLighting=!1,this.resetDrawCommands())}},backFaceCulling:{get:function(){return this._backFaceCulling},set:function(e){e!==this._backFaceCulling&&(this._backFaceCullingDirty=!0),this._backFaceCulling=e}},scale:{get:function(){return this._scale},set:function(e){e!==this._scale&&(this._updateModelMatrix=!0),this._scale=e}},computedScale:{get:function(){return this._computedScale}},minimumPixelSize:{get:function(){return this._minimumPixelSize},set:function(e){e!==this._minimumPixelSize&&(this._updateModelMatrix=!0),this._minimumPixelSize=e}},maximumScale:{get:function(){return this._maximumScale},set:function(e){e!==this._maximumScale&&(this._updateModelMatrix=!0),this._maximumScale=e}},shadows:{get:function(){return this._shadows},set:function(e){e!==this._shadows&&(this._shadowsDirty=!0),this._shadows=e}},credit:{get:function(){return this._credit}},showCreditsOnScreen:{get:function(){return this._showCreditsOnScreen},set:function(e){this._showCreditsOnScreen!==e&&(this._showCreditsOnScreenDirty=!0),this._showCreditsOnScreen=e}},splitDirection:{get:function(){return this._splitDirection},set:function(e){this._splitDirection!==e&&this.resetDrawCommands(),this._splitDirection=e}},classificationType:{get:function(){return this._classificationType}},pickIds:{get:function(){return this._pickIds}},styleCommandsNeeded:{get:function(){return this._styleCommandsNeeded}}});Vi.prototype.getNode=function(e){if(!this._ready)throw new w("The model is not loaded. Use Model.readyPromise or wait for Model.ready to be true.");return E.typeOf.string("name",e),this._nodesByName[e]};Vi.prototype.setArticulationStage=function(e,t){if(E.typeOf.number("value",t),!this._ready)throw new w("The model is not loaded. Use Model.readyPromise or wait for Model.ready to be true.");this._sceneGraph.setArticulationStage(e,t)};Vi.prototype.applyArticulations=function(){if(!this._ready)throw new w("The model is not loaded. Use Model.readyPromise or wait for Model.ready to be true.");this._sceneGraph.applyArticulations()};Vi.prototype.makeStyleDirty=function(){this._styleDirty=!0};Vi.prototype.resetDrawCommands=function(){this._drawCommandsBuilt=!1};const lrt=new N,urt=new te,frt=new N;Vi.prototype.update=function(e){if(drt(this,e),hrt(this,e),prt(this,e),!this._resourcesLoaded||e.mode===me.MORPHING)return;mrt(this),_rt(this),grt(this,e),yrt(this),Art(this,e),Trt(this,e),Crt(this,e),brt(this,e),this._defaultTexture=e.context.defaultTexture,Ert(this,e),xrt(this,e),wrt(this),Srt(this,e),Irt(this,e);const t=this;if(!t._ready){t._completeLoad(t,e);return}Drt(this),Prt(this,e),Ort(this),Lrt(this,e)};function drt(e,t){(!e._resourcesLoaded||!e._texturesLoaded)&&e._loader.process(t)}function hrt(e,t){l(e._customShader)&&e._customShader.update(t)}function prt(e,t){e._imageBasedLighting.update(t),e._imageBasedLighting.shouldRegenerateShaders&&e.resetDrawCommands()}function mrt(e){if(!e._featureTableIdDirty)return;e._featureTableIdDirty=!1;const t=e._sceneGraph.components,n=t.structuralMetadata;l(n)&&n.propertyTableCount>0&&(e.featureTableId=art(t,e),e._styleDirty=!0,e.resetDrawCommands())}function _rt(e){e._styleDirty&&(e.applyStyle(e._style),e._styleDirty=!1)}function grt(e,t){const n=e._featureTables,i=n.length;let o=!1;for(let r=0;r<i;r++)n[r].update(t),n[r].styleCommandsNeededDirty&&(o=!0);o&&Uie(e)}function Uie(e){const t=e.featureTables[e.featureTableId];e._styleCommandsNeeded=$E.getStyleCommandsNeeded(t.featuresLength,t.batchTexture.translucentFeaturesLength)}function yrt(e){const t=e.pointCloudShading;t.attenuation!==e._attenuation&&(e.resetDrawCommands(),e._attenuation=t.attenuation),t.backFaceCulling!==e._pointCloudBackFaceCulling&&(e.resetDrawCommands(),e._pointCloudBackFaceCulling=t.backFaceCulling)}function Art(e,t){e._silhouetteDirty&&(Vie(t)&&e.resetDrawCommands(),e._silhouetteDirty=!1)}function Trt(e,t){const n=e.hasSkipLevelOfDetail(t);n!==e._skipLevelOfDetail&&(e.resetDrawCommands(),e._skipLevelOfDetail=n)}function Crt(e,t){let n=0;e.isClippingEnabled()&&(e._clippingPlanes.owner===e&&e._clippingPlanes.update(t),n=e._clippingPlanes.clippingPlanesState),n!==e._clippingPlanesState&&(e.resetDrawCommands(),e._clippingPlanesState=n)}function brt(e,t){t.mode!==e._sceneMode&&(e._projectTo2D?e.resetDrawCommands():e._updateModelMatrix=!0,e._sceneMode=t.mode)}function Ert(e,t){e._drawCommandsBuilt||(e.destroyPipelineResources(),e._sceneGraph.buildDrawCommands(t),e._drawCommandsBuilt=!0)}function xrt(e,t){if(!N.equals(e.modelMatrix,e._modelMatrix)){if(t.mode!==me.SCENE3D&&e._projectTo2D)throw new w("Model.modelMatrix cannot be changed in 2D or Columbus View if projectTo2D is true.");e._updateModelMatrix=!0,e._modelMatrix=N.clone(e.modelMatrix,e._modelMatrix)}}const od=new d,KD=new ve;function wrt(e){if(!e._updateModelMatrix&&!e._heightDirty&&e._minimumPixelSize===0)return;l(e._removeUpdateHeightCallback)&&(e._removeUpdateHeightCallback(),e._removeUpdateHeightCallback=void 0);const t=e._scene;if(!l(t)||!l(t.globe)||e.heightReference===Ht.NONE){if(e.heightReference!==Ht.NONE)throw new w("Height reference is not supported without a scene and globe.");e._clampedModelMatrix=void 0;return}const n=t.globe,i=n.ellipsoid,o=e.modelMatrix;od.x=o[12],od.y=o[13],od.z=o[14];const r=i.cartesianToCartographic(od);l(e._clampedModelMatrix)||(e._clampedModelMatrix=N.clone(o,new N));const s=n._surface;e._removeUpdateHeightCallback=s.updateHeight(r,Tq(e,i,r));const a=n.getHeight(r);if(l(a)){const c=Tq(e,i,r);ve.clone(r,KD),KD.height=a,i.cartographicToCartesian(KD,od),c(od)}e._heightDirty=!1,e._updateModelMatrix=!0}function Srt(e,t){if(!e._updateModelMatrix&&e._minimumPixelSize===0)return;const n=l(e._clampedModelMatrix)?e._clampedModelMatrix:e.modelMatrix;Hie(e,n),vrt(e,n,t)}function Hie(e,t){e._clampedScale=l(e._maximumScale)?Math.min(e._scale,e._maximumScale):e._scale,e._boundingSphere.center=d.multiplyByScalar(e._sceneGraph.boundingSphere.center,e._clampedScale,e._boundingSphere.center),e._boundingSphere.radius=e._initialRadius*e._clampedScale,e._boundingSphere=Ae.transform(e._boundingSphere,t,e._boundingSphere)}function vrt(e,t,n){let i=e.scale;if(e.minimumPixelSize!==0&&!e._projectTo2D){const o=n.context,r=Math.max(o.drawingBufferWidth,o.drawingBufferHeight);N.getTranslation(t,od),e._sceneMode!==me.SCENE3D&&es.computeActualWgs84Position(n,od,od);const s=e._boundingSphere.radius,a=Brt(od,s,n),c=1/a;Math.min(c*(2*s),r)<e.minimumPixelSize&&(i=e.minimumPixelSize*a/(2*e._initialRadius))}e._computedScale=l(e.maximumScale)?Math.min(e.maximumScale,i):i}function Drt(e){if(!e._idDirty)return;e._idDirty=!1;const t=e._id,n=e._pickIds,i=n.length;for(let o=0;o<i;++o)n[o].object.id=t}function Irt(e,t){const n=l(e._clampedModelMatrix)?e._clampedModelMatrix:e.modelMatrix,i=A(e.referenceMatrix,n),o=t.context,r=e._imageBasedLighting;if(r.useSphericalHarmonicCoefficients||r.useSpecularEnvironmentMaps){let s=urt,a=lrt;a=N.multiply(o.uniformState.view3D,i,a),s=N.getMatrix3(a,s),s=te.getRotation(s,s),e._iblReferenceFrameMatrix=te.transpose(s,e._iblReferenceFrameMatrix)}if(e.isClippingEnabled()){let s=frt;s=N.multiply(o.uniformState.view3D,i,s),s=N.multiply(s,e._clippingPlanes.modelMatrix,s),e._clippingPlanesMatrix=N.inverseTranspose(s,e._clippingPlanesMatrix)}}function Prt(e,t){const n=e._sceneGraph;if(e._updateModelMatrix||e._minimumPixelSize!==0){const o=l(e._clampedModelMatrix)?e._clampedModelMatrix:e.modelMatrix;n.updateModelMatrix(o,t),e._updateModelMatrix=!1}e._backFaceCullingDirty&&(n.updateBackFaceCulling(e._backFaceCulling),e._backFaceCullingDirty=!1),e._shadowsDirty&&(n.updateShadows(e._shadows),e._shadowsDirty=!1),e._debugShowBoundingVolumeDirty&&(n.updateShowBoundingVolume(e._debugShowBoundingVolume),e._debugShowBoundingVolumeDirty=!1);let i=!1;l(e.classificationType)||(i=e._userAnimationDirty||e._activeAnimations.update(t)),n.update(t,i),e._userAnimationDirty=!1}function Ort(e){if(!e._showCreditsOnScreenDirty)return;e._showCreditsOnScreenDirty=!1;const t=e._showCreditsOnScreen;l(e._credit)&&(e._credit.showOnScreen=t);const n=e._resourceCredits,i=n.length;for(let s=0;s<i;s++)n[s].showOnScreen=t;const o=e._gltfCredits,r=o.length;for(let s=0;s<r;s++)o[s].showOnScreen=t}function Lrt(e,t){const n=Nrt(e,t),i=e.isInvisible(),o=e.hasSilhouette(t),r=e._show&&e._computedScale!==0&&n&&(!i||o),s=t.passes,a=s.render||s.pick&&e.allowPicking;r&&!e._ignoreCommands&&a&&(Mrt(e,t),e._sceneGraph.pushDrawCommands(t))}const WR=new Ae;function Brt(e,t,n){return WR.center=e,WR.radius=t,n.camera.getPixelSize(WR,n.context.drawingBufferWidth,n.context.drawingBufferHeight)}function Tq(e,t,n){return function(i){if(e.heightReference===Ht.RELATIVE_TO_GROUND){const r=t.cartesianToCartographic(i,KD);r.height+=n.height,t.cartographicToCartesian(r,i)}const o=e._clampedModelMatrix;N.clone(e.modelMatrix,o),o[12]=i.x,o[13]=i.y,o[14]=i.z,e._heightDirty=!0}}const Rrt=new d;function Nrt(e,t){const n=e.distanceDisplayCondition;if(!l(n))return!0;const i=n.near*n.near,o=n.far*n.far;let r;if(t.mode===me.SCENE2D){const a=(t.camera.frustum.right-t.camera.frustum.left)*.5;r=a*a}else{const s=N.getTranslation(e.modelMatrix,Rrt);es.computeActualWgs84Position(t,s,s),r=d.distanceSquared(s,t.camera.positionWC)}return r>=i&&r<=o}function Mrt(e,t){const n=t.creditDisplay,i=e._credit;l(i)&&n.addCredit(i);const o=e._resourceCredits,r=o.length;for(let c=0;c<r;c++)n.addCredit(o[c]);const s=e._gltfCredits,a=s.length;for(let c=0;c<a;c++)n.addCredit(s[c])}Vi.prototype.isTranslucent=function(){const e=this.color;return l(e)&&e.alpha>0&&e.alpha<1};Vi.prototype.isInvisible=function(){const e=this.color;return l(e)&&e.alpha===0};function Vie(e){return e.context.stencilBuffer}Vi.prototype.hasSilhouette=function(e){return Vie(e)&&this._silhouetteSize>0&&this._silhouetteColor.alpha>0&&!l(this._classificationType)};function Frt(e){return e.context.stencilBuffer}Vi.prototype.hasSkipLevelOfDetail=function(e){if(!Xa.is3DTiles(this.type))return!1;const n=this._content.tileset;return Frt(e)&&n.skipLevelOfDetail};Vi.prototype.isClippingEnabled=function(){const e=this._clippingPlanes;return l(e)&&e.enabled&&e.length!==0};Vi.prototype.isDestroyed=function(){return!1};Vi.prototype.destroy=function(){const e=this._loader;l(e)&&e.destroy();const t=this._featureTables;if(l(t)){const i=t.length;for(let o=0;o<i;o++)t[o].destroy()}this.destroyPipelineResources(),this.destroyModelResources(),l(this._removeUpdateHeightCallback)&&(this._removeUpdateHeightCallback(),this._removeUpdateHeightCallback=void 0),l(this._terrainProviderChangedCallback)&&(this._terrainProviderChangedCallback(),this._terrainProviderChangedCallback=void 0);const n=this._clippingPlanes;l(n)&&!n.isDestroyed()&&n.owner===this&&n.destroy(),this._clippingPlanes=void 0,this._shouldDestroyImageBasedLighting&&!this._imageBasedLighting.isDestroyed()&&this._imageBasedLighting.destroy(),this._imageBasedLighting=void 0,Je(this)};Vi.prototype.destroyPipelineResources=function(){const e=this._pipelineResources;for(let t=0;t<e.length;t++)e[t].destroy();this._pipelineResources.length=0,this._pickIds.length=0};Vi.prototype.destroyModelResources=function(){const e=this._modelResources;for(let t=0;t<e.length;t++)e[t].destroy();this._modelResources.length=0};Vi.fromGltf=function(e){if(e=A(e,A.EMPTY_OBJECT),!l(e.url)&&!l(e.gltf))throw new w("options.url is required.");const t=A(e.url,e.gltf),n={releaseGltfJson:e.releaseGltfJson,asynchronous:e.asynchronous,incrementallyLoadTextures:e.incrementallyLoadTextures,upAxis:e.upAxis,forwardAxis:e.forwardAxis,loadAttributesFor2D:e.projectTo2D,loadIndicesForWireframe:e.enableDebugWireframe,loadPrimitiveOutline:e.enableShowOutline,loadForClassification:l(e.classificationType)},i=A(e.basePath,""),o=je.createIfNeeded(i);l(t.asset)?(n.gltfJson=t,n.baseResource=o,n.gltfResource=o):t instanceof Uint8Array?(n.typedArray=t,n.baseResource=o,n.gltfResource=o):n.gltfResource=je.createIfNeeded(t);const r=new af(n),a=l(e.content)?Xa.TILE_GLTF:Xa.GLTF,c=Vx(r,a,e);return c.resource=n.gltfResource,new Vi(c)};Vi.fromB3dm=function(e){const t={b3dmResource:e.resource,arrayBuffer:e.arrayBuffer,byteOffset:e.byteOffset,releaseGltfJson:e.releaseGltfJson,asynchronous:e.asynchronous,incrementallyLoadTextures:e.incrementallyLoadTextures,upAxis:e.upAxis,forwardAxis:e.forwardAxis,loadAttributesFor2D:e.projectTo2D,loadIndicesForWireframe:e.enableDebugWireframe,loadPrimitiveOutline:e.enableShowOutline,loadForClassification:l(e.classificationType)},n=new km(t),i=Vx(n,Xa.TILE_B3DM,e);return new Vi(i)};Vi.fromPnts=function(e){const t={arrayBuffer:e.arrayBuffer,byteOffset:e.byteOffset,loadAttributesFor2D:e.projectTo2D},n=new qm(t),i=Vx(n,Xa.TILE_PNTS,e);return new Vi(i)};Vi.fromI3dm=function(e){const t={i3dmResource:e.resource,arrayBuffer:e.arrayBuffer,byteOffset:e.byteOffset,releaseGltfJson:e.releaseGltfJson,asynchronous:e.asynchronous,incrementallyLoadTextures:e.incrementallyLoadTextures,upAxis:e.upAxis,forwardAxis:e.forwardAxis,loadAttributesFor2D:e.projectTo2D,loadIndicesForWireframe:e.enableDebugWireframe,loadPrimitiveOutline:e.enableShowOutline},n=new Wh(t),i=Vx(n,Xa.TILE_I3DM,e);return new Vi(i)};Vi.fromGeoJson=function(e){const t={geoJson:e.geoJson},n=new Gm(t),i=Vx(n,Xa.TILE_GEOJSON,e);return new Vi(i)};Vi.prototype.applyColorAndShow=function(e){const t=this._color,n=l(e)&&l(e.color),i=l(e)&&l(e.show);this._color=n?e.color.evaluateColor(void 0,this._color):k.clone(k.WHITE,this._color),this._show=i?e.show.evaluate(void 0):!0,s2(t,this._color)&&this.resetDrawCommands()};Vi.prototype.applyStyle=function(e){const t=this.type===Xa.TILE_PNTS,n=l(this.featureTableId)&&this.featureTables[this.featureTableId].featuresLength>0,i=l(this.structuralMetadata)?this.structuralMetadata.propertyAttributes:void 0,o=l(i)&&l(i[0]);if(t&&(!n||o)){this.resetDrawCommands();return}n?(this.featureTables[this.featureTableId].applyStyle(e),Uie(this)):(this.applyColorAndShow(e),this._styleCommandsNeeded=void 0)};function Vx(e,t,n){return{loader:e,type:t,resource:n.resource,show:n.show,modelMatrix:n.modelMatrix,scale:n.scale,minimumPixelSize:n.minimumPixelSize,maximumScale:n.maximumScale,id:n.id,allowPicking:n.allowPicking,clampAnimations:n.clampAnimations,shadows:n.shadows,debugShowBoundingVolume:n.debugShowBoundingVolume,enableDebugWireframe:n.enableDebugWireframe,debugWireframe:n.debugWireframe,cull:n.cull,opaquePass:n.opaquePass,customShader:n.customShader,content:n.content,heightReference:n.heightReference,scene:n.scene,distanceDisplayCondition:n.distanceDisplayCondition,color:n.color,colorBlendAmount:n.colorBlendAmount,colorBlendMode:n.colorBlendMode,silhouetteColor:n.silhouetteColor,silhouetteSize:n.silhouetteSize,enableShowOutline:n.enableShowOutline,showOutline:n.showOutline,outlineColor:n.outlineColor,clippingPlanes:n.clippingPlanes,lightColor:n.lightColor,imageBasedLighting:n.imageBasedLighting,backFaceCulling:n.backFaceCulling,credit:n.credit,showCreditsOnScreen:n.showCreditsOnScreen,splitDirection:n.splitDirection,projectTo2D:n.projectTo2D,featureIdLabel:n.featureIdLabel,instanceFeatureIdLabel:n.instanceFeatureIdLabel,pointCloudShading:n.pointCloudShading,classificationType:n.classificationType,pickObject:n.pickObject}}function pr(e,t,n){this._tileset=e,this._tile=t,this._resource=n,this._model=void 0,this._readyPromise=void 0,this._metadata=void 0,this._group=void 0}Object.defineProperties(pr.prototype,{featuresLength:{get:function(){const e=this._model,t=e.featureTables,n=e.featureTableId;return l(t)&&l(t[n])?t[n].featuresLength:0}},pointsLength:{get:function(){return this._model.statistics.pointsLength}},trianglesLength:{get:function(){return this._model.statistics.trianglesLength}},geometryByteLength:{get:function(){return this._model.statistics.geometryByteLength}},texturesByteLength:{get:function(){return this._model.statistics.texturesByteLength}},batchTableByteLength:{get:function(){const e=this._model.statistics;return e.propertyTablesByteLength+e.batchTexturesByteLength}},innerContents:{get:function(){}},readyPromise:{get:function(){return this._readyPromise}},tileset:{get:function(){return this._tileset}},tile:{get:function(){return this._tile}},url:{get:function(){return this._resource.getUrlComponent(!0)}},batchTable:{get:function(){const e=this._model,t=e.featureTables,n=e.featureTableId;if(l(t)&&l(t[n]))return t[n]}},metadata:{get:function(){return this._metadata},set:function(e){this._metadata=e}},group:{get:function(){return this._group},set:function(e){this._group=e}}});pr.prototype.getFeature=function(e){const t=this._model,n=t.featureTableId;if(!l(n))throw new w("No feature ID set is selected. Make sure Cesium3DTileset.featureIdLabel or Cesium3DTileset.instanceFeatureIdLabel is defined");const i=t.featureTables[n];if(!l(i))throw new w("No feature table found for the selected feature ID set");const o=i.featuresLength;if(!l(e)||e<0||e>=o)throw new w(`featureId is required and must be between 0 and featuresLength - 1 (${o-1}).`);return i.getFeature(e)};pr.prototype.hasProperty=function(e,t){const n=this._model,i=n.featureTableId;return l(i)?n.featureTables[i].hasProperty(e,t):!1};pr.prototype.applyDebugSettings=function(e,t){t=e?t:k.WHITE,this.featuresLength===0?this._model.color=t:l(this.batchTable)&&this.batchTable.setAllColor(t)};pr.prototype.applyStyle=function(e){this._model.style=e};pr.prototype.update=function(e,t){const n=this._model,i=this._tile;n.colorBlendAmount=e.colorBlendAmount,n.colorBlendMode=e.colorBlendMode,n.modelMatrix=i.computedTransform,n.customShader=e.customShader,n.featureIdLabel=e.featureIdLabel,n.instanceFeatureIdLabel=e.instanceFeatureIdLabel,n.lightColor=e.lightColor,n.imageBasedLighting=e.imageBasedLighting,n.backFaceCulling=e.backFaceCulling,n.shadows=e.shadows,n.showCreditsOnScreen=e.showCreditsOnScreen,n.splitDirection=e.splitDirection,n.debugWireframe=e.debugWireframe,n.showOutline=e.showOutline,n.outlineColor=e.outlineColor,n.pointCloudShading=e.pointCloudShading;const o=e.clippingPlanes;n.referenceMatrix=e.clippingPlanesOriginMatrix,l(o)&&i.clippingPlanesDirty&&(n._clippingPlanes=o.enabled&&i._isClipped?o:void 0),l(o)&&l(n._clippingPlanes)&&n._clippingPlanes!==o&&(n._clippingPlanes=o,n._clippingPlanesState=0),n.update(t)};pr.prototype.isDestroyed=function(){return!1};pr.prototype.destroy=function(){return this._model=this._model&&this._model.destroy(),Je(this)};pr.fromGltf=function(e,t,n,i){const o=new pr(e,t,n),s=kx(e,t,o,{gltf:i,basePath:n}),a=e.vectorClassificationOnly?void 0:e.classificationType;s.classificationType=a;const c=Vi.fromGltf(s);return o._model=c,o._readyPromise=c.readyPromise.then(function(u){return u.activeAnimations.addAll({loop:Dh.REPEAT}),u}),o};pr.fromB3dm=function(e,t,n,i,o){const r=new pr(e,t,n),a=kx(e,t,r,{arrayBuffer:i,byteOffset:o,resource:n}),c=e.vectorClassificationOnly?void 0:e.classificationType;a.classificationType=c;const u=Vi.fromB3dm(a);return r._model=u,r._readyPromise=u.readyPromise.then(function(f){return f.activeAnimations.addAll({loop:Dh.REPEAT}),f}),r};pr.fromI3dm=function(e,t,n,i,o){const r=new pr(e,t,n),a=kx(e,t,r,{arrayBuffer:i,byteOffset:o,resource:n}),c=Vi.fromI3dm(a);return r._model=c,r._readyPromise=c.readyPromise.then(function(u){return u.activeAnimations.addAll({loop:Dh.REPEAT}),u}),r};pr.fromPnts=function(e,t,n,i,o){const r=new pr(e,t,n),a=kx(e,t,r,{arrayBuffer:i,byteOffset:o,resource:n}),c=Vi.fromPnts(a);return r._model=c,r._readyPromise=c.readyPromise,r};pr.fromGeoJson=function(e,t,n,i){const o=new pr(e,t,n),s=kx(e,t,o,{geoJson:i,resource:n}),a=Vi.fromGeoJson(s);return o._model=a,o._readyPromise=a.readyPromise,o};function kx(e,t,n,i){const o={cull:!1,releaseGltfJson:!0,opaquePass:We.CESIUM_3D_TILE,modelMatrix:t.computedTransform,upAxis:e._modelUpAxis,forwardAxis:e._modelForwardAxis,incrementallyLoadTextures:!1,customShader:e.customShader,content:n,colorBlendMode:e.colorBlendMode,colorBlendAmount:e.colorBlendAmount,lightColor:e.lightColor,imageBasedLighting:e.imageBasedLighting,featureIdLabel:e.featureIdLabel,instanceFeatureIdLabel:e.instanceFeatureIdLabel,pointCloudShading:e.pointCloudShading,clippingPlanes:e.clippingPlanes,backFaceCulling:e.backFaceCulling,shadows:e.shadows,showCreditsOnScreen:e.showCreditsOnScreen,splitDirection:e.splitDirection,enableDebugWireframe:e._enableDebugWireframe,debugWireframe:e.debugWireframe,projectTo2D:e._projectTo2D,enableShowOutline:e._enableShowOutline,showOutline:e.showOutline,outlineColor:e.outlineColor};return Ln(i,o)}function Ap(e,t,n,i){this._tileset=e,this._tile=t,this._resource=n,this.featurePropertiesDirty=!1,this._metadata=void 0,this._group=void 0,this._readyPromise=zrt(this,i)}Object.defineProperties(Ap.prototype,{featuresLength:{get:function(){return 0}},pointsLength:{get:function(){return 0}},trianglesLength:{get:function(){return 0}},geometryByteLength:{get:function(){return 0}},texturesByteLength:{get:function(){return 0}},batchTableByteLength:{get:function(){return 0}},innerContents:{get:function(){}},readyPromise:{get:function(){return this._readyPromise}},tileset:{get:function(){return this._tileset}},tile:{get:function(){return this._tile}},url:{get:function(){return this._resource.getUrlComponent(!0)}},batchTable:{get:function(){}},metadata:{get:function(){return this._metadata},set:function(e){this._metadata=e}},group:{get:function(){return this._group},set:function(e){this._group=e}}});function zrt(e,t){return e._tileset.loadTileset(e._resource,t,e._tile),Promise.resolve(e)}Ap.prototype.hasProperty=function(e,t){return!1};Ap.prototype.getFeature=function(e){};Ap.prototype.applyDebugSettings=function(e,t){};Ap.prototype.applyStyle=function(e){};Ap.prototype.update=function(e,t){};Ap.prototype.isDestroyed=function(){return!1};Ap.prototype.destroy=function(){return Je(this)};function en(e,t){if(e=A(e,A.EMPTY_OBJECT),l(e.disableDepthTestDistance)&&e.disableDepthTestDistance<0)throw new w("disableDepthTestDistance must be greater than or equal to 0.0.");let n=e.translucencyByDistance,i=e.pixelOffsetScaleByDistance,o=e.scaleByDistance,r=e.distanceDisplayCondition;if(l(n)){if(n.far<=n.near)throw new w("translucencyByDistance.far must be greater than translucencyByDistance.near.");n=tn.clone(n)}if(l(i)){if(i.far<=i.near)throw new w("pixelOffsetScaleByDistance.far must be greater than pixelOffsetScaleByDistance.near.");i=tn.clone(i)}if(l(o)){if(o.far<=o.near)throw new w("scaleByDistance.far must be greater than scaleByDistance.near.");o=tn.clone(o)}if(l(r)){if(r.far<=r.near)throw new w("distanceDisplayCondition.far must be greater than distanceDisplayCondition.near.");r=sn.clone(r)}this._show=A(e.show,!0),this._position=d.clone(A(e.position,d.ZERO)),this._actualPosition=d.clone(this._position),this._pixelOffset=$.clone(A(e.pixelOffset,$.ZERO)),this._translate=new $(0,0),this._eyeOffset=d.clone(A(e.eyeOffset,d.ZERO)),this._heightReference=A(e.heightReference,Ht.NONE),this._verticalOrigin=A(e.verticalOrigin,co.CENTER),this._horizontalOrigin=A(e.horizontalOrigin,yc.CENTER),this._scale=A(e.scale,1),this._color=k.clone(A(e.color,k.WHITE)),this._rotation=A(e.rotation,0),this._alignedAxis=d.clone(A(e.alignedAxis,d.ZERO)),this._width=e.width,this._height=e.height,this._scaleByDistance=o,this._translucencyByDistance=n,this._pixelOffsetScaleByDistance=i,this._sizeInMeters=A(e.sizeInMeters,!1),this._distanceDisplayCondition=r,this._disableDepthTestDistance=e.disableDepthTestDistance,this._id=e.id,this._collection=A(e.collection,t),this._pickId=void 0,this._pickPrimitive=A(e._pickPrimitive,this),this._billboardCollection=t,this._dirty=!1,this._index=-1,this._batchIndex=void 0,this._imageIndex=-1,this._imageIndexPromise=void 0,this._imageId=void 0,this._image=void 0,this._imageSubRegion=void 0,this._imageWidth=void 0,this._imageHeight=void 0,this._labelDimensions=void 0,this._labelHorizontalOrigin=void 0,this._labelTranslate=void 0;const s=e.image;let a=e.imageId;l(s)&&(l(a)||(typeof s=="string"?a=s:l(s.src)?a=s.src:a=ma()),this._imageId=a,this._image=s),l(e.imageSubRegion)&&(this._imageId=a,this._imageSubRegion=e.imageSubRegion),l(this._billboardCollection._textureAtlas)&&this._loadImage(),this._actualClampedPosition=void 0,this._removeCallbackFunc=void 0,this._mode=me.SCENE3D,this._clusterShow=!0,this._outlineColor=k.clone(A(e.outlineColor,k.BLACK)),this._outlineWidth=A(e.outlineWidth,0),this._updateClamping()}const Cq=en.SHOW_INDEX=0,JD=en.POSITION_INDEX=1,kie=en.PIXEL_OFFSET_INDEX=2,Urt=en.EYE_OFFSET_INDEX=3,Hrt=en.HORIZONTAL_ORIGIN_INDEX=4,Vrt=en.VERTICAL_ORIGIN_INDEX=5,krt=en.SCALE_INDEX=6,QD=en.IMAGE_INDEX_INDEX=7,bq=en.COLOR_INDEX=8,Grt=en.ROTATION_INDEX=9,Wrt=en.ALIGNED_AXIS_INDEX=10,qrt=en.SCALE_BY_DISTANCE_INDEX=11,jrt=en.TRANSLUCENCY_BY_DISTANCE_INDEX=12,Yrt=en.PIXEL_OFFSET_SCALE_BY_DISTANCE_INDEX=13,$rt=en.DISTANCE_DISPLAY_CONDITION=14,Xrt=en.DISABLE_DEPTH_DISTANCE=15;en.TEXTURE_COORDINATE_BOUNDS=16;const Eq=en.SDF_INDEX=17;en.NUMBER_OF_PROPERTIES=18;function Po(e,t){const n=e._billboardCollection;l(n)&&(n._updateBillboard(e,t),e._dirty=!0)}Object.defineProperties(en.prototype,{show:{get:function(){return this._show},set:function(e){E.typeOf.bool("value",e),this._show!==e&&(this._show=e,Po(this,Cq))}},position:{get:function(){return this._position},set:function(e){E.typeOf.object("value",e);const t=this._position;d.equals(t,e)||(d.clone(e,t),d.clone(e,this._actualPosition),this._updateClamping(),Po(this,JD))}},heightReference:{get:function(){return this._heightReference},set:function(e){E.typeOf.number("value",e);const t=this._heightReference;e!==t&&(this._heightReference=e,this._updateClamping(),Po(this,JD))}},pixelOffset:{get:function(){return this._pixelOffset},set:function(e){E.typeOf.object("value",e);const t=this._pixelOffset;$.equals(t,e)||($.clone(e,t),Po(this,kie))}},scaleByDistance:{get:function(){return this._scaleByDistance},set:function(e){if(l(e)&&(E.typeOf.object("value",e),e.far<=e.near))throw new w("far distance must be greater than near distance.");const t=this._scaleByDistance;tn.equals(t,e)||(this._scaleByDistance=tn.clone(e,t),Po(this,qrt))}},translucencyByDistance:{get:function(){return this._translucencyByDistance},set:function(e){if(l(e)&&(E.typeOf.object("value",e),e.far<=e.near))throw new w("far distance must be greater than near distance.");const t=this._translucencyByDistance;tn.equals(t,e)||(this._translucencyByDistance=tn.clone(e,t),Po(this,jrt))}},pixelOffsetScaleByDistance:{get:function(){return this._pixelOffsetScaleByDistance},set:function(e){if(l(e)&&(E.typeOf.object("value",e),e.far<=e.near))throw new w("far distance must be greater than near distance.");const t=this._pixelOffsetScaleByDistance;tn.equals(t,e)||(this._pixelOffsetScaleByDistance=tn.clone(e,t),Po(this,Yrt))}},eyeOffset:{get:function(){return this._eyeOffset},set:function(e){E.typeOf.object("value",e);const t=this._eyeOffset;d.equals(t,e)||(d.clone(e,t),Po(this,Urt))}},horizontalOrigin:{get:function(){return this._horizontalOrigin},set:function(e){E.typeOf.number("value",e),this._horizontalOrigin!==e&&(this._horizontalOrigin=e,Po(this,Hrt))}},verticalOrigin:{get:function(){return this._verticalOrigin},set:function(e){E.typeOf.number("value",e),this._verticalOrigin!==e&&(this._verticalOrigin=e,Po(this,Vrt))}},scale:{get:function(){return this._scale},set:function(e){E.typeOf.number("value",e),this._scale!==e&&(this._scale=e,Po(this,krt))}},color:{get:function(){return this._color},set:function(e){E.typeOf.object("value",e);const t=this._color;k.equals(t,e)||(k.clone(e,t),Po(this,bq))}},rotation:{get:function(){return this._rotation},set:function(e){E.typeOf.number("value",e),this._rotation!==e&&(this._rotation=e,Po(this,Grt))}},alignedAxis:{get:function(){return this._alignedAxis},set:function(e){E.typeOf.object("value",e);const t=this._alignedAxis;d.equals(t,e)||(d.clone(e,t),Po(this,Wrt))}},width:{get:function(){return A(this._width,this._imageWidth)},set:function(e){l(e)&&E.typeOf.number("value",e),this._width!==e&&(this._width=e,Po(this,QD))}},height:{get:function(){return A(this._height,this._imageHeight)},set:function(e){l(e)&&E.typeOf.number("value",e),this._height!==e&&(this._height=e,Po(this,QD))}},sizeInMeters:{get:function(){return this._sizeInMeters},set:function(e){E.typeOf.bool("value",e),this._sizeInMeters!==e&&(this._sizeInMeters=e,Po(this,bq))}},distanceDisplayCondition:{get:function(){return this._distanceDisplayCondition},set:function(e){if(!sn.equals(e,this._distanceDisplayCondition)){if(l(e)&&(E.typeOf.object("value",e),e.far<=e.near))throw new w("far distance must be greater than near distance.");this._distanceDisplayCondition=sn.clone(e,this._distanceDisplayCondition),Po(this,$rt)}}},disableDepthTestDistance:{get:function(){return this._disableDepthTestDistance},set:function(e){if(l(e)&&(E.typeOf.number("value",e),e<0))throw new w("disableDepthTestDistance must be greater than or equal to 0.0.");this._disableDepthTestDistance!==e&&(this._disableDepthTestDistance=e,Po(this,Xrt))}},id:{get:function(){return this._id},set:function(e){this._id=e,l(this._pickId)&&(this._pickId.object.id=e)}},pickPrimitive:{get:function(){return this._pickPrimitive},set:function(e){this._pickPrimitive=e,l(this._pickId)&&(this._pickId.object.primitive=e)}},pickId:{get:function(){return this._pickId}},image:{get:function(){return this._imageId},set:function(e){l(e)?typeof e=="string"?this.setImage(e,e):e instanceof je?this.setImage(e.url,e):l(e.src)?this.setImage(e.src,e):this.setImage(ma(),e):(this._imageIndex=-1,this._imageSubRegion=void 0,this._imageId=void 0,this._image=void 0,this._imageIndexPromise=void 0,Po(this,QD))}},ready:{get:function(){return this._imageIndex!==-1}},_clampedPosition:{get:function(){return this._actualClampedPosition},set:function(e){this._actualClampedPosition=d.clone(e,this._actualClampedPosition),Po(this,JD)}},clusterShow:{get:function(){return this._clusterShow},set:function(e){this._clusterShow!==e&&(this._clusterShow=e,Po(this,Cq))}},outlineColor:{get:function(){return this._outlineColor},set:function(e){if(!l(e))throw new w("value is required.");const t=this._outlineColor;k.equals(t,e)||(k.clone(e,t),Po(this,Eq))}},outlineWidth:{get:function(){return this._outlineWidth},set:function(e){this._outlineWidth!==e&&(this._outlineWidth=e,Po(this,Eq))}}});en.prototype.getPickId=function(e){return l(this._pickId)||(this._pickId=e.createPickId({primitive:this._pickPrimitive,collection:this._collection,id:this._id})),this._pickId};en.prototype._updateClamping=function(){en._updateClamping(this._billboardCollection,this)};const wb=new ve,xq=new d;en._updateClamping=function(e,t){const n=e._scene;if(!l(n)||!l(n.globe)){if(t._heightReference!==Ht.NONE)throw new w("Height reference is not supported without a scene and globe.");return}const i=n.globe,o=i.ellipsoid,r=i._surface,s=n.frameState.mode,a=s!==t._mode;if(t._mode=s,(t._heightReference===Ht.NONE||a)&&l(t._removeCallbackFunc)&&(t._removeCallbackFunc(),t._removeCallbackFunc=void 0,t._clampedPosition=void 0),t._heightReference===Ht.NONE||!l(t._position))return;const c=o.cartesianToCartographic(t._position);if(!l(c)){t._actualClampedPosition=void 0;return}l(t._removeCallbackFunc)&&t._removeCallbackFunc();function u(h){if(t._heightReference===Ht.RELATIVE_TO_GROUND)if(t._mode===me.SCENE3D){const _=o.cartesianToCartographic(h,wb);_.height+=c.height,o.cartographicToCartesian(_,h)}else h.x+=c.height;t._clampedPosition=d.clone(h,t._clampedPosition)}t._removeCallbackFunc=r.updateHeight(c,u),ve.clone(c,wb);const f=i.getHeight(c);l(f)&&(wb.height=f),o.cartographicToCartesian(wb,xq),u(xq)};en.prototype._loadImage=function(){const e=this._billboardCollection._textureAtlas,t=this._imageId,n=this._image,i=this._imageSubRegion;let o;const r=this;function s(a){if(r._imageId!==t||r._image!==n||!at.equals(r._imageSubRegion,i))return;const c=e.textureCoordinates[a];r._imageWidth=e.texture.width*c.width,r._imageHeight=e.texture.height*c.height,r._imageIndex=a,r._ready=!0,r._image=void 0,r._imageIndexPromise=void 0,Po(r,QD)}if(l(n)){const a=e.getImageIndex(t);if(l(a)){s(a);return}o=e.addImage(t,n)}l(i)&&(o=e.addSubRegion(t,i)),this._imageIndexPromise=o,l(o)&&o.then(s).catch(function(a){console.error(`Error loading image for billboard: ${a}`),r._imageIndexPromise=void 0})};en.prototype.setImage=function(e,t){if(!l(e))throw new w("id is required.");if(!l(t))throw new w("image is required.");this._imageId!==e&&(this._imageIndex=-1,this._imageSubRegion=void 0,this._imageId=e,this._image=t,l(this._billboardCollection._textureAtlas)&&this._loadImage())};en.prototype.setImageSubRegion=function(e,t){if(!l(e))throw new w("id is required.");if(!l(t))throw new w("subRegion is required.");this._imageId===e&&at.equals(this._imageSubRegion,t)||(this._imageIndex=-1,this._imageId=e,this._imageSubRegion=at.clone(t),l(this._billboardCollection._textureAtlas)&&this._loadImage())};en.prototype._setTranslate=function(e){if(!l(e))throw new w("value is required.");const t=this._translate;$.equals(t,e)||($.clone(e,t),Po(this,kie))};en.prototype._getActualPosition=function(){return l(this._clampedPosition)?this._clampedPosition:this._actualPosition};en.prototype._setActualPosition=function(e){l(this._clampedPosition)||d.clone(e,this._actualPosition),Po(this,JD)};const wq=new ue;en._computeActualPosition=function(e,t,n,i){return l(e._clampedPosition)?(n.mode!==e._mode&&e._updateClamping(),e._clampedPosition):n.mode===me.SCENE3D?t:(N.multiplyByPoint(i,t,wq),es.computeActualWgs84Position(n,wq))};const Gie=new d;en._computeScreenSpacePosition=function(e,t,n,i,o,r){const s=N.multiplyByPoint(e,t,Gie),a=es.wgs84WithEyeOffsetToWindowCoordinates(o,s,n,r);if(l(a))return $.add(a,i,a),a};const Rv=new $(0,0);en.prototype.computeScreenSpacePosition=function(e,t){const n=this._billboardCollection;if(l(t)||(t=new $),!l(n))throw new w("Billboard must be in a collection. Was it removed?");if(!l(e))throw new w("scene is required.");$.clone(this._pixelOffset,Rv),$.add(Rv,this._translate,Rv);let i=n.modelMatrix,o=this._position;if(l(this._clampedPosition)&&(o=this._clampedPosition,e.mode!==me.SCENE3D)){const s=e.mapProjection,a=s.ellipsoid,c=s.unproject(o,wb);o=a.cartographicToCartesian(c,Gie),i=N.IDENTITY}return en._computeScreenSpacePosition(i,o,this._eyeOffset,Rv,e,t)};en.getScreenSpaceBoundingBox=function(e,t,n){let i=e.width,o=e.height;const r=e.scale;i*=r,o*=r;let s=t.x;e.horizontalOrigin===yc.RIGHT?s-=i:e.horizontalOrigin===yc.CENTER&&(s-=i*.5);let a=t.y;return e.verticalOrigin===co.BOTTOM||e.verticalOrigin===co.BASELINE?a-=o:e.verticalOrigin===co.CENTER&&(a-=o*.5),l(n)||(n=new at),n.x=s,n.y=a,n.width=i,n.height=o,n};en.prototype.equals=function(e){return this===e||l(e)&&this._id===e._id&&d.equals(this._position,e._position)&&this._imageId===e._imageId&&this._show===e._show&&this._scale===e._scale&&this._verticalOrigin===e._verticalOrigin&&this._horizontalOrigin===e._horizontalOrigin&&this._heightReference===e._heightReference&&at.equals(this._imageSubRegion,e._imageSubRegion)&&k.equals(this._color,e._color)&&$.equals(this._pixelOffset,e._pixelOffset)&&$.equals(this._translate,e._translate)&&d.equals(this._eyeOffset,e._eyeOffset)&&tn.equals(this._scaleByDistance,e._scaleByDistance)&&tn.equals(this._translucencyByDistance,e._translucencyByDistance)&&tn.equals(this._pixelOffsetScaleByDistance,e._pixelOffsetScaleByDistance)&&sn.equals(this._distanceDisplayCondition,e._distanceDisplayCondition)&&this._disableDepthTestDistance===e._disableDepthTestDistance};en.prototype._destroy=function(){l(this._customData)&&(this._billboardCollection._scene.globe._surface.removeTileCustomData(this._customData),this._customData=void 0),l(this._removeCallbackFunc)&&(this._removeCallbackFunc(),this._removeCallbackFunc=void 0),this.image=void 0,this._pickId=this._pickId&&this._pickId.destroy(),this._billboardCollection=void 0};const Krt={OPAQUE:0,TRANSLUCENT:1,OPAQUE_AND_TRANSLUCENT:2},Sr=Object.freeze(Krt),Jrt={FONT_SIZE:48,PADDING:10,RADIUS:8,CUTOFF:.25},il=Object.freeze(Jrt);function xh(e,t,n,i,o){this.bottomLeft=A(e,$.ZERO),this.topRight=A(t,$.ZERO),this.childNode1=n,this.childNode2=i,this.imageIndex=o}const Qrt=new $(16,16);function bd(e){e=A(e,A.EMPTY_OBJECT);const t=A(e.borderWidthInPixels,1),n=A(e.initialSize,Qrt);if(!l(e.context))throw new w("context is required.");if(t<0)throw new w("borderWidthInPixels must be greater than or equal to zero.");if(n.x<1||n.y<1)throw new w("initialSize must be greater than zero.");this._context=e.context,this._pixelFormat=A(e.pixelFormat,yt.RGBA),this._borderWidthInPixels=t,this._textureCoordinates=[],this._guid=ma(),this._idHash={},this._indexHash={},this._initialSize=n,this._root=void 0}Object.defineProperties(bd.prototype,{borderWidthInPixels:{get:function(){return this._borderWidthInPixels}},textureCoordinates:{get:function(){return this._textureCoordinates}},texture:{get:function(){return l(this._texture)||(this._texture=new rn({context:this._context,width:this._initialSize.x,height:this._initialSize.y,pixelFormat:this._pixelFormat})),this._texture}},numberOfImages:{get:function(){return this._textureCoordinates.length}},guid:{get:function(){return this._guid}}});function Zrt(e,t){const n=e._context,i=e.numberOfImages,o=2,r=e._borderWidthInPixels;if(i>0){const s=e._texture.width,a=e._texture.height,c=o*(s+t.width+r),u=o*(a+t.height+r),f=s/c,h=a/u,_=new xh(new $(s+r,r),new $(c,a)),g=new xh(new $,new $(c,a),e._root,_),p=new xh(new $(r,a+r),new $(c,u)),y=new xh(new $,new $(c,u),g,p);for(let x=0;x<e._textureCoordinates.length;x++){const v=e._textureCoordinates[x];l(v)&&(v.x*=f,v.y*=h,v.width*=f,v.height*=h)}const T=new rn({context:e._context,width:c,height:u,pixelFormat:e._pixelFormat}),b=new Ds({context:n,colorTextures:[e._texture],destroyAttachments:!1});b._bind(),T.copyFromFramebuffer(0,0,0,0,c,u),b._unBind(),b.destroy(),e._texture=e._texture&&e._texture.destroy(),e._texture=T,e._root=y}else{let s=o*(t.width+2*r),a=o*(t.height+2*r);s<e._initialSize.x&&(s=e._initialSize.x),a<e._initialSize.y&&(a=e._initialSize.y),e._texture=e._texture&&e._texture.destroy(),e._texture=new rn({context:e._context,width:s,height:a,pixelFormat:e._pixelFormat}),e._root=new xh(new $(r,r),new $(s,a))}}function ZD(e,t,n){if(l(t)){if(!l(t.childNode1)&&!l(t.childNode2)){if(l(t.imageIndex))return;const i=t.topRight.x-t.bottomLeft.x,o=t.topRight.y-t.bottomLeft.y,r=i-n.width,s=o-n.height;if(r<0||s<0)return;if(r===0&&s===0)return t;if(r>s){t.childNode1=new xh(new $(t.bottomLeft.x,t.bottomLeft.y),new $(t.bottomLeft.x+n.width,t.topRight.y));const a=t.bottomLeft.x+n.width+e._borderWidthInPixels;a<t.topRight.x&&(t.childNode2=new xh(new $(a,t.bottomLeft.y),new $(t.topRight.x,t.topRight.y)))}else{t.childNode1=new xh(new $(t.bottomLeft.x,t.bottomLeft.y),new $(t.topRight.x,t.bottomLeft.y+n.height));const a=t.bottomLeft.y+n.height+e._borderWidthInPixels;a<t.topRight.y&&(t.childNode2=new xh(new $(t.bottomLeft.x,a),new $(t.topRight.x,t.topRight.y)))}return ZD(e,t.childNode1,n)}return ZD(e,t.childNode1,n)||ZD(e,t.childNode2,n)}}function Wie(e,t,n){const i=ZD(e,e._root,t);if(l(i)){i.imageIndex=n;const o=e._texture.width,r=e._texture.height,s=i.topRight.x-i.bottomLeft.x,a=i.topRight.y-i.bottomLeft.y,c=i.bottomLeft.x/o,u=i.bottomLeft.y/r,f=s/o,h=a/r;e._textureCoordinates[n]=new at(c,u,f,h),e._texture.copyFrom({source:t,xOffset:i.bottomLeft.x,yOffset:i.bottomLeft.y})}else Zrt(e,t),Wie(e,t,n);e._guid=ma()}function qie(e,t){if(!l(e)||e.isDestroyed())return-1;const n=e.numberOfImages;return Wie(e,t,n),n}bd.prototype.getImageIndex=function(e){if(!l(e))throw new w("id is required.");return this._indexHash[e]};bd.prototype.addImageSync=function(e,t){if(!l(e))throw new w("id is required.");if(!l(t))throw new w("image is required.");let n=this._indexHash[e];return l(n)||(n=qie(this,t),this._idHash[e]=Promise.resolve(n),this._indexHash[e]=n),n};bd.prototype.addImage=function(e,t){if(!l(e))throw new w("id is required.");if(!l(t))throw new w("image is required.");let n=this._idHash[e];if(l(n))return n;if(typeof t=="function"){if(t=t(e),!l(t))throw new w("image is required.")}else(typeof t=="string"||t instanceof je)&&(t=je.createIfNeeded(t).fetchImage());const i=this;return n=Promise.resolve(t).then(function(o){const r=qie(i,o);return i._indexHash[e]=r,r}),this._idHash[e]=n,n};bd.prototype.addSubRegion=function(e,t){if(!l(e))throw new w("id is required.");if(!l(t))throw new w("subRegion is required.");const n=this._idHash[e];if(!l(n))throw new Fe(`image with id "${e}" not found in the atlas.`);const i=this;return Promise.resolve(n).then(function(o){if(o===-1)return-1;const r=i._texture.width,s=i._texture.height,a=i.numberOfImages,c=i._textureCoordinates[o],u=c.x+t.x/r,f=c.y+t.y/s,h=t.width/r,_=t.height/s;return i._textureCoordinates.push(new at(u,f,h,_)),i._guid=ma(),a})};bd.prototype.isDestroyed=function(){return!1};bd.prototype.destroy=function(){return this._texture=this._texture&&this._texture.destroy(),Je(this)};const est=en.SHOW_INDEX,tE=en.POSITION_INDEX,jie=en.PIXEL_OFFSET_INDEX,Yie=en.EYE_OFFSET_INDEX,tst=en.HORIZONTAL_ORIGIN_INDEX,nst=en.VERTICAL_ORIGIN_INDEX,ist=en.SCALE_INDEX,GC=en.IMAGE_INDEX_INDEX,$ie=en.COLOR_INDEX,ost=en.ROTATION_INDEX,rst=en.ALIGNED_AXIS_INDEX,Xie=en.SCALE_BY_DISTANCE_INDEX,Kie=en.TRANSLUCENCY_BY_DISTANCE_INDEX,Jie=en.PIXEL_OFFSET_SCALE_BY_DISTANCE_INDEX,Qie=en.DISTANCE_DISPLAY_CONDITION,sst=en.DISABLE_DEPTH_DISTANCE,ast=en.TEXTURE_COORDINATE_BOUNDS,Zie=en.SDF_INDEX,PU=en.NUMBER_OF_PROPERTIES;let _o;const cst={positionHighAndScale:0,positionLowAndRotation:1,compressedAttribute0:2,compressedAttribute1:3,compressedAttribute2:4,eyeOffset:5,scaleByDistance:6,pixelOffsetScaleByDistance:7,compressedAttribute3:8,textureCoordinateBoundsOrLabelTranslate:9,a_batchId:10,sdf:11},lst={direction:0,positionHighAndScale:1,positionLowAndRotation:2,compressedAttribute0:3,compressedAttribute1:4,compressedAttribute2:5,eyeOffset:6,scaleByDistance:7,pixelOffsetScaleByDistance:8,compressedAttribute3:9,textureCoordinateBoundsOrLabelTranslate:10,a_batchId:11,sdf:12};function Ka(e){e=A(e,A.EMPTY_OBJECT),this._scene=e.scene,this._batchTable=e.batchTable,this._textureAtlas=void 0,this._textureAtlasGUID=void 0,this._destroyTextureAtlas=!0,this._sp=void 0,this._spTranslucent=void 0,this._rsOpaque=void 0,this._rsTranslucent=void 0,this._vaf=void 0,this._billboards=[],this._billboardsToUpdate=[],this._billboardsToUpdateIndex=0,this._billboardsRemoved=!1,this._createVertexArray=!1,this._shaderRotation=!1,this._compiledShaderRotation=!1,this._shaderAlignedAxis=!1,this._compiledShaderAlignedAxis=!1,this._shaderScaleByDistance=!1,this._compiledShaderScaleByDistance=!1,this._shaderTranslucencyByDistance=!1,this._compiledShaderTranslucencyByDistance=!1,this._shaderPixelOffsetScaleByDistance=!1,this._compiledShaderPixelOffsetScaleByDistance=!1,this._shaderDistanceDisplayCondition=!1,this._compiledShaderDistanceDisplayCondition=!1,this._shaderDisableDepthDistance=!1,this._compiledShaderDisableDepthDistance=!1,this._shaderClampToGround=!1,this._compiledShaderClampToGround=!1,this._propertiesChanged=new Uint32Array(PU),this._maxSize=0,this._maxEyeOffset=0,this._maxScale=1,this._maxPixelOffset=0,this._allHorizontalCenter=!0,this._allVerticalCenter=!0,this._allSizedInMeters=!0,this._baseVolume=new Ae,this._baseVolumeWC=new Ae,this._baseVolume2D=new Ae,this._boundingVolume=new Ae,this._boundingVolumeDirty=!1,this._colorCommands=[],this.show=A(e.show,!0),this.modelMatrix=N.clone(A(e.modelMatrix,N.IDENTITY)),this._modelMatrix=N.clone(N.IDENTITY),this.debugShowBoundingVolume=A(e.debugShowBoundingVolume,!1),this.debugShowTextureAtlas=A(e.debugShowTextureAtlas,!1),this.blendOption=A(e.blendOption,Sr.OPAQUE_AND_TRANSLUCENT),this._blendOption=void 0,this._mode=me.SCENE3D,this._buffersUsage=[mt.STATIC_DRAW,mt.STATIC_DRAW,mt.STATIC_DRAW,mt.STATIC_DRAW,mt.STATIC_DRAW,mt.STATIC_DRAW,mt.STATIC_DRAW,mt.STATIC_DRAW,mt.STATIC_DRAW,mt.STATIC_DRAW,mt.STATIC_DRAW,mt.STATIC_DRAW,mt.STATIC_DRAW,mt.STATIC_DRAW,mt.STATIC_DRAW,mt.STATIC_DRAW],this._highlightColor=k.clone(k.WHITE);const t=this;this._uniforms={u_atlas:function(){return t._textureAtlas.texture},u_highlightColor:function(){return t._highlightColor}};const n=this._scene;l(n)&&l(n.terrainProviderChanged)&&(this._removeCallbackFunc=n.terrainProviderChanged.addEventListener(function(){const i=this._billboards,o=i.length;for(let r=0;r<o;++r)l(i[r])&&i[r]._updateClamping()},this))}Object.defineProperties(Ka.prototype,{length:{get:function(){return OU(this),this._billboards.length}},textureAtlas:{get:function(){return this._textureAtlas},set:function(e){this._textureAtlas!==e&&(this._textureAtlas=this._destroyTextureAtlas&&this._textureAtlas&&this._textureAtlas.destroy(),this._textureAtlas=e,this._createVertexArray=!0)}},destroyTextureAtlas:{get:function(){return this._destroyTextureAtlas},set:function(e){this._destroyTextureAtlas=e}}});function eoe(e){const t=e.length;for(let n=0;n<t;++n)e[n]&&e[n]._destroy()}Ka.prototype.add=function(e){const t=new en(e,this);return t._index=this._billboards.length,this._billboards.push(t),this._createVertexArray=!0,t};Ka.prototype.remove=function(e){return this.contains(e)?(this._billboards[e._index]=void 0,this._billboardsRemoved=!0,this._createVertexArray=!0,e._destroy(),!0):!1};Ka.prototype.removeAll=function(){eoe(this._billboards),this._billboards=[],this._billboardsToUpdate=[],this._billboardsToUpdateIndex=0,this._billboardsRemoved=!1,this._createVertexArray=!0};function OU(e){if(e._billboardsRemoved){e._billboardsRemoved=!1;const t=[],n=e._billboards,i=n.length;for(let o=0,r=0;o<i;++o){const s=n[o];l(s)&&(s._index=r++,t.push(s))}e._billboards=t}}Ka.prototype._updateBillboard=function(e,t){e._dirty||(this._billboardsToUpdate[this._billboardsToUpdateIndex++]=e),++this._propertiesChanged[t]};Ka.prototype.contains=function(e){return l(e)&&e._billboardCollection===this};Ka.prototype.get=function(e){return E.typeOf.number("index",e),OU(this),this._billboards[e]};let qR;function ust(e){let n=e.cache.billboardCollection_indexBufferBatched;if(l(n))return n;const i=16384*6-6,o=new Uint16Array(i);for(let r=0,s=0;r<i;r+=6,s+=4)o[r]=s,o[r+1]=s+1,o[r+2]=s+2,o[r+3]=s+0,o[r+4]=s+2,o[r+5]=s+3;return n=Mt.createIndexBuffer({context:e,typedArray:o,usage:mt.STATIC_DRAW,indexDatatype:At.UNSIGNED_SHORT}),n.vertexArrayDestroyable=!1,e.cache.billboardCollection_indexBufferBatched=n,n}function fst(e){let t=e.cache.billboardCollection_indexBufferInstanced;return l(t)||(t=Mt.createIndexBuffer({context:e,typedArray:new Uint16Array([0,1,2,0,2,3]),usage:mt.STATIC_DRAW,indexDatatype:At.UNSIGNED_SHORT}),t.vertexArrayDestroyable=!1,e.cache.billboardCollection_indexBufferInstanced=t),t}function dst(e){let t=e.cache.billboardCollection_vertexBufferInstanced;return l(t)||(t=Mt.createVertexBuffer({context:e,typedArray:new Float32Array([0,0,1,0,1,1,0,1]),usage:mt.STATIC_DRAW}),t.vertexArrayDestroyable=!1,e.cache.billboardCollection_vertexBufferInstanced=t),t}Ka.prototype.computeNewBuffersUsage=function(){const e=this._buffersUsage;let t=!1;const n=this._propertiesChanged;for(let i=0;i<PU;++i){const o=n[i]===0?mt.STATIC_DRAW:mt.STREAM_DRAW;t=t||e[i]!==o,e[i]=o}return t};function hst(e,t,n,i,o,r){const s=[{index:_o.positionHighAndScale,componentsPerAttribute:4,componentDatatype:oe.FLOAT,usage:n[tE]},{index:_o.positionLowAndRotation,componentsPerAttribute:4,componentDatatype:oe.FLOAT,usage:n[tE]},{index:_o.compressedAttribute0,componentsPerAttribute:4,componentDatatype:oe.FLOAT,usage:n[jie]},{index:_o.compressedAttribute1,componentsPerAttribute:4,componentDatatype:oe.FLOAT,usage:n[Kie]},{index:_o.compressedAttribute2,componentsPerAttribute:4,componentDatatype:oe.FLOAT,usage:n[$ie]},{index:_o.eyeOffset,componentsPerAttribute:4,componentDatatype:oe.FLOAT,usage:n[Yie]},{index:_o.scaleByDistance,componentsPerAttribute:4,componentDatatype:oe.FLOAT,usage:n[Xie]},{index:_o.pixelOffsetScaleByDistance,componentsPerAttribute:4,componentDatatype:oe.FLOAT,usage:n[Jie]},{index:_o.compressedAttribute3,componentsPerAttribute:4,componentDatatype:oe.FLOAT,usage:n[Qie]},{index:_o.textureCoordinateBoundsOrLabelTranslate,componentsPerAttribute:4,componentDatatype:oe.FLOAT,usage:n[ast]}];i&&s.push({index:_o.direction,componentsPerAttribute:2,componentDatatype:oe.FLOAT,vertexBuffer:dst(e)}),l(o)&&s.push({index:_o.a_batchId,componentsPerAttribute:1,componentDatatype:oe.FLOAT,bufferUsage:mt.STATIC_DRAW}),r&&s.push({index:_o.sdf,componentsPerAttribute:2,componentDatatype:oe.FLOAT,usage:n[Zie]});const a=i?t:4*t;return new ds(e,s,a,i)}const jR=new Zn;function toe(e,t,n,i,o){let r;const s=i[_o.positionHighAndScale],a=i[_o.positionLowAndRotation],c=o._getActualPosition();e._mode===me.SCENE3D&&(Ae.expand(e._baseVolume,c,e._baseVolume),e._boundingVolumeDirty=!0),Zn.fromCartesian(c,jR);const u=o.scale,f=o.rotation;f!==0&&(e._shaderRotation=!0),e._maxScale=Math.max(e._maxScale,u);const h=jR.high,_=jR.low;e._instanced?(r=o._index,s(r,h.x,h.y,h.z,u),a(r,_.x,_.y,_.z,f)):(r=o._index*4,s(r+0,h.x,h.y,h.z,u),s(r+1,h.x,h.y,h.z,u),s(r+2,h.x,h.y,h.z,u),s(r+3,h.x,h.y,h.z,u),a(r+0,_.x,_.y,_.z,f),a(r+1,_.x,_.y,_.z,f),a(r+2,_.x,_.y,_.z,f),a(r+3,_.x,_.y,_.z,f))}const Yl=new $,kl=32768,PA=65536,YR=4096,pd=256,pst=128,mst=32,_st=8,noe=4,gst=1/256,ioe=0,ooe=2,roe=3,soe=1;function aoe(e,t,n,i,o){let r;const s=i[_o.compressedAttribute0],a=o.pixelOffset,c=a.x,u=a.y,f=o._translate,h=f.x,_=f.y;e._maxPixelOffset=Math.max(e._maxPixelOffset,Math.abs(c+h),Math.abs(-u+_));const g=o.horizontalOrigin;let p=o._verticalOrigin,y=o.show&&o.clusterShow;o.color.alpha===0&&(y=!1),p===co.BASELINE&&(p=co.BOTTOM),e._allHorizontalCenter=e._allHorizontalCenter&&g===yc.CENTER,e._allVerticalCenter=e._allVerticalCenter&&p===co.CENTER;let T=0,b=0,x=0,v=0;const D=o._imageIndex;if(D!==-1){const W=n[D];if(!l(W))throw new w(`Invalid billboard image index: ${D}`);T=W.x,b=W.y,x=W.width,v=W.height}const L=T+x,B=b+v;let V=Math.floor(F.clamp(c,-kl,kl)+kl)*pst;V+=(g+1)*mst,V+=(p+1)*_st,V+=(y?1:0)*noe;let M=Math.floor(F.clamp(u,-kl,kl)+kl)*pd,H=Math.floor(F.clamp(h,-kl,kl)+kl)*pd;const G=(F.clamp(_,-kl,kl)+kl)*gst,I=Math.floor(G),O=Math.floor((G-I)*pd);M+=I,H+=O,Yl.x=T,Yl.y=b;const m=Ri.compressTextureCoordinates(Yl);Yl.x=L;const P=Ri.compressTextureCoordinates(Yl);Yl.y=B;const R=Ri.compressTextureCoordinates(Yl);Yl.x=T;const U=Ri.compressTextureCoordinates(Yl);e._instanced?(r=o._index,s(r,V,M,H,m)):(r=o._index*4,s(r+0,V+ioe,M,H,m),s(r+1,V+ooe,M,H,P),s(r+2,V+roe,M,H,R),s(r+3,V+soe,M,H,U))}function coe(e,t,n,i,o){let r;const s=i[_o.compressedAttribute1],a=o.alignedAxis;d.equals(a,d.ZERO)||(e._shaderAlignedAxis=!0);let c=0,u=1,f=1,h=1;const _=o.translucencyByDistance;l(_)&&(c=_.near,u=_.nearValue,f=_.far,h=_.farValue,(u!==1||h!==1)&&(e._shaderTranslucencyByDistance=!0));let g=0;const p=o._imageIndex;if(p!==-1){const v=n[p];if(!l(v))throw new w(`Invalid billboard image index: ${p}`);g=v.width}const y=e._textureAtlas.texture.width,T=Math.round(A(o.width,y*g));e._maxSize=Math.max(e._maxSize,T);let b=F.clamp(T,0,PA),x=0;Math.abs(d.magnitudeSquared(a)-1)<F.EPSILON6&&(x=Ri.octEncodeFloat(a)),u=F.clamp(u,0,1),u=u===1?255:u*255|0,b=b*pd+u,h=F.clamp(h,0,1),h=h===1?255:h*255|0,x=x*pd+h,e._instanced?(r=o._index,s(r,b,x,c,f)):(r=o._index*4,s(r+0,b,x,c,f),s(r+1,b,x,c,f),s(r+2,b,x,c,f),s(r+3,b,x,c,f))}function a2(e,t,n,i,o){let r;const s=i[_o.compressedAttribute2],a=o.color,c=l(e._batchTable)?k.WHITE:o.getPickId(t.context).color,u=o.sizeInMeters?1:0,f=Math.abs(d.magnitudeSquared(o.alignedAxis)-1)<F.EPSILON6?1:0;e._allSizedInMeters=e._allSizedInMeters&&u===1;let h=0;const _=o._imageIndex;if(_!==-1){const V=n[_];if(!l(V))throw new w(`Invalid billboard image index: ${_}`);h=V.height}const g=e._textureAtlas.texture.dimensions,p=Math.round(A(o.height,g.y*h));e._maxSize=Math.max(e._maxSize,p);let y=A(o._labelHorizontalOrigin,-2);y+=2;const T=p*noe+y;let b=k.floatToByte(a.red),x=k.floatToByte(a.green),v=k.floatToByte(a.blue);const D=b*PA+x*pd+v;b=k.floatToByte(c.red),x=k.floatToByte(c.green),v=k.floatToByte(c.blue);const L=b*PA+x*pd+v;let B=k.floatToByte(a.alpha)*PA+k.floatToByte(c.alpha)*pd;B+=u*2+f,e._instanced?(r=o._index,s(r,D,L,B,T)):(r=o._index*4,s(r+0,D,L,B,T),s(r+1,D,L,B,T),s(r+2,D,L,B,T),s(r+3,D,L,B,T))}function c2(e,t,n,i,o){let r;const s=i[_o.eyeOffset],a=o.eyeOffset;let c=a.z;if(o._heightReference!==Ht.NONE&&(c*=1.005),e._maxEyeOffset=Math.max(e._maxEyeOffset,Math.abs(a.x),Math.abs(a.y),Math.abs(c)),e._instanced){let u=0,f=0;const h=o._imageIndex;if(h!==-1){const g=n[h];if(!l(g))throw new w(`Invalid billboard image index: ${h}`);u=g.width,f=g.height}Yl.x=u,Yl.y=f;const _=Ri.compressTextureCoordinates(Yl);r=o._index,s(r,a.x,a.y,c,_)}else r=o._index*4,s(r+0,a.x,a.y,c,0),s(r+1,a.x,a.y,c,0),s(r+2,a.x,a.y,c,0),s(r+3,a.x,a.y,c,0)}function loe(e,t,n,i,o){let r;const s=i[_o.scaleByDistance];let a=0,c=1,u=1,f=1;const h=o.scaleByDistance;l(h)&&(a=h.near,c=h.nearValue,u=h.far,f=h.farValue,(c!==1||f!==1)&&(e._shaderScaleByDistance=!0)),e._instanced?(r=o._index,s(r,a,c,u,f)):(r=o._index*4,s(r+0,a,c,u,f),s(r+1,a,c,u,f),s(r+2,a,c,u,f),s(r+3,a,c,u,f))}function uoe(e,t,n,i,o){let r;const s=i[_o.pixelOffsetScaleByDistance];let a=0,c=1,u=1,f=1;const h=o.pixelOffsetScaleByDistance;l(h)&&(a=h.near,c=h.nearValue,u=h.far,f=h.farValue,(c!==1||f!==1)&&(e._shaderPixelOffsetScaleByDistance=!0)),e._instanced?(r=o._index,s(r,a,c,u,f)):(r=o._index*4,s(r+0,a,c,u,f),s(r+1,a,c,u,f),s(r+2,a,c,u,f),s(r+3,a,c,u,f))}function foe(e,t,n,i,o){let r;const s=i[_o.compressedAttribute3];let a=0,c=Number.MAX_VALUE;const u=o.distanceDisplayCondition;l(u)&&(a=u.near,c=u.far,a*=a,c*=c,e._shaderDistanceDisplayCondition=!0);let f=o.disableDepthTestDistance;const h=o.heightReference===Ht.CLAMP_TO_GROUND&&t.context.depthTexture;l(f)||(f=h?5e3:0),f*=f,(h||f>0)&&(e._shaderDisableDepthDistance=!0,f===Number.POSITIVE_INFINITY&&(f=-1));let _,g;if(l(o._labelDimensions))g=o._labelDimensions.x,_=o._labelDimensions.y;else{let b=0,x=0;const v=o._imageIndex;if(v!==-1){const L=n[v];if(!l(L))throw new w(`Invalid billboard image index: ${v}`);b=L.height,x=L.width}_=Math.round(A(o.height,e._textureAtlas.texture.dimensions.y*b));const D=e._textureAtlas.texture.width;g=Math.round(A(o.width,D*x))}const p=Math.floor(F.clamp(g,0,YR)),y=Math.floor(F.clamp(_,0,YR)),T=p*YR+y;e._instanced?(r=o._index,s(r,a,c,f,T)):(r=o._index*4,s(r+0,a,c,f,T),s(r+1,a,c,f,T),s(r+2,a,c,f,T),s(r+3,a,c,f,T))}function doe(e,t,n,i,o){if(o.heightReference===Ht.CLAMP_TO_GROUND){const p=e._scene,y=t.context,T=t.globeTranslucencyState.translucent,b=l(p.globe)&&p.globe.depthTestAgainstTerrain;e._shaderClampToGround=y.depthTexture&&!T&&b}let r;const s=i[_o.textureCoordinateBoundsOrLabelTranslate];if(Gt.maximumVertexTextureImageUnits>0){let p=0,y=0;l(o._labelTranslate)&&(p=o._labelTranslate.x,y=o._labelTranslate.y),e._instanced?(r=o._index,s(r,p,y,0,0)):(r=o._index*4,s(r+0,p,y,0,0),s(r+1,p,y,0,0),s(r+2,p,y,0,0),s(r+3,p,y,0,0));return}let a=0,c=0,u=0,f=0;const h=o._imageIndex;if(h!==-1){const p=n[h];if(!l(p))throw new w(`Invalid billboard image index: ${h}`);a=p.x,c=p.y,u=p.width,f=p.height}const _=a+u,g=c+f;e._instanced?(r=o._index,s(r,a,c,_,g)):(r=o._index*4,s(r+0,a,c,_,g),s(r+1,a,c,_,g),s(r+2,a,c,_,g),s(r+3,a,c,_,g))}function yst(e,t,n,i,o){if(!l(e._batchTable))return;const r=i[_o.a_batchId],s=o._batchIndex;let a;e._instanced?(a=o._index,r(a,s)):(a=o._index*4,r(a+0,s),r(a+1,s),r(a+2,s),r(a+3,s))}function hoe(e,t,n,i,o){if(!e._sdf)return;let r;const s=i[_o.sdf],a=o.outlineColor,c=o.outlineWidth,u=k.floatToByte(a.red),f=k.floatToByte(a.green),h=k.floatToByte(a.blue),_=u*PA+f*pd+h,g=c/il.RADIUS,p=k.floatToByte(a.alpha)*PA+k.floatToByte(g)*pd;e._instanced?(r=o._index,s(r,_,p)):(r=o._index*4,s(r+0,_+ioe,p),s(r+1,_+ooe,p),s(r+2,_+roe,p),s(r+3,_+soe,p))}function Ast(e,t,n,i,o){toe(e,t,n,i,o),aoe(e,t,n,i,o),coe(e,t,n,i,o),a2(e,t,n,i,o),c2(e,t,n,i,o),loe(e,t,n,i,o),uoe(e,t,n,i,o),foe(e,t,n,i,o),doe(e,t,n,i,o),yst(e,t,n,i,o),hoe(e,t,n,i,o)}function $R(e,t,n,i,o,r){let s;i.mode===me.SCENE3D?(s=e._baseVolume,e._boundingVolumeDirty=!0):s=e._baseVolume2D;const a=[];for(let c=0;c<n;++c){const u=t[c],f=u.position,h=en._computeActualPosition(u,f,i,o);l(h)&&(u._setActualPosition(h),r?a.push(h):Ae.expand(s,h,s))}r&&Ae.fromPoints(a,s)}function Tst(e,t){const n=t.mode,i=e._billboards,o=e._billboardsToUpdate,r=e._modelMatrix;e._createVertexArray||e._mode!==n||n!==me.SCENE3D&&!N.equals(r,e.modelMatrix)?(e._mode=n,N.clone(e.modelMatrix,r),e._createVertexArray=!0,(n===me.SCENE3D||n===me.SCENE2D||n===me.COLUMBUS_VIEW)&&$R(e,i,i.length,t,r,!0)):n===me.MORPHING?$R(e,i,i.length,t,r,!0):(n===me.SCENE2D||n===me.COLUMBUS_VIEW)&&$R(e,o,e._billboardsToUpdateIndex,t,r,!1)}function Cst(e,t,n){let i=1;(!e._allSizedInMeters||e._maxPixelOffset!==0)&&(i=t.camera.getPixelSize(n,t.context.drawingBufferWidth,t.context.drawingBufferHeight));let o=i*e._maxScale*e._maxSize*2;e._allHorizontalCenter&&e._allVerticalCenter&&(o*=.5);const r=i*e._maxPixelOffset+e._maxEyeOffset;n.radius+=o+r}function bst(e,t){const n=`uniform sampler2D billboard_texture;
|
||
varying vec2 v_textureCoordinates;
|
||
void main()
|
||
{
|
||
gl_FragColor = texture2D(billboard_texture, v_textureCoordinates);
|
||
}
|
||
`,i=t.createViewportQuadCommand(n,{uniformMap:{billboard_texture:function(){return e._textureAtlas.texture}}});return i.pass=We.OVERLAY,i}const Est=[];Ka.prototype.update=function(e){if(OU(this),!this.show)return;let t=this._billboards,n=t.length;const i=e.context;this._instanced=i.instancedArrays,_o=this._instanced?lst:cst,qR=this._instanced?fst:ust;let o=this._textureAtlas;if(!l(o)){o=this._textureAtlas=new bd({context:i});for(let M=0;M<n;++M)t[M]._loadImage()}const r=o.textureCoordinates;if(r.length===0)return;Tst(this,e),t=this._billboards,n=t.length;const s=this._billboardsToUpdate,a=this._billboardsToUpdateIndex,c=this._propertiesChanged,u=o.guid,f=this._createVertexArray||this._textureAtlasGUID!==u;this._textureAtlasGUID=u;let h;const _=e.passes,g=_.pick;if(f||!g&&this.computeNewBuffersUsage()){this._createVertexArray=!1;for(let M=0;M<PU;++M)c[M]=0;if(this._vaf=this._vaf&&this._vaf.destroy(),n>0){this._vaf=hst(i,n,this._buffersUsage,this._instanced,this._batchTable,this._sdf),h=this._vaf.writers;for(let M=0;M<n;++M){const H=this._billboards[M];H._dirty=!1,Ast(this,e,r,h,H)}this._vaf.commit(qR(i))}this._billboardsToUpdateIndex=0}else if(a>0){const M=Est;M.length=0,(c[tE]||c[ost]||c[ist])&&M.push(toe),(c[GC]||c[jie]||c[tst]||c[nst]||c[est])&&(M.push(aoe),this._instanced&&M.push(c2)),(c[GC]||c[rst]||c[Kie])&&(M.push(coe),M.push(a2)),(c[GC]||c[$ie])&&M.push(a2),c[Yie]&&M.push(c2),c[Xie]&&M.push(loe),c[Jie]&&M.push(uoe),(c[Qie]||c[sst]||c[GC]||c[tE])&&M.push(foe),(c[GC]||c[tE])&&M.push(doe),c[Zie]&&M.push(hoe);const H=M.length;if(h=this._vaf.writers,a/n>.1){for(let G=0;G<a;++G){const I=s[G];I._dirty=!1;for(let O=0;O<H;++O)M[O](this,e,r,h,I)}this._vaf.commit(qR(i))}else{for(let G=0;G<a;++G){const I=s[G];I._dirty=!1;for(let O=0;O<H;++O)M[O](this,e,r,h,I);this._instanced?this._vaf.subCommit(I._index,1):this._vaf.subCommit(I._index*4,4)}this._vaf.endSubCommits()}this._billboardsToUpdateIndex=0}if(a>n*1.5&&(s.length=n),!l(this._vaf)||!l(this._vaf.va))return;this._boundingVolumeDirty&&(this._boundingVolumeDirty=!1,Ae.transform(this._baseVolume,this.modelMatrix,this._baseVolumeWC));let p,y=N.IDENTITY;e.mode===me.SCENE3D?(y=this.modelMatrix,p=Ae.clone(this._baseVolumeWC,this._boundingVolume)):p=Ae.clone(this._baseVolume2D,this._boundingVolume),Cst(this,e,p);const T=this._blendOption!==this.blendOption;if(this._blendOption=this.blendOption,T){this._blendOption===Sr.OPAQUE||this._blendOption===Sr.OPAQUE_AND_TRANSLUCENT?this._rsOpaque=ht.fromCache({depthTest:{enabled:!0,func:fe.LESS},depthMask:!0}):this._rsOpaque=void 0;const M=this._blendOption===Sr.TRANSLUCENT;this._blendOption===Sr.TRANSLUCENT||this._blendOption===Sr.OPAQUE_AND_TRANSLUCENT?this._rsTranslucent=ht.fromCache({depthTest:{enabled:!0,func:M?fe.LEQUAL:fe.LESS},depthMask:M,blending:fo.ALPHA_BLEND}):this._rsTranslucent=void 0}this._shaderDisableDepthDistance=this._shaderDisableDepthDistance||e.minimumDisableDepthTestDistance!==0;let b,x,v,D,L;const B=Gt.maximumVertexTextureImageUnits>0;if(T||this._shaderRotation!==this._compiledShaderRotation||this._shaderAlignedAxis!==this._compiledShaderAlignedAxis||this._shaderScaleByDistance!==this._compiledShaderScaleByDistance||this._shaderTranslucencyByDistance!==this._compiledShaderTranslucencyByDistance||this._shaderPixelOffsetScaleByDistance!==this._compiledShaderPixelOffsetScaleByDistance||this._shaderDistanceDisplayCondition!==this._compiledShaderDistanceDisplayCondition||this._shaderDisableDepthDistance!==this._compiledShaderDisableDepthDistance||this._shaderClampToGround!==this._compiledShaderClampToGround||this._sdf!==this._compiledSDF){b=wOe,x=xOe,L=[],l(this._batchTable)&&(L.push("VECTOR_TILE"),b=this._batchTable.getVertexShaderCallback(!1,"a_batchId",void 0)(b),x=this._batchTable.getFragmentShaderCallback(!1,void 0)(x)),v=new nt({defines:L,sources:[b]}),this._instanced&&v.defines.push("INSTANCED"),this._shaderRotation&&v.defines.push("ROTATION"),this._shaderAlignedAxis&&v.defines.push("ALIGNED_AXIS"),this._shaderScaleByDistance&&v.defines.push("EYE_DISTANCE_SCALING"),this._shaderTranslucencyByDistance&&v.defines.push("EYE_DISTANCE_TRANSLUCENCY"),this._shaderPixelOffsetScaleByDistance&&v.defines.push("EYE_DISTANCE_PIXEL_OFFSET"),this._shaderDistanceDisplayCondition&&v.defines.push("DISTANCE_DISPLAY_CONDITION"),this._shaderDisableDepthDistance&&v.defines.push("DISABLE_DEPTH_DISTANCE"),this._shaderClampToGround&&(B?v.defines.push("VERTEX_DEPTH_CHECK"):v.defines.push("FRAGMENT_DEPTH_CHECK"));const M=1-il.CUTOFF;this._sdf&&v.defines.push("SDF");const H=l(this._batchTable)?"VECTOR_TILE":"";this._blendOption===Sr.OPAQUE_AND_TRANSLUCENT&&(D=new nt({defines:["OPAQUE",H],sources:[x]}),this._shaderClampToGround&&(B?D.defines.push("VERTEX_DEPTH_CHECK"):D.defines.push("FRAGMENT_DEPTH_CHECK")),this._sdf&&(D.defines.push("SDF"),D.defines.push(`SDF_EDGE ${M}`)),this._sp=Hn.replaceCache({context:i,shaderProgram:this._sp,vertexShaderSource:v,fragmentShaderSource:D,attributeLocations:_o}),D=new nt({defines:["TRANSLUCENT",H],sources:[x]}),this._shaderClampToGround&&(B?D.defines.push("VERTEX_DEPTH_CHECK"):D.defines.push("FRAGMENT_DEPTH_CHECK")),this._sdf&&(D.defines.push("SDF"),D.defines.push(`SDF_EDGE ${M}`)),this._spTranslucent=Hn.replaceCache({context:i,shaderProgram:this._spTranslucent,vertexShaderSource:v,fragmentShaderSource:D,attributeLocations:_o})),this._blendOption===Sr.OPAQUE&&(D=new nt({defines:[H],sources:[x]}),this._shaderClampToGround&&(B?D.defines.push("VERTEX_DEPTH_CHECK"):D.defines.push("FRAGMENT_DEPTH_CHECK")),this._sdf&&(D.defines.push("SDF"),D.defines.push(`SDF_EDGE ${M}`)),this._sp=Hn.replaceCache({context:i,shaderProgram:this._sp,vertexShaderSource:v,fragmentShaderSource:D,attributeLocations:_o})),this._blendOption===Sr.TRANSLUCENT&&(D=new nt({defines:[H],sources:[x]}),this._shaderClampToGround&&(B?D.defines.push("VERTEX_DEPTH_CHECK"):D.defines.push("FRAGMENT_DEPTH_CHECK")),this._sdf&&(D.defines.push("SDF"),D.defines.push(`SDF_EDGE ${M}`)),this._spTranslucent=Hn.replaceCache({context:i,shaderProgram:this._spTranslucent,vertexShaderSource:v,fragmentShaderSource:D,attributeLocations:_o})),this._compiledShaderRotation=this._shaderRotation,this._compiledShaderAlignedAxis=this._shaderAlignedAxis,this._compiledShaderScaleByDistance=this._shaderScaleByDistance,this._compiledShaderTranslucencyByDistance=this._shaderTranslucencyByDistance,this._compiledShaderPixelOffsetScaleByDistance=this._shaderPixelOffsetScaleByDistance,this._compiledShaderDistanceDisplayCondition=this._shaderDistanceDisplayCondition,this._compiledShaderDisableDepthDistance=this._shaderDisableDepthDistance,this._compiledShaderClampToGround=this._shaderClampToGround,this._compiledSDF=this._sdf}const V=e.commandList;if(_.render||_.pick){const M=this._colorCommands,H=this._blendOption===Sr.OPAQUE,G=this._blendOption===Sr.OPAQUE_AND_TRANSLUCENT,I=this._vaf.va,O=I.length;let m=this._uniforms,P;l(this._batchTable)?(m=this._batchTable.getUniformMapCallback()(m),P=this._batchTable.getPickId()):P="v_pickColor",M.length=O;const R=G?O*2:O;for(let U=0;U<R;++U){let W=M[U];l(W)||(W=M[U]=new Dt);const q=H||G&&U%2===0;W.pass=q||!G?We.OPAQUE:We.TRANSLUCENT,W.owner=this;const Y=G?Math.floor(U/2):U;W.boundingVolume=p,W.modelMatrix=y,W.count=I[Y].indicesCount,W.shaderProgram=q?this._sp:this._spTranslucent,W.uniformMap=m,W.vertexArray=I[Y].va,W.renderState=q?this._rsOpaque:this._rsTranslucent,W.debugShowBoundingVolume=this.debugShowBoundingVolume,W.pickId=P,this._instanced&&(W.count=6,W.instanceCount=n),V.push(W)}this.debugShowTextureAtlas&&(l(this.debugCommand)||(this.debugCommand=bst(this,e.context)),V.push(this.debugCommand))}};Ka.prototype.isDestroyed=function(){return!1};Ka.prototype.destroy=function(){return l(this._removeCallbackFunc)&&(this._removeCallbackFunc(),this._removeCallbackFunc=void 0),this._textureAtlas=this._destroyTextureAtlas&&this._textureAtlas&&this._textureAtlas.destroy(),this._sp=this._sp&&this._sp.destroy(),this._spTranslucent=this._spTranslucent&&this._spTranslucent.destroy(),this._vaf=this._vaf&&this._vaf.destroy(),eoe(this._billboards),Je(this)};function poe(e,t,n,i,o){return function(){const r=document.createElement("canvas"),s=o+2*i;r.height=r.width=s;const a=r.getContext("2d");return a.clearRect(0,0,s,s),i!==0&&(a.beginPath(),a.arc(s/2,s/2,s/2,0,2*Math.PI,!0),a.closePath(),a.fillStyle=n,a.fill(),e<1&&(a.save(),a.globalCompositeOperation="destination-out",a.beginPath(),a.arc(s/2,s/2,o/2,0,2*Math.PI,!0),a.closePath(),a.fillStyle="black",a.fill(),a.restore())),a.beginPath(),a.arc(s/2,s/2,o/2,0,2*Math.PI,!0),a.closePath(),a.fillStyle=t,a.fill(),r}}function kr(e,t,n,i,o){this._content=e,this._billboard=n,this._label=i,this._polyline=o,this._batchId=t,this._billboardImage=void 0,this._billboardColor=void 0,this._billboardOutlineColor=void 0,this._billboardOutlineWidth=void 0,this._billboardSize=void 0,this._pointSize=void 0,this._color=void 0,this._pointSize=void 0,this._pointOutlineColor=void 0,this._pointOutlineWidth=void 0,this._heightOffset=void 0,this._pickIds=new Array(3),iA(this)}const xst=new ve;Object.defineProperties(kr.prototype,{show:{get:function(){return this._label.show},set:function(e){this._label.show=e,this._billboard.show=e,this._polyline.show=e}},color:{get:function(){return this._color},set:function(e){this._color=k.clone(e,this._color),iA(this)}},pointSize:{get:function(){return this._pointSize},set:function(e){this._pointSize=e,iA(this)}},pointOutlineColor:{get:function(){return this._pointOutlineColor},set:function(e){this._pointOutlineColor=k.clone(e,this._pointOutlineColor),iA(this)}},pointOutlineWidth:{get:function(){return this._pointOutlineWidth},set:function(e){this._pointOutlineWidth=e,iA(this)}},labelColor:{get:function(){return this._label.fillColor},set:function(e){this._label.fillColor=e,this._polyline.show=this._label.show&&e.alpha>0}},labelOutlineColor:{get:function(){return this._label.outlineColor},set:function(e){this._label.outlineColor=e}},labelOutlineWidth:{get:function(){return this._label.outlineWidth},set:function(e){this._label.outlineWidth=e}},font:{get:function(){return this._label.font},set:function(e){this._label.font=e}},labelStyle:{get:function(){return this._label.style},set:function(e){this._label.style=e}},labelText:{get:function(){return this._label.text},set:function(e){l(e)||(e=""),this._label.text=e}},backgroundColor:{get:function(){return this._label.backgroundColor},set:function(e){this._label.backgroundColor=e}},backgroundPadding:{get:function(){return this._label.backgroundPadding},set:function(e){this._label.backgroundPadding=e}},backgroundEnabled:{get:function(){return this._label.showBackground},set:function(e){this._label.showBackground=e}},scaleByDistance:{get:function(){return this._label.scaleByDistance},set:function(e){this._label.scaleByDistance=e,this._billboard.scaleByDistance=e}},translucencyByDistance:{get:function(){return this._label.translucencyByDistance},set:function(e){this._label.translucencyByDistance=e,this._billboard.translucencyByDistance=e}},distanceDisplayCondition:{get:function(){return this._label.distanceDisplayCondition},set:function(e){this._label.distanceDisplayCondition=e,this._polyline.distanceDisplayCondition=e,this._billboard.distanceDisplayCondition=e}},heightOffset:{get:function(){return this._heightOffset},set:function(e){const t=A(this._heightOffset,0),n=this._content.tileset.ellipsoid,i=n.cartesianToCartographic(this._billboard.position,xst);i.height=i.height-t+e;const o=n.cartographicToCartesian(i);this._billboard.position=o,this._label.position=this._billboard.position,this._polyline.positions=[this._polyline.positions[0],o],this._heightOffset=e}},anchorLineEnabled:{get:function(){return this._polyline.show},set:function(e){this._polyline.show=e}},anchorLineColor:{get:function(){return this._polyline.material.uniforms.color},set:function(e){this._polyline.material.uniforms.color=k.clone(e,this._polyline.material.uniforms.color)}},image:{get:function(){return this._billboardImage},set:function(e){const t=this._billboardImage!==e;this._billboardImage=e,t&&iA(this)}},disableDepthTestDistance:{get:function(){return this._label.disableDepthTestDistance},set:function(e){this._label.disableDepthTestDistance=e,this._billboard.disableDepthTestDistance=e}},horizontalOrigin:{get:function(){return this._billboard.horizontalOrigin},set:function(e){this._billboard.horizontalOrigin=e}},verticalOrigin:{get:function(){return this._billboard.verticalOrigin},set:function(e){this._billboard.verticalOrigin=e}},labelHorizontalOrigin:{get:function(){return this._label.horizontalOrigin},set:function(e){this._label.horizontalOrigin=e}},labelVerticalOrigin:{get:function(){return this._label.verticalOrigin},set:function(e){this._label.verticalOrigin=e}},content:{get:function(){return this._content}},tileset:{get:function(){return this._content.tileset}},primitive:{get:function(){return this._content.tileset}},pickIds:{get:function(){const e=this._pickIds;return e[0]=this._billboard.pickId,e[1]=this._label.pickId,e[2]=this._polyline.pickId,e}}});kr.defaultColor=k.WHITE;kr.defaultPointOutlineColor=k.BLACK;kr.defaultPointOutlineWidth=0;kr.defaultPointSize=8;function iA(e){const t=e._billboard;if(l(e._billboardImage)&&e._billboardImage!==t.image){t.image=e._billboardImage;return}if(l(e._billboardImage))return;const n=A(e._color,kr.defaultColor),i=A(e._pointOutlineColor,kr.defaultPointOutlineColor),o=A(e._pointOutlineWidth,kr.defaultPointOutlineWidth),r=A(e._pointSize,kr.defaultPointSize),s=e._billboardColor,a=e._billboardOutlineColor,c=e._billboardOutlineWidth,u=e._billboardSize;if(k.equals(n,s)&&k.equals(i,a)&&o===c&&r===u)return;e._billboardColor=k.clone(n,e._billboardColor),e._billboardOutlineColor=k.clone(i,e._billboardOutlineColor),e._billboardOutlineWidth=o,e._billboardSize=r;const f=n.alpha,h=n.toCssColorString(),_=i.toCssColorString(),g=JSON.stringify([h,r,_,o]);t.setImage(g,poe(f,h,_,o,r))}kr.prototype.hasProperty=function(e){return this._content.batchTable.hasProperty(this._batchId,e)};kr.prototype.getPropertyIds=function(e){return this._content.batchTable.getPropertyIds(this._batchId,e)};kr.prototype.getProperty=function(e){return this._content.batchTable.getProperty(this._batchId,e)};kr.prototype.getPropertyInherited=function(e){return Js.getPropertyInherited(this._content,this._batchId,e)};kr.prototype.setProperty=function(e,t){this._content.batchTable.setProperty(this._batchId,e,t),this._content.featurePropertiesDirty=!0};kr.prototype.isExactClass=function(e){return this._content.batchTable.isExactClass(this._batchId,e)};kr.prototype.isClass=function(e){return this._content.batchTable.isClass(this._batchId,e)};kr.prototype.getExactClassName=function(){return this._content.batchTable.getExactClassName(this._batchId)};function wst(e,t,n,i,o){const r=e.measureText(t);if(!!/\S/.test(t)){const a=document.defaultView.getComputedStyle(e.canvas).getPropertyValue("font-size").replace("px",""),c=document.createElement("canvas"),u=100,f=r.width+u|0,h=3*a,_=h/2;c.width=f,c.height=h;const g=c.getContext("2d");g.font=n,g.fillStyle="white",g.fillRect(0,0,c.width+1,c.height+1),i&&(g.strokeStyle="black",g.lineWidth=e.lineWidth,g.strokeText(t,u/2,_)),o&&(g.fillStyle="black",g.fillText(t,u/2,_));const p=g.getImageData(0,0,f,h).data,y=p.length,T=f*4;let b,x,v,D;for(b=0;b<y;++b)if(p[b]!==255){v=b/T|0;break}for(b=y-1;b>=0;--b)if(p[b]!==255){D=b/T|0;break}let L=-1;for(b=0;b<f&&L===-1;++b)for(x=0;x<h;++x){const B=b*4+x*T;if(p[B]!==255||p[B+1]!==255||p[B+2]!==255||p[B+3]!==255){L=b;break}}return{width:r.width,height:D-v,ascent:_-v,descent:D-_,minx:L-u/2}}return{width:r.width,height:0,ascent:0,descent:0,minx:0}}let sg;function Sst(e,t){if(!l(e))throw new w("text is required.");if(e==="")return;t=A(t,A.EMPTY_OBJECT);const n=A(t.font,"10px sans-serif"),i=A(t.stroke,!1),o=A(t.fill,!0),r=A(t.strokeWidth,1),s=A(t.backgroundColor,k.TRANSPARENT),a=A(t.padding,0),c=a*2,u=document.createElement("canvas");u.width=1,u.height=1,u.style.font=n;const f=u.getContext("2d");l(sg)||(l(f.imageSmoothingEnabled)?sg="imageSmoothingEnabled":l(f.mozImageSmoothingEnabled)?sg="mozImageSmoothingEnabled":l(f.webkitImageSmoothingEnabled)?sg="webkitImageSmoothingEnabled":l(f.msImageSmoothingEnabled)&&(sg="msImageSmoothingEnabled")),f.font=n,f.lineJoin="round",f.lineWidth=r,f[sg]=!1,u.style.visibility="hidden",document.body.appendChild(u);const h=wst(f,e,n,i,o);u.dimensions=h,document.body.removeChild(u),u.style.visibility="";const _=-h.minx,g=Math.ceil(h.width)+_+c,p=h.height+c,y=p-h.ascent+a,T=p-y+c;if(u.width=g,u.height=p,f.font=n,f.lineJoin="round",f.lineWidth=r,f[sg]=!1,s!==k.TRANSPARENT&&(f.fillStyle=s.toCssColorString(),f.fillRect(0,0,u.width,u.height)),i){const b=A(t.strokeColor,k.BLACK);f.strokeStyle=b.toCssColorString(),f.strokeText(e,_+a,T)}if(o){const b=A(t.fillColor,k.WHITE);f.fillStyle=b.toCssColorString(),f.fillText(e,_+a,T)}return u}var vst=Dst,nE=1e20;function Dst(e,t){t||(t={});var n=t.cutoff==null?.25:t.cutoff,i=t.radius==null?8:t.radius,o=t.channel||0,r,s,a,c,u,f,h,_,g,p,y;if(ArrayBuffer.isView(e)||Array.isArray(e)){if(!t.width||!t.height)throw Error("For raw data width and height should be provided by options");r=t.width,s=t.height,c=e,t.stride?f=t.stride:f=Math.floor(e.length/r/s)}else window.HTMLCanvasElement&&e instanceof window.HTMLCanvasElement?(_=e,h=_.getContext("2d"),r=_.width,s=_.height,g=h.getImageData(0,0,r,s),c=g.data,f=4):window.CanvasRenderingContext2D&&e instanceof window.CanvasRenderingContext2D?(_=e.canvas,h=e,r=_.width,s=_.height,g=h.getImageData(0,0,r,s),c=g.data,f=4):window.ImageData&&e instanceof window.ImageData&&(g=e,r=e.width,s=e.height,c=g.data,f=4);if(a=Math.max(r,s),window.Uint8ClampedArray&&c instanceof window.Uint8ClampedArray||window.Uint8Array&&c instanceof window.Uint8Array)for(u=c,c=Array(r*s),p=0,y=Math.floor(u.length/f);p<y;p++)c[p]=u[p*f+o]/255;else if(f!==1)throw Error("Raw data can have only 1 value per pixel");var T=Array(r*s),b=Array(r*s),x=Array(a),v=Array(a),D=Array(a+1),L=Array(a);for(p=0,y=r*s;p<y;p++){var B=c[p];T[p]=B===1?0:B===0?nE:Math.pow(Math.max(0,.5-B),2),b[p]=B===1?nE:B===0?0:Math.pow(Math.max(0,B-.5),2)}Sq(T,r,s,x,v,L,D),Sq(b,r,s,x,v,L,D);var V=window.Float32Array?new Float32Array(r*s):new Array(r*s);for(p=0,y=r*s;p<y;p++)V[p]=Math.min(Math.max(1-((T[p]-b[p])/i+n),0),1);return V}function Sq(e,t,n,i,o,r,s){for(var a=0;a<t;a++){for(var c=0;c<n;c++)i[c]=e[c*t+a];for(vq(i,o,r,s,n),c=0;c<n;c++)e[c*t+a]=o[c]}for(c=0;c<n;c++){for(a=0;a<t;a++)i[a]=e[c*t+a];for(vq(i,o,r,s,t),a=0;a<t;a++)e[c*t+a]=Math.sqrt(o[a])}}function vq(e,t,n,i,o){n[0]=0,i[0]=-nE,i[1]=+nE;for(var r=1,s=0;r<o;r++){for(var a=(e[r]+r*r-(e[n[s]]+n[s]*n[s]))/(2*r-2*n[s]);a<=i[s];)s--,a=(e[r]+r*r-(e[n[s]]+n[s]*n[s]))/(2*r-2*n[s]);s++,n[s]=r,i[s]=a,i[s+1]=+nE}for(r=0,s=0;r<o;r++){for(;i[s+1]<r;)s++;t[r]=(r-n[s])*(r-n[s])+e[n[s]]}}const Ist={FILL:0,OUTLINE:1,FILL_AND_OUTLINE:2},nf=Object.freeze(Ist),Dq={};let Iq=0;const Pst=256,Ost=new k(.165,.165,.165,.8),Lst=new $(7,5),Kr=Object.freeze({LTR:0,RTL:1,WEAK:2,BRACKETS:3});function ag(e){!e._rebindAllGlyphs&&!e._repositionAllGlyphs&&e._labelCollection._labelsToUpdate.push(e),e._rebindAllGlyphs=!0}function WC(e){!e._rebindAllGlyphs&&!e._repositionAllGlyphs&&e._labelCollection._labelsToUpdate.push(e),e._repositionAllGlyphs=!0}function qC(e,t){return document.defaultView.getComputedStyle(e,null).getPropertyValue(t)}function moe(e){let t=Dq[e._font];if(!l(t)){const n=document.createElement("div");n.style.position="absolute",n.style.opacity=0,n.style.font=e._font,document.body.appendChild(n);let i=parseFloat(qC(n,"line-height"));isNaN(i)&&(i=void 0),t={family:qC(n,"font-family"),size:qC(n,"font-size").replace("px",""),style:qC(n,"font-style"),weight:qC(n,"font-weight"),lineHeight:i},document.body.removeChild(n),Iq<Pst&&(Dq[e._font]=t,Iq++)}e._fontFamily=t.family,e._fontSize=t.size,e._fontStyle=t.style,e._fontWeight=t.weight,e._lineHeight=t.lineHeight}function Af(e,t){if(e=A(e,A.EMPTY_OBJECT),l(e.disableDepthTestDistance)&&e.disableDepthTestDistance<0)throw new w("disableDepthTestDistance must be greater than 0.0.");let n=e.translucencyByDistance,i=e.pixelOffsetScaleByDistance,o=e.scaleByDistance,r=e.distanceDisplayCondition;if(l(n)){if(n.far<=n.near)throw new w("translucencyByDistance.far must be greater than translucencyByDistance.near.");n=tn.clone(n)}if(l(i)){if(i.far<=i.near)throw new w("pixelOffsetScaleByDistance.far must be greater than pixelOffsetScaleByDistance.near.");i=tn.clone(i)}if(l(o)){if(o.far<=o.near)throw new w("scaleByDistance.far must be greater than scaleByDistance.near.");o=tn.clone(o)}if(l(r)){if(r.far<=r.near)throw new w("distanceDisplayCondition.far must be greater than distanceDisplayCondition.near.");r=sn.clone(r)}this._renderedText=void 0,this._text=void 0,this._show=A(e.show,!0),this._font=A(e.font,"30px sans-serif"),this._fillColor=k.clone(A(e.fillColor,k.WHITE)),this._outlineColor=k.clone(A(e.outlineColor,k.BLACK)),this._outlineWidth=A(e.outlineWidth,1),this._showBackground=A(e.showBackground,!1),this._backgroundColor=k.clone(A(e.backgroundColor,Ost)),this._backgroundPadding=$.clone(A(e.backgroundPadding,Lst)),this._style=A(e.style,nf.FILL),this._verticalOrigin=A(e.verticalOrigin,co.BASELINE),this._horizontalOrigin=A(e.horizontalOrigin,yc.LEFT),this._pixelOffset=$.clone(A(e.pixelOffset,$.ZERO)),this._eyeOffset=d.clone(A(e.eyeOffset,d.ZERO)),this._position=d.clone(A(e.position,d.ZERO)),this._scale=A(e.scale,1),this._id=e.id,this._translucencyByDistance=n,this._pixelOffsetScaleByDistance=i,this._scaleByDistance=o,this._heightReference=A(e.heightReference,Ht.NONE),this._distanceDisplayCondition=r,this._disableDepthTestDistance=e.disableDepthTestDistance,this._labelCollection=t,this._glyphs=[],this._backgroundBillboard=void 0,this._batchIndex=void 0,this._rebindAllGlyphs=!0,this._repositionAllGlyphs=!0,this._actualClampedPosition=void 0,this._removeCallbackFunc=void 0,this._mode=void 0,this._clusterShow=!0,this.text=A(e.text,""),this._relativeSize=1,moe(this),this._updateClamping()}Object.defineProperties(Af.prototype,{show:{get:function(){return this._show},set:function(e){if(!l(e))throw new w("value is required.");if(this._show!==e){this._show=e;const t=this._glyphs;for(let i=0,o=t.length;i<o;i++){const r=t[i].billboard;l(r)&&(r.show=e)}const n=this._backgroundBillboard;l(n)&&(n.show=e)}}},position:{get:function(){return this._position},set:function(e){if(!l(e))throw new w("value is required.");const t=this._position;if(!d.equals(t,e)){d.clone(e,t);const n=this._glyphs;for(let o=0,r=n.length;o<r;o++){const s=n[o].billboard;l(s)&&(s.position=e)}const i=this._backgroundBillboard;l(i)&&(i.position=e),this._updateClamping()}}},heightReference:{get:function(){return this._heightReference},set:function(e){if(!l(e))throw new w("value is required.");if(e!==this._heightReference){this._heightReference=e;const t=this._glyphs;for(let i=0,o=t.length;i<o;i++){const r=t[i].billboard;l(r)&&(r.heightReference=e)}const n=this._backgroundBillboard;l(n)&&(n.heightReference=e),WC(this),this._updateClamping()}}},text:{get:function(){return this._text},set:function(e){if(!l(e))throw new w("value is required.");if(this._text!==e){this._text=e;const t=e.replace(/\u00ad/g,"");this._renderedText=Af.enableRightToLeftDetection?zst(t):t,ag(this)}}},font:{get:function(){return this._font},set:function(e){if(!l(e))throw new w("value is required.");this._font!==e&&(this._font=e,ag(this),moe(this))}},fillColor:{get:function(){return this._fillColor},set:function(e){if(!l(e))throw new w("value is required.");const t=this._fillColor;k.equals(t,e)||(k.clone(e,t),ag(this))}},outlineColor:{get:function(){return this._outlineColor},set:function(e){if(!l(e))throw new w("value is required.");const t=this._outlineColor;k.equals(t,e)||(k.clone(e,t),ag(this))}},outlineWidth:{get:function(){return this._outlineWidth},set:function(e){if(!l(e))throw new w("value is required.");this._outlineWidth!==e&&(this._outlineWidth=e,ag(this))}},showBackground:{get:function(){return this._showBackground},set:function(e){if(!l(e))throw new w("value is required.");this._showBackground!==e&&(this._showBackground=e,ag(this))}},backgroundColor:{get:function(){return this._backgroundColor},set:function(e){if(!l(e))throw new w("value is required.");const t=this._backgroundColor;if(!k.equals(t,e)){k.clone(e,t);const n=this._backgroundBillboard;l(n)&&(n.color=t)}}},backgroundPadding:{get:function(){return this._backgroundPadding},set:function(e){if(!l(e))throw new w("value is required.");const t=this._backgroundPadding;$.equals(t,e)||($.clone(e,t),WC(this))}},style:{get:function(){return this._style},set:function(e){if(!l(e))throw new w("value is required.");this._style!==e&&(this._style=e,ag(this))}},pixelOffset:{get:function(){return this._pixelOffset},set:function(e){if(!l(e))throw new w("value is required.");const t=this._pixelOffset;if(!$.equals(t,e)){$.clone(e,t);const n=this._glyphs;for(let o=0,r=n.length;o<r;o++){const s=n[o];l(s.billboard)&&(s.billboard.pixelOffset=e)}const i=this._backgroundBillboard;l(i)&&(i.pixelOffset=e)}}},translucencyByDistance:{get:function(){return this._translucencyByDistance},set:function(e){if(l(e)&&e.far<=e.near)throw new w("far distance must be greater than near distance.");const t=this._translucencyByDistance;if(!tn.equals(t,e)){this._translucencyByDistance=tn.clone(e,t);const n=this._glyphs;for(let o=0,r=n.length;o<r;o++){const s=n[o];l(s.billboard)&&(s.billboard.translucencyByDistance=e)}const i=this._backgroundBillboard;l(i)&&(i.translucencyByDistance=e)}}},pixelOffsetScaleByDistance:{get:function(){return this._pixelOffsetScaleByDistance},set:function(e){if(l(e)&&e.far<=e.near)throw new w("far distance must be greater than near distance.");const t=this._pixelOffsetScaleByDistance;if(!tn.equals(t,e)){this._pixelOffsetScaleByDistance=tn.clone(e,t);const n=this._glyphs;for(let o=0,r=n.length;o<r;o++){const s=n[o];l(s.billboard)&&(s.billboard.pixelOffsetScaleByDistance=e)}const i=this._backgroundBillboard;l(i)&&(i.pixelOffsetScaleByDistance=e)}}},scaleByDistance:{get:function(){return this._scaleByDistance},set:function(e){if(l(e)&&e.far<=e.near)throw new w("far distance must be greater than near distance.");const t=this._scaleByDistance;if(!tn.equals(t,e)){this._scaleByDistance=tn.clone(e,t);const n=this._glyphs;for(let o=0,r=n.length;o<r;o++){const s=n[o];l(s.billboard)&&(s.billboard.scaleByDistance=e)}const i=this._backgroundBillboard;l(i)&&(i.scaleByDistance=e)}}},eyeOffset:{get:function(){return this._eyeOffset},set:function(e){if(!l(e))throw new w("value is required.");const t=this._eyeOffset;if(!d.equals(t,e)){d.clone(e,t);const n=this._glyphs;for(let o=0,r=n.length;o<r;o++){const s=n[o];l(s.billboard)&&(s.billboard.eyeOffset=e)}const i=this._backgroundBillboard;l(i)&&(i.eyeOffset=e)}}},horizontalOrigin:{get:function(){return this._horizontalOrigin},set:function(e){if(!l(e))throw new w("value is required.");this._horizontalOrigin!==e&&(this._horizontalOrigin=e,WC(this))}},verticalOrigin:{get:function(){return this._verticalOrigin},set:function(e){if(!l(e))throw new w("value is required.");if(this._verticalOrigin!==e){this._verticalOrigin=e;const t=this._glyphs;for(let i=0,o=t.length;i<o;i++){const r=t[i];l(r.billboard)&&(r.billboard.verticalOrigin=e)}const n=this._backgroundBillboard;l(n)&&(n.verticalOrigin=e),WC(this)}}},scale:{get:function(){return this._scale},set:function(e){if(!l(e))throw new w("value is required.");if(this._scale!==e){this._scale=e;const t=this._glyphs;for(let i=0,o=t.length;i<o;i++){const r=t[i];l(r.billboard)&&(r.billboard.scale=e*this._relativeSize)}const n=this._backgroundBillboard;l(n)&&(n.scale=e*this._relativeSize),WC(this)}}},totalScale:{get:function(){return this._scale*this._relativeSize}},distanceDisplayCondition:{get:function(){return this._distanceDisplayCondition},set:function(e){if(l(e)&&e.far<=e.near)throw new w("far must be greater than near");if(!sn.equals(e,this._distanceDisplayCondition)){this._distanceDisplayCondition=sn.clone(e,this._distanceDisplayCondition);const t=this._glyphs;for(let i=0,o=t.length;i<o;i++){const r=t[i];l(r.billboard)&&(r.billboard.distanceDisplayCondition=e)}const n=this._backgroundBillboard;l(n)&&(n.distanceDisplayCondition=e)}}},disableDepthTestDistance:{get:function(){return this._disableDepthTestDistance},set:function(e){if(this._disableDepthTestDistance!==e){if(l(e)&&e<0)throw new w("disableDepthTestDistance must be greater than 0.0.");this._disableDepthTestDistance=e;const t=this._glyphs;for(let i=0,o=t.length;i<o;i++){const r=t[i];l(r.billboard)&&(r.billboard.disableDepthTestDistance=e)}const n=this._backgroundBillboard;l(n)&&(n.disableDepthTestDistance=e)}}},id:{get:function(){return this._id},set:function(e){if(this._id!==e){this._id=e;const t=this._glyphs;for(let i=0,o=t.length;i<o;i++){const r=t[i];l(r.billboard)&&(r.billboard.id=e)}const n=this._backgroundBillboard;l(n)&&(n.id=e)}}},pickId:{get:function(){if(!(this._glyphs.length===0||!l(this._glyphs[0].billboard)))return this._glyphs[0].billboard.pickId}},_clampedPosition:{get:function(){return this._actualClampedPosition},set:function(e){this._actualClampedPosition=d.clone(e,this._actualClampedPosition);const t=this._glyphs;for(let i=0,o=t.length;i<o;i++){const r=t[i];l(r.billboard)&&(r.billboard._clampedPosition=e)}const n=this._backgroundBillboard;l(n)&&(n._clampedPosition=e)}},clusterShow:{get:function(){return this._clusterShow},set:function(e){if(this._clusterShow!==e){this._clusterShow=e;const t=this._glyphs;for(let i=0,o=t.length;i<o;i++){const r=t[i];l(r.billboard)&&(r.billboard.clusterShow=e)}const n=this._backgroundBillboard;l(n)&&(n.clusterShow=e)}}}});Af.prototype._updateClamping=function(){en._updateClamping(this._labelCollection,this)};Af.prototype.computeScreenSpacePosition=function(e,t){if(!l(e))throw new w("scene is required.");l(t)||(t=new $);const i=this._labelCollection.modelMatrix,o=l(this._actualClampedPosition)?this._actualClampedPosition:this._position;return en._computeScreenSpacePosition(i,o,this._eyeOffset,this._pixelOffset,e,t)};Af.getScreenSpaceBoundingBox=function(e,t,n){let i=0,o=0,r=0,s=0;const a=e.totalScale,c=e._backgroundBillboard;if(l(c))i=t.x+c._translate.x,o=t.y-c._translate.y,r=c.width*a,s=c.height*a,e.verticalOrigin===co.BOTTOM||e.verticalOrigin===co.BASELINE?o-=s:e.verticalOrigin===co.CENTER&&(o-=s*.5);else{i=Number.POSITIVE_INFINITY,o=Number.POSITIVE_INFINITY;let u=0,f=0;const h=e._glyphs,_=h.length;for(let g=0;g<_;++g){const p=h[g],y=p.billboard;if(!l(y))continue;const T=t.x+y._translate.x;let b=t.y-y._translate.y;const x=p.dimensions.width*a,v=p.dimensions.height*a;e.verticalOrigin===co.BOTTOM||e.verticalOrigin===co.BASELINE?b-=v:e.verticalOrigin===co.CENTER&&(b-=v*.5),e._verticalOrigin===co.TOP?b+=il.PADDING*a:(e._verticalOrigin===co.BOTTOM||e._verticalOrigin===co.BASELINE)&&(b-=il.PADDING*a),i=Math.min(i,T),o=Math.min(o,b),u=Math.max(u,T+x),f=Math.max(f,b+v)}r=u-i,s=f-o}return l(n)||(n=new at),n.x=i,n.y=o,n.width=r,n.height=s,n};Af.prototype.equals=function(e){return this===e||l(e)&&this._show===e._show&&this._scale===e._scale&&this._outlineWidth===e._outlineWidth&&this._showBackground===e._showBackground&&this._style===e._style&&this._verticalOrigin===e._verticalOrigin&&this._horizontalOrigin===e._horizontalOrigin&&this._heightReference===e._heightReference&&this._renderedText===e._renderedText&&this._font===e._font&&d.equals(this._position,e._position)&&k.equals(this._fillColor,e._fillColor)&&k.equals(this._outlineColor,e._outlineColor)&&k.equals(this._backgroundColor,e._backgroundColor)&&$.equals(this._backgroundPadding,e._backgroundPadding)&&$.equals(this._pixelOffset,e._pixelOffset)&&d.equals(this._eyeOffset,e._eyeOffset)&&tn.equals(this._translucencyByDistance,e._translucencyByDistance)&&tn.equals(this._pixelOffsetScaleByDistance,e._pixelOffsetScaleByDistance)&&tn.equals(this._scaleByDistance,e._scaleByDistance)&&sn.equals(this._distanceDisplayCondition,e._distanceDisplayCondition)&&this._disableDepthTestDistance===e._disableDepthTestDistance&&this._id===e._id};Af.prototype.isDestroyed=function(){return!1};Af.enableRightToLeftDetection=!1;function Bst(e,t){const n=/[a-zA-Z0-9]/,i=/[()[\]{}<>]/,o=[];let r="",s=Kr.LTR,a="";const c=e.length;for(let u=0;u<c;++u){const f=e.charAt(u);t.test(f)?a=Kr.RTL:n.test(f)?a=Kr.LTR:i.test(f)?a=Kr.BRACKETS:a=Kr.WEAK,u===0&&(s=a),s===a&&a!==Kr.BRACKETS?r+=f:(r!==""&&o.push({Type:s,Word:r}),s=a,r=f)}return o.push({Type:a,Word:r}),o}function Rst(e){return e.split("").reverse().join("")}function jC(e,t,n){return e.slice(0,t)+n+e.slice(t)}function Nst(e){switch(e){case"(":return")";case")":return"(";case"[":return"]";case"]":return"[";case"{":return"}";case"}":return"{";case"<":return">";case">":return"<"}}const Mst="א-ת",Fst="-ۿݐ-ݿࢠ-ࣿ",Pq=new RegExp(`[${Mst}${Fst}]`);function zst(e){const t=e.split(`
|
||
`);let n="";for(let i=0;i<t.length;i++){const o=t[i],r=Pq.test(o.charAt(0)),s=Bst(o,Pq);let a=0,c="";for(let u=0;u<s.length;++u){const f=s[u],h=f.Type===Kr.BRACKETS?Nst(f.Word):Rst(f.Word);r?f.Type===Kr.RTL?(c=h+c,a=0):f.Type===Kr.LTR?(c=jC(c,a,f.Word),a+=f.Word.length):(f.Type===Kr.WEAK||f.Type===Kr.BRACKETS)&&(f.Type===Kr.WEAK&&s[u-1].Type===Kr.BRACKETS?c=h+c:s[u-1].Type===Kr.RTL?(c=h+c,a=0):s.length>u+1?s[u+1].Type===Kr.RTL?(c=h+c,a=0):(c=jC(c,a,f.Word),a+=f.Word.length):c=jC(c,0,h)):f.Type===Kr.RTL?c=jC(c,a,h):f.Type===Kr.LTR?(c+=f.Word,a=c.length):(f.Type===Kr.WEAK||f.Type===Kr.BRACKETS)&&(u>0&&s[u-1].Type===Kr.RTL?s.length>u+1?s[u+1].Type===Kr.RTL?c=jC(c,a,h):(c+=f.Word,a=c.length):c+=f.Word:(c+=f.Word,a=c.length))}n+=c,i<t.length-1&&(n+=`
|
||
`)}return n}var l2={},Ust={get exports(){return l2},set exports(e){l2=e}};(function(e){function t(){var n=0,i=1,o=2,r=3,s=4,a=5,c=6,u=7,f=8,h=9,_=10,g=11,p=12,y=13,T=14,b=15,x=16,v=17,D=0,L=1,B=2,V=3,M=4;function H(m,P){return 55296<=m.charCodeAt(P)&&m.charCodeAt(P)<=56319&&56320<=m.charCodeAt(P+1)&&m.charCodeAt(P+1)<=57343}function G(m,P){P===void 0&&(P=0);var R=m.charCodeAt(P);if(55296<=R&&R<=56319&&P<m.length-1){var U=R,W=m.charCodeAt(P+1);return 56320<=W&&W<=57343?(U-55296)*1024+(W-56320)+65536:U}if(56320<=R&&R<=57343&&P>=1){var U=m.charCodeAt(P-1),W=R;return 55296<=U&&U<=56319?(U-55296)*1024+(W-56320)+65536:W}return R}function I(m,P,R){var U=[m].concat(P).concat([R]),W=U[U.length-2],q=R,Y=U.lastIndexOf(T);if(Y>1&&U.slice(1,Y).every(function(K){return K==r})&&[r,y,v].indexOf(m)==-1)return B;var j=U.lastIndexOf(s);if(j>0&&U.slice(1,j).every(function(K){return K==s})&&[p,s].indexOf(W)==-1)return U.filter(function(K){return K==s}).length%2==1?V:M;if(W==n&&q==i)return D;if(W==o||W==n||W==i)return q==T&&P.every(function(K){return K==r})?B:L;if(q==o||q==n||q==i)return L;if(W==c&&(q==c||q==u||q==h||q==_))return D;if((W==h||W==u)&&(q==u||q==f))return D;if((W==_||W==f)&&q==f)return D;if(q==r||q==b)return D;if(q==a)return D;if(W==p)return D;var ee=U.indexOf(r)!=-1?U.lastIndexOf(r)-1:U.length-2;return[y,v].indexOf(U[ee])!=-1&&U.slice(ee+1,-1).every(function(K){return K==r})&&q==T||W==b&&[x,v].indexOf(q)!=-1?D:P.indexOf(s)!=-1?B:W==s&&q==s?D:L}this.nextBreak=function(m,P){if(P===void 0&&(P=0),P<0)return 0;if(P>=m.length-1)return m.length;for(var R=O(G(m,P)),U=[],W=P+1;W<m.length;W++)if(!H(m,W-1)){var q=O(G(m,W));if(I(R,U,q))return W;U.push(q)}return m.length},this.splitGraphemes=function(m){for(var P=[],R=0,U;(U=this.nextBreak(m,R))<m.length;)P.push(m.slice(R,U)),R=U;return R<m.length&&P.push(m.slice(R)),P},this.iterateGraphemes=function(m){var P=0,R={next:function(){var U,W;return(W=this.nextBreak(m,P))<m.length?(U=m.slice(P,W),P=W,{value:U,done:!1}):P<m.length?(U=m.slice(P),P=m.length,{value:U,done:!1}):{value:void 0,done:!0}}.bind(this)};return typeof Symbol<"u"&&Symbol.iterator&&(R[Symbol.iterator]=function(){return R}),R},this.countGraphemes=function(m){for(var P=0,R=0,U;(U=this.nextBreak(m,R))<m.length;)R=U,P++;return R<m.length&&P++,P};function O(m){return 1536<=m&&m<=1541||m==1757||m==1807||m==2274||m==3406||m==69821||70082<=m&&m<=70083||m==72250||72326<=m&&m<=72329||m==73030?p:m==13?n:m==10?i:0<=m&&m<=9||11<=m&&m<=12||14<=m&&m<=31||127<=m&&m<=159||m==173||m==1564||m==6158||m==8203||8206<=m&&m<=8207||m==8232||m==8233||8234<=m&&m<=8238||8288<=m&&m<=8292||m==8293||8294<=m&&m<=8303||55296<=m&&m<=57343||m==65279||65520<=m&&m<=65528||65529<=m&&m<=65531||113824<=m&&m<=113827||119155<=m&&m<=119162||m==917504||m==917505||917506<=m&&m<=917535||917632<=m&&m<=917759||918e3<=m&&m<=921599?o:768<=m&&m<=879||1155<=m&&m<=1159||1160<=m&&m<=1161||1425<=m&&m<=1469||m==1471||1473<=m&&m<=1474||1476<=m&&m<=1477||m==1479||1552<=m&&m<=1562||1611<=m&&m<=1631||m==1648||1750<=m&&m<=1756||1759<=m&&m<=1764||1767<=m&&m<=1768||1770<=m&&m<=1773||m==1809||1840<=m&&m<=1866||1958<=m&&m<=1968||2027<=m&&m<=2035||2070<=m&&m<=2073||2075<=m&&m<=2083||2085<=m&&m<=2087||2089<=m&&m<=2093||2137<=m&&m<=2139||2260<=m&&m<=2273||2275<=m&&m<=2306||m==2362||m==2364||2369<=m&&m<=2376||m==2381||2385<=m&&m<=2391||2402<=m&&m<=2403||m==2433||m==2492||m==2494||2497<=m&&m<=2500||m==2509||m==2519||2530<=m&&m<=2531||2561<=m&&m<=2562||m==2620||2625<=m&&m<=2626||2631<=m&&m<=2632||2635<=m&&m<=2637||m==2641||2672<=m&&m<=2673||m==2677||2689<=m&&m<=2690||m==2748||2753<=m&&m<=2757||2759<=m&&m<=2760||m==2765||2786<=m&&m<=2787||2810<=m&&m<=2815||m==2817||m==2876||m==2878||m==2879||2881<=m&&m<=2884||m==2893||m==2902||m==2903||2914<=m&&m<=2915||m==2946||m==3006||m==3008||m==3021||m==3031||m==3072||3134<=m&&m<=3136||3142<=m&&m<=3144||3146<=m&&m<=3149||3157<=m&&m<=3158||3170<=m&&m<=3171||m==3201||m==3260||m==3263||m==3266||m==3270||3276<=m&&m<=3277||3285<=m&&m<=3286||3298<=m&&m<=3299||3328<=m&&m<=3329||3387<=m&&m<=3388||m==3390||3393<=m&&m<=3396||m==3405||m==3415||3426<=m&&m<=3427||m==3530||m==3535||3538<=m&&m<=3540||m==3542||m==3551||m==3633||3636<=m&&m<=3642||3655<=m&&m<=3662||m==3761||3764<=m&&m<=3769||3771<=m&&m<=3772||3784<=m&&m<=3789||3864<=m&&m<=3865||m==3893||m==3895||m==3897||3953<=m&&m<=3966||3968<=m&&m<=3972||3974<=m&&m<=3975||3981<=m&&m<=3991||3993<=m&&m<=4028||m==4038||4141<=m&&m<=4144||4146<=m&&m<=4151||4153<=m&&m<=4154||4157<=m&&m<=4158||4184<=m&&m<=4185||4190<=m&&m<=4192||4209<=m&&m<=4212||m==4226||4229<=m&&m<=4230||m==4237||m==4253||4957<=m&&m<=4959||5906<=m&&m<=5908||5938<=m&&m<=5940||5970<=m&&m<=5971||6002<=m&&m<=6003||6068<=m&&m<=6069||6071<=m&&m<=6077||m==6086||6089<=m&&m<=6099||m==6109||6155<=m&&m<=6157||6277<=m&&m<=6278||m==6313||6432<=m&&m<=6434||6439<=m&&m<=6440||m==6450||6457<=m&&m<=6459||6679<=m&&m<=6680||m==6683||m==6742||6744<=m&&m<=6750||m==6752||m==6754||6757<=m&&m<=6764||6771<=m&&m<=6780||m==6783||6832<=m&&m<=6845||m==6846||6912<=m&&m<=6915||m==6964||6966<=m&&m<=6970||m==6972||m==6978||7019<=m&&m<=7027||7040<=m&&m<=7041||7074<=m&&m<=7077||7080<=m&&m<=7081||7083<=m&&m<=7085||m==7142||7144<=m&&m<=7145||m==7149||7151<=m&&m<=7153||7212<=m&&m<=7219||7222<=m&&m<=7223||7376<=m&&m<=7378||7380<=m&&m<=7392||7394<=m&&m<=7400||m==7405||m==7412||7416<=m&&m<=7417||7616<=m&&m<=7673||7675<=m&&m<=7679||m==8204||8400<=m&&m<=8412||8413<=m&&m<=8416||m==8417||8418<=m&&m<=8420||8421<=m&&m<=8432||11503<=m&&m<=11505||m==11647||11744<=m&&m<=11775||12330<=m&&m<=12333||12334<=m&&m<=12335||12441<=m&&m<=12442||m==42607||42608<=m&&m<=42610||42612<=m&&m<=42621||42654<=m&&m<=42655||42736<=m&&m<=42737||m==43010||m==43014||m==43019||43045<=m&&m<=43046||43204<=m&&m<=43205||43232<=m&&m<=43249||43302<=m&&m<=43309||43335<=m&&m<=43345||43392<=m&&m<=43394||m==43443||43446<=m&&m<=43449||m==43452||m==43493||43561<=m&&m<=43566||43569<=m&&m<=43570||43573<=m&&m<=43574||m==43587||m==43596||m==43644||m==43696||43698<=m&&m<=43700||43703<=m&&m<=43704||43710<=m&&m<=43711||m==43713||43756<=m&&m<=43757||m==43766||m==44005||m==44008||m==44013||m==64286||65024<=m&&m<=65039||65056<=m&&m<=65071||65438<=m&&m<=65439||m==66045||m==66272||66422<=m&&m<=66426||68097<=m&&m<=68099||68101<=m&&m<=68102||68108<=m&&m<=68111||68152<=m&&m<=68154||m==68159||68325<=m&&m<=68326||m==69633||69688<=m&&m<=69702||69759<=m&&m<=69761||69811<=m&&m<=69814||69817<=m&&m<=69818||69888<=m&&m<=69890||69927<=m&&m<=69931||69933<=m&&m<=69940||m==70003||70016<=m&&m<=70017||70070<=m&&m<=70078||70090<=m&&m<=70092||70191<=m&&m<=70193||m==70196||70198<=m&&m<=70199||m==70206||m==70367||70371<=m&&m<=70378||70400<=m&&m<=70401||m==70460||m==70462||m==70464||m==70487||70502<=m&&m<=70508||70512<=m&&m<=70516||70712<=m&&m<=70719||70722<=m&&m<=70724||m==70726||m==70832||70835<=m&&m<=70840||m==70842||m==70845||70847<=m&&m<=70848||70850<=m&&m<=70851||m==71087||71090<=m&&m<=71093||71100<=m&&m<=71101||71103<=m&&m<=71104||71132<=m&&m<=71133||71219<=m&&m<=71226||m==71229||71231<=m&&m<=71232||m==71339||m==71341||71344<=m&&m<=71349||m==71351||71453<=m&&m<=71455||71458<=m&&m<=71461||71463<=m&&m<=71467||72193<=m&&m<=72198||72201<=m&&m<=72202||72243<=m&&m<=72248||72251<=m&&m<=72254||m==72263||72273<=m&&m<=72278||72281<=m&&m<=72283||72330<=m&&m<=72342||72344<=m&&m<=72345||72752<=m&&m<=72758||72760<=m&&m<=72765||m==72767||72850<=m&&m<=72871||72874<=m&&m<=72880||72882<=m&&m<=72883||72885<=m&&m<=72886||73009<=m&&m<=73014||m==73018||73020<=m&&m<=73021||73023<=m&&m<=73029||m==73031||92912<=m&&m<=92916||92976<=m&&m<=92982||94095<=m&&m<=94098||113821<=m&&m<=113822||m==119141||119143<=m&&m<=119145||119150<=m&&m<=119154||119163<=m&&m<=119170||119173<=m&&m<=119179||119210<=m&&m<=119213||119362<=m&&m<=119364||121344<=m&&m<=121398||121403<=m&&m<=121452||m==121461||m==121476||121499<=m&&m<=121503||121505<=m&&m<=121519||122880<=m&&m<=122886||122888<=m&&m<=122904||122907<=m&&m<=122913||122915<=m&&m<=122916||122918<=m&&m<=122922||125136<=m&&m<=125142||125252<=m&&m<=125258||917536<=m&&m<=917631||917760<=m&&m<=917999?r:127462<=m&&m<=127487?s:m==2307||m==2363||2366<=m&&m<=2368||2377<=m&&m<=2380||2382<=m&&m<=2383||2434<=m&&m<=2435||2495<=m&&m<=2496||2503<=m&&m<=2504||2507<=m&&m<=2508||m==2563||2622<=m&&m<=2624||m==2691||2750<=m&&m<=2752||m==2761||2763<=m&&m<=2764||2818<=m&&m<=2819||m==2880||2887<=m&&m<=2888||2891<=m&&m<=2892||m==3007||3009<=m&&m<=3010||3014<=m&&m<=3016||3018<=m&&m<=3020||3073<=m&&m<=3075||3137<=m&&m<=3140||3202<=m&&m<=3203||m==3262||3264<=m&&m<=3265||3267<=m&&m<=3268||3271<=m&&m<=3272||3274<=m&&m<=3275||3330<=m&&m<=3331||3391<=m&&m<=3392||3398<=m&&m<=3400||3402<=m&&m<=3404||3458<=m&&m<=3459||3536<=m&&m<=3537||3544<=m&&m<=3550||3570<=m&&m<=3571||m==3635||m==3763||3902<=m&&m<=3903||m==3967||m==4145||4155<=m&&m<=4156||4182<=m&&m<=4183||m==4228||m==6070||6078<=m&&m<=6085||6087<=m&&m<=6088||6435<=m&&m<=6438||6441<=m&&m<=6443||6448<=m&&m<=6449||6451<=m&&m<=6456||6681<=m&&m<=6682||m==6741||m==6743||6765<=m&&m<=6770||m==6916||m==6965||m==6971||6973<=m&&m<=6977||6979<=m&&m<=6980||m==7042||m==7073||7078<=m&&m<=7079||m==7082||m==7143||7146<=m&&m<=7148||m==7150||7154<=m&&m<=7155||7204<=m&&m<=7211||7220<=m&&m<=7221||m==7393||7410<=m&&m<=7411||m==7415||43043<=m&&m<=43044||m==43047||43136<=m&&m<=43137||43188<=m&&m<=43203||43346<=m&&m<=43347||m==43395||43444<=m&&m<=43445||43450<=m&&m<=43451||43453<=m&&m<=43456||43567<=m&&m<=43568||43571<=m&&m<=43572||m==43597||m==43755||43758<=m&&m<=43759||m==43765||44003<=m&&m<=44004||44006<=m&&m<=44007||44009<=m&&m<=44010||m==44012||m==69632||m==69634||m==69762||69808<=m&&m<=69810||69815<=m&&m<=69816||m==69932||m==70018||70067<=m&&m<=70069||70079<=m&&m<=70080||70188<=m&&m<=70190||70194<=m&&m<=70195||m==70197||70368<=m&&m<=70370||70402<=m&&m<=70403||m==70463||70465<=m&&m<=70468||70471<=m&&m<=70472||70475<=m&&m<=70477||70498<=m&&m<=70499||70709<=m&&m<=70711||70720<=m&&m<=70721||m==70725||70833<=m&&m<=70834||m==70841||70843<=m&&m<=70844||m==70846||m==70849||71088<=m&&m<=71089||71096<=m&&m<=71099||m==71102||71216<=m&&m<=71218||71227<=m&&m<=71228||m==71230||m==71340||71342<=m&&m<=71343||m==71350||71456<=m&&m<=71457||m==71462||72199<=m&&m<=72200||m==72249||72279<=m&&m<=72280||m==72343||m==72751||m==72766||m==72873||m==72881||m==72884||94033<=m&&m<=94078||m==119142||m==119149?a:4352<=m&&m<=4447||43360<=m&&m<=43388?c:4448<=m&&m<=4519||55216<=m&&m<=55238?u:4520<=m&&m<=4607||55243<=m&&m<=55291?f:m==44032||m==44060||m==44088||m==44116||m==44144||m==44172||m==44200||m==44228||m==44256||m==44284||m==44312||m==44340||m==44368||m==44396||m==44424||m==44452||m==44480||m==44508||m==44536||m==44564||m==44592||m==44620||m==44648||m==44676||m==44704||m==44732||m==44760||m==44788||m==44816||m==44844||m==44872||m==44900||m==44928||m==44956||m==44984||m==45012||m==45040||m==45068||m==45096||m==45124||m==45152||m==45180||m==45208||m==45236||m==45264||m==45292||m==45320||m==45348||m==45376||m==45404||m==45432||m==45460||m==45488||m==45516||m==45544||m==45572||m==45600||m==45628||m==45656||m==45684||m==45712||m==45740||m==45768||m==45796||m==45824||m==45852||m==45880||m==45908||m==45936||m==45964||m==45992||m==46020||m==46048||m==46076||m==46104||m==46132||m==46160||m==46188||m==46216||m==46244||m==46272||m==46300||m==46328||m==46356||m==46384||m==46412||m==46440||m==46468||m==46496||m==46524||m==46552||m==46580||m==46608||m==46636||m==46664||m==46692||m==46720||m==46748||m==46776||m==46804||m==46832||m==46860||m==46888||m==46916||m==46944||m==46972||m==47e3||m==47028||m==47056||m==47084||m==47112||m==47140||m==47168||m==47196||m==47224||m==47252||m==47280||m==47308||m==47336||m==47364||m==47392||m==47420||m==47448||m==47476||m==47504||m==47532||m==47560||m==47588||m==47616||m==47644||m==47672||m==47700||m==47728||m==47756||m==47784||m==47812||m==47840||m==47868||m==47896||m==47924||m==47952||m==47980||m==48008||m==48036||m==48064||m==48092||m==48120||m==48148||m==48176||m==48204||m==48232||m==48260||m==48288||m==48316||m==48344||m==48372||m==48400||m==48428||m==48456||m==48484||m==48512||m==48540||m==48568||m==48596||m==48624||m==48652||m==48680||m==48708||m==48736||m==48764||m==48792||m==48820||m==48848||m==48876||m==48904||m==48932||m==48960||m==48988||m==49016||m==49044||m==49072||m==49100||m==49128||m==49156||m==49184||m==49212||m==49240||m==49268||m==49296||m==49324||m==49352||m==49380||m==49408||m==49436||m==49464||m==49492||m==49520||m==49548||m==49576||m==49604||m==49632||m==49660||m==49688||m==49716||m==49744||m==49772||m==49800||m==49828||m==49856||m==49884||m==49912||m==49940||m==49968||m==49996||m==50024||m==50052||m==50080||m==50108||m==50136||m==50164||m==50192||m==50220||m==50248||m==50276||m==50304||m==50332||m==50360||m==50388||m==50416||m==50444||m==50472||m==50500||m==50528||m==50556||m==50584||m==50612||m==50640||m==50668||m==50696||m==50724||m==50752||m==50780||m==50808||m==50836||m==50864||m==50892||m==50920||m==50948||m==50976||m==51004||m==51032||m==51060||m==51088||m==51116||m==51144||m==51172||m==51200||m==51228||m==51256||m==51284||m==51312||m==51340||m==51368||m==51396||m==51424||m==51452||m==51480||m==51508||m==51536||m==51564||m==51592||m==51620||m==51648||m==51676||m==51704||m==51732||m==51760||m==51788||m==51816||m==51844||m==51872||m==51900||m==51928||m==51956||m==51984||m==52012||m==52040||m==52068||m==52096||m==52124||m==52152||m==52180||m==52208||m==52236||m==52264||m==52292||m==52320||m==52348||m==52376||m==52404||m==52432||m==52460||m==52488||m==52516||m==52544||m==52572||m==52600||m==52628||m==52656||m==52684||m==52712||m==52740||m==52768||m==52796||m==52824||m==52852||m==52880||m==52908||m==52936||m==52964||m==52992||m==53020||m==53048||m==53076||m==53104||m==53132||m==53160||m==53188||m==53216||m==53244||m==53272||m==53300||m==53328||m==53356||m==53384||m==53412||m==53440||m==53468||m==53496||m==53524||m==53552||m==53580||m==53608||m==53636||m==53664||m==53692||m==53720||m==53748||m==53776||m==53804||m==53832||m==53860||m==53888||m==53916||m==53944||m==53972||m==54e3||m==54028||m==54056||m==54084||m==54112||m==54140||m==54168||m==54196||m==54224||m==54252||m==54280||m==54308||m==54336||m==54364||m==54392||m==54420||m==54448||m==54476||m==54504||m==54532||m==54560||m==54588||m==54616||m==54644||m==54672||m==54700||m==54728||m==54756||m==54784||m==54812||m==54840||m==54868||m==54896||m==54924||m==54952||m==54980||m==55008||m==55036||m==55064||m==55092||m==55120||m==55148||m==55176?h:44033<=m&&m<=44059||44061<=m&&m<=44087||44089<=m&&m<=44115||44117<=m&&m<=44143||44145<=m&&m<=44171||44173<=m&&m<=44199||44201<=m&&m<=44227||44229<=m&&m<=44255||44257<=m&&m<=44283||44285<=m&&m<=44311||44313<=m&&m<=44339||44341<=m&&m<=44367||44369<=m&&m<=44395||44397<=m&&m<=44423||44425<=m&&m<=44451||44453<=m&&m<=44479||44481<=m&&m<=44507||44509<=m&&m<=44535||44537<=m&&m<=44563||44565<=m&&m<=44591||44593<=m&&m<=44619||44621<=m&&m<=44647||44649<=m&&m<=44675||44677<=m&&m<=44703||44705<=m&&m<=44731||44733<=m&&m<=44759||44761<=m&&m<=44787||44789<=m&&m<=44815||44817<=m&&m<=44843||44845<=m&&m<=44871||44873<=m&&m<=44899||44901<=m&&m<=44927||44929<=m&&m<=44955||44957<=m&&m<=44983||44985<=m&&m<=45011||45013<=m&&m<=45039||45041<=m&&m<=45067||45069<=m&&m<=45095||45097<=m&&m<=45123||45125<=m&&m<=45151||45153<=m&&m<=45179||45181<=m&&m<=45207||45209<=m&&m<=45235||45237<=m&&m<=45263||45265<=m&&m<=45291||45293<=m&&m<=45319||45321<=m&&m<=45347||45349<=m&&m<=45375||45377<=m&&m<=45403||45405<=m&&m<=45431||45433<=m&&m<=45459||45461<=m&&m<=45487||45489<=m&&m<=45515||45517<=m&&m<=45543||45545<=m&&m<=45571||45573<=m&&m<=45599||45601<=m&&m<=45627||45629<=m&&m<=45655||45657<=m&&m<=45683||45685<=m&&m<=45711||45713<=m&&m<=45739||45741<=m&&m<=45767||45769<=m&&m<=45795||45797<=m&&m<=45823||45825<=m&&m<=45851||45853<=m&&m<=45879||45881<=m&&m<=45907||45909<=m&&m<=45935||45937<=m&&m<=45963||45965<=m&&m<=45991||45993<=m&&m<=46019||46021<=m&&m<=46047||46049<=m&&m<=46075||46077<=m&&m<=46103||46105<=m&&m<=46131||46133<=m&&m<=46159||46161<=m&&m<=46187||46189<=m&&m<=46215||46217<=m&&m<=46243||46245<=m&&m<=46271||46273<=m&&m<=46299||46301<=m&&m<=46327||46329<=m&&m<=46355||46357<=m&&m<=46383||46385<=m&&m<=46411||46413<=m&&m<=46439||46441<=m&&m<=46467||46469<=m&&m<=46495||46497<=m&&m<=46523||46525<=m&&m<=46551||46553<=m&&m<=46579||46581<=m&&m<=46607||46609<=m&&m<=46635||46637<=m&&m<=46663||46665<=m&&m<=46691||46693<=m&&m<=46719||46721<=m&&m<=46747||46749<=m&&m<=46775||46777<=m&&m<=46803||46805<=m&&m<=46831||46833<=m&&m<=46859||46861<=m&&m<=46887||46889<=m&&m<=46915||46917<=m&&m<=46943||46945<=m&&m<=46971||46973<=m&&m<=46999||47001<=m&&m<=47027||47029<=m&&m<=47055||47057<=m&&m<=47083||47085<=m&&m<=47111||47113<=m&&m<=47139||47141<=m&&m<=47167||47169<=m&&m<=47195||47197<=m&&m<=47223||47225<=m&&m<=47251||47253<=m&&m<=47279||47281<=m&&m<=47307||47309<=m&&m<=47335||47337<=m&&m<=47363||47365<=m&&m<=47391||47393<=m&&m<=47419||47421<=m&&m<=47447||47449<=m&&m<=47475||47477<=m&&m<=47503||47505<=m&&m<=47531||47533<=m&&m<=47559||47561<=m&&m<=47587||47589<=m&&m<=47615||47617<=m&&m<=47643||47645<=m&&m<=47671||47673<=m&&m<=47699||47701<=m&&m<=47727||47729<=m&&m<=47755||47757<=m&&m<=47783||47785<=m&&m<=47811||47813<=m&&m<=47839||47841<=m&&m<=47867||47869<=m&&m<=47895||47897<=m&&m<=47923||47925<=m&&m<=47951||47953<=m&&m<=47979||47981<=m&&m<=48007||48009<=m&&m<=48035||48037<=m&&m<=48063||48065<=m&&m<=48091||48093<=m&&m<=48119||48121<=m&&m<=48147||48149<=m&&m<=48175||48177<=m&&m<=48203||48205<=m&&m<=48231||48233<=m&&m<=48259||48261<=m&&m<=48287||48289<=m&&m<=48315||48317<=m&&m<=48343||48345<=m&&m<=48371||48373<=m&&m<=48399||48401<=m&&m<=48427||48429<=m&&m<=48455||48457<=m&&m<=48483||48485<=m&&m<=48511||48513<=m&&m<=48539||48541<=m&&m<=48567||48569<=m&&m<=48595||48597<=m&&m<=48623||48625<=m&&m<=48651||48653<=m&&m<=48679||48681<=m&&m<=48707||48709<=m&&m<=48735||48737<=m&&m<=48763||48765<=m&&m<=48791||48793<=m&&m<=48819||48821<=m&&m<=48847||48849<=m&&m<=48875||48877<=m&&m<=48903||48905<=m&&m<=48931||48933<=m&&m<=48959||48961<=m&&m<=48987||48989<=m&&m<=49015||49017<=m&&m<=49043||49045<=m&&m<=49071||49073<=m&&m<=49099||49101<=m&&m<=49127||49129<=m&&m<=49155||49157<=m&&m<=49183||49185<=m&&m<=49211||49213<=m&&m<=49239||49241<=m&&m<=49267||49269<=m&&m<=49295||49297<=m&&m<=49323||49325<=m&&m<=49351||49353<=m&&m<=49379||49381<=m&&m<=49407||49409<=m&&m<=49435||49437<=m&&m<=49463||49465<=m&&m<=49491||49493<=m&&m<=49519||49521<=m&&m<=49547||49549<=m&&m<=49575||49577<=m&&m<=49603||49605<=m&&m<=49631||49633<=m&&m<=49659||49661<=m&&m<=49687||49689<=m&&m<=49715||49717<=m&&m<=49743||49745<=m&&m<=49771||49773<=m&&m<=49799||49801<=m&&m<=49827||49829<=m&&m<=49855||49857<=m&&m<=49883||49885<=m&&m<=49911||49913<=m&&m<=49939||49941<=m&&m<=49967||49969<=m&&m<=49995||49997<=m&&m<=50023||50025<=m&&m<=50051||50053<=m&&m<=50079||50081<=m&&m<=50107||50109<=m&&m<=50135||50137<=m&&m<=50163||50165<=m&&m<=50191||50193<=m&&m<=50219||50221<=m&&m<=50247||50249<=m&&m<=50275||50277<=m&&m<=50303||50305<=m&&m<=50331||50333<=m&&m<=50359||50361<=m&&m<=50387||50389<=m&&m<=50415||50417<=m&&m<=50443||50445<=m&&m<=50471||50473<=m&&m<=50499||50501<=m&&m<=50527||50529<=m&&m<=50555||50557<=m&&m<=50583||50585<=m&&m<=50611||50613<=m&&m<=50639||50641<=m&&m<=50667||50669<=m&&m<=50695||50697<=m&&m<=50723||50725<=m&&m<=50751||50753<=m&&m<=50779||50781<=m&&m<=50807||50809<=m&&m<=50835||50837<=m&&m<=50863||50865<=m&&m<=50891||50893<=m&&m<=50919||50921<=m&&m<=50947||50949<=m&&m<=50975||50977<=m&&m<=51003||51005<=m&&m<=51031||51033<=m&&m<=51059||51061<=m&&m<=51087||51089<=m&&m<=51115||51117<=m&&m<=51143||51145<=m&&m<=51171||51173<=m&&m<=51199||51201<=m&&m<=51227||51229<=m&&m<=51255||51257<=m&&m<=51283||51285<=m&&m<=51311||51313<=m&&m<=51339||51341<=m&&m<=51367||51369<=m&&m<=51395||51397<=m&&m<=51423||51425<=m&&m<=51451||51453<=m&&m<=51479||51481<=m&&m<=51507||51509<=m&&m<=51535||51537<=m&&m<=51563||51565<=m&&m<=51591||51593<=m&&m<=51619||51621<=m&&m<=51647||51649<=m&&m<=51675||51677<=m&&m<=51703||51705<=m&&m<=51731||51733<=m&&m<=51759||51761<=m&&m<=51787||51789<=m&&m<=51815||51817<=m&&m<=51843||51845<=m&&m<=51871||51873<=m&&m<=51899||51901<=m&&m<=51927||51929<=m&&m<=51955||51957<=m&&m<=51983||51985<=m&&m<=52011||52013<=m&&m<=52039||52041<=m&&m<=52067||52069<=m&&m<=52095||52097<=m&&m<=52123||52125<=m&&m<=52151||52153<=m&&m<=52179||52181<=m&&m<=52207||52209<=m&&m<=52235||52237<=m&&m<=52263||52265<=m&&m<=52291||52293<=m&&m<=52319||52321<=m&&m<=52347||52349<=m&&m<=52375||52377<=m&&m<=52403||52405<=m&&m<=52431||52433<=m&&m<=52459||52461<=m&&m<=52487||52489<=m&&m<=52515||52517<=m&&m<=52543||52545<=m&&m<=52571||52573<=m&&m<=52599||52601<=m&&m<=52627||52629<=m&&m<=52655||52657<=m&&m<=52683||52685<=m&&m<=52711||52713<=m&&m<=52739||52741<=m&&m<=52767||52769<=m&&m<=52795||52797<=m&&m<=52823||52825<=m&&m<=52851||52853<=m&&m<=52879||52881<=m&&m<=52907||52909<=m&&m<=52935||52937<=m&&m<=52963||52965<=m&&m<=52991||52993<=m&&m<=53019||53021<=m&&m<=53047||53049<=m&&m<=53075||53077<=m&&m<=53103||53105<=m&&m<=53131||53133<=m&&m<=53159||53161<=m&&m<=53187||53189<=m&&m<=53215||53217<=m&&m<=53243||53245<=m&&m<=53271||53273<=m&&m<=53299||53301<=m&&m<=53327||53329<=m&&m<=53355||53357<=m&&m<=53383||53385<=m&&m<=53411||53413<=m&&m<=53439||53441<=m&&m<=53467||53469<=m&&m<=53495||53497<=m&&m<=53523||53525<=m&&m<=53551||53553<=m&&m<=53579||53581<=m&&m<=53607||53609<=m&&m<=53635||53637<=m&&m<=53663||53665<=m&&m<=53691||53693<=m&&m<=53719||53721<=m&&m<=53747||53749<=m&&m<=53775||53777<=m&&m<=53803||53805<=m&&m<=53831||53833<=m&&m<=53859||53861<=m&&m<=53887||53889<=m&&m<=53915||53917<=m&&m<=53943||53945<=m&&m<=53971||53973<=m&&m<=53999||54001<=m&&m<=54027||54029<=m&&m<=54055||54057<=m&&m<=54083||54085<=m&&m<=54111||54113<=m&&m<=54139||54141<=m&&m<=54167||54169<=m&&m<=54195||54197<=m&&m<=54223||54225<=m&&m<=54251||54253<=m&&m<=54279||54281<=m&&m<=54307||54309<=m&&m<=54335||54337<=m&&m<=54363||54365<=m&&m<=54391||54393<=m&&m<=54419||54421<=m&&m<=54447||54449<=m&&m<=54475||54477<=m&&m<=54503||54505<=m&&m<=54531||54533<=m&&m<=54559||54561<=m&&m<=54587||54589<=m&&m<=54615||54617<=m&&m<=54643||54645<=m&&m<=54671||54673<=m&&m<=54699||54701<=m&&m<=54727||54729<=m&&m<=54755||54757<=m&&m<=54783||54785<=m&&m<=54811||54813<=m&&m<=54839||54841<=m&&m<=54867||54869<=m&&m<=54895||54897<=m&&m<=54923||54925<=m&&m<=54951||54953<=m&&m<=54979||54981<=m&&m<=55007||55009<=m&&m<=55035||55037<=m&&m<=55063||55065<=m&&m<=55091||55093<=m&&m<=55119||55121<=m&&m<=55147||55149<=m&&m<=55175||55177<=m&&m<=55203?_:m==9757||m==9977||9994<=m&&m<=9997||m==127877||127938<=m&&m<=127940||m==127943||127946<=m&&m<=127948||128066<=m&&m<=128067||128070<=m&&m<=128080||m==128110||128112<=m&&m<=128120||m==128124||128129<=m&&m<=128131||128133<=m&&m<=128135||m==128170||128372<=m&&m<=128373||m==128378||m==128400||128405<=m&&m<=128406||128581<=m&&m<=128583||128587<=m&&m<=128591||m==128675||128692<=m&&m<=128694||m==128704||m==128716||129304<=m&&m<=129308||129310<=m&&m<=129311||m==129318||129328<=m&&m<=129337||129341<=m&&m<=129342||129489<=m&&m<=129501?y:127995<=m&&m<=127999?T:m==8205?b:m==9792||m==9794||9877<=m&&m<=9878||m==9992||m==10084||m==127752||m==127806||m==127859||m==127891||m==127908||m==127912||m==127979||m==127981||m==128139||128187<=m&&m<=128188||m==128295||m==128300||m==128488||m==128640||m==128658?x:128102<=m&&m<=128105?v:g}return this}e.exports&&(e.exports=t)})(Ust);const Hst=l2;function Vst(){this.textureInfo=void 0,this.dimensions=void 0,this.billboard=void 0}function kst(e,t,n){this.labelCollection=e,this.index=t,this.dimensions=n}const Gst=1.2,_oe="ID_WHITE_PIXEL",u2=new $(4,4),Wst=new at(1,1,1,1);function qst(e){const t=document.createElement("canvas");t.width=u2.x,t.height=u2.y;const n=t.getContext("2d");n.fillStyle="#fff",n.fillRect(0,0,t.width,t.height),e.addImage(_oe,t)}const Gl={};function jst(e,t,n,i,o,r,s){return Gl.font=t,Gl.fillColor=n,Gl.strokeColor=i,Gl.strokeWidth=o,Gl.padding=il.PADDING,s===co.CENTER?Gl.textBaseline="middle":s===co.TOP?Gl.textBaseline="top":Gl.textBaseline="bottom",Gl.fill=r===nf.FILL||r===nf.FILL_AND_OUTLINE,Gl.stroke=r===nf.OUTLINE||r===nf.FILL_AND_OUTLINE,Gl.backgroundColor=k.BLACK,Sst(e,Gl)}function f2(e,t){t.textureInfo=void 0,t.dimensions=void 0;const n=t.billboard;l(n)&&(n.show=!1,n.image=void 0,l(n._removeCallbackFunc)&&(n._removeCallbackFunc(),n._removeCallbackFunc=void 0),e._spareBillboards.push(n),t.billboard=void 0)}function Yst(e,t,n,i){i.index=e.addImageSync(t,n)}const $st=new Hst;function Xst(e,t){const n=t._renderedText,i=$st.splitGraphemes(n),o=i.length,r=t._glyphs,s=r.length;let a,c,u;if(t._relativeSize=t._fontSize/il.FONT_SIZE,o<s)for(c=o;c<s;++c)f2(e,r[c]);r.length=o;const f=t._showBackground&&n.split(`
|
||
`).join("").length>0;let h=t._backgroundBillboard;const _=e._backgroundBillboardCollection;f?(l(h)||(h=_.add({collection:e,image:_oe,imageSubRegion:Wst}),t._backgroundBillboard=h),h.color=t._backgroundColor,h.show=t._show,h.position=t._position,h.eyeOffset=t._eyeOffset,h.pixelOffset=t._pixelOffset,h.horizontalOrigin=yc.LEFT,h.verticalOrigin=t._verticalOrigin,h.heightReference=t._heightReference,h.scale=t.totalScale,h.pickPrimitive=t,h.id=t._id,h.translucencyByDistance=t._translucencyByDistance,h.pixelOffsetScaleByDistance=t._pixelOffsetScaleByDistance,h.scaleByDistance=t._scaleByDistance,h.distanceDisplayCondition=t._distanceDisplayCondition,h.disableDepthTestDistance=t._disableDepthTestDistance):l(h)&&(_.remove(h),t._backgroundBillboard=h=void 0);const g=e._glyphTextureCache;for(u=0;u<o;++u){const p=i[u],y=t._verticalOrigin,T=JSON.stringify([p,t._fontFamily,t._fontStyle,t._fontWeight,+y]);let b=g[T];if(!l(b)){const x=`${t._fontStyle} ${t._fontWeight} ${il.FONT_SIZE}px ${t._fontFamily}`,v=jst(p,x,k.WHITE,k.WHITE,0,nf.FILL,y);if(b=new kst(e,-1,v.dimensions),g[T]=b,v.width>0&&v.height>0){const D=vst(v,{cutoff:il.CUTOFF,radius:il.RADIUS}),L=v.getContext("2d"),B=v.width,V=v.height,M=L.getImageData(0,0,B,V);for(let H=0;H<B;H++)for(let G=0;G<V;G++){const I=G*B+H,O=D[I]*255,m=I*4;M.data[m+0]=O,M.data[m+1]=O,M.data[m+2]=O,M.data[m+3]=O}L.putImageData(M,0,0),p!==" "&&Yst(e._textureAtlas,T,v,b)}}if(a=r[u],l(a)?b.index===-1?f2(e,a):l(a.textureInfo)&&(a.textureInfo=void 0):(a=new Vst,r[u]=a),a.textureInfo=b,a.dimensions=b.dimensions,b.index!==-1){let x=a.billboard;const v=e._spareBillboards;l(x)||(v.length>0?x=v.pop():(x=e._billboardCollection.add({collection:e}),x._labelDimensions=new $,x._labelTranslate=new $),a.billboard=x),x.show=t._show,x.position=t._position,x.eyeOffset=t._eyeOffset,x.pixelOffset=t._pixelOffset,x.horizontalOrigin=yc.LEFT,x.verticalOrigin=t._verticalOrigin,x.heightReference=t._heightReference,x.scale=t.totalScale,x.pickPrimitive=t,x.id=t._id,x.image=T,x.translucencyByDistance=t._translucencyByDistance,x.pixelOffsetScaleByDistance=t._pixelOffsetScaleByDistance,x.scaleByDistance=t._scaleByDistance,x.distanceDisplayCondition=t._distanceDisplayCondition,x.disableDepthTestDistance=t._disableDepthTestDistance,x._batchIndex=t._batchIndex,x.outlineColor=t.outlineColor,t.style===nf.FILL_AND_OUTLINE?(x.color=t._fillColor,x.outlineWidth=t.outlineWidth):t.style===nf.FILL?(x.color=t._fillColor,x.outlineWidth=0):t.style===nf.OUTLINE&&(x.color=k.TRANSPARENT,x.outlineWidth=t.outlineWidth)}}t._repositionAllGlyphs=!0}function Oq(e,t,n){return t===yc.CENTER?-e/2:t===yc.RIGHT?-(e+n.x):n.x}const $o=new $,Kst=new $;function Jst(e){const t=e._glyphs,n=e._renderedText;let i,o,r=0,s=0;const a=[];let c=Number.NEGATIVE_INFINITY,u=0,f=1,h;const _=t.length,g=e._backgroundBillboard,p=$.clone(l(g)?e._backgroundPadding:$.ZERO,Kst);for(p.x/=e._relativeSize,p.y/=e._relativeSize,h=0;h<_;++h)n.charAt(h)===`
|
||
`?(a.push(r),++f,r=0):(i=t[h],o=i.dimensions,u=Math.max(u,o.height-o.descent),c=Math.max(c,o.descent),r+=o.width-o.minx,h<_-1&&(r+=t[h+1].dimensions.minx),s=Math.max(s,r));a.push(r);const y=u+c,T=e.totalScale,b=e._horizontalOrigin,x=e._verticalOrigin;let v=0,D=a[v],L=Oq(D,b,p);const B=(l(e._lineHeight)?e._lineHeight:Gst*e._fontSize)/e._relativeSize,V=B*(f-1);let M=s,H=y+V;l(g)&&(M+=p.x*2,H+=p.y*2,g._labelHorizontalOrigin=b),$o.x=L*T,$o.y=0;let G=!0,I=0;for(h=0;h<_;++h)if(n.charAt(h)===`
|
||
`)++v,I+=B,D=a[v],L=Oq(D,b,p),$o.x=L*T,G=!0;else if(i=t[h],o=i.dimensions,x===co.TOP?($o.y=o.height-u-p.y,$o.y+=il.PADDING):x===co.CENTER?$o.y=(V+o.height-u)/2:x===co.BASELINE?($o.y=V,$o.y-=il.PADDING):($o.y=V+c+p.y,$o.y-=il.PADDING),$o.y=($o.y-o.descent-I)*T,G&&($o.x-=il.PADDING*T,G=!1),l(i.billboard)&&(i.billboard._setTranslate($o),i.billboard._labelDimensions.x=M,i.billboard._labelDimensions.y=H,i.billboard._labelHorizontalOrigin=b),h<_-1){const O=t[h+1];$o.x+=(o.width-o.minx+O.dimensions.minx)*T}if(l(g)&&n.split(`
|
||
`).join("").length>0&&(b===yc.CENTER?L=-s/2-p.x:b===yc.RIGHT?L=-(s+p.x*2):L=0,$o.x=L*T,x===co.TOP?$o.y=y-u-c:x===co.CENTER?$o.y=(y-u)/2-c:x===co.BASELINE?$o.y=-p.y-c:$o.y=0,$o.y=$o.y*T,g.width=M,g.height=H,g._setTranslate($o),g._labelTranslate=$.clone($o,g._labelTranslate)),e.heightReference===Ht.CLAMP_TO_GROUND)for(h=0;h<_;++h){i=t[h];const O=i.billboard;l(O)&&(O._labelTranslate=$.clone($o,O._labelTranslate))}}function goe(e,t){const n=t._glyphs;for(let i=0,o=n.length;i<o;++i)f2(e,n[i]);l(t._backgroundBillboard)&&(e._backgroundBillboardCollection.remove(t._backgroundBillboard),t._backgroundBillboard=void 0),t._labelCollection=void 0,l(t._removeCallbackFunc)&&t._removeCallbackFunc(),Je(t)}function Sl(e){e=A(e,A.EMPTY_OBJECT),this._scene=e.scene,this._batchTable=e.batchTable,this._textureAtlas=void 0,this._backgroundTextureAtlas=void 0,this._backgroundBillboardCollection=new Ka({scene:this._scene}),this._backgroundBillboardCollection.destroyTextureAtlas=!1,this._billboardCollection=new Ka({scene:this._scene,batchTable:this._batchTable}),this._billboardCollection.destroyTextureAtlas=!1,this._billboardCollection._sdf=!0,this._spareBillboards=[],this._glyphTextureCache={},this._labels=[],this._labelsToUpdate=[],this._totalGlyphCount=0,this._highlightColor=k.clone(k.WHITE),this.show=A(e.show,!0),this.modelMatrix=N.clone(A(e.modelMatrix,N.IDENTITY)),this.debugShowBoundingVolume=A(e.debugShowBoundingVolume,!1),this.blendOption=A(e.blendOption,Sr.OPAQUE_AND_TRANSLUCENT)}Object.defineProperties(Sl.prototype,{length:{get:function(){return this._labels.length}}});Sl.prototype.add=function(e){const t=new Af(e,this);return this._labels.push(t),this._labelsToUpdate.push(t),t};Sl.prototype.remove=function(e){if(l(e)&&e._labelCollection===this){const t=this._labels.indexOf(e);if(t!==-1)return this._labels.splice(t,1),goe(this,e),!0}return!1};Sl.prototype.removeAll=function(){const e=this._labels;for(let t=0,n=e.length;t<n;++t)goe(this,e[t]);e.length=0};Sl.prototype.contains=function(e){return l(e)&&e._labelCollection===this};Sl.prototype.get=function(e){if(!l(e))throw new w("index is required.");return this._labels[e]};Sl.prototype.update=function(e){if(!this.show)return;const t=this._billboardCollection,n=this._backgroundBillboardCollection;t.modelMatrix=this.modelMatrix,t.debugShowBoundingVolume=this.debugShowBoundingVolume,n.modelMatrix=this.modelMatrix,n.debugShowBoundingVolume=this.debugShowBoundingVolume;const i=e.context;l(this._textureAtlas)||(this._textureAtlas=new bd({context:i}),t.textureAtlas=this._textureAtlas),l(this._backgroundTextureAtlas)||(this._backgroundTextureAtlas=new bd({context:i,initialSize:u2}),n.textureAtlas=this._backgroundTextureAtlas,qst(this._backgroundTextureAtlas));const o=this._labelsToUpdate.length;for(let s=0;s<o;++s){const a=this._labelsToUpdate[s];if(a.isDestroyed())continue;const c=a._glyphs.length;a._rebindAllGlyphs&&(Xst(this,a),a._rebindAllGlyphs=!1),a._repositionAllGlyphs&&(Jst(a),a._repositionAllGlyphs=!1);const u=a._glyphs.length-c;this._totalGlyphCount+=u}const r=n.length>0?Sr.TRANSLUCENT:this.blendOption;t.blendOption=r,n.blendOption=r,t._highlightColor=this._highlightColor,n._highlightColor=this._highlightColor,this._labelsToUpdate.length=0,n.update(e),t.update(e)};Sl.prototype.isDestroyed=function(){return!1};Sl.prototype.destroy=function(){return this.removeAll(),this._billboardCollection=this._billboardCollection.destroy(),this._textureAtlas=this._textureAtlas&&this._textureAtlas.destroy(),this._backgroundBillboardCollection=this._backgroundBillboardCollection.destroy(),this._backgroundTextureAtlas=this._backgroundTextureAtlas&&this._backgroundTextureAtlas.destroy(),Je(this)};const Ac={};Ac.numberOfPoints=function(e,t,n){const i=d.distance(e,t);return Math.ceil(i/n)};Ac.numberOfPointsRhumbLine=function(e,t,n){const i=Math.pow(e.longitude-t.longitude,2)+Math.pow(e.latitude-t.latitude,2);return Math.max(1,Math.ceil(Math.sqrt(i/(n*n))))};const Qst=new ve;Ac.extractHeights=function(e,t){const n=e.length,i=new Array(n);for(let o=0;o<n;o++){const r=e[o];i[o]=t.cartesianToCartographic(r,Qst).height}return i};const Zst=new N,eat=new d,Lq=new d,tat=new Wt(d.UNIT_X,0),Bq=new d,nat=new Wt(d.UNIT_X,0),iat=new d,oat=new d,LU=[];function yoe(e,t,n){const i=LU;i.length=e;let o;if(t===n){for(o=0;o<e;o++)i[o]=t;return i}const s=(n-t)/e;for(o=0;o<e;o++){const a=t+o*s;i[o]=a}return i}const BP=new ve,a1=new ve,r_=new d,BU=new d,rat=new d,XR=new fp;let YC=new js;function sat(e,t,n,i,o,r,s,a){const c=i.scaleToGeodeticSurface(e,BU),u=i.scaleToGeodeticSurface(t,rat),f=Ac.numberOfPoints(e,t,n),h=i.cartesianToCartographic(c,BP),_=i.cartesianToCartographic(u,a1),g=yoe(f,o,r);XR.setEndPoints(h,_);const p=XR.surfaceDistance/f;let y=a;h.height=o;let T=i.cartographicToCartesian(h,r_);d.pack(T,s,y),y+=3;for(let b=1;b<f;b++){const x=XR.interpolateUsingSurfaceDistance(b*p,a1);x.height=g[b],T=i.cartographicToCartesian(x,r_),d.pack(T,s,y),y+=3}return y}function aat(e,t,n,i,o,r,s,a){const c=i.cartesianToCartographic(e,BP),u=i.cartesianToCartographic(t,a1),f=Ac.numberOfPointsRhumbLine(c,u,n);c.height=0,u.height=0;const h=yoe(f,o,r);YC.ellipsoid.equals(i)||(YC=new js(void 0,void 0,i)),YC.setEndPoints(c,u);const _=YC.surfaceDistance/f;let g=a;c.height=o;let p=i.cartographicToCartesian(c,r_);d.pack(p,s,g),g+=3;for(let y=1;y<f;y++){const T=YC.interpolateUsingSurfaceDistance(y*_,a1);T.height=h[y],p=i.cartographicToCartesian(T,r_),d.pack(p,s,g),g+=3}return g}Ac.wrapLongitude=function(e,t){const n=[],i=[];if(l(e)&&e.length>0){t=A(t,N.IDENTITY);const o=N.inverseTransformation(t,Zst),r=N.multiplyByPoint(o,d.ZERO,eat),s=d.normalize(N.multiplyByPointAsVector(o,d.UNIT_Y,Lq),Lq),a=Wt.fromPointNormal(r,s,tat),c=d.normalize(N.multiplyByPointAsVector(o,d.UNIT_X,Bq),Bq),u=Wt.fromPointNormal(r,c,nat);let f=1;n.push(d.clone(e[0]));let h=n[0];const _=e.length;for(let g=1;g<_;++g){const p=e[g];if(Wt.getPointDistance(u,h)<0||Wt.getPointDistance(u,p)<0){const y=qr.lineSegmentPlane(h,p,a,iat);if(l(y)){const T=d.multiplyByScalar(s,5e-9,oat);Wt.getPointDistance(a,h)<0&&d.negate(T,T),n.push(d.add(y,T,new d)),i.push(f+1),d.negate(T,T),n.push(d.add(y,T,new d)),f=1}}n.push(d.clone(e[g])),f++,h=p}i.push(f)}return{positions:n,lengths:i}};Ac.generateArc=function(e){l(e)||(e={});const t=e.positions;if(!l(t))throw new w("options.positions is required.");const n=t.length,i=A(e.ellipsoid,be.WGS84);let o=A(e.height,0);const r=Array.isArray(o);if(n<1)return[];if(n===1){const y=i.scaleToGeodeticSurface(t[0],BU);if(o=r?o[0]:o,o!==0){const T=i.geodeticSurfaceNormal(y,r_);d.multiplyByScalar(T,o,T),d.add(y,T,y)}return[y.x,y.y,y.z]}let s=e.minDistance;if(!l(s)){const y=A(e.granularity,F.RADIANS_PER_DEGREE);s=F.chordLength(y,i.maximumRadius)}let a=0,c;for(c=0;c<n-1;c++)a+=Ac.numberOfPoints(t[c],t[c+1],s);const u=(a+1)*3,f=new Array(u);let h=0;for(c=0;c<n-1;c++){const y=t[c],T=t[c+1],b=r?o[c]:o,x=r?o[c+1]:o;h=sat(y,T,s,i,b,x,f,h)}LU.length=0;const _=t[n-1],g=i.cartesianToCartographic(_,BP);g.height=r?o[n-1]:o;const p=i.cartographicToCartesian(g,r_);return d.pack(p,f,u-3),f};const Rq=new ve,cat=new ve;Ac.generateRhumbArc=function(e){l(e)||(e={});const t=e.positions;if(!l(t))throw new w("options.positions is required.");const n=t.length,i=A(e.ellipsoid,be.WGS84);let o=A(e.height,0);const r=Array.isArray(o);if(n<1)return[];if(n===1){const b=i.scaleToGeodeticSurface(t[0],BU);if(o=r?o[0]:o,o!==0){const x=i.geodeticSurfaceNormal(b,r_);d.multiplyByScalar(x,o,x),d.add(b,x,b)}return[b.x,b.y,b.z]}const s=A(e.granularity,F.RADIANS_PER_DEGREE);let a=0,c,u=i.cartesianToCartographic(t[0],Rq),f;for(c=0;c<n-1;c++)f=i.cartesianToCartographic(t[c+1],cat),a+=Ac.numberOfPointsRhumbLine(u,f,s),u=ve.clone(f,Rq);const h=(a+1)*3,_=new Array(h);let g=0;for(c=0;c<n-1;c++){const b=t[c],x=t[c+1],v=r?o[c]:o,D=r?o[c+1]:o;g=aat(b,x,s,i,v,D,_,g)}LU.length=0;const p=t[n-1],y=i.cartesianToCartographic(p,BP);y.height=r?o[n-1]:o;const T=i.cartographicToCartesian(y,r_);return d.pack(T,_,h-3),_};Ac.generateCartesianArc=function(e){const t=Ac.generateArc(e),n=t.length/3,i=new Array(n);for(let o=0;o<n;o++)i[o]=d.unpack(t,o*3);return i};Ac.generateCartesianRhumbArc=function(e){const t=Ac.generateRhumbArc(e),n=t.length/3,i=new Array(n);for(let o=0;o<n;o++)i[o]=d.unpack(t,o*3);return i};const Jr=Ac;function gs(e,t){e=A(e,A.EMPTY_OBJECT),this._show=A(e.show,!0),this._width=A(e.width,1),this._loop=A(e.loop,!1),this._distanceDisplayCondition=e.distanceDisplayCondition,this._material=e.material,l(this._material)||(this._material=$e.fromType($e.ColorType,{color:new k(1,1,1,1)}));let n=e.positions;l(n)||(n=[]),this._positions=n,this._actualPositions=Ya(n,d.equalsEpsilon),this._loop&&this._actualPositions.length>2&&(this._actualPositions===this._positions&&(this._actualPositions=n.slice()),this._actualPositions.push(d.clone(this._actualPositions[0]))),this._length=this._actualPositions.length,this._id=e.id;let i;l(t)&&(i=N.clone(t.modelMatrix)),this._modelMatrix=i,this._segments=Jr.wrapLongitude(this._actualPositions,i),this._actualLength=void 0,this._propertiesChanged=new Uint32Array(Toe),this._polylineCollection=t,this._dirty=!1,this._pickId=void 0,this._boundingVolume=Ae.fromPoints(this._actualPositions),this._boundingVolumeWC=Ae.transform(this._boundingVolume,this._modelMatrix),this._boundingVolume2D=new Ae}const Aoe=gs.POSITION_INDEX=0,lat=gs.SHOW_INDEX=1,uat=gs.WIDTH_INDEX=2,fat=gs.MATERIAL_INDEX=3,iE=gs.POSITION_SIZE_INDEX=4,dat=gs.DISTANCE_DISPLAY_CONDITION=5,Toe=gs.NUMBER_OF_PROPERTIES=6;function Ah(e,t){++e._propertiesChanged[t];const n=e._polylineCollection;l(n)&&(n._updatePolyline(e,t),e._dirty=!0)}Object.defineProperties(gs.prototype,{show:{get:function(){return this._show},set:function(e){if(!l(e))throw new w("value is required.");e!==this._show&&(this._show=e,Ah(this,lat))}},positions:{get:function(){return this._positions},set:function(e){if(!l(e))throw new w("value is required.");let t=Ya(e,d.equalsEpsilon);this._loop&&t.length>2&&(t===e&&(t=e.slice()),t.push(d.clone(t[0]))),(this._actualPositions.length!==t.length||this._actualPositions.length!==this._length)&&Ah(this,iE),this._positions=e,this._actualPositions=t,this._length=t.length,this._boundingVolume=Ae.fromPoints(this._actualPositions,this._boundingVolume),this._boundingVolumeWC=Ae.transform(this._boundingVolume,this._modelMatrix,this._boundingVolumeWC),Ah(this,Aoe),this.update()}},material:{get:function(){return this._material},set:function(e){if(!l(e))throw new w("material is required.");this._material!==e&&(this._material=e,Ah(this,fat))}},width:{get:function(){return this._width},set:function(e){if(!l(e))throw new w("value is required.");const t=this._width;e!==t&&(this._width=e,Ah(this,uat))}},loop:{get:function(){return this._loop},set:function(e){if(!l(e))throw new w("value is required.");if(e!==this._loop){let t=this._actualPositions;e?t.length>2&&!d.equals(t[0],t[t.length-1])&&(t.length===this._positions.length&&(this._actualPositions=t=this._positions.slice()),t.push(d.clone(t[0]))):t.length>2&&d.equals(t[0],t[t.length-1])&&(t.length-1===this._positions.length?this._actualPositions=this._positions:t.pop()),this._loop=e,Ah(this,iE)}}},id:{get:function(){return this._id},set:function(e){this._id=e,l(this._pickId)&&(this._pickId.object.id=e)}},pickId:{get:function(){return this._pickId}},isDestroyed:{get:function(){return!l(this._polylineCollection)}},distanceDisplayCondition:{get:function(){return this._distanceDisplayCondition},set:function(e){if(l(e)&&e.far<=e.near)throw new w("far distance must be greater than near distance.");sn.equals(e,this._distanceDisplayCondition)||(this._distanceDisplayCondition=sn.clone(e,this._distanceDisplayCondition),Ah(this,dat))}}});gs.prototype.update=function(){let e=N.IDENTITY;l(this._polylineCollection)&&(e=this._polylineCollection.modelMatrix);const t=this._segments.positions.length,n=this._segments.lengths,i=this._propertiesChanged[Aoe]>0||this._propertiesChanged[iE]>0;if((!N.equals(e,this._modelMatrix)||i)&&(this._segments=Jr.wrapLongitude(this._actualPositions,e),this._boundingVolumeWC=Ae.transform(this._boundingVolume,e,this._boundingVolumeWC)),this._modelMatrix=N.clone(e,this._modelMatrix),this._segments.positions.length!==t)Ah(this,iE);else{const o=n.length;for(let r=0;r<o;++r)if(n[r]!==this._segments.lengths[r]){Ah(this,iE);break}}};gs.prototype.getPickId=function(e){return l(this._pickId)||(this._pickId=e.createPickId({primitive:this,collection:this._polylineCollection,id:this._id})),this._pickId};gs.prototype._clean=function(){this._dirty=!1;const e=this._propertiesChanged;for(let t=0;t<Toe-1;++t)e[t]=0};gs.prototype._destroy=function(){this._pickId=this._pickId&&this._pickId.destroy(),this._material=this._material&&this._material.destroy(),this._polylineCollection=void 0};const hat=gs.SHOW_INDEX,pat=gs.WIDTH_INDEX,d2=gs.POSITION_INDEX,mat=gs.MATERIAL_INDEX,Nq=gs.POSITION_SIZE_INDEX,_at=gs.DISTANCE_DISPLAY_CONDITION,Coe=gs.NUMBER_OF_PROPERTIES,Bc={texCoordExpandAndBatchIndex:0,position3DHigh:1,position3DLow:2,position2DHigh:3,position2DLow:4,prevPosition3DHigh:5,prevPosition3DLow:6,prevPosition2DHigh:7,prevPosition2DLow:8,nextPosition3DHigh:9,nextPosition3DLow:10,nextPosition2DHigh:11,nextPosition2DLow:12};function Vc(e){e=A(e,A.EMPTY_OBJECT),this.show=A(e.show,!0),this.modelMatrix=N.clone(A(e.modelMatrix,N.IDENTITY)),this._modelMatrix=N.clone(N.IDENTITY),this.debugShowBoundingVolume=A(e.debugShowBoundingVolume,!1),this._opaqueRS=void 0,this._translucentRS=void 0,this._colorCommands=[],this._polylinesUpdated=!1,this._polylinesRemoved=!1,this._createVertexArray=!1,this._propertiesChanged=new Uint32Array(Coe),this._polylines=[],this._polylineBuckets={},this._positionBufferUsage={bufferUsage:mt.STATIC_DRAW,frameCount:0},this._mode=void 0,this._polylinesToUpdate=[],this._vertexArrays=[],this._positionBuffer=void 0,this._texCoordExpandAndBatchIndexBuffer=void 0,this._batchTable=void 0,this._createBatchTable=!1,this._useHighlightColor=!1,this._highlightColor=k.clone(k.WHITE);const t=this;this._uniformMap={u_highlightColor:function(){return t._highlightColor}}}Object.defineProperties(Vc.prototype,{length:{get:function(){return RU(this),this._polylines.length}}});Vc.prototype.add=function(e){const t=new gs(e,this);return t._index=this._polylines.length,this._polylines.push(t),this._createVertexArray=!0,this._createBatchTable=!0,t};Vc.prototype.remove=function(e){if(this.contains(e)){if(this._polylinesRemoved=!0,this._createVertexArray=!0,this._createBatchTable=!0,l(e._bucket)){const t=e._bucket;t.shaderProgram=t.shaderProgram&&t.shaderProgram.destroy()}return e._destroy(),!0}return!1};Vc.prototype.removeAll=function(){NU(this),Soe(this),this._polylineBuckets={},this._polylinesRemoved=!1,this._polylines.length=0,this._polylinesToUpdate.length=0,this._createVertexArray=!0};Vc.prototype.contains=function(e){return l(e)&&e._polylineCollection===this};Vc.prototype.get=function(e){if(!l(e))throw new w("index is required.");return RU(this),this._polylines[e]};function gat(e,t){l(e._batchTable)&&e._batchTable.destroy();const n=[{functionName:"batchTable_getWidthAndShow",componentDatatype:oe.UNSIGNED_BYTE,componentsPerAttribute:2},{functionName:"batchTable_getPickColor",componentDatatype:oe.UNSIGNED_BYTE,componentsPerAttribute:4,normalize:!0},{functionName:"batchTable_getCenterHigh",componentDatatype:oe.FLOAT,componentsPerAttribute:3},{functionName:"batchTable_getCenterLowAndRadius",componentDatatype:oe.FLOAT,componentsPerAttribute:4},{functionName:"batchTable_getDistanceDisplayCondition",componentDatatype:oe.FLOAT,componentsPerAttribute:2}];e._batchTable=new Bd(t,n,e._polylines.length)}const boe=new Zn,Eoe=new ue,xoe=new $;Vc.prototype.update=function(e){if(RU(this),this._polylines.length===0||!this.show)return;Eat(this,e);const t=e.context,n=e.mapProjection;let i,o=this._propertiesChanged;if(this._createBatchTable){if(Gt.maximumVertexTextureImageUnits===0)throw new Fe("Vertex texture fetch support is required to render polylines. The maximum number of vertex texture image units must be greater than zero.");gat(this,t),this._createBatchTable=!1}if(this._createVertexArray||Aat(this))zq(this,t,n);else if(this._polylinesUpdated){const c=this._polylinesToUpdate;if(this._mode!==me.SCENE3D){const u=c.length;for(let f=0;f<u;++f)i=c[f],i.update()}if(o[Nq]||o[mat])zq(this,t,n);else{const u=c.length,f=this._polylineBuckets;for(let h=0;h<u;++h){i=c[h],o=i._propertiesChanged;const _=i._bucket;let g=0;for(const p in f)if(f.hasOwnProperty(p)){if(f[p]===_){o[d2]&&_.writeUpdate(g,i,this._positionBuffer,n);break}g+=f[p].lengthOfPositions}if((o[hat]||o[pat])&&this._batchTable.setBatchedAttribute(i._index,0,new $(i._width,i._show)),this._batchTable.attributes.length>2){if(o[d2]||o[Nq]){const p=e.mode===me.SCENE2D?i._boundingVolume2D:i._boundingVolumeWC,y=Zn.fromCartesian(p.center,boe),T=ue.fromElements(y.low.x,y.low.y,y.low.z,p.radius,Eoe);this._batchTable.setBatchedAttribute(i._index,2,y.high),this._batchTable.setBatchedAttribute(i._index,3,T)}if(o[_at]){const p=xoe;p.x=0,p.y=Number.MAX_VALUE;const y=i.distanceDisplayCondition;l(y)&&(p.x=y.near,p.y=y.far),this._batchTable.setBatchedAttribute(i._index,4,p)}}i._clean()}}c.length=0,this._polylinesUpdated=!1}o=this._propertiesChanged;for(let c=0;c<Coe;++c)o[c]=0;let r=N.IDENTITY;e.mode===me.SCENE3D&&(r=this.modelMatrix);const s=e.passes,a=e.morphTime!==0;if((!l(this._opaqueRS)||this._opaqueRS.depthTest.enabled!==a)&&(this._opaqueRS=ht.fromCache({depthMask:a,depthTest:{enabled:a}})),(!l(this._translucentRS)||this._translucentRS.depthTest.enabled!==a)&&(this._translucentRS=ht.fromCache({blending:fo.ALPHA_BLEND,depthMask:!a,depthTest:{enabled:a}})),this._batchTable.update(e),s.render||s.pick){const c=this._colorCommands;yat(this,e,c,r)}};const $C=new Ae,Mq=new Ae;function yat(e,t,n,i){const o=t.context,r=t.commandList,s=n.length;let a=0,c=!0;const u=e._vertexArrays,f=e.debugShowBoundingVolume,_=e._batchTable.getUniformMapCallback(),g=u.length;for(let p=0;p<g;++p){const y=u[p],T=y.buckets,b=T.length;for(let x=0;x<b;++x){const v=T[x];let D=v.offset;const L=v.bucket.shaderProgram,B=v.bucket.polylines,V=B.length;let M,H,G=0,I,O;for(let m=0;m<V;++m){const P=B[m],R=Cat(P._material);if(R!==M){if(l(M)&&G>0){const Y=H.isTranslucent();a>=s?(I=new Dt({owner:e}),n.push(I)):I=n[a],++a,O=Ln(_(H._uniforms),e._uniformMap),I.boundingVolume=Ae.clone($C,I.boundingVolume),I.modelMatrix=i,I.shaderProgram=L,I.vertexArray=y.va,I.renderState=Y?e._translucentRS:e._opaqueRS,I.pass=Y?We.TRANSLUCENT:We.OPAQUE,I.debugShowBoundingVolume=f,I.pickId="v_pickColor",I.uniformMap=O,I.count=G,I.offset=D,D+=G,G=0,c=!0,r.push(I)}H=P._material,H.update(o),M=R}const U=P._locatorBuckets,W=U.length;for(let Y=0;Y<W;++Y){const j=U[Y];j.locator===v&&(G+=j.count)}let q;t.mode===me.SCENE3D?q=P._boundingVolumeWC:t.mode===me.COLUMBUS_VIEW?q=P._boundingVolume2D:t.mode===me.SCENE2D?l(P._boundingVolume2D)&&(q=Ae.clone(P._boundingVolume2D,Mq),q.center.x=0):l(P._boundingVolumeWC)&&l(P._boundingVolume2D)&&(q=Ae.union(P._boundingVolumeWC,P._boundingVolume2D,Mq)),c?(c=!1,Ae.clone(q,$C)):Ae.union(q,$C,$C)}l(M)&&G>0&&(a>=s?(I=new Dt({owner:e}),n.push(I)):I=n[a],++a,O=Ln(_(H._uniforms),e._uniformMap),I.boundingVolume=Ae.clone($C,I.boundingVolume),I.modelMatrix=i,I.shaderProgram=L,I.vertexArray=y.va,I.renderState=H.isTranslucent()?e._translucentRS:e._opaqueRS,I.pass=H.isTranslucent()?We.TRANSLUCENT:We.OPAQUE,I.debugShowBoundingVolume=f,I.pickId="v_pickColor",I.uniformMap=O,I.count=G,I.offset=D,c=!0,r.push(I)),M=void 0}}n.length=a}Vc.prototype.isDestroyed=function(){return!1};Vc.prototype.destroy=function(){return woe(this),NU(this),Soe(this),this._batchTable=this._batchTable&&this._batchTable.destroy(),Je(this)};function Aat(e){let t=!1;const n=e._propertiesChanged,i=e._positionBufferUsage;return n[d2]?(i.bufferUsage!==mt.STREAM_DRAW&&(t=!0,i.bufferUsage=mt.STREAM_DRAW),i.frameCount=100):i.bufferUsage!==mt.STATIC_DRAW&&(i.frameCount===0?(t=!0,i.bufferUsage=mt.STATIC_DRAW):i.frameCount--),t}const Fq=[0,0,0];function zq(e,t,n){e._createVertexArray=!1,NU(e),woe(e),bat(e);const i=[[]];let o=i[0];const r=e._batchTable,s=e._useHighlightColor,a=[0];let c=0;const u=[[]];let f=0;const h=e._polylineBuckets;let _,g;for(_ in h)h.hasOwnProperty(_)&&(g=h[_],g.updateShader(t,r,s),f+=g.lengthOfPositions);if(f>0){const p=e._mode,y=new Float32Array(6*f*3),T=new Float32Array(f*4);let b,x=0,v=0,D=0;for(_ in h)if(h.hasOwnProperty(_)){g=h[_],g.write(y,T,x,v,D,r,t,n),p===me.MORPHING&&(l(b)||(b=new Float32Array(6*f*3)),g.writeForMorph(b,x));const O=g.lengthOfPositions;x+=6*O*3,v+=O*4,D+=O*4,c=g.updateIndices(i,a,u,c)}const L=e._positionBufferUsage.bufferUsage,B=mt.STATIC_DRAW;e._positionBuffer=Mt.createVertexBuffer({context:t,typedArray:y,usage:L});let V;l(b)&&(V=Mt.createVertexBuffer({context:t,typedArray:b,usage:L})),e._texCoordExpandAndBatchIndexBuffer=Mt.createVertexBuffer({context:t,typedArray:T,usage:B});const M=3*Float32Array.BYTES_PER_ELEMENT,H=4*Float32Array.BYTES_PER_ELEMENT;let G=0;const I=i.length;for(let O=0;O<I;++O)if(o=i[O],o.length>0){const m=new Uint16Array(o),P=Mt.createIndexBuffer({context:t,typedArray:m,usage:mt.STATIC_DRAW,indexDatatype:At.UNSIGNED_SHORT});G+=a[O];const R=6*(O*(M*F.SIXTY_FOUR_KILOBYTES)-G*M),U=M+R,W=M+U,q=M+W,Y=M+q,j=M+Y,ee=O*(H*F.SIXTY_FOUR_KILOBYTES)-G*H,K=[{index:Bc.position3DHigh,componentsPerAttribute:3,componentDatatype:oe.FLOAT,offsetInBytes:R,strideInBytes:6*M},{index:Bc.position3DLow,componentsPerAttribute:3,componentDatatype:oe.FLOAT,offsetInBytes:U,strideInBytes:6*M},{index:Bc.position2DHigh,componentsPerAttribute:3,componentDatatype:oe.FLOAT,offsetInBytes:R,strideInBytes:6*M},{index:Bc.position2DLow,componentsPerAttribute:3,componentDatatype:oe.FLOAT,offsetInBytes:U,strideInBytes:6*M},{index:Bc.prevPosition3DHigh,componentsPerAttribute:3,componentDatatype:oe.FLOAT,offsetInBytes:W,strideInBytes:6*M},{index:Bc.prevPosition3DLow,componentsPerAttribute:3,componentDatatype:oe.FLOAT,offsetInBytes:q,strideInBytes:6*M},{index:Bc.prevPosition2DHigh,componentsPerAttribute:3,componentDatatype:oe.FLOAT,offsetInBytes:W,strideInBytes:6*M},{index:Bc.prevPosition2DLow,componentsPerAttribute:3,componentDatatype:oe.FLOAT,offsetInBytes:q,strideInBytes:6*M},{index:Bc.nextPosition3DHigh,componentsPerAttribute:3,componentDatatype:oe.FLOAT,offsetInBytes:Y,strideInBytes:6*M},{index:Bc.nextPosition3DLow,componentsPerAttribute:3,componentDatatype:oe.FLOAT,offsetInBytes:j,strideInBytes:6*M},{index:Bc.nextPosition2DHigh,componentsPerAttribute:3,componentDatatype:oe.FLOAT,offsetInBytes:Y,strideInBytes:6*M},{index:Bc.nextPosition2DLow,componentsPerAttribute:3,componentDatatype:oe.FLOAT,offsetInBytes:j,strideInBytes:6*M},{index:Bc.texCoordExpandAndBatchIndex,componentsPerAttribute:4,componentDatatype:oe.FLOAT,vertexBuffer:e._texCoordExpandAndBatchIndexBuffer,offsetInBytes:ee}];let se,Q,Z,J;p===me.SCENE3D?(Q=e._positionBuffer,se="vertexBuffer",Z=Fq,J="value"):p===me.SCENE2D||p===me.COLUMBUS_VIEW?(Q=Fq,se="value",Z=e._positionBuffer,J="vertexBuffer"):(Q=V,se="vertexBuffer",Z=e._positionBuffer,J="vertexBuffer"),K[0][se]=Q,K[1][se]=Q,K[2][J]=Z,K[3][J]=Z,K[4][se]=Q,K[5][se]=Q,K[6][J]=Z,K[7][J]=Z,K[8][se]=Q,K[9][se]=Q,K[10][J]=Z,K[11][J]=Z;const de=new Fo({context:t,attributes:K,indexBuffer:P});e._vertexArrays.push({va:de,buckets:u[O]})}}}function Tat(e,t){return t instanceof rn?t.id:t}const Nv=[];function Cat(e){const t=$e._uniformList[e.type],n=t.length;Nv.length=2*n;let i=0;for(let o=0;o<n;++o){const r=t[o];Nv[i]=r,Nv[i+1]=e._uniforms[r](),i+=2}return`${e.type}:${JSON.stringify(Nv,Tat)}`}function bat(e){const t=e._mode,n=e._modelMatrix,i=e._polylineBuckets={},o=e._polylines,r=o.length;for(let s=0;s<r;++s){const a=o[s];if(a._actualPositions.length>1){a.update();const c=a.material;let u=i[c.type];l(u)||(u=i[c.type]=new qd(c,t,n)),u.addPolyline(a)}}}function Eat(e,t){const n=t.mode;(e._mode!==n||!N.equals(e._modelMatrix,e.modelMatrix))&&(e._mode=n,e._modelMatrix=N.clone(e.modelMatrix),e._createVertexArray=!0)}function RU(e){if(e._polylinesRemoved){e._polylinesRemoved=!1;const t=[],n=[];let i=0,o;const r=e._polylines.length;for(let s=0;s<r;++s)o=e._polylines[s],o.isDestroyed||(o._index=i++,n.push(o),t.push(o));e._polylines=t,e._polylinesToUpdate=n}}function NU(e){const t=e._polylines,n=t.length;for(let i=0;i<n;++i)if(!t[i].isDestroyed){const o=t[i]._bucket;l(o)&&(o.shaderProgram=o.shaderProgram&&o.shaderProgram.destroy())}}function woe(e){const t=e._vertexArrays.length;for(let n=0;n<t;++n)e._vertexArrays[n].va.destroy();e._vertexArrays.length=0}Vc.prototype._updatePolyline=function(e,t){this._polylinesUpdated=!0,e._dirty||this._polylinesToUpdate.push(e),++this._propertiesChanged[t]};function Soe(e){const t=e._polylines,n=t.length;for(let i=0;i<n;++i)t[i].isDestroyed||t[i]._destroy()}function KR(e,t,n){this.count=e,this.offset=t,this.bucket=n}function qd(e,t,n){this.polylines=[],this.lengthOfPositions=0,this.material=e,this.shaderProgram=void 0,this.mode=t,this.modelMatrix=n}qd.prototype.addPolyline=function(e){this.polylines.push(e),e._actualLength=this.getPolylinePositionsLength(e),this.lengthOfPositions+=e._actualLength,e._bucket=this};qd.prototype.updateShader=function(e,t,n){if(l(this.shaderProgram))return;const i=["DISTANCE_DISPLAY_CONDITION"];n&&i.push("VECTOR_TILE"),this.material.shaderSource.search(/varying\s+float\s+v_polylineAngle;/g)!==-1&&i.push("POLYLINE_DASH"),Mn.isInternetExplorer()||i.push("CLIP_POLYLINE");const o=new nt({defines:i,sources:[`varying vec4 v_pickColor;
|
||
`,this.material.shaderSource,XK]}),r=t.getVertexShaderCallback()(kOe),s=new nt({defines:i,sources:[mx,r]});this.shaderProgram=Hn.fromCache({context:e,vertexShaderSource:s,fragmentShaderSource:o,attributeLocations:Bc})};function voe(e){return d.dot(d.UNIT_X,e._boundingVolume.center)<0||e._boundingVolume.intersectPlane(Wt.ORIGIN_ZX_PLANE)===Vn.INTERSECTING}qd.prototype.getPolylinePositionsLength=function(e){let t;if(this.mode===me.SCENE3D||!voe(e))return t=e._actualPositions.length,t*4-4;let n=0;const i=e._segments.lengths;t=i.length;for(let o=0;o<t;++o)n+=i[o]*4-4;return n};const rs=new d,Jl=new d,Ql=new d,c1=new d,xat=new ue,wat=new $;qd.prototype.write=function(e,t,n,i,o,r,s,a){const c=this.mode,u=a.ellipsoid.maximumRadius*F.PI,f=this.polylines,h=f.length;for(let _=0;_<h;++_){const g=f[_],p=g.width,y=g.show&&p>0,T=g._index,b=this.getSegments(g,a),x=b.positions,v=b.lengths,D=x.length,L=g.getPickId(s).color;let B=0,V=0,M;for(let W=0;W<D;++W){W===0?g._loop?M=x[D-2]:(M=c1,d.subtract(x[0],x[1],M),d.add(x[0],M,M)):M=x[W-1],d.clone(M,Jl),d.clone(x[W],rs),W===D-1?g._loop?M=x[1]:(M=c1,d.subtract(x[D-1],x[D-2],M),d.add(x[D-1],M,M)):M=x[W+1],d.clone(M,Ql);const q=v[B];W===V+q&&(V+=q,++B);const Y=W-V===0,j=W===V+v[B]-1;c===me.SCENE2D&&(Jl.z=0,rs.z=0,Ql.z=0),(c===me.SCENE2D||c===me.MORPHING)&&(Y||j)&&u-Math.abs(rs.x)<1&&((rs.x<0&&Jl.x>0||rs.x>0&&Jl.x<0)&&d.clone(rs,Jl),(rs.x<0&&Ql.x>0||rs.x>0&&Ql.x<0)&&d.clone(rs,Ql));const ee=Y?2:0,K=j?2:4;for(let se=ee;se<K;++se){Zn.writeElements(rs,e,n),Zn.writeElements(Jl,e,n+6),Zn.writeElements(Ql,e,n+12);const Q=se-2<0?-1:1;t[o]=W/(D-1),t[o+1]=2*(se%2)-1,t[o+2]=Q,t[o+3]=T,n+=6*3,o+=4}}const H=xat;H.x=k.floatToByte(L.red),H.y=k.floatToByte(L.green),H.z=k.floatToByte(L.blue),H.w=k.floatToByte(L.alpha);const G=wat;G.x=p,G.y=y?1:0;const I=c===me.SCENE2D?g._boundingVolume2D:g._boundingVolumeWC,O=Zn.fromCartesian(I.center,boe),m=O.high,P=ue.fromElements(O.low.x,O.low.y,O.low.z,I.radius,Eoe),R=xoe;R.x=0,R.y=Number.MAX_VALUE;const U=g.distanceDisplayCondition;l(U)&&(R.x=U.near,R.y=U.far),r.setBatchedAttribute(T,0,G),r.setBatchedAttribute(T,1,H),r.attributes.length>2&&(r.setBatchedAttribute(T,2,m),r.setBatchedAttribute(T,3,P),r.setBatchedAttribute(T,4,R))}};const Sat=new d,vat=new d,Dat=new d,Uq=new d;qd.prototype.writeForMorph=function(e,t){const n=this.modelMatrix,i=this.polylines,o=i.length;for(let r=0;r<o;++r){const s=i[r],a=s._segments.positions,c=s._segments.lengths,u=a.length;let f=0,h=0;for(let _=0;_<u;++_){let g;_===0?s._loop?g=a[u-2]:(g=Uq,d.subtract(a[0],a[1],g),d.add(a[0],g,g)):g=a[_-1],g=N.multiplyByPoint(n,g,vat);const p=N.multiplyByPoint(n,a[_],Sat);let y;_===u-1?s._loop?y=a[1]:(y=Uq,d.subtract(a[u-1],a[u-2],y),d.add(a[u-1],y,y)):y=a[_+1],y=N.multiplyByPoint(n,y,Dat);const T=c[f];_===h+T&&(h+=T,++f);const b=_-h===0,x=_===h+c[f]-1,v=b?2:0,D=x?2:4;for(let L=v;L<D;++L)Zn.writeElements(p,e,t),Zn.writeElements(g,e,t+6),Zn.writeElements(y,e,t+12),t+=6*3}}};const Iat=new Array(1);qd.prototype.updateIndices=function(e,t,n,i){let o=n.length-1,r=new KR(0,i,this);n[o].push(r);let s=0,a=e[e.length-1],c=0;a.length>0&&(c=a[a.length-1]+1);const u=this.polylines,f=u.length;for(let h=0;h<f;++h){const _=u[h];_._locatorBuckets=[];let g;if(this.mode===me.SCENE3D){g=Iat;const y=_._actualPositions.length;if(y>0)g[0]=y;else continue}else g=_._segments.lengths;const p=g.length;if(p>0){let y=0;for(let T=0;T<p;++T){const b=g[T]-1;for(let x=0;x<b;++x)c+4>F.SIXTY_FOUR_KILOBYTES&&(_._locatorBuckets.push({locator:r,count:y}),y=0,t.push(4),a=[],e.push(a),c=0,r.count=s,s=0,i=0,r=new KR(0,0,this),n[++o]=[r]),a.push(c,c+2,c+1),a.push(c+1,c+2,c+3),y+=6,s+=6,i+=6,c+=4}_._locatorBuckets.push({locator:r,count:y}),c+4>F.SIXTY_FOUR_KILOBYTES&&(t.push(0),a=[],e.push(a),c=0,r.count=s,i=0,s=0,r=new KR(0,0,this),n[++o]=[r])}_._clean()}return r.count=s,i};qd.prototype.getPolylineStartIndex=function(e){const t=this.polylines;let n=0;const i=t.length;for(let o=0;o<i;++o){const r=t[o];if(r===e)break;n+=r._actualLength}return n};const R0={positions:void 0,lengths:void 0},Hq=new Array(1),Pat=new d,Oat=new ve;qd.prototype.getSegments=function(e,t){let n=e._actualPositions;if(this.mode===me.SCENE3D)return Hq[0]=n.length,R0.positions=n,R0.lengths=Hq,R0;voe(e)&&(n=e._segments.positions);const i=t.ellipsoid,o=[],r=this.modelMatrix,s=n.length;let a,c=Pat;for(let u=0;u<s;++u)a=n[u],c=N.multiplyByPoint(r,a,c),o.push(t.project(i.cartesianToCartographic(c,Oat)));if(o.length>0){e._boundingVolume2D=Ae.fromPoints(o,e._boundingVolume2D);const u=e._boundingVolume2D.center;e._boundingVolume2D.center=new d(u.z,u.x,u.y)}return R0.positions=o,R0.lengths=e._segments.lengths,R0};let Vq;qd.prototype.writeUpdate=function(e,t,n,i){const o=this.mode,r=i.ellipsoid.maximumRadius*F.PI;let s=t._actualLength;if(s){e+=this.getPolylineStartIndex(t);let a=Vq;const c=6*s*3;!l(a)||a.length<c?a=Vq=new Float32Array(c):a.length>c&&(a=new Float32Array(a.buffer,0,c));const u=this.getSegments(t,i),f=u.positions,h=u.lengths;let _=0,g=0,p=0,y;s=f.length;for(let T=0;T<s;++T){T===0?t._loop?y=f[s-2]:(y=c1,d.subtract(f[0],f[1],y),d.add(f[0],y,y)):y=f[T-1],d.clone(y,Jl),d.clone(f[T],rs),T===s-1?t._loop?y=f[1]:(y=c1,d.subtract(f[s-1],f[s-2],y),d.add(f[s-1],y,y)):y=f[T+1],d.clone(y,Ql);const b=h[g];T===p+b&&(p+=b,++g);const x=T-p===0,v=T===p+h[g]-1;o===me.SCENE2D&&(Jl.z=0,rs.z=0,Ql.z=0),(o===me.SCENE2D||o===me.MORPHING)&&(x||v)&&r-Math.abs(rs.x)<1&&((rs.x<0&&Jl.x>0||rs.x>0&&Jl.x<0)&&d.clone(rs,Jl),(rs.x<0&&Ql.x>0||rs.x>0&&Ql.x<0)&&d.clone(rs,Ql));const D=x?2:0,L=v?2:4;for(let B=D;B<L;++B)Zn.writeElements(rs,a,_),Zn.writeElements(Jl,a,_+6),Zn.writeElements(Ql,a,_+12),_+=6*3}n.copyFromArrayView(a,6*3*Float32Array.BYTES_PER_ELEMENT*e)}};function v_(e){this._positions=e.positions,this._batchTable=e.batchTable,this._batchIds=e.batchIds,this._rectangle=e.rectangle,this._minHeight=e.minimumHeight,this._maxHeight=e.maximumHeight,this._billboardCollection=new Ka({batchTable:e.batchTable}),this._labelCollection=new Sl({batchTable:e.batchTable}),this._polylineCollection=new Vc,this._polylineCollection._useHighlightColor=!0,this._verticesPromise=void 0,this._packedBuffer=void 0,this._ready=!1,this._update=function(t,n){},this._readyPromise=Gat(this)}Object.defineProperties(v_.prototype,{pointsLength:{get:function(){return this._billboardCollection.length}},texturesByteLength:{get:function(){const e=this._billboardCollection.textureAtlas.texture.sizeInBytes,t=this._labelCollection._textureAtlas.texture.sizeInBytes;return e+t}},readyPromise:{get:function(){return this._readyPromise}}});function Lat(e,t){const n=e._rectangle,i=e._minHeight,o=e._maxHeight,r=2+Ee.packedLength+be.packedLength,s=new Float64Array(r);let a=0;return s[a++]=i,s[a++]=o,Ee.pack(n,s,a),a+=Ee.packedLength,be.pack(t,s,a),s}const Bat=new lo("createVectorTilePoints",5),Rat=new d;function Nat(e,t){let n;if(!l(e._verticesPromise)){n=e._positions;let i=e._packedBuffer;l(i)||(n=e._positions=n.slice(),e._batchIds=e._batchIds.slice(),i=e._packedBuffer=Lat(e,t));const o=[n.buffer,i.buffer],r={positions:n.buffer,packedBuffer:i.buffer},s=e._verticesPromise=Bat.scheduleTask(r,o);return l(s)?s.then(function(a){e._positions=new Float64Array(a.positions);const c=e._billboardCollection,u=e._labelCollection,f=e._polylineCollection;n=e._positions;const h=e._batchIds,_=n.length/3;for(let g=0;g<_;++g){const p=h[g],y=d.unpack(n,g*3,Rat),T=c.add();T.position=y,T._batchIndex=p;const b=u.add();b.text=" ",b.position=y,b._batchIndex=p;const x=f.add();x.positions=[d.clone(y),d.clone(y)]}e._positions=void 0,e._packedBuffer=void 0,e._ready=!0}):void 0}}v_.prototype.createFeatures=function(e,t){const n=this._billboardCollection,i=this._labelCollection,o=this._polylineCollection,r=this._batchIds,s=r.length;for(let a=0;a<s;++a){const c=r[a],u=n.get(a),f=i.get(a),h=o.get(a);t[c]=new kr(e,c,u,f,h)}};v_.prototype.applyDebugSettings=function(e,t){e?(k.clone(t,this._billboardCollection._highlightColor),k.clone(t,this._labelCollection._highlightColor),k.clone(t,this._polylineCollection._highlightColor)):(k.clone(k.WHITE,this._billboardCollection._highlightColor),k.clone(k.WHITE,this._labelCollection._highlightColor),k.clone(k.WHITE,this._polylineCollection._highlightColor))};function Mat(e,t){const n=e._batchIds,i=n.length;for(let o=0;o<i;++o){const r=n[o],s=t[r];s.show=!0,s.pointSize=kr.defaultPointSize,s.color=kr.defaultColor,s.pointOutlineColor=kr.defaultPointOutlineColor,s.pointOutlineWidth=kr.defaultPointOutlineWidth,s.labelColor=k.WHITE,s.labelOutlineColor=k.WHITE,s.labelOutlineWidth=1,s.font="30px sans-serif",s.labelStyle=nf.FILL,s.labelText=void 0,s.backgroundColor=new k(.165,.165,.165,.8),s.backgroundPadding=new $(7,5),s.backgroundEnabled=!1,s.scaleByDistance=void 0,s.translucencyByDistance=void 0,s.distanceDisplayCondition=void 0,s.heightOffset=0,s.anchorLineEnabled=!1,s.anchorLineColor=k.WHITE,s.image=void 0,s.disableDepthTestDistance=0,s.horizontalOrigin=yc.CENTER,s.verticalOrigin=co.CENTER,s.labelHorizontalOrigin=yc.RIGHT,s.labelVerticalOrigin=co.BASELINE}}const Fat=new k,zat=new k,Uat=new k,Hat=new k,Vat=new k,kat=new k,XC=new tn,KC=new tn,JR=new sn;v_.prototype.applyStyle=function(e,t){if(!l(e)){Mat(this,t);return}const n=this._batchIds,i=n.length;for(let o=0;o<i;++o){const r=n[o],s=t[r];if(l(e.show)&&(s.show=e.show.evaluate(s)),l(e.pointSize)&&(s.pointSize=e.pointSize.evaluate(s)),l(e.color)&&(s.color=e.color.evaluateColor(s,Fat)),l(e.pointOutlineColor)&&(s.pointOutlineColor=e.pointOutlineColor.evaluateColor(s,zat)),l(e.pointOutlineWidth)&&(s.pointOutlineWidth=e.pointOutlineWidth.evaluate(s)),l(e.labelColor)&&(s.labelColor=e.labelColor.evaluateColor(s,Uat)),l(e.labelOutlineColor)&&(s.labelOutlineColor=e.labelOutlineColor.evaluateColor(s,Hat)),l(e.labelOutlineWidth)&&(s.labelOutlineWidth=e.labelOutlineWidth.evaluate(s)),l(e.font)&&(s.font=e.font.evaluate(s)),l(e.labelStyle)&&(s.labelStyle=e.labelStyle.evaluate(s)),l(e.labelText)?s.labelText=e.labelText.evaluate(s):s.labelText=void 0,l(e.backgroundColor)&&(s.backgroundColor=e.backgroundColor.evaluateColor(s,Vat)),l(e.backgroundPadding)&&(s.backgroundPadding=e.backgroundPadding.evaluate(s)),l(e.backgroundEnabled)&&(s.backgroundEnabled=e.backgroundEnabled.evaluate(s)),l(e.scaleByDistance)){const a=e.scaleByDistance.evaluate(s);XC.near=a.x,XC.nearValue=a.y,XC.far=a.z,XC.farValue=a.w,s.scaleByDistance=XC}else s.scaleByDistance=void 0;if(l(e.translucencyByDistance)){const a=e.translucencyByDistance.evaluate(s);KC.near=a.x,KC.nearValue=a.y,KC.far=a.z,KC.farValue=a.w,s.translucencyByDistance=KC}else s.translucencyByDistance=void 0;if(l(e.distanceDisplayCondition)){const a=e.distanceDisplayCondition.evaluate(s);JR.near=a.x,JR.far=a.y,s.distanceDisplayCondition=JR}else s.distanceDisplayCondition=void 0;l(e.heightOffset)&&(s.heightOffset=e.heightOffset.evaluate(s)),l(e.anchorLineEnabled)&&(s.anchorLineEnabled=e.anchorLineEnabled.evaluate(s)),l(e.anchorLineColor)&&(s.anchorLineColor=e.anchorLineColor.evaluateColor(s,kat)),l(e.image)?s.image=e.image.evaluate(s):s.image=void 0,l(e.disableDepthTestDistance)&&(s.disableDepthTestDistance=e.disableDepthTestDistance.evaluate(s)),l(e.horizontalOrigin)&&(s.horizontalOrigin=e.horizontalOrigin.evaluate(s)),l(e.verticalOrigin)&&(s.verticalOrigin=e.verticalOrigin.evaluate(s)),l(e.labelHorizontalOrigin)&&(s.labelHorizontalOrigin=e.labelHorizontalOrigin.evaluate(s)),l(e.labelVerticalOrigin)&&(s.labelVerticalOrigin=e.labelVerticalOrigin.evaluate(s))}};function Gat(e){return new Promise(function(t,n){e._update=function(i,o){const r=Nat(i,o.mapProjection.ellipsoid);i._ready&&(i._polylineCollection.update(o),i._billboardCollection.update(o),i._labelCollection.update(o)),l(r)&&r.then(function(){t()}).catch(function(s){n(s)})}})}v_.prototype.update=function(e){this._update(this,e)};v_.prototype.isDestroyed=function(){return!1};v_.prototype.destroy=function(){return this._billboardCollection=this._billboardCollection&&this._billboardCollection.destroy(),this._labelCollection=this._labelCollection&&this._labelCollection.destroy(),this._polylineCollection=this._polylineCollection&&this._polylineCollection.destroy(),Je(this)};function Tp(e){this._batchTable=e.batchTable,this._batchIds=e.batchIds,this._positions=e.positions,this._counts=e.counts,this._indices=e.indices,this._indexCounts=e.indexCounts,this._indexOffsets=void 0,this._batchTableColors=void 0,this._packedBuffer=void 0,this._batchedPositions=void 0,this._transferrableBatchIds=void 0,this._vertexBatchIds=void 0,this._ellipsoid=A(e.ellipsoid,be.WGS84),this._minimumHeight=e.minimumHeight,this._maximumHeight=e.maximumHeight,this._polygonMinimumHeights=e.polygonMinimumHeights,this._polygonMaximumHeights=e.polygonMaximumHeights,this._center=A(e.center,d.ZERO),this._rectangle=e.rectangle,this._center=void 0,this._boundingVolume=e.boundingVolume,this._boundingVolumes=void 0,this._batchedIndices=void 0,this._ready=!1,this._update=function(t,n){},this._readyPromise=Kat(this),this._verticesPromise=void 0,this._primitive=void 0,this.debugWireframe=!1,this.forceRebatch=!1,this.classificationType=ir.BOTH}Object.defineProperties(Tp.prototype,{trianglesLength:{get:function(){return l(this._primitive)?this._primitive.trianglesLength:0}},geometryByteLength:{get:function(){return l(this._primitive)?this._primitive.geometryByteLength:0}},readyPromise:{get:function(){return this._readyPromise}}});function Wat(e){const t=new Float64Array(3+d.packedLength+be.packedLength+Ee.packedLength);let n=0;return t[n++]=e._indices.BYTES_PER_ELEMENT,t[n++]=e._minimumHeight,t[n++]=e._maximumHeight,d.pack(e._center,t,n),n+=d.packedLength,be.pack(e._ellipsoid,t,n),n+=be.packedLength,Ee.pack(e._rectangle,t,n),t}function qat(e,t){let n=1;const i=t[n++],o=e._boundingVolumes=new Array(i);for(let a=0;a<i;++a)o[a]=Zt.unpack(t,n),n+=Zt.packedLength;const r=t[n++],s=e._batchedIndices=new Array(r);for(let a=0;a<r;++a){const c=k.unpack(t,n);n+=k.packedLength;const u=t[n++],f=t[n++],h=t[n++],_=new Array(h);for(let g=0;g<h;++g)_[g]=t[n++];s[a]=new YI({color:c,offset:u,count:f,batchIds:_})}}const jat=new lo("createVectorTilePolygons",5),Yat=new k;function $at(e){if(!l(e._primitive)&&!l(e._verticesPromise)){let t=e._positions,n=e._counts,i=e._indexCounts,o=e._indices,r=e._transferrableBatchIds,s=e._batchTableColors,a=e._packedBuffer;if(!l(s)){t=e._positions=e._positions.slice(),n=e._counts=e._counts.slice(),i=e._indexCounts=e._indexCounts.slice(),o=e._indices=e._indices.slice(),e._center=e._ellipsoid.cartographicToCartesian(Ee.center(e._rectangle)),r=e._transferrableBatchIds=new Uint32Array(e._batchIds),s=e._batchTableColors=new Uint32Array(r.length);const g=e._batchTable,p=s.length;for(let y=0;y<p;++y){const T=g.getColor(y,Yat);s[y]=T.toRgba()}a=e._packedBuffer=Wat(e)}const c=[t.buffer,n.buffer,i.buffer,o.buffer,r.buffer,s.buffer,a.buffer],u={packedBuffer:a.buffer,positions:t.buffer,counts:n.buffer,indexCounts:i.buffer,indices:o.buffer,batchIds:r.buffer,batchTableColors:s.buffer};let f=e._polygonMinimumHeights,h=e._polygonMaximumHeights;l(f)&&l(h)&&(f=f.slice(),h=h.slice(),c.push(f.buffer,h.buffer),u.minimumHeights=f,u.maximumHeights=h);const _=e._verticesPromise=jat.scheduleTask(u,c);return l(_)?_.then(function(g){e._positions=void 0,e._counts=void 0,e._polygonMinimumHeights=void 0,e._polygonMaximumHeights=void 0;const p=new Float64Array(g.packedBuffer),y=p[0];qat(e,p),e._indices=At.getSizeInBytes(y)===2?new Uint16Array(g.indices):new Uint32Array(g.indices),e._indexOffsets=new Uint32Array(g.indexOffsets),e._indexCounts=new Uint32Array(g.indexCounts),e._batchedPositions=new Float32Array(g.positions),e._vertexBatchIds=new Uint16Array(g.batchIds),e._ready=!0}):void 0}}function Xat(e){e._ready&&!l(e._primitive)&&(e._primitive=new Hd({batchTable:e._batchTable,positions:e._batchedPositions,batchIds:e._batchIds,vertexBatchIds:e._vertexBatchIds,indices:e._indices,indexOffsets:e._indexOffsets,indexCounts:e._indexCounts,batchedIndices:e._batchedIndices,boundingVolume:e._boundingVolume,boundingVolumes:e._boundingVolumes,center:e._center}),e._batchTable=void 0,e._batchIds=void 0,e._positions=void 0,e._counts=void 0,e._indices=void 0,e._indexCounts=void 0,e._indexOffsets=void 0,e._batchTableColors=void 0,e._packedBuffer=void 0,e._batchedPositions=void 0,e._transferrableBatchIds=void 0,e._vertexBatchIds=void 0,e._ellipsoid=void 0,e._minimumHeight=void 0,e._maximumHeight=void 0,e._polygonMinimumHeights=void 0,e._polygonMaximumHeights=void 0,e._center=void 0,e._rectangle=void 0,e._boundingVolume=void 0,e._boundingVolumes=void 0,e._batchedIndices=void 0,e._verticesPromise=void 0)}Tp.prototype.createFeatures=function(e,t){this._primitive.createFeatures(e,t)};Tp.prototype.applyDebugSettings=function(e,t){this._primitive.applyDebugSettings(e,t)};Tp.prototype.applyStyle=function(e,t){this._primitive.applyStyle(e,t)};Tp.prototype.updateCommands=function(e,t){this._primitive.updateCommands(e,t)};function Kat(e){return new Promise(function(t,n){e._update=function(i,o){const r=$at(i);i._ready&&(i._primitive.debugWireframe=i.debugWireframe,i._primitive.forceRebatch=i.forceRebatch,i._primitive.classificationType=i.classificationType,i._primitive.update(o)),l(r)&&r.then(function(){Xat(i),t(i)}).catch(function(s){n(s)})}})}Tp.prototype.update=function(e){this._update(this,e)};Tp.prototype.isDestroyed=function(){return!1};Tp.prototype.destroy=function(){return this._primitive=this._primitive&&this._primitive.destroy(),Je(this)};function yu(e){this._positions=e.positions,this._widths=e.widths,this._counts=e.counts,this._batchIds=e.batchIds,this._ellipsoid=A(e.ellipsoid,be.WGS84),this._minimumHeight=e.minimumHeight,this._maximumHeight=e.maximumHeight,this._center=e.center,this._rectangle=e.rectangle,this._boundingVolume=e.boundingVolume,this._batchTable=e.batchTable,this._va=void 0,this._sp=void 0,this._rs=void 0,this._uniformMap=void 0,this._command=void 0,this._transferrableBatchIds=void 0,this._packedBuffer=void 0,this._keepDecodedPositions=e.keepDecodedPositions,this._decodedPositions=void 0,this._decodedPositionOffsets=void 0,this._currentPositions=void 0,this._previousPositions=void 0,this._nextPositions=void 0,this._expandAndWidth=void 0,this._vertexBatchIds=void 0,this._indices=void 0,this._constantColor=k.clone(k.WHITE),this._highlightColor=this._constantColor,this._trianglesLength=0,this._geometryByteLength=0,this._ready=!1,this._update=function(t,n){},this._readyPromise=uct(this),this._verticesPromise=void 0}Object.defineProperties(yu.prototype,{trianglesLength:{get:function(){return this._trianglesLength}},geometryByteLength:{get:function(){return this._geometryByteLength}},readyPromise:{get:function(){return this._readyPromise}}});function Jat(e){const t=e._rectangle,n=e._minimumHeight,i=e._maximumHeight,o=e._ellipsoid,r=e._center,s=2+Ee.packedLength+be.packedLength+d.packedLength,a=new Float64Array(s);let c=0;return a[c++]=n,a[c++]=i,Ee.pack(t,a,c),c+=Ee.packedLength,be.pack(o,a,c),c+=be.packedLength,d.pack(r,a,c),a}const Qat=new lo("createVectorTilePolylines",5),oA={previousPosition:0,currentPosition:1,nextPosition:2,expandAndWidth:3,a_batchId:4};function Zat(e,t){if(!l(e._va)&&!l(e._verticesPromise)){let n=e._positions,i=e._widths,o=e._counts,r=e._transferrableBatchIds,s=e._packedBuffer;l(s)||(n=e._positions=n.slice(),i=e._widths=i.slice(),o=e._counts=o.slice(),r=e._transferrableBatchIds=e._batchIds.slice(),s=e._packedBuffer=Jat(e));const a=[n.buffer,i.buffer,o.buffer,r.buffer,s.buffer],c={positions:n.buffer,widths:i.buffer,counts:o.buffer,batchIds:r.buffer,packedBuffer:s.buffer,keepDecodedPositions:e._keepDecodedPositions},u=e._verticesPromise=Qat.scheduleTask(c,a);return l(u)?u.then(function(f){e._keepDecodedPositions&&(e._decodedPositions=new Float64Array(f.decodedPositions),e._decodedPositionOffsets=new Uint32Array(f.decodedPositionOffsets)),e._currentPositions=new Float32Array(f.currentPositions),e._previousPositions=new Float32Array(f.previousPositions),e._nextPositions=new Float32Array(f.nextPositions),e._expandAndWidth=new Float32Array(f.expandAndWidth),e._vertexBatchIds=new Uint16Array(f.batchIds);const h=f.indexDatatype;e._indices=h===At.UNSIGNED_SHORT?new Uint16Array(f.indices):new Uint32Array(f.indices),e._ready=!0}):void 0}}function ect(e,t){if(e._ready&&!l(e._va)){const n=e._currentPositions,i=e._previousPositions,o=e._nextPositions,r=e._expandAndWidth,s=e._vertexBatchIds,a=e._indices;let c=i.byteLength+n.byteLength+o.byteLength;c+=r.byteLength+s.byteLength+a.byteLength,e._trianglesLength=a.length/3,e._geometryByteLength=c;const u=Mt.createVertexBuffer({context:t,typedArray:i,usage:mt.STATIC_DRAW}),f=Mt.createVertexBuffer({context:t,typedArray:n,usage:mt.STATIC_DRAW}),h=Mt.createVertexBuffer({context:t,typedArray:o,usage:mt.STATIC_DRAW}),_=Mt.createVertexBuffer({context:t,typedArray:r,usage:mt.STATIC_DRAW}),g=Mt.createVertexBuffer({context:t,typedArray:s,usage:mt.STATIC_DRAW}),p=Mt.createIndexBuffer({context:t,typedArray:a,usage:mt.STATIC_DRAW,indexDatatype:a.BYTES_PER_ELEMENT===2?At.UNSIGNED_SHORT:At.UNSIGNED_INT}),y=[{index:oA.previousPosition,vertexBuffer:u,componentDatatype:oe.FLOAT,componentsPerAttribute:3},{index:oA.currentPosition,vertexBuffer:f,componentDatatype:oe.FLOAT,componentsPerAttribute:3},{index:oA.nextPosition,vertexBuffer:h,componentDatatype:oe.FLOAT,componentsPerAttribute:3},{index:oA.expandAndWidth,vertexBuffer:_,componentDatatype:oe.FLOAT,componentsPerAttribute:2},{index:oA.a_batchId,vertexBuffer:g,componentDatatype:oe.UNSIGNED_SHORT,componentsPerAttribute:1}];e._va=new Fo({context:t,attributes:y,indexBuffer:p}),e._positions=void 0,e._widths=void 0,e._counts=void 0,e._ellipsoid=void 0,e._minimumHeight=void 0,e._maximumHeight=void 0,e._rectangle=void 0,e._transferrableBatchIds=void 0,e._packedBuffer=void 0,e._currentPositions=void 0,e._previousPositions=void 0,e._nextPositions=void 0,e._expandAndWidth=void 0,e._vertexBatchIds=void 0,e._indices=void 0}}const JC=new N,kq=new d;function tct(e,t){l(e._uniformMap)||(e._uniformMap={u_modifiedModelView:function(){const n=t.uniformState.view;return N.clone(n,JC),N.multiplyByPoint(JC,e._center,kq),N.setTranslation(JC,kq,JC),JC},u_highlightColor:function(){return e._highlightColor}})}function nct(e){if(l(e._rs))return;const t={enabled:!0,factor:-5,units:-5};e._rs=ht.fromCache({blending:fo.ALPHA_BLEND,depthMask:!1,depthTest:{enabled:!0},polygonOffset:t})}const ict=`uniform vec4 u_highlightColor;
|
||
void main()
|
||
{
|
||
gl_FragColor = u_highlightColor;
|
||
}
|
||
`;function oct(e,t){if(l(e._sp))return;const n=e._batchTable,i=n.getVertexShaderCallback(!1,"a_batchId",void 0)(tLe),o=n.getFragmentShaderCallback(!1,void 0,!1)(ict),r=new nt({defines:["VECTOR_TILE",Mn.isInternetExplorer()?"":"CLIP_POLYLINE"],sources:[mx,i]}),s=new nt({defines:["VECTOR_TILE"],sources:[o]});e._sp=Hn.fromCache({context:t,vertexShaderSource:r,fragmentShaderSource:s,attributeLocations:oA})}function rct(e,t){if(!l(e._command)){const n=e._batchTable.getUniformMapCallback()(e._uniformMap);e._command=new Dt({owner:e,vertexArray:e._va,renderState:e._rs,shaderProgram:e._sp,uniformMap:n,boundingVolume:e._boundingVolume,pass:We.TRANSLUCENT,pickId:e._batchTable.getPickId()})}t.commandList.push(e._command)}yu.getPolylinePositions=function(e,t){const n=e._batchIds,i=e._decodedPositions,o=e._decodedPositionOffsets;if(!l(n)||!l(i))return;let r,s;const a=n.length;let c=0,u=0;for(r=0;r<a;++r)n[r]===t&&(c+=o[r+1]-o[r]);if(c===0)return;const f=new Float64Array(c*3);for(r=0;r<a;++r)if(n[r]===t){const h=o[r],_=o[r+1]-h;for(s=0;s<_;++s){const g=(h+s)*3;f[u++]=i[g],f[u++]=i[g+1],f[u++]=i[g+2]}}return f};yu.prototype.getPositions=function(e){return yu.getPolylinePositions(this,e)};yu.prototype.createFeatures=function(e,t){const n=this._batchIds,i=n.length;for(let o=0;o<i;++o){const r=n[o];t[r]=new Js(e,r)}};yu.prototype.applyDebugSettings=function(e,t){this._highlightColor=e?t:this._constantColor};function sct(e,t){const n=e._batchIds,i=n.length;for(let o=0;o<i;++o){const r=n[o],s=t[r];s.show=!0,s.color=k.WHITE}}const act=new k,cct=k.WHITE,lct=!0;yu.prototype.applyStyle=function(e,t){if(!l(e)){sct(this,t);return}const n=this._batchIds,i=n.length;for(let o=0;o<i;++o){const r=n[o],s=t[r];s.color=l(e.color)?e.color.evaluateColor(s,act):cct,s.show=l(e.show)?e.show.evaluate(s):lct}};function uct(e){return new Promise(function(t,n){e._update=function(i,o){const r=o.context,s=Zat(i);if(tct(i,r),oct(i,r),nct(i),i._ready){const a=o.passes;(a.render||a.pick)&&rct(i,o)}l(s)&&s.then(function(){ect(i,r),t()}).catch(function(a){n(a)})}})}yu.prototype.update=function(e){this._update(this,e)};yu.prototype.isDestroyed=function(){return!1};yu.prototype.destroy=function(){return this._va=this._va&&this._va.destroy(),this._sp=this._sp&&this._sp.destroy(),Je(this)};function Cp(e){this._positions=e.positions,this._widths=e.widths,this._counts=e.counts,this._batchIds=e.batchIds,this._ellipsoid=A(e.ellipsoid,be.WGS84),this._minimumHeight=e.minimumHeight,this._maximumHeight=e.maximumHeight,this._center=e.center,this._rectangle=e.rectangle,this._batchTable=e.batchTable,this._va=void 0,this._sp=void 0,this._rs=void 0,this._uniformMap=void 0,this._command=void 0,this._transferrableBatchIds=void 0,this._packedBuffer=void 0,this._minimumMaximumVectorHeights=new $(Ro._defaultMinTerrainHeight,Ro._defaultMaxTerrainHeight),this._boundingVolume=Zt.fromRectangle(e.rectangle,Ro._defaultMinTerrainHeight,Ro._defaultMaxTerrainHeight,this._ellipsoid),this._classificationType=e.classificationType,this._keepDecodedPositions=e.keepDecodedPositions,this._decodedPositions=void 0,this._decodedPositionOffsets=void 0,this._startEllipsoidNormals=void 0,this._endEllipsoidNormals=void 0,this._startPositionAndHeights=void 0,this._startFaceNormalAndVertexCornerIds=void 0,this._endPositionAndHeights=void 0,this._endFaceNormalAndHalfWidths=void 0,this._vertexBatchIds=void 0,this._indices=void 0,this._constantColor=k.clone(k.WHITE),this._highlightColor=this._constantColor,this._trianglesLength=0,this._geometryByteLength=0,this._ready=!1,this._update=function(t,n){},this._readyPromise=xct(this),this._verticesPromise=void 0}Object.defineProperties(Cp.prototype,{trianglesLength:{get:function(){return this._trianglesLength}},geometryByteLength:{get:function(){return this._geometryByteLength}},readyPromise:{get:function(){return this._readyPromise}}});function fct(e,t,n){const i=Ro.getMinimumMaximumHeights(t,n),o=i.minimumTerrainHeight,r=i.maximumTerrainHeight,s=e._minimumMaximumVectorHeights;s.x=o,s.y=r;const a=e._boundingVolume,c=e._rectangle;Zt.fromRectangle(c,o,r,n,a)}function dct(e){const t=e._rectangle,n=e._minimumHeight,i=e._maximumHeight,o=e._ellipsoid,r=e._center,s=2+Ee.packedLength+be.packedLength+d.packedLength,a=new Float64Array(s);let c=0;return a[c++]=n,a[c++]=i,Ee.pack(t,a,c),c+=Ee.packedLength,be.pack(o,a,c),c+=be.packedLength,d.pack(r,a,c),a}const hct=new lo("createVectorTileClampedPolylines"),pm={startEllipsoidNormal:0,endEllipsoidNormal:1,startPositionAndHeight:2,endPositionAndHeight:3,startFaceNormalAndVertexCorner:4,endFaceNormalAndHalfWidth:5,a_batchId:6};function pct(e,t){if(!l(e._va)&&!l(e._verticesPromise)){let n=e._positions,i=e._widths,o=e._counts,r=e._transferrableBatchIds,s=e._packedBuffer;l(s)||(n=e._positions=n.slice(),i=e._widths=i.slice(),o=e._counts=o.slice(),r=e._transferrableBatchIds=e._batchIds.slice(),s=e._packedBuffer=dct(e));const a=[n.buffer,i.buffer,o.buffer,r.buffer,s.buffer],c={positions:n.buffer,widths:i.buffer,counts:o.buffer,batchIds:r.buffer,packedBuffer:s.buffer,keepDecodedPositions:e._keepDecodedPositions},u=e._verticesPromise=hct.scheduleTask(c,a);return l(u)?u.then(function(f){e._keepDecodedPositions&&(e._decodedPositions=new Float64Array(f.decodedPositions),e._decodedPositionOffsets=new Uint32Array(f.decodedPositionOffsets)),e._startEllipsoidNormals=new Float32Array(f.startEllipsoidNormals),e._endEllipsoidNormals=new Float32Array(f.endEllipsoidNormals),e._startPositionAndHeights=new Float32Array(f.startPositionAndHeights),e._startFaceNormalAndVertexCornerIds=new Float32Array(f.startFaceNormalAndVertexCornerIds),e._endPositionAndHeights=new Float32Array(f.endPositionAndHeights),e._endFaceNormalAndHalfWidths=new Float32Array(f.endFaceNormalAndHalfWidths),e._vertexBatchIds=new Uint16Array(f.vertexBatchIds);const h=f.indexDatatype;e._indices=h===At.UNSIGNED_SHORT?new Uint16Array(f.indices):new Uint32Array(f.indices),e._ready=!0}):void 0}}function mct(e,t){if(e._ready&&!l(e._va)){const n=e._startEllipsoidNormals,i=e._endEllipsoidNormals,o=e._startPositionAndHeights,r=e._endPositionAndHeights,s=e._startFaceNormalAndVertexCornerIds,a=e._endFaceNormalAndHalfWidths,c=e._vertexBatchIds,u=e._indices;let f=n.byteLength+i.byteLength;f+=o.byteLength+r.byteLength,f+=s.byteLength+a.byteLength,f+=c.byteLength+u.byteLength,e._trianglesLength=u.length/3,e._geometryByteLength=f;const h=Mt.createVertexBuffer({context:t,typedArray:n,usage:mt.STATIC_DRAW}),_=Mt.createVertexBuffer({context:t,typedArray:i,usage:mt.STATIC_DRAW}),g=Mt.createVertexBuffer({context:t,typedArray:o,usage:mt.STATIC_DRAW}),p=Mt.createVertexBuffer({context:t,typedArray:r,usage:mt.STATIC_DRAW}),y=Mt.createVertexBuffer({context:t,typedArray:s,usage:mt.STATIC_DRAW}),T=Mt.createVertexBuffer({context:t,typedArray:a,usage:mt.STATIC_DRAW}),b=Mt.createVertexBuffer({context:t,typedArray:c,usage:mt.STATIC_DRAW}),x=Mt.createIndexBuffer({context:t,typedArray:u,usage:mt.STATIC_DRAW,indexDatatype:u.BYTES_PER_ELEMENT===2?At.UNSIGNED_SHORT:At.UNSIGNED_INT}),v=[{index:pm.startEllipsoidNormal,vertexBuffer:h,componentDatatype:oe.FLOAT,componentsPerAttribute:3},{index:pm.endEllipsoidNormal,vertexBuffer:_,componentDatatype:oe.FLOAT,componentsPerAttribute:3},{index:pm.startPositionAndHeight,vertexBuffer:g,componentDatatype:oe.FLOAT,componentsPerAttribute:4},{index:pm.endPositionAndHeight,vertexBuffer:p,componentDatatype:oe.FLOAT,componentsPerAttribute:4},{index:pm.startFaceNormalAndVertexCorner,vertexBuffer:y,componentDatatype:oe.FLOAT,componentsPerAttribute:4},{index:pm.endFaceNormalAndHalfWidth,vertexBuffer:T,componentDatatype:oe.FLOAT,componentsPerAttribute:4},{index:pm.a_batchId,vertexBuffer:b,componentDatatype:oe.UNSIGNED_SHORT,componentsPerAttribute:1}];e._va=new Fo({context:t,attributes:v,indexBuffer:x}),e._positions=void 0,e._widths=void 0,e._counts=void 0,e._ellipsoid=void 0,e._minimumHeight=void 0,e._maximumHeight=void 0,e._rectangle=void 0,e._transferrableBatchIds=void 0,e._packedBuffer=void 0,e._startEllipsoidNormals=void 0,e._endEllipsoidNormals=void 0,e._startPositionAndHeights=void 0,e._startFaceNormalAndVertexCornerIds=void 0,e._endPositionAndHeights=void 0,e._endFaceNormalAndHalfWidths=void 0,e._vertexBatchIds=void 0,e._indices=void 0}}const QC=new N,Gq=new d;function _ct(e,t){l(e._uniformMap)||(e._uniformMap={u_modifiedModelView:function(){const n=t.uniformState.view;return N.clone(n,QC),N.multiplyByPoint(QC,e._center,Gq),N.setTranslation(QC,Gq,QC),QC},u_highlightColor:function(){return e._highlightColor},u_minimumMaximumVectorHeights:function(){return e._minimumMaximumVectorHeights}})}function Wq(e){return ht.fromCache({cull:{enabled:!0,face:mr.FRONT},blending:fo.PRE_MULTIPLIED_ALPHA_BLEND,depthMask:!1,stencilTest:{enabled:e,frontFunction:Ni.EQUAL,frontOperation:{fail:It.KEEP,zFail:It.KEEP,zPass:It.KEEP},backFunction:Ni.EQUAL,backOperation:{fail:It.KEEP,zFail:It.KEEP,zPass:It.KEEP},reference:Kt.CESIUM_3D_TILE_MASK,mask:Kt.CESIUM_3D_TILE_MASK}})}function gct(e){l(e._rs)||(e._rs=Wq(!1),e._rs3DTiles=Wq(!0))}function yct(e,t){if(l(e._sp))return;const n=e._batchTable,i=n.getVertexShaderCallback(!1,"a_batchId",void 0)(eLe),o=n.getFragmentShaderCallback(!1,void 0,!0)(ZOe),r=new nt({defines:["VECTOR_TILE",Mn.isInternetExplorer()?"":"CLIP_POLYLINE"],sources:[mx,i]}),s=new nt({defines:["VECTOR_TILE"],sources:[o]});e._sp=Hn.fromCache({context:t,vertexShaderSource:r,fragmentShaderSource:s,attributeLocations:pm})}function Act(e,t){let n=e._command;if(!l(e._command)){const o=e._batchTable.getUniformMapCallback()(e._uniformMap);n=e._command=new Dt({owner:e,vertexArray:e._va,renderState:e._rs,shaderProgram:e._sp,uniformMap:o,boundingVolume:e._boundingVolume,pass:We.TERRAIN_CLASSIFICATION,pickId:e._batchTable.getPickId()});const r=Dt.shallowClone(n,n.derivedCommands.tileset);r.renderState=e._rs3DTiles,r.pass=We.CESIUM_3D_TILE_CLASSIFICATION,n.derivedCommands.tileset=r}const i=e._classificationType;(i===ir.TERRAIN||i===ir.BOTH)&&t.commandList.push(n),(i===ir.CESIUM_3D_TILE||i===ir.BOTH)&&t.commandList.push(n.derivedCommands.tileset)}Cp.prototype.getPositions=function(e){return yu.getPolylinePositions(this,e)};Cp.prototype.createFeatures=function(e,t){const n=this._batchIds,i=n.length;for(let o=0;o<i;++o){const r=n[o];t[r]=new Js(e,r)}};Cp.prototype.applyDebugSettings=function(e,t){this._highlightColor=e?t:this._constantColor};function Tct(e,t){const n=e._batchIds,i=n.length;for(let o=0;o<i;++o){const r=n[o],s=t[r];s.show=!0,s.color=k.WHITE}}const Cct=new k,bct=k.WHITE,Ect=!0;Cp.prototype.applyStyle=function(e,t){if(!l(e)){Tct(this,t);return}const n=this._batchIds,i=n.length;for(let o=0;o<i;++o){const r=n[o],s=t[r];s.color=l(e.color)?e.color.evaluateColor(s,Cct):bct,s.show=l(e.show)?e.show.evaluate(s):Ect}};function xct(e){return Ro.initialize().then(function(){return fct(e,e._rectangle,e._ellipsoid),new Promise(function(t,n){e._update=function(i,o){const r=o.context,s=pct(i);if(_ct(i,r),yct(i,r),gct(i),i._ready){const a=o.passes;(a.render||a.pick)&&Act(i,o)}l(s)&&s.then(function(){mct(i,r),t(i)}).catch(function(a){n(a)})}})})}Cp.prototype.update=function(e){this._update(this,e)};Cp.prototype.isDestroyed=function(){return!1};Cp.prototype.destroy=function(){return this._va=this._va&&this._va.destroy(),this._sp=this._sp&&this._sp.destroy(),Je(this)};const QR=32767,wct=new ve,Sct=new d;function vct(e,t,n,i,o){const r=e.length/3,s=e.subarray(0,r),a=e.subarray(r,2*r),c=e.subarray(2*r,3*r);Ri.zigZagDeltaDecode(s,a,c);const u=new Float64Array(e.length);for(let f=0;f<r;++f){const h=s[f],_=a[f],g=c[f],p=F.lerp(t.west,t.east,h/QR),y=F.lerp(t.south,t.north,_/QR),T=F.lerp(n,i,g/QR),b=ve.fromRadians(p,y,T,wct),x=o.cartographicToCartesian(b,Sct);d.pack(x,u,f*3)}return u}function jd(e,t,n,i,o){this._tileset=e,this._tile=t,this._resource=n,this._polygons=void 0,this._polylines=void 0,this._points=void 0,this._metadata=void 0,this._batchTable=void 0,this._features=void 0,this.featurePropertiesDirty=!1,this._group=void 0,Lct(this,i,o)}Object.defineProperties(jd.prototype,{featuresLength:{get:function(){return l(this._batchTable)?this._batchTable.featuresLength:0}},pointsLength:{get:function(){return l(this._points)?this._points.pointsLength:0}},trianglesLength:{get:function(){let e=0;return l(this._polygons)&&(e+=this._polygons.trianglesLength),l(this._polylines)&&(e+=this._polylines.trianglesLength),e}},geometryByteLength:{get:function(){let e=0;return l(this._polygons)&&(e+=this._polygons.geometryByteLength),l(this._polylines)&&(e+=this._polylines.geometryByteLength),e}},texturesByteLength:{get:function(){return l(this._points)?this._points.texturesByteLength:0}},batchTableByteLength:{get:function(){return l(this._batchTable)?this._batchTable.batchTableByteLength:0}},innerContents:{get:function(){}},readyPromise:{get:function(){const e=l(this._points)?this._points.readyPromise:void 0,t=l(this._polygons)?this._polygons.readyPromise:void 0,n=l(this._polylines)?this._polylines.readyPromise:void 0,i=this;return Promise.all([e,t,n]).then(function(){return i})}},tileset:{get:function(){return this._tileset}},tile:{get:function(){return this._tile}},url:{get:function(){return this._resource.getUrlComponent(!0)}},metadata:{get:function(){return this._metadata},set:function(e){this._metadata=e}},batchTable:{get:function(){return this._batchTable}},group:{get:function(){return this._group},set:function(e){this._group=e}}});function Dct(e){return function(t,n){l(e._polygons)&&e._polygons.updateCommands(t,n)}}function Ict(e,t){let n,i,o,r;const s=A(e.POLYGONS_LENGTH,0),a=A(e.POLYLINES_LENGTH,0),c=A(e.POINTS_LENGTH,0);if(s>0&&l(e.POLYGON_BATCH_IDS)){const _=t.byteOffset+e.POLYGON_BATCH_IDS.byteOffset;n=new Uint16Array(t.buffer,_,s)}if(a>0&&l(e.POLYLINE_BATCH_IDS)){const _=t.byteOffset+e.POLYLINE_BATCH_IDS.byteOffset;i=new Uint16Array(t.buffer,_,a)}if(c>0&&l(e.POINT_BATCH_IDS)){const _=t.byteOffset+e.POINT_BATCH_IDS.byteOffset;o=new Uint16Array(t.buffer,_,c)}const u=l(n)||l(i)||l(o),f=s>0&&!l(n)||a>0&&!l(i)||c>0&&!l(o);if(u&&f)throw new Fe("If one group of batch ids is defined, then all batch ids must be defined.");if(!l(n)&&!l(i)&&!l(o)){let _=0;if(!l(n)&&s>0)for(n=new Uint16Array(s),r=0;r<s;++r)n[r]=_++;if(!l(i)&&a>0)for(i=new Uint16Array(a),r=0;r<a;++r)i[r]=_++;if(!l(o)&&c>0)for(o=new Uint16Array(c),r=0;r<c;++r)o[r]=_++}return{polygons:n,polylines:i,points:o}}const Hu=Uint32Array.BYTES_PER_ELEMENT;function Pct(e){return new yu(e)}function Oct(e){return new Cp(e)}function Lct(e,t,n){n=A(n,0);const i=new Uint8Array(t),o=new DataView(t);n+=Hu;const r=o.getUint32(n,!0);if(r!==1)throw new Fe(`Only Vector tile version 1 is supported. Version ${r} is not.`);n+=Hu;const s=o.getUint32(n,!0);if(n+=Hu,s===0)return Promise.resolve(e);const a=o.getUint32(n,!0);if(n+=Hu,a===0)throw new Fe("Feature table must have a byte length greater than zero");const c=o.getUint32(n,!0);n+=Hu;const u=o.getUint32(n,!0);n+=Hu;const f=o.getUint32(n,!0);n+=Hu;const h=o.getUint32(n,!0);n+=Hu;const _=o.getUint32(n,!0);n+=Hu;const g=o.getUint32(n,!0);n+=Hu;const p=o.getUint32(n,!0);n+=Hu;const y=zc(i,n,a);n+=a;const T=new Uint8Array(t,n,c);n+=c;let b,x;u>0&&(b=zc(i,n,u),n+=u,f>0&&(x=new Uint8Array(t,n,f),x=new Uint8Array(x),n+=f));const v=A(y.POLYGONS_LENGTH,0),D=A(y.POLYLINES_LENGTH,0),L=A(y.POINTS_LENGTH,0),B=v+D+L,V=new $i(e,B,b,x,Dct(e));if(e._batchTable=V,B===0)return;const M=new w_(y,T),H=M.getGlobalProperty("REGION");if(!l(H))throw new Fe("Feature table global property: REGION must be defined");const G=Ee.unpack(H),I=H[4],O=H[5],m=e._tile.computedTransform;let P=M.getGlobalProperty("RTC_CENTER",oe.FLOAT,3);l(P)?(P=d.unpack(P),N.multiplyByPoint(m,P,P)):(P=Ee.center(G),P.height=F.lerp(I,O,.5),P=be.WGS84.cartographicToCartesian(P));const R=Ict(y,T);if(n+=(4-n%4)%4,v>0){M.featuresLength=v;const U=A(M.getPropertyArray("POLYGON_COUNTS",oe.UNSIGNED_INT,1),M.getPropertyArray("POLYGON_COUNT",oe.UNSIGNED_INT,1));if(!l(U))throw new Fe("Feature table property: POLYGON_COUNTS must be defined when POLYGONS_LENGTH is greater than 0");const W=A(M.getPropertyArray("POLYGON_INDEX_COUNTS",oe.UNSIGNED_INT,1),M.getPropertyArray("POLYGON_INDEX_COUNT",oe.UNSIGNED_INT,1));if(!l(W))throw new Fe("Feature table property: POLYGON_INDEX_COUNTS must be defined when POLYGONS_LENGTH is greater than 0");const q=U.reduce(function(Q,Z){return Q+Z*2},0),Y=W.reduce(function(Q,Z){return Q+Z},0),j=new Uint32Array(t,n,Y);n+=h;const ee=new Uint16Array(t,n,q);n+=_;let K,se;l(y.POLYGON_MINIMUM_HEIGHTS)&&l(y.POLYGON_MAXIMUM_HEIGHTS)&&(K=M.getPropertyArray("POLYGON_MINIMUM_HEIGHTS",oe.FLOAT,1),se=M.getPropertyArray("POLYGON_MAXIMUM_HEIGHTS",oe.FLOAT,1)),e._polygons=new Tp({positions:ee,counts:U,indexCounts:W,indices:j,minimumHeight:I,maximumHeight:O,polygonMinimumHeights:K,polygonMaximumHeights:se,center:P,rectangle:G,boundingVolume:e.tile.boundingVolume.boundingVolume,batchTable:V,batchIds:R.polygons,modelMatrix:m})}if(D>0){M.featuresLength=D;const U=A(M.getPropertyArray("POLYLINE_COUNTS",oe.UNSIGNED_INT,1),M.getPropertyArray("POLYLINE_COUNT",oe.UNSIGNED_INT,1));if(!l(U))throw new Fe("Feature table property: POLYLINE_COUNTS must be defined when POLYLINES_LENGTH is greater than 0");let W=M.getPropertyArray("POLYLINE_WIDTHS",oe.UNSIGNED_SHORT,1);if(!l(W)){W=new Uint16Array(D);for(let se=0;se<D;++se)W[se]=2}const q=U.reduce(function(se,Q){return se+Q*3},0),Y=new Uint16Array(t,n,q);n+=g;const j=e._tileset,ee=j.examineVectorLinesFunction;if(l(ee)){const se=vct(new Uint16Array(Y),G,I,O,be.WGS84);Bct(se,U,R.polylines,V,e.url,ee)}let K=Pct;l(j.classificationType)&&(K=Oct),e._polylines=K({positions:Y,widths:W,counts:U,batchIds:R.polylines,minimumHeight:I,maximumHeight:O,center:P,rectangle:G,boundingVolume:e.tile.boundingVolume.boundingVolume,batchTable:V,classificationType:j.classificationType,keepDecodedPositions:j.vectorKeepDecodedPositions})}if(L>0){const U=new Uint16Array(t,n,L*3);n+=p,e._points=new v_({positions:U,batchIds:R.points,minimumHeight:I,maximumHeight:O,rectangle:G,batchTable:V})}return Promise.resolve(e)}function MU(e){const t=e.featuresLength;if(!l(e._features)&&t>0){const n=new Array(t);l(e._polygons)&&e._polygons.createFeatures(e,n),l(e._polylines)&&e._polylines.createFeatures(e,n),l(e._points)&&e._points.createFeatures(e,n),e._features=n}}jd.prototype.hasProperty=function(e,t){return this._batchTable.hasProperty(e,t)};jd.prototype.getFeature=function(e){const t=this.featuresLength;if(!l(e)||e<0||e>=t)throw new w(`batchId is required and between zero and featuresLength - 1 (${t-1}).`);return l(this._features)||MU(this),this._features[e]};jd.prototype.applyDebugSettings=function(e,t){l(this._polygons)&&this._polygons.applyDebugSettings(e,t),l(this._polylines)&&this._polylines.applyDebugSettings(e,t),l(this._points)&&this._points.applyDebugSettings(e,t)};jd.prototype.applyStyle=function(e){l(this._features)||MU(this),l(this._polygons)&&this._polygons.applyStyle(e,this._features),l(this._polylines)&&this._polylines.applyStyle(e,this._features),l(this._points)&&this._points.applyStyle(e,this._features)};jd.prototype.update=function(e,t){let n=!0;l(this._polygons)&&(this._polygons.classificationType=this._tileset.classificationType,this._polygons.debugWireframe=this._tileset.debugWireframe,this._polygons.update(t),n=n&&this._polygons._ready),l(this._polylines)&&(this._polylines.update(t),n=n&&this._polylines._ready),l(this._points)&&(this._points.update(t),n=n&&this._points._ready),l(this._batchTable)&&n&&(l(this._features)||MU(this),this._batchTable.update(e,t))};jd.prototype.getPolylinePositions=function(e){const t=this._polylines;if(l(t))return t.getPositions(e)};jd.prototype.isDestroyed=function(){return!1};jd.prototype.destroy=function(){return this._polygons=this._polygons&&this._polygons.destroy(),this._polylines=this._polylines&&this._polylines.destroy(),this._points=this._points&&this._points.destroy(),this._batchTable=this._batchTable&&this._batchTable.destroy(),Je(this)};function Bct(e,t,n,i,o,r){const s=t.length;let a=0;for(let c=0;c<s;c++){const u=t[c]*3,f=e.slice(a,a+u);a+=u,r(f,n[c],o,i)}}const Doe={b3dm:function(e,t,n,i,o){return pr.fromB3dm(e,t,n,i,o)},pnts:function(e,t,n,i,o){return pr.fromPnts(e,t,n,i,o)},i3dm:function(e,t,n,i,o){return pr.fromI3dm(e,t,n,i,o)},cmpt:function(e,t,n,i,o){return new mp(e,t,n,i,o,Doe)},externalTileset:function(e,t,n,i){return new Ap(e,t,n,i)},geom:function(e,t,n,i,o){return new _p(e,t,n,i,o)},vctr:function(e,t,n,i,o){return new jd(e,t,n,i,o)},subt:function(e,t,n,i,o){return new Al(e,t,n,void 0,i,o)},subtreeJson:function(e,t,n,i){return new Al(e,t,n,i)},glb:function(e,t,n,i,o){if(i.byteLength<12)throw new Fe("Invalid glb content");const a=new DataView(i,o).getUint32(8,!0),c=new Uint8Array(i,o,a);return pr.fromGltf(e,t,n,c)},gltf:function(e,t,n,i){return pr.fromGltf(e,t,n,i)},geoJson:function(e,t,n,i){return pr.fromGeoJson(e,t,n,i)}},Ioe=Doe,Rct={UNLOADED:0,LOADING:1,PROCESSING:2,READY:3,EXPIRED:4,FAILED:5},gr=Object.freeze(Rct),Wu={BATCHED_3D_MODEL:"b3dm",INSTANCED_3D_MODEL:"i3dm",COMPOSITE:"cmpt",POINT_CLOUD:"pnts",VECTOR:"vctr",GEOMETRY:"geom",GLTF:"gltf",GLTF_BINARY:"glb",IMPLICIT_SUBTREE:"subt",IMPLICIT_SUBTREE_JSON:"subtreeJson",EXTERNAL_TILESET:"externalTileset",MULTIPLE_CONTENT:"multipleContent",GEOJSON:"geoJson",VOXEL_BINARY:"voxl",VOXEL_JSON:"voxelJson"};Wu.isBinaryFormat=function(e){switch(e){case Wu.BATCHED_3D_MODEL:case Wu.INSTANCED_3D_MODEL:case Wu.COMPOSITE:case Wu.POINT_CLOUD:case Wu.VECTOR:case Wu.GEOMETRY:case Wu.IMPLICIT_SUBTREE:case Wu.VOXEL_BINARY:case Wu.GLTF_BINARY:return!0;default:return!1}};const Mc=Object.freeze(Wu);function Ed(e,t){this._tileset=e,this._tile=t,this.featurePropertiesDirty=!1}Object.defineProperties(Ed.prototype,{featuresLength:{get:function(){return 0}},pointsLength:{get:function(){return 0}},trianglesLength:{get:function(){return 0}},geometryByteLength:{get:function(){return 0}},texturesByteLength:{get:function(){return 0}},batchTableByteLength:{get:function(){return 0}},innerContents:{get:function(){}},readyPromise:{get:function(){}},tileset:{get:function(){return this._tileset}},tile:{get:function(){return this._tile}},url:{get:function(){}},metadata:{get:function(){},set:function(e){throw new w("Empty3DTileContent cannot have content metadata")}},batchTable:{get:function(){}},group:{get:function(){},set:function(e){throw new w("Empty3DTileContent cannot have group metadata")}}});Ed.prototype.hasProperty=function(e,t){return!1};Ed.prototype.getFeature=function(e){};Ed.prototype.applyDebugSettings=function(e,t){};Ed.prototype.applyStyle=function(e){};Ed.prototype.update=function(e,t){};Ed.prototype.isDestroyed=function(){return!1};Ed.prototype.destroy=function(){return Je(this)};function bp(e){e=A(e,A.EMPTY_OBJECT);const t=e.content,n=e.class;E.typeOf.object("options.content",t),E.typeOf.object("options.class",n),this._class=n,this._properties=t.properties,this._extensions=t.extensions,this._extras=t.extras}Object.defineProperties(bp.prototype,{class:{get:function(){return this._class}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}});bp.prototype.hasProperty=function(e){return cn.hasProperty(e,this._properties,this._class)};bp.prototype.hasPropertyBySemantic=function(e){return cn.hasPropertyBySemantic(e,this._properties,this._class)};bp.prototype.getPropertyIds=function(e){return cn.getPropertyIds(this._properties,this._class,e)};bp.prototype.getProperty=function(e){return cn.getProperty(e,this._properties,this._class)};bp.prototype.setProperty=function(e,t){return cn.setProperty(e,t,this._properties,this._class)};bp.prototype.getPropertyBySemantic=function(e){return cn.getPropertyBySemantic(e,this._properties,this._class)};bp.prototype.setPropertyBySemantic=function(e,t){return cn.setPropertyBySemantic(e,t,this._properties,this._class)};function RP(e,t){const n=Wr(t,"3DTILES_metadata")?t.extensions["3DTILES_metadata"]:t.metadata;if(!l(n))return;if(!l(e.schema)){RP._oneTimeWarning("findContentMetadata-missing-root-schema","Could not find a metadata schema for content metadata. For tilesets that contain external tilesets, make sure the schema is added to the root tileset.json.");return}const i=A(e.schema.classes,A.EMPTY_OBJECT);if(l(n.class)){const o=i[n.class];return new bp({content:n,class:o})}}RP._oneTimeWarning=uo;function Poe(e,t){const n=e.metadataExtension;if(!l(n))return;const i=n.groups,o=Wr(t,"3DTILES_metadata")?t.extensions["3DTILES_metadata"].group:t.group;if(typeof o=="number")return i[o];const r=n.groupIds.findIndex(function(s){return s===o});return r>=0?i[r]:void 0}function Ep(e){e=A(e,A.EMPTY_OBJECT);const t=e.tile,n=e.class;E.typeOf.object("options.tile",t),E.typeOf.object("options.class",n),this._class=n,this._properties=t.properties,this._extensions=t.extensions,this._extras=t.extras}Object.defineProperties(Ep.prototype,{class:{get:function(){return this._class}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}});Ep.prototype.hasProperty=function(e){return cn.hasProperty(e,this._properties,this._class)};Ep.prototype.hasPropertyBySemantic=function(e){return cn.hasPropertyBySemantic(e,this._properties,this._class)};Ep.prototype.getPropertyIds=function(e){return cn.getPropertyIds(this._properties,this._class,e)};Ep.prototype.getProperty=function(e){return cn.getProperty(e,this._properties,this._class)};Ep.prototype.setProperty=function(e,t){return cn.setProperty(e,t,this._properties,this._class)};Ep.prototype.getPropertyBySemantic=function(e){return cn.getPropertyBySemantic(e,this._properties,this._class)};Ep.prototype.setPropertyBySemantic=function(e,t){return cn.setPropertyBySemantic(e,t,this._properties,this._class)};function FU(e,t){const n=Wr(t,"3DTILES_metadata")?t.extensions["3DTILES_metadata"]:t.metadata;if(!l(n))return;if(!l(e.schema)){FU._oneTimeWarning("findTileMetadata-missing-root-schema","Could not find a metadata schema for tile metadata. For tilesets that contain external tilesets, make sure the schema is added to the root tileset.json.");return}const i=A(e.schema.classes,A.EMPTY_OBJECT);if(l(n.class)){const o=i[n.class];return new Ep({tile:n,class:o})}}FU._oneTimeWarning=uo;function Ooe(e){const t=new Uint8Array(e);let n=TP(t);if(n==="glTF"&&(n="glb"),Mc.isBinaryFormat(n))return{contentType:n,binaryPayload:t};const i=Nct(t);if(l(i.root))return{contentType:Mc.EXTERNAL_TILESET,jsonPayload:i};if(l(i.asset))return{contentType:Mc.GLTF,jsonPayload:i};if(l(i.tileAvailability))return{contentType:Mc.IMPLICIT_SUBTREE_JSON,jsonPayload:i};if(l(i.type))return{contentType:Mc.GEOJSON,jsonPayload:i};if(l(i.voxelTable))return{contentType:Mc.VOXEL_JSON,jsonPayload:i};throw new Fe("Invalid tile content.")}function Nct(e){let t;try{t=zc(e)}catch{throw new Fe("Invalid tile content.")}return t}function Lf(e,t,n,i){this._tileset=e,this._tile=t,this._tilesetResource=n,this._contents=[],this._contentsCreated=!1;const o=l(i.contents)?i.contents:i.content;this._innerContentHeaders=o,this._requestsInFlight=0,this._cancelCount=0;const r=this._innerContentHeaders.length;this._arrayFetchPromises=new Array(r),this._requests=new Array(r),this._innerContentResources=new Array(r),this._serverKeys=new Array(r);for(let s=0;s<r;s++){const a=n.getDerivedResource({url:o[s].uri}),c=Ui.getServerKey(a.getUrlComponent());this._innerContentResources[s]=a,this._serverKeys[s]=c}this._contentsFetchedPromise=void 0}Object.defineProperties(Lf.prototype,{featurePropertiesDirty:{get:function(){const e=this._contents,t=e.length;for(let n=0;n<t;++n)if(e[n].featurePropertiesDirty)return!0;return!1},set:function(e){const t=this._contents,n=t.length;for(let i=0;i<n;++i)t[i].featurePropertiesDirty=e}},featuresLength:{get:function(){return 0}},pointsLength:{get:function(){return 0}},trianglesLength:{get:function(){return 0}},geometryByteLength:{get:function(){return 0}},texturesByteLength:{get:function(){return 0}},batchTableByteLength:{get:function(){return 0}},innerContents:{get:function(){return this._contents}},readyPromise:{get:function(){if(!this._contentsCreated)return;const e=this._contents.map(function(n){return n.readyPromise}),t=this;return Promise.all(e).then(function(){return t})}},tileset:{get:function(){return this._tileset}},tile:{get:function(){return this._tile}},url:{get:function(){}},metadata:{get:function(){},set:function(){throw new w("Multiple3DTileContent cannot have metadata")}},batchTable:{get:function(){}},group:{get:function(){},set:function(){throw new w("Multiple3DTileContent cannot have group metadata")}},innerContentUrls:{get:function(){return this._innerContentHeaders.map(function(e){return e.uri})}},contentsFetchedPromise:{get:function(){return this._contentsFetchedPromise}}});function h2(e,t){e._requestsInFlight+=t,e.tileset.statistics.numberOfPendingRequests+=t}function Mct(e,t){e._cancelCount++,e._tile._contentState=t;const n=e.tileset.statistics;n.numberOfPendingRequests-=e._requestsInFlight,n.numberOfAttemptedRequests+=e._requestsInFlight,e._requestsInFlight=0;const i=e._innerContentHeaders.length;e._arrayFetchPromises=new Array(i)}Lf.prototype.requestInnerContents=function(){if(!Fct(this._serverKeys))return this._serverKeys.length;const e=this._innerContentHeaders;h2(this,e.length);for(let t=0;t<e.length;t++)this._arrayFetchPromises[t]=zct(this,t,this._cancelCount,this._tile._contentState);return this._contentsFetchedPromise=Uct(this),0};function Fct(e){const t={};for(let n=0;n<e.length;n++){const i=e[n];l(t[i])?t[i]++:t[i]=1}for(const n in t)if(t.hasOwnProperty(n)&&!Ui.serverHasOpenSlots(n,t[n]))return!1;return Ui.heapHasOpenSlots(e.length)}function zct(e,t,n,i){const o=e._innerContentResources[t].clone(),r=e.tile,s=function(){return r._priority},a=e._serverKeys[t],c=new Ad({throttle:!0,throttleByServer:!0,type:xy.TILES3D,priorityFunction:s,serverKey:a});o.request=c,e._requests[t]=c;const u=o.fetchArrayBuffer();return l(u)?u.then(function(f){if(!(n<e._cancelCount))return h2(e,-1),f}).catch(function(f){if(!(n<e._cancelCount)){if(o.request.state===or.CANCELLED){Mct(e,i);return}h2(e,-1),Loe(e,t,f)}}):Promise.resolve(void 0)}function Uct(e){const t=e._cancelCount;return Promise.all(e._arrayFetchPromises).then(function(n){if(t<e._cancelCount)return;const i=n.map(function(o,r){if(l(o))return Hct(e,o,r)});e._contentsCreated=!0,e._contents=i.filter(l)})}function Hct(e,t,n){const i=Ooe(t);if(i.contentType===Mc.EXTERNAL_TILESET){const h=new Fe("External tilesets are disallowed inside multiple contents");return Loe(e,n,h)}e._disableSkipLevelOfDetail=e._disableSkipLevelOfDetail||i.contentType===Mc.GEOMETRY||i.contentType===Mc.VECTOR;const o=e._tileset,r=e._innerContentResources[n],s=e._tile;let a;const c=Ioe[i.contentType];l(i.binaryPayload)?a=c(o,s,r,i.binaryPayload.buffer,0):a=c(o,s,r,i.jsonPayload);const u=e._innerContentHeaders[n];if(s.hasImplicitContentMetadata){const h=s.implicitSubtree,_=s.implicitCoordinates;a.metadata=h.getContentMetadataView(_,n)}else s.hasImplicitContent||(a.metadata=RP(o,u));const f=Poe(o,u);return l(f)&&(a.group=new oU({metadata:f})),a}function Loe(e,t,n){const i=e._tileset,o=e._innerContentResources[t].url,r=l(n.message)?n.message:n.toString();i.tileFailed.numberOfListeners>0?i.tileFailed.raiseEvent({url:o,message:r}):(console.log(`A content failed to load: ${o}`),console.log(`Error: ${r}`))}Lf.prototype.cancelRequests=function(){for(let e=0;e<this._requests.length;e++){const t=this._requests[e];l(t)&&t.cancel()}};Lf.prototype.hasProperty=function(e,t){return!1};Lf.prototype.getFeature=function(e){};Lf.prototype.applyDebugSettings=function(e,t){const n=this._contents,i=n.length;for(let o=0;o<i;++o)n[o].applyDebugSettings(e,t)};Lf.prototype.applyStyle=function(e){const t=this._contents,n=t.length;for(let i=0;i<n;++i)t[i].applyStyle(e)};Lf.prototype.update=function(e,t){const n=this._contents,i=n.length;for(let o=0;o<i;++o)n[o].update(e,t)};Lf.prototype.isDestroyed=function(){return!1};Lf.prototype.destroy=function(){const e=this._contents,t=e.length;for(let n=0;n<t;++n)e[n].destroy();return Je(this)};const Gx={},Vct=new d,Boe=new d,Roe=new d,Noe=new d,Moe=new Zt;Gx.validOutline=function(e){E.defined("positions",e);const n=Zt.fromPoints(e,Moe).halfAxes,i=te.getColumn(n,0,Boe),o=te.getColumn(n,1,Roe),r=te.getColumn(n,2,Noe),s=d.magnitude(i),a=d.magnitude(o),c=d.magnitude(r);return!(s===0&&(a===0||c===0)||a===0&&c===0)};Gx.computeProjectTo2DArguments=function(e,t,n,i){E.defined("positions",e),E.defined("centerResult",t),E.defined("planeAxis1Result",n),E.defined("planeAxis2Result",i);const o=Zt.fromPoints(e,Moe),r=o.halfAxes,s=te.getColumn(r,0,Boe),a=te.getColumn(r,1,Roe),c=te.getColumn(r,2,Noe),u=d.magnitude(s),f=d.magnitude(a),h=d.magnitude(c),_=Math.min(u,f,h);if(u===0&&(f===0||h===0)||f===0&&h===0)return!1;let g,p;return(_===f||_===h)&&(g=s),_===u?g=a:_===h&&(p=a),(_===u||_===f)&&(p=c),d.normalize(g,n),d.normalize(p,i),d.clone(o.center,t),!0};function Foe(e,t,n,i,o){const r=d.subtract(e,t,Vct),s=d.dot(n,r),a=d.dot(i,r);return $.fromElements(s,a,o)}Gx.createProjectPointsTo2DFunction=function(e,t,n){return function(i){const o=new Array(i.length);for(let r=0;r<i.length;r++)o[r]=Foe(i[r],e,t,n);return o}};Gx.createProjectPointTo2DFunction=function(e,t,n){return function(i,o){return Foe(i,e,t,n,o)}};const eI=Gx,Zo={};Zo.computeHierarchyPackedLength=function(e,t){let n=0;const i=[e];for(;i.length>0;){const o=i.pop();if(!l(o))continue;n+=2;const r=o.positions,s=o.holes;if(l(r)&&r.length>0&&(n+=r.length*t.packedLength),l(s)){const a=s.length;for(let c=0;c<a;++c)i.push(s[c])}}return n};Zo.packPolygonHierarchy=function(e,t,n,i){const o=[e];for(;o.length>0;){const r=o.pop();if(!l(r))continue;const s=r.positions,a=r.holes;if(t[n++]=l(s)?s.length:0,t[n++]=l(a)?a.length:0,l(s)){const c=s.length;for(let u=0;u<c;++u,n+=i.packedLength)i.pack(s[u],t,n)}if(l(a)){const c=a.length;for(let u=0;u<c;++u)o.push(a[u])}}return n};Zo.unpackPolygonHierarchy=function(e,t,n){const i=e[t++],o=e[t++],r=new Array(i),s=o>0?new Array(o):void 0;for(let a=0;a<i;++a,t+=n.packedLength)r[a]=n.unpack(e,t);for(let a=0;a<o;++a)s[a]=Zo.unpackPolygonHierarchy(e,t,n),t=s[a].startingIndex,delete s[a].startingIndex;return{positions:r,holes:s,startingIndex:t}};const cg=new $;function zoe(e,t,n,i){return $.subtract(t,e,cg),$.multiplyByScalar(cg,n/i,cg),$.add(e,cg,cg),[cg.x,cg.y]}const em=new d;function kct(e,t,n,i){return d.subtract(t,e,em),d.multiplyByScalar(em,n/i,em),d.add(e,em,em),[em.x,em.y,em.z]}Zo.subdivideLineCount=function(e,t,n){const o=d.distance(e,t)/n,r=Math.max(0,Math.ceil(F.log2(o)));return Math.pow(2,r)};const zU=new ve,UU=new ve,Gct=new ve,Wct=new d,qq=new js;Zo.subdivideRhumbLineCount=function(e,t,n,i){const o=e.cartesianToCartographic(t,zU),r=e.cartesianToCartographic(n,UU),a=new js(o,r,e).surfaceDistance/i,c=Math.max(0,Math.ceil(F.log2(a)));return Math.pow(2,c)};Zo.subdivideTexcoordLine=function(e,t,n,i,o,r){const s=Zo.subdivideLineCount(n,i,o),a=$.distance(e,t),c=a/s,u=r;u.length=s*2;let f=0;for(let h=0;h<s;h++){const _=zoe(e,t,h*c,a);u[f++]=_[0],u[f++]=_[1]}return u};Zo.subdivideLine=function(e,t,n,i){const o=Zo.subdivideLineCount(e,t,n),r=d.distance(e,t),s=r/o;l(i)||(i=[]);const a=i;a.length=o*3;let c=0;for(let u=0;u<o;u++){const f=kct(e,t,u*s,r);a[c++]=f[0],a[c++]=f[1],a[c++]=f[2]}return a};Zo.subdivideTexcoordRhumbLine=function(e,t,n,i,o,r,s){const a=n.cartesianToCartographic(i,zU),c=n.cartesianToCartographic(o,UU);qq.setEndPoints(a,c);const u=qq.surfaceDistance/r,f=Math.max(0,Math.ceil(F.log2(u))),h=Math.pow(2,f),_=$.distance(e,t),g=_/h,p=s;p.length=h*2;let y=0;for(let T=0;T<h;T++){const b=zoe(e,t,T*g,_);p[y++]=b[0],p[y++]=b[1]}return p};Zo.subdivideRhumbLine=function(e,t,n,i,o){const r=e.cartesianToCartographic(t,zU),s=e.cartesianToCartographic(n,UU),a=new js(r,s,e),c=a.surfaceDistance/i,u=Math.max(0,Math.ceil(F.log2(c))),f=Math.pow(2,u),h=a.surfaceDistance/f;l(o)||(o=[]);const _=o;_.length=f*3;let g=0;for(let p=0;p<f;p++){const y=a.interpolateUsingSurfaceDistance(p*h,Gct),T=e.cartographicToCartesian(y,Wct);_[g++]=T.x,_[g++]=T.y,_[g++]=T.z}return _};const qct=new d,jct=new d,Yct=new d,$ct=new d;Zo.scaleToGeodeticHeightExtruded=function(e,t,n,i,o){i=A(i,be.WGS84);const r=qct;let s=jct;const a=Yct;let c=$ct;if(l(e)&&l(e.attributes)&&l(e.attributes.position)){const u=e.attributes.position.values,f=u.length/2;for(let h=0;h<f;h+=3)d.fromArray(u,h,a),i.geodeticSurfaceNormal(a,r),c=i.scaleToGeodeticSurface(a,c),s=d.multiplyByScalar(r,n,s),s=d.add(c,s,s),u[h+f]=s.x,u[h+1+f]=s.y,u[h+2+f]=s.z,o&&(c=d.clone(a,c)),s=d.multiplyByScalar(r,t,s),s=d.add(c,s,s),u[h]=s.x,u[h+1]=s.y,u[h+2]=s.z}return e};Zo.polygonOutlinesFromHierarchy=function(e,t,n){const i=[],o=new Rd;o.enqueue(e);let r,s,a;for(;o.length!==0;){const c=o.dequeue();let u=c.positions;if(t)for(a=u.length,r=0;r<a;r++)n.scaleToGeodeticSurface(u[r],u[r]);if(u=Ya(u,d.equalsEpsilon,!0),u.length<3)continue;const f=c.holes?c.holes.length:0;for(r=0;r<f;r++){const h=c.holes[r];let _=h.positions;if(t)for(a=_.length,s=0;s<a;++s)n.scaleToGeodeticSurface(_[s],_[s]);if(_=Ya(_,d.equalsEpsilon,!0),_.length<3)continue;i.push(_);let g=0;for(l(h.holes)&&(g=h.holes.length),s=0;s<g;s++)o.enqueue(h.holes[s])}i.push(u)}return i};Zo.polygonsFromHierarchy=function(e,t,n,i,o){const r=[],s=[],a=new Rd;for(a.enqueue(e);a.length!==0;){const c=a.dequeue();let u=c.positions;const f=c.holes;let h,_;if(i)for(_=u.length,h=0;h<_;h++)o.scaleToGeodeticSurface(u[h],u[h]);if(t||(u=Ya(u,d.equalsEpsilon,!0)),u.length<3)continue;let g=n(u);if(!l(g))continue;const p=[];let y=wo.computeWindingOrder2D(g);y===pu.CLOCKWISE&&(g.reverse(),u=u.slice().reverse());let T=u.slice();const b=l(f)?f.length:0,x=[];let v;for(h=0;h<b;h++){const D=f[h];let L=D.positions;if(i)for(_=L.length,v=0;v<_;++v)o.scaleToGeodeticSurface(L[v],L[v]);if(t||(L=Ya(L,d.equalsEpsilon,!0)),L.length<3)continue;const B=n(L);if(!l(B))continue;y=wo.computeWindingOrder2D(B),y===pu.CLOCKWISE&&(B.reverse(),L=L.slice().reverse()),x.push(L),p.push(T.length),T=T.concat(L),g=g.concat(B);let V=0;for(l(D.holes)&&(V=D.holes.length),v=0;v<V;v++)a.enqueue(D.holes[v])}r.push({outerRing:u,holes:x}),s.push({positions:T,positions2D:g,holes:p})}return{hierarchy:r,polygons:s}};const Xct=new $,Kct=new d,Jct=new De,Qct=new te;Zo.computeBoundingRectangle=function(e,t,n,i,o){const r=De.fromAxisAngle(e,i,Jct),s=te.fromQuaternion(r,Qct);let a=Number.POSITIVE_INFINITY,c=Number.NEGATIVE_INFINITY,u=Number.POSITIVE_INFINITY,f=Number.NEGATIVE_INFINITY;const h=n.length;for(let _=0;_<h;++_){const g=d.clone(n[_],Kct);te.multiplyByVector(s,g,g);const p=t(g,Xct);l(p)&&(a=Math.min(a,p.x),c=Math.max(c,p.x),u=Math.min(u,p.y),f=Math.max(f,p.y))}return o.x=a,o.y=u,o.width=c-a,o.height=f-u,o};Zo.createGeometryFromPositions=function(e,t,n,i,o,r,s){let a=wo.triangulate(t.positions2D,t.holes);a.length<3&&(a=[0,1,2]);const c=t.positions,u=l(n),f=u?n.positions:void 0;if(o){const h=c.length,_=new Array(h*3);let g=0;for(let T=0;T<h;T++){const b=c[T];_[g++]=b.x,_[g++]=b.y,_[g++]=b.z}const p={attributes:{position:new Xe({componentDatatype:oe.DOUBLE,componentsPerAttribute:3,values:_})},indices:a,primitiveType:dt.TRIANGLES};u&&(p.attributes.st=new Xe({componentDatatype:oe.FLOAT,componentsPerAttribute:2,values:$.packArray(f)}));const y=new $t(p);return r.normal?mo.computeNormal(y):y}if(s===Kn.GEODESIC)return wo.computeSubdivision(e,c,a,f,i);if(s===Kn.RHUMB)return wo.computeRhumbLineSubdivision(e,c,a,f,i)};const jq=[],Yq=[],Zct=new d,elt=new d;Zo.computeWallGeometry=function(e,t,n,i,o,r){let s,a,c,u,f,h,_,g,p,y=e.length,T=0,b=0;const x=l(t),v=x?t.positions:void 0;if(o)for(a=y*3*2,s=new Array(a*2),x&&(p=y*2*2,g=new Array(p*2)),c=0;c<y;c++)u=e[c],f=e[(c+1)%y],s[T]=s[T+a]=u.x,++T,s[T]=s[T+a]=u.y,++T,s[T]=s[T+a]=u.z,++T,s[T]=s[T+a]=f.x,++T,s[T]=s[T+a]=f.y,++T,s[T]=s[T+a]=f.z,++T,x&&(h=v[c],_=v[(c+1)%y],g[b]=g[b+p]=h.x,++b,g[b]=g[b+p]=h.y,++b,g[b]=g[b+p]=_.x,++b,g[b]=g[b+p]=_.y,++b);else{const M=F.chordLength(i,n.maximumRadius);let H=0;if(r===Kn.GEODESIC)for(c=0;c<y;c++)H+=Zo.subdivideLineCount(e[c],e[(c+1)%y],M);else if(r===Kn.RHUMB)for(c=0;c<y;c++)H+=Zo.subdivideRhumbLineCount(n,e[c],e[(c+1)%y],M);for(a=(H+y)*3,s=new Array(a*2),x&&(p=(H+y)*2,g=new Array(p*2)),c=0;c<y;c++){u=e[c],f=e[(c+1)%y];let G,I;x&&(h=v[c],_=v[(c+1)%y]),r===Kn.GEODESIC?(G=Zo.subdivideLine(u,f,M,Yq),x&&(I=Zo.subdivideTexcoordLine(h,_,u,f,M,jq))):r===Kn.RHUMB&&(G=Zo.subdivideRhumbLine(n,u,f,M,Yq),x&&(I=Zo.subdivideTexcoordRhumbLine(h,_,n,u,f,M,jq)));const O=G.length;for(let m=0;m<O;++m,++T)s[T]=G[m],s[T+a]=G[m];if(s[T]=f.x,s[T+a]=f.x,++T,s[T]=f.y,s[T+a]=f.y,++T,s[T]=f.z,s[T+a]=f.z,++T,x){const m=I.length;for(let P=0;P<m;++P,++b)g[b]=I[P],g[b+p]=I[P];g[b]=_.x,g[b+p]=_.x,++b,g[b]=_.y,g[b+p]=_.y,++b}}}y=s.length;const D=At.createTypedArray(y/3,y-e.length*6);let L=0;for(y/=6,c=0;c<y;c++){const M=c,H=M+1,G=M+y,I=G+1;u=d.fromArray(s,M*3,Zct),f=d.fromArray(s,H*3,elt),!d.equalsEpsilon(u,f,F.EPSILON10,F.EPSILON10)&&(D[L++]=M,D[L++]=G,D[L++]=H,D[L++]=H,D[L++]=G,D[L++]=I)}const B={attributes:new To({position:new Xe({componentDatatype:oe.DOUBLE,componentsPerAttribute:3,values:s})}),indices:D,primitiveType:dt.TRIANGLES};return x&&(B.attributes.st=new Xe({componentDatatype:oe.FLOAT,componentsPerAttribute:2,values:g})),new $t(B)};const ci=Zo;function tlt(e){const t=e.length,n=new Float64Array(t*3),i=At.createTypedArray(t,t*2);let o=0,r=0;for(let a=0;a<t;a++){const c=e[a];n[o++]=c.x,n[o++]=c.y,n[o++]=c.z,i[r++]=a,i[r++]=(a+1)%t}const s=new To({position:new Xe({componentDatatype:oe.DOUBLE,componentsPerAttribute:3,values:n})});return new $t({attributes:s,indices:i,primitiveType:dt.LINES})}function Zc(e){e=A(e,A.EMPTY_OBJECT);const t=e.polygonHierarchy;E.defined("options.polygonHierarchy",t),this._polygonHierarchy=t,this._workerName="createCoplanarPolygonOutlineGeometry",this.packedLength=ci.computeHierarchyPackedLength(t,d)+1}Zc.fromPositions=function(e){e=A(e,A.EMPTY_OBJECT),E.defined("options.positions",e.positions);const t={polygonHierarchy:{positions:e.positions}};return new Zc(t)};Zc.pack=function(e,t,n){return E.typeOf.object("value",e),E.defined("array",t),n=A(n,0),n=ci.packPolygonHierarchy(e._polygonHierarchy,t,n,d),t[n]=e.packedLength,t};const nlt={polygonHierarchy:{}};Zc.unpack=function(e,t,n){E.defined("array",e),t=A(t,0);const i=ci.unpackPolygonHierarchy(e,t,d);t=i.startingIndex,delete i.startingIndex;const o=e[t];return l(n)||(n=new Zc(nlt)),n._polygonHierarchy=i,n.packedLength=o,n};Zc.createGeometry=function(e){const t=e._polygonHierarchy;let n=t.positions;if(n=Ya(n,d.equalsEpsilon,!0),n.length<3||!eI.validOutline(n))return;const o=ci.polygonOutlinesFromHierarchy(t,!1);if(o.length===0)return;const r=[];for(let c=0;c<o.length;c++){const u=new xn({geometry:tlt(o[c])});r.push(u)}const s=mo.combineInstances(r)[0],a=Ae.fromPoints(t.positions);return new $t({attributes:s.attributes,indices:s.indices,primitiveType:s.primitiveType,boundingSphere:a})};let Mv=new ve;function Wx(e){E.typeOf.object("options",e),E.typeOf.string("options.token",e.token);const t=vo.fromToken(e.token),n=A(e.minimumHeight,0),i=A(e.maximumHeight,0),o=A(e.ellipsoid,be.WGS84);this.s2Cell=t,this.minimumHeight=n,this.maximumHeight=i,this.ellipsoid=o;const r=flt(t,n,i,o);this._boundingPlanes=r;const s=mlt(r);this._vertices=s,this._edgeNormals=new Array(6),this._edgeNormals[0]=sN(r[0],s.slice(0,4));let a;for(a=0;a<4;a++)this._edgeNormals[0][a]=d.negate(this._edgeNormals[0][a],this._edgeNormals[0][a]);for(this._edgeNormals[1]=sN(r[1],s.slice(4,8)),a=0;a<4;a++)this._edgeNormals[2+a]=sN(r[2+a],[s[a%4],s[(a+1)%4],s[4+(a+1)%4],s[4+a]]);for(this._planeVertices=[this._vertices.slice(0,4),this._vertices.slice(4,8)],a=0;a<4;a++)this._planeVertices.push([this._vertices[a%4],this._vertices[(a+1)%4],this._vertices[4+(a+1)%4],this._vertices[4+a]]);const c=t.getCenter();Mv=o.cartesianToCartographic(c,Mv),Mv.height=(i+n)/2,this.center=o.cartographicToCartesian(Mv,c),this._boundingSphere=Ae.fromPoints(s)}const ilt=new d,olt=new ve,rlt=new d,slt=new ve,alt=new d,clt=new d,llt=new d,ult=new d;function flt(e,t,n,i){const o=new Array(6),r=e.getCenter(),s=i.geodeticSurfaceNormal(r,ilt),a=i.cartesianToCartographic(r,olt);a.height=n;const c=i.cartographicToCartesian(a,rlt),u=Wt.fromPointNormal(c,s);o[0]=u;let f=0,h;const _=[];let g,p;for(h=0;h<4;h++){g=e.getVertex(h),_[h]=g,p=i.cartesianToCartographic(g,slt),p.height=t;const T=Wt.getPointDistance(u,i.cartographicToCartesian(p,alt));T<f&&(f=T)}const y=Wt.clone(u);for(y.normal=d.negate(y.normal,y.normal),y.distance=y.distance*-1+f,o[1]=y,h=0;h<4;h++){g=_[h];const T=_[(h+1)%4],b=i.geodeticSurfaceNormal(g,clt),x=d.subtract(T,g,ult);let v=d.cross(x,b,llt);v=d.normalize(v,v),o[2+h]=Wt.fromPointNormal(g,v)}return o}let lg=new d,ug=new d,fg=new d,ZR=new d,eN=new d,tN=new d;const dlt=new d,hlt=new d,plt=new d;let nN=new d,iN=new d,oN=new d,tm=new d;const $f=new te;function $q(e,t,n){lg=e.normal,ug=t.normal,fg=n.normal,ZR=d.multiplyByScalar(e.normal,-e.distance,ZR),eN=d.multiplyByScalar(t.normal,-t.distance,eN),tN=d.multiplyByScalar(n.normal,-n.distance,tN),nN=d.multiplyByScalar(d.cross(ug,fg,dlt),d.dot(ZR,lg),nN),iN=d.multiplyByScalar(d.cross(fg,lg,hlt),d.dot(eN,ug),iN),oN=d.multiplyByScalar(d.cross(lg,ug,plt),d.dot(tN,fg),oN),$f[0]=lg.x,$f[1]=ug.x,$f[2]=fg.x,$f[3]=lg.y,$f[4]=ug.y,$f[5]=fg.y,$f[6]=lg.z,$f[7]=ug.z,$f[8]=fg.z;const i=te.determinant($f);return tm=d.add(nN,iN,tm),tm=d.add(tm,oN,tm),new d(tm.x/i,tm.y/i,tm.z/i)}function mlt(e){const t=new Array(8);for(let n=0;n<4;n++)t[n]=$q(e[0],e[2+(n+3)%4],e[2+n%4]),t[n+4]=$q(e[1],e[2+(n+3)%4],e[2+n%4]);return t}let rN=new d,N0=new d;function sN(e,t){const n=[];for(let i=0;i<4;i++)rN=d.subtract(t[(i+1)%4],t[i],rN),N0=d.cross(e.normal,rN,N0),N0=d.normalize(N0,N0),n[i]=d.clone(N0);return n}Object.defineProperties(Wx.prototype,{boundingVolume:{get:function(){return this}},boundingSphere:{get:function(){return this._boundingSphere}}});const aN=new d;Wx.prototype.distanceToCamera=function(e){E.defined("frameState",e);const t=e.camera.positionWC,n=[],i=[];let o;Wt.getPointDistance(this._boundingPlanes[0],t)>0?(n.push(0),i.push(this._planeVertices[0]),o=this._edgeNormals[0]):Wt.getPointDistance(this._boundingPlanes[1],t)>0&&(n.push(1),i.push(this._planeVertices[1]),o=this._edgeNormals[1]);let r,s;for(r=0;r<4;r++)s=2+r,Wt.getPointDistance(this._boundingPlanes[s],t)>0&&(n.push(s),i.push(this._planeVertices[s]),o=this._edgeNormals[s]);if(n.length===0)return 0;let a,c;if(n.length===1)return c=this._boundingPlanes[n[0]],a=cN(Wt.projectPointOntoPlane(c,t,aN),i[0],c,o),d.distance(a,t);if(n.length===2){if(n[0]===0){const _=[this._vertices[4*n[0]+(n[1]-2)],this._vertices[4*n[0]+(n[1]-2+1)%4]];return a=Uoe(t,_[0],_[1]),d.distance(a,t)}let f=Number.MAX_VALUE,h;for(r=0;r<2;r++)c=this._boundingPlanes[n[r]],a=cN(Wt.projectPointOntoPlane(c,t,aN),i[r],c,this._edgeNormals[n[r]]),h=d.distanceSquared(a,t),h<f&&(f=h);return Math.sqrt(f)}else if(n.length>3)return a=cN(Wt.projectPointOntoPlane(this._boundingPlanes[1],t,aN),this._planeVertices[1],this._boundingPlanes[1],this._edgeNormals[1]),d.distance(a,t);const u=n[1]===2&&n[2]===5?0:1;return n[0]===0?d.distance(t,this._vertices[(n[1]-2+u)%4]):d.distance(t,this._vertices[4+(n[1]-2+u)%4])};const _lt=new d,glt=new d;function Uoe(e,t,n){const i=d.subtract(n,t,_lt),o=d.subtract(e,t,glt);let r=d.dot(i,o);if(r<=0)return t;const s=d.dot(i,i);return r>=s?n:(r=r/s,new d((1-r)*t.x+r*n.x,(1-r)*t.y+r*n.y,(1-r)*t.z+r*n.z))}const ylt=new Wt(d.UNIT_X,0);function cN(e,t,n,i){let o=Number.MAX_VALUE,r,s,a;for(let c=0;c<t.length;c++){const u=Wt.fromPointNormal(t[c],i[c],ylt);Wt.getPointDistance(u,e)<0||(a=Uoe(e,t[c],t[(c+1)%4]),r=d.distance(e,a),r<o&&(o=r,s=a))}return l(s)?s:e}Wx.prototype.intersectPlane=function(e){E.defined("plane",e);let t=0,n=0;for(let i=0;i<this._vertices.length;i++)d.dot(e.normal,this._vertices[i])+e.distance<0?n++:t++;return t===this._vertices.length?Vn.INSIDE:n===this._vertices.length?Vn.OUTSIDE:Vn.INTERSECTING};Wx.prototype.createDebugVolume=function(e){E.defined("color",e);const t=new N.clone(N.IDENTITY),n=new Zc({polygonHierarchy:{positions:this._planeVertices[0]}}),i=Zc.createGeometry(n),o=new xn({geometry:i,id:"outline",modelMatrix:t,attributes:{color:Bn.fromColor(e)}}),r=new Zc({polygonHierarchy:{positions:this._planeVertices[1]}}),s=Zc.createGeometry(r),a=new xn({geometry:s,id:"outline",modelMatrix:t,attributes:{color:Bn.fromColor(e)}}),c=[];for(let u=0;u<4;u++){const f=new Zc({polygonHierarchy:{positions:this._planeVertices[2+u]}}),h=Zc.createGeometry(f);c[u]=new xn({geometry:h,id:"outline",modelMatrix:t,attributes:{color:Bn.fromColor(e)}})}return new fn({geometryInstances:[c[0],c[1],c[2],c[3],a,o],appearance:new kn({translucent:!1,flat:!0}),asynchronous:!1})};function xp(e,t){t===0&&(t=F.EPSILON7),this._boundingSphere=new Ae(e,t)}Object.defineProperties(xp.prototype,{center:{get:function(){return this._boundingSphere.center}},radius:{get:function(){return this._boundingSphere.radius}},boundingVolume:{get:function(){return this._boundingSphere}},boundingSphere:{get:function(){return this._boundingSphere}}});xp.prototype.distanceToCamera=function(e){E.defined("frameState",e);const t=this._boundingSphere;return Math.max(0,d.distance(t.center,e.camera.positionWC)-t.radius)};xp.prototype.intersectPlane=function(e){return E.defined("plane",e),Ae.intersectPlane(this._boundingSphere,e)};xp.prototype.update=function(e,t){d.clone(e,this._boundingSphere.center),this._boundingSphere.radius=t};xp.prototype.createDebugVolume=function(e){E.defined("color",e);const t=new Jm({radius:this.radius}),n=N.fromTranslation(this.center,new N.clone(N.IDENTITY)),i=new xn({geometry:t,id:"outline",modelMatrix:n,attributes:{color:Bn.fromColor(e)}});return new fn({geometryInstances:i,appearance:new kn({translucent:!1,flat:!0}),asynchronous:!1})};const Alt=new d,Tlt=new d,Clt=new d,blt=new d;function Tg(e,t,n){n=d.cross(e,t,n);const i=d.magnitude(n);return d.multiplyByScalar(n,F.EPSILON7/i,n)}function lN(e,t){const n=d.normalize(e,blt),i=d.equalsEpsilon(n,d.UNIT_X,F.EPSILON6)?d.UNIT_Y:d.UNIT_X;return Tg(e,i,t)}function Hoe(e){let t=te.getColumn(e,0,Alt),n=te.getColumn(e,1,Tlt),i=te.getColumn(e,2,Clt);const o=d.equals(t,d.ZERO),r=d.equals(n,d.ZERO),s=d.equals(i,d.ZERO);return!o&&!r&&!s?e:o&&r&&s?(e[0]=F.EPSILON7,e[4]=F.EPSILON7,e[8]=F.EPSILON7,e):(o&&!r&&!s?t=Tg(n,i,t):!o&&r&&!s?n=Tg(t,i,n):!o&&!r&&s?i=Tg(n,t,i):o?r?s||(t=lN(i,t),n=Tg(i,t,n)):(t=lN(n,t),i=Tg(n,t,i)):(n=lN(t,n),i=Tg(n,t,i)),te.setColumn(e,0,t,e),te.setColumn(e,1,n,e),te.setColumn(e,2,i,e),e)}function Tf(e,t){t=Hoe(t),this._orientedBoundingBox=new Zt(e,t),this._boundingSphere=Ae.fromOrientedBoundingBox(this._orientedBoundingBox)}Object.defineProperties(Tf.prototype,{boundingVolume:{get:function(){return this._orientedBoundingBox}},boundingSphere:{get:function(){return this._boundingSphere}}});Tf.prototype.distanceToCamera=function(e){return E.defined("frameState",e),Math.sqrt(this._orientedBoundingBox.distanceSquaredTo(e.camera.positionWC))};Tf.prototype.intersectPlane=function(e){return E.defined("plane",e),this._orientedBoundingBox.intersectPlane(e)};Tf.prototype.update=function(e,t){d.clone(e,this._orientedBoundingBox.center),t=Hoe(t),te.clone(t,this._orientedBoundingBox.halfAxes),Ae.fromOrientedBoundingBox(this._orientedBoundingBox,this._boundingSphere)};Tf.prototype.createDebugVolume=function(e){E.defined("color",e);const t=new pl({minimum:new d(-1,-1,-1),maximum:new d(1,1,1)}),n=N.fromRotationTranslation(this.boundingVolume.halfAxes,this.boundingVolume.center),i=new xn({geometry:t,id:"outline",modelMatrix:n,attributes:{color:Bn.fromColor(e)}});return new fn({geometryInstances:i,appearance:new kn({translucent:!1,flat:!0}),asynchronous:!1})};function No(e,t,n,i){this._tileset=e,this._header=n;const o=l(n.contents),r=o&&n.contents.length>1||Wr(n,"3DTILES_multiple_contents"),s=o&&!r?n.contents[0]:n.content;this._contentHeader=s,this.transform=l(n.transform)?N.unpack(n.transform):N.clone(N.IDENTITY);const a=l(i)?i.computedTransform:e.modelMatrix,c=N.multiply(a,this.transform,new N),u=l(i)?i._initialTransform:N.IDENTITY;this._initialTransform=N.multiply(u,this.transform,new N),this.computedTransform=c,this._boundingVolume=this.createBoundingVolume(n.boundingVolume,c),this._boundingVolume2D=void 0;let f;l(s)&&l(s.boundingVolume)&&(f=this.createBoundingVolume(s.boundingVolume,c)),this._contentBoundingVolume=f,this._contentBoundingVolume2D=void 0;let h;l(n.viewerRequestVolume)&&(h=this.createBoundingVolume(n.viewerRequestVolume,c)),this._viewerRequestVolume=h,this.geometricError=n.geometricError,this._geometricError=n.geometricError,l(this._geometricError)||(this._geometricError=l(i)?i.geometricError:e._geometricError,No._deprecationWarning("geometricErrorUndefined","Required property geometricError is undefined for this tile. Using parent's geometric error instead.")),this.updateGeometricErrorScale();let _;l(n.refine)?((n.refine==="replace"||n.refine==="add")&&No._deprecationWarning("lowercase-refine",`This tile uses a lowercase refine "${n.refine}". Instead use "${n.refine.toUpperCase()}".`),_=n.refine.toUpperCase()==="REPLACE"?_c.REPLACE:_c.ADD):l(i)?_=i.refine:_=_c.REPLACE,this.refine=_,this.children=[],this.parent=i;let g,p=!1,y,T,b;if(t=je.createIfNeeded(t),r)y=gr.UNLOADED,T=t.clone();else if(l(s)){let L=s.uri;l(s.url)&&(No._deprecationWarning("contentUrl",'This tileset JSON uses the "content.url" property which has been deprecated. Use "content.uri" instead.'),L=s.url),L===""?(No._deprecationWarning("contentUriEmpty","content.uri property is an empty string, which creates a circular dependency, making this tileset invalid. Omit the content property instead"),g=new Ed(e,this),p=!0,y=gr.READY):(y=gr.UNLOADED,T=t.getDerivedResource({url:L}),b=Ui.getServerKey(T.getUrlComponent()))}else g=new Ed(e,this),p=!0,y=gr.READY;this._content=g,this._contentResource=T,this._contentState=y,this._contentReadyToProcessPromise=void 0,this._contentReadyPromise=void 0,this._expiredContent=void 0,this._serverKey=b,this.hasEmptyContent=p,this.hasTilesetContent=!1,this.hasImplicitContent=!1,this.hasImplicitContentMetadata=!1,this.hasMultipleContents=r,this.metadata=FU(e,n),this.cacheNode=void 0;const x=n.expire;let v,D;l(x)&&(v=x.duration,l(x.date)&&(D=ce.fromIso8601(x.date))),this.expireDuration=v,this.expireDate=D,this.lastStyleTime=0,this._optimChildrenWithinParent=pA.NOT_COMPUTED,this.clippingPlanesDirty=!1,this.priorityDeferred=!1,this.implicitTileset=void 0,this.implicitCoordinates=void 0,this.implicitSubtree=void 0,this._distanceToCamera=0,this._centerZDepth=0,this._screenSpaceError=0,this._screenSpaceErrorProgressiveResolution=0,this._visibilityPlaneMask=0,this._visible=!1,this._inRequestVolume=!1,this._finalResolution=!0,this._depth=0,this._stackLength=0,this._selectionDepth=0,this._updatedVisibilityFrame=0,this._touchedFrame=0,this._visitedFrame=0,this._selectedFrame=0,this._requestedFrame=0,this._ancestorWithContent=void 0,this._ancestorWithContentAvailable=void 0,this._refines=!1,this._shouldSelect=!1,this._isClipped=!0,this._clippingPlanesState=0,this._debugBoundingVolume=void 0,this._debugContentBoundingVolume=void 0,this._debugViewerRequestVolume=void 0,this._debugColor=k.fromRandom({alpha:1}),this._debugColorizeTiles=!1,this._priority=0,this._priorityHolder=this,this._priorityProgressiveResolution=!1,this._priorityProgressiveResolutionScreenSpaceErrorLeaf=!1,this._priorityReverseScreenSpaceError=0,this._foveatedFactor=0,this._wasMinPriorityChild=!1,this._loadTimestamp=new ce,this._commandsLength=0,this._color=void 0,this._colorDirty=!1,this._request=void 0}No._deprecationWarning=p_;Object.defineProperties(No.prototype,{tileset:{get:function(){return this._tileset}},content:{get:function(){return this._content}},boundingVolume:{get:function(){return this._boundingVolume}},contentBoundingVolume:{get:function(){return A(this._contentBoundingVolume,this._boundingVolume)}},boundingSphere:{get:function(){return this._boundingVolume.boundingSphere}},extras:{get:function(){return this._header.extras}},color:{get:function(){return l(this._color)||(this._color=new k),k.clone(this._color)},set:function(e){this._color=k.clone(e,this._color),this._colorDirty=!0}},contentAvailable:{get:function(){return this.contentReady&&!this.hasEmptyContent&&!this.hasTilesetContent&&!this.hasImplicitContent||l(this._expiredContent)&&!this.contentFailed}},contentReady:{get:function(){return this._contentState===gr.READY}},contentUnloaded:{get:function(){return this._contentState===gr.UNLOADED}},contentExpired:{get:function(){return this._contentState===gr.EXPIRED}},contentFailed:{get:function(){return this._contentState===gr.FAILED}},contentReadyToProcessPromise:{get:function(){return this._contentReadyToProcessPromise}},contentReadyPromise:{get:function(){return this._contentReadyPromise}},commandsLength:{get:function(){return this._commandsLength}}});const nm=new d;function Elt(e,t){const n=e._tileset,i=t.camera,o=e.boundingSphere,r=o.radius,s=d.multiplyByScalar(i.directionWC,e._centerZDepth,nm),a=d.add(i.positionWC,s,nm),c=d.subtract(a,o.center,nm);if(d.magnitude(c)>r){const v=d.normalize(c,nm),D=d.multiplyByScalar(v,r,nm),L=d.add(o.center,D,nm),B=d.subtract(L,i.positionWC,nm),V=d.normalize(B,nm);e._foveatedFactor=1-Math.abs(d.dot(i.directionWC,V))}else e._foveatedFactor=0;const h=e.refine===_c.REPLACE,_=n._skipLevelOfDetail;if(h&&!_||!n.foveatedScreenSpaceError||n.foveatedConeSize===1||e._priorityProgressiveResolution&&h&&_||n._pass===Va.PRELOAD_FLIGHT||n._pass===Va.PRELOAD)return!1;const g=1-Math.cos(i.frustum.fov*.5),p=n.foveatedConeSize*g;if(e._foveatedFactor<=p)return!1;const y=g-p,T=F.clamp((e._foveatedFactor-p)/y,0,1),b=n.foveatedInterpolationCallback(n.foveatedMinimumScreenSpaceErrorRelaxation,n.maximumScreenSpaceError,T),x=e._screenSpaceError===0&&l(e.parent)?e.parent._screenSpaceError*.5:e._screenSpaceError;return n.maximumScreenSpaceError-b<=x}const Voe=new ce;No.prototype.getScreenSpaceError=function(e,t,n){const i=this._tileset,o=A(n,1),r=l(this.parent)?this.parent.geometricError:i._geometricError,s=t?r:this.geometricError;if(s===0)return 0;const a=e.camera;let c=a.frustum;const u=e.context,f=u.drawingBufferWidth,h=u.drawingBufferHeight*o;let _;if(e.mode===me.SCENE2D||c instanceof nn){l(c._offCenterFrustum)&&(c=c._offCenterFrustum);const g=Math.max(c.top-c.bottom,c.right-c.left)/Math.max(f,h);_=s/g}else{const g=Math.max(this._distanceToCamera,F.EPSILON7),p=a.frustum.sseDenominator;if(_=s*h/(g*p),i.dynamicScreenSpaceError){const y=i._dynamicScreenSpaceErrorComputedDensity,T=i.dynamicScreenSpaceErrorFactor,b=F.fog(g,y)*T;_-=b}}return _/=e.pixelRatio,_};function xlt(e,t){if(e.progressiveResolutionHeightFraction<=0||e.progressiveResolutionHeightFraction>.5)return!1;let n=t._screenSpaceErrorProgressiveResolution>e._maximumScreenSpaceError;t._priorityProgressiveResolutionScreenSpaceErrorLeaf=!1;const i=t.parent,o=e._maximumScreenSpaceError,r=t._screenSpaceErrorProgressiveResolution<=o,s=l(i)&&i._screenSpaceErrorProgressiveResolution>o;return r&&s&&(t._priorityProgressiveResolutionScreenSpaceErrorLeaf=!0,n=!0),n}function wlt(e,t){const n=t.parent,o=l(n)&&(!e._skipLevelOfDetail||t._screenSpaceError===0||n.hasTilesetContent||n.hasImplicitContent)?n._screenSpaceError:t._screenSpaceError;return e.root._screenSpaceError-o}No.prototype.updateVisibility=function(e){const t=this.parent,n=this._tileset,i=l(t)?t.computedTransform:n.modelMatrix,o=l(t)?t._visibilityPlaneMask:Ur.MASK_INDETERMINATE;this.updateTransform(i),this._distanceToCamera=this.distanceToTile(e),this._centerZDepth=this.distanceToTileCenter(e),this._screenSpaceError=this.getScreenSpaceError(e,!1),this._screenSpaceErrorProgressiveResolution=this.getScreenSpaceError(e,!1,n.progressiveResolutionHeightFraction),this._visibilityPlaneMask=this.visibility(e,o),this._visible=this._visibilityPlaneMask!==Ur.MASK_OUTSIDE,this._inRequestVolume=this.insideViewerRequestVolume(e),this._priorityReverseScreenSpaceError=wlt(n,this),this._priorityProgressiveResolution=xlt(n,this),this.priorityDeferred=Elt(this,e)};No.prototype.updateExpiration=function(){if(l(this.expireDate)&&this.contentReady&&!this.hasEmptyContent&&!this.hasMultipleContents){const e=ce.now(Voe);ce.lessThan(this.expireDate,e)&&(this._contentState=gr.EXPIRED,this._expiredContent=this._content)}};function Slt(e){if(l(e.expireDuration)){const t=ce.now(Voe);ce.addSeconds(t,e.expireDuration,t),l(e.expireDate)?ce.lessThan(e.expireDate,t)&&ce.clone(t,e.expireDate):e.expireDate=ce.clone(t)}}function vlt(e){return function(){return e._priority}}No.prototype.requestContent=function(){return this.hasEmptyContent?0:this.hasMultipleContents?Dlt(this):Ilt(this)};function Dlt(e){let t=e._content;const n=e._tileset;if(!l(t)){const r=Wr(e._header,"3DTILES_multiple_contents")?e._header.extensions["3DTILES_multiple_contents"]:e._header;t=new Lf(n,e,e._contentResource.clone(),r),e._content=t}const i=t.requestInnerContents();if(i>0)return i;e._contentState=gr.LOADING;const o=t.contentsFetchedPromise.then(function(){if(!(e._contentState!==gr.LOADING||!l(t.readyPromise))){if(e.isDestroyed()){uN(e,n);return}return e._contentState=gr.PROCESSING,t}});return e._contentReadyToProcessPromise=o,e._contentReadyPromise=o.then(function(r){if(l(r))return t.readyPromise}).then(function(r){if(l(r)){if(e.isDestroyed()){uN(e,n);return}return e._selectedFrame=0,e.lastStyleTime=0,ce.now(e._loadTimestamp),e._contentState=gr.READY,r}}).catch(function(r){uN(e,n)}),0}function uN(e,t,n){e._contentState===gr.PROCESSING&&--t.statistics.numberOfTilesProcessing,e._contentState=gr.FAILED}function Ilt(e){const t=e._contentResource.clone(),n=e.contentExpired;n&&t.setQueryParameters({expired:e.expireDate.toString()});const i=new Ad({throttle:!0,throttleByServer:!0,type:xy.TILES3D,priorityFunction:vlt(e),serverKey:e._serverKey});e._request=i,t.request=i;const o=t.fetchArrayBuffer();if(!l(o))return 1;const r=e._contentState,s=e._tileset;e._contentState=gr.LOADING,++s.statistics.numberOfPendingRequests;const a=o.then(function(c){if(e.isDestroyed()){fN(e,s);return}const u=Plt(e,c);return n&&(e.expireDate=void 0),e._content=u,e._contentState=gr.PROCESSING,u});return e._contentReadyToProcessPromise=a,e._contentReadyPromise=a.then(function(c){if(l(c))return--s.statistics.numberOfPendingRequests,c.readyPromise}).then(function(c){if(l(c)){if(e.isDestroyed()){fN(e,s);return}return Slt(e),e._selectedFrame=0,e.lastStyleTime=0,ce.now(e._loadTimestamp),e._contentState=gr.READY,c}}).catch(function(c){return i.state===or.CANCELLED?(e._contentState=r,--s.statistics.numberOfPendingRequests,++s.statistics.numberOfAttemptedRequests,Promise.reject("Cancelled")):(fN(e,s),Promise.reject(c))}),0}function fN(e,t){e._contentState===gr.PROCESSING?--t.statistics.numberOfTilesProcessing:--t.statistics.numberOfPendingRequests,e._contentState=gr.FAILED}function Plt(e,t){const n=Ooe(t),i=e._tileset;i._disableSkipLevelOfDetail=i._disableSkipLevelOfDetail||n.contentType===Mc.GEOMETRY||n.contentType===Mc.VECTOR,(n.contentType===Mc.IMPLICIT_SUBTREE||n.contentType===Mc.IMPLICIT_SUBTREE_JSON)&&(e.hasImplicitContent=!0),n.contentType===Mc.EXTERNAL_TILESET&&(e.hasTilesetContent=!0);let o;const r=Ioe[n.contentType];l(n.binaryPayload)?o=r(i,e,e._contentResource,n.binaryPayload.buffer,0):o=r(i,e,e._contentResource,n.jsonPayload);const s=e._contentHeader;if(e.hasImplicitContentMetadata){const c=e.implicitSubtree,u=e.implicitCoordinates;o.metadata=c.getContentMetadataView(u,0)}else e.hasImplicitContent||(o.metadata=RP(i,s));const a=Poe(i,s);return l(a)&&(o.group=new oU({metadata:a})),o}No.prototype.cancelRequests=function(){this.hasMultipleContents?this._content.cancelRequests():this._request.cancel()};No.prototype.unloadContent=function(){this.hasEmptyContent||this.hasTilesetContent||this.hasImplicitContent||(this._content=this._content&&this._content.destroy(),this._contentState=gr.UNLOADED,this._contentReadyToProcessPromise=void 0,this._contentReadyPromise=void 0,this.lastStyleTime=0,this.clippingPlanesDirty=this._clippingPlanesState===0,this._clippingPlanesState=0,this._debugColorizeTiles=!1,this._debugBoundingVolume=this._debugBoundingVolume&&this._debugBoundingVolume.destroy(),this._debugContentBoundingVolume=this._debugContentBoundingVolume&&this._debugContentBoundingVolume.destroy(),this._debugViewerRequestVolume=this._debugViewerRequestVolume&&this._debugViewerRequestVolume.destroy())};const koe=new Ae;function HU(e,t){if(t.mode!==me.SCENE3D&&!l(e._boundingVolume2D)){const n=e._boundingVolume.boundingSphere,i=Ae.projectTo2D(n,t.mapProjection,koe);e._boundingVolume2D=new xp(i.center,i.radius)}return t.mode!==me.SCENE3D?e._boundingVolume2D:e._boundingVolume}function Olt(e,t){if(t.mode!==me.SCENE3D&&!l(e._contentBoundingVolume2D)){const n=e._contentBoundingVolume.boundingSphere,i=Ae.projectTo2D(n,t.mapProjection,koe);e._contentBoundingVolume2D=new xp(i.center,i.radius)}return t.mode!==me.SCENE3D?e._contentBoundingVolume2D:e._contentBoundingVolume}No.prototype.visibility=function(e,t){const n=e.cullingVolume,i=HU(this,e),o=this._tileset,r=o.clippingPlanes;if(l(r)&&r.enabled){const s=r.computeIntersectionWithBoundingVolume(i,o.clippingPlanesOriginMatrix);if(this._isClipped=s!==Vn.INSIDE,s===Vn.OUTSIDE)return Ur.MASK_OUTSIDE}return n.computeVisibilityWithPlaneMask(i,t)};No.prototype.contentVisibility=function(e){if(!l(this._contentBoundingVolume)||this._visibilityPlaneMask===Ur.MASK_INSIDE)return Vn.INSIDE;const t=e.cullingVolume,n=Olt(this,e),i=this._tileset,o=i.clippingPlanes;if(l(o)&&o.enabled){const r=o.computeIntersectionWithBoundingVolume(n,i.clippingPlanesOriginMatrix);if(this._isClipped=r!==Vn.INSIDE,r===Vn.OUTSIDE)return Vn.OUTSIDE}return t.computeVisibility(n)};No.prototype.distanceToTile=function(e){return HU(this,e).distanceToCamera(e)};const Llt=new d;No.prototype.distanceToTileCenter=function(e){const n=HU(this,e).boundingVolume,i=d.subtract(n.center,e.camera.positionWC,Llt);return d.dot(e.camera.directionWC,i)};No.prototype.insideViewerRequestVolume=function(e){const t=this._viewerRequestVolume;return!l(t)||t.distanceToCamera(e)===0};const Goe=new te,Woe=new d,Blt=new te,qoe=new d,joe=new Ee,Rlt=new Zt,p2=new N;function Nlt(e,t,n){let i=d.fromElements(e[0],e[1],e[2],qoe),o=te.fromArray(e,3,Blt);i=N.multiplyByPoint(t,i,i);const r=N.getMatrix3(t,Goe);return o=te.multiply(r,o,o),l(n)?(n.update(i,o),n):new Tf(i,o)}function Mlt(e,t,n,i){const o=Ee.unpack(e,0,joe),r=e[4],s=e[5],a=Zt.fromRectangle(o,r,s,be.WGS84,Rlt);let c=a.center,u=a.halfAxes;t=N.multiplyTransformation(t,N.inverseTransformation(n,p2),p2),c=N.multiplyByPoint(t,c,c);const f=N.getMatrix3(t,Goe);return u=te.multiply(f,u,u),l(i)&&i instanceof Tf?(i.update(c,u),i):new Tf(c,u)}function Flt(e,t,n,i){if(!N.equalsEpsilon(t,n,F.EPSILON8))return Mlt(e,t,n,i);if(l(i))return i;const o=Ee.unpack(e,0,joe);return new Td({rectangle:o,minimumHeight:e[4],maximumHeight:e[5]})}function zlt(e,t,n){let i=d.fromElements(e[0],e[1],e[2],qoe),o=e[3];i=N.multiplyByPoint(t,i,i);const r=N.getScale(t,Woe),s=d.maximumComponent(r);return o*=s,l(n)?(n.update(i,o),n):new xp(i,o)}No.prototype.createBoundingVolume=function(e,t,n){if(!l(e))throw new Fe("boundingVolume must be defined");if(Wr(e,"3DTILES_bounding_volume_S2"))return new Wx(e.extensions["3DTILES_bounding_volume_S2"]);if(l(e.box))return Nlt(e.box,t,n);if(l(e.region))return Flt(e.region,t,this._initialTransform,n);if(l(e.sphere))return zlt(e.sphere,t,n);throw new Fe("boundingVolume must contain a sphere, region, or box")};No.prototype.updateTransform=function(e){e=A(e,N.IDENTITY);const t=N.multiply(e,this.transform,p2);if(!!N.equals(t,this.computedTransform))return;N.clone(t,this.computedTransform);const i=this._header,o=this._contentHeader;this._boundingVolume=this.createBoundingVolume(i.boundingVolume,this.computedTransform,this._boundingVolume),l(this._contentBoundingVolume)&&(this._contentBoundingVolume=this.createBoundingVolume(o.boundingVolume,this.computedTransform,this._contentBoundingVolume)),l(this._viewerRequestVolume)&&(this._viewerRequestVolume=this.createBoundingVolume(i.viewerRequestVolume,this.computedTransform,this._viewerRequestVolume)),this.updateGeometricErrorScale(),this._debugBoundingVolume=this._debugBoundingVolume&&this._debugBoundingVolume.destroy(),this._debugContentBoundingVolume=this._debugContentBoundingVolume&&this._debugContentBoundingVolume.destroy(),this._debugViewerRequestVolume=this._debugViewerRequestVolume&&this._debugViewerRequestVolume.destroy()};No.prototype.updateGeometricErrorScale=function(){const e=N.getScale(this.computedTransform,Woe),t=d.maximumComponent(e);this.geometricError=this._geometricError*t};function Ult(e,t,n,i){if(!i.isRender)return;const o=l(e._contentHeader)&&l(e._contentHeader.boundingVolume),r=e.hasEmptyContent||e.hasTilesetContent||e.hasImplicitContent,s=t.debugShowBoundingVolume||t.debugShowContentBoundingVolume&&!o;if(s){let u;e._finalResolution?r?u=k.DARKGRAY:u=k.WHITE:u=k.YELLOW,l(e._debugBoundingVolume)||(e._debugBoundingVolume=e._boundingVolume.createDebugVolume(u)),e._debugBoundingVolume.update(n);const f=e._debugBoundingVolume.getGeometryInstanceAttributes("outline");f.color=Bn.toValue(u,f.color)}else!s&&l(e._debugBoundingVolume)&&(e._debugBoundingVolume=e._debugBoundingVolume.destroy());t.debugShowContentBoundingVolume&&o?(l(e._debugContentBoundingVolume)||(e._debugContentBoundingVolume=e._contentBoundingVolume.createDebugVolume(k.BLUE)),e._debugContentBoundingVolume.update(n)):!t.debugShowContentBoundingVolume&&l(e._debugContentBoundingVolume)&&(e._debugContentBoundingVolume=e._debugContentBoundingVolume.destroy()),t.debugShowViewerRequestVolume&&l(e._viewerRequestVolume)?(l(e._debugViewerRequestVolume)||(e._debugViewerRequestVolume=e._viewerRequestVolume.createDebugVolume(k.YELLOW)),e._debugViewerRequestVolume.update(n)):!t.debugShowViewerRequestVolume&&l(e._debugViewerRequestVolume)&&(e._debugViewerRequestVolume=e._debugViewerRequestVolume.destroy());const a=t.debugColorizeTiles&&!e._debugColorizeTiles||l(t._heatmap.tilePropertyName),c=!t.debugColorizeTiles&&e._debugColorizeTiles;a?(t._heatmap.colorize(e,n),e._debugColorizeTiles=!0,e.color=e._debugColor):c&&(e._debugColorizeTiles=!1,e.color=k.WHITE),e._colorDirty&&(e._colorDirty=!1,e._content.applyDebugSettings(!0,e._color)),c&&t.makeStyleDirty()}function Hlt(e,t,n){const i=e._content,o=e._expiredContent;if(!e.hasMultipleContents&&l(o)){if(!e.contentReady){o.update(t,n);return}e._expiredContent.destroy(),e._expiredContent=void 0}i.update(t,n)}function Vlt(e,t){const n=t.clippingPlanes;let i=0;l(n)&&e._isClipped&&n.enabled&&(i=n.clippingPlanesState),i!==e._clippingPlanesState&&(e._clippingPlanesState=i,e.clippingPlanesDirty=!0)}No.prototype.update=function(e,t,n){const i=t.commandList.length;Vlt(this,e),Ult(this,e,t,n),Hlt(this,e,t);const r=t.commandList.length-i;this._commandsLength=r;for(let s=0;s<r;++s){const a=t.commandList[i+s],c=a.pass===We.TRANSLUCENT;a.depthForTranslucentClassification=c}this.clippingPlanesDirty=!1};const Xq=[];No.prototype.process=function(e,t){const n=t.commandList;t.commandList=Xq,this._content.update(e,t),Xq.length=0,t.commandList=n};function Kq(e,t,n){const i=e*Math.pow(10,t);return parseInt(i)*Math.pow(10,n)}function Fv(e,t,n){return Math.max(F.normalize(e,t,n)-F.EPSILON7,0)}No.prototype.updatePriority=function(){const e=this.tileset,t=e.preferLeaves,n=e._minimumPriority,i=e._maximumPriority,o=4,r=1,s=0,a=o,c=s+a,u=o,f=c+u,h=r,_=Math.pow(10,f),g=f+h,p=r,y=Math.pow(10,g),T=g+p,b=Math.pow(10,T);let x=Fv(this._depth,n.depth,i.depth);x=t?1-x:x;const D=!e._skipLevelOfDetail&&this.refine===_c.REPLACE?Fv(this._priorityHolder._distanceToCamera,n.distance,i.distance):Fv(this._priorityReverseScreenSpaceError,n.reverseScreenSpaceError,i.reverseScreenSpaceError),L=Kq(D,a,s),B=this._priorityProgressiveResolution?0:_,V=Fv(this._priorityHolder._foveatedFactor,n.foveatedFactor,i.foveatedFactor),M=Kq(V,u,c),H=this.priorityDeferred?y:0,G=e._pass===Va.PRELOAD_FLIGHT?0:b;this._priority=x+L+B+M+H+G};No.prototype.isDestroyed=function(){return!1};No.prototype.destroy=function(){return this._content=this._content&&this._content.destroy(),this._expiredContent=this._expiredContent&&!this._expiredContent.isDestroyed()&&this._expiredContent.destroy(),this._debugBoundingVolume=this._debugBoundingVolume&&this._debugBoundingVolume.destroy(),this._debugContentBoundingVolume=this._debugContentBoundingVolume&&this._debugContentBoundingVolume.destroy(),this._debugViewerRequestVolume=this._debugViewerRequestVolume&&this._debugViewerRequestVolume.destroy(),Je(this)};function xd(e){e=A(e,A.EMPTY_OBJECT);const t=e.id,n=e.group,i=e.class;E.typeOf.object("options.group",n),E.typeOf.object("options.class",i);const o=l(n.properties)?n.properties:{};this._class=i,this._properties=o,this._id=t,this._extras=n.extras,this._extensions=n.extensions}Object.defineProperties(xd.prototype,{class:{get:function(){return this._class}},id:{get:function(){return this._id}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}});xd.prototype.hasProperty=function(e){return cn.hasProperty(e,this._properties,this._class)};xd.prototype.hasPropertyBySemantic=function(e){return cn.hasPropertyBySemantic(e,this._properties,this._class)};xd.prototype.getPropertyIds=function(e){return cn.getPropertyIds(this._properties,this._class,e)};xd.prototype.getProperty=function(e){return cn.getProperty(e,this._properties,this._class)};xd.prototype.setProperty=function(e,t){return cn.setProperty(e,t,this._properties,this._class)};xd.prototype.getPropertyBySemantic=function(e){return cn.getPropertyBySemantic(e,this._properties,this._class)};xd.prototype.setPropertyBySemantic=function(e,t){return cn.setPropertyBySemantic(e,t,this._properties,this._class)};function wp(e){e=A(e,A.EMPTY_OBJECT);const t=e.tileset,n=e.class;E.typeOf.object("options.tileset",t),E.typeOf.object("options.class",n);const i=l(t.properties)?t.properties:{};this._class=n,this._properties=i,this._extras=t.extras,this._extensions=t.extensions}Object.defineProperties(wp.prototype,{class:{get:function(){return this._class}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}});wp.prototype.hasProperty=function(e){return cn.hasProperty(e,this._properties,this._class)};wp.prototype.hasPropertyBySemantic=function(e){return cn.hasPropertyBySemantic(e,this._properties,this._class)};wp.prototype.getPropertyIds=function(e){return cn.getPropertyIds(this._properties,this._class,e)};wp.prototype.getProperty=function(e){return cn.getProperty(e,this._properties,this._class)};wp.prototype.setProperty=function(e,t){return cn.setProperty(e,t,this._properties,this._class)};wp.prototype.getPropertyBySemantic=function(e){return cn.getPropertyBySemantic(e,this._properties,this._class)};wp.prototype.setPropertyBySemantic=function(e,t){return cn.setPropertyBySemantic(e,t,this._properties,this._class)};function Yoe(e){e=A(e,A.EMPTY_OBJECT);const t=e.metadataJson,n=e.schema;E.typeOf.object("options.metadataJson",t),E.typeOf.object("options.schema",n);const i=A(t.metadata,t.tileset);let o;l(i)&&(o=new wp({tileset:i,class:n.classes[i.class]}));let r=[];const s=[],a=t.groups;if(Array.isArray(a)){const c=a.length;for(let u=0;u<c;u++){const f=a[u];s.push(new xd({group:f,class:n.classes[f.class]}))}}else if(l(a)){r=Object.keys(a).sort();const c=r.length;for(let u=0;u<c;u++){const f=r[u];if(a.hasOwnProperty(f)){const h=a[f];s.push(new xd({id:f,group:a[f],class:n.classes[h.class]}))}}}this._schema=n,this._groups=s,this._groupIds=r,this._tileset=o,this._statistics=t.statistics,this._extras=t.extras,this._extensions=t.extensions}Object.defineProperties(Yoe.prototype,{schema:{get:function(){return this._schema}},groups:{get:function(){return this._groups}},groupIds:{get:function(){return this._groupIds}},tileset:{get:function(){return this._tileset}},statistics:{get:function(){return this._statistics}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}});const $oe={},klt=new d;$oe.checkChildrenWithinParent=function(e){E.typeOf.object("tile",e);const t=e.children,n=t.length,i=e.boundingVolume;if(i instanceof Tf||i instanceof Td){const o=i._orientedBoundingBox;e._optimChildrenWithinParent=pA.USE_OPTIMIZATION;for(let r=0;r<n;++r){const a=t[r].boundingVolume;if(!(a instanceof Tf||a instanceof Td)){e._optimChildrenWithinParent=pA.SKIP_OPTIMIZATION;break}const c=a._orientedBoundingBox,u=d.subtract(c.center,o.center,klt),f=d.magnitude(u);d.divideByScalar(u,f,u);const h=Math.abs(o.halfAxes[0]*u.x)+Math.abs(o.halfAxes[1]*u.y)+Math.abs(o.halfAxes[2]*u.z)+Math.abs(o.halfAxes[3]*u.x)+Math.abs(o.halfAxes[4]*u.y)+Math.abs(o.halfAxes[5]*u.z)+Math.abs(o.halfAxes[6]*u.x)+Math.abs(o.halfAxes[7]*u.y)+Math.abs(o.halfAxes[8]*u.z),_=Math.abs(c.halfAxes[0]*u.x)+Math.abs(c.halfAxes[1]*u.y)+Math.abs(c.halfAxes[2]*u.z)+Math.abs(c.halfAxes[3]*u.x)+Math.abs(c.halfAxes[4]*u.y)+Math.abs(c.halfAxes[5]*u.z)+Math.abs(c.halfAxes[6]*u.x)+Math.abs(c.halfAxes[7]*u.y)+Math.abs(c.halfAxes[8]*u.z);if(h<=_+f){e._optimChildrenWithinParent=pA.SKIP_OPTIMIZATION;break}}}return e._optimChildrenWithinParent===pA.USE_OPTIMIZATION};const Glt=$oe;function qx(){this.head=void 0,this.tail=void 0,this._length=0}Object.defineProperties(qx.prototype,{length:{get:function(){return this._length}}});function Wlt(e,t,n){this.item=e,this.previous=t,this.next=n}qx.prototype.add=function(e){const t=new Wlt(e,this.tail,void 0);return l(this.tail)?(this.tail.next=t,this.tail=t):(this.head=t,this.tail=t),++this._length,t};function Xoe(e,t){l(t.previous)&&l(t.next)?(t.previous.next=t.next,t.next.previous=t.previous):l(t.previous)?(t.previous.next=void 0,e.tail=t.previous):l(t.next)?(t.next.previous=void 0,e.head=t.next):(e.head=void 0,e.tail=void 0),t.next=void 0,t.previous=void 0}qx.prototype.remove=function(e){l(e)&&(Xoe(this,e),--this._length)};qx.prototype.splice=function(e,t){if(e===t)return;Xoe(this,t);const n=e.next;e.next=t,this.tail===e?this.tail=t:n.previous=t,t.next=n,t.previous=e};function jy(){this._list=new qx,this._sentinel=this._list.add(),this._trimTiles=!1}jy.prototype.reset=function(){this._list.splice(this._list.tail,this._sentinel)};jy.prototype.touch=function(e){const t=e.cacheNode;l(t)&&this._list.splice(this._sentinel,t)};jy.prototype.add=function(e){l(e.cacheNode)||(e.cacheNode=this._list.add(e))};jy.prototype.unloadTile=function(e,t,n){const i=t.cacheNode;l(i)&&(this._list.remove(i),t.cacheNode=void 0,n(e,t))};jy.prototype.unloadTiles=function(e,t){const n=this._trimTiles;this._trimTiles=!1;const i=this._list,o=e.maximumMemoryUsage*1024*1024,r=this._sentinel;let s=i.head;for(;s!==r&&(e.totalMemoryUsageInBytes>o||n);){const a=s.item;s=s.next,this.unloadTile(e,a,t)}};jy.prototype.trim=function(){this._trimTiles=!0};function NP(e){this.tilePropertyName=e,this._minimum=Number.MAX_VALUE,this._maximum=-Number.MAX_VALUE,this._previousMinimum=Number.MAX_VALUE,this._previousMaximum=-Number.MAX_VALUE,this._referenceMinimum={},this._referenceMaximum={}}function m2(e,t){let n;return t==="_loadTimestamp"?n=ce.toDate(e).getTime():n=e,n}NP.prototype.setReferenceMinimumMaximum=function(e,t,n){this._referenceMinimum[n]=m2(e,n),this._referenceMaximum[n]=m2(t,n)};function qlt(e,t){const n=e.tilePropertyName;if(l(n)){const i=m2(t[n],n);return l(i)?(e._maximum=Math.max(i,e._maximum),e._minimum=Math.min(i,e._minimum),i):(e.tilePropertyName=void 0,i)}}const dN=[new k(.1,.1,.1,1),new k(.153,.278,.878,1),new k(.827,.231,.49,1),new k(.827,.188,.22,1),new k(1,.592,.259,1),new k(1,.843,0,1)];NP.prototype.colorize=function(e,t){const n=this.tilePropertyName;if(!l(n)||!e.contentAvailable||e._selectedFrame!==t.frameNumber)return;const i=qlt(this,e),o=this._previousMinimum,r=this._previousMaximum;if(o===Number.MAX_VALUE||r===-Number.MAX_VALUE)return;const s=r-o+F.EPSILON7,c=F.clamp(i-o,0,s)/s,u=dN.length-1,f=c*u,h=Math.floor(f),_=Math.ceil(f),g=f-h,p=dN[h],y=dN[_],T=k.clone(k.WHITE);T.red=F.lerp(p.red,y.red,g),T.green=F.lerp(p.green,y.green,g),T.blue=F.lerp(p.blue,y.blue,g),e._debugColor=T};NP.prototype.resetMinimumMaximum=function(){const e=this.tilePropertyName;if(l(e)){const t=this._referenceMinimum[e],n=this._referenceMaximum[e],i=l(t)&&l(n);this._previousMinimum=i?t:this._minimum,this._previousMaximum=i?n:this._maximum,this._minimum=Number.MAX_VALUE,this._maximum=-Number.MAX_VALUE}};function md(){this.selected=0,this.visited=0,this.numberOfCommands=0,this.numberOfAttemptedRequests=0,this.numberOfPendingRequests=0,this.numberOfTilesProcessing=0,this.numberOfTilesWithContentReady=0,this.numberOfTilesTotal=0,this.numberOfLoadedTilesTotal=0,this.numberOfFeaturesSelected=0,this.numberOfFeaturesLoaded=0,this.numberOfPointsSelected=0,this.numberOfPointsLoaded=0,this.numberOfTrianglesSelected=0,this.numberOfTilesStyled=0,this.numberOfFeaturesStyled=0,this.numberOfTilesCulledWithChildrenUnion=0,this.geometryByteLength=0,this.texturesByteLength=0,this.batchTableByteLength=0}md.prototype.clear=function(){this.selected=0,this.visited=0,this.numberOfCommands=0,this.numberOfAttemptedRequests=0,this.numberOfFeaturesSelected=0,this.numberOfPointsSelected=0,this.numberOfTrianglesSelected=0,this.numberOfTilesStyled=0,this.numberOfFeaturesStyled=0,this.numberOfTilesCulledWithChildrenUnion=0};function MP(e,t,n,i){const o=t.innerContents,r=t.pointsLength,s=t.trianglesLength,a=t.featuresLength,c=t.geometryByteLength,u=t.texturesByteLength,f=t.batchTableByteLength;if(i?(e.numberOfFeaturesLoaded+=n?-a:a,e.numberOfPointsLoaded+=n?-r:r,e.geometryByteLength+=n?-c:c,e.texturesByteLength+=n?-u:u,e.batchTableByteLength+=n?-f:f):(e.numberOfFeaturesSelected+=n?-a:a,e.numberOfPointsSelected+=n?-r:r,e.numberOfTrianglesSelected+=n?-s:s),l(o)){const h=o.length;for(let _=0;_<h;++_)MP(e,o[_],n,i)}}md.prototype.incrementSelectionCounts=function(e){MP(this,e,!1,!1)};md.prototype.incrementLoadCounts=function(e){MP(this,e,!1,!0)};md.prototype.decrementLoadCounts=function(e){MP(this,e,!0,!0)};md.clone=function(e,t){t.selected=e.selected,t.visited=e.visited,t.numberOfCommands=e.numberOfCommands,t.selected=e.selected,t.numberOfAttemptedRequests=e.numberOfAttemptedRequests,t.numberOfPendingRequests=e.numberOfPendingRequests,t.numberOfTilesProcessing=e.numberOfTilesProcessing,t.numberOfTilesWithContentReady=e.numberOfTilesWithContentReady,t.numberOfTilesTotal=e.numberOfTilesTotal,t.numberOfFeaturesSelected=e.numberOfFeaturesSelected,t.numberOfFeaturesLoaded=e.numberOfFeaturesLoaded,t.numberOfPointsSelected=e.numberOfPointsSelected,t.numberOfPointsLoaded=e.numberOfPointsLoaded,t.numberOfTrianglesSelected=e.numberOfTrianglesSelected,t.numberOfTilesStyled=e.numberOfTilesStyled,t.numberOfFeaturesStyled=e.numberOfFeaturesStyled,t.numberOfTilesCulledWithChildrenUnion=e.numberOfTilesCulledWithChildrenUnion,t.geometryByteLength=e.geometryByteLength,t.texturesByteLength=e.texturesByteLength,t.batchTableByteLength=e.batchTableByteLength};function jx(){this._style=void 0,this._styleDirty=!1,this._lastStyleTime=0}Object.defineProperties(jx.prototype,{style:{get:function(){return this._style},set:function(e){e!==this._style&&(this._style=e,this._styleDirty=!0)}}});jx.prototype.makeDirty=function(){this._styleDirty=!0};jx.prototype.resetDirty=function(){this._styleDirty=!1};jx.prototype.applyStyle=function(e){if(!e.ready||l(this._style)&&!this._style._ready)return;const t=this._styleDirty;t&&++this._lastStyleTime;const n=this._lastStyleTime,i=e._statistics,o=t?e._selectedTiles:e._selectedTilesToStyle,r=o.length;for(let s=0;s<r;++s){const a=o[s];if(a.lastStyleTime!==n){const c=a.content;a.lastStyleTime=n,c.applyStyle(this._style),i.numberOfFeaturesStyled+=c.featuresLength,++i.numberOfTilesStyled}}};function jlt(e,t,n){const i=Wr(t,"3DTILES_implicit_tiling")?t.extensions["3DTILES_implicit_tiling"]:t.implicitTiling;E.typeOf.object("implicitTiling",i),this.baseResource=e,this.geometricError=t.geometricError,this.metadataSchema=n;const o=t.boundingVolume;if(!l(o.box)&&!l(o.region)&&!Wr(o,"3DTILES_bounding_volume_S2")&&!Wr(o,"3DTILES_bounding_volume_cylinder"))throw new Fe("Only box, region, 3DTILES_bounding_volume_S2, and 3DTILES_bounding_volume_cylinder are supported for implicit tiling");this.boundingVolume=o,this.refine=t.refine,this.subtreeUriTemplate=new je({url:i.subtrees.uri}),this.contentUriTemplates=[],this.contentHeaders=[];const r=Ylt(t);for(let s=0;s<r.length;s++){const a=r[s];this.contentHeaders.push(St(a,!0));const c=new je({url:a.uri});this.contentUriTemplates.push(c)}this.contentCount=this.contentHeaders.length,this.tileHeader=$lt(t),this.subdivisionScheme=us[i.subdivisionScheme],this.branchingFactor=us.getBranchingFactor(this.subdivisionScheme),this.subtreeLevels=i.subtreeLevels,l(i.availableLevels)?this.availableLevels=i.availableLevels:this.availableLevels=i.maximumLevel+1}function Ylt(e){if(Wr(e,"3DTILES_multiple_contents")){const t=e.extensions["3DTILES_multiple_contents"];return l(t.contents)?t.contents:t.content}return l(e.contents)?e.contents:l(e.content)?[e.content]:[]}function $lt(e){const t=St(e,!0);return l(t.extensions)&&(delete t.extensions["3DTILES_implicit_tiling"],delete t.extensions["3DTILES_multiple_contents"],Object.keys(t.extensions).length===0&&delete t.extensions),delete t.implicitTiling,delete t.contents,delete t.content,t}const Yx={};function Jq(e){return e=(e^e<<8)&16711935,e=(e^e<<4)&252645135,e=(e^e<<2)&858993459,e=(e^e<<1)&1431655765,e}function hN(e){return e=(e^e<<16)&50331903,e=(e^e<<8)&50393103,e=(e^e<<4)&51130563,e=(e^e<<2)&153391689,e}function Qq(e){return e&=1431655765,e=(e^e>>1)&858993459,e=(e^e>>2)&252645135,e=(e^e>>4)&16711935,e=(e^e>>8)&65535,e}function pN(e){return e&=153391689,e=(e^e>>2)&51130563,e=(e^e>>4)&50393103,e=(e^e>>8)&4278190335,e=(e^e>>16)&1023,e}Yx.encode2D=function(e,t){if(E.typeOf.number("x",e),E.typeOf.number("y",t),e<0||e>65535||t<0||t>65535)throw new w("inputs must be 16-bit unsigned integers");return(Jq(e)|Jq(t)<<1)>>>0};Yx.decode2D=function(e,t){if(E.typeOf.number("mortonIndex",e),e<0||e>4294967295)throw new w("input must be a 32-bit unsigned integer");return l(t)||(t=new Array(2)),t[0]=Qq(e),t[1]=Qq(e>>1),t};Yx.encode3D=function(e,t,n){if(E.typeOf.number("x",e),E.typeOf.number("y",t),E.typeOf.number("z",n),e<0||e>1023||t<0||t>1023||n<0||n>1023)throw new w("inputs must be 10-bit unsigned integers");return hN(e)|hN(t)<<1|hN(n)<<2};Yx.decode3D=function(e,t){if(E.typeOf.number("mortonIndex",e),e<0||e>1073741823)throw new w("input must be a 30-bit unsigned integer");return l(t)||(t=new Array(3)),t[0]=pN(e),t[1]=pN(e>>1),t[2]=pN(e>>2),t};const l1=Yx;function Mo(e){if(E.typeOf.string("options.subdivisionScheme",e.subdivisionScheme),E.typeOf.number("options.subtreeLevels",e.subtreeLevels),E.typeOf.number("options.level",e.level),E.typeOf.number("options.x",e.x),E.typeOf.number("options.y",e.y),e.subdivisionScheme===us.OCTREE&&E.typeOf.number("options.z",e.z),e.level<0)throw new w("level must be non-negative");if(e.x<0)throw new w("x must be non-negative");if(e.y<0)throw new w("y must be non-negative");if(e.subdivisionScheme===us.OCTREE&&e.z<0)throw new w("z must be non-negative");const t=1<<e.level;if(e.x>=t)throw new w("x is out of range");if(e.y>=t)throw new w("y is out of range");if(e.subdivisionScheme===us.OCTREE&&e.z>=t)throw new w("z is out of range");this.subdivisionScheme=e.subdivisionScheme,this.subtreeLevels=e.subtreeLevels,this.level=e.level,this.x=e.x,this.y=e.y,this.z=void 0,e.subdivisionScheme===us.OCTREE&&(this.z=e.z)}Object.defineProperties(Mo.prototype,{childIndex:{get:function(){let e=0;return e|=this.x&1,e|=(this.y&1)<<1,this.subdivisionScheme===us.OCTREE&&(e|=(this.z&1)<<2),e}},mortonIndex:{get:function(){return this.subdivisionScheme===us.OCTREE?l1.encode3D(this.x,this.y,this.z):l1.encode2D(this.x,this.y)}},tileIndex:{get:function(){const e=this.subdivisionScheme===us.OCTREE?((1<<3*this.level)-1)/7:((1<<2*this.level)-1)/3,t=this.mortonIndex;return e+t}}});function VU(e,t){if(e.subdivisionScheme!==t.subdivisionScheme)throw new w("coordinates must have same subdivisionScheme");if(e.subtreeLevels!==t.subtreeLevels)throw new w("coordinates must have same subtreeLevels")}Mo.prototype.getDescendantCoordinates=function(e){E.typeOf.object("offsetCoordinates",e),VU(this,e);const t=this.level+e.level,n=(this.x<<e.level)+e.x,i=(this.y<<e.level)+e.y;if(this.subdivisionScheme===us.OCTREE){const o=(this.z<<e.level)+e.z;return new Mo({subdivisionScheme:this.subdivisionScheme,subtreeLevels:this.subtreeLevels,level:t,x:n,y:i,z:o})}return new Mo({subdivisionScheme:this.subdivisionScheme,subtreeLevels:this.subtreeLevels,level:t,x:n,y:i})};Mo.prototype.getAncestorCoordinates=function(e){if(E.typeOf.number("offsetLevels",e),e<0)throw new w("offsetLevels must be non-negative");if(e>this.level)throw new w("ancestor cannot be above the tileset root");const t=1<<e,n=this.level-e,i=Math.floor(this.x/t),o=Math.floor(this.y/t);if(this.subdivisionScheme===us.OCTREE){const r=Math.floor(this.z/t);return new Mo({subdivisionScheme:this.subdivisionScheme,subtreeLevels:this.subtreeLevels,level:n,x:i,y:o,z:r})}return new Mo({subdivisionScheme:this.subdivisionScheme,subtreeLevels:this.subtreeLevels,level:n,x:i,y:o})};Mo.prototype.getOffsetCoordinates=function(e){if(E.typeOf.object("descendantCoordinates",e),!this.isEqual(e)&&!this.isAncestor(e))throw new w("this is not an ancestor of descendant");VU(this,e);const t=e.level-this.level,n=1<<t,i=e.x%n,o=e.y%n;if(this.subdivisionScheme===us.OCTREE){const r=e.z%n;return new Mo({subdivisionScheme:this.subdivisionScheme,subtreeLevels:this.subtreeLevels,level:t,x:i,y:o,z:r})}return new Mo({subdivisionScheme:this.subdivisionScheme,subtreeLevels:this.subtreeLevels,level:t,x:i,y:o})};Mo.prototype.getChildCoordinates=function(e){E.typeOf.number("childIndex",e);const t=us.getBranchingFactor(this.subdivisionScheme);if(e<0||t<=e)throw new w(`childIndex must be at least 0 and less than ${t}`);const n=this.level+1,i=2*this.x+e%2,o=2*this.y+Math.floor(e/2)%2;if(this.subdivisionScheme===us.OCTREE){const r=2*this.z+Math.floor(e/4)%2;return new Mo({subdivisionScheme:this.subdivisionScheme,subtreeLevels:this.subtreeLevels,level:n,x:i,y:o,z:r})}return new Mo({subdivisionScheme:this.subdivisionScheme,subtreeLevels:this.subtreeLevels,level:n,x:i,y:o})};Mo.prototype.getSubtreeCoordinates=function(){return this.getAncestorCoordinates(this.level%this.subtreeLevels)};Mo.prototype.getParentSubtreeCoordinates=function(){return this.getAncestorCoordinates(this.level%this.subtreeLevels+this.subtreeLevels)};Mo.prototype.isAncestor=function(e){E.typeOf.object("descendantCoordinates",e),VU(this,e);const t=e.level-this.level;if(t<=0)return!1;const n=e.x>>t,i=e.y>>t,o=this.x===n,r=this.y===i;if(this.subdivisionScheme===us.OCTREE){const s=e.z>>t,a=this.z===s;return o&&r&&a}return o&&r};Mo.prototype.isEqual=function(e){return E.typeOf.object("otherCoordinates",e),this.subdivisionScheme===e.subdivisionScheme&&this.subtreeLevels===e.subtreeLevels&&this.level===e.level&&this.x===e.x&&this.y===e.y&&(this.subdivisionScheme===us.OCTREE?this.z===e.z:!0)};Mo.prototype.isImplicitTilesetRoot=function(){return this.level===0};Mo.prototype.isSubtreeRoot=function(){return this.level%this.subtreeLevels===0};Mo.prototype.isBottomOfSubtree=function(){return this.level%this.subtreeLevels===this.subtreeLevels-1};Mo.prototype.getTemplateValues=function(){const e={level:this.level,x:this.x,y:this.y};return this.subdivisionScheme===us.OCTREE&&(e.z=this.z),e};const Zq=[0,0,0];Mo.fromMortonIndex=function(e,t,n,i){let o;return e===us.OCTREE?(o=l1.decode3D(i,Zq),new Mo({subdivisionScheme:e,subtreeLevels:t,level:n,x:o[0],y:o[1],z:o[2]})):(o=l1.decode2D(i,Zq),new Mo({subdivisionScheme:e,subtreeLevels:t,level:n,x:o[0],y:o[1]}))};Mo.fromTileIndex=function(e,t,n){let i,o,r;return e===us.OCTREE?(i=Math.floor(F.log2(7*n+1)/3),o=((1<<3*i)-1)/7,r=n-o):(i=Math.floor(F.log2(3*n+1)/2),o=((1<<2*i)-1)/3,r=n-o),Mo.fromMortonIndex(e,t,i,r)};function ps(e){e=A(e,A.EMPTY_OBJECT),E.defined("options.url",e.url),this._url=void 0,this._basePath=void 0,this._root=void 0,this._resource=void 0,this._asset=void 0,this._properties=void 0,this._geometricError=void 0,this._extensionsUsed=void 0,this._extensions=void 0,this._modelUpAxis=void 0,this._modelForwardAxis=void 0,this._cache=new jy,this._processingQueue=[],this._selectedTiles=[],this._emptyTiles=[],this._requestedTiles=[],this._selectedTilesToStyle=[],this._loadTimestamp=void 0,this._timeSinceLoad=0,this._updatedVisibilityFrame=0,this._updatedModelMatrixFrame=0,this._modelMatrixChanged=!1,this._previousModelMatrix=void 0,this._extras=void 0,this._credits=void 0,this._showCreditsOnScreen=A(e.showCreditsOnScreen,!1),this._cullWithChildrenBounds=A(e.cullWithChildrenBounds,!0),this._allTilesAdditive=!0,this._hasMixedContent=!1,this._stencilClearCommand=void 0,this._backfaceCommands=new qa,this._maximumScreenSpaceError=A(e.maximumScreenSpaceError,16),this._maximumMemoryUsage=A(e.maximumMemoryUsage,512),this._styleEngine=new jx,this._styleApplied=!1,this._modelMatrix=l(e.modelMatrix)?N.clone(e.modelMatrix):N.clone(N.IDENTITY),this._statistics=new md,this._statisticsLast=new md,this._statisticsPerPass=new Array(Va.NUMBER_OF_PASSES);for(let r=0;r<Va.NUMBER_OF_PASSES;++r)this._statisticsPerPass[r]=new md;this._requestedTilesInFlight=[],this._maximumPriority={foveatedFactor:-Number.MAX_VALUE,depth:-Number.MAX_VALUE,distance:-Number.MAX_VALUE,reverseScreenSpaceError:-Number.MAX_VALUE},this._minimumPriority={foveatedFactor:Number.MAX_VALUE,depth:Number.MAX_VALUE,distance:Number.MAX_VALUE,reverseScreenSpaceError:Number.MAX_VALUE},this._heatmap=new NP(e.debugHeatmapTilePropertyName),this.cullRequestsWhileMoving=A(e.cullRequestsWhileMoving,!0),this._cullRequestsWhileMoving=!1,this.cullRequestsWhileMovingMultiplier=A(e.cullRequestsWhileMovingMultiplier,60),this.progressiveResolutionHeightFraction=F.clamp(A(e.progressiveResolutionHeightFraction,.3),0,.5),this.preferLeaves=A(e.preferLeaves,!1),this._tilesLoaded=!1,this._initialTilesLoaded=!1,this._tileDebugLabels=void 0,this._classificationType=e.classificationType,this._ellipsoid=A(e.ellipsoid,be.WGS84),this._initialClippingPlanesOriginMatrix=N.IDENTITY,this._clippingPlanesOriginMatrix=void 0,this._clippingPlanesOriginMatrixDirty=!0,this._vectorClassificationOnly=A(e.vectorClassificationOnly,!1),this._vectorKeepDecodedPositions=A(e.vectorKeepDecodedPositions,!1),this.preloadWhenHidden=A(e.preloadWhenHidden,!1),this.preloadFlightDestinations=A(e.preloadFlightDestinations,!0),this._pass=void 0,this.dynamicScreenSpaceError=A(e.dynamicScreenSpaceError,!1),this.foveatedScreenSpaceError=A(e.foveatedScreenSpaceError,!0),this._foveatedConeSize=A(e.foveatedConeSize,.1),this._foveatedMinimumScreenSpaceErrorRelaxation=A(e.foveatedMinimumScreenSpaceErrorRelaxation,0),this.foveatedInterpolationCallback=A(e.foveatedInterpolationCallback,F.lerp),this.foveatedTimeDelay=A(e.foveatedTimeDelay,.2),this.dynamicScreenSpaceErrorDensity=.00278,this.dynamicScreenSpaceErrorFactor=4,this.dynamicScreenSpaceErrorHeightFalloff=.25,this._dynamicScreenSpaceErrorComputedDensity=0,this.shadows=A(e.shadows,sr.ENABLED),this.show=A(e.show,!0),this.colorBlendMode=qD.HIGHLIGHT,this.colorBlendAmount=.5,this._pointCloudShading=new Hx(e.pointCloudShading),this._pointCloudEyeDomeLighting=new x_,this.loadProgress=new lt,this.allTilesLoaded=new lt,this.initialTilesLoaded=new lt,this.tileLoad=new lt,this.tileUnload=new lt,this.tileFailed=new lt,this.tileVisible=new lt,this.skipLevelOfDetail=A(e.skipLevelOfDetail,!1),this._skipLevelOfDetail=this.skipLevelOfDetail,this._disableSkipLevelOfDetail=!1,this.baseScreenSpaceError=A(e.baseScreenSpaceError,1024),this.skipScreenSpaceErrorFactor=A(e.skipScreenSpaceErrorFactor,16),this.skipLevels=A(e.skipLevels,1),this.immediatelyLoadDesiredLevelOfDetail=A(e.immediatelyLoadDesiredLevelOfDetail,!1),this.loadSiblings=A(e.loadSiblings,!1),this._clippingPlanes=void 0,this.clippingPlanes=e.clippingPlanes,l(e.imageBasedLighting)?(this._imageBasedLighting=e.imageBasedLighting,this._shouldDestroyImageBasedLighting=!1):(this._imageBasedLighting=new vT,this._shouldDestroyImageBasedLighting=!0),this.lightColor=e.lightColor,this.backFaceCulling=A(e.backFaceCulling,!0),this._enableShowOutline=A(e.enableShowOutline,!0),this.showOutline=A(e.showOutline,!0),this.outlineColor=A(e.outlineColor,k.BLACK),this.splitDirection=A(e.splitDirection,Py.NONE),this._projectTo2D=A(e.projectTo2D,!1),this.debugFreezeFrame=A(e.debugFreezeFrame,!1),this.debugColorizeTiles=A(e.debugColorizeTiles,!1),this._enableDebugWireframe=A(e.enableDebugWireframe,!1),this.debugWireframe=A(e.debugWireframe,!1),this.debugWireframe===!0&&this._enableDebugWireframe===!1&&uo("tileset-debug-wireframe-ignored","enableDebugWireframe must be set to true in the Cesium3DTileset constructor, otherwise debugWireframe will be ignored."),this.debugShowBoundingVolume=A(e.debugShowBoundingVolume,!1),this.debugShowContentBoundingVolume=A(e.debugShowContentBoundingVolume,!1),this.debugShowViewerRequestVolume=A(e.debugShowViewerRequestVolume,!1),this._tileDebugLabels=void 0,this.debugPickedTileLabelOnly=!1,this.debugPickedTile=void 0,this.debugPickPosition=void 0,this.debugShowGeometricError=A(e.debugShowGeometricError,!1),this.debugShowRenderingStatistics=A(e.debugShowRenderingStatistics,!1),this.debugShowMemoryUsage=A(e.debugShowMemoryUsage,!1),this.debugShowUrl=A(e.debugShowUrl,!1),this.examineVectorLinesFunction=void 0,this._metadataExtension=void 0,this._customShader=e.customShader;let t=A(e.featureIdLabel,"featureId_0");typeof t=="number"&&(t=`featureId_${t}`),this._featureIdLabel=t;let n=A(e.instanceFeatureIdLabel,"instanceFeatureId_0");typeof n=="number"&&(n=`instanceFeatureId_${n}`),this._instanceFeatureIdLabel=n,this._schemaLoader=void 0;const i=this;let o;this._readyPromise=Promise.resolve(e.url).then(function(r){let s;return o=je.createIfNeeded(r),i._resource=o,i._credits=o.credits,o.extension==="json"?s=o.getBaseUri(!0):o.isDataUri&&(s=""),i._url=o.url,i._basePath=s,ps.loadJson(o)}).then(function(r){if(!i.isDestroyed())return Xlt(i,r)}).then(function(r){if(i.isDestroyed())return;i._root=i.loadTileset(o,r);const s=l(r.asset.gltfUpAxis)?Vs.fromName(r.asset.gltfUpAxis):Vs.Y,a=A(e.modelUpAxis,s),c=A(e.modelForwardAxis,Vs.X),u=r.asset;i._asset=u,i._properties=r.properties,i._geometricError=r.geometricError,i._extensionsUsed=r.extensionsUsed,i._extensions=r.extensions,i._modelUpAxis=a,i._modelForwardAxis=c,i._extras=r.extras;const f=u.extras;if(l(f)&&l(f.cesium)&&l(f.cesium.credits)){const p=f.cesium.credits;let y=i._credits;l(y)||(y=[],i._credits=y);for(let T=0;T<p.length;++T){const b=p[T];y.push(new Si(b.html,i._showCreditsOnScreen))}}const _=i._root.createBoundingVolume(r.root.boundingVolume,N.IDENTITY).boundingSphere.center,g=i._ellipsoid.cartesianToCartographic(_);return l(g)&&g.height>Ro._defaultMinTerrainHeight&&(i._initialClippingPlanesOriginMatrix=En.eastNorthUpToFixedFrame(_)),i._clippingPlanesOriginMatrix=N.clone(i._initialClippingPlanesOriginMatrix),i})}Object.defineProperties(ps.prototype,{isCesium3DTileset:{get:function(){return!0}},asset:{get:function(){if(!this.ready)throw new w("The tileset is not loaded. Use Cesium3DTileset.readyPromise or wait for Cesium3DTileset.ready to be true.");return this._asset}},extensions:{get:function(){if(!this.ready)throw new w("The tileset is not loaded. Use Cesium3DTileset.readyPromise or wait for Cesium3DTileset.ready to be true.");return this._extensions}},clippingPlanes:{get:function(){return this._clippingPlanes},set:function(e){rr.setOwner(e,this,"_clippingPlanes")}},properties:{get:function(){if(!this.ready)throw new w("The tileset is not loaded. Use Cesium3DTileset.readyPromise or wait for Cesium3DTileset.ready to be true.");return this._properties}},ready:{get:function(){return l(this._root)}},readyPromise:{get:function(){return this._readyPromise}},tilesLoaded:{get:function(){return this._tilesLoaded}},resource:{get:function(){return this._resource}},basePath:{get:function(){return p_("Cesium3DTileset.basePath","Cesium3DTileset.basePath has been deprecated. All tiles are relative to the url of the tileset JSON file that contains them. Use the url property instead."),this._basePath}},style:{get:function(){return this._styleEngine.style},set:function(e){this._styleEngine.style=e}},customShader:{get:function(){return this._customShader},set:function(e){this._customShader=e}},metadataExtension:{get:function(){return this._metadataExtension}},metadata:{get:function(){if(l(this._metadataExtension))return this._metadataExtension.tileset}},schema:{get:function(){if(l(this._metadataExtension))return this._metadataExtension.schema}},maximumScreenSpaceError:{get:function(){return this._maximumScreenSpaceError},set:function(e){E.typeOf.number.greaterThanOrEquals("maximumScreenSpaceError",e,0),this._maximumScreenSpaceError=e}},maximumMemoryUsage:{get:function(){return this._maximumMemoryUsage},set:function(e){E.typeOf.number.greaterThanOrEquals("value",e,0),this._maximumMemoryUsage=e}},pointCloudShading:{get:function(){return this._pointCloudShading},set:function(e){E.defined("pointCloudShading",e),this._pointCloudShading=e}},root:{get:function(){if(!this.ready)throw new w("The tileset is not loaded. Use Cesium3DTileset.readyPromise or wait for Cesium3DTileset.ready to be true.");return this._root}},boundingSphere:{get:function(){if(!this.ready)throw new w("The tileset is not loaded. Use Cesium3DTileset.readyPromise or wait for Cesium3DTileset.ready to be true.");return this._root.updateTransform(this._modelMatrix),this._root.boundingSphere}},modelMatrix:{get:function(){return this._modelMatrix},set:function(e){this._modelMatrix=N.clone(e,this._modelMatrix)}},timeSinceLoad:{get:function(){return this._timeSinceLoad}},totalMemoryUsageInBytes:{get:function(){const e=this._statistics;return e.texturesByteLength+e.geometryByteLength+e.batchTableByteLength}},clippingPlanesOriginMatrix:{get:function(){return l(this._clippingPlanesOriginMatrix)?(this._clippingPlanesOriginMatrixDirty&&(N.multiply(this.root.computedTransform,this._initialClippingPlanesOriginMatrix,this._clippingPlanesOriginMatrix),this._clippingPlanesOriginMatrixDirty=!1),this._clippingPlanesOriginMatrix):N.IDENTITY}},styleEngine:{get:function(){return this._styleEngine}},statistics:{get:function(){return this._statistics}},classificationType:{get:function(){return this._classificationType}},ellipsoid:{get:function(){return this._ellipsoid}},foveatedConeSize:{get:function(){return this._foveatedConeSize},set:function(e){E.typeOf.number.greaterThanOrEquals("foveatedConeSize",e,0),E.typeOf.number.lessThanOrEquals("foveatedConeSize",e,1),this._foveatedConeSize=e}},foveatedMinimumScreenSpaceErrorRelaxation:{get:function(){return this._foveatedMinimumScreenSpaceErrorRelaxation},set:function(e){E.typeOf.number.greaterThanOrEquals("foveatedMinimumScreenSpaceErrorRelaxation",e,0),E.typeOf.number.lessThanOrEquals("foveatedMinimumScreenSpaceErrorRelaxation",e,this.maximumScreenSpaceError),this._foveatedMinimumScreenSpaceErrorRelaxation=e}},extras:{get:function(){if(!this.ready)throw new w("The tileset is not loaded. Use Cesium3DTileset.readyPromise or wait for Cesium3DTileset.ready to be true.");return this._extras}},imageBasedLighting:{get:function(){return this._imageBasedLighting},set:function(e){E.typeOf.object("imageBasedLighting",this._imageBasedLighting),e!==this._imageBasedLighting&&(this._shouldDestroyImageBasedLighting&&!this._imageBasedLighting.isDestroyed()&&this._imageBasedLighting.destroy(),this._imageBasedLighting=e,this._shouldDestroyImageBasedLighting=!1)}},vectorClassificationOnly:{get:function(){return this._vectorClassificationOnly}},vectorKeepDecodedPositions:{get:function(){return this._vectorKeepDecodedPositions}},showCreditsOnScreen:{get:function(){return this._showCreditsOnScreen},set:function(e){this._showCreditsOnScreen=e}},featureIdLabel:{get:function(){return this._featureIdLabel},set:function(e){typeof e=="number"&&(e=`featureId_${e}`),E.typeOf.string("value",e),this._featureIdLabel=e}},instanceFeatureIdLabel:{get:function(){return this._instanceFeatureIdLabel},set:function(e){typeof e=="number"&&(e=`instanceFeatureId_${e}`),E.typeOf.string("value",e),this._instanceFeatureIdLabel=e}}});ps.loadJson=function(e){return je.createIfNeeded(e).fetchJson()};ps.prototype.makeStyleDirty=function(){this._styleEngine.makeDirty()};ps.prototype.loadTileset=function(e,t,n){const i=t.asset;if(!l(i))throw new Fe("Tileset must have an asset property.");if(i.version!=="0.0"&&i.version!=="1.0"&&i.version!=="1.1")throw new Fe("The tileset must be 3D Tiles version 0.0, 1.0, or 1.1");l(t.extensionsRequired)&&ps.checkSupportedExtensions(t.extensionsRequired);const o=this._statistics,r=i.tilesetVersion;l(r)&&(this._basePath+=`?v=${r}`,e=e.clone(),e.setQueryParameters({v:r}));const s=ej(this,e,t.root,n);l(n)&&(n.children.push(s),s._depth=n._depth+1);const a=[];for(a.push(s);a.length>0;){const c=a.pop();++o.numberOfTilesTotal,this._allTilesAdditive=this._allTilesAdditive&&c.refine===_c.ADD;const u=c._header.children;if(l(u)){const f=u.length;for(let h=0;h<f;++h){const _=u[h],g=ej(this,e,_,c);c.children.push(g),g._depth=c._depth+1,a.push(g)}}this._cullWithChildrenBounds&&Glt.checkChildrenWithinParent(c)}return s};function ej(e,t,n,i){if(l(n.implicitTiling)||Wr(n,"3DTILES_implicit_tiling")){const r=e.schema,s=new jlt(t,n,r),a=new Mo({subdivisionScheme:s.subdivisionScheme,subtreeLevels:s.subtreeLevels,level:0,x:0,y:0,z:0}),c=s.subtreeUriTemplate.getDerivedResource({templateValues:a.getTemplateValues()}).url,f=St(n,!0);f.contents=[{uri:c}],delete f.content,delete f.extensions;const h=new No(e,t,f,i);return h.implicitTileset=s,h.implicitCoordinates=a,h}return new No(e,t,n,i)}function Xlt(e,t){const n=Wr(t,"3DTILES_metadata")?t.extensions["3DTILES_metadata"]:t;let i;if(l(n.schemaUri)){const o=e._resource.getDerivedResource({url:n.schemaUri});i=Bt.loadSchema({resource:o})}else if(l(n.schema))i=Bt.loadSchema({schema:n.schema});else return Promise.resolve(t);return e._schemaLoader=i,i.promise.then(function(o){return e._metadataExtension=new Yoe({schema:o.schema,metadataJson:n}),t})}const tj=new d,Klt=new ve,Jlt=new N,Qlt=new d,Zlt=new d,eut=new d;function tut(e,t){let n,i,o,r,s;const a=t.camera,c=e._root,u=c.contentBoundingVolume;if(u instanceof Td)n=d.normalize(a.positionWC,tj),i=a.directionWC,o=a.positionCartographic.height,r=u.minimumHeight,s=u.maximumHeight;else{const b=N.inverseTransformation(c.computedTransform,Jlt),x=t.mapProjection.ellipsoid,v=u.boundingVolume,D=N.multiplyByPoint(b,v.center,Qlt);if(d.magnitude(D)>x.minimumRadius){const L=ve.fromCartesian(D,x,Klt);n=d.normalize(a.positionWC,tj),i=a.directionWC,o=a.positionCartographic.height,r=0,s=L.height*2}else{const L=N.multiplyByPoint(b,a.positionWC,Zlt);if(n=d.UNIT_Z,i=N.multiplyByPointAsVector(b,a.directionWC,eut),i=d.normalize(i,i),o=L.z,u instanceof Tf){const B=c._header.boundingVolume.box[11];r=D.z-B,s=D.z+B}else if(u instanceof xp){const B=v.radius;r=D.z-B,s=D.z+B}}}const f=e.dynamicScreenSpaceErrorHeightFalloff,h=r+(s-r)*f,_=s,g=F.clamp((o-h)/(_-h),0,1);let y=1-Math.abs(d.dot(i,n));y=y*(1-g);let T=e.dynamicScreenSpaceErrorDensity;T*=y,e._dynamicScreenSpaceErrorComputedDensity=T}function nut(e,t){if(t.hasEmptyContent)return;const n=e._statistics,i=t.contentExpired,o=t.requestContent();if(o>0){n.numberOfAttemptedRequests+=o;return}i&&(t.hasTilesetContent||t.hasImplicitContent?put(e,t):(n.decrementLoadCounts(t.content),--n.numberOfTilesWithContentReady)),e._requestedTilesInFlight.push(t),t.contentReadyToProcessPromise.then(sut(e,t)).catch(function(r){}),t.contentReadyPromise.then(cut(e,t)).catch(aut(e,t))}function iut(e,t){return e._priority-t._priority}ps.prototype.postPassesUpdate=function(e){this.ready&&(out(this,e),_ut(this,e),this._cache.unloadTiles(this,Joe),this._styleApplied&&this._styleEngine.resetDirty(),this._styleApplied=!1)};ps.prototype.prePassesUpdate=function(e){if(!this.ready)return;uut(this,e);const t=this._clippingPlanes;this._clippingPlanesOriginMatrixDirty=!0,l(t)&&t.enabled&&t.update(e),l(this._loadTimestamp)||(this._loadTimestamp=ce.clone(e.time)),this._timeSinceLoad=Math.max(ce.secondsDifference(e.time,this._loadTimestamp)*1e3,0),this._skipLevelOfDetail=this.skipLevelOfDetail&&!l(this._classificationType)&&!this._disableSkipLevelOfDetail&&!this._allTilesAdditive,this.dynamicScreenSpaceError&&tut(this,e),e.newFrame&&this._cache.reset()};function out(e,t){const n=e._requestedTilesInFlight;let i=0;const o=n.length;for(let r=0;r<o;++r){const s=n[r],a=t.frameNumber-s._touchedFrame>=1;if(s._contentState!==gr.LOADING){++i;continue}else if(a){s.cancelRequests(),++i;continue}i>0&&(n[r-i]=s)}n.length-=i}function rut(e,t){const n=e._requestedTiles,i=n.length;n.sort(iut);for(let o=0;o<i;++o)nut(e,n[o])}function sut(e,t){return function(){e._processingQueue.push(t),++e._statistics.numberOfTilesProcessing}}function aut(e,t){return function(n){if(t._contentState!==gr.FAILED)return;const i=t._contentResource.url,o=l(n.message)?n.message:n.toString();e.tileFailed.numberOfListeners>0?e.tileFailed.raiseEvent({url:i,message:o}):(console.log(`A 3D tile failed to load: ${i}`),console.log(`Error: ${o}`))}}function cut(e,t){return function(n){--e._statistics.numberOfTilesProcessing,l(n)&&(!t.hasTilesetContent&&!t.hasImplicitContent&&(e._statistics.incrementLoadCounts(t.content),++e._statistics.numberOfTilesWithContentReady,++e._statistics.numberOfLoadedTilesTotal,e._cache.add(t)),e.tileLoad.raiseEvent(t))}}function lut(e){const t=e._processingQueue,n=t.length;let i=0;for(let o=0;o<n;++o){const r=t[o];if(r._contentState!==gr.PROCESSING){++i;continue}i>0&&(t[o-i]=r)}t.length-=i}function uut(e,t){lut(e);const n=e._processingQueue,i=n.length;for(let o=0;o<i;++o)n[o].process(e,t)}const zv=new d,fut={maximumFractionDigits:3};function nj(e){const t=e/1048576;return t<1?t.toLocaleString(void 0,fut):Math.round(t).toLocaleString()}function mN(e){const t=e.boundingVolume.boundingVolume,n=t.halfAxes,i=t.radius;let o=d.clone(t.center,zv);if(l(n))o.x+=.75*(n[0]+n[3]+n[6]),o.y+=.75*(n[1]+n[4]+n[7]),o.z+=.75*(n[2]+n[5]+n[8]);else if(l(i)){let r=d.normalize(t.center,zv);r=d.multiplyByScalar(r,.75*i,zv),o=d.add(r,t.center,zv)}return o}function _N(e,t,n){let i="",o=0;if(t.debugShowGeometricError&&(i+=`
|
||
Geometric error: ${e.geometricError}`,o++),t.debugShowRenderingStatistics&&(i+=`
|
||
Commands: ${e.commandsLength}`,o++,e.content.pointsLength>0&&(i+=`
|
||
Points: ${e.content.pointsLength}`,o++),e.content.trianglesLength>0&&(i+=`
|
||
Triangles: ${e.content.trianglesLength}`,o++),i+=`
|
||
Features: ${e.content.featuresLength}`,o++),t.debugShowMemoryUsage&&(i+=`
|
||
Texture Memory: ${nj(e.content.texturesByteLength)}`,i+=`
|
||
Geometry Memory: ${nj(e.content.geometryByteLength)}`,o+=2),t.debugShowUrl)if(e.hasMultipleContents){i+=`
|
||
Urls:`;const s=e.content.innerContentUrls;for(let a=0;a<s.length;a++)i+=`
|
||
- ${s[a]}`;o+=s.length}else i+=`
|
||
Url: ${e._contentHeader.uri}`,o++;const r={text:i.substring(1),position:n,font:`${19-o}px sans-serif`,showBackground:!0,disableDepthTestDistance:Number.POSITIVE_INFINITY};return t._tileDebugLabels.add(r)}function dut(e,t){let n,i;const o=e._selectedTiles,r=o.length,s=e._emptyTiles,a=s.length;if(e._tileDebugLabels.removeAll(),e.debugPickedTileLabelOnly){if(l(e.debugPickedTile)){const c=l(e.debugPickPosition)?e.debugPickPosition:mN(e.debugPickedTile),u=_N(e.debugPickedTile,e,c);u.pixelOffset=new $(15,-15)}}else{for(n=0;n<r;++n)i=o[n],_N(i,e,mN(i));for(n=0;n<a;++n)i=s[n],(i.hasTilesetContent||i.hasImplicitContent)&&_N(i,e,mN(i))}e._tileDebugLabels.update(t)}function hut(e,t,n){e._styleEngine.applyStyle(e),e._styleApplied=!0;const i=n.isRender,o=e._statistics,r=t.commandList,s=r.length,a=e._selectedTiles,c=a.length,u=e._emptyTiles,f=u.length,h=e.tileVisible;let _,g;const p=e._skipLevelOfDetail&&e._hasMixedContent&&t.context.stencilBuffer&&c>0;e._backfaceCommands.length=0,p&&(l(e._stencilClearCommand)||(e._stencilClearCommand=new Bo({stencil:0,pass:We.CESIUM_3D_TILE,renderState:ht.fromCache({stencilMask:Kt.SKIP_LOD_MASK})})),r.push(e._stencilClearCommand));const y=r.length;for(_=0;_<c;++_)g=a[_],i&&h.raiseEvent(g),g.update(e,t,n),o.incrementSelectionCounts(g.content),++o.selected;for(_=0;_<f;++_)g=u[_],g.update(e,t,n);let T=r.length-y;if(e._backfaceCommands.trim(),p){const b=e._backfaceCommands.values,x=b.length;for(r.length+=x,_=T-1;_>=0;--_)r[y+x+_]=r[y+_];for(_=0;_<x;++_)r[y+_]=b[_]}T=r.length-s,o.numberOfCommands=T,i&&e.pointCloudShading.attenuation&&e.pointCloudShading.eyeDomeLighting&&T>0&&e._pointCloudEyeDomeLighting.update(t,s,e.pointCloudShading,e.boundingSphere),i&&(e.debugShowGeometricError||e.debugShowRenderingStatistics||e.debugShowMemoryUsage||e.debugShowUrl?(l(e._tileDebugLabels)||(e._tileDebugLabels=new Sl),dut(e,t)):e._tileDebugLabels=e._tileDebugLabels&&e._tileDebugLabels.destroy())}const Koe=[];function put(e,t){const n=t,i=Koe;for(i.push(t);i.length>0;){t=i.pop();const o=t.children,r=o.length;for(let s=0;s<r;++s)i.push(o[s]);t!==n&&(mut(e,t),--e._statistics.numberOfTilesTotal)}n.children=[]}function Joe(e,t){e.tileUnload.raiseEvent(t),e._statistics.decrementLoadCounts(t.content),--e._statistics.numberOfTilesWithContentReady,t.unloadContent()}function mut(e,t){e._cache.unloadTile(e,t,Joe),t.destroy()}ps.prototype.trimLoadedTiles=function(){this._cache.trim()};function _ut(e,t){const n=e._statistics,i=e._statisticsLast,o=n.numberOfPendingRequests,r=n.numberOfTilesProcessing,s=i.numberOfPendingRequests,a=i.numberOfTilesProcessing;md.clone(n,i);const c=o!==s||r!==a;c&&t.afterRender.push(function(){return e.loadProgress.raiseEvent(o,r),!0}),e._tilesLoaded=n.numberOfPendingRequests===0&&n.numberOfTilesProcessing===0&&n.numberOfAttemptedRequests===0,c&&e._tilesLoaded&&(t.afterRender.push(function(){return e.allTilesLoaded.raiseEvent(),!0}),e._initialTilesLoaded||(e._initialTilesLoaded=!0,t.afterRender.push(function(){return e.initialTilesLoaded.raiseEvent(),!0})))}function gut(e){e._heatmap.resetMinimumMaximum(),e._minimumPriority.depth=Number.MAX_VALUE,e._maximumPriority.depth=-Number.MAX_VALUE,e._minimumPriority.foveatedFactor=Number.MAX_VALUE,e._maximumPriority.foveatedFactor=-Number.MAX_VALUE,e._minimumPriority.distance=Number.MAX_VALUE,e._maximumPriority.distance=-Number.MAX_VALUE,e._minimumPriority.reverseScreenSpaceError=Number.MAX_VALUE,e._maximumPriority.reverseScreenSpaceError=-Number.MAX_VALUE}function yut(e,t){(t.frameNumber!==e._updatedModelMatrixFrame||!l(e._previousModelMatrix))&&(e._updatedModelMatrixFrame=t.frameNumber,e._modelMatrixChanged=!N.equals(e.modelMatrix,e._previousModelMatrix),e._modelMatrixChanged&&(e._previousModelMatrix=N.clone(e.modelMatrix,e._previousModelMatrix)))}function Aut(e,t,n,i){if(t.mode===me.MORPHING||!e.ready)return!1;const o=e._statistics;o.clear();const r=i.isRender;++e._updatedVisibilityFrame,gut(e),yut(e,t),e._cullRequestsWhileMoving=e.cullRequestsWhileMoving&&!e._modelMatrixChanged;const s=i.traversal.selectTiles(e,t);if(i.requestTiles&&rut(e),hut(e,t,i),md.clone(o,n),r){const a=e._credits;if(l(a)&&o.selected!==0){const c=a.length;for(let u=0;u<c;++u){const f=a[u];f.showOnScreen=e._showCreditsOnScreen,t.creditDisplay.addCredit(f)}}}return s}ps.prototype.update=function(e){this.updateForPass(e,e.tilesetPassState)};ps.prototype.updateForPass=function(e,t){E.typeOf.object("frameState",e),E.typeOf.object("tilesetPassState",t);const n=t.pass;if(n===Va.PRELOAD&&(!this.preloadWhenHidden||this.show)||n===Va.PRELOAD_FLIGHT&&(!this.preloadFlightDestinations||!this.show&&!this.preloadWhenHidden)||n===Va.REQUEST_RENDER_MODE_DEFER_CHECK&&(!this._cullRequestsWhileMoving&&this.foveatedTimeDelay<=0||!this.show))return;const i=e.commandList,o=e.camera,r=e.cullingVolume;t.ready=!1;const s=Va.getPassOptions(n),a=s.ignoreCommands,c=A(t.commandList,i),u=c.length;e.commandList=c,e.camera=A(t.camera,o),e.cullingVolume=A(t.cullingVolume,r);const f=this._statisticsPerPass[n];(this.show||a)&&(this._pass=n,t.ready=Aut(this,e,f,s)),a&&(c.length=u),e.commandList=i,e.camera=o,e.cullingVolume=r};ps.prototype.hasExtension=function(e){return l(this._extensionsUsed)?this._extensionsUsed.indexOf(e)>-1:!1};ps.prototype.isDestroyed=function(){return!1};ps.prototype.destroy=function(){if(this._tileDebugLabels=this._tileDebugLabels&&this._tileDebugLabels.destroy(),this._clippingPlanes=this._clippingPlanes&&this._clippingPlanes.destroy(),l(this._schemaLoader)&&Bt.unload(this._schemaLoader),l(this._root)){const e=Koe;for(e.push(this._root);e.length>0;){const t=e.pop();t.destroy();const n=t.children,i=n.length;for(let o=0;o<i;++o)e.push(n[o])}}return this._root=void 0,this._shouldDestroyImageBasedLighting&&!this._imageBasedLighting.isDestroyed()&&this._imageBasedLighting.destroy(),this._imageBasedLighting=void 0,Je(this)};ps.supportedExtensions={"3DTILES_metadata":!0,"3DTILES_implicit_tiling":!0,"3DTILES_content_gltf":!0,"3DTILES_multiple_contents":!0,"3DTILES_bounding_volume_S2":!0,"3DTILES_batch_table_hierarchy":!0,"3DTILES_draco_point_compression":!0,MAXAR_content_geojson:!0};ps.checkSupportedExtensions=function(e){for(let t=0;t<e.length;t++)if(!ps.supportedExtensions[e[t]])throw new Fe(`Unsupported 3D Tiles Extension: ${e[t]}`)};const Tut=new N;function s_(e,t){if(!l(e))throw new w("scene is required.");if(!l(t))throw new w("entityCollection is required.");t.collectionChanged.addEventListener(s_.prototype._onCollectionChanged,this),this._scene=e,this._primitives=e.primitives,this._entityCollection=t,this._tilesetHash={},this._entitiesToVisualize=new Vt,this._onCollectionChanged(t,t.values,[],[])}s_.prototype.update=function(e){if(!l(e))throw new w("time is required.");const t=this._entitiesToVisualize.values,n=this._tilesetHash,i=this._primitives;for(let o=0,r=t.length;o<r;o++){const s=t[o],a=s._tileset;let c,u=n[s.id];const f=s.isShowing&&s.isAvailable(e)&&ie.getValueOrDefault(a._show,e,!0);let h;if(f&&(h=s.computeModelMatrix(e,Tut),c=je.createIfNeeded(ie.getValueOrUndefined(a._uri,e))),!f){l(u)&&(u.tilesetPrimitive.show=!1);continue}let _=l(u)?u.tilesetPrimitive:void 0;(!l(_)||c.url!==u.url)&&(l(_)&&(i.removeAndDestroy(_),delete n[s.id]),_=new ps({url:c}),_.id=s,i.add(_),u={tilesetPrimitive:_,url:c.url,loadFail:!1},n[s.id]=u,Cut(_,s,n)),_.show=!0,l(h)&&(_.modelMatrix=h),_.maximumScreenSpaceError=ie.getValueOrDefault(a.maximumScreenSpaceError,e,_.maximumScreenSpaceError)}return!0};s_.prototype.isDestroyed=function(){return!1};s_.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(s_.prototype._onCollectionChanged,this);const e=this._entitiesToVisualize.values,t=this._tilesetHash,n=this._primitives;for(let i=e.length-1;i>-1;i--)_2(this,e[i],t,n);return Je(this)};s_.prototype.getBoundingSphere=function(e,t){if(!l(e))throw new w("entity is required.");if(!l(t))throw new w("result is required.");const n=this._tilesetHash[e.id];if(!l(n)||n.loadFail)return Ot.FAILED;const i=n.tilesetPrimitive;return!l(i)||!i.show?Ot.FAILED:i.ready?(Ae.clone(i.boundingSphere,t),Ot.DONE):Ot.PENDING};s_.prototype._onCollectionChanged=function(e,t,n,i){let o,r;const s=this._entitiesToVisualize,a=this._tilesetHash,c=this._primitives;for(o=t.length-1;o>-1;o--)r=t[o],l(r._tileset)&&s.set(r.id,r);for(o=i.length-1;o>-1;o--)r=i[o],l(r._tileset)?s.set(r.id,r):(_2(this,r,a,c),s.remove(r.id));for(o=n.length-1;o>-1;o--)r=n[o],_2(this,r,a,c),s.remove(r.id)};function _2(e,t,n,i){const o=n[t.id];l(o)&&(i.removeAndDestroy(o.tilesetPrimitive),delete n[t.id])}function Cut(e,t,n){e.readyPromise.catch(function(i){console.error(i),n[t.id].loadFail=!0})}const ij={id:void 0};function $x(e){if(e._firing){e._refire=!0;return}if(e._suspendCount===0){const t=e._addedEntities,n=e._removedEntities,i=e._changedEntities;if(i.length!==0||t.length!==0||n.length!==0){e._firing=!0;do{e._refire=!1;const o=t.values.slice(0),r=n.values.slice(0),s=i.values.slice(0);t.removeAll(),n.removeAll(),i.removeAll(),e._collectionChanged.raiseEvent(e,o,r,s)}while(e._refire);e._firing=!1}}}function Ja(e){this._owner=e,this._entities=new Vt,this._addedEntities=new Vt,this._removedEntities=new Vt,this._changedEntities=new Vt,this._suspendCount=0,this._collectionChanged=new lt,this._id=ma(),this._show=!0,this._firing=!1,this._refire=!1}Ja.prototype.suspendEvents=function(){this._suspendCount++};Ja.prototype.resumeEvents=function(){if(this._suspendCount===0)throw new w("resumeEvents can not be called before suspendEvents.");this._suspendCount--,$x(this)};Object.defineProperties(Ja.prototype,{collectionChanged:{get:function(){return this._collectionChanged}},id:{get:function(){return this._id}},values:{get:function(){return this._entities.values}},show:{get:function(){return this._show},set:function(e){if(!l(e))throw new w("value is required.");if(e===this._show)return;this.suspendEvents();let t;const n=[],i=this._entities.values,o=i.length;for(t=0;t<o;t++)n.push(i[t].isShowing);for(this._show=e,t=0;t<o;t++){const r=n[t],s=i[t];r!==s.isShowing&&s.definitionChanged.raiseEvent(s,"isShowing",s.isShowing,r)}this.resumeEvents()}},owner:{get:function(){return this._owner}}});Ja.prototype.computeAvailability=function(){let e=wt.MAXIMUM_VALUE,t=wt.MINIMUM_VALUE;const n=this._entities.values;for(let i=0,o=n.length;i<o;i++){const s=n[i].availability;if(l(s)){const a=s.start,c=s.stop;ce.lessThan(a,e)&&!a.equals(wt.MINIMUM_VALUE)&&(e=a),ce.greaterThan(c,t)&&!c.equals(wt.MAXIMUM_VALUE)&&(t=c)}}return wt.MAXIMUM_VALUE.equals(e)&&(e=wt.MINIMUM_VALUE),wt.MINIMUM_VALUE.equals(t)&&(t=wt.MAXIMUM_VALUE),new bn({start:e,stop:t})};Ja.prototype.add=function(e){if(!l(e))throw new w("entity is required.");e instanceof hs||(e=new hs(e));const t=e.id,n=this._entities;if(n.contains(t))throw new Fe(`An entity with id ${t} already exists in this collection.`);return e.entityCollection=this,n.set(t,e),this._removedEntities.remove(t)||this._addedEntities.set(t,e),e.definitionChanged.addEventListener(Ja.prototype._onEntityDefinitionChanged,this),$x(this),e};Ja.prototype.remove=function(e){return l(e)?this.removeById(e.id):!1};Ja.prototype.contains=function(e){if(!l(e))throw new w("entity is required");return this._entities.get(e.id)===e};Ja.prototype.removeById=function(e){if(!l(e))return!1;const n=this._entities.get(e);return this._entities.remove(e)?(this._addedEntities.remove(e)||(this._removedEntities.set(e,n),this._changedEntities.remove(e)),this._entities.remove(e),n.definitionChanged.removeEventListener(Ja.prototype._onEntityDefinitionChanged,this),$x(this),!0):!1};Ja.prototype.removeAll=function(){const e=this._entities,t=e.length,n=e.values,i=this._addedEntities,o=this._removedEntities;for(let r=0;r<t;r++){const s=n[r],a=s.id,c=i.get(a);l(c)||(s.definitionChanged.removeEventListener(Ja.prototype._onEntityDefinitionChanged,this),o.set(a,s))}e.removeAll(),i.removeAll(),this._changedEntities.removeAll(),$x(this)};Ja.prototype.getById=function(e){if(!l(e))throw new w("id is required.");return this._entities.get(e)};Ja.prototype.getOrCreateEntity=function(e){if(!l(e))throw new w("id is required.");let t=this._entities.get(e);return l(t)||(ij.id=e,t=new hs(ij),this.add(t)),t};Ja.prototype._onEntityDefinitionChanged=function(e){const t=e.id;this._addedEntities.contains(t)||this._changedEntities.set(t,e),$x(this)};function Yd(){this._removalFunctions=[]}Yd.prototype.add=function(e,t,n){if(!l(e))throw new w("event is required");const i=e.addEventListener(t,n);this._removalFunctions.push(i);const o=this;return function(){i();const r=o._removalFunctions;r.splice(r.indexOf(i),1)}};Yd.prototype.removeAll=function(){const e=this._removalFunctions;for(let t=0,n=e.length;t<n;++t)e[t]();e.length=0};function kU(e,t){return ce.compare(e.start,t.start)}function ar(e){if(this._intervals=[],this._changedEvent=new lt,l(e)){const t=e.length;for(let n=0;n<t;n++)this.addInterval(e[n])}}Object.defineProperties(ar.prototype,{changedEvent:{get:function(){return this._changedEvent}},start:{get:function(){const e=this._intervals;return e.length===0?void 0:e[0].start}},isStartIncluded:{get:function(){const e=this._intervals;return e.length===0?!1:e[0].isStartIncluded}},stop:{get:function(){const e=this._intervals,t=e.length;return t===0?void 0:e[t-1].stop}},isStopIncluded:{get:function(){const e=this._intervals,t=e.length;return t===0?!1:e[t-1].isStopIncluded}},length:{get:function(){return this._intervals.length}},isEmpty:{get:function(){return this._intervals.length===0}}});ar.prototype.equals=function(e,t){if(this===e)return!0;if(!(e instanceof ar))return!1;const n=this._intervals,i=e._intervals,o=n.length;if(o!==i.length)return!1;for(let r=0;r<o;r++)if(!bn.equals(n[r],i[r],t))return!1;return!0};ar.prototype.get=function(e){if(!l(e))throw new w("index is required.");return this._intervals[e]};ar.prototype.removeAll=function(){this._intervals.length>0&&(this._intervals.length=0,this._changedEvent.raiseEvent(this))};ar.prototype.findIntervalContainingDate=function(e){const t=this.indexOf(e);return t>=0?this._intervals[t]:void 0};ar.prototype.findDataForIntervalContainingDate=function(e){const t=this.indexOf(e);return t>=0?this._intervals[t].data:void 0};ar.prototype.contains=function(e){return this.indexOf(e)>=0};const gN=new bn;ar.prototype.indexOf=function(e){if(!l(e))throw new w("date is required");const t=this._intervals;gN.start=e,gN.stop=e;let n=da(t,gN,kU);return n>=0?t[n].isStartIncluded?n:n>0&&t[n-1].stop.equals(e)&&t[n-1].isStopIncluded?n-1:~n:(n=~n,n>0&&n-1<t.length&&bn.contains(t[n-1],e)?n-1:~n)};ar.prototype.findInterval=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.start,n=e.stop,i=e.isStartIncluded,o=e.isStopIncluded,r=this._intervals;for(let s=0,a=r.length;s<a;s++){const c=r[s];if((!l(t)||c.start.equals(t))&&(!l(n)||c.stop.equals(n))&&(!l(i)||c.isStartIncluded===i)&&(!l(o)||c.isStopIncluded===o))return r[s]}};ar.prototype.addInterval=function(e,t){if(!l(e))throw new w("interval is required");if(e.isEmpty)return;const n=this._intervals;if(n.length===0||ce.greaterThan(e.start,n[n.length-1].stop)){n.push(e),this._changedEvent.raiseEvent(this);return}let i=da(n,e,kU);i<0?i=~i:i>0&&e.isStartIncluded&&n[i-1].isStartIncluded&&n[i-1].start.equals(e.start)?--i:i<n.length&&!e.isStartIncluded&&n[i].isStartIncluded&&n[i].start.equals(e.start)&&++i;let o;for(i>0&&(o=ce.compare(n[i-1].stop,e.start),(o>0||o===0&&(n[i-1].isStopIncluded||e.isStartIncluded))&&((l(t)?t(n[i-1].data,e.data):n[i-1].data===e.data)?(ce.greaterThan(e.stop,n[i-1].stop)?e=new bn({start:n[i-1].start,stop:e.stop,isStartIncluded:n[i-1].isStartIncluded,isStopIncluded:e.isStopIncluded,data:e.data}):e=new bn({start:n[i-1].start,stop:n[i-1].stop,isStartIncluded:n[i-1].isStartIncluded,isStopIncluded:n[i-1].isStopIncluded||e.stop.equals(n[i-1].stop)&&e.isStopIncluded,data:e.data}),n.splice(i-1,1),--i):(o=ce.compare(n[i-1].stop,e.stop),(o>0||o===0&&n[i-1].isStopIncluded&&!e.isStopIncluded)&&n.splice(i,0,new bn({start:e.stop,stop:n[i-1].stop,isStartIncluded:!e.isStopIncluded,isStopIncluded:n[i-1].isStopIncluded,data:n[i-1].data})),n[i-1]=new bn({start:n[i-1].start,stop:e.start,isStartIncluded:n[i-1].isStartIncluded,isStopIncluded:!e.isStartIncluded,data:n[i-1].data}))));i<n.length&&(o=ce.compare(e.stop,n[i].start),o>0||o===0&&(e.isStopIncluded||n[i].isStartIncluded));)if(l(t)?t(n[i].data,e.data):n[i].data===e.data)e=new bn({start:e.start,stop:ce.greaterThan(n[i].stop,e.stop)?n[i].stop:e.stop,isStartIncluded:e.isStartIncluded,isStopIncluded:ce.greaterThan(n[i].stop,e.stop)?n[i].isStopIncluded:e.isStopIncluded,data:e.data}),n.splice(i,1);else if(n[i]=new bn({start:e.stop,stop:n[i].stop,isStartIncluded:!e.isStopIncluded,isStopIncluded:n[i].isStopIncluded,data:n[i].data}),n[i].isEmpty)n.splice(i,1);else break;n.splice(i,0,e),this._changedEvent.raiseEvent(this)};ar.prototype.removeInterval=function(e){if(!l(e))throw new w("interval is required");if(e.isEmpty)return!1;const t=this._intervals;let n=da(t,e,kU);n<0&&(n=~n);let i=!1;for(n>0&&(ce.greaterThan(t[n-1].stop,e.start)||t[n-1].stop.equals(e.start)&&t[n-1].isStopIncluded&&e.isStartIncluded)&&(i=!0,(ce.greaterThan(t[n-1].stop,e.stop)||t[n-1].isStopIncluded&&!e.isStopIncluded&&t[n-1].stop.equals(e.stop))&&t.splice(n,0,new bn({start:e.stop,stop:t[n-1].stop,isStartIncluded:!e.isStopIncluded,isStopIncluded:t[n-1].isStopIncluded,data:t[n-1].data})),t[n-1]=new bn({start:t[n-1].start,stop:e.start,isStartIncluded:t[n-1].isStartIncluded,isStopIncluded:!e.isStartIncluded,data:t[n-1].data})),n<t.length&&!e.isStartIncluded&&t[n].isStartIncluded&&e.start.equals(t[n].start)&&(i=!0,t.splice(n,0,new bn({start:t[n].start,stop:t[n].start,isStartIncluded:!0,isStopIncluded:!0,data:t[n].data})),++n);n<t.length&&ce.greaterThan(e.stop,t[n].stop);)i=!0,t.splice(n,1);return n<t.length&&e.stop.equals(t[n].stop)&&(i=!0,!e.isStopIncluded&&t[n].isStopIncluded?n+1<t.length&&t[n+1].start.equals(e.stop)&&t[n].data===t[n+1].data?(t.splice(n,1),t[n]=new bn({start:t[n].start,stop:t[n].stop,isStartIncluded:!0,isStopIncluded:t[n].isStopIncluded,data:t[n].data})):t[n]=new bn({start:e.stop,stop:e.stop,isStartIncluded:!0,isStopIncluded:!0,data:t[n].data}):t.splice(n,1)),n<t.length&&(ce.greaterThan(e.stop,t[n].start)||e.stop.equals(t[n].start)&&e.isStopIncluded&&t[n].isStartIncluded)&&(i=!0,t[n]=new bn({start:e.stop,stop:t[n].stop,isStartIncluded:!e.isStopIncluded,isStopIncluded:t[n].isStopIncluded,data:t[n].data})),i&&this._changedEvent.raiseEvent(this),i};ar.prototype.intersect=function(e,t,n){if(!l(e))throw new w("other is required.");const i=new ar;let o=0,r=0;const s=this._intervals,a=e._intervals;for(;o<s.length&&r<a.length;){const c=s[o],u=a[r];if(ce.lessThan(c.stop,u.start))++o;else if(ce.lessThan(u.stop,c.start))++r;else{if(l(n)||l(t)&&t(c.data,u.data)||!l(t)&&u.data===c.data){const f=bn.intersect(c,u,new bn,n);f.isEmpty||i.addInterval(f,t)}ce.lessThan(c.stop,u.stop)||c.stop.equals(u.stop)&&!c.isStopIncluded&&u.isStopIncluded?++o:++r}}return i};ar.fromJulianDateArray=function(e,t){if(!l(e))throw new w("options is required.");if(!l(e.julianDates))throw new w("options.iso8601Array is required.");l(t)||(t=new ar);const n=e.julianDates,i=n.length,o=e.dataCallback,r=A(e.isStartIncluded,!0),s=A(e.isStopIncluded,!0),a=A(e.leadingInterval,!1),c=A(e.trailingInterval,!1);let u,f=0;a&&(++f,u=new bn({start:wt.MINIMUM_VALUE,stop:n[0],isStartIncluded:!0,isStopIncluded:!r}),u.data=l(o)?o(u,t.length):t.length,t.addInterval(u));for(let h=0;h<i-1;++h){let _=n[h];const g=n[h+1];u=new bn({start:_,stop:g,isStartIncluded:t.length===f?r:!0,isStopIncluded:h===i-2?s:!1}),u.data=l(o)?o(u,t.length):t.length,t.addInterval(u),_=g}return c&&(u=new bn({start:n[i-1],stop:wt.MAXIMUM_VALUE,isStartIncluded:!s,isStopIncluded:!0}),u.data=l(o)?o(u,t.length):t.length,t.addInterval(u)),t};const xa=new dx,ZC=[0,31,28,31,30,31,30,31,31,30,31,30,31];function g2(e,t,n){l(n)||(n=new ce),ce.toGregorianDate(e,xa);let i=xa.millisecond+t.millisecond,o=xa.second+t.second,r=xa.minute+t.minute,s=xa.hour+t.hour,a=xa.day+t.day,c=xa.month+t.month,u=xa.year+t.year;for(i>=1e3&&(o+=Math.floor(i/1e3),i=i%1e3),o>=60&&(r+=Math.floor(o/60),o=o%60),r>=60&&(s+=Math.floor(r/60),r=r%60),s>=24&&(a+=Math.floor(s/24),s=s%24),ZC[2]=wI(u)?29:28;a>ZC[c]||c>=13;)a>ZC[c]&&(a-=ZC[c],++c),c>=13&&(--c,u+=Math.floor(c/12),c=c%12,++c),ZC[2]=wI(u)?29:28;return xa.millisecond=i,xa.second=o,xa.minute=r,xa.hour=s,xa.day=a,xa.month=c,xa.year=u,ce.fromGregorianDate(xa,n)}const but=new ce,Eut=/P(?:([\d.,]+)Y)?(?:([\d.,]+)M)?(?:([\d.,]+)W)?(?:([\d.,]+)D)?(?:T(?:([\d.,]+)H)?(?:([\d.,]+)M)?(?:([\d.,]+)S)?)?/;function Qoe(e,t){if(!l(e)||e.length===0)return!1;if(t.year=0,t.month=0,t.day=0,t.hour=0,t.minute=0,t.second=0,t.millisecond=0,e[0]==="P"){const n=e.match(Eut);if(!l(n))return!1;if(l(n[1])&&(t.year=Number(n[1].replace(",","."))),l(n[2])&&(t.month=Number(n[2].replace(",","."))),l(n[3])&&(t.day=Number(n[3].replace(",","."))*7),l(n[4])&&(t.day+=Number(n[4].replace(",","."))),l(n[5])&&(t.hour=Number(n[5].replace(",","."))),l(n[6])&&(t.minute=Number(n[6].replace(",","."))),l(n[7])){const i=Number(n[7].replace(",","."));t.second=Math.floor(i),t.millisecond=i%1*1e3}}else e[e.length-1]!=="Z"&&(e+="Z"),ce.toGregorianDate(ce.fromIso8601(e,but),t);return t.year||t.month||t.day||t.hour||t.minute||t.second||t.millisecond}const oE=new dx;ar.fromIso8601=function(e,t){if(!l(e))throw new w("options is required.");if(!l(e.iso8601))throw new w("options.iso8601 is required.");const n=e.iso8601.split("/"),i=ce.fromIso8601(n[0]),o=ce.fromIso8601(n[1]),r=[];if(!Qoe(n[2],oE))r.push(i,o);else{let s=ce.clone(i);for(r.push(s);ce.compare(s,o)<0;)s=g2(s,oE),ce.compare(o,s)<=0&&ce.clone(o,s),r.push(s)}return ar.fromJulianDateArray({julianDates:r,isStartIncluded:e.isStartIncluded,isStopIncluded:e.isStopIncluded,leadingInterval:e.leadingInterval,trailingInterval:e.trailingInterval,dataCallback:e.dataCallback},t)};ar.fromIso8601DateArray=function(e,t){if(!l(e))throw new w("options is required.");if(!l(e.iso8601Dates))throw new w("options.iso8601Dates is required.");return ar.fromJulianDateArray({julianDates:e.iso8601Dates.map(function(n){return ce.fromIso8601(n)}),isStartIncluded:e.isStartIncluded,isStopIncluded:e.isStopIncluded,leadingInterval:e.leadingInterval,trailingInterval:e.trailingInterval,dataCallback:e.dataCallback},t)};ar.fromIso8601DurationArray=function(e,t){if(!l(e))throw new w("options is required.");if(!l(e.epoch))throw new w("options.epoch is required.");if(!l(e.iso8601Durations))throw new w("options.iso8601Durations is required.");const n=e.epoch,i=e.iso8601Durations,o=A(e.relativeToPrevious,!1),r=[];let s,a;const c=i.length;for(let u=0;u<c;++u)(Qoe(i[u],oE)||u===0)&&(o&&l(a)?s=g2(a,oE):s=g2(n,oE),r.push(s),a=s);return ar.fromJulianDateArray({julianDates:r,isStartIncluded:e.isStartIncluded,isStopIncluded:e.isStopIncluded,leadingInterval:e.leadingInterval,trailingInterval:e.trailingInterval,dataCallback:e.dataCallback},t)};function xut(e,t,n,i){function o(){n.raiseEvent(e)}const r=[];t.removeAll();const s=i.length;for(let a=0;a<s;a++){const c=i.get(a);l(c.data)&&r.indexOf(c.data)===-1&&t.add(c.data.definitionChanged,o)}}function uy(){this._eventHelper=new Yd,this._definitionChanged=new lt,this._intervals=new ar,this._intervals.changedEvent.addEventListener(uy.prototype._intervalsChanged,this)}Object.defineProperties(uy.prototype,{isConstant:{get:function(){return this._intervals.isEmpty}},definitionChanged:{get:function(){return this._definitionChanged}},intervals:{get:function(){return this._intervals}}});uy.prototype.getValue=function(e,t){if(!l(e))throw new w("time is required");const n=this._intervals.findDataForIntervalContainingDate(e);if(l(n))return n.getValue(e,t)};uy.prototype.equals=function(e){return this===e||e instanceof uy&&this._intervals.equals(e._intervals,ie.equals)};uy.prototype._intervalsChanged=function(){xut(this,this._eventHelper,this._definitionChanged,this._intervals),this._definitionChanged.raiseEvent(this)};function a_(e){this._referenceFrame=A(e,$a.FIXED),this._definitionChanged=new lt,this._composite=new uy,this._composite.definitionChanged.addEventListener(a_.prototype._raiseDefinitionChanged,this)}Object.defineProperties(a_.prototype,{isConstant:{get:function(){return this._composite.isConstant}},definitionChanged:{get:function(){return this._definitionChanged}},intervals:{get:function(){return this._composite.intervals}},referenceFrame:{get:function(){return this._referenceFrame},set:function(e){this._referenceFrame=e}}});a_.prototype.getValue=function(e,t){return this.getValueInReferenceFrame(e,$a.FIXED,t)};a_.prototype.getValueInReferenceFrame=function(e,t,n){if(!l(e))throw new w("time is required.");if(!l(t))throw new w("referenceFrame is required.");const i=this._composite._intervals.findDataForIntervalContainingDate(e);if(l(i))return i.getValueInReferenceFrame(e,t,n)};a_.prototype.equals=function(e){return this===e||e instanceof a_&&this._referenceFrame===e._referenceFrame&&this._composite.equals(e._composite,ie.equals)};a_.prototype._raiseDefinitionChanged=function(){this._definitionChanged.raiseEvent(this)};const wut={ROUNDED:0,MITERED:1,BEVELED:2},Hr=Object.freeze(wut),Ms=[new d,new d],Sut=new d,vut=new d,Dut=new d,Iut=new d,Put=new d,Out=new d,Lut=new d,But=new d,Rut=new d,rA=new d,Uv=new d,XE={};let yN=new ve;function Nut(e,t){const n=new Array(e.length);for(let i=0;i<e.length;i++){const o=e[i];yN=t.cartesianToCartographic(o,yN),n[i]=yN.height,e[i]=t.scaleToGeodeticSurface(o,o)}return n}function AN(e,t,n,i){const o=e[0],r=e[1],s=d.angleBetween(o,r),a=Math.ceil(s/i),c=new Array(a);let u;if(t===n){for(u=0;u<a;u++)c[u]=t;return c.push(n),c}const h=(n-t)/a;for(u=1;u<a;u++){const _=t+u*h;c[u]=_}return c[0]=t,c.push(n),c}const u1=new d,f1=new d;function Mut(e,t,n,i){const o=new Ks(n,i),r=o.projectPointOntoPlane(d.add(n,e,u1),u1),s=o.projectPointOntoPlane(d.add(n,t,f1),f1),a=$.angleBetween(r,s);return s.x*r.y-s.y*r.x>=0?-a:a}const Fut=new d(-1,0,0);let dg=new N;const zut=new N;let TN=new te;const Uut=te.IDENTITY.clone(),Hut=new d,Vut=new ue,oj=new d;function wh(e,t,n,i,o,r,s,a){let c=Hut,u=Vut;dg=En.eastNorthUpToFixedFrame(e,o,dg),c=N.multiplyByPointAsVector(dg,Fut,c),c=d.normalize(c,c);const f=Mut(c,t,e,o);TN=te.fromRotationZ(f,TN),oj.z=r,dg=N.multiplyTransformation(dg,N.fromRotationTranslation(TN,oj,zut),dg);const h=Uut;h[0]=s;for(let _=0;_<a;_++)for(let g=0;g<n.length;g+=3)u=d.fromArray(n,g,u),u=te.multiplyByVector(h,u,u),u=N.multiplyByPoint(dg,u,u),i.push(u.x,u.y,u.z);return i}const kut=new d;function CN(e,t,n,i,o,r,s){for(let a=0;a<e.length;a+=3){const c=d.fromArray(e,a,kut);i=wh(c,t,n,i,o,r[a/3],s,1)}return i}function Gut(e,t){const n=e.length,i=new Array(n*6);let o=0;const r=t.x+t.width/2,s=t.y+t.height/2;let a=e[0];i[o++]=a.x-r,i[o++]=0,i[o++]=a.y-s;for(let c=1;c<n;c++){a=e[c];const u=a.x-r,f=a.y-s;i[o++]=u,i[o++]=0,i[o++]=f,i[o++]=u,i[o++]=0,i[o++]=f}return a=e[0],i[o++]=a.x-r,i[o++]=0,i[o++]=a.y-s,i}function rj(e,t){const n=e.length,i=new Array(n*3);let o=0;const r=t.x+t.width/2,s=t.y+t.height/2;for(let a=0;a<n;a++)i[o++]=e[a].x-r,i[o++]=0,i[o++]=e[a].y-s;return i}const sj=new De,aj=new d,cj=new te;function lj(e,t,n,i,o,r,s,a,c,u){const f=d.angleBetween(d.subtract(t,e,rA),d.subtract(n,e,Uv)),h=i===Hr.BEVELED?0:Math.ceil(f/F.toRadians(5));let _;o?_=te.fromQuaternion(De.fromAxisAngle(d.negate(e,rA),f/(h+1),sj),cj):_=te.fromQuaternion(De.fromAxisAngle(e,f/(h+1),sj),cj);let g,p;if(t=d.clone(t,aj),h>0){const y=u?2:1;for(let T=0;T<h;T++)t=te.multiplyByVector(_,t,t),g=d.subtract(t,e,rA),g=d.normalize(g,g),o||(g=d.negate(g,g)),p=r.scaleToGeodeticSurface(t,Uv),s=wh(p,g,a,s,r,c,1,y)}else g=d.subtract(t,e,rA),g=d.normalize(g,g),o||(g=d.negate(g,g)),p=r.scaleToGeodeticSurface(t,Uv),s=wh(p,g,a,s,r,c,1,1),n=d.clone(n,aj),g=d.subtract(n,e,rA),g=d.normalize(g,g),o||(g=d.negate(g,g)),p=r.scaleToGeodeticSurface(n,Uv),s=wh(p,g,a,s,r,c,1,1);return s}XE.removeDuplicatesFromShape=function(e){const t=e.length,n=[];for(let i=t-1,o=0;o<t;i=o++){const r=e[i],s=e[o];$.equals(r,s)||n.push(s)}return n};XE.angleIsGreaterThanPi=function(e,t,n,i){const o=new Ks(n,i),r=o.projectPointOntoPlane(d.add(n,e,u1),u1),s=o.projectPointOntoPlane(d.add(n,t,f1),f1);return s.x*r.y-s.y*r.x>=0};const Wut=new d,qut=new d;XE.computePositions=function(e,t,n,i,o){const r=i._ellipsoid,s=Nut(e,r),a=i._granularity,c=i._cornerType,u=o?Gut(t,n):rj(t,n),f=o?rj(t,n):void 0,h=n.height/2,_=n.width/2;let g=e.length,p=[],y=o?[]:void 0,T=Sut,b=vut,x=Dut,v=Iut,D=Put,L=Out,B=Lut,V=But,M=Rut,H=e[0],G=e[1];v=r.geodeticSurfaceNormal(H,v),T=d.subtract(G,H,T),T=d.normalize(T,T),V=d.cross(v,T,V),V=d.normalize(V,V);let I=s[0],O=s[1];o&&(y=wh(H,V,f,y,r,I+h,1,1)),M=d.clone(H,M),H=G,b=d.negate(T,b);let m,P;for(let W=1;W<g-1;W++){const q=o?2:1;if(G=e[W+1],H.equals(G)){uo("Positions are too close and are considered equivalent with rounding error.");continue}T=d.subtract(G,H,T),T=d.normalize(T,T),x=d.add(T,b,x),x=d.normalize(x,x),v=r.geodeticSurfaceNormal(H,v);const Y=d.multiplyByScalar(v,d.dot(T,v),Wut);d.subtract(T,Y,Y),d.normalize(Y,Y);const j=d.multiplyByScalar(v,d.dot(b,v),qut);if(d.subtract(b,j,j),d.normalize(j,j),!F.equalsEpsilon(Math.abs(d.dot(Y,j)),1,F.EPSILON7)){x=d.cross(x,v,x),x=d.cross(v,x,x),x=d.normalize(x,x);const K=1/Math.max(.25,d.magnitude(d.cross(x,b,rA))),se=XE.angleIsGreaterThanPi(T,b,H,r);se?(D=d.add(H,d.multiplyByScalar(x,K*_,x),D),L=d.add(D,d.multiplyByScalar(V,_,L),L),Ms[0]=d.clone(M,Ms[0]),Ms[1]=d.clone(L,Ms[1]),m=AN(Ms,I+h,O+h,a),P=Jr.generateArc({positions:Ms,granularity:a,ellipsoid:r}),p=CN(P,V,u,p,r,m,1),V=d.cross(v,T,V),V=d.normalize(V,V),B=d.add(D,d.multiplyByScalar(V,_,B),B),c===Hr.ROUNDED||c===Hr.BEVELED?lj(D,L,B,c,se,r,p,u,O+h,o):(x=d.negate(x,x),p=wh(H,x,u,p,r,O+h,K,q)),M=d.clone(B,M)):(D=d.add(H,d.multiplyByScalar(x,K*_,x),D),L=d.add(D,d.multiplyByScalar(V,-_,L),L),Ms[0]=d.clone(M,Ms[0]),Ms[1]=d.clone(L,Ms[1]),m=AN(Ms,I+h,O+h,a),P=Jr.generateArc({positions:Ms,granularity:a,ellipsoid:r}),p=CN(P,V,u,p,r,m,1),V=d.cross(v,T,V),V=d.normalize(V,V),B=d.add(D,d.multiplyByScalar(V,-_,B),B),c===Hr.ROUNDED||c===Hr.BEVELED?lj(D,L,B,c,se,r,p,u,O+h,o):p=wh(H,x,u,p,r,O+h,K,q),M=d.clone(B,M)),b=d.negate(T,b)}else p=wh(M,V,u,p,r,I+h,1,1),M=H;I=O,O=s[W+1],H=G}Ms[0]=d.clone(M,Ms[0]),Ms[1]=d.clone(H,Ms[1]),m=AN(Ms,I+h,O+h,a),P=Jr.generateArc({positions:Ms,granularity:a,ellipsoid:r}),p=CN(P,V,u,p,r,m,1),o&&(y=wh(H,V,f,y,r,O+h,1,1)),g=p.length;const R=o?g+y.length:g,U=new Float64Array(R);return U.set(p),o&&U.set(y,g),U};const KE=XE,GU={},OA=new d,Zoe=new d,jut=new d,uj=new d,sc=[new d,new d],ere=new d,tre=new d,nre=new d,Yut=new d,$ut=new d,Xut=new d,Kut=new d,Jut=new d,Qut=new d,Zut=new d,fj=new De,dj=new te;function d1(e,t,n,i,o){const r=d.angleBetween(d.subtract(t,e,OA),d.subtract(n,e,Zoe)),s=i===Hr.BEVELED?1:Math.ceil(r/F.toRadians(5))+1,a=s*3,c=new Array(a);c[a-3]=n.x,c[a-2]=n.y,c[a-1]=n.z;let u;o?u=te.fromQuaternion(De.fromAxisAngle(d.negate(e,OA),r/s,fj),dj):u=te.fromQuaternion(De.fromAxisAngle(e,r/s,fj),dj);let f=0;t=d.clone(t,OA);for(let h=0;h<s;h++)t=te.multiplyByVector(u,t,t),c[f++]=t.x,c[f++]=t.y,c[f++]=t.z;return c}function eft(e){let t=ere,n=tre,i=nre,o=e[1];n=d.fromArray(e[1],o.length-3,n),i=d.fromArray(e[0],0,i),t=d.midpoint(n,i,t);const r=d1(t,n,i,Hr.ROUNDED,!1),s=e.length-1,a=e[s-1];o=e[s],n=d.fromArray(a,a.length-3,n),i=d.fromArray(o,0,i),t=d.midpoint(n,i,t);const c=d1(t,n,i,Hr.ROUNDED,!1);return[r,c]}function hj(e,t,n,i){let o=OA;return i||(t=d.negate(t,t)),o=d.add(e,t,o),[o.x,o.y,o.z,n.x,n.y,n.z]}function bN(e,t,n,i){const o=new Array(e.length),r=new Array(e.length),s=d.multiplyByScalar(t,n,OA),a=d.negate(s,Zoe);let c=0,u=e.length-1;for(let f=0;f<e.length;f+=3){const h=d.fromArray(e,f,jut),_=d.add(h,a,uj);o[c++]=_.x,o[c++]=_.y,o[c++]=_.z;const g=d.add(h,s,uj);r[u--]=g.z,r[u--]=g.y,r[u--]=g.x}return i.push(o,r),i}GU.addAttribute=function(e,t,n,i){const o=t.x,r=t.y,s=t.z;l(n)&&(e[n]=o,e[n+1]=r,e[n+2]=s),l(i)&&(e[i]=s,e[i-1]=r,e[i-2]=o)};const tft=new d,nft=new d;GU.computePositions=function(e){const t=e.granularity,n=e.positions,i=e.ellipsoid,o=e.width/2,r=e.cornerType,s=e.saveAttributes;let a=ere,c=tre,u=nre,f=Yut,h=$ut,_=Xut,g=Kut,p=Jut,y=Qut,T=Zut,b=[];const x=s?[]:void 0,v=s?[]:void 0;let D=n[0],L=n[1];c=d.normalize(d.subtract(L,D,c),c),a=i.geodeticSurfaceNormal(D,a),f=d.normalize(d.cross(a,c,f),f),s&&(x.push(f.x,f.y,f.z),v.push(a.x,a.y,a.z)),g=d.clone(D,g),D=L,u=d.negate(c,u);let B;const V=[];let M;const H=n.length;for(M=1;M<H-1;M++){a=i.geodeticSurfaceNormal(D,a),L=n[M+1],c=d.normalize(d.subtract(L,D,c),c),h=d.normalize(d.add(c,u,h),h);const I=d.multiplyByScalar(a,d.dot(c,a),tft);d.subtract(c,I,I),d.normalize(I,I);const O=d.multiplyByScalar(a,d.dot(u,a),nft);if(d.subtract(u,O,O),d.normalize(O,O),!F.equalsEpsilon(Math.abs(d.dot(I,O)),1,F.EPSILON7)){h=d.cross(h,a,h),h=d.cross(a,h,h),h=d.normalize(h,h);const P=o/Math.max(.25,d.magnitude(d.cross(h,u,OA))),R=KE.angleIsGreaterThanPi(c,u,D,i);h=d.multiplyByScalar(h,P,h),R?(p=d.add(D,h,p),T=d.add(p,d.multiplyByScalar(f,o,T),T),y=d.add(p,d.multiplyByScalar(f,o*2,y),y),sc[0]=d.clone(g,sc[0]),sc[1]=d.clone(T,sc[1]),B=Jr.generateArc({positions:sc,granularity:t,ellipsoid:i}),b=bN(B,f,o,b),s&&(x.push(f.x,f.y,f.z),v.push(a.x,a.y,a.z)),_=d.clone(y,_),f=d.normalize(d.cross(a,c,f),f),y=d.add(p,d.multiplyByScalar(f,o*2,y),y),g=d.add(p,d.multiplyByScalar(f,o,g),g),r===Hr.ROUNDED||r===Hr.BEVELED?V.push({leftPositions:d1(p,_,y,r,R)}):V.push({leftPositions:hj(D,d.negate(h,h),y,R)})):(y=d.add(D,h,y),T=d.add(y,d.negate(d.multiplyByScalar(f,o,T),T),T),p=d.add(y,d.negate(d.multiplyByScalar(f,o*2,p),p),p),sc[0]=d.clone(g,sc[0]),sc[1]=d.clone(T,sc[1]),B=Jr.generateArc({positions:sc,granularity:t,ellipsoid:i}),b=bN(B,f,o,b),s&&(x.push(f.x,f.y,f.z),v.push(a.x,a.y,a.z)),_=d.clone(p,_),f=d.normalize(d.cross(a,c,f),f),p=d.add(y,d.negate(d.multiplyByScalar(f,o*2,p),p),p),g=d.add(y,d.negate(d.multiplyByScalar(f,o,g),g),g),r===Hr.ROUNDED||r===Hr.BEVELED?V.push({rightPositions:d1(y,_,p,r,R)}):V.push({rightPositions:hj(D,h,p,R)})),u=d.negate(c,u)}D=L}a=i.geodeticSurfaceNormal(D,a),sc[0]=d.clone(g,sc[0]),sc[1]=d.clone(D,sc[1]),B=Jr.generateArc({positions:sc,granularity:t,ellipsoid:i}),b=bN(B,f,o,b),s&&(x.push(f.x,f.y,f.z),v.push(a.x,a.y,a.z));let G;return r===Hr.ROUNDED&&(G=eft(b)),{positions:b,corners:V,lefts:x,normals:v,endPositions:G}};const ao=GU,ire=new d,ore=new d,tI=new d,nI=new d,ift=new d,rre=new d,Am=new d,M0=new d;function sre(e,t){for(let n=0;n<e.length;n++)e[n]=t.scaleToGeodeticSurface(e[n],e[n]);return e}function Vu(e,t,n,i,o,r){const s=e.normals,a=e.tangents,c=e.bitangents,u=d.normalize(d.cross(n,t,Am),Am);r.normal&&ao.addAttribute(s,t,i,o),r.tangent&&ao.addAttribute(a,u,i,o),r.bitangent&&ao.addAttribute(c,n,i,o)}function are(e,t,n){const i=e.positions,o=e.corners,r=e.endPositions,s=e.lefts,a=e.normals,c=new To;let u,f=0,h=0,_,g=0,p;for(_=0;_<i.length;_+=2)p=i[_].length-3,f+=p,g+=p*2,h+=i[_+1].length-3;for(f+=3,h+=3,_=0;_<o.length;_++){u=o[_];const J=o[_].leftPositions;l(J)?(p=J.length,f+=p,g+=p):(p=o[_].rightPositions.length,h+=p,g+=p)}const y=l(r);let T;y&&(T=r[0].length-3,f+=T,h+=T,T/=3,g+=T*6);const b=f+h,x=new Float64Array(b),v=t.normal?new Float32Array(b):void 0,D=t.tangent?new Float32Array(b):void 0,L=t.bitangent?new Float32Array(b):void 0,B={normals:v,tangents:D,bitangents:L};let V=0,M=b-1,H,G,I,O,m=ire,P=ore,R,U;const W=T/2,q=At.createTypedArray(b/3,g);let Y=0;if(y){U=tI,R=nI;const J=r[0];for(m=d.fromArray(a,0,m),P=d.fromArray(s,0,P),_=0;_<W;_++)U=d.fromArray(J,(W-1-_)*3,U),R=d.fromArray(J,(W+_)*3,R),ao.addAttribute(x,R,V),ao.addAttribute(x,U,void 0,M),Vu(B,m,P,V,M,t),G=V/3,O=G+1,H=(M-2)/3,I=H-1,q[Y++]=H,q[Y++]=G,q[Y++]=I,q[Y++]=I,q[Y++]=G,q[Y++]=O,V+=3,M-=3}let j=0,ee=0,K=i[j++],se=i[j++];x.set(K,V),x.set(se,M-se.length+1),P=d.fromArray(s,ee,P);let Q,Z;for(p=se.length-3,_=0;_<p;_+=3)Q=n.geodeticSurfaceNormal(d.fromArray(K,_,Am),Am),Z=n.geodeticSurfaceNormal(d.fromArray(se,p-_,M0),M0),m=d.normalize(d.add(Q,Z,m),m),Vu(B,m,P,V,M,t),G=V/3,O=G+1,H=(M-2)/3,I=H-1,q[Y++]=H,q[Y++]=G,q[Y++]=I,q[Y++]=I,q[Y++]=G,q[Y++]=O,V+=3,M-=3;for(Q=n.geodeticSurfaceNormal(d.fromArray(K,p,Am),Am),Z=n.geodeticSurfaceNormal(d.fromArray(se,p,M0),M0),m=d.normalize(d.add(Q,Z,m),m),ee+=3,_=0;_<o.length;_++){let J;u=o[_];const de=u.leftPositions,_e=u.rightPositions;let le,Te,pe=rre,ne=tI,ae=nI;if(m=d.fromArray(a,ee,m),l(de)){for(Vu(B,m,P,void 0,M,t),M-=3,le=O,Te=I,J=0;J<de.length/3;J++)pe=d.fromArray(de,J*3,pe),q[Y++]=le,q[Y++]=Te-J-1,q[Y++]=Te-J,ao.addAttribute(x,pe,void 0,M),ne=d.fromArray(x,(Te-J-1)*3,ne),ae=d.fromArray(x,le*3,ae),P=d.normalize(d.subtract(ne,ae,P),P),Vu(B,m,P,void 0,M,t),M-=3;pe=d.fromArray(x,le*3,pe),ne=d.subtract(d.fromArray(x,Te*3,ne),pe,ne),ae=d.subtract(d.fromArray(x,(Te-J)*3,ae),pe,ae),P=d.normalize(d.add(ne,ae,P),P),Vu(B,m,P,V,void 0,t),V+=3}else{for(Vu(B,m,P,V,void 0,t),V+=3,le=I,Te=O,J=0;J<_e.length/3;J++)pe=d.fromArray(_e,J*3,pe),q[Y++]=le,q[Y++]=Te+J,q[Y++]=Te+J+1,ao.addAttribute(x,pe,V),ne=d.fromArray(x,le*3,ne),ae=d.fromArray(x,(Te+J)*3,ae),P=d.normalize(d.subtract(ne,ae,P),P),Vu(B,m,P,V,void 0,t),V+=3;pe=d.fromArray(x,le*3,pe),ne=d.subtract(d.fromArray(x,(Te+J)*3,ne),pe,ne),ae=d.subtract(d.fromArray(x,Te*3,ae),pe,ae),P=d.normalize(d.negate(d.add(ae,ne,P),P),P),Vu(B,m,P,void 0,M,t),M-=3}for(K=i[j++],se=i[j++],K.splice(0,3),se.splice(se.length-3,3),x.set(K,V),x.set(se,M-se.length+1),p=se.length-3,ee+=3,P=d.fromArray(s,ee,P),J=0;J<se.length;J+=3)Q=n.geodeticSurfaceNormal(d.fromArray(K,J,Am),Am),Z=n.geodeticSurfaceNormal(d.fromArray(se,p-J,M0),M0),m=d.normalize(d.add(Q,Z,m),m),Vu(B,m,P,V,M,t),O=V/3,G=O-1,I=(M-2)/3,H=I+1,q[Y++]=H,q[Y++]=G,q[Y++]=I,q[Y++]=I,q[Y++]=G,q[Y++]=O,V+=3,M-=3;V-=3,M+=3}if(m=d.fromArray(a,a.length-3,m),Vu(B,m,P,V,M,t),y){V+=3,M-=3,U=tI,R=nI;const J=r[1];for(_=0;_<W;_++)U=d.fromArray(J,(T-_-1)*3,U),R=d.fromArray(J,_*3,R),ao.addAttribute(x,U,void 0,M),ao.addAttribute(x,R,V),Vu(B,m,P,V,M,t),O=V/3,G=O-1,I=(M-2)/3,H=I+1,q[Y++]=H,q[Y++]=G,q[Y++]=I,q[Y++]=I,q[Y++]=G,q[Y++]=O,V+=3,M-=3}if(c.position=new Xe({componentDatatype:oe.DOUBLE,componentsPerAttribute:3,values:x}),t.st){const J=new Float32Array(b/3*2);let de,_e,le=0;if(y){f/=3,h/=3;const Te=Math.PI/(T+1);_e=1/(f-T+1),de=1/(h-T+1);let pe;const ne=T/2;for(_=ne+1;_<T+1;_++)pe=F.PI_OVER_TWO+Te*_,J[le++]=de*(1+Math.cos(pe)),J[le++]=.5*(1+Math.sin(pe));for(_=1;_<h-T+1;_++)J[le++]=_*de,J[le++]=0;for(_=T;_>ne;_--)pe=F.PI_OVER_TWO-_*Te,J[le++]=1-de*(1+Math.cos(pe)),J[le++]=.5*(1+Math.sin(pe));for(_=ne;_>0;_--)pe=F.PI_OVER_TWO-Te*_,J[le++]=1-_e*(1+Math.cos(pe)),J[le++]=.5*(1+Math.sin(pe));for(_=f-T;_>0;_--)J[le++]=_*_e,J[le++]=1;for(_=1;_<ne+1;_++)pe=F.PI_OVER_TWO+Te*_,J[le++]=_e*(1+Math.cos(pe)),J[le++]=.5*(1+Math.sin(pe))}else{for(f/=3,h/=3,_e=1/(f-1),de=1/(h-1),_=0;_<h;_++)J[le++]=_*de,J[le++]=0;for(_=f;_>0;_--)J[le++]=(_-1)*_e,J[le++]=1}c.st=new Xe({componentDatatype:oe.FLOAT,componentsPerAttribute:2,values:J})}return t.normal&&(c.normal=new Xe({componentDatatype:oe.FLOAT,componentsPerAttribute:3,values:B.normals})),t.tangent&&(c.tangent=new Xe({componentDatatype:oe.FLOAT,componentsPerAttribute:3,values:B.tangents})),t.bitangent&&(c.bitangent=new Xe({componentDatatype:oe.FLOAT,componentsPerAttribute:3,values:B.bitangents})),{attributes:c,indices:q}}function oft(e,t){if(!t.normal&&!t.tangent&&!t.bitangent&&!t.st)return e;const n=e.position.values;let i,o;(t.normal||t.bitangent)&&(i=e.normal.values,o=e.bitangent.values);const r=e.position.values.length/18,s=r*3,a=r*2,c=s*2;let u;if(t.normal||t.bitangent||t.tangent){const f=t.normal?new Float32Array(s*6):void 0,h=t.tangent?new Float32Array(s*6):void 0,_=t.bitangent?new Float32Array(s*6):void 0;let g=ire,p=ore,y=tI,T=nI,b=ift,x=rre,v=c;for(u=0;u<s;u+=3){const D=v+c;g=d.fromArray(n,u,g),p=d.fromArray(n,u+s,p),y=d.fromArray(n,(u+3)%s,y),p=d.subtract(p,g,p),y=d.subtract(y,g,y),T=d.normalize(d.cross(p,y,T),T),t.normal&&(ao.addAttribute(f,T,D),ao.addAttribute(f,T,D+3),ao.addAttribute(f,T,v),ao.addAttribute(f,T,v+3)),(t.tangent||t.bitangent)&&(x=d.fromArray(i,u,x),t.bitangent&&(ao.addAttribute(_,x,D),ao.addAttribute(_,x,D+3),ao.addAttribute(_,x,v),ao.addAttribute(_,x,v+3)),t.tangent&&(b=d.normalize(d.cross(x,T,b),b),ao.addAttribute(h,b,D),ao.addAttribute(h,b,D+3),ao.addAttribute(h,b,v),ao.addAttribute(h,b,v+3))),v+=6}if(t.normal){for(f.set(i),u=0;u<s;u+=3)f[u+s]=-i[u],f[u+s+1]=-i[u+1],f[u+s+2]=-i[u+2];e.normal.values=f}else e.normal=void 0;if(t.bitangent?(_.set(o),_.set(o,s),e.bitangent.values=_):e.bitangent=void 0,t.tangent){const D=e.tangent.values;h.set(D),h.set(D,s),e.tangent.values=h}}if(t.st){const f=e.st.values,h=new Float32Array(a*6);h.set(f),h.set(f,a);let _=a*2;for(let g=0;g<2;g++){for(h[_++]=f[0],h[_++]=f[1],u=2;u<a;u+=2){const p=f[u],y=f[u+1];h[_++]=p,h[_++]=y,h[_++]=p,h[_++]=y}h[_++]=f[0],h[_++]=f[1]}e.st.values=h}return e}function EN(e,t,n){n[t++]=e[0],n[t++]=e[1],n[t++]=e[2];for(let i=3;i<e.length;i+=3){const o=e[i],r=e[i+1],s=e[i+2];n[t++]=o,n[t++]=r,n[t++]=s,n[t++]=o,n[t++]=r,n[t++]=s}return n[t++]=e[0],n[t++]=e[1],n[t++]=e[2],n}function rft(e,t){const n=new Ye({position:t.position,normal:t.normal||t.bitangent||e.shadowVolume,tangent:t.tangent,bitangent:t.normal||t.bitangent,st:t.st}),i=e.ellipsoid,o=ao.computePositions(e),r=are(o,n,i),s=e.height,a=e.extrudedHeight;let c=r.attributes;const u=r.indices;let f=c.position.values,h=f.length;const _=new Float64Array(h*6);let g=new Float64Array(h);g.set(f);let p=new Float64Array(h*4);f=wo.scaleToGeodeticHeight(f,s,i),p=EN(f,0,p),g=wo.scaleToGeodeticHeight(g,a,i),p=EN(g,h*2,p),_.set(f),_.set(g,h),_.set(p,h*2),c.position.values=_,c=oft(c,t);let y;const T=h/3;if(e.shadowVolume){const H=c.normal.values;h=H.length;let G=new Float32Array(h*6);for(y=0;y<h;y++)H[y]=-H[y];G.set(H,h),G=EN(H,h*4,G),c.extrudeDirection=new Xe({componentDatatype:oe.FLOAT,componentsPerAttribute:3,values:G}),t.normal||(c.normal=void 0)}if(l(e.offsetAttribute)){let H=new Uint8Array(T*6);if(e.offsetAttribute===Fn.TOP)H=H.fill(1,0,T).fill(1,T*2,T*4);else{const G=e.offsetAttribute===Fn.NONE?0:1;H=H.fill(G)}c.applyOffset=new Xe({componentDatatype:oe.UNSIGNED_BYTE,componentsPerAttribute:1,values:H})}const b=u.length,x=T+T,v=At.createTypedArray(_.length/3,b*2+x*3);v.set(u);let D=b;for(y=0;y<b;y+=3){const H=u[y],G=u[y+1],I=u[y+2];v[D++]=I+T,v[D++]=G+T,v[D++]=H+T}let L,B,V,M;for(y=0;y<x;y+=2)L=y+x,B=L+x,V=L+1,M=B+1,v[D++]=L,v[D++]=B,v[D++]=V,v[D++]=V,v[D++]=B,v[D++]=M;return{attributes:c,indices:v}}const pj=new d,eb=new d,Zl=new ve;function mj(e,t,n,i,o,r){const s=d.subtract(t,e,pj);d.normalize(s,s);const a=n.geodeticSurfaceNormal(e,eb),c=d.cross(s,a,pj);d.multiplyByScalar(c,i,c);let u=o.latitude,f=o.longitude,h=r.latitude,_=r.longitude;d.add(e,c,eb),n.cartesianToCartographic(eb,Zl);let g=Zl.latitude,p=Zl.longitude;u=Math.min(u,g),f=Math.min(f,p),h=Math.max(h,g),_=Math.max(_,p),d.subtract(e,c,eb),n.cartesianToCartographic(eb,Zl),g=Zl.latitude,p=Zl.longitude,u=Math.min(u,g),f=Math.min(f,p),h=Math.max(h,g),_=Math.max(_,p),o.latitude=u,o.longitude=f,r.latitude=h,r.longitude=_}const Wl=new d,tb=new d,Ic=new ve,Pc=new ve;function cre(e,t,n,i,o){e=sre(e,t);const r=Ya(e,d.equalsEpsilon),s=r.length;if(s<2||n<=0)return new Ee;const a=n*.5;Ic.latitude=Number.POSITIVE_INFINITY,Ic.longitude=Number.POSITIVE_INFINITY,Pc.latitude=Number.NEGATIVE_INFINITY,Pc.longitude=Number.NEGATIVE_INFINITY;let c,u;if(i===Hr.ROUNDED){const _=r[0];d.subtract(_,r[1],Wl),d.normalize(Wl,Wl),d.multiplyByScalar(Wl,a,Wl),d.add(_,Wl,tb),t.cartesianToCartographic(tb,Zl),c=Zl.latitude,u=Zl.longitude,Ic.latitude=Math.min(Ic.latitude,c),Ic.longitude=Math.min(Ic.longitude,u),Pc.latitude=Math.max(Pc.latitude,c),Pc.longitude=Math.max(Pc.longitude,u)}for(let _=0;_<s-1;++_)mj(r[_],r[_+1],t,a,Ic,Pc);const f=r[s-1];d.subtract(f,r[s-2],Wl),d.normalize(Wl,Wl),d.multiplyByScalar(Wl,a,Wl),d.add(f,Wl,tb),mj(f,tb,t,a,Ic,Pc),i===Hr.ROUNDED&&(t.cartesianToCartographic(tb,Zl),c=Zl.latitude,u=Zl.longitude,Ic.latitude=Math.min(Ic.latitude,c),Ic.longitude=Math.min(Ic.longitude,u),Pc.latitude=Math.max(Pc.latitude,c),Pc.longitude=Math.max(Pc.longitude,u));const h=l(o)?o:new Ee;return h.north=Pc.latitude,h.south=Ic.latitude,h.east=Pc.longitude,h.west=Ic.longitude,h}function Cf(e){e=A(e,A.EMPTY_OBJECT);const t=e.positions,n=e.width;E.defined("options.positions",t),E.defined("options.width",n);const i=A(e.height,0),o=A(e.extrudedHeight,i);this._positions=t,this._ellipsoid=be.clone(A(e.ellipsoid,be.WGS84)),this._vertexFormat=Ye.clone(A(e.vertexFormat,Ye.DEFAULT)),this._width=n,this._height=Math.max(i,o),this._extrudedHeight=Math.min(i,o),this._cornerType=A(e.cornerType,Hr.ROUNDED),this._granularity=A(e.granularity,F.RADIANS_PER_DEGREE),this._shadowVolume=A(e.shadowVolume,!1),this._workerName="createCorridorGeometry",this._offsetAttribute=e.offsetAttribute,this._rectangle=void 0,this.packedLength=1+t.length*d.packedLength+be.packedLength+Ye.packedLength+7}Cf.pack=function(e,t,n){E.defined("value",e),E.defined("array",t),n=A(n,0);const i=e._positions,o=i.length;t[n++]=o;for(let r=0;r<o;++r,n+=d.packedLength)d.pack(i[r],t,n);return be.pack(e._ellipsoid,t,n),n+=be.packedLength,Ye.pack(e._vertexFormat,t,n),n+=Ye.packedLength,t[n++]=e._width,t[n++]=e._height,t[n++]=e._extrudedHeight,t[n++]=e._cornerType,t[n++]=e._granularity,t[n++]=e._shadowVolume?1:0,t[n]=A(e._offsetAttribute,-1),t};const lre=be.clone(be.UNIT_SPHERE),ure=new Ye,mh={positions:void 0,ellipsoid:lre,vertexFormat:ure,width:void 0,height:void 0,extrudedHeight:void 0,cornerType:void 0,granularity:void 0,shadowVolume:void 0,offsetAttribute:void 0};Cf.unpack=function(e,t,n){E.defined("array",e),t=A(t,0);const i=e[t++],o=new Array(i);for(let p=0;p<i;++p,t+=d.packedLength)o[p]=d.unpack(e,t);const r=be.unpack(e,t,lre);t+=be.packedLength;const s=Ye.unpack(e,t,ure);t+=Ye.packedLength;const a=e[t++],c=e[t++],u=e[t++],f=e[t++],h=e[t++],_=e[t++]===1,g=e[t];return l(n)?(n._positions=o,n._ellipsoid=be.clone(r,n._ellipsoid),n._vertexFormat=Ye.clone(s,n._vertexFormat),n._width=a,n._height=c,n._extrudedHeight=u,n._cornerType=f,n._granularity=h,n._shadowVolume=_,n._offsetAttribute=g===-1?void 0:g,n):(mh.positions=o,mh.width=a,mh.height=c,mh.extrudedHeight=u,mh.cornerType=f,mh.granularity=h,mh.shadowVolume=_,mh.offsetAttribute=g===-1?void 0:g,new Cf(mh))};Cf.computeRectangle=function(e,t){e=A(e,A.EMPTY_OBJECT);const n=e.positions,i=e.width;E.defined("options.positions",n),E.defined("options.width",i);const o=A(e.ellipsoid,be.WGS84),r=A(e.cornerType,Hr.ROUNDED);return cre(n,o,i,r,t)};Cf.createGeometry=function(e){let t=e._positions;const n=e._width,i=e._ellipsoid;t=sre(t,i);const o=Ya(t,d.equalsEpsilon);if(o.length<2||n<=0)return;const r=e._height,s=e._extrudedHeight,a=!F.equalsEpsilon(r,s,0,F.EPSILON2),c=e._vertexFormat,u={ellipsoid:i,positions:o,width:n,cornerType:e._cornerType,granularity:e._granularity,saveAttributes:!0};let f;if(a)u.height=r,u.extrudedHeight=s,u.shadowVolume=e._shadowVolume,u.offsetAttribute=e._offsetAttribute,f=rft(u,c);else{const g=ao.computePositions(u);if(f=are(g,c,i),f.attributes.position.values=wo.scaleToGeodeticHeight(f.attributes.position.values,r,i),l(e._offsetAttribute)){const p=e._offsetAttribute===Fn.NONE?0:1,y=f.attributes.position.values.length,T=new Uint8Array(y/3).fill(p);f.attributes.applyOffset=new Xe({componentDatatype:oe.UNSIGNED_BYTE,componentsPerAttribute:1,values:T})}}const h=f.attributes,_=Ae.fromVertices(h.position.values,void 0,3);return c.position||(f.attributes.position.values=void 0),new $t({attributes:h,indices:f.indices,primitiveType:dt.TRIANGLES,boundingSphere:_,offsetAttribute:e._offsetAttribute})};Cf.createShadowVolume=function(e,t,n){const i=e._granularity,o=e._ellipsoid,r=t(i,o),s=n(i,o);return new Cf({positions:e._positions,width:e._width,cornerType:e._cornerType,ellipsoid:o,granularity:i,extrudedHeight:r,height:s,vertexFormat:Ye.POSITION_ONLY,shadowVolume:!0})};Object.defineProperties(Cf.prototype,{rectangle:{get:function(){return l(this._rectangle)||(this._rectangle=cre(this._positions,this._ellipsoid,this._width,this._cornerType)),this._rectangle}},textureCoordinateRotationPoints:{get:function(){return[0,0,0,1,1,0]}}});const _j=new d,gj=new d,sft=new d;function aft(e,t){for(let n=0;n<e.length;n++)e[n]=t.scaleToGeodeticSurface(e[n],e[n]);return e}function fre(e,t){const n=[],i=e.positions,o=e.corners,r=e.endPositions,s=new To;let a,c=0,u=0,f,h=0,_;for(f=0;f<i.length;f+=2)_=i[f].length-3,c+=_,h+=_/3*4,u+=i[f+1].length-3;for(c+=3,u+=3,f=0;f<o.length;f++){a=o[f];const R=o[f].leftPositions;l(R)?(_=R.length,c+=_,h+=_/3*2):(_=o[f].rightPositions.length,u+=_,h+=_/3*2)}const g=l(r);let p;g&&(p=r[0].length-3,c+=p,u+=p,p/=3,h+=p*4);const y=c+u,T=new Float64Array(y);let b=0,x=y-1,v,D,L,B,V,M;const H=p/2,G=At.createTypedArray(y/3,h+4);let I=0;if(G[I++]=b/3,G[I++]=(x-2)/3,g){n.push(b/3),M=_j,V=gj;const R=r[0];for(f=0;f<H;f++)M=d.fromArray(R,(H-1-f)*3,M),V=d.fromArray(R,(H+f)*3,V),ao.addAttribute(T,V,b),ao.addAttribute(T,M,void 0,x),D=b/3,B=D+1,v=(x-2)/3,L=v-1,G[I++]=v,G[I++]=L,G[I++]=D,G[I++]=B,b+=3,x-=3}let O=0,m=i[O++],P=i[O++];for(T.set(m,b),T.set(P,x-P.length+1),_=P.length-3,n.push(b/3,(x-2)/3),f=0;f<_;f+=3)D=b/3,B=D+1,v=(x-2)/3,L=v-1,G[I++]=v,G[I++]=L,G[I++]=D,G[I++]=B,b+=3,x-=3;for(f=0;f<o.length;f++){let R;a=o[f];const U=a.leftPositions,W=a.rightPositions;let q,Y=sft;if(l(U)){for(x-=3,q=L,n.push(B),R=0;R<U.length/3;R++)Y=d.fromArray(U,R*3,Y),G[I++]=q-R-1,G[I++]=q-R,ao.addAttribute(T,Y,void 0,x),x-=3;n.push(q-Math.floor(U.length/6)),t===Hr.BEVELED&&n.push((x-2)/3+1),b+=3}else{for(b+=3,q=B,n.push(L),R=0;R<W.length/3;R++)Y=d.fromArray(W,R*3,Y),G[I++]=q+R,G[I++]=q+R+1,ao.addAttribute(T,Y,b),b+=3;n.push(q+Math.floor(W.length/6)),t===Hr.BEVELED&&n.push(b/3-1),x-=3}for(m=i[O++],P=i[O++],m.splice(0,3),P.splice(P.length-3,3),T.set(m,b),T.set(P,x-P.length+1),_=P.length-3,R=0;R<P.length;R+=3)B=b/3,D=B-1,L=(x-2)/3,v=L+1,G[I++]=v,G[I++]=L,G[I++]=D,G[I++]=B,b+=3,x-=3;b-=3,x+=3,n.push(b/3,(x-2)/3)}if(g){b+=3,x-=3,M=_j,V=gj;const R=r[1];for(f=0;f<H;f++)M=d.fromArray(R,(p-f-1)*3,M),V=d.fromArray(R,f*3,V),ao.addAttribute(T,M,void 0,x),ao.addAttribute(T,V,b),B=b/3,D=B-1,L=(x-2)/3,v=L+1,G[I++]=v,G[I++]=L,G[I++]=D,G[I++]=B,b+=3,x-=3;n.push(b/3)}else n.push(b/3,(x-2)/3);return G[I++]=b/3,G[I++]=(x-2)/3,s.position=new Xe({componentDatatype:oe.DOUBLE,componentsPerAttribute:3,values:T}),{attributes:s,indices:G,wallIndices:n}}function cft(e){const t=e.ellipsoid,n=ao.computePositions(e),i=fre(n,e.cornerType),o=i.wallIndices,r=e.height,s=e.extrudedHeight,a=i.attributes,c=i.indices;let u=a.position.values,f=u.length,h=new Float64Array(f);h.set(u);const _=new Float64Array(f*2);if(u=wo.scaleToGeodeticHeight(u,r,t),h=wo.scaleToGeodeticHeight(h,s,t),_.set(u),_.set(h,f),a.position.values=_,f/=3,l(e.offsetAttribute)){let v=new Uint8Array(f*2);if(e.offsetAttribute===Fn.TOP)v=v.fill(1,0,f);else{const D=e.offsetAttribute===Fn.NONE?0:1;v=v.fill(D)}a.applyOffset=new Xe({componentDatatype:oe.UNSIGNED_BYTE,componentsPerAttribute:1,values:v})}let g;const p=c.length,y=At.createTypedArray(_.length/3,(p+o.length)*2);y.set(c);let T=p;for(g=0;g<p;g+=2){const v=c[g],D=c[g+1];y[T++]=v+f,y[T++]=D+f}let b,x;for(g=0;g<o.length;g++)b=o[g],x=b+f,y[T++]=b,y[T++]=x;return{attributes:a,indices:y}}function JE(e){e=A(e,A.EMPTY_OBJECT);const t=e.positions,n=e.width;E.typeOf.object("options.positions",t),E.typeOf.number("options.width",n);const i=A(e.height,0),o=A(e.extrudedHeight,i);this._positions=t,this._ellipsoid=be.clone(A(e.ellipsoid,be.WGS84)),this._width=n,this._height=Math.max(i,o),this._extrudedHeight=Math.min(i,o),this._cornerType=A(e.cornerType,Hr.ROUNDED),this._granularity=A(e.granularity,F.RADIANS_PER_DEGREE),this._offsetAttribute=e.offsetAttribute,this._workerName="createCorridorOutlineGeometry",this.packedLength=1+t.length*d.packedLength+be.packedLength+6}JE.pack=function(e,t,n){E.typeOf.object("value",e),E.typeOf.object("array",t),n=A(n,0);const i=e._positions,o=i.length;t[n++]=o;for(let r=0;r<o;++r,n+=d.packedLength)d.pack(i[r],t,n);return be.pack(e._ellipsoid,t,n),n+=be.packedLength,t[n++]=e._width,t[n++]=e._height,t[n++]=e._extrudedHeight,t[n++]=e._cornerType,t[n++]=e._granularity,t[n]=A(e._offsetAttribute,-1),t};const dre=be.clone(be.UNIT_SPHERE),im={positions:void 0,ellipsoid:dre,width:void 0,height:void 0,extrudedHeight:void 0,cornerType:void 0,granularity:void 0,offsetAttribute:void 0};JE.unpack=function(e,t,n){E.typeOf.object("array",e),t=A(t,0);const i=e[t++],o=new Array(i);for(let _=0;_<i;++_,t+=d.packedLength)o[_]=d.unpack(e,t);const r=be.unpack(e,t,dre);t+=be.packedLength;const s=e[t++],a=e[t++],c=e[t++],u=e[t++],f=e[t++],h=e[t];return l(n)?(n._positions=o,n._ellipsoid=be.clone(r,n._ellipsoid),n._width=s,n._height=a,n._extrudedHeight=c,n._cornerType=u,n._granularity=f,n._offsetAttribute=h===-1?void 0:h,n):(im.positions=o,im.width=s,im.height=a,im.extrudedHeight=c,im.cornerType=u,im.granularity=f,im.offsetAttribute=h===-1?void 0:h,new JE(im))};JE.createGeometry=function(e){let t=e._positions;const n=e._width,i=e._ellipsoid;t=aft(t,i);const o=Ya(t,d.equalsEpsilon);if(o.length<2||n<=0)return;const r=e._height,s=e._extrudedHeight,a=!F.equalsEpsilon(r,s,0,F.EPSILON2),c={ellipsoid:i,positions:o,width:n,cornerType:e._cornerType,granularity:e._granularity,saveAttributes:!1};let u;if(a)c.height=r,c.extrudedHeight=s,c.offsetAttribute=e._offsetAttribute,u=cft(c);else{const _=ao.computePositions(c);if(u=fre(_,c.cornerType),u.attributes.position.values=wo.scaleToGeodeticHeight(u.attributes.position.values,r,i),l(e._offsetAttribute)){const g=u.attributes.position.values.length,p=e._offsetAttribute===Fn.NONE?0:1,y=new Uint8Array(g/3).fill(p);u.attributes.applyOffset=new Xe({componentDatatype:oe.UNSIGNED_BYTE,componentsPerAttribute:1,values:y})}}const f=u.attributes,h=Ae.fromVertices(f.position.values,void 0,3);return new $t({attributes:f,indices:u.indices,primitiveType:dt.LINES,boundingSphere:h,offsetAttribute:e._offsetAttribute})};const lft=new Cr(0);function _n(e){li.call(this,e),this._zIndex=0,this._terrainOffsetProperty=void 0}l(Object.create)&&(_n.prototype=Object.create(li.prototype),_n.prototype.constructor=_n);Object.defineProperties(_n.prototype,{zIndex:{get:function(){return this._zIndex}},terrainOffsetProperty:{get:function(){return this._terrainOffsetProperty}}});_n.prototype._isOnTerrain=function(e,t){return this._fillEnabled&&!l(t.height)&&!l(t.extrudedHeight)&&vs.isSupported(this._scene)};_n.prototype._getIsClosed=function(e){const t=e.height,n=e.extrudedHeight;return t===0||l(n)&&n!==t};_n.prototype._computeCenter=w.throwInstantiationError;_n.prototype._onEntityPropertyChanged=function(e,t,n,i){if(li.prototype._onEntityPropertyChanged.call(this,e,t,n,i),this._observedPropertyNames.indexOf(t)===-1)return;const o=this._entity[this._geometryPropertyName];if(!l(o))return;l(o.zIndex)&&(l(o.height)||l(o.extrudedHeight))&&uo(uo.geometryZIndex),this._zIndex=A(o.zIndex,lft),l(this._terrainOffsetProperty)&&(this._terrainOffsetProperty.destroy(),this._terrainOffsetProperty=void 0);const r=o.heightReference,s=o.extrudedHeightReference;if(l(r)||l(s)){const a=new cy(this._computeCenter.bind(this),!this._dynamic);this._terrainOffsetProperty=new ky(this._scene,a,r,s)}};_n.prototype.destroy=function(){l(this._terrainOffsetProperty)&&(this._terrainOffsetProperty.destroy(),this._terrainOffsetProperty=void 0),li.prototype.destroy.call(this)};_n.getGeometryHeight=function(e,t){if(E.defined("heightReference",t),!l(e)){t!==Ht.NONE&&uo(uo.geometryHeightReference);return}return t!==Ht.CLAMP_TO_GROUND?e:0};_n.getGeometryExtrudedHeight=function(e,t){if(E.defined("extrudedHeightReference",t),!l(e)){t!==Ht.NONE&&uo(uo.geometryExtrudedHeightReference);return}return t!==Ht.CLAMP_TO_GROUND?e:_n.CLAMP_TO_GROUND};_n.CLAMP_TO_GROUND="clamp";_n.computeGeometryOffsetAttribute=function(e,t,n,i){(!l(e)||!l(t))&&(t=Ht.NONE),(!l(n)||!l(i))&&(i=Ht.NONE);let o=0;if(t!==Ht.NONE&&o++,i===Ht.RELATIVE_TO_GROUND&&o++,o===2)return Fn.ALL;if(o===1)return Fn.TOP};const hre=new k,pre=d.ZERO,mre=new d,_re=new Ee;function uft(e){this.id=e,this.vertexFormat=void 0,this.positions=void 0,this.width=void 0,this.cornerType=void 0,this.height=void 0,this.extrudedHeight=void 0,this.granularity=void 0,this.offsetAttribute=void 0}function cf(e,t){_n.call(this,{entity:e,scene:t,geometryOptions:new uft(e),geometryPropertyName:"corridor",observedPropertyNames:["availability","corridor"]}),this._onEntityPropertyChanged(e,"corridor",e.corridor,void 0)}l(Object.create)&&(cf.prototype=Object.create(_n.prototype),cf.prototype.constructor=cf);cf.prototype.createFillGeometryInstance=function(e){if(E.defined("time",e),!this._fillEnabled)throw new w("This instance does not represent a filled geometry.");const t=this._entity,n=t.isAvailable(e),i={show:new pi(n&&t.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),distanceDisplayCondition:Yi.fromDistanceDisplayCondition(this._distanceDisplayConditionProperty.getValue(e)),offset:void 0,color:void 0};if(this._materialProperty instanceof An){let o;l(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(o=this._materialProperty.color.getValue(e,hre)),l(o)||(o=k.WHITE),i.color=Bn.fromColor(o)}return l(this._options.offsetAttribute)&&(i.offset=Ar.fromCartesian3(ie.getValueOrDefault(this._terrainOffsetProperty,e,pre,mre))),new xn({id:t,geometry:new Cf(this._options),attributes:i})};cf.prototype.createOutlineGeometryInstance=function(e){if(E.defined("time",e),!this._outlineEnabled)throw new w("This instance does not represent an outlined geometry.");const t=this._entity,n=t.isAvailable(e),i=ie.getValueOrDefault(this._outlineColorProperty,e,k.BLACK,hre),o={show:new pi(n&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:Bn.fromColor(i),distanceDisplayCondition:Yi.fromDistanceDisplayCondition(this._distanceDisplayConditionProperty.getValue(e)),offset:void 0};return l(this._options.offsetAttribute)&&(o.offset=Ar.fromCartesian3(ie.getValueOrDefault(this._terrainOffsetProperty,e,pre,mre))),new xn({id:t,geometry:new JE(this._options),attributes:o})};cf.prototype._computeCenter=function(e,t){const n=ie.getValueOrUndefined(this._entity.corridor.positions,e);if(!(!l(n)||n.length===0))return d.clone(n[Math.floor(n.length/2)],t)};cf.prototype._isHidden=function(e,t){return!l(t.positions)||!l(t.width)||li.prototype._isHidden.call(this,e,t)};cf.prototype._isDynamic=function(e,t){return!t.positions.isConstant||!ie.isConstant(t.height)||!ie.isConstant(t.extrudedHeight)||!ie.isConstant(t.granularity)||!ie.isConstant(t.width)||!ie.isConstant(t.outlineWidth)||!ie.isConstant(t.cornerType)||!ie.isConstant(t.zIndex)||this._onTerrain&&!ie.isConstant(this._materialProperty)&&!(this._materialProperty instanceof An)};cf.prototype._setStaticOptions=function(e,t){let n=ie.getValueOrUndefined(t.height,wt.MINIMUM_VALUE);const i=ie.getValueOrDefault(t.heightReference,wt.MINIMUM_VALUE,Ht.NONE);let o=ie.getValueOrUndefined(t.extrudedHeight,wt.MINIMUM_VALUE);const r=ie.getValueOrDefault(t.extrudedHeightReference,wt.MINIMUM_VALUE,Ht.NONE);l(o)&&!l(n)&&(n=0);const s=this._options;s.vertexFormat=this._materialProperty instanceof An?kn.VERTEX_FORMAT:Dr.MaterialSupport.TEXTURED.vertexFormat,s.positions=t.positions.getValue(wt.MINIMUM_VALUE,s.positions),s.width=t.width.getValue(wt.MINIMUM_VALUE),s.granularity=ie.getValueOrUndefined(t.granularity,wt.MINIMUM_VALUE),s.cornerType=ie.getValueOrUndefined(t.cornerType,wt.MINIMUM_VALUE),s.offsetAttribute=_n.computeGeometryOffsetAttribute(n,i,o,r),s.height=_n.getGeometryHeight(n,i),o=_n.getGeometryExtrudedHeight(o,r),o===_n.CLAMP_TO_GROUND&&(o=Ro.getMinimumMaximumHeights(Cf.computeRectangle(s,_re)).minimumTerrainHeight),s.extrudedHeight=o};cf.DynamicGeometryUpdater=LA;function LA(e,t,n){Mi.call(this,e,t,n)}l(Object.create)&&(LA.prototype=Object.create(Mi.prototype),LA.prototype.constructor=LA);LA.prototype._isHidden=function(e,t,n){const i=this._options;return!l(i.positions)||!l(i.width)||Mi.prototype._isHidden.call(this,e,t,n)};LA.prototype._setOptions=function(e,t,n){const i=this._options;let o=ie.getValueOrUndefined(t.height,n);const r=ie.getValueOrDefault(t.heightReference,n,Ht.NONE);let s=ie.getValueOrUndefined(t.extrudedHeight,n);const a=ie.getValueOrDefault(t.extrudedHeightReference,n,Ht.NONE);l(s)&&!l(o)&&(o=0),i.positions=ie.getValueOrUndefined(t.positions,n),i.width=ie.getValueOrUndefined(t.width,n),i.granularity=ie.getValueOrUndefined(t.granularity,n),i.cornerType=ie.getValueOrUndefined(t.cornerType,n),i.offsetAttribute=_n.computeGeometryOffsetAttribute(o,r,s,a),i.height=_n.getGeometryHeight(o,r),s=_n.getGeometryExtrudedHeight(s,a),s===_n.CLAMP_TO_GROUND&&(s=Ro.getMinimumMaximumHeights(Cf.computeRectangle(i,_re)).minimumTerrainHeight),i.extrudedHeight=s};function FP(){w.throwInstantiationError()}Object.defineProperties(FP.prototype,{name:{get:w.throwInstantiationError},clock:{get:w.throwInstantiationError},entities:{get:w.throwInstantiationError},isLoading:{get:w.throwInstantiationError},changedEvent:{get:w.throwInstantiationError},errorEvent:{get:w.throwInstantiationError},loadingEvent:{get:w.throwInstantiationError},show:{get:w.throwInstantiationError},clustering:{get:w.throwInstantiationError}});FP.prototype.update=function(e){w.throwInstantiationError()};FP.setLoading=function(e,t){e._isLoading!==t&&(t?e._entityCollection.suspendEvents():e._entityCollection.resumeEvents(),e._isLoading=t,e._loading.raiseEvent(e,t))};function Pi(e,t){if(e=A(e,A.EMPTY_OBJECT),l(e.disableDepthTestDistance)&&e.disableDepthTestDistance<0)throw new w("disableDepthTestDistance must be greater than or equal to 0.0.");let n=e.translucencyByDistance,i=e.scaleByDistance,o=e.distanceDisplayCondition;if(l(n)){if(n.far<=n.near)throw new w("translucencyByDistance.far must be greater than translucencyByDistance.near.");n=tn.clone(n)}if(l(i)){if(i.far<=i.near)throw new w("scaleByDistance.far must be greater than scaleByDistance.near.");i=tn.clone(i)}if(l(o)){if(o.far<=o.near)throw new w("distanceDisplayCondition.far must be greater than distanceDisplayCondition.near.");o=sn.clone(o)}this._show=A(e.show,!0),this._position=d.clone(A(e.position,d.ZERO)),this._actualPosition=d.clone(this._position),this._color=k.clone(A(e.color,k.WHITE)),this._outlineColor=k.clone(A(e.outlineColor,k.TRANSPARENT)),this._outlineWidth=A(e.outlineWidth,0),this._pixelSize=A(e.pixelSize,10),this._scaleByDistance=i,this._translucencyByDistance=n,this._distanceDisplayCondition=o,this._disableDepthTestDistance=A(e.disableDepthTestDistance,0),this._id=e.id,this._collection=A(e.collection,t),this._clusterShow=!0,this._pickId=void 0,this._pointPrimitiveCollection=t,this._dirty=!1,this._index=-1}const yj=Pi.SHOW_INDEX=0,gre=Pi.POSITION_INDEX=1,fft=Pi.COLOR_INDEX=2,dft=Pi.OUTLINE_COLOR_INDEX=3,hft=Pi.OUTLINE_WIDTH_INDEX=4,pft=Pi.PIXEL_SIZE_INDEX=5,mft=Pi.SCALE_BY_DISTANCE_INDEX=6,_ft=Pi.TRANSLUCENCY_BY_DISTANCE_INDEX=7,gft=Pi.DISTANCE_DISPLAY_CONDITION_INDEX=8,yft=Pi.DISABLE_DEPTH_DISTANCE_INDEX=9;Pi.NUMBER_OF_PROPERTIES=10;function ql(e,t){const n=e._pointPrimitiveCollection;l(n)&&(n._updatePointPrimitive(e,t),e._dirty=!0)}Object.defineProperties(Pi.prototype,{show:{get:function(){return this._show},set:function(e){if(!l(e))throw new w("value is required.");this._show!==e&&(this._show=e,ql(this,yj))}},position:{get:function(){return this._position},set:function(e){if(!l(e))throw new w("value is required.");const t=this._position;d.equals(t,e)||(d.clone(e,t),d.clone(e,this._actualPosition),ql(this,gre))}},scaleByDistance:{get:function(){return this._scaleByDistance},set:function(e){if(l(e)&&e.far<=e.near)throw new w("far distance must be greater than near distance.");const t=this._scaleByDistance;tn.equals(t,e)||(this._scaleByDistance=tn.clone(e,t),ql(this,mft))}},translucencyByDistance:{get:function(){return this._translucencyByDistance},set:function(e){if(l(e)&&e.far<=e.near)throw new w("far distance must be greater than near distance.");const t=this._translucencyByDistance;tn.equals(t,e)||(this._translucencyByDistance=tn.clone(e,t),ql(this,_ft))}},pixelSize:{get:function(){return this._pixelSize},set:function(e){if(!l(e))throw new w("value is required.");this._pixelSize!==e&&(this._pixelSize=e,ql(this,pft))}},color:{get:function(){return this._color},set:function(e){if(!l(e))throw new w("value is required.");const t=this._color;k.equals(t,e)||(k.clone(e,t),ql(this,fft))}},outlineColor:{get:function(){return this._outlineColor},set:function(e){if(!l(e))throw new w("value is required.");const t=this._outlineColor;k.equals(t,e)||(k.clone(e,t),ql(this,dft))}},outlineWidth:{get:function(){return this._outlineWidth},set:function(e){if(!l(e))throw new w("value is required.");this._outlineWidth!==e&&(this._outlineWidth=e,ql(this,hft))}},distanceDisplayCondition:{get:function(){return this._distanceDisplayCondition},set:function(e){if(l(e)&&e.far<=e.near)throw new w("far must be greater than near");sn.equals(this._distanceDisplayCondition,e)||(this._distanceDisplayCondition=sn.clone(e,this._distanceDisplayCondition),ql(this,gft))}},disableDepthTestDistance:{get:function(){return this._disableDepthTestDistance},set:function(e){if(this._disableDepthTestDistance!==e){if(!l(e)||e<0)throw new w("disableDepthTestDistance must be greater than or equal to 0.0.");this._disableDepthTestDistance=e,ql(this,yft)}}},id:{get:function(){return this._id},set:function(e){this._id=e,l(this._pickId)&&(this._pickId.object.id=e)}},pickId:{get:function(){return this._pickId}},clusterShow:{get:function(){return this._clusterShow},set:function(e){this._clusterShow!==e&&(this._clusterShow=e,ql(this,yj))}}});Pi.prototype.getPickId=function(e){return l(this._pickId)||(this._pickId=e.createPickId({primitive:this,collection:this._collection,id:this._id})),this._pickId};Pi.prototype._getActualPosition=function(){return this._actualPosition};Pi.prototype._setActualPosition=function(e){d.clone(e,this._actualPosition),ql(this,gre)};const Aj=new ue;Pi._computeActualPosition=function(e,t,n){return t.mode===me.SCENE3D?e:(N.multiplyByPoint(n,e,Aj),es.computeActualWgs84Position(t,Aj))};const Tj=new ue;Pi._computeScreenSpacePosition=function(e,t,n,i){const o=N.multiplyByVector(e,ue.fromElements(t.x,t.y,t.z,1,Tj),Tj);return es.wgs84ToWindowCoordinates(n,o,i)};Pi.prototype.computeScreenSpacePosition=function(e,t){const n=this._pointPrimitiveCollection;if(l(t)||(t=new $),!l(n))throw new w("PointPrimitive must be in a collection.");if(!l(e))throw new w("scene is required.");const i=n.modelMatrix,o=Pi._computeScreenSpacePosition(i,this._actualPosition,e,t);if(l(o))return o.y=e.canvas.clientHeight-o.y,o};Pi.getScreenSpaceBoundingBox=function(e,t,n){const i=e.pixelSize,o=i*.5,r=t.x-o,s=t.y-o,a=i,c=i;return l(n)||(n=new at),n.x=r,n.y=s,n.width=a,n.height=c,n};Pi.prototype.equals=function(e){return this===e||l(e)&&this._id===e._id&&d.equals(this._position,e._position)&&k.equals(this._color,e._color)&&this._pixelSize===e._pixelSize&&this._outlineWidth===e._outlineWidth&&this._show===e._show&&k.equals(this._outlineColor,e._outlineColor)&&tn.equals(this._scaleByDistance,e._scaleByDistance)&&tn.equals(this._translucencyByDistance,e._translucencyByDistance)&&sn.equals(this._distanceDisplayCondition,e._distanceDisplayCondition)&&this._disableDepthTestDistance===e._disableDepthTestDistance};Pi.prototype._destroy=function(){this._pickId=this._pickId&&this._pickId.destroy(),this._pointPrimitiveCollection=void 0};const Aft=Pi.SHOW_INDEX,y2=Pi.POSITION_INDEX,yre=Pi.COLOR_INDEX,Tft=Pi.OUTLINE_COLOR_INDEX,Cft=Pi.OUTLINE_WIDTH_INDEX,bft=Pi.PIXEL_SIZE_INDEX,Are=Pi.SCALE_BY_DISTANCE_INDEX,Tre=Pi.TRANSLUCENCY_BY_DISTANCE_INDEX,Cre=Pi.DISTANCE_DISPLAY_CONDITION_INDEX,Eft=Pi.DISABLE_DEPTH_DISTANCE_INDEX,WU=Pi.NUMBER_OF_PROPERTIES,La={positionHighAndSize:0,positionLowAndOutline:1,compressedAttribute0:2,compressedAttribute1:3,scaleByDistance:4,distanceDisplayConditionAndDisableDepth:5};function vl(e){e=A(e,A.EMPTY_OBJECT),this._sp=void 0,this._spTranslucent=void 0,this._rsOpaque=void 0,this._rsTranslucent=void 0,this._vaf=void 0,this._pointPrimitives=[],this._pointPrimitivesToUpdate=[],this._pointPrimitivesToUpdateIndex=0,this._pointPrimitivesRemoved=!1,this._createVertexArray=!1,this._shaderScaleByDistance=!1,this._compiledShaderScaleByDistance=!1,this._shaderTranslucencyByDistance=!1,this._compiledShaderTranslucencyByDistance=!1,this._shaderDistanceDisplayCondition=!1,this._compiledShaderDistanceDisplayCondition=!1,this._shaderDisableDepthDistance=!1,this._compiledShaderDisableDepthDistance=!1,this._propertiesChanged=new Uint32Array(WU),this._maxPixelSize=1,this._baseVolume=new Ae,this._baseVolumeWC=new Ae,this._baseVolume2D=new Ae,this._boundingVolume=new Ae,this._boundingVolumeDirty=!1,this._colorCommands=[],this.show=A(e.show,!0),this.modelMatrix=N.clone(A(e.modelMatrix,N.IDENTITY)),this._modelMatrix=N.clone(N.IDENTITY),this.debugShowBoundingVolume=A(e.debugShowBoundingVolume,!1),this.blendOption=A(e.blendOption,Sr.OPAQUE_AND_TRANSLUCENT),this._blendOption=void 0,this._mode=me.SCENE3D,this._maxTotalPointSize=1,this._buffersUsage=[mt.STATIC_DRAW,mt.STATIC_DRAW,mt.STATIC_DRAW,mt.STATIC_DRAW,mt.STATIC_DRAW,mt.STATIC_DRAW,mt.STATIC_DRAW,mt.STATIC_DRAW,mt.STATIC_DRAW];const t=this;this._uniforms={u_maxTotalPointSize:function(){return t._maxTotalPointSize}}}Object.defineProperties(vl.prototype,{length:{get:function(){return qU(this),this._pointPrimitives.length}}});function bre(e){const t=e.length;for(let n=0;n<t;++n)e[n]&&e[n]._destroy()}vl.prototype.add=function(e){const t=new Pi(e,this);return t._index=this._pointPrimitives.length,this._pointPrimitives.push(t),this._createVertexArray=!0,t};vl.prototype.remove=function(e){return this.contains(e)?(this._pointPrimitives[e._index]=null,this._pointPrimitivesRemoved=!0,this._createVertexArray=!0,e._destroy(),!0):!1};vl.prototype.removeAll=function(){bre(this._pointPrimitives),this._pointPrimitives=[],this._pointPrimitivesToUpdate=[],this._pointPrimitivesToUpdateIndex=0,this._pointPrimitivesRemoved=!1,this._createVertexArray=!0};function qU(e){if(e._pointPrimitivesRemoved){e._pointPrimitivesRemoved=!1;const t=[],n=e._pointPrimitives,i=n.length;for(let o=0,r=0;o<i;++o){const s=n[o];s&&(s._index=r++,t.push(s))}e._pointPrimitives=t}}vl.prototype._updatePointPrimitive=function(e,t){e._dirty||(this._pointPrimitivesToUpdate[this._pointPrimitivesToUpdateIndex++]=e),++this._propertiesChanged[t]};vl.prototype.contains=function(e){return l(e)&&e._pointPrimitiveCollection===this};vl.prototype.get=function(e){if(!l(e))throw new w("index is required.");return qU(this),this._pointPrimitives[e]};vl.prototype.computeNewBuffersUsage=function(){const e=this._buffersUsage;let t=!1;const n=this._propertiesChanged;for(let i=0;i<WU;++i){const o=n[i]===0?mt.STATIC_DRAW:mt.STREAM_DRAW;t=t||e[i]!==o,e[i]=o}return t};function xft(e,t,n){return new ds(e,[{index:La.positionHighAndSize,componentsPerAttribute:4,componentDatatype:oe.FLOAT,usage:n[y2]},{index:La.positionLowAndShow,componentsPerAttribute:4,componentDatatype:oe.FLOAT,usage:n[y2]},{index:La.compressedAttribute0,componentsPerAttribute:4,componentDatatype:oe.FLOAT,usage:n[yre]},{index:La.compressedAttribute1,componentsPerAttribute:4,componentDatatype:oe.FLOAT,usage:n[Tre]},{index:La.scaleByDistance,componentsPerAttribute:4,componentDatatype:oe.FLOAT,usage:n[Are]},{index:La.distanceDisplayConditionAndDisableDepth,componentsPerAttribute:3,componentDatatype:oe.FLOAT,usage:n[Cre]}],t)}const xN=new Zn;function Ere(e,t,n,i){const o=i._index,r=i._getActualPosition();e._mode===me.SCENE3D&&(Ae.expand(e._baseVolume,r,e._baseVolume),e._boundingVolumeDirty=!0),Zn.fromCartesian(r,xN);const s=i.pixelSize,a=i.outlineWidth;e._maxPixelSize=Math.max(e._maxPixelSize,s+a);const c=n[La.positionHighAndSize],u=xN.high;c(o,u.x,u.y,u.z,s);const f=n[La.positionLowAndOutline],h=xN.low;f(o,h.x,h.y,h.z,a)}const Hv=65536,Sb=256;function xre(e,t,n,i){const o=i._index,r=i.color,s=i.getPickId(t).color,a=i.outlineColor;let c=k.floatToByte(r.red),u=k.floatToByte(r.green),f=k.floatToByte(r.blue);const h=c*Hv+u*Sb+f;c=k.floatToByte(a.red),u=k.floatToByte(a.green),f=k.floatToByte(a.blue);const _=c*Hv+u*Sb+f;c=k.floatToByte(s.red),u=k.floatToByte(s.green),f=k.floatToByte(s.blue);const g=c*Hv+u*Sb+f,p=k.floatToByte(r.alpha)*Hv+k.floatToByte(a.alpha)*Sb+k.floatToByte(s.alpha),y=n[La.compressedAttribute0];y(o,h,_,g,p)}function wre(e,t,n,i){const o=i._index;let r=0,s=1,a=1,c=1;const u=i.translucencyByDistance;l(u)&&(r=u.near,s=u.nearValue,a=u.far,c=u.farValue,(s!==1||c!==1)&&(e._shaderTranslucencyByDistance=!0));let f=i.show&&i.clusterShow;i.color.alpha===0&&i.outlineColor.alpha===0&&(f=!1),s=F.clamp(s,0,1),s=s===1?255:s*255|0;const h=(f?1:0)*Sb+s;c=F.clamp(c,0,1),c=c===1?255:c*255|0;const _=c,g=n[La.compressedAttribute1];g(o,h,_,r,a)}function Sre(e,t,n,i){const o=i._index,r=n[La.scaleByDistance];let s=0,a=1,c=1,u=1;const f=i.scaleByDistance;l(f)&&(s=f.near,a=f.nearValue,c=f.far,u=f.farValue,(a!==1||u!==1)&&(e._shaderScaleByDistance=!0)),r(o,s,a,c,u)}function vre(e,t,n,i){const o=i._index,r=n[La.distanceDisplayConditionAndDisableDepth];let s=0,a=Number.MAX_VALUE;const c=i.distanceDisplayCondition;l(c)&&(s=c.near,a=c.far,s*=s,a*=a,e._shaderDistanceDisplayCondition=!0);let u=i.disableDepthTestDistance;u*=u,u>0&&(e._shaderDisableDepthDistance=!0,u===Number.POSITIVE_INFINITY&&(u=-1)),r(o,s,a,u)}function wft(e,t,n,i){Ere(e,t,n,i),xre(e,t,n,i),wre(e,t,n,i),Sre(e,t,n,i),vre(e,t,n,i)}function wN(e,t,n,i,o,r){let s;i.mode===me.SCENE3D?(s=e._baseVolume,e._boundingVolumeDirty=!0):s=e._baseVolume2D;const a=[];for(let c=0;c<n;++c){const u=t[c],f=u.position,h=Pi._computeActualPosition(f,i,o);l(h)&&(u._setActualPosition(h),r?a.push(h):Ae.expand(s,h,s))}r&&Ae.fromPoints(a,s)}function Sft(e,t){const n=t.mode,i=e._pointPrimitives,o=e._pointPrimitivesToUpdate,r=e._modelMatrix;e._createVertexArray||e._mode!==n||n!==me.SCENE3D&&!N.equals(r,e.modelMatrix)?(e._mode=n,N.clone(e.modelMatrix,r),e._createVertexArray=!0,(n===me.SCENE3D||n===me.SCENE2D||n===me.COLUMBUS_VIEW)&&wN(e,i,i.length,t,r,!0)):n===me.MORPHING?wN(e,i,i.length,t,r,!0):(n===me.SCENE2D||n===me.COLUMBUS_VIEW)&&wN(e,o,e._pointPrimitivesToUpdateIndex,t,r,!1)}function vft(e,t,n){const o=t.camera.getPixelSize(n,t.context.drawingBufferWidth,t.context.drawingBufferHeight)*e._maxPixelSize;n.radius+=o}const Dft=[];vl.prototype.update=function(e){if(qU(this),!this.show)return;this._maxTotalPointSize=Gt.maximumAliasedPointSize,Sft(this,e);const n=this._pointPrimitives.length,i=this._pointPrimitivesToUpdate,o=this._pointPrimitivesToUpdateIndex,r=this._propertiesChanged,s=this._createVertexArray;let a;const c=e.context,u=e.passes,f=u.pick;if(s||!f&&this.computeNewBuffersUsage()){this._createVertexArray=!1;for(let L=0;L<WU;++L)r[L]=0;if(this._vaf=this._vaf&&this._vaf.destroy(),n>0){this._vaf=xft(c,n,this._buffersUsage),a=this._vaf.writers;for(let L=0;L<n;++L){const B=this._pointPrimitives[L];B._dirty=!1,wft(this,c,a,B)}this._vaf.commit()}this._pointPrimitivesToUpdateIndex=0}else if(o>0){const L=Dft;L.length=0,(r[y2]||r[Cft]||r[bft])&&L.push(Ere),(r[yre]||r[Tft])&&L.push(xre),(r[Aft]||r[Tre])&&L.push(wre),r[Are]&&L.push(Sre),(r[Cre]||r[Eft])&&L.push(vre);const B=L.length;if(a=this._vaf.writers,o/n>.1){for(let V=0;V<o;++V){const M=i[V];M._dirty=!1;for(let H=0;H<B;++H)L[H](this,c,a,M)}this._vaf.commit()}else{for(let V=0;V<o;++V){const M=i[V];M._dirty=!1;for(let H=0;H<B;++H)L[H](this,c,a,M);this._vaf.subCommit(M._index,1)}this._vaf.endSubCommits()}this._pointPrimitivesToUpdateIndex=0}if(o>n*1.5&&(i.length=n),!l(this._vaf)||!l(this._vaf.va))return;this._boundingVolumeDirty&&(this._boundingVolumeDirty=!1,Ae.transform(this._baseVolume,this.modelMatrix,this._baseVolumeWC));let h,_=N.IDENTITY;e.mode===me.SCENE3D?(_=this.modelMatrix,h=Ae.clone(this._baseVolumeWC,this._boundingVolume)):h=Ae.clone(this._baseVolume2D,this._boundingVolume),vft(this,e,h);const g=this._blendOption!==this.blendOption;this._blendOption=this.blendOption,g&&(this._blendOption===Sr.OPAQUE||this._blendOption===Sr.OPAQUE_AND_TRANSLUCENT?this._rsOpaque=ht.fromCache({depthTest:{enabled:!0,func:fe.LEQUAL},depthMask:!0}):this._rsOpaque=void 0,this._blendOption===Sr.TRANSLUCENT||this._blendOption===Sr.OPAQUE_AND_TRANSLUCENT?this._rsTranslucent=ht.fromCache({depthTest:{enabled:!0,func:fe.LEQUAL},depthMask:!1,blending:fo.ALPHA_BLEND}):this._rsTranslucent=void 0),this._shaderDisableDepthDistance=this._shaderDisableDepthDistance||e.minimumDisableDepthTestDistance!==0;let p,y;(g||this._shaderScaleByDistance&&!this._compiledShaderScaleByDistance||this._shaderTranslucencyByDistance&&!this._compiledShaderTranslucencyByDistance||this._shaderDistanceDisplayCondition&&!this._compiledShaderDistanceDisplayCondition||this._shaderDisableDepthDistance!==this._compiledShaderDisableDepthDistance)&&(p=new nt({sources:[FOe]}),this._shaderScaleByDistance&&p.defines.push("EYE_DISTANCE_SCALING"),this._shaderTranslucencyByDistance&&p.defines.push("EYE_DISTANCE_TRANSLUCENCY"),this._shaderDistanceDisplayCondition&&p.defines.push("DISTANCE_DISPLAY_CONDITION"),this._shaderDisableDepthDistance&&p.defines.push("DISABLE_DEPTH_DISTANCE"),this._blendOption===Sr.OPAQUE_AND_TRANSLUCENT&&(y=new nt({defines:["OPAQUE"],sources:[SS]}),this._sp=Hn.replaceCache({context:c,shaderProgram:this._sp,vertexShaderSource:p,fragmentShaderSource:y,attributeLocations:La}),y=new nt({defines:["TRANSLUCENT"],sources:[SS]}),this._spTranslucent=Hn.replaceCache({context:c,shaderProgram:this._spTranslucent,vertexShaderSource:p,fragmentShaderSource:y,attributeLocations:La})),this._blendOption===Sr.OPAQUE&&(y=new nt({sources:[SS]}),this._sp=Hn.replaceCache({context:c,shaderProgram:this._sp,vertexShaderSource:p,fragmentShaderSource:y,attributeLocations:La})),this._blendOption===Sr.TRANSLUCENT&&(y=new nt({sources:[SS]}),this._spTranslucent=Hn.replaceCache({context:c,shaderProgram:this._spTranslucent,vertexShaderSource:p,fragmentShaderSource:y,attributeLocations:La})),this._compiledShaderScaleByDistance=this._shaderScaleByDistance,this._compiledShaderTranslucencyByDistance=this._shaderTranslucencyByDistance,this._compiledShaderDistanceDisplayCondition=this._shaderDistanceDisplayCondition,this._compiledShaderDisableDepthDistance=this._shaderDisableDepthDistance);let T,b,x,v;const D=e.commandList;if(u.render||f){const L=this._colorCommands,B=this._blendOption===Sr.OPAQUE,V=this._blendOption===Sr.OPAQUE_AND_TRANSLUCENT;T=this._vaf.va,b=T.length,L.length=b;const M=V?b*2:b;for(v=0;v<M;++v){const H=B||V&&v%2===0;x=L[v],l(x)||(x=L[v]=new Dt),x.primitiveType=dt.POINTS,x.pass=H||!V?We.OPAQUE:We.TRANSLUCENT,x.owner=this;const G=V?Math.floor(v/2):v;x.boundingVolume=h,x.modelMatrix=_,x.shaderProgram=H?this._sp:this._spTranslucent,x.uniformMap=this._uniforms,x.vertexArray=T[G].va,x.renderState=H?this._rsOpaque:this._rsTranslucent,x.debugShowBoundingVolume=this.debugShowBoundingVolume,x.pickId="v_pickColor",D.push(x)}}};vl.prototype.isDestroyed=function(){return!1};vl.prototype.destroy=function(){return this._sp=this._sp&&this._sp.destroy(),this._spTranslucent=this._spTranslucent&&this._spTranslucent.destroy(),this._spPick=this._spPick&&this._spPick.destroy(),this._vaf=this._vaf&&this._vaf.destroy(),bre(this._pointPrimitives),Je(this)};function A2(e,t,n,i,o,r){if(o-i<=n)return;const s=i+o>>1;Dre(e,t,s,i,o,r%2),A2(e,t,n,i,s-1,r+1),A2(e,t,n,s+1,o,r+1)}function Dre(e,t,n,i,o,r){for(;o>i;){if(o-i>600){const u=o-i+1,f=n-i+1,h=Math.log(u),_=.5*Math.exp(2*h/3),g=.5*Math.sqrt(h*_*(u-_)/u)*(f-u/2<0?-1:1),p=Math.max(i,Math.floor(n-f*_/u+g)),y=Math.min(o,Math.floor(n+(u-f)*_/u+g));Dre(e,t,n,p,y,r)}const s=t[2*n+r];let a=i,c=o;for(nb(e,t,i,n),t[2*o+r]>s&&nb(e,t,i,o);a<c;){for(nb(e,t,a,c),a++,c--;t[2*a+r]<s;)a++;for(;t[2*c+r]>s;)c--}t[2*i+r]===s?nb(e,t,i,c):(c++,nb(e,t,c,o)),c<=n&&(i=c+1),n<=c&&(o=c-1)}}function nb(e,t,n,i){SN(e,n,i),SN(t,2*n,2*i),SN(t,2*n+1,2*i+1)}function SN(e,t,n){const i=e[t];e[t]=e[n],e[n]=i}function Ift(e,t,n,i,o,r,s){const a=[0,e.length-1,0],c=[];let u,f;for(;a.length;){const h=a.pop(),_=a.pop(),g=a.pop();if(_-g<=s){for(let T=g;T<=_;T++)u=t[2*T],f=t[2*T+1],u>=n&&u<=o&&f>=i&&f<=r&&c.push(e[T]);continue}const p=Math.floor((g+_)/2);u=t[2*p],f=t[2*p+1],u>=n&&u<=o&&f>=i&&f<=r&&c.push(e[p]);const y=(h+1)%2;(h===0?n<=u:i<=f)&&(a.push(g),a.push(p-1),a.push(y)),(h===0?o>=u:r>=f)&&(a.push(p+1),a.push(_),a.push(y))}return c}function Pft(e,t,n,i,o,r){const s=[0,e.length-1,0],a=[],c=o*o;for(;s.length;){const u=s.pop(),f=s.pop(),h=s.pop();if(f-h<=r){for(let T=h;T<=f;T++)Cj(t[2*T],t[2*T+1],n,i)<=c&&a.push(e[T]);continue}const _=Math.floor((h+f)/2),g=t[2*_],p=t[2*_+1];Cj(g,p,n,i)<=c&&a.push(e[_]);const y=(u+1)%2;(u===0?n-o<=g:i-o<=p)&&(s.push(h),s.push(_-1),s.push(y)),(u===0?n+o>=g:i+o>=p)&&(s.push(_+1),s.push(f),s.push(y))}return a}function Cj(e,t,n,i){const o=e-n,r=t-i;return o*o+r*r}const Oft=e=>e[0],Lft=e=>e[1];class Bft{constructor(t,n=Oft,i=Lft,o=64,r=Float64Array){this.nodeSize=o,this.points=t;const s=t.length<65536?Uint16Array:Uint32Array,a=this.ids=new s(t.length),c=this.coords=new r(t.length*2);for(let u=0;u<t.length;u++)a[u]=u,c[2*u]=n(t[u]),c[2*u+1]=i(t[u]);A2(a,c,o,0,a.length-1,0)}range(t,n,i,o){return Ift(this.ids,this.coords,t,n,i,o,this.nodeSize)}within(t,n,i){return Pft(this.ids,this.coords,t,n,i,this.nodeSize)}}function Bf(e){e=A(e,A.EMPTY_OBJECT),this._enabled=A(e.enabled,!1),this._pixelRange=A(e.pixelRange,80),this._minimumClusterSize=A(e.minimumClusterSize,2),this._clusterBillboards=A(e.clusterBillboards,!0),this._clusterLabels=A(e.clusterLabels,!0),this._clusterPoints=A(e.clusterPoints,!0),this._labelCollection=void 0,this._billboardCollection=void 0,this._pointCollection=void 0,this._clusterBillboardCollection=void 0,this._clusterLabelCollection=void 0,this._clusterPointCollection=void 0,this._collectionIndicesByEntity={},this._unusedLabelIndices=[],this._unusedBillboardIndices=[],this._unusedPointIndices=[],this._previousClusters=[],this._previousHeight=void 0,this._enabledDirty=!1,this._clusterDirty=!1,this._cluster=void 0,this._removeEventListener=void 0,this._clusterEvent=new lt,this.show=A(e.show,!0)}function Rft(e){return e.coord.x}function Nft(e){return e.coord.y}function bj(e,t){e.x-=t,e.y-=t,e.width+=t*2,e.height+=t*2}const Mft=new at;function Ej(e,t,n,i,o){if(l(e._labelCollection)&&i._clusterLabels?o=Af.getScreenSpaceBoundingBox(e,t,o):l(e._billboardCollection)&&i._clusterBillboards?o=en.getScreenSpaceBoundingBox(e,t,o):l(e._pointPrimitiveCollection)&&i._clusterPoints&&(o=Pi.getScreenSpaceBoundingBox(e,t,o)),bj(o,n),i._clusterLabels&&!l(e._labelCollection)&&l(e.id)&&Ire(i,e.id.id)&&l(e.id._label)){const r=i._collectionIndicesByEntity[e.id.id].labelIndex,s=i._labelCollection.get(r),a=Af.getScreenSpaceBoundingBox(s,t,Mft);bj(a,n),o=at.union(o,a,o)}return o}function Fft(e,t){if(e.clusterShow=!0,!l(e._labelCollection)&&l(e.id)&&Ire(t,e.id.id)&&l(e.id._label)){const n=t._collectionIndicesByEntity[e.id.id].labelIndex,i=t._labelCollection.get(n);i.clusterShow=!0}}function xj(e,t,n,i){const o={billboard:i._clusterBillboardCollection.add(),label:i._clusterLabelCollection.add(),point:i._clusterPointCollection.add()};o.billboard.show=!1,o.point.show=!1,o.label.show=!0,o.label.text=t.toLocaleString(),o.label.id=n,o.billboard.position=o.label.position=o.point.position=e,i._clusterEvent.raiseEvent(n,o)}function Ire(e,t){return l(e)&&l(e._collectionIndicesByEntity[t])&&l(e._collectionIndicesByEntity[t].labelIndex)}function vN(e,t,n,i,o){if(!l(e))return;const r=e.length;for(let s=0;s<r;++s){const a=e.get(s);if(a.clusterShow=!1,!a.show||o._scene.mode===me.SCENE3D&&!i.isPointVisible(a.position))continue;const c=o._clusterLabels&&l(a._labelCollection),u=o._clusterBillboards&&l(a.id._billboard),f=o._clusterPoints&&l(a.id._point);if(c&&(f||u))continue;const h=a.computeScreenSpacePosition(n);l(h)&&t.push({index:s,collection:e,clustered:!1,coord:h})}}const zft=new at,Uft=new at,Hft=new at;function Vft(e){return function(t){if(l(t)&&t<.05||!e.enabled)return;const n=e._scene,i=e._labelCollection,o=e._billboardCollection,r=e._pointCollection;if(!l(i)&&!l(o)&&!l(r)||!e._clusterBillboards&&!e._clusterLabels&&!e._clusterPoints)return;let s=e._clusterLabelCollection,a=e._clusterBillboardCollection,c=e._clusterPointCollection;l(s)?s.removeAll():s=e._clusterLabelCollection=new Sl({scene:n}),l(a)?a.removeAll():a=e._clusterBillboardCollection=new Ka({scene:n}),l(c)?c.removeAll():c=e._clusterPointCollection=new vl;const u=e._pixelRange,f=e._minimumClusterSize,h=e._previousClusters,_=[],g=e._previousHeight,p=n.camera.positionCartographic.height,y=n.mapProjection.ellipsoid,T=n.camera.positionWC,b=new Eu(y,T),x=[];e._clusterLabels&&vN(i,x,n,b,e),e._clusterBillboards&&vN(o,x,n,b,e),e._clusterPoints&&vN(r,x,n,b,e);let v,D,L,B,V,M,H,G,I,O,m,P;const R=new Bft(x,Rft,Nft,64,Int32Array);if(p<g)for(L=h.length,v=0;v<L;++v){const U=h[v];if(!b.isPointVisible(U.position))continue;const W=en._computeScreenSpacePosition(N.IDENTITY,U.position,d.ZERO,$.ZERO,n);if(!l(W))continue;const q=1-p/g;let Y=U.width=U.width*q,j=U.height=U.height*q;Y=Math.max(Y,U.minimumWidth),j=Math.max(j,U.minimumHeight);const ee=W.x-Y*.5,K=W.y-j*.5,se=W.x+Y,Q=W.y+j;for(V=R.range(ee,K,se,Q),M=V.length,O=0,I=[],D=0;D<M;++D)H=V[D],G=x[H],G.clustered||(++O,m=G.collection,P=G.index,I.push(m.get(P).id));if(O>=f)for(xj(U.position,O,I,e),_.push(U),D=0;D<M;++D)x[V[D]].clustered=!0}for(L=x.length,v=0;v<L;++v){const U=x[v];if(U.clustered)continue;U.clustered=!0,m=U.collection,P=U.index;const W=m.get(P);B=Ej(W,U.coord,u,e,zft);const q=at.clone(B,Uft);V=R.range(B.x,B.y,B.x+B.width,B.y+B.height),M=V.length;const Y=d.clone(W.position);for(O=1,I=[W.id],D=0;D<M;++D)if(H=V[D],G=x[H],!G.clustered){const j=G.collection.get(G.index),ee=Ej(j,G.coord,u,e,Hft);d.add(j.position,Y,Y),at.union(q,ee,q),++O,I.push(j.id)}if(O>=f){const j=d.multiplyByScalar(Y,1/O,Y);for(xj(j,O,I,e),_.push({position:j,width:q.width,height:q.height,minimumWidth:B.width,minimumHeight:B.height}),D=0;D<M;++D)x[V[D]].clustered=!0}else Fft(W,e)}s.length===0&&(s.destroy(),e._clusterLabelCollection=void 0),a.length===0&&(a.destroy(),e._clusterBillboardCollection=void 0),c.length===0&&(c.destroy(),e._clusterPointCollection=void 0),e._previousClusters=_,e._previousHeight=p}}Bf.prototype._initialize=function(e){this._scene=e;const t=Vft(this);this._cluster=t,this._removeEventListener=e.camera.changed.addEventListener(t)};Object.defineProperties(Bf.prototype,{enabled:{get:function(){return this._enabled},set:function(e){this._enabledDirty=e!==this._enabled,this._enabled=e}},pixelRange:{get:function(){return this._pixelRange},set:function(e){this._clusterDirty=this._clusterDirty||e!==this._pixelRange,this._pixelRange=e}},minimumClusterSize:{get:function(){return this._minimumClusterSize},set:function(e){this._clusterDirty=this._clusterDirty||e!==this._minimumClusterSize,this._minimumClusterSize=e}},clusterEvent:{get:function(){return this._clusterEvent}},clusterBillboards:{get:function(){return this._clusterBillboards},set:function(e){this._clusterDirty=this._clusterDirty||e!==this._clusterBillboards,this._clusterBillboards=e}},clusterLabels:{get:function(){return this._clusterLabels},set:function(e){this._clusterDirty=this._clusterDirty||e!==this._clusterLabels,this._clusterLabels=e}},clusterPoints:{get:function(){return this._clusterPoints},set:function(e){this._clusterDirty=this._clusterDirty||e!==this._clusterPoints,this._clusterPoints=e}}});function jU(e,t,n,i){return function(o){let r=this[e];l(this._collectionIndicesByEntity)||(this._collectionIndicesByEntity={});let s=this._collectionIndicesByEntity[o.id];if(l(s)||(s=this._collectionIndicesByEntity[o.id]={billboardIndex:void 0,labelIndex:void 0,pointIndex:void 0}),l(r)&&l(s[i]))return r.get(s[i]);l(r)||(r=this[e]=new t({scene:this._scene}));let a,c;const u=this[n];u.length>0?(a=u.pop(),c=r.get(a)):(c=r.add(),a=r.length-1),s[i]=a;const f=this;return Promise.resolve().then(function(){f._clusterDirty=!0}),c}}function YU(e,t){const n=e._collectionIndicesByEntity[t];!l(n.billboardIndex)&&!l(n.labelIndex)&&!l(n.pointIndex)&&delete e._collectionIndicesByEntity[t]}Bf.prototype.getLabel=jU("_labelCollection",Sl,"_unusedLabelIndices","labelIndex");Bf.prototype.removeLabel=function(e){const t=this._collectionIndicesByEntity&&this._collectionIndicesByEntity[e.id];if(!l(this._labelCollection)||!l(t)||!l(t.labelIndex))return;const n=t.labelIndex;t.labelIndex=void 0,YU(this,e.id);const i=this._labelCollection.get(n);i.show=!1,i.text="",i.id=void 0,this._unusedLabelIndices.push(n),this._clusterDirty=!0};Bf.prototype.getBillboard=jU("_billboardCollection",Ka,"_unusedBillboardIndices","billboardIndex");Bf.prototype.removeBillboard=function(e){const t=this._collectionIndicesByEntity&&this._collectionIndicesByEntity[e.id];if(!l(this._billboardCollection)||!l(t)||!l(t.billboardIndex))return;const n=t.billboardIndex;t.billboardIndex=void 0,YU(this,e.id);const i=this._billboardCollection.get(n);i.id=void 0,i.show=!1,i.image=void 0,this._unusedBillboardIndices.push(n),this._clusterDirty=!0};Bf.prototype.getPoint=jU("_pointCollection",vl,"_unusedPointIndices","pointIndex");Bf.prototype.removePoint=function(e){const t=this._collectionIndicesByEntity&&this._collectionIndicesByEntity[e.id];if(!l(this._pointCollection)||!l(t)||!l(t.pointIndex))return;const n=t.pointIndex;t.pointIndex=void 0,YU(this,e.id);const i=this._pointCollection.get(n);i.show=!1,i.id=void 0,this._unusedPointIndices.push(n),this._clusterDirty=!0};function DN(e){if(!l(e))return;const t=e.length;for(let n=0;n<t;++n)e.get(n).clusterShow=!0}function kft(e){e.enabled||(l(e._clusterLabelCollection)&&e._clusterLabelCollection.destroy(),l(e._clusterBillboardCollection)&&e._clusterBillboardCollection.destroy(),l(e._clusterPointCollection)&&e._clusterPointCollection.destroy(),e._clusterLabelCollection=void 0,e._clusterBillboardCollection=void 0,e._clusterPointCollection=void 0,DN(e._labelCollection),DN(e._billboardCollection),DN(e._pointCollection))}Bf.prototype.update=function(e){if(!this.show)return;let t;l(this._labelCollection)&&this._labelCollection.length>0&&this._labelCollection.get(0)._glyphs.length===0&&(t=e.commandList,e.commandList=[],this._labelCollection.update(e),e.commandList=t),l(this._billboardCollection)&&this._billboardCollection.length>0&&!l(this._billboardCollection.get(0).width)&&(t=e.commandList,e.commandList=[],this._billboardCollection.update(e),e.commandList=t),this._enabledDirty&&(this._enabledDirty=!1,kft(this),this._clusterDirty=!0),this._clusterDirty&&(this._clusterDirty=!1,this._cluster()),l(this._clusterLabelCollection)&&this._clusterLabelCollection.update(e),l(this._clusterBillboardCollection)&&this._clusterBillboardCollection.update(e),l(this._clusterPointCollection)&&this._clusterPointCollection.update(e),l(this._labelCollection)&&this._labelCollection.update(e),l(this._billboardCollection)&&this._billboardCollection.update(e),l(this._pointCollection)&&this._pointCollection.update(e)};Bf.prototype.destroy=function(){this._labelCollection=this._labelCollection&&this._labelCollection.destroy(),this._billboardCollection=this._billboardCollection&&this._billboardCollection.destroy(),this._pointCollection=this._pointCollection&&this._pointCollection.destroy(),this._clusterLabelCollection=this._clusterLabelCollection&&this._clusterLabelCollection.destroy(),this._clusterBillboardCollection=this._clusterBillboardCollection&&this._clusterBillboardCollection.destroy(),this._clusterPointCollection=this._clusterPointCollection&&this._clusterPointCollection.destroy(),l(this._removeEventListener)&&(this._removeEventListener(),this._removeEventListener=void 0),this._labelCollection=void 0,this._billboardCollection=void 0,this._pointCollection=void 0,this._clusterBillboardCollection=void 0,this._clusterLabelCollection=void 0,this._clusterPointCollection=void 0,this._collectionIndicesByEntity=void 0,this._unusedLabelIndices=[],this._unusedBillboardIndices=[],this._unusedPointIndices=[],this._previousClusters=[],this._previousHeight=void 0,this._enabledDirty=!1,this._pixelRangeDirty=!1,this._minimumClusterSizeDirty=!1};function $U(e){this._name=e,this._clock=void 0,this._changed=new lt,this._error=new lt,this._isLoading=!1,this._loading=new lt,this._entityCollection=new Ja(this),this._entityCluster=new Bf}Object.defineProperties($U.prototype,{name:{get:function(){return this._name},set:function(e){this._name!==e&&(this._name=e,this._changed.raiseEvent(this))}},clock:{get:function(){return this._clock},set:function(e){this._clock!==e&&(this._clock=e,this._changed.raiseEvent(this))}},entities:{get:function(){return this._entityCollection}},isLoading:{get:function(){return this._isLoading},set:function(e){FP.setLoading(this,e)}},changedEvent:{get:function(){return this._changed}},errorEvent:{get:function(){return this._error}},loadingEvent:{get:function(){return this._loading}},show:{get:function(){return this._entityCollection.show},set:function(e){this._entityCollection.show=e}},clustering:{get:function(){return this._entityCluster},set:function(e){if(!l(e))throw new w("value must be defined.");this._entityCluster=e}}});$U.prototype.update=function(e){return!0};const Pre={};Pre.computePositions=function(e,t,n,i,o){const r=e*.5,s=-r,a=i+i,c=o?2*a:a,u=new Float64Array(c*3);let f,h=0,_=0;const g=o?a*3:0,p=o?(a+i)*3:i*3;for(f=0;f<i;f++){const y=f/i*F.TWO_PI,T=Math.cos(y),b=Math.sin(y),x=T*n,v=b*n,D=T*t,L=b*t;u[_+g]=x,u[_+g+1]=v,u[_+g+2]=s,u[_+p]=D,u[_+p+1]=L,u[_+p+2]=r,_+=3,o&&(u[h++]=x,u[h++]=v,u[h++]=s,u[h++]=D,u[h++]=L,u[h++]=r)}return u};const Ore=Pre,IN=new $,Gft=new d,Wft=new d,qft=new d,jft=new d;function qh(e){e=A(e,A.EMPTY_OBJECT);const t=e.length,n=e.topRadius,i=e.bottomRadius,o=A(e.vertexFormat,Ye.DEFAULT),r=A(e.slices,128);if(!l(t))throw new w("options.length must be defined.");if(!l(n))throw new w("options.topRadius must be defined.");if(!l(i))throw new w("options.bottomRadius must be defined.");if(r<3)throw new w("options.slices must be greater than or equal to 3.");if(l(e.offsetAttribute)&&e.offsetAttribute===Fn.TOP)throw new w("GeometryOffsetAttribute.TOP is not a supported options.offsetAttribute for this geometry.");this._length=t,this._topRadius=n,this._bottomRadius=i,this._vertexFormat=Ye.clone(o),this._slices=r,this._offsetAttribute=e.offsetAttribute,this._workerName="createCylinderGeometry"}qh.packedLength=Ye.packedLength+5;qh.pack=function(e,t,n){if(!l(e))throw new w("value is required");if(!l(t))throw new w("array is required");return n=A(n,0),Ye.pack(e._vertexFormat,t,n),n+=Ye.packedLength,t[n++]=e._length,t[n++]=e._topRadius,t[n++]=e._bottomRadius,t[n++]=e._slices,t[n]=A(e._offsetAttribute,-1),t};const Lre=new Ye,F0={vertexFormat:Lre,length:void 0,topRadius:void 0,bottomRadius:void 0,slices:void 0,offsetAttribute:void 0};qh.unpack=function(e,t,n){if(!l(e))throw new w("array is required");t=A(t,0);const i=Ye.unpack(e,t,Lre);t+=Ye.packedLength;const o=e[t++],r=e[t++],s=e[t++],a=e[t++],c=e[t];return l(n)?(n._vertexFormat=Ye.clone(i,n._vertexFormat),n._length=o,n._topRadius=r,n._bottomRadius=s,n._slices=a,n._offsetAttribute=c===-1?void 0:c,n):(F0.length=o,F0.topRadius=r,F0.bottomRadius=s,F0.slices=a,F0.offsetAttribute=c===-1?void 0:c,new qh(F0))};qh.createGeometry=function(e){let t=e._length;const n=e._topRadius,i=e._bottomRadius,o=e._vertexFormat,r=e._slices;if(t<=0||n<0||i<0||n===0&&i===0)return;const s=r+r,a=r+s,c=s+s,u=Ore.computePositions(t,n,i,r,!0),f=o.st?new Float32Array(c*2):void 0,h=o.normal?new Float32Array(c*3):void 0,_=o.tangent?new Float32Array(c*3):void 0,g=o.bitangent?new Float32Array(c*3):void 0;let p;const y=o.normal||o.tangent||o.bitangent;if(y){const V=o.tangent||o.bitangent;let M=0,H=0,G=0;const I=Math.atan2(i-n,t),O=Gft;O.z=Math.sin(I);const m=Math.cos(I);let P=qft,R=Wft;for(p=0;p<r;p++){const U=p/r*F.TWO_PI,W=m*Math.cos(U),q=m*Math.sin(U);y&&(O.x=W,O.y=q,V&&(P=d.normalize(d.cross(d.UNIT_Z,O,P),P)),o.normal&&(h[M++]=O.x,h[M++]=O.y,h[M++]=O.z,h[M++]=O.x,h[M++]=O.y,h[M++]=O.z),o.tangent&&(_[H++]=P.x,_[H++]=P.y,_[H++]=P.z,_[H++]=P.x,_[H++]=P.y,_[H++]=P.z),o.bitangent&&(R=d.normalize(d.cross(O,P,R),R),g[G++]=R.x,g[G++]=R.y,g[G++]=R.z,g[G++]=R.x,g[G++]=R.y,g[G++]=R.z))}for(p=0;p<r;p++)o.normal&&(h[M++]=0,h[M++]=0,h[M++]=-1),o.tangent&&(_[H++]=1,_[H++]=0,_[H++]=0),o.bitangent&&(g[G++]=0,g[G++]=-1,g[G++]=0);for(p=0;p<r;p++)o.normal&&(h[M++]=0,h[M++]=0,h[M++]=1),o.tangent&&(_[H++]=1,_[H++]=0,_[H++]=0),o.bitangent&&(g[G++]=0,g[G++]=1,g[G++]=0)}const T=12*r-12,b=At.createTypedArray(c,T);let x=0,v=0;for(p=0;p<r-1;p++)b[x++]=v,b[x++]=v+2,b[x++]=v+3,b[x++]=v,b[x++]=v+3,b[x++]=v+1,v+=2;for(b[x++]=s-2,b[x++]=0,b[x++]=1,b[x++]=s-2,b[x++]=1,b[x++]=s-1,p=1;p<r-1;p++)b[x++]=s+p+1,b[x++]=s+p,b[x++]=s;for(p=1;p<r-1;p++)b[x++]=a,b[x++]=a+p,b[x++]=a+p+1;let D=0;if(o.st){const V=Math.max(n,i);for(p=0;p<c;p++){const M=d.fromArray(u,p*3,jft);f[D++]=(M.x+V)/(2*V),f[D++]=(M.y+V)/(2*V)}}const L=new To;o.position&&(L.position=new Xe({componentDatatype:oe.DOUBLE,componentsPerAttribute:3,values:u})),o.normal&&(L.normal=new Xe({componentDatatype:oe.FLOAT,componentsPerAttribute:3,values:h})),o.tangent&&(L.tangent=new Xe({componentDatatype:oe.FLOAT,componentsPerAttribute:3,values:_})),o.bitangent&&(L.bitangent=new Xe({componentDatatype:oe.FLOAT,componentsPerAttribute:3,values:g})),o.st&&(L.st=new Xe({componentDatatype:oe.FLOAT,componentsPerAttribute:2,values:f})),IN.x=t*.5,IN.y=Math.max(i,n);const B=new Ae(d.ZERO,$.magnitude(IN));if(l(e._offsetAttribute)){t=u.length;const V=e._offsetAttribute===Fn.NONE?0:1,M=new Uint8Array(t/3).fill(V);L.applyOffset=new Xe({componentDatatype:oe.UNSIGNED_BYTE,componentsPerAttribute:1,values:M})}return new $t({attributes:L,indices:b,primitiveType:dt.TRIANGLES,boundingSphere:B,offsetAttribute:e._offsetAttribute})};let PN;qh.getUnitCylinder=function(){return l(PN)||(PN=qh.createGeometry(new qh({topRadius:1,bottomRadius:1,length:1,vertexFormat:Ye.POSITION_ONLY}))),PN};const ON=new $;function aT(e){e=A(e,A.EMPTY_OBJECT);const t=e.length,n=e.topRadius,i=e.bottomRadius,o=A(e.slices,128),r=Math.max(A(e.numberOfVerticalLines,16),0);if(E.typeOf.number("options.positions",t),E.typeOf.number("options.topRadius",n),E.typeOf.number("options.bottomRadius",i),E.typeOf.number.greaterThanOrEquals("options.slices",o,3),l(e.offsetAttribute)&&e.offsetAttribute===Fn.TOP)throw new w("GeometryOffsetAttribute.TOP is not a supported options.offsetAttribute for this geometry.");this._length=t,this._topRadius=n,this._bottomRadius=i,this._slices=o,this._numberOfVerticalLines=r,this._offsetAttribute=e.offsetAttribute,this._workerName="createCylinderOutlineGeometry"}aT.packedLength=6;aT.pack=function(e,t,n){return E.typeOf.object("value",e),E.defined("array",t),n=A(n,0),t[n++]=e._length,t[n++]=e._topRadius,t[n++]=e._bottomRadius,t[n++]=e._slices,t[n++]=e._numberOfVerticalLines,t[n]=A(e._offsetAttribute,-1),t};const hg={length:void 0,topRadius:void 0,bottomRadius:void 0,slices:void 0,numberOfVerticalLines:void 0,offsetAttribute:void 0};aT.unpack=function(e,t,n){E.defined("array",e),t=A(t,0);const i=e[t++],o=e[t++],r=e[t++],s=e[t++],a=e[t++],c=e[t];return l(n)?(n._length=i,n._topRadius=o,n._bottomRadius=r,n._slices=s,n._numberOfVerticalLines=a,n._offsetAttribute=c===-1?void 0:c,n):(hg.length=i,hg.topRadius=o,hg.bottomRadius=r,hg.slices=s,hg.numberOfVerticalLines=a,hg.offsetAttribute=c===-1?void 0:c,new aT(hg))};aT.createGeometry=function(e){let t=e._length;const n=e._topRadius,i=e._bottomRadius,o=e._slices,r=e._numberOfVerticalLines;if(t<=0||n<0||i<0||n===0&&i===0)return;const s=o*2,a=Ore.computePositions(t,n,i,o,!1);let c=o*2,u;if(r>0){const y=Math.min(r,o);u=Math.round(o/y),c+=y}const f=At.createTypedArray(s,c*2);let h=0,_;for(_=0;_<o-1;_++)f[h++]=_,f[h++]=_+1,f[h++]=_+o,f[h++]=_+1+o;if(f[h++]=o-1,f[h++]=0,f[h++]=o+o-1,f[h++]=o,r>0)for(_=0;_<o;_+=u)f[h++]=_,f[h++]=_+o;const g=new To;g.position=new Xe({componentDatatype:oe.DOUBLE,componentsPerAttribute:3,values:a}),ON.x=t*.5,ON.y=Math.max(i,n);const p=new Ae(d.ZERO,$.magnitude(ON));if(l(e._offsetAttribute)){t=a.length;const y=e._offsetAttribute===Fn.NONE?0:1,T=new Uint8Array(t/3).fill(y);g.applyOffset=new Xe({componentDatatype:oe.UNSIGNED_BYTE,componentsPerAttribute:1,values:T})}return new $t({attributes:g,indices:f,primitiveType:dt.LINES,boundingSphere:p,offsetAttribute:e._offsetAttribute})};const Bre=d.ZERO,Rre=new d,Yft=new d,Nre=new k;function $ft(e){this.id=e,this.vertexFormat=void 0,this.length=void 0,this.topRadius=void 0,this.bottomRadius=void 0,this.slices=void 0,this.numberOfVerticalLines=void 0,this.offsetAttribute=void 0}function ul(e,t){li.call(this,{entity:e,scene:t,geometryOptions:new $ft(e),geometryPropertyName:"cylinder",observedPropertyNames:["availability","position","orientation","cylinder"]}),this._onEntityPropertyChanged(e,"cylinder",e.cylinder,void 0)}l(Object.create)&&(ul.prototype=Object.create(li.prototype),ul.prototype.constructor=ul);Object.defineProperties(ul.prototype,{terrainOffsetProperty:{get:function(){return this._terrainOffsetProperty}}});ul.prototype.createFillGeometryInstance=function(e){if(E.defined("time",e),!this._fillEnabled)throw new w("This instance does not represent a filled geometry.");const t=this._entity,n=t.isAvailable(e),i=new pi(n&&t.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),o=this._distanceDisplayConditionProperty.getValue(e),r=Yi.fromDistanceDisplayCondition(o),s={show:i,distanceDisplayCondition:r,color:void 0,offset:void 0};if(this._materialProperty instanceof An){let a;l(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(a=this._materialProperty.color.getValue(e,Nre)),l(a)||(a=k.WHITE),s.color=Bn.fromColor(a)}return l(this._options.offsetAttribute)&&(s.offset=Ar.fromCartesian3(ie.getValueOrDefault(this._terrainOffsetProperty,e,Bre,Rre))),new xn({id:t,geometry:new qh(this._options),modelMatrix:t.computeModelMatrixForHeightReference(e,t.cylinder.heightReference,this._options.length*.5,this._scene.mapProjection.ellipsoid),attributes:s})};ul.prototype.createOutlineGeometryInstance=function(e){if(E.defined("time",e),!this._outlineEnabled)throw new w("This instance does not represent an outlined geometry.");const t=this._entity,n=t.isAvailable(e),i=ie.getValueOrDefault(this._outlineColorProperty,e,k.BLACK,Nre),o=this._distanceDisplayConditionProperty.getValue(e),r={show:new pi(n&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:Bn.fromColor(i),distanceDisplayCondition:Yi.fromDistanceDisplayCondition(o),offset:void 0};return l(this._options.offsetAttribute)&&(r.offset=Ar.fromCartesian3(ie.getValueOrDefault(this._terrainOffsetProperty,e,Bre,Rre))),new xn({id:t,geometry:new aT(this._options),modelMatrix:t.computeModelMatrixForHeightReference(e,t.cylinder.heightReference,this._options.length*.5,this._scene.mapProjection.ellipsoid),attributes:r})};ul.prototype._computeCenter=function(e,t){return ie.getValueOrUndefined(this._entity.position,e,t)};ul.prototype._isHidden=function(e,t){return!l(e.position)||!l(t.length)||!l(t.topRadius)||!l(t.bottomRadius)||li.prototype._isHidden.call(this,e,t)};ul.prototype._isDynamic=function(e,t){return!e.position.isConstant||!ie.isConstant(e.orientation)||!t.length.isConstant||!t.topRadius.isConstant||!t.bottomRadius.isConstant||!ie.isConstant(t.slices)||!ie.isConstant(t.outlineWidth)||!ie.isConstant(t.numberOfVerticalLines)};ul.prototype._setStaticOptions=function(e,t){const n=ie.getValueOrDefault(t.heightReference,wt.MINIMUM_VALUE,Ht.NONE),i=this._options;i.vertexFormat=this._materialProperty instanceof An?kn.VERTEX_FORMAT:Dr.MaterialSupport.TEXTURED.vertexFormat,i.length=t.length.getValue(wt.MINIMUM_VALUE),i.topRadius=t.topRadius.getValue(wt.MINIMUM_VALUE),i.bottomRadius=t.bottomRadius.getValue(wt.MINIMUM_VALUE),i.slices=ie.getValueOrUndefined(t.slices,wt.MINIMUM_VALUE),i.numberOfVerticalLines=ie.getValueOrUndefined(t.numberOfVerticalLines,wt.MINIMUM_VALUE),i.offsetAttribute=n!==Ht.NONE?Fn.ALL:void 0};ul.prototype._onEntityPropertyChanged=iU;ul.DynamicGeometryUpdater=BA;function BA(e,t,n){Mi.call(this,e,t,n)}l(Object.create)&&(BA.prototype=Object.create(Mi.prototype),BA.prototype.constructor=BA);BA.prototype._isHidden=function(e,t,n){const i=this._options,o=ie.getValueOrUndefined(e.position,n,Yft);return!l(o)||!l(i.length)||!l(i.topRadius)||!l(i.bottomRadius)||Mi.prototype._isHidden.call(this,e,t,n)};BA.prototype._setOptions=function(e,t,n){const i=ie.getValueOrDefault(t.heightReference,n,Ht.NONE),o=this._options;o.length=ie.getValueOrUndefined(t.length,n),o.topRadius=ie.getValueOrUndefined(t.topRadius,n),o.bottomRadius=ie.getValueOrUndefined(t.bottomRadius,n),o.slices=ie.getValueOrUndefined(t.slices,n),o.numberOfVerticalLines=ie.getValueOrUndefined(t.numberOfVerticalLines,n),o.offsetAttribute=i!==Ht.NONE?Fn.ALL:void 0};const Xft={NONE:0,HOLD:1,EXTRAPOLATE:2},yA=Object.freeze(Xft),XU={type:"Linear"};XU.getRequiredDataPoints=function(e){return 2};XU.interpolateOrderZero=function(e,t,n,i,o){if(t.length!==2)throw new w("The xTable provided to the linear interpolator must have exactly two elements.");if(i<=0)throw new w("There must be at least 1 dependent variable for each independent variable.");l(o)||(o=new Array(i));let r,s,a;const c=t[0],u=t[1];if(c===u)throw new w("Divide by zero error: xTable[0] and xTable[1] are equal");for(r=0;r<i;r++)s=n[r],a=n[r+i],o[r]=((a-s)*e+u*s-c*a)/(u-c);return o};const Kft=XU;function Xg(e){let t=e._targetProperty;if(!l(t)){let n=e._targetEntity;if(!l(n)){if(n=e._targetCollection.getById(e._targetId),!l(n)){e._targetEntity=e._targetProperty=void 0;return}n.definitionChanged.addEventListener(Tl.prototype._onTargetEntityDefinitionChanged,e),e._targetEntity=n}const i=e._targetPropertyNames;t=e._targetEntity;for(let o=0,r=i.length;o<r&&l(t);++o)t=t[i[o]];e._targetProperty=t}return t}function Tl(e,t,n){if(!l(e))throw new w("targetCollection is required.");if(!l(t)||t==="")throw new w("targetId is required.");if(!l(n)||n.length===0)throw new w("targetPropertyNames is required.");for(let i=0;i<n.length;i++){const o=n[i];if(!l(o)||o==="")throw new w("reference contains invalid properties.")}this._targetCollection=e,this._targetId=t,this._targetPropertyNames=n,this._targetProperty=void 0,this._targetEntity=void 0,this._definitionChanged=new lt,e.collectionChanged.addEventListener(Tl.prototype._onCollectionChanged,this)}Object.defineProperties(Tl.prototype,{isConstant:{get:function(){return ie.isConstant(Xg(this))}},definitionChanged:{get:function(){return this._definitionChanged}},referenceFrame:{get:function(){const e=Xg(this);return l(e)?e.referenceFrame:void 0}},targetId:{get:function(){return this._targetId}},targetCollection:{get:function(){return this._targetCollection}},targetPropertyNames:{get:function(){return this._targetPropertyNames}},resolvedProperty:{get:function(){return Xg(this)}}});Tl.fromString=function(e,t){if(!l(e))throw new w("targetCollection is required.");if(!l(t))throw new w("referenceString is required.");let n;const i=[];let o=!0,r=!1,s="";for(let a=0;a<t.length;++a){const c=t.charAt(a);r?(s+=c,r=!1):c==="\\"?r=!0:o&&c==="#"?(n=s,o=!1,s=""):!o&&c==="."?(i.push(s),s=""):s+=c}return i.push(s),new Tl(e,n,i)};Tl.prototype.getValue=function(e,t){const n=Xg(this);return l(n)?n.getValue(e,t):void 0};Tl.prototype.getValueInReferenceFrame=function(e,t,n){const i=Xg(this);return l(i)?i.getValueInReferenceFrame(e,t,n):void 0};Tl.prototype.getType=function(e){const t=Xg(this);return l(t)?t.getType(e):void 0};Tl.prototype.equals=function(e){if(this===e)return!0;const t=this._targetPropertyNames,n=e._targetPropertyNames;if(this._targetCollection!==e._targetCollection||this._targetId!==e._targetId||t.length!==n.length)return!1;const i=this._targetPropertyNames.length;for(let o=0;o<i;o++)if(t[o]!==n[o])return!1;return!0};Tl.prototype._onTargetEntityDefinitionChanged=function(e,t,n,i){l(this._targetProperty)&&this._targetPropertyNames[0]===t&&(this._targetProperty=void 0,this._definitionChanged.raiseEvent(this))};Tl.prototype._onCollectionChanged=function(e,t,n){let i=this._targetEntity;l(i)&&n.indexOf(i)!==-1?(i.definitionChanged.removeEventListener(Tl.prototype._onTargetEntityDefinitionChanged,this),this._targetEntity=this._targetProperty=void 0):l(i)||(i=Xg(this),l(i)&&this._definitionChanged.raiseEvent(this))};const wj={packedLength:1,pack:function(e,t,n){n=A(n,0),t[n]=e},unpack:function(e,t,n){return t=A(t,0),e[t]}};function Sj(e,t,n){let i;const o=e.length,r=n.length,s=o+r;if(e.length=s,o!==t){let a=o-1;for(i=s-1;i>=t;i--)e[i]=e[a--]}for(i=0;i<r;i++)e[t++]=n[i]}function vj(e,t){return e instanceof ce?e:typeof e=="string"?ce.fromIso8601(e):ce.addSeconds(t,e,new ce)}const LN=[],BN=[];function zP(e,t,n,i,o){let r=0,s,a,c,u,f,h;for(;r<i.length;){f=vj(i[r],e),c=da(t,f,ce.compare);let _=0,g=0;if(c<0){for(c=~c,u=c*o,a=void 0,h=t[c];r<i.length&&(f=vj(i[r],e),!(l(a)&&ce.compare(a,f)>=0||l(h)&&ce.compare(f,h)>=0));){for(LN[_++]=f,r=r+1,s=0;s<o;s++)BN[g++]=i[r],r=r+1;a=f}_>0&&(BN.length=g,Sj(n,u,BN),LN.length=_,Sj(t,c,LN))}else{for(s=0;s<o;s++)r++,n[c*o+s]=i[r];r++}}}function Rf(e,t){E.defined("type",e);let n=e;n===Number&&(n=wj);let i=n.packedLength,o=A(n.packedInterpolationLength,i),r=0,s;if(l(t)){const a=t.length;s=new Array(a);for(let c=0;c<a;c++){let u=t[c];u===Number&&(u=wj);const f=u.packedLength;i+=f,o+=A(u.packedInterpolationLength,f),s[c]=u}r=a}this._type=e,this._innerType=n,this._interpolationDegree=1,this._interpolationAlgorithm=Kft,this._numberOfPoints=0,this._times=[],this._values=[],this._xTable=[],this._yTable=[],this._packedLength=i,this._packedInterpolationLength=o,this._updateTableLength=!0,this._interpolationResult=new Array(o),this._definitionChanged=new lt,this._derivativeTypes=t,this._innerDerivativeTypes=s,this._inputOrder=r,this._forwardExtrapolationType=yA.NONE,this._forwardExtrapolationDuration=0,this._backwardExtrapolationType=yA.NONE,this._backwardExtrapolationDuration=0}Object.defineProperties(Rf.prototype,{isConstant:{get:function(){return this._values.length===0}},definitionChanged:{get:function(){return this._definitionChanged}},type:{get:function(){return this._type}},derivativeTypes:{get:function(){return this._derivativeTypes}},interpolationDegree:{get:function(){return this._interpolationDegree}},interpolationAlgorithm:{get:function(){return this._interpolationAlgorithm}},forwardExtrapolationType:{get:function(){return this._forwardExtrapolationType},set:function(e){this._forwardExtrapolationType!==e&&(this._forwardExtrapolationType=e,this._definitionChanged.raiseEvent(this))}},forwardExtrapolationDuration:{get:function(){return this._forwardExtrapolationDuration},set:function(e){this._forwardExtrapolationDuration!==e&&(this._forwardExtrapolationDuration=e,this._definitionChanged.raiseEvent(this))}},backwardExtrapolationType:{get:function(){return this._backwardExtrapolationType},set:function(e){this._backwardExtrapolationType!==e&&(this._backwardExtrapolationType=e,this._definitionChanged.raiseEvent(this))}},backwardExtrapolationDuration:{get:function(){return this._backwardExtrapolationDuration},set:function(e){this._backwardExtrapolationDuration!==e&&(this._backwardExtrapolationDuration=e,this._definitionChanged.raiseEvent(this))}}});Rf.prototype.getValue=function(e,t){E.defined("time",e);const n=this._times,i=n.length;if(i===0)return;let o;const r=this._innerType,s=this._values;let a=da(n,e,ce.compare);if(a<0){if(a=~a,a===0){const D=n[a];if(o=this._backwardExtrapolationDuration,this._backwardExtrapolationType===yA.NONE||o!==0&&ce.secondsDifference(D,e)>o)return;if(this._backwardExtrapolationType===yA.HOLD)return r.unpack(s,0,t)}if(a>=i){a=i-1;const D=n[a];if(o=this._forwardExtrapolationDuration,this._forwardExtrapolationType===yA.NONE||o!==0&&ce.secondsDifference(e,D)>o)return;if(this._forwardExtrapolationType===yA.HOLD)return a=i-1,r.unpack(s,a*r.packedLength,t)}const c=this._xTable,u=this._yTable,f=this._interpolationAlgorithm,h=this._packedInterpolationLength,_=this._inputOrder;if(this._updateTableLength){this._updateTableLength=!1;const D=Math.min(f.getRequiredDataPoints(this._interpolationDegree,_),i);D!==this._numberOfPoints&&(this._numberOfPoints=D,c.length=D,u.length=D*h)}const g=this._numberOfPoints-1;if(g<1)return;let p=0,y=i-1;if(y-p+1>=g+1){let D=a-(g/2|0)-1;D<p&&(D=p);let L=D+g;L>y&&(L=y,D=L-g,D<p&&(D=p)),p=D,y=L}const b=y-p+1;for(let D=0;D<b;++D)c[D]=ce.secondsDifference(n[p+D],n[y]);if(l(r.convertPackedArrayForInterpolation))r.convertPackedArrayForInterpolation(s,p,y,u);else{let D=0;const L=this._packedLength;let B=p*L;const V=(y+1)*L;for(;B<V;)u[D]=s[B],B++,D++}const x=ce.secondsDifference(e,n[y]);let v;if(_===0||!l(f.interpolate))v=f.interpolateOrderZero(x,c,u,h,this._interpolationResult);else{const D=Math.floor(h/(_+1));v=f.interpolate(x,c,u,D,_,_,this._interpolationResult)}return l(r.unpackInterpolationResult)?r.unpackInterpolationResult(v,s,p,y,t):r.unpack(v,0,t)}return r.unpack(s,a*this._packedLength,t)};Rf.prototype.setInterpolationOptions=function(e){if(!l(e))return;let t=!1;const n=e.interpolationAlgorithm,i=e.interpolationDegree;l(n)&&this._interpolationAlgorithm!==n&&(this._interpolationAlgorithm=n,t=!0),l(i)&&this._interpolationDegree!==i&&(this._interpolationDegree=i,t=!0),t&&(this._updateTableLength=!0,this._definitionChanged.raiseEvent(this))};Rf.prototype.addSample=function(e,t,n){const i=this._innerDerivativeTypes,o=l(i);E.defined("time",e),E.defined("value",t),o&&E.defined("derivatives",n);const r=this._innerType,s=[];if(s.push(e),r.pack(t,s,s.length),o){const a=i.length;for(let c=0;c<a;c++)i[c].pack(n[c],s,s.length)}zP(void 0,this._times,this._values,s,this._packedLength),this._updateTableLength=!0,this._definitionChanged.raiseEvent(this)};Rf.prototype.addSamples=function(e,t,n){const i=this._innerDerivativeTypes,o=l(i);if(E.defined("times",e),E.defined("values",t),e.length!==t.length)throw new w("times and values must be the same length.");if(o&&(!l(n)||n.length!==e.length))throw new w("times and derivativeValues must be the same length.");const r=this._innerType,s=e.length,a=[];for(let c=0;c<s;c++)if(a.push(e[c]),r.pack(t[c],a,a.length),o){const u=n[c],f=i.length;for(let h=0;h<f;h++)i[h].pack(u[h],a,a.length)}zP(void 0,this._times,this._values,a,this._packedLength),this._updateTableLength=!0,this._definitionChanged.raiseEvent(this)};Rf.prototype.addSamplesPackedArray=function(e,t){E.defined("packedSamples",e),zP(t,this._times,this._values,e,this._packedLength),this._updateTableLength=!0,this._definitionChanged.raiseEvent(this)};Rf.prototype.removeSample=function(e){E.defined("time",e);const t=da(this._times,e,ce.compare);return t<0?!1:(Mre(this,t,1),!0)};function Mre(e,t,n){const i=e._packedLength;e._times.splice(t,n),e._values.splice(t*i,n*i),e._updateTableLength=!0,e._definitionChanged.raiseEvent(e)}Rf.prototype.removeSamples=function(e){E.defined("timeInterval",e);const t=this._times;let n=da(t,e.start,ce.compare);n<0?n=~n:e.isStartIncluded||++n;let i=da(t,e.stop,ce.compare);i<0?i=~i:e.isStopIncluded&&++i,Mre(this,n,i-n)};Rf.prototype.equals=function(e){if(this===e)return!0;if(!l(e)||this._type!==e._type||this._interpolationDegree!==e._interpolationDegree||this._interpolationAlgorithm!==e._interpolationAlgorithm)return!1;const t=this._derivativeTypes,n=l(t),i=e._derivativeTypes,o=l(i);if(n!==o)return!1;let r,s;if(n){if(s=t.length,s!==i.length)return!1;for(r=0;r<s;r++)if(t[r]!==i[r])return!1}const a=this._times,c=e._times;if(s=a.length,s!==c.length)return!1;for(r=0;r<s;r++)if(!ce.equals(a[r],c[r]))return!1;const u=this._values,f=e._values;for(s=u.length,r=0;r<s;r++)if(u[r]!==f[r])return!1;return!0};Rf._mergeNewSamples=zP;function Cl(e,t){t=A(t,0);let n;if(t>0){n=new Array(t);for(let i=0;i<t;i++)n[i]=d}this._numberOfDerivatives=t,this._property=new Rf(d,n),this._definitionChanged=new lt,this._referenceFrame=A(e,$a.FIXED),this._property._definitionChanged.addEventListener(function(){this._definitionChanged.raiseEvent(this)},this)}Object.defineProperties(Cl.prototype,{isConstant:{get:function(){return this._property.isConstant}},definitionChanged:{get:function(){return this._definitionChanged}},referenceFrame:{get:function(){return this._referenceFrame}},interpolationDegree:{get:function(){return this._property.interpolationDegree}},interpolationAlgorithm:{get:function(){return this._property.interpolationAlgorithm}},numberOfDerivatives:{get:function(){return this._numberOfDerivatives}},forwardExtrapolationType:{get:function(){return this._property.forwardExtrapolationType},set:function(e){this._property.forwardExtrapolationType=e}},forwardExtrapolationDuration:{get:function(){return this._property.forwardExtrapolationDuration},set:function(e){this._property.forwardExtrapolationDuration=e}},backwardExtrapolationType:{get:function(){return this._property.backwardExtrapolationType},set:function(e){this._property.backwardExtrapolationType=e}},backwardExtrapolationDuration:{get:function(){return this._property.backwardExtrapolationDuration},set:function(e){this._property.backwardExtrapolationDuration=e}}});Cl.prototype.getValue=function(e,t){return this.getValueInReferenceFrame(e,$a.FIXED,t)};Cl.prototype.getValueInReferenceFrame=function(e,t,n){if(E.defined("time",e),E.defined("referenceFrame",t),n=this._property.getValue(e,n),l(n))return b_.convertToReferenceFrame(e,n,this._referenceFrame,t,n)};Cl.prototype.setInterpolationOptions=function(e){this._property.setInterpolationOptions(e)};Cl.prototype.addSample=function(e,t,n){const i=this._numberOfDerivatives;if(i>0&&(!l(n)||n.length!==i))throw new w("derivatives length must be equal to the number of derivatives.");this._property.addSample(e,t,n)};Cl.prototype.addSamples=function(e,t,n){this._property.addSamples(e,t,n)};Cl.prototype.addSamplesPackedArray=function(e,t){this._property.addSamplesPackedArray(e,t)};Cl.prototype.removeSample=function(e){return this._property.removeSample(e)};Cl.prototype.removeSamples=function(e){this._property.removeSamples(e)};Cl.prototype.equals=function(e){return this===e||e instanceof Cl&&ie.equals(this._property,e._property)&&this._referenceFrame===e._referenceFrame};function c_(e){this._definitionChanged=new lt,this._intervals=new ar,this._intervals.changedEvent.addEventListener(c_.prototype._intervalsChanged,this),this._referenceFrame=A(e,$a.FIXED)}Object.defineProperties(c_.prototype,{isConstant:{get:function(){return this._intervals.isEmpty}},definitionChanged:{get:function(){return this._definitionChanged}},intervals:{get:function(){return this._intervals}},referenceFrame:{get:function(){return this._referenceFrame}}});c_.prototype.getValue=function(e,t){return this.getValueInReferenceFrame(e,$a.FIXED,t)};c_.prototype.getValueInReferenceFrame=function(e,t,n){if(!l(e))throw new w("time is required.");if(!l(t))throw new w("referenceFrame is required.");const i=this._intervals.findDataForIntervalContainingDate(e);if(l(i))return b_.convertToReferenceFrame(e,i,this._referenceFrame,t,n)};c_.prototype.equals=function(e){return this===e||e instanceof c_&&this._intervals.equals(e._intervals,ie.equals)&&this._referenceFrame===e._referenceFrame};c_.prototype._intervalsChanged=function(){this._definitionChanged.raiseEvent(this)};function Ec(){this._dataSources=[],this._dataSourceAdded=new lt,this._dataSourceRemoved=new lt,this._dataSourceMoved=new lt}Object.defineProperties(Ec.prototype,{length:{get:function(){return this._dataSources.length}},dataSourceAdded:{get:function(){return this._dataSourceAdded}},dataSourceRemoved:{get:function(){return this._dataSourceRemoved}},dataSourceMoved:{get:function(){return this._dataSourceMoved}}});Ec.prototype.add=function(e){if(!l(e))throw new w("dataSource is required.");const t=this,n=this._dataSources;return Promise.resolve(e).then(function(i){return n===t._dataSources&&(t._dataSources.push(i),t._dataSourceAdded.raiseEvent(t,i)),i})};Ec.prototype.remove=function(e,t){t=A(t,!1);const n=this._dataSources.indexOf(e);return n!==-1?(this._dataSources.splice(n,1),this._dataSourceRemoved.raiseEvent(this,e),t&&typeof e.destroy=="function"&&e.destroy(),!0):!1};Ec.prototype.removeAll=function(e){e=A(e,!1);const t=this._dataSources;for(let n=0,i=t.length;n<i;++n){const o=t[n];this._dataSourceRemoved.raiseEvent(this,o),e&&typeof o.destroy=="function"&&o.destroy()}this._dataSources=[]};Ec.prototype.contains=function(e){return this.indexOf(e)!==-1};Ec.prototype.indexOf=function(e){return this._dataSources.indexOf(e)};Ec.prototype.get=function(e){if(!l(e))throw new w("index is required.");return this._dataSources[e]};Ec.prototype.getByName=function(e){if(!l(e))throw new w("name is required.");return this._dataSources.filter(function(t){return t.name===e})};function UP(e,t){if(!l(t))throw new w("dataSource is required.");const n=e.indexOf(t);if(n===-1)throw new w("dataSource is not in this collection.");return n}function Fre(e,t,n){const i=e._dataSources,o=i.length-1;if(t=F.clamp(t,0,o),n=F.clamp(n,0,o),t===n)return;const r=i[t];i[t]=i[n],i[n]=r,e.dataSourceMoved.raiseEvent(r,n,t)}Ec.prototype.raise=function(e){const t=UP(this._dataSources,e);Fre(this,t,t+1)};Ec.prototype.lower=function(e){const t=UP(this._dataSources,e);Fre(this,t,t-1)};Ec.prototype.raiseToTop=function(e){const t=UP(this._dataSources,e);t!==this._dataSources.length-1&&(this._dataSources.splice(t,1),this._dataSources.push(e),this.dataSourceMoved.raiseEvent(e,this._dataSources.length-1,t))};Ec.prototype.lowerToBottom=function(e){const t=UP(this._dataSources,e);t!==0&&(this._dataSources.splice(t,1),this._dataSources.splice(0,0,e),this.dataSourceMoved.raiseEvent(e,0,t))};Ec.prototype.isDestroyed=function(){return!1};Ec.prototype.destroy=function(){return this.removeAll(!0),Je(this)};function $d(){this._length=0,this._collections={},this._collectionsArray=[],this.show=!0}Object.defineProperties($d.prototype,{length:{get:function(){return this._length}}});$d.prototype.add=function(e,t){E.defined("primitive",e),l(t)&&E.typeOf.number("zIndex",t),t=A(t,0);let n=this._collections[t];if(!l(n)){n=new Tr({destroyPrimitives:!1}),n._zIndex=t,this._collections[t]=n;const i=this._collectionsArray;let o=0;for(;o<i.length&&i[o]._zIndex<t;)o++;i.splice(o,0,n)}return n.add(e),this._length++,e._zIndex=t,e};$d.prototype.set=function(e,t){return E.defined("primitive",e),E.typeOf.number("zIndex",t),t===e._zIndex||(this.remove(e,!0),this.add(e,t)),e};$d.prototype.remove=function(e,t){if(this.contains(e)){const n=e._zIndex,i=this._collections[n];let o;return t?o=i.remove(e):o=i.removeAndDestroy(e),o&&this._length--,i.length===0&&(this._collectionsArray.splice(this._collectionsArray.indexOf(i),1),this._collections[n]=void 0,i.destroy()),o}return!1};$d.prototype.removeAll=function(){const e=this._collectionsArray;for(let t=0;t<e.length;t++){const n=e[t];n.destroyPrimitives=!0,n.destroy()}this._collections={},this._collectionsArray=[],this._length=0};$d.prototype.contains=function(e){if(!l(e))return!1;const t=this._collections[e._zIndex];return l(t)&&t.contains(e)};$d.prototype.update=function(e){if(!this.show)return;const t=this._collectionsArray;for(let n=0;n<t.length;n++)t[n].update(e)};$d.prototype.isDestroyed=function(){return!1};$d.prototype.destroy=function(){return this.removeAll(),Je(this)};function Yy(e,t){this._primitives=e,this._orderedGroundPrimitives=t,this._dynamicUpdaters=new Vt}Yy.prototype.add=function(e,t){this._dynamicUpdaters.set(t.id,t.createDynamicUpdater(this._primitives,this._orderedGroundPrimitives))};Yy.prototype.remove=function(e){const t=e.id,n=this._dynamicUpdaters.get(t);l(n)&&(this._dynamicUpdaters.remove(t),n.destroy())};Yy.prototype.update=function(e){const t=this._dynamicUpdaters.values;for(let n=0,i=t.length;n<i;n++)t[n].update(e);return!0};Yy.prototype.removeAllPrimitives=function(){const e=this._dynamicUpdaters.values;for(let t=0,n=e.length;t<n;t++)e[t].destroy();this._dynamicUpdaters.removeAll()};Yy.prototype.getBoundingSphere=function(e,t){return e=this._dynamicUpdaters.get(e.id),l(e)&&l(e.getBoundingSphere)?e.getBoundingSphere(t):Ot.FAILED};const KU={},Vv=new d,Dj=new d,Ij=new De,Pj=new te;function z0(e,t,n,i,o,r,s,a,c,u){const f=e+t;d.multiplyByScalar(i,Math.cos(f),Vv),d.multiplyByScalar(n,Math.sin(f),Dj),d.add(Vv,Dj,Vv);let h=Math.cos(e);h=h*h;let _=Math.sin(e);_=_*_;const p=r/Math.sqrt(s*h+o*_)/a;return De.fromAxisAngle(Vv,p,Ij),te.fromQuaternion(Ij,Pj),te.multiplyByVector(Pj,c,u),d.normalize(u,u),d.multiplyByScalar(u,a,u),u}const zre=new d,Ure=new d,T2=new d,Jft=new d;KU.raisePositionsToHeight=function(e,t,n){const i=t.ellipsoid,o=t.height,r=t.extrudedHeight,s=n?e.length/3*2:e.length/3,a=new Float64Array(s*3),c=e.length,u=n?c:0;for(let f=0;f<c;f+=3){const h=f+1,_=f+2,g=d.fromArray(e,f,zre);i.scaleToGeodeticSurface(g,g);const p=d.clone(g,Ure),y=i.geodeticSurfaceNormal(g,Jft),T=d.multiplyByScalar(y,o,T2);d.add(g,T,g),n&&(d.multiplyByScalar(y,r,T),d.add(p,T,p),a[f+u]=p.x,a[h+u]=p.y,a[_+u]=p.z),a[f]=g.x,a[h]=g.y,a[_]=g.z}return a};const Qft=new d,Zft=new d,edt=new d;KU.computeEllipsePositions=function(e,t,n){const i=e.semiMinorAxis,o=e.semiMajorAxis,r=e.rotation,s=e.center,a=e.granularity*8,c=i*i,u=o*o,f=o*i,h=d.magnitude(s),_=d.normalize(s,Qft);let g=d.cross(d.UNIT_Z,s,Zft);g=d.normalize(g,g);const p=d.cross(_,g,edt);let y=1+Math.ceil(F.PI_OVER_TWO/a);const T=F.PI_OVER_TWO/(y-1);let b=F.PI_OVER_TWO-y*T;b<0&&(y-=Math.ceil(Math.abs(b)/T));const x=2*(y*(y+2)),v=t?new Array(x*3):void 0;let D=0,L=zre,B=Ure;const V=y*4*3;let M=V-1,H=0;const G=n?new Array(V):void 0;let I,O,m,P,R;for(b=F.PI_OVER_TWO,L=z0(b,r,p,g,c,f,u,h,_,L),t&&(v[D++]=L.x,v[D++]=L.y,v[D++]=L.z),n&&(G[M--]=L.z,G[M--]=L.y,G[M--]=L.x),b=F.PI_OVER_TWO-T,I=1;I<y+1;++I){if(L=z0(b,r,p,g,c,f,u,h,_,L),B=z0(Math.PI-b,r,p,g,c,f,u,h,_,B),t){for(v[D++]=L.x,v[D++]=L.y,v[D++]=L.z,m=2*I+2,O=1;O<m-1;++O)P=O/(m-1),R=d.lerp(L,B,P,T2),v[D++]=R.x,v[D++]=R.y,v[D++]=R.z;v[D++]=B.x,v[D++]=B.y,v[D++]=B.z}n&&(G[M--]=L.z,G[M--]=L.y,G[M--]=L.x,G[H++]=B.x,G[H++]=B.y,G[H++]=B.z),b=F.PI_OVER_TWO-(I+1)*T}for(I=y;I>1;--I){if(b=F.PI_OVER_TWO-(I-1)*T,L=z0(-b,r,p,g,c,f,u,h,_,L),B=z0(b+Math.PI,r,p,g,c,f,u,h,_,B),t){for(v[D++]=L.x,v[D++]=L.y,v[D++]=L.z,m=2*(I-1)+2,O=1;O<m-1;++O)P=O/(m-1),R=d.lerp(L,B,P,T2),v[D++]=R.x,v[D++]=R.y,v[D++]=R.z;v[D++]=B.x,v[D++]=B.y,v[D++]=B.z}n&&(G[M--]=L.z,G[M--]=L.y,G[M--]=L.x,G[H++]=B.x,G[H++]=B.y,G[H++]=B.z)}b=F.PI_OVER_TWO,L=z0(-b,r,p,g,c,f,u,h,_,L);const U={};return t&&(v[D++]=L.x,v[D++]=L.y,v[D++]=L.z,U.positions=v,U.numPts=y),n&&(G[M--]=L.z,G[M--]=L.y,G[M--]=L.x,U.outerPositions=G),U};const tp=KU,cT=new d,C2=new d,b2=new d,Oj=new d,ss=new $,Hre=new te,tdt=new te,E2=new De,Vre=new d,kre=new d,Gre=new d,h1=new ve,Wre=new d,qre=new $,jre=new $;function Yre(e,t,n){const i=t.vertexFormat,o=t.center,r=t.semiMajorAxis,s=t.semiMinorAxis,a=t.ellipsoid,c=t.stRotation,u=n?e.length/3*2:e.length/3,f=t.shadowVolume,h=i.st?new Float32Array(u*2):void 0,_=i.normal?new Float32Array(u*3):void 0,g=i.tangent?new Float32Array(u*3):void 0,p=i.bitangent?new Float32Array(u*3):void 0,y=f?new Float32Array(u*3):void 0;let T=0,b=Vre,x=kre,v=Gre;const D=new Or(a),L=D.project(a.cartesianToCartographic(o,h1),Wre),B=a.scaleToGeodeticSurface(o,cT);a.geodeticSurfaceNormal(B,B);let V=Hre,M=tdt;if(c!==0){let R=De.fromAxisAngle(B,c,E2);V=te.fromQuaternion(R,V),R=De.fromAxisAngle(B,-c,E2),M=te.fromQuaternion(R,M)}else V=te.clone(te.IDENTITY,V),M=te.clone(te.IDENTITY,M);const H=$.fromElements(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,qre),G=$.fromElements(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,jre);let I=e.length;const O=n?I:0,m=O/3*2;for(let R=0;R<I;R+=3){const U=R+1,W=R+2,q=d.fromArray(e,R,cT);if(i.st){const Y=te.multiplyByVector(V,q,C2),j=D.project(a.cartesianToCartographic(Y,h1),b2);d.subtract(j,L,j),ss.x=(j.x+r)/(2*r),ss.y=(j.y+s)/(2*s),H.x=Math.min(ss.x,H.x),H.y=Math.min(ss.y,H.y),G.x=Math.max(ss.x,G.x),G.y=Math.max(ss.y,G.y),n&&(h[T+m]=ss.x,h[T+1+m]=ss.y),h[T++]=ss.x,h[T++]=ss.y}(i.normal||i.tangent||i.bitangent||f)&&(b=a.geodeticSurfaceNormal(q,b),f&&(y[R+O]=-b.x,y[U+O]=-b.y,y[W+O]=-b.z),(i.normal||i.tangent||i.bitangent)&&((i.tangent||i.bitangent)&&(x=d.normalize(d.cross(d.UNIT_Z,b,x),x),te.multiplyByVector(M,x,x)),i.normal&&(_[R]=b.x,_[U]=b.y,_[W]=b.z,n&&(_[R+O]=-b.x,_[U+O]=-b.y,_[W+O]=-b.z)),i.tangent&&(g[R]=x.x,g[U]=x.y,g[W]=x.z,n&&(g[R+O]=-x.x,g[U+O]=-x.y,g[W+O]=-x.z)),i.bitangent&&(v=d.normalize(d.cross(b,x,v),v),p[R]=v.x,p[U]=v.y,p[W]=v.z,n&&(p[R+O]=v.x,p[U+O]=v.y,p[W+O]=v.z))))}if(i.st){I=h.length;for(let R=0;R<I;R+=2)h[R]=(h[R]-H.x)/(G.x-H.x),h[R+1]=(h[R+1]-H.y)/(G.y-H.y)}const P=new To;if(i.position){const R=tp.raisePositionsToHeight(e,t,n);P.position=new Xe({componentDatatype:oe.DOUBLE,componentsPerAttribute:3,values:R})}if(i.st&&(P.st=new Xe({componentDatatype:oe.FLOAT,componentsPerAttribute:2,values:h})),i.normal&&(P.normal=new Xe({componentDatatype:oe.FLOAT,componentsPerAttribute:3,values:_})),i.tangent&&(P.tangent=new Xe({componentDatatype:oe.FLOAT,componentsPerAttribute:3,values:g})),i.bitangent&&(P.bitangent=new Xe({componentDatatype:oe.FLOAT,componentsPerAttribute:3,values:p})),f&&(P.extrudeDirection=new Xe({componentDatatype:oe.FLOAT,componentsPerAttribute:3,values:y})),n&&l(t.offsetAttribute)){let R=new Uint8Array(u);if(t.offsetAttribute===Fn.TOP)R=R.fill(1,0,u/2);else{const U=t.offsetAttribute===Fn.NONE?0:1;R=R.fill(U)}P.applyOffset=new Xe({componentDatatype:oe.UNSIGNED_BYTE,componentsPerAttribute:1,values:R})}return P}function $re(e){const t=new Array(12*(e*(e+1))-6);let n=0,i,o,r,s,a;for(i=0,r=1,s=0;s<3;s++)t[n++]=r++,t[n++]=i,t[n++]=r;for(s=2;s<e+1;++s){for(r=s*(s+1)-1,i=(s-1)*s-1,t[n++]=r++,t[n++]=i,t[n++]=r,o=2*s,a=0;a<o-1;++a)t[n++]=r,t[n++]=i++,t[n++]=i,t[n++]=r++,t[n++]=i,t[n++]=r;t[n++]=r++,t[n++]=i,t[n++]=r}for(o=e*2,++r,++i,s=0;s<o-1;++s)t[n++]=r,t[n++]=i++,t[n++]=i,t[n++]=r++,t[n++]=i,t[n++]=r;for(t[n++]=r,t[n++]=i++,t[n++]=i,t[n++]=r++,t[n++]=i++,t[n++]=i,++i,s=e-1;s>1;--s){for(t[n++]=i++,t[n++]=i,t[n++]=r,o=2*s,a=0;a<o-1;++a)t[n++]=r,t[n++]=i++,t[n++]=i,t[n++]=r++,t[n++]=i,t[n++]=r;t[n++]=i++,t[n++]=i++,t[n++]=r++}for(s=0;s<3;s++)t[n++]=i++,t[n++]=i,t[n++]=r;return t}let pg=new d;function ndt(e){const t=e.center;pg=d.multiplyByScalar(e.ellipsoid.geodeticSurfaceNormal(t,pg),e.height,pg),pg=d.add(t,pg,pg);const n=new Ae(pg,e.semiMajorAxis),i=tp.computeEllipsePositions(e,!0,!1),o=i.positions,r=i.numPts,s=Yre(o,e,!1);let a=$re(r);return a=At.createTypedArray(o.length/3,a),{boundingSphere:n,attributes:s,indices:a}}function idt(e,t){const n=t.vertexFormat,i=t.center,o=t.semiMajorAxis,r=t.semiMinorAxis,s=t.ellipsoid,a=t.height,c=t.extrudedHeight,u=t.stRotation,f=e.length/3*2,h=new Float64Array(f*3),_=n.st?new Float32Array(f*2):void 0,g=n.normal?new Float32Array(f*3):void 0,p=n.tangent?new Float32Array(f*3):void 0,y=n.bitangent?new Float32Array(f*3):void 0,T=t.shadowVolume,b=T?new Float32Array(f*3):void 0;let x=0,v=Vre,D=kre,L=Gre;const B=new Or(s),V=B.project(s.cartesianToCartographic(i,h1),Wre),M=s.scaleToGeodeticSurface(i,cT);s.geodeticSurfaceNormal(M,M);const H=De.fromAxisAngle(M,u,E2),G=te.fromQuaternion(H,Hre),I=$.fromElements(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,qre),O=$.fromElements(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,jre);let m=e.length;const P=m/3*2;for(let U=0;U<m;U+=3){const W=U+1,q=U+2;let Y=d.fromArray(e,U,cT),j;if(n.st){const K=te.multiplyByVector(G,Y,C2),se=B.project(s.cartesianToCartographic(K,h1),b2);d.subtract(se,V,se),ss.x=(se.x+o)/(2*o),ss.y=(se.y+r)/(2*r),I.x=Math.min(ss.x,I.x),I.y=Math.min(ss.y,I.y),O.x=Math.max(ss.x,O.x),O.y=Math.max(ss.y,O.y),_[x+P]=ss.x,_[x+1+P]=ss.y,_[x++]=ss.x,_[x++]=ss.y}Y=s.scaleToGeodeticSurface(Y,Y),j=d.clone(Y,C2),v=s.geodeticSurfaceNormal(Y,v),T&&(b[U+m]=-v.x,b[W+m]=-v.y,b[q+m]=-v.z);let ee=d.multiplyByScalar(v,a,Oj);if(Y=d.add(Y,ee,Y),ee=d.multiplyByScalar(v,c,ee),j=d.add(j,ee,j),n.position&&(h[U+m]=j.x,h[W+m]=j.y,h[q+m]=j.z,h[U]=Y.x,h[W]=Y.y,h[q]=Y.z),n.normal||n.tangent||n.bitangent){L=d.clone(v,L);const K=d.fromArray(e,(U+3)%m,Oj);d.subtract(K,Y,K);const se=d.subtract(j,Y,b2);v=d.normalize(d.cross(se,K,v),v),n.normal&&(g[U]=v.x,g[W]=v.y,g[q]=v.z,g[U+m]=v.x,g[W+m]=v.y,g[q+m]=v.z),n.tangent&&(D=d.normalize(d.cross(L,v,D),D),p[U]=D.x,p[W]=D.y,p[q]=D.z,p[U+m]=D.x,p[U+1+m]=D.y,p[U+2+m]=D.z),n.bitangent&&(y[U]=L.x,y[W]=L.y,y[q]=L.z,y[U+m]=L.x,y[W+m]=L.y,y[q+m]=L.z)}}if(n.st){m=_.length;for(let U=0;U<m;U+=2)_[U]=(_[U]-I.x)/(O.x-I.x),_[U+1]=(_[U+1]-I.y)/(O.y-I.y)}const R=new To;if(n.position&&(R.position=new Xe({componentDatatype:oe.DOUBLE,componentsPerAttribute:3,values:h})),n.st&&(R.st=new Xe({componentDatatype:oe.FLOAT,componentsPerAttribute:2,values:_})),n.normal&&(R.normal=new Xe({componentDatatype:oe.FLOAT,componentsPerAttribute:3,values:g})),n.tangent&&(R.tangent=new Xe({componentDatatype:oe.FLOAT,componentsPerAttribute:3,values:p})),n.bitangent&&(R.bitangent=new Xe({componentDatatype:oe.FLOAT,componentsPerAttribute:3,values:y})),T&&(R.extrudeDirection=new Xe({componentDatatype:oe.FLOAT,componentsPerAttribute:3,values:b})),l(t.offsetAttribute)){let U=new Uint8Array(f);if(t.offsetAttribute===Fn.TOP)U=U.fill(1,0,f/2);else{const W=t.offsetAttribute===Fn.NONE?0:1;U=U.fill(W)}R.applyOffset=new Xe({componentDatatype:oe.UNSIGNED_BYTE,componentsPerAttribute:1,values:U})}return R}function odt(e){const t=e.length/3,n=At.createTypedArray(t,t*6);let i=0;for(let o=0;o<t;o++){const r=o,s=o+t,a=(r+1)%t,c=a+t;n[i++]=r,n[i++]=s,n[i++]=a,n[i++]=a,n[i++]=s,n[i++]=c}return n}const kv=new Ae,Gv=new Ae;function rdt(e){const t=e.center,n=e.ellipsoid,i=e.semiMajorAxis;let o=d.multiplyByScalar(n.geodeticSurfaceNormal(t,cT),e.height,cT);kv.center=d.add(t,o,kv.center),kv.radius=i,o=d.multiplyByScalar(n.geodeticSurfaceNormal(t,o),e.extrudedHeight,o),Gv.center=d.add(t,o,Gv.center),Gv.radius=i;const r=tp.computeEllipsePositions(e,!0,!0),s=r.positions,a=r.numPts,c=r.outerPositions,u=Ae.union(kv,Gv),f=Yre(s,e,!0);let h=$re(a);const _=h.length;h.length=_*2;const g=s.length/3;for(let D=0;D<_;D+=3)h[D+_]=h[D+2]+g,h[D+1+_]=h[D+1]+g,h[D+2+_]=h[D]+g;const p=At.createTypedArray(g*2/3,h),y=new $t({attributes:f,indices:p,primitiveType:dt.TRIANGLES}),T=idt(c,e);h=odt(c);const b=At.createTypedArray(c.length*2/3,h),x=new $t({attributes:T,indices:b,primitiveType:dt.TRIANGLES}),v=mo.combineInstances([new xn({geometry:y}),new xn({geometry:x})]);return{boundingSphere:u,attributes:v[0].attributes,indices:v[0].indices}}function Xre(e,t,n,i,o,r,s){const c=tp.computeEllipsePositions({center:e,semiMajorAxis:t,semiMinorAxis:n,rotation:i,granularity:o},!1,!0).outerPositions,u=c.length/3,f=new Array(u);for(let _=0;_<u;++_)f[_]=d.fromArray(c,_*3);const h=Ee.fromCartesianArray(f,r,s);return h.width>F.PI&&(h.north=h.north>0?F.PI_OVER_TWO-F.EPSILON7:h.north,h.south=h.south<0?F.EPSILON7-F.PI_OVER_TWO:h.south,h.east=F.PI,h.west=-F.PI),h}function Au(e){e=A(e,A.EMPTY_OBJECT);const t=e.center,n=A(e.ellipsoid,be.WGS84),i=e.semiMajorAxis,o=e.semiMinorAxis,r=A(e.granularity,F.RADIANS_PER_DEGREE),s=A(e.vertexFormat,Ye.DEFAULT);if(E.defined("options.center",t),E.typeOf.number("options.semiMajorAxis",i),E.typeOf.number("options.semiMinorAxis",o),i<o)throw new w("semiMajorAxis must be greater than or equal to the semiMinorAxis.");if(r<=0)throw new w("granularity must be greater than zero.");const a=A(e.height,0),c=A(e.extrudedHeight,a);this._center=d.clone(t),this._semiMajorAxis=i,this._semiMinorAxis=o,this._ellipsoid=be.clone(n),this._rotation=A(e.rotation,0),this._stRotation=A(e.stRotation,0),this._height=Math.max(c,a),this._granularity=r,this._vertexFormat=Ye.clone(s),this._extrudedHeight=Math.min(c,a),this._shadowVolume=A(e.shadowVolume,!1),this._workerName="createEllipseGeometry",this._offsetAttribute=e.offsetAttribute,this._rectangle=void 0,this._textureCoordinateRotationPoints=void 0}Au.packedLength=d.packedLength+be.packedLength+Ye.packedLength+9;Au.pack=function(e,t,n){return E.defined("value",e),E.defined("array",t),n=A(n,0),d.pack(e._center,t,n),n+=d.packedLength,be.pack(e._ellipsoid,t,n),n+=be.packedLength,Ye.pack(e._vertexFormat,t,n),n+=Ye.packedLength,t[n++]=e._semiMajorAxis,t[n++]=e._semiMinorAxis,t[n++]=e._rotation,t[n++]=e._stRotation,t[n++]=e._height,t[n++]=e._granularity,t[n++]=e._extrudedHeight,t[n++]=e._shadowVolume?1:0,t[n]=A(e._offsetAttribute,-1),t};const Kre=new d,Jre=new be,Qre=new Ye,Xf={center:Kre,ellipsoid:Jre,vertexFormat:Qre,semiMajorAxis:void 0,semiMinorAxis:void 0,rotation:void 0,stRotation:void 0,height:void 0,granularity:void 0,extrudedHeight:void 0,shadowVolume:void 0,offsetAttribute:void 0};Au.unpack=function(e,t,n){E.defined("array",e),t=A(t,0);const i=d.unpack(e,t,Kre);t+=d.packedLength;const o=be.unpack(e,t,Jre);t+=be.packedLength;const r=Ye.unpack(e,t,Qre);t+=Ye.packedLength;const s=e[t++],a=e[t++],c=e[t++],u=e[t++],f=e[t++],h=e[t++],_=e[t++],g=e[t++]===1,p=e[t];return l(n)?(n._center=d.clone(i,n._center),n._ellipsoid=be.clone(o,n._ellipsoid),n._vertexFormat=Ye.clone(r,n._vertexFormat),n._semiMajorAxis=s,n._semiMinorAxis=a,n._rotation=c,n._stRotation=u,n._height=f,n._granularity=h,n._extrudedHeight=_,n._shadowVolume=g,n._offsetAttribute=p===-1?void 0:p,n):(Xf.height=f,Xf.extrudedHeight=_,Xf.granularity=h,Xf.stRotation=u,Xf.rotation=c,Xf.semiMajorAxis=s,Xf.semiMinorAxis=a,Xf.shadowVolume=g,Xf.offsetAttribute=p===-1?void 0:p,new Au(Xf))};Au.computeRectangle=function(e,t){e=A(e,A.EMPTY_OBJECT);const n=e.center,i=A(e.ellipsoid,be.WGS84),o=e.semiMajorAxis,r=e.semiMinorAxis,s=A(e.granularity,F.RADIANS_PER_DEGREE),a=A(e.rotation,0);if(E.defined("options.center",n),E.typeOf.number("options.semiMajorAxis",o),E.typeOf.number("options.semiMinorAxis",r),o<r)throw new w("semiMajorAxis must be greater than or equal to the semiMinorAxis.");if(s<=0)throw new w("granularity must be greater than zero.");return Xre(n,o,r,a,s,i,t)};Au.createGeometry=function(e){if(e._semiMajorAxis<=0||e._semiMinorAxis<=0)return;const t=e._height,n=e._extrudedHeight,i=!F.equalsEpsilon(t,n,0,F.EPSILON2);e._center=e._ellipsoid.scaleToGeodeticSurface(e._center,e._center);const o={center:e._center,semiMajorAxis:e._semiMajorAxis,semiMinorAxis:e._semiMinorAxis,ellipsoid:e._ellipsoid,rotation:e._rotation,height:t,granularity:e._granularity,vertexFormat:e._vertexFormat,stRotation:e._stRotation};let r;if(i)o.extrudedHeight=n,o.shadowVolume=e._shadowVolume,o.offsetAttribute=e._offsetAttribute,r=rdt(o);else if(r=ndt(o),l(e._offsetAttribute)){const s=r.attributes.position.values.length,a=e._offsetAttribute===Fn.NONE?0:1,c=new Uint8Array(s/3).fill(a);r.attributes.applyOffset=new Xe({componentDatatype:oe.UNSIGNED_BYTE,componentsPerAttribute:1,values:c})}return new $t({attributes:r.attributes,indices:r.indices,primitiveType:dt.TRIANGLES,boundingSphere:r.boundingSphere,offsetAttribute:e._offsetAttribute})};Au.createShadowVolume=function(e,t,n){const i=e._granularity,o=e._ellipsoid,r=t(i,o),s=n(i,o);return new Au({center:e._center,semiMajorAxis:e._semiMajorAxis,semiMinorAxis:e._semiMinorAxis,ellipsoid:o,rotation:e._rotation,stRotation:e._stRotation,granularity:i,extrudedHeight:r,height:s,vertexFormat:Ye.POSITION_ONLY,shadowVolume:!0})};function sdt(e){const t=-e._stRotation;if(t===0)return[0,0,0,1,1,0];const i=tp.computeEllipsePositions({center:e._center,semiMajorAxis:e._semiMajorAxis,semiMinorAxis:e._semiMinorAxis,rotation:e._rotation,granularity:e._granularity},!1,!0).outerPositions,o=i.length/3,r=new Array(o);for(let c=0;c<o;++c)r[c]=d.fromArray(i,c*3);const s=e._ellipsoid,a=e.rectangle;return $t._textureCoordinateRotationPoints(r,t,s,a)}Object.defineProperties(Au.prototype,{rectangle:{get:function(){return l(this._rectangle)||(this._rectangle=Xre(this._center,this._semiMajorAxis,this._semiMinorAxis,this._rotation,this._granularity,this._ellipsoid)),this._rectangle}},textureCoordinateRotationPoints:{get:function(){return l(this._textureCoordinateRotationPoints)||(this._textureCoordinateRotationPoints=sdt(this)),this._textureCoordinateRotationPoints}}});const Lj=new d;let mg=new d;function adt(e){const t=e.center;mg=d.multiplyByScalar(e.ellipsoid.geodeticSurfaceNormal(t,mg),e.height,mg),mg=d.add(t,mg,mg);const n=new Ae(mg,e.semiMajorAxis),i=tp.computeEllipsePositions(e,!1,!0).outerPositions,o=new To({position:new Xe({componentDatatype:oe.DOUBLE,componentsPerAttribute:3,values:tp.raisePositionsToHeight(i,e,!1)})}),r=i.length/3,s=At.createTypedArray(r,r*2);let a=0;for(let c=0;c<r;++c)s[a++]=c,s[a++]=(c+1)%r;return{boundingSphere:n,attributes:o,indices:s}}const Wv=new Ae,qv=new Ae;function cdt(e){const t=e.center,n=e.ellipsoid,i=e.semiMajorAxis;let o=d.multiplyByScalar(n.geodeticSurfaceNormal(t,Lj),e.height,Lj);Wv.center=d.add(t,o,Wv.center),Wv.radius=i,o=d.multiplyByScalar(n.geodeticSurfaceNormal(t,o),e.extrudedHeight,o),qv.center=d.add(t,o,qv.center),qv.radius=i;let r=tp.computeEllipsePositions(e,!1,!0).outerPositions;const s=new To({position:new Xe({componentDatatype:oe.DOUBLE,componentsPerAttribute:3,values:tp.raisePositionsToHeight(r,e,!0)})});r=s.position.values;const a=Ae.union(Wv,qv);let c=r.length/3;if(l(e.offsetAttribute)){let p=new Uint8Array(c);if(e.offsetAttribute===Fn.TOP)p=p.fill(1,0,c/2);else{const y=e.offsetAttribute===Fn.NONE?0:1;p=p.fill(y)}s.applyOffset=new Xe({componentDatatype:oe.UNSIGNED_BYTE,componentsPerAttribute:1,values:p})}let u=A(e.numberOfVerticalLines,16);u=F.clamp(u,0,c/2);const f=At.createTypedArray(c,c*2+u*2);c/=2;let h=0,_;for(_=0;_<c;++_)f[h++]=_,f[h++]=(_+1)%c,f[h++]=_+c,f[h++]=(_+1)%c+c;let g;if(u>0){const p=Math.min(u,c);g=Math.round(c/p);const y=Math.min(g*u,c);for(_=0;_<y;_+=g)f[h++]=_,f[h++]=_+c}return{boundingSphere:a,attributes:s,indices:f}}function lT(e){e=A(e,A.EMPTY_OBJECT);const t=e.center,n=A(e.ellipsoid,be.WGS84),i=e.semiMajorAxis,o=e.semiMinorAxis,r=A(e.granularity,F.RADIANS_PER_DEGREE);if(!l(t))throw new w("center is required.");if(!l(i))throw new w("semiMajorAxis is required.");if(!l(o))throw new w("semiMinorAxis is required.");if(i<o)throw new w("semiMajorAxis must be greater than or equal to the semiMinorAxis.");if(r<=0)throw new w("granularity must be greater than zero.");const s=A(e.height,0),a=A(e.extrudedHeight,s);this._center=d.clone(t),this._semiMajorAxis=i,this._semiMinorAxis=o,this._ellipsoid=be.clone(n),this._rotation=A(e.rotation,0),this._height=Math.max(a,s),this._granularity=r,this._extrudedHeight=Math.min(a,s),this._numberOfVerticalLines=Math.max(A(e.numberOfVerticalLines,16),0),this._offsetAttribute=e.offsetAttribute,this._workerName="createEllipseOutlineGeometry"}lT.packedLength=d.packedLength+be.packedLength+8;lT.pack=function(e,t,n){if(!l(e))throw new w("value is required");if(!l(t))throw new w("array is required");return n=A(n,0),d.pack(e._center,t,n),n+=d.packedLength,be.pack(e._ellipsoid,t,n),n+=be.packedLength,t[n++]=e._semiMajorAxis,t[n++]=e._semiMinorAxis,t[n++]=e._rotation,t[n++]=e._height,t[n++]=e._granularity,t[n++]=e._extrudedHeight,t[n++]=e._numberOfVerticalLines,t[n]=A(e._offsetAttribute,-1),t};const Zre=new d,ese=new be,_h={center:Zre,ellipsoid:ese,semiMajorAxis:void 0,semiMinorAxis:void 0,rotation:void 0,height:void 0,granularity:void 0,extrudedHeight:void 0,numberOfVerticalLines:void 0,offsetAttribute:void 0};lT.unpack=function(e,t,n){if(!l(e))throw new w("array is required");t=A(t,0);const i=d.unpack(e,t,Zre);t+=d.packedLength;const o=be.unpack(e,t,ese);t+=be.packedLength;const r=e[t++],s=e[t++],a=e[t++],c=e[t++],u=e[t++],f=e[t++],h=e[t++],_=e[t];return l(n)?(n._center=d.clone(i,n._center),n._ellipsoid=be.clone(o,n._ellipsoid),n._semiMajorAxis=r,n._semiMinorAxis=s,n._rotation=a,n._height=c,n._granularity=u,n._extrudedHeight=f,n._numberOfVerticalLines=h,n._offsetAttribute=_===-1?void 0:_,n):(_h.height=c,_h.extrudedHeight=f,_h.granularity=u,_h.rotation=a,_h.semiMajorAxis=r,_h.semiMinorAxis=s,_h.numberOfVerticalLines=h,_h.offsetAttribute=_===-1?void 0:_,new lT(_h))};lT.createGeometry=function(e){if(e._semiMajorAxis<=0||e._semiMinorAxis<=0)return;const t=e._height,n=e._extrudedHeight,i=!F.equalsEpsilon(t,n,0,F.EPSILON2);e._center=e._ellipsoid.scaleToGeodeticSurface(e._center,e._center);const o={center:e._center,semiMajorAxis:e._semiMajorAxis,semiMinorAxis:e._semiMinorAxis,ellipsoid:e._ellipsoid,rotation:e._rotation,height:t,granularity:e._granularity,numberOfVerticalLines:e._numberOfVerticalLines};let r;if(i)o.extrudedHeight=n,o.offsetAttribute=e._offsetAttribute,r=cdt(o);else if(r=adt(o),l(e._offsetAttribute)){const s=r.attributes.position.values.length,a=e._offsetAttribute===Fn.NONE?0:1,c=new Uint8Array(s/3).fill(a);r.attributes.applyOffset=new Xe({componentDatatype:oe.UNSIGNED_BYTE,componentsPerAttribute:1,values:c})}return new $t({attributes:r.attributes,indices:r.indices,primitiveType:dt.LINES,boundingSphere:r.boundingSphere,offsetAttribute:e._offsetAttribute})};const tse=new k,nse=d.ZERO,ise=new d,ose=new Ee;function ldt(e){this.id=e,this.vertexFormat=void 0,this.center=void 0,this.semiMajorAxis=void 0,this.semiMinorAxis=void 0,this.rotation=void 0,this.height=void 0,this.extrudedHeight=void 0,this.granularity=void 0,this.stRotation=void 0,this.numberOfVerticalLines=void 0,this.offsetAttribute=void 0}function lf(e,t){_n.call(this,{entity:e,scene:t,geometryOptions:new ldt(e),geometryPropertyName:"ellipse",observedPropertyNames:["availability","position","ellipse"]}),this._onEntityPropertyChanged(e,"ellipse",e.ellipse,void 0)}l(Object.create)&&(lf.prototype=Object.create(_n.prototype),lf.prototype.constructor=lf);lf.prototype.createFillGeometryInstance=function(e){if(E.defined("time",e),!this._fillEnabled)throw new w("This instance does not represent a filled geometry.");const t=this._entity,n=t.isAvailable(e),i={show:new pi(n&&t.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),distanceDisplayCondition:Yi.fromDistanceDisplayCondition(this._distanceDisplayConditionProperty.getValue(e)),offset:void 0,color:void 0};if(this._materialProperty instanceof An){let o;l(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(o=this._materialProperty.color.getValue(e,tse)),l(o)||(o=k.WHITE),i.color=Bn.fromColor(o)}return l(this._options.offsetAttribute)&&(i.offset=Ar.fromCartesian3(ie.getValueOrDefault(this._terrainOffsetProperty,e,nse,ise))),new xn({id:t,geometry:new Au(this._options),attributes:i})};lf.prototype.createOutlineGeometryInstance=function(e){if(E.defined("time",e),!this._outlineEnabled)throw new w("This instance does not represent an outlined geometry.");const t=this._entity,n=t.isAvailable(e),i=ie.getValueOrDefault(this._outlineColorProperty,e,k.BLACK,tse),o=this._distanceDisplayConditionProperty.getValue(e),r={show:new pi(n&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:Bn.fromColor(i),distanceDisplayCondition:Yi.fromDistanceDisplayCondition(o),offset:void 0};return l(this._options.offsetAttribute)&&(r.offset=Ar.fromCartesian3(ie.getValueOrDefault(this._terrainOffsetProperty,e,nse,ise))),new xn({id:t,geometry:new lT(this._options),attributes:r})};lf.prototype._computeCenter=function(e,t){return ie.getValueOrUndefined(this._entity.position,e,t)};lf.prototype._isHidden=function(e,t){const n=e.position;return!l(n)||!l(t.semiMajorAxis)||!l(t.semiMinorAxis)||li.prototype._isHidden.call(this,e,t)};lf.prototype._isDynamic=function(e,t){return!e.position.isConstant||!t.semiMajorAxis.isConstant||!t.semiMinorAxis.isConstant||!ie.isConstant(t.rotation)||!ie.isConstant(t.height)||!ie.isConstant(t.extrudedHeight)||!ie.isConstant(t.granularity)||!ie.isConstant(t.stRotation)||!ie.isConstant(t.outlineWidth)||!ie.isConstant(t.numberOfVerticalLines)||!ie.isConstant(t.zIndex)||this._onTerrain&&!ie.isConstant(this._materialProperty)&&!(this._materialProperty instanceof An)};lf.prototype._setStaticOptions=function(e,t){let n=ie.getValueOrUndefined(t.height,wt.MINIMUM_VALUE);const i=ie.getValueOrDefault(t.heightReference,wt.MINIMUM_VALUE,Ht.NONE);let o=ie.getValueOrUndefined(t.extrudedHeight,wt.MINIMUM_VALUE);const r=ie.getValueOrDefault(t.extrudedHeightReference,wt.MINIMUM_VALUE,Ht.NONE);l(o)&&!l(n)&&(n=0);const s=this._options;s.vertexFormat=this._materialProperty instanceof An?kn.VERTEX_FORMAT:Dr.MaterialSupport.TEXTURED.vertexFormat,s.center=e.position.getValue(wt.MINIMUM_VALUE,s.center),s.semiMajorAxis=t.semiMajorAxis.getValue(wt.MINIMUM_VALUE,s.semiMajorAxis),s.semiMinorAxis=t.semiMinorAxis.getValue(wt.MINIMUM_VALUE,s.semiMinorAxis),s.rotation=ie.getValueOrUndefined(t.rotation,wt.MINIMUM_VALUE),s.granularity=ie.getValueOrUndefined(t.granularity,wt.MINIMUM_VALUE),s.stRotation=ie.getValueOrUndefined(t.stRotation,wt.MINIMUM_VALUE),s.numberOfVerticalLines=ie.getValueOrUndefined(t.numberOfVerticalLines,wt.MINIMUM_VALUE),s.offsetAttribute=_n.computeGeometryOffsetAttribute(n,i,o,r),s.height=_n.getGeometryHeight(n,i),o=_n.getGeometryExtrudedHeight(o,r),o===_n.CLAMP_TO_GROUND&&(o=Ro.getMinimumMaximumHeights(Au.computeRectangle(s,ose)).minimumTerrainHeight),s.extrudedHeight=o};lf.DynamicGeometryUpdater=RA;function RA(e,t,n){Mi.call(this,e,t,n)}l(Object.create)&&(RA.prototype=Object.create(Mi.prototype),RA.prototype.constructor=RA);RA.prototype._isHidden=function(e,t,n){const i=this._options;return!l(i.center)||!l(i.semiMajorAxis)||!l(i.semiMinorAxis)||Mi.prototype._isHidden.call(this,e,t,n)};RA.prototype._setOptions=function(e,t,n){const i=this._options;let o=ie.getValueOrUndefined(t.height,n);const r=ie.getValueOrDefault(t.heightReference,n,Ht.NONE);let s=ie.getValueOrUndefined(t.extrudedHeight,n);const a=ie.getValueOrDefault(t.extrudedHeightReference,n,Ht.NONE);l(s)&&!l(o)&&(o=0),i.center=ie.getValueOrUndefined(e.position,n,i.center),i.semiMajorAxis=ie.getValueOrUndefined(t.semiMajorAxis,n),i.semiMinorAxis=ie.getValueOrUndefined(t.semiMinorAxis,n),i.rotation=ie.getValueOrUndefined(t.rotation,n),i.granularity=ie.getValueOrUndefined(t.granularity,n),i.stRotation=ie.getValueOrUndefined(t.stRotation,n),i.numberOfVerticalLines=ie.getValueOrUndefined(t.numberOfVerticalLines,n),i.offsetAttribute=_n.computeGeometryOffsetAttribute(o,r,s,a),i.height=_n.getGeometryHeight(o,r),s=_n.getGeometryExtrudedHeight(s,a),s===_n.CLAMP_TO_GROUND&&(s=Ro.getMinimumMaximumHeights(Au.computeRectangle(i,ose)).minimumTerrainHeight),i.extrudedHeight=s};const udt=new An(k.WHITE),JU=d.ZERO,QU=new d,fdt=new d,ddt=new d,ZU=new k,hdt=new d(1,1,1);function pdt(e){this.id=e,this.vertexFormat=void 0,this.radii=void 0,this.innerRadii=void 0,this.minimumClock=void 0,this.maximumClock=void 0,this.minimumCone=void 0,this.maximumCone=void 0,this.stackPartitions=void 0,this.slicePartitions=void 0,this.subdivisions=void 0,this.offsetAttribute=void 0}function fl(e,t){li.call(this,{entity:e,scene:t,geometryOptions:new pdt(e),geometryPropertyName:"ellipsoid",observedPropertyNames:["availability","position","orientation","ellipsoid"]}),this._onEntityPropertyChanged(e,"ellipsoid",e.ellipsoid,void 0)}l(Object.create)&&(fl.prototype=Object.create(li.prototype),fl.prototype.constructor=fl);Object.defineProperties(fl.prototype,{terrainOffsetProperty:{get:function(){return this._terrainOffsetProperty}}});fl.prototype.createFillGeometryInstance=function(e,t,n){E.defined("time",e);const i=this._entity,o=i.isAvailable(e);let r;const s=new pi(o&&i.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),a=this._distanceDisplayConditionProperty.getValue(e),c=Yi.fromDistanceDisplayCondition(a),u={show:s,distanceDisplayCondition:c,color:void 0,offset:void 0};if(this._materialProperty instanceof An){let f;l(this._materialProperty.color)&&(this._materialProperty.color.isConstant||o)&&(f=this._materialProperty.color.getValue(e,ZU)),l(f)||(f=k.WHITE),r=Bn.fromColor(f),u.color=r}return l(this._options.offsetAttribute)&&(u.offset=Ar.fromCartesian3(ie.getValueOrDefault(this._terrainOffsetProperty,e,JU,QU))),new xn({id:i,geometry:new sl(this._options),modelMatrix:t?void 0:i.computeModelMatrixForHeightReference(e,i.ellipsoid.heightReference,this._options.radii.z*.5,this._scene.mapProjection.ellipsoid,n),attributes:u})};fl.prototype.createOutlineGeometryInstance=function(e,t,n){E.defined("time",e);const i=this._entity,o=i.isAvailable(e),r=ie.getValueOrDefault(this._outlineColorProperty,e,k.BLACK,ZU),s=this._distanceDisplayConditionProperty.getValue(e),a={show:new pi(o&&i.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:Bn.fromColor(r),distanceDisplayCondition:Yi.fromDistanceDisplayCondition(s),offset:void 0};return l(this._options.offsetAttribute)&&(a.offset=Ar.fromCartesian3(ie.getValueOrDefault(this._terrainOffsetProperty,e,JU,QU))),new xn({id:i,geometry:new ml(this._options),modelMatrix:t?void 0:i.computeModelMatrixForHeightReference(e,i.ellipsoid.heightReference,this._options.radii.z*.5,this._scene.mapProjection.ellipsoid,n),attributes:a})};fl.prototype._computeCenter=function(e,t){return ie.getValueOrUndefined(this._entity.position,e,t)};fl.prototype._isHidden=function(e,t){return!l(e.position)||!l(t.radii)||li.prototype._isHidden.call(this,e,t)};fl.prototype._isDynamic=function(e,t){return!e.position.isConstant||!ie.isConstant(e.orientation)||!t.radii.isConstant||!ie.isConstant(t.innerRadii)||!ie.isConstant(t.stackPartitions)||!ie.isConstant(t.slicePartitions)||!ie.isConstant(t.outlineWidth)||!ie.isConstant(t.minimumClock)||!ie.isConstant(t.maximumClock)||!ie.isConstant(t.minimumCone)||!ie.isConstant(t.maximumCone)||!ie.isConstant(t.subdivisions)};fl.prototype._setStaticOptions=function(e,t){const n=ie.getValueOrDefault(t.heightReference,wt.MINIMUM_VALUE,Ht.NONE),i=this._options;i.vertexFormat=this._materialProperty instanceof An?kn.VERTEX_FORMAT:Dr.MaterialSupport.TEXTURED.vertexFormat,i.radii=t.radii.getValue(wt.MINIMUM_VALUE,i.radii),i.innerRadii=ie.getValueOrUndefined(t.innerRadii,i.radii),i.minimumClock=ie.getValueOrUndefined(t.minimumClock,wt.MINIMUM_VALUE),i.maximumClock=ie.getValueOrUndefined(t.maximumClock,wt.MINIMUM_VALUE),i.minimumCone=ie.getValueOrUndefined(t.minimumCone,wt.MINIMUM_VALUE),i.maximumCone=ie.getValueOrUndefined(t.maximumCone,wt.MINIMUM_VALUE),i.stackPartitions=ie.getValueOrUndefined(t.stackPartitions,wt.MINIMUM_VALUE),i.slicePartitions=ie.getValueOrUndefined(t.slicePartitions,wt.MINIMUM_VALUE),i.subdivisions=ie.getValueOrUndefined(t.subdivisions,wt.MINIMUM_VALUE),i.offsetAttribute=n!==Ht.NONE?Fn.ALL:void 0};fl.prototype._onEntityPropertyChanged=iU;fl.DynamicGeometryUpdater=rE;function rE(e,t,n){Mi.call(this,e,t,n),this._scene=e._scene,this._modelMatrix=new N,this._attributes=void 0,this._outlineAttributes=void 0,this._lastSceneMode=void 0,this._lastShow=void 0,this._lastOutlineShow=void 0,this._lastOutlineWidth=void 0,this._lastOutlineColor=void 0,this._lastOffset=new d,this._material={}}l(Object.create)&&(rE.prototype=Object.create(Mi.prototype),rE.prototype.constructor=rE);rE.prototype.update=function(e){E.defined("time",e);const t=this._entity,n=t.ellipsoid;if(!t.isShowing||!t.isAvailable(e)||!ie.getValueOrDefault(n.show,e,!0)){l(this._primitive)&&(this._primitive.show=!1),l(this._outlinePrimitive)&&(this._outlinePrimitive.show=!1);return}const i=ie.getValueOrUndefined(n.radii,e,fdt);let o=l(i)?t.computeModelMatrixForHeightReference(e,n.heightReference,i.z*.5,this._scene.mapProjection.ellipsoid,this._modelMatrix):void 0;if(!l(o)||!l(i)){l(this._primitive)&&(this._primitive.show=!1),l(this._outlinePrimitive)&&(this._outlinePrimitive.show=!1);return}const r=ie.getValueOrDefault(n.fill,e,!0),s=ie.getValueOrDefault(n.outline,e,!1),a=ie.getValueOrClonedDefault(n.outlineColor,e,k.BLACK,ZU),c=ls.getValue(e,A(n.material,udt),this._material),u=ie.getValueOrUndefined(n.innerRadii,e,ddt),f=ie.getValueOrUndefined(n.minimumClock,e),h=ie.getValueOrUndefined(n.maximumClock,e),_=ie.getValueOrUndefined(n.minimumCone,e),g=ie.getValueOrUndefined(n.maximumCone,e),p=ie.getValueOrUndefined(n.stackPartitions,e),y=ie.getValueOrUndefined(n.slicePartitions,e),T=ie.getValueOrUndefined(n.subdivisions,e),b=ie.getValueOrDefault(n.outlineWidth,e,1),x=ie.getValueOrDefault(n.heightReference,e,Ht.NONE),v=x!==Ht.NONE?Fn.ALL:void 0,D=this._scene.mode,L=D===me.SCENE3D&&x===Ht.NONE,B=this._options,V=this._geometryUpdater.shadowsProperty.getValue(e),H=this._geometryUpdater.distanceDisplayConditionProperty.getValue(e),G=ie.getValueOrDefault(this._geometryUpdater.terrainOffsetProperty,e,JU,QU);if(!L||this._lastSceneMode!==D||!l(this._primitive)||B.stackPartitions!==p||B.slicePartitions!==y||l(u)&&!d.equals(B.innerRadii!==u)||B.minimumClock!==f||B.maximumClock!==h||B.minimumCone!==_||B.maximumCone!==g||B.subdivisions!==T||this._lastOutlineWidth!==b||B.offsetAttribute!==v){const O=this._primitives;if(O.removeAndDestroy(this._primitive),O.removeAndDestroy(this._outlinePrimitive),this._primitive=void 0,this._outlinePrimitive=void 0,this._lastSceneMode=D,this._lastOutlineWidth=b,B.stackPartitions=p,B.slicePartitions=y,B.subdivisions=T,B.offsetAttribute=v,B.radii=d.clone(L?hdt:i,B.radii),l(u))if(L){const U=d.magnitude(i);B.innerRadii=d.fromElements(u.x/U,u.y/U,u.z/U,B.innerRadii)}else B.innerRadii=d.clone(u,B.innerRadii);else B.innerRadii=void 0;B.minimumClock=f,B.maximumClock=h,B.minimumCone=_,B.maximumCone=g;const m=new Dr({material:c,translucent:c.isTranslucent(),closed:!0});B.vertexFormat=m.vertexFormat;const P=this._geometryUpdater.createFillGeometryInstance(e,L,this._modelMatrix);this._primitive=O.add(new fn({geometryInstances:P,appearance:m,asynchronous:!1,shadows:V}));const R=this._geometryUpdater.createOutlineGeometryInstance(e,L,this._modelMatrix);this._outlinePrimitive=O.add(new fn({geometryInstances:R,appearance:new kn({flat:!0,translucent:R.attributes.color.value[3]!==255,renderState:{lineWidth:this._geometryUpdater._scene.clampLineWidth(b)}}),asynchronous:!1,shadows:V})),this._lastShow=r,this._lastOutlineShow=s,this._lastOutlineColor=k.clone(a,this._lastOutlineColor),this._lastDistanceDisplayCondition=H,this._lastOffset=d.clone(G,this._lastOffset)}else if(this._primitive.ready){const O=this._primitive,m=this._outlinePrimitive;O.show=!0,m.show=!0,O.appearance.material=c;let P=this._attributes;l(P)||(P=O.getGeometryInstanceAttributes(t),this._attributes=P),r!==this._lastShow&&(P.show=pi.toValue(r,P.show),this._lastShow=r);let R=this._outlineAttributes;l(R)||(R=m.getGeometryInstanceAttributes(t),this._outlineAttributes=R),s!==this._lastOutlineShow&&(R.show=pi.toValue(s,R.show),this._lastOutlineShow=s),k.equals(a,this._lastOutlineColor)||(R.color=Bn.toValue(a,R.color),k.clone(a,this._lastOutlineColor)),sn.equals(H,this._lastDistanceDisplayCondition)||(P.distanceDisplayCondition=Yi.toValue(H,P.distanceDisplayCondition),R.distanceDisplayCondition=Yi.toValue(H,R.distanceDisplayCondition),sn.clone(H,this._lastDistanceDisplayCondition)),d.equals(G,this._lastOffset)||(P.offset=Ar.toValue(G,P.offset),R.offset=Ar.toValue(G,P.offset),d.clone(G,this._lastOffset))}L&&(i.x=Math.max(i.x,.001),i.y=Math.max(i.y,.001),i.z=Math.max(i.z,.001),o=N.multiplyByScale(o,i,o),this._primitive.modelMatrix=o,this._outlinePrimitive.modelMatrix=o)};function uT(e){e=A(e,A.EMPTY_OBJECT);const t=A(e.vertexFormat,Ye.DEFAULT);this._vertexFormat=t,this._workerName="createPlaneGeometry"}uT.packedLength=Ye.packedLength;uT.pack=function(e,t,n){return E.typeOf.object("value",e),E.defined("array",t),n=A(n,0),Ye.pack(e._vertexFormat,t,n),t};const rse=new Ye,mdt={vertexFormat:rse};uT.unpack=function(e,t,n){E.defined("array",e),t=A(t,0);const i=Ye.unpack(e,t,rse);return l(n)?(n._vertexFormat=Ye.clone(i,n._vertexFormat),n):new uT(mdt)};const jv=new d(-.5,-.5,0),Yv=new d(.5,.5,0);uT.createGeometry=function(e){const t=e._vertexFormat,n=new To;let i,o;if(t.position){if(o=new Float64Array(4*3),o[0]=jv.x,o[1]=jv.y,o[2]=0,o[3]=Yv.x,o[4]=jv.y,o[5]=0,o[6]=Yv.x,o[7]=Yv.y,o[8]=0,o[9]=jv.x,o[10]=Yv.y,o[11]=0,n.position=new Xe({componentDatatype:oe.DOUBLE,componentsPerAttribute:3,values:o}),t.normal){const r=new Float32Array(12);r[0]=0,r[1]=0,r[2]=1,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=1,r[9]=0,r[10]=0,r[11]=1,n.normal=new Xe({componentDatatype:oe.FLOAT,componentsPerAttribute:3,values:r})}if(t.st){const r=new Float32Array(8);r[0]=0,r[1]=0,r[2]=1,r[3]=0,r[4]=1,r[5]=1,r[6]=0,r[7]=1,n.st=new Xe({componentDatatype:oe.FLOAT,componentsPerAttribute:2,values:r})}if(t.tangent){const r=new Float32Array(12);r[0]=1,r[1]=0,r[2]=0,r[3]=1,r[4]=0,r[5]=0,r[6]=1,r[7]=0,r[8]=0,r[9]=1,r[10]=0,r[11]=0,n.tangent=new Xe({componentDatatype:oe.FLOAT,componentsPerAttribute:3,values:r})}if(t.bitangent){const r=new Float32Array(12);r[0]=0,r[1]=1,r[2]=0,r[3]=0,r[4]=1,r[5]=0,r[6]=0,r[7]=1,r[8]=0,r[9]=0,r[10]=1,r[11]=0,n.bitangent=new Xe({componentDatatype:oe.FLOAT,componentsPerAttribute:3,values:r})}i=new Uint16Array(2*3),i[0]=0,i[1]=1,i[2]=2,i[3]=0,i[4]=2,i[5]=3}return new $t({attributes:n,indices:i,primitiveType:dt.TRIANGLES,boundingSphere:new Ae(d.ZERO,Math.sqrt(2))})};function fT(){this._workerName="createPlaneOutlineGeometry"}fT.packedLength=0;fT.pack=function(e,t){return E.defined("value",e),E.defined("array",t),t};fT.unpack=function(e,t,n){return E.defined("array",e),l(n)?n:new fT};const om=new d(-.5,-.5,0),$v=new d(.5,.5,0);fT.createGeometry=function(){const e=new To,t=new Uint16Array(4*2),n=new Float64Array(4*3);return n[0]=om.x,n[1]=om.y,n[2]=om.z,n[3]=$v.x,n[4]=om.y,n[5]=om.z,n[6]=$v.x,n[7]=$v.y,n[8]=om.z,n[9]=om.x,n[10]=$v.y,n[11]=om.z,e.position=new Xe({componentDatatype:oe.DOUBLE,componentsPerAttribute:3,values:n}),t[0]=0,t[1]=1,t[2]=1,t[3]=2,t[4]=2,t[5]=3,t[6]=3,t[7]=0,new $t({attributes:e,indices:t,primitiveType:dt.LINES,boundingSphere:new Ae(d.ZERO,Math.sqrt(2))})};const _dt=new d,sse=new k;function gdt(e){this.id=e,this.vertexFormat=void 0,this.plane=void 0,this.dimensions=void 0}function du(e,t){li.call(this,{entity:e,scene:t,geometryOptions:new gdt(e),geometryPropertyName:"plane",observedPropertyNames:["availability","position","orientation","plane"]}),this._onEntityPropertyChanged(e,"plane",e.plane,void 0)}l(Object.create)&&(du.prototype=Object.create(li.prototype),du.prototype.constructor=du);du.prototype.createFillGeometryInstance=function(e){if(E.defined("time",e),!this._fillEnabled)throw new w("This instance does not represent a filled geometry.");const t=this._entity,n=t.isAvailable(e);let i,o;const r=new pi(n&&t.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),s=this._distanceDisplayConditionProperty.getValue(e),a=Yi.fromDistanceDisplayCondition(s);if(this._materialProperty instanceof An){let g;l(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(g=this._materialProperty.color.getValue(e,sse)),l(g)||(g=k.WHITE),o=Bn.fromColor(g),i={show:r,distanceDisplayCondition:a,color:o}}else i={show:r,distanceDisplayCondition:a};const c=t.plane,u=this._options;let f=t.computeModelMatrix(e);const h=ie.getValueOrDefault(c.plane,e,u.plane),_=ie.getValueOrUndefined(c.dimensions,e,u.dimensions);return u.plane=h,u.dimensions=_,f=eH(h,_,f,f),new xn({id:t,geometry:new uT(this._options),modelMatrix:f,attributes:i})};du.prototype.createOutlineGeometryInstance=function(e){if(E.defined("time",e),!this._outlineEnabled)throw new w("This instance does not represent an outlined geometry.");const t=this._entity,n=t.isAvailable(e),i=ie.getValueOrDefault(this._outlineColorProperty,e,k.BLACK,sse),o=this._distanceDisplayConditionProperty.getValue(e),r=t.plane,s=this._options;let a=t.computeModelMatrix(e);const c=ie.getValueOrDefault(r.plane,e,s.plane),u=ie.getValueOrUndefined(r.dimensions,e,s.dimensions);return s.plane=c,s.dimensions=u,a=eH(c,u,a,a),new xn({id:t,geometry:new fT,modelMatrix:a,attributes:{show:new pi(n&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:Bn.fromColor(i),distanceDisplayCondition:Yi.fromDistanceDisplayCondition(o)}})};du.prototype._isHidden=function(e,t){return!l(t.plane)||!l(t.dimensions)||!l(e.position)||li.prototype._isHidden.call(this,e,t)};du.prototype._getIsClosed=function(e){return!1};du.prototype._isDynamic=function(e,t){return!e.position.isConstant||!ie.isConstant(e.orientation)||!t.plane.isConstant||!t.dimensions.isConstant||!ie.isConstant(t.outlineWidth)};du.prototype._setStaticOptions=function(e,t){const n=this._materialProperty instanceof An,i=this._options;i.vertexFormat=n?kn.VERTEX_FORMAT:Dr.MaterialSupport.TEXTURED.vertexFormat,i.plane=t.plane.getValue(wt.MINIMUM_VALUE,i.plane),i.dimensions=t.dimensions.getValue(wt.MINIMUM_VALUE,i.dimensions)};du.DynamicGeometryUpdater=NA;function NA(e,t,n){Mi.call(this,e,t,n)}l(Object.create)&&(NA.prototype=Object.create(Mi.prototype),NA.prototype.constructor=NA);NA.prototype._isHidden=function(e,t,n){const i=this._options,o=ie.getValueOrUndefined(e.position,n,_dt);return!l(o)||!l(i.plane)||!l(i.dimensions)||Mi.prototype._isHidden.call(this,e,t,n)};NA.prototype._setOptions=function(e,t,n){const i=this._options;i.plane=ie.getValueOrDefault(t.plane,n,i.plane),i.dimensions=ie.getValueOrUndefined(t.dimensions,n,i.dimensions)};const ydt=new d,Adt=new d,Tdt=new d,Cdt=new d,bdt=new te,Edt=new te,xdt=new N;function eH(e,t,n,i){const o=e.normal,r=e.distance,s=d.multiplyByScalar(o,-r,Tdt);let a=d.clone(d.UNIT_Z,Adt);F.equalsEpsilon(Math.abs(d.dot(a,o)),1,F.EPSILON8)&&(a=d.clone(d.UNIT_Y,a));const c=d.cross(a,o,ydt);a=d.cross(o,c,a),d.normalize(c,c),d.normalize(a,a);const u=bdt;te.setColumn(u,0,c,u),te.setColumn(u,1,a,u),te.setColumn(u,2,o,u);const f=d.fromElements(t.x,t.y,1,Cdt),h=te.multiplyByScale(u,f,Edt),_=N.fromRotationTranslation(h,s,xdt);return N.multiplyTransformation(n,_,i)}du.createPrimitiveMatrix=eH;const wdt=new d,Sdt=new at,vdt=new $,Ddt=new $,Idt=new d,Pdt=new d,Odt=new d,ib=new d,Ldt=new d,Bdt=new d,Bj=new De,Rdt=new te,Ndt=new te,Mdt=new d;function Fdt(e,t,n,i,o,r,s,a,c){const u=e.positions;let f=wo.triangulate(e.positions2D,e.holes);f.length<3&&(f=[0,1,2]);const h=At.createTypedArray(u.length,f.length);h.set(f);let _=Rdt;if(i!==0){let I=De.fromAxisAngle(s,i,Bj);if(_=te.fromQuaternion(I,_),t.tangent||t.bitangent){I=De.fromAxisAngle(s,-i,Bj);const O=te.fromQuaternion(I,Ndt);a=d.normalize(te.multiplyByVector(O,a,a),a),t.bitangent&&(c=d.normalize(d.cross(s,a,c),c))}}else _=te.clone(te.IDENTITY,_);const g=Ddt;t.st&&(g.x=n.x,g.y=n.y);const p=u.length,y=p*3,T=new Float64Array(y),b=t.normal?new Float32Array(y):void 0,x=t.tangent?new Float32Array(y):void 0,v=t.bitangent?new Float32Array(y):void 0,D=t.st?new Float32Array(p*2):void 0;let L=0,B=0,V=0,M=0,H=0;for(let I=0;I<p;I++){const O=u[I];if(T[L++]=O.x,T[L++]=O.y,T[L++]=O.z,t.st)if(l(o)&&o.positions.length===p)D[H++]=o.positions[I].x,D[H++]=o.positions[I].y;else{const m=te.multiplyByVector(_,O,wdt),P=r(m,vdt);$.subtract(P,g,P);const R=F.clamp(P.x/n.width,0,1),U=F.clamp(P.y/n.height,0,1);D[H++]=R,D[H++]=U}t.normal&&(b[B++]=s.x,b[B++]=s.y,b[B++]=s.z),t.tangent&&(x[M++]=a.x,x[M++]=a.y,x[M++]=a.z),t.bitangent&&(v[V++]=c.x,v[V++]=c.y,v[V++]=c.z)}const G=new To;return t.position&&(G.position=new Xe({componentDatatype:oe.DOUBLE,componentsPerAttribute:3,values:T})),t.normal&&(G.normal=new Xe({componentDatatype:oe.FLOAT,componentsPerAttribute:3,values:b})),t.tangent&&(G.tangent=new Xe({componentDatatype:oe.FLOAT,componentsPerAttribute:3,values:x})),t.bitangent&&(G.bitangent=new Xe({componentDatatype:oe.FLOAT,componentsPerAttribute:3,values:v})),t.st&&(G.st=new Xe({componentDatatype:oe.FLOAT,componentsPerAttribute:2,values:D})),new $t({attributes:G,indices:h,primitiveType:dt.TRIANGLES})}function fy(e){e=A(e,A.EMPTY_OBJECT);const t=e.polygonHierarchy,n=e.textureCoordinates;E.defined("options.polygonHierarchy",t);const i=A(e.vertexFormat,Ye.DEFAULT);this._vertexFormat=Ye.clone(i),this._polygonHierarchy=t,this._stRotation=A(e.stRotation,0),this._ellipsoid=be.clone(A(e.ellipsoid,be.WGS84)),this._workerName="createCoplanarPolygonGeometry",this._textureCoordinates=n,this.packedLength=ci.computeHierarchyPackedLength(t,d)+Ye.packedLength+be.packedLength+(l(n)?ci.computeHierarchyPackedLength(n,$):1)+2}fy.fromPositions=function(e){e=A(e,A.EMPTY_OBJECT),E.defined("options.positions",e.positions);const t={polygonHierarchy:{positions:e.positions},vertexFormat:e.vertexFormat,stRotation:e.stRotation,ellipsoid:e.ellipsoid,textureCoordinates:e.textureCoordinates};return new fy(t)};fy.pack=function(e,t,n){return E.typeOf.object("value",e),E.defined("array",t),n=A(n,0),n=ci.packPolygonHierarchy(e._polygonHierarchy,t,n,d),be.pack(e._ellipsoid,t,n),n+=be.packedLength,Ye.pack(e._vertexFormat,t,n),n+=Ye.packedLength,t[n++]=e._stRotation,l(e._textureCoordinates)?n=ci.packPolygonHierarchy(e._textureCoordinates,t,n,$):t[n++]=-1,t[n++]=e.packedLength,t};const zdt=be.clone(be.UNIT_SPHERE),Udt=new Ye,Hdt={polygonHierarchy:{}};fy.unpack=function(e,t,n){E.defined("array",e),t=A(t,0);const i=ci.unpackPolygonHierarchy(e,t,d);t=i.startingIndex,delete i.startingIndex;const o=be.unpack(e,t,zdt);t+=be.packedLength;const r=Ye.unpack(e,t,Udt);t+=Ye.packedLength;const s=e[t++],a=e[t]===-1?void 0:ci.unpackPolygonHierarchy(e,t,$);l(a)?(t=a.startingIndex,delete a.startingIndex):t++;const c=e[t++];return l(n)||(n=new fy(Hdt)),n._polygonHierarchy=i,n._ellipsoid=be.clone(o,n._ellipsoid),n._vertexFormat=Ye.clone(r,n._vertexFormat),n._stRotation=s,n._textureCoordinates=a,n.packedLength=c,n};fy.createGeometry=function(e){const t=e._vertexFormat,n=e._polygonHierarchy,i=e._stRotation,o=e._textureCoordinates,r=l(o);let s=n.positions;if(s=Ya(s,d.equalsEpsilon,!0),s.length<3)return;let a=Idt,c=Pdt,u=Odt,f=Ldt;const h=Bdt;if(!eI.computeProjectTo2DArguments(s,ib,f,h))return;if(a=d.cross(f,h,a),a=d.normalize(a,a),!d.equalsEpsilon(ib,d.ZERO,F.EPSILON6)){const H=e._ellipsoid.geodeticSurfaceNormal(ib,Mdt);d.dot(a,H)<0&&(a=d.negate(a,a),f=d.negate(f,f))}const g=eI.createProjectPointsTo2DFunction(ib,f,h),p=eI.createProjectPointTo2DFunction(ib,f,h);t.tangent&&(c=d.clone(f,c)),t.bitangent&&(u=d.clone(h,u));const y=ci.polygonsFromHierarchy(n,r,g,!1),T=y.hierarchy,b=y.polygons,x=function(H){return H},v=r?ci.polygonsFromHierarchy(o,!0,x,!1).polygons:void 0;if(T.length===0)return;s=T[0].outerRing;const D=Ae.fromPoints(s),L=ci.computeBoundingRectangle(a,p,s,i,Sdt),B=[];for(let H=0;H<b.length;H++){const G=new xn({geometry:Fdt(b[H],t,L,i,r?v[H]:void 0,p,a,c,u)});B.push(G)}const V=mo.combineInstances(B)[0];V.attributes.position.values=new Float64Array(V.attributes.position.values),V.indices=At.createTypedArray(V.attributes.position.values.length/3,V.indices);const M=V.attributes;return t.position||delete M.position,new $t({attributes:M,indices:V.indices,primitiveType:V.primitiveType,boundingSphere:D})};const Vdt=new ve,Rj=new ve;function kdt(e,t,n,i){const r=i.cartesianToCartographic(e,Vdt).height,s=i.cartesianToCartographic(t,Rj);s.height=r,i.cartographicToCartesian(s,t);const a=i.cartesianToCartographic(n,Rj);a.height=r-100,i.cartographicToCartesian(a,n)}const Gdt=new at,Wdt=new d,qdt=new d,jdt=new d,Ydt=new d,$dt=new d,Xdt=new d;let Xv=new d,Kf=new d,U0=new d;const Kdt=new $,Jdt=new $,Qdt=new d,Nj=new De,Zdt=new te,eht=new te;function RN(e){const t=e.vertexFormat,n=e.geometry,i=e.shadowVolume,o=n.attributes.position.values,r=l(n.attributes.st)?n.attributes.st.values:void 0;let s=o.length;const a=e.wall,c=e.top||a,u=e.bottom||a;if(t.st||t.normal||t.tangent||t.bitangent||i){const f=e.boundingRectangle,h=e.tangentPlane,_=e.ellipsoid,g=e.stRotation,p=e.perPositionHeight,y=Kdt;y.x=f.x,y.y=f.y;const T=t.st?new Float32Array(2*(s/3)):void 0;let b;t.normal&&(p&&c&&!a?b=n.attributes.normal.values:b=new Float32Array(s));const x=t.tangent?new Float32Array(s):void 0,v=t.bitangent?new Float32Array(s):void 0,D=i?new Float32Array(s):void 0;let L=0,B=0,V=qdt,M=jdt,H=Ydt,G=!0,I=Zdt,O=eht;if(g!==0){let R=De.fromAxisAngle(h._plane.normal,g,Nj);I=te.fromQuaternion(R,I),R=De.fromAxisAngle(h._plane.normal,-g,Nj),O=te.fromQuaternion(R,O)}else I=te.clone(te.IDENTITY,I),O=te.clone(te.IDENTITY,O);let m=0,P=0;c&&u&&(m=s/2,P=s/3,s/=2);for(let R=0;R<s;R+=3){const U=d.fromArray(o,R,Qdt);if(t.st&&!l(r)){let W=te.multiplyByVector(I,U,Wdt);W=_.scaleToGeodeticSurface(W,W);const q=h.projectPointOntoPlane(W,Jdt);$.subtract(q,y,q);const Y=F.clamp(q.x/f.width,0,1),j=F.clamp(q.y/f.height,0,1);u&&(T[L+P]=Y,T[L+1+P]=j),c&&(T[L]=Y,T[L+1]=j),L+=2}if(t.normal||t.tangent||t.bitangent||i){const W=B+1,q=B+2;if(a){if(R+3<s){const Y=d.fromArray(o,R+3,$dt);if(G){const j=d.fromArray(o,R+s,Xdt);p&&kdt(U,Y,j,_),d.subtract(Y,U,Y),d.subtract(j,U,j),V=d.normalize(d.cross(j,Y,V),V),G=!1}d.equalsEpsilon(Y,U,F.EPSILON10)&&(G=!0)}(t.tangent||t.bitangent)&&(H=_.geodeticSurfaceNormal(U,H),t.tangent&&(M=d.normalize(d.cross(H,V,M),M)))}else V=_.geodeticSurfaceNormal(U,V),(t.tangent||t.bitangent)&&(p&&(Xv=d.fromArray(b,B,Xv),Kf=d.cross(d.UNIT_Z,Xv,Kf),Kf=d.normalize(te.multiplyByVector(O,Kf,Kf),Kf),t.bitangent&&(U0=d.normalize(d.cross(Xv,Kf,U0),U0))),M=d.cross(d.UNIT_Z,V,M),M=d.normalize(te.multiplyByVector(O,M,M),M),t.bitangent&&(H=d.normalize(d.cross(V,M,H),H)));t.normal&&(e.wall?(b[B+m]=V.x,b[W+m]=V.y,b[q+m]=V.z):u&&(b[B+m]=-V.x,b[W+m]=-V.y,b[q+m]=-V.z),(c&&!p||a)&&(b[B]=V.x,b[W]=V.y,b[q]=V.z)),i&&(a&&(V=_.geodeticSurfaceNormal(U,V)),D[B+m]=-V.x,D[W+m]=-V.y,D[q+m]=-V.z),t.tangent&&(e.wall?(x[B+m]=M.x,x[W+m]=M.y,x[q+m]=M.z):u&&(x[B+m]=-M.x,x[W+m]=-M.y,x[q+m]=-M.z),c&&(p?(x[B]=Kf.x,x[W]=Kf.y,x[q]=Kf.z):(x[B]=M.x,x[W]=M.y,x[q]=M.z))),t.bitangent&&(u&&(v[B+m]=H.x,v[W+m]=H.y,v[q+m]=H.z),c&&(p?(v[B]=U0.x,v[W]=U0.y,v[q]=U0.z):(v[B]=H.x,v[W]=H.y,v[q]=H.z))),B+=3}}t.st&&!l(r)&&(n.attributes.st=new Xe({componentDatatype:oe.FLOAT,componentsPerAttribute:2,values:T})),t.normal&&(n.attributes.normal=new Xe({componentDatatype:oe.FLOAT,componentsPerAttribute:3,values:b})),t.tangent&&(n.attributes.tangent=new Xe({componentDatatype:oe.FLOAT,componentsPerAttribute:3,values:x})),t.bitangent&&(n.attributes.bitangent=new Xe({componentDatatype:oe.FLOAT,componentsPerAttribute:3,values:v})),i&&(n.attributes.extrudeDirection=new Xe({componentDatatype:oe.FLOAT,componentsPerAttribute:3,values:D}))}if(e.extrude&&l(e.offsetAttribute)){const f=o.length/3;let h=new Uint8Array(f);if(e.offsetAttribute===Fn.TOP)c&&u||a?h=h.fill(1,0,f/2):c&&(h=h.fill(1));else{const _=e.offsetAttribute===Fn.NONE?0:1;h=h.fill(_)}n.attributes.applyOffset=new Xe({componentDatatype:oe.UNSIGNED_BYTE,componentsPerAttribute:1,values:h})}return n}const tht=new ve,nht=new ve,rm={westOverIDL:0,eastOverIDL:0};let H0=new fp;function ase(e,t,n,i,o){if(o=A(o,new Ee),!l(e)||e.length<3)return o.west=0,o.north=0,o.south=0,o.east=0,o;if(n===Kn.RHUMB)return Ee.fromCartesianArray(e,t,o);H0.ellipsoid.equals(t)||(H0=new fp(void 0,void 0,t)),o.west=Number.POSITIVE_INFINITY,o.east=Number.NEGATIVE_INFINITY,o.south=Number.POSITIVE_INFINITY,o.north=Number.NEGATIVE_INFINITY,rm.westOverIDL=Number.POSITIVE_INFINITY,rm.eastOverIDL=Number.NEGATIVE_INFINITY;const r=1/F.chordLength(i,t.maximumRadius),s=e.length;let a=t.cartesianToCartographic(e[0],nht),c=tht,u;for(let f=1;f<s;f++)u=c,c=a,a=t.cartesianToCartographic(e[f],u),H0.setEndPoints(c,a),Mj(H0,r,o,rm);return u=c,c=a,a=t.cartesianToCartographic(e[0],u),H0.setEndPoints(c,a),Mj(H0,r,o,rm),o.east-o.west>rm.eastOverIDL-rm.westOverIDL&&(o.west=rm.westOverIDL,o.east=rm.eastOverIDL,o.east>F.PI&&(o.east=o.east-F.TWO_PI),o.west>F.PI&&(o.west=o.west-F.TWO_PI)),o}const iht=new ve;function Mj(e,t,n,i){const o=e.surfaceDistance,r=Math.ceil(o*t),s=r>0?o/(r-1):Number.POSITIVE_INFINITY;let a=0;for(let c=0;c<r;c++){const u=e.interpolateUsingSurfaceDistance(a,iht);a+=s;const f=u.longitude,h=u.latitude;n.west=Math.min(n.west,f),n.east=Math.max(n.east,f),n.south=Math.min(n.south,h),n.north=Math.max(n.north,h);const _=f>=0?f:f+F.TWO_PI;i.westOverIDL=Math.min(i.westOverIDL,_),i.eastOverIDL=Math.max(i.eastOverIDL,_)}}const Fj=[];function oht(e,t,n,i,o,r,s,a,c,u){const f={walls:[]};let h;if(s||a){const x=ci.createGeometryFromPositions(e,t,n,i,r,c,u),v=x.attributes.position.values,D=x.indices;let L,B;if(s&&a){const V=v.concat(v);L=V.length/3,B=At.createTypedArray(L,D.length*2),B.set(D);const M=D.length,H=L/2;for(h=0;h<M;h+=3){const G=B[h]+H,I=B[h+1]+H,O=B[h+2]+H;B[h+M]=O,B[h+1+M]=I,B[h+2+M]=G}if(x.attributes.position.values=V,r&&c.normal){const G=x.attributes.normal.values;x.attributes.normal.values=new Float32Array(V.length),x.attributes.normal.values.set(G)}if(c.st&&l(n)){const G=x.attributes.st.values;x.attributes.st.values=new Float32Array(L*2),x.attributes.st.values=G.concat(G)}x.indices=B}else if(a){for(L=v.length/3,B=At.createTypedArray(L,D.length),h=0;h<D.length;h+=3)B[h]=D[h+2],B[h+1]=D[h+1],B[h+2]=D[h];x.indices=B}f.topAndBottom=new xn({geometry:x})}let _=o.outerRing,g=Ks.fromPoints(_,e),p=g.projectPointsOntoPlane(_,Fj),y=wo.computeWindingOrder2D(p);y===pu.CLOCKWISE&&(_=_.slice().reverse());let T=ci.computeWallGeometry(_,n,e,i,r,u);f.walls.push(new xn({geometry:T}));const b=o.holes;for(h=0;h<b.length;h++){let x=b[h];g=Ks.fromPoints(x,e),p=g.projectPointsOntoPlane(x,Fj),y=wo.computeWindingOrder2D(p),y===pu.COUNTER_CLOCKWISE&&(x=x.slice().reverse()),T=ci.computeWallGeometry(x,n,e,i,r,u),f.walls.push(new xn({geometry:T}))}return f}function bl(e){if(E.typeOf.object("options",e),E.typeOf.object("options.polygonHierarchy",e.polygonHierarchy),l(e.perPositionHeight)&&e.perPositionHeight&&l(e.height))throw new w("Cannot use both options.perPositionHeight and options.height");if(l(e.arcType)&&e.arcType!==Kn.GEODESIC&&e.arcType!==Kn.RHUMB)throw new w("Invalid arcType. Valid options are ArcType.GEODESIC and ArcType.RHUMB.");const t=e.polygonHierarchy,n=A(e.vertexFormat,Ye.DEFAULT),i=A(e.ellipsoid,be.WGS84),o=A(e.granularity,F.RADIANS_PER_DEGREE),r=A(e.stRotation,0),s=e.textureCoordinates,a=A(e.perPositionHeight,!1),c=a&&l(e.extrudedHeight);let u=A(e.height,0),f=A(e.extrudedHeight,u);if(!c){const h=Math.max(u,f);f=Math.min(u,f),u=h}this._vertexFormat=Ye.clone(n),this._ellipsoid=be.clone(i),this._granularity=o,this._stRotation=r,this._height=u,this._extrudedHeight=f,this._closeTop=A(e.closeTop,!0),this._closeBottom=A(e.closeBottom,!0),this._polygonHierarchy=t,this._perPositionHeight=a,this._perPositionHeightExtrude=c,this._shadowVolume=A(e.shadowVolume,!1),this._workerName="createPolygonGeometry",this._offsetAttribute=e.offsetAttribute,this._arcType=A(e.arcType,Kn.GEODESIC),this._rectangle=void 0,this._textureCoordinateRotationPoints=void 0,this._textureCoordinates=s,this.packedLength=ci.computeHierarchyPackedLength(t,d)+be.packedLength+Ye.packedLength+(s?ci.computeHierarchyPackedLength(s,$):1)+12}bl.fromPositions=function(e){e=A(e,A.EMPTY_OBJECT),E.defined("options.positions",e.positions);const t={polygonHierarchy:{positions:e.positions},height:e.height,extrudedHeight:e.extrudedHeight,vertexFormat:e.vertexFormat,stRotation:e.stRotation,ellipsoid:e.ellipsoid,granularity:e.granularity,perPositionHeight:e.perPositionHeight,closeTop:e.closeTop,closeBottom:e.closeBottom,offsetAttribute:e.offsetAttribute,arcType:e.arcType,textureCoordinates:e.textureCoordinates};return new bl(t)};bl.pack=function(e,t,n){return E.typeOf.object("value",e),E.defined("array",t),n=A(n,0),n=ci.packPolygonHierarchy(e._polygonHierarchy,t,n,d),be.pack(e._ellipsoid,t,n),n+=be.packedLength,Ye.pack(e._vertexFormat,t,n),n+=Ye.packedLength,t[n++]=e._height,t[n++]=e._extrudedHeight,t[n++]=e._granularity,t[n++]=e._stRotation,t[n++]=e._perPositionHeightExtrude?1:0,t[n++]=e._perPositionHeight?1:0,t[n++]=e._closeTop?1:0,t[n++]=e._closeBottom?1:0,t[n++]=e._shadowVolume?1:0,t[n++]=A(e._offsetAttribute,-1),t[n++]=e._arcType,l(e._textureCoordinates)?n=ci.packPolygonHierarchy(e._textureCoordinates,t,n,$):t[n++]=-1,t[n++]=e.packedLength,t};const rht=be.clone(be.UNIT_SPHERE),sht=new Ye,aht={polygonHierarchy:{}};bl.unpack=function(e,t,n){E.defined("array",e),t=A(t,0);const i=ci.unpackPolygonHierarchy(e,t,d);t=i.startingIndex,delete i.startingIndex;const o=be.unpack(e,t,rht);t+=be.packedLength;const r=Ye.unpack(e,t,sht);t+=Ye.packedLength;const s=e[t++],a=e[t++],c=e[t++],u=e[t++],f=e[t++]===1,h=e[t++]===1,_=e[t++]===1,g=e[t++]===1,p=e[t++]===1,y=e[t++],T=e[t++],b=e[t]===-1?void 0:ci.unpackPolygonHierarchy(e,t,$);l(b)?(t=b.startingIndex,delete b.startingIndex):t++;const x=e[t++];return l(n)||(n=new bl(aht)),n._polygonHierarchy=i,n._ellipsoid=be.clone(o,n._ellipsoid),n._vertexFormat=Ye.clone(r,n._vertexFormat),n._height=s,n._extrudedHeight=a,n._granularity=c,n._stRotation=u,n._perPositionHeightExtrude=f,n._perPositionHeight=h,n._closeTop=_,n._closeBottom=g,n._shadowVolume=p,n._offsetAttribute=y===-1?void 0:y,n._arcType=T,n._textureCoordinates=b,n.packedLength=x,n};bl.computeRectangle=function(e,t){E.typeOf.object("options",e),E.typeOf.object("options.polygonHierarchy",e.polygonHierarchy);const n=A(e.granularity,F.RADIANS_PER_DEGREE),i=A(e.arcType,Kn.GEODESIC);if(i!==Kn.GEODESIC&&i!==Kn.RHUMB)throw new w("Invalid arcType. Valid options are ArcType.GEODESIC and ArcType.RHUMB.");const o=e.polygonHierarchy,r=A(e.ellipsoid,be.WGS84);return ase(o.positions,r,i,n,t)};bl.createGeometry=function(e){const t=e._vertexFormat,n=e._ellipsoid,i=e._granularity,o=e._stRotation,r=e._polygonHierarchy,s=e._perPositionHeight,a=e._closeTop,c=e._closeBottom,u=e._arcType,f=e._textureCoordinates,h=l(f);let _=r.positions;if(_.length<3)return;const g=Ks.fromPoints(_,n),p=ci.polygonsFromHierarchy(r,h,g.projectPointsOntoPlane.bind(g),!s,n),y=p.hierarchy,T=p.polygons,b=function(m){return m},x=h?ci.polygonsFromHierarchy(f,!0,b,!1).polygons:void 0;if(y.length===0)return;_=y[0].outerRing;const v=ci.computeBoundingRectangle(g.plane.normal,g.projectPointOntoPlane.bind(g),_,o,Gdt),D=[],L=e._height,B=e._extrudedHeight,V=e._perPositionHeightExtrude||!F.equalsEpsilon(L,B,0,F.EPSILON2),M={perPositionHeight:s,vertexFormat:t,geometry:void 0,tangentPlane:g,boundingRectangle:v,ellipsoid:n,stRotation:o,textureCoordinates:void 0,bottom:!1,top:!0,wall:!1,extrude:!1,arcType:u};let H;if(V)for(M.extrude=!0,M.top=a,M.bottom=c,M.shadowVolume=e._shadowVolume,M.offsetAttribute=e._offsetAttribute,H=0;H<T.length;H++){const m=oht(n,T[H],h?x[H]:void 0,i,y[H],s,a,c,t,u);let P;a&&c?(P=m.topAndBottom,M.geometry=ci.scaleToGeodeticHeightExtruded(P.geometry,L,B,n,s)):a?(P=m.topAndBottom,P.geometry.attributes.position.values=wo.scaleToGeodeticHeight(P.geometry.attributes.position.values,L,n,!s),M.geometry=P.geometry):c&&(P=m.topAndBottom,P.geometry.attributes.position.values=wo.scaleToGeodeticHeight(P.geometry.attributes.position.values,B,n,!0),M.geometry=P.geometry),(a||c)&&(M.wall=!1,P.geometry=RN(M),D.push(P));const R=m.walls;M.wall=!0;for(let U=0;U<R.length;U++){const W=R[U];M.geometry=ci.scaleToGeodeticHeightExtruded(W.geometry,L,B,n,s),W.geometry=RN(M),D.push(W)}}else for(H=0;H<T.length;H++){const m=new xn({geometry:ci.createGeometryFromPositions(n,T[H],h?x[H]:void 0,i,s,t,u)});if(m.geometry.attributes.position.values=wo.scaleToGeodeticHeight(m.geometry.attributes.position.values,L,n,!s),M.geometry=m.geometry,m.geometry=RN(M),l(e._offsetAttribute)){const P=m.geometry.attributes.position.values.length,R=e._offsetAttribute===Fn.NONE?0:1,U=new Uint8Array(P/3).fill(R);m.geometry.attributes.applyOffset=new Xe({componentDatatype:oe.UNSIGNED_BYTE,componentsPerAttribute:1,values:U})}D.push(m)}const G=mo.combineInstances(D)[0];G.attributes.position.values=new Float64Array(G.attributes.position.values),G.indices=At.createTypedArray(G.attributes.position.values.length/3,G.indices);const I=G.attributes,O=Ae.fromVertices(I.position.values);return t.position||delete I.position,new $t({attributes:I,indices:G.indices,primitiveType:G.primitiveType,boundingSphere:O,offsetAttribute:e._offsetAttribute})};bl.createShadowVolume=function(e,t,n){const i=e._granularity,o=e._ellipsoid,r=t(i,o),s=n(i,o);return new bl({polygonHierarchy:e._polygonHierarchy,ellipsoid:o,stRotation:e._stRotation,granularity:i,perPositionHeight:!1,extrudedHeight:r,height:s,vertexFormat:Ye.POSITION_ONLY,shadowVolume:!0,arcType:e._arcType})};function cht(e){const t=-e._stRotation;if(t===0)return[0,0,0,1,1,0];const n=e._ellipsoid,i=e._polygonHierarchy.positions,o=e.rectangle;return $t._textureCoordinateRotationPoints(i,t,n,o)}Object.defineProperties(bl.prototype,{rectangle:{get:function(){if(!l(this._rectangle)){const e=this._polygonHierarchy.positions;this._rectangle=ase(e,this._ellipsoid,this._arcType,this._granularity)}return this._rectangle}},textureCoordinateRotationPoints:{get:function(){return l(this._textureCoordinateRotationPoints)||(this._textureCoordinateRotationPoints=cht(this)),this._textureCoordinateRotationPoints}}});const cse=[],p1=[];function lht(e,t,n,i,o){const s=Ks.fromPoints(t,e).projectPointsOntoPlane(t,cse);wo.computeWindingOrder2D(s)===pu.CLOCKWISE&&(s.reverse(),t=t.slice().reverse());let c,u,f=t.length,h=0;if(i)for(c=new Float64Array(f*2*3),u=0;u<f;u++){const p=t[u],y=t[(u+1)%f];c[h++]=p.x,c[h++]=p.y,c[h++]=p.z,c[h++]=y.x,c[h++]=y.y,c[h++]=y.z}else{let p=0;if(o===Kn.GEODESIC)for(u=0;u<f;u++)p+=ci.subdivideLineCount(t[u],t[(u+1)%f],n);else if(o===Kn.RHUMB)for(u=0;u<f;u++)p+=ci.subdivideRhumbLineCount(e,t[u],t[(u+1)%f],n);for(c=new Float64Array(p*3),u=0;u<f;u++){let y;o===Kn.GEODESIC?y=ci.subdivideLine(t[u],t[(u+1)%f],n,p1):o===Kn.RHUMB&&(y=ci.subdivideRhumbLine(e,t[u],t[(u+1)%f],n,p1));const T=y.length;for(let b=0;b<T;++b)c[h++]=y[b]}}f=c.length/3;const _=f*2,g=At.createTypedArray(f,_);for(h=0,u=0;u<f-1;u++)g[h++]=u,g[h++]=u+1;return g[h++]=f-1,g[h++]=0,new xn({geometry:new $t({attributes:new To({position:new Xe({componentDatatype:oe.DOUBLE,componentsPerAttribute:3,values:c})}),indices:g,primitiveType:dt.LINES})})}function uht(e,t,n,i,o){const s=Ks.fromPoints(t,e).projectPointsOntoPlane(t,cse);wo.computeWindingOrder2D(s)===pu.CLOCKWISE&&(s.reverse(),t=t.slice().reverse());let c,u,f=t.length;const h=new Array(f);let _=0;if(i)for(c=new Float64Array(f*2*3*2),u=0;u<f;++u){h[u]=_/3;const T=t[u],b=t[(u+1)%f];c[_++]=T.x,c[_++]=T.y,c[_++]=T.z,c[_++]=b.x,c[_++]=b.y,c[_++]=b.z}else{let T=0;if(o===Kn.GEODESIC)for(u=0;u<f;u++)T+=ci.subdivideLineCount(t[u],t[(u+1)%f],n);else if(o===Kn.RHUMB)for(u=0;u<f;u++)T+=ci.subdivideRhumbLineCount(e,t[u],t[(u+1)%f],n);for(c=new Float64Array(T*3*2),u=0;u<f;++u){h[u]=_/3;let b;o===Kn.GEODESIC?b=ci.subdivideLine(t[u],t[(u+1)%f],n,p1):o===Kn.RHUMB&&(b=ci.subdivideRhumbLine(e,t[u],t[(u+1)%f],n,p1));const x=b.length;for(let v=0;v<x;++v)c[_++]=b[v]}}f=c.length/(3*2);const g=h.length,p=(f*2+g)*2,y=At.createTypedArray(f+g,p);for(_=0,u=0;u<f;++u)y[_++]=u,y[_++]=(u+1)%f,y[_++]=u+f,y[_++]=(u+1)%f+f;for(u=0;u<g;u++){const T=h[u];y[_++]=T,y[_++]=T+f}return new xn({geometry:new $t({attributes:new To({position:new Xe({componentDatatype:oe.DOUBLE,componentsPerAttribute:3,values:c})}),indices:y,primitiveType:dt.LINES})})}function dy(e){if(E.typeOf.object("options",e),E.typeOf.object("options.polygonHierarchy",e.polygonHierarchy),e.perPositionHeight&&l(e.height))throw new w("Cannot use both options.perPositionHeight and options.height");if(l(e.arcType)&&e.arcType!==Kn.GEODESIC&&e.arcType!==Kn.RHUMB)throw new w("Invalid arcType. Valid options are ArcType.GEODESIC and ArcType.RHUMB.");const t=e.polygonHierarchy,n=A(e.ellipsoid,be.WGS84),i=A(e.granularity,F.RADIANS_PER_DEGREE),o=A(e.perPositionHeight,!1),r=o&&l(e.extrudedHeight),s=A(e.arcType,Kn.GEODESIC);let a=A(e.height,0),c=A(e.extrudedHeight,a);if(!r){const u=Math.max(a,c);c=Math.min(a,c),a=u}this._ellipsoid=be.clone(n),this._granularity=i,this._height=a,this._extrudedHeight=c,this._arcType=s,this._polygonHierarchy=t,this._perPositionHeight=o,this._perPositionHeightExtrude=r,this._offsetAttribute=e.offsetAttribute,this._workerName="createPolygonOutlineGeometry",this.packedLength=ci.computeHierarchyPackedLength(t,d)+be.packedLength+8}dy.pack=function(e,t,n){return E.typeOf.object("value",e),E.defined("array",t),n=A(n,0),n=ci.packPolygonHierarchy(e._polygonHierarchy,t,n,d),be.pack(e._ellipsoid,t,n),n+=be.packedLength,t[n++]=e._height,t[n++]=e._extrudedHeight,t[n++]=e._granularity,t[n++]=e._perPositionHeightExtrude?1:0,t[n++]=e._perPositionHeight?1:0,t[n++]=e._arcType,t[n++]=A(e._offsetAttribute,-1),t[n]=e.packedLength,t};const fht=be.clone(be.UNIT_SPHERE),dht={polygonHierarchy:{}};dy.unpack=function(e,t,n){E.defined("array",e),t=A(t,0);const i=ci.unpackPolygonHierarchy(e,t,d);t=i.startingIndex,delete i.startingIndex;const o=be.unpack(e,t,fht);t+=be.packedLength;const r=e[t++],s=e[t++],a=e[t++],c=e[t++]===1,u=e[t++]===1,f=e[t++],h=e[t++],_=e[t];return l(n)||(n=new dy(dht)),n._polygonHierarchy=i,n._ellipsoid=be.clone(o,n._ellipsoid),n._height=r,n._extrudedHeight=s,n._granularity=a,n._perPositionHeight=u,n._perPositionHeightExtrude=c,n._arcType=f,n._offsetAttribute=h===-1?void 0:h,n.packedLength=_,n};dy.fromPositions=function(e){e=A(e,A.EMPTY_OBJECT),E.defined("options.positions",e.positions);const t={polygonHierarchy:{positions:e.positions},height:e.height,extrudedHeight:e.extrudedHeight,ellipsoid:e.ellipsoid,granularity:e.granularity,perPositionHeight:e.perPositionHeight,arcType:e.arcType,offsetAttribute:e.offsetAttribute};return new dy(t)};dy.createGeometry=function(e){const t=e._ellipsoid,n=e._granularity,i=e._polygonHierarchy,o=e._perPositionHeight,r=e._arcType,s=ci.polygonOutlinesFromHierarchy(i,!o,t);if(s.length===0)return;let a;const c=[],u=F.chordLength(n,t.maximumRadius),f=e._height,h=e._extrudedHeight,_=e._perPositionHeightExtrude||!F.equalsEpsilon(f,h,0,F.EPSILON2);let g,p;if(_)for(p=0;p<s.length;p++){if(a=uht(t,s[p],u,o,r),a.geometry=ci.scaleToGeodeticHeightExtruded(a.geometry,f,h,t,o),l(e._offsetAttribute)){const b=a.geometry.attributes.position.values.length/3;let x=new Uint8Array(b);e._offsetAttribute===Fn.TOP?x=x.fill(1,0,b/2):(g=e._offsetAttribute===Fn.NONE?0:1,x=x.fill(g)),a.geometry.attributes.applyOffset=new Xe({componentDatatype:oe.UNSIGNED_BYTE,componentsPerAttribute:1,values:x})}c.push(a)}else for(p=0;p<s.length;p++){if(a=lht(t,s[p],u,o,r),a.geometry.attributes.position.values=wo.scaleToGeodeticHeight(a.geometry.attributes.position.values,f,t,!o),l(e._offsetAttribute)){const b=a.geometry.attributes.position.values.length;g=e._offsetAttribute===Fn.NONE?0:1;const x=new Uint8Array(b/3).fill(g);a.geometry.attributes.applyOffset=new Xe({componentDatatype:oe.UNSIGNED_BYTE,componentsPerAttribute:1,values:x})}c.push(a)}const y=mo.combineInstances(c)[0],T=Ae.fromVertices(y.attributes.position.values);return new $t({attributes:y.attributes,indices:y.indices,primitiveType:y.primitiveType,boundingSphere:T,offsetAttribute:e._offsetAttribute})};const lse="Entity polygons cannot have both height and perPositionHeight. height will be ignored",use="heightReference is not supported for entity polygons with perPositionHeight. heightReference will be ignored",fse=new k,dse=d.ZERO,hse=new d,pse=new Ee,hht=[],pht=new $;function mht(e){this.id=e,this.vertexFormat=void 0,this.polygonHierarchy=void 0,this.perPositionHeight=void 0,this.closeTop=void 0,this.closeBottom=void 0,this.height=void 0,this.extrudedHeight=void 0,this.granularity=void 0,this.stRotation=void 0,this.offsetAttribute=void 0,this.arcType=void 0,this.textureCoordinates=void 0}function dl(e,t){_n.call(this,{entity:e,scene:t,geometryOptions:new mht(e),geometryPropertyName:"polygon",observedPropertyNames:["availability","polygon"]}),this._onEntityPropertyChanged(e,"polygon",e.polygon,void 0)}l(Object.create)&&(dl.prototype=Object.create(_n.prototype),dl.prototype.constructor=dl);dl.prototype.createFillGeometryInstance=function(e){if(E.defined("time",e),!this._fillEnabled)throw new w("This instance does not represent a filled geometry.");const t=this._entity,n=t.isAvailable(e),i=this._options,o={show:new pi(n&&t.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),distanceDisplayCondition:Yi.fromDistanceDisplayCondition(this._distanceDisplayConditionProperty.getValue(e)),offset:void 0,color:void 0};if(this._materialProperty instanceof An){let s;l(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(s=this._materialProperty.color.getValue(e,fse)),l(s)||(s=k.WHITE),o.color=Bn.fromColor(s)}l(i.offsetAttribute)&&(o.offset=Ar.fromCartesian3(ie.getValueOrDefault(this._terrainOffsetProperty,e,dse,hse)));let r;return i.perPositionHeight&&!l(i.extrudedHeight)?r=new fy(i):r=new bl(i),new xn({id:t,geometry:r,attributes:o})};dl.prototype.createOutlineGeometryInstance=function(e){if(E.defined("time",e),!this._outlineEnabled)throw new w("This instance does not represent an outlined geometry.");const t=this._entity,n=t.isAvailable(e),i=this._options,o=ie.getValueOrDefault(this._outlineColorProperty,e,k.BLACK,fse),r=this._distanceDisplayConditionProperty.getValue(e),s={show:new pi(n&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:Bn.fromColor(o),distanceDisplayCondition:Yi.fromDistanceDisplayCondition(r),offset:void 0};l(i.offsetAttribute)&&(s.offset=Ar.fromCartesian3(ie.getValueOrDefault(this._terrainOffsetProperty,e,dse,hse)));let a;return i.perPositionHeight&&!l(i.extrudedHeight)?a=new Zc(i):a=new dy(i),new xn({id:t,geometry:a,attributes:s})};dl.prototype._computeCenter=function(e,t){const n=ie.getValueOrUndefined(this._entity.polygon.hierarchy,e);if(!l(n))return;const i=n.positions;if(i.length===0)return;const o=this._scene.mapProjection.ellipsoid,r=Ks.fromPoints(i,o),s=r.projectPointsOntoPlane(i,hht),a=s.length;let c=0,u=a-1,f=new $;for(let _=0;_<a;u=_++){const g=s[_],p=s[u],y=g.x*p.y-p.x*g.y;let T=$.add(g,p,pht);T=$.multiplyByScalar(T,y,T),f=$.add(f,T,f),c+=y}const h=1/(c*3);return f=$.multiplyByScalar(f,h,f),r.projectPointOntoEllipsoid(f,t)};dl.prototype._isHidden=function(e,t){return!l(t.hierarchy)||li.prototype._isHidden.call(this,e,t)};dl.prototype._isOnTerrain=function(e,t){const n=_n.prototype._isOnTerrain.call(this,e,t),i=t.perPositionHeight,o=l(i)&&(i.isConstant?i.getValue(wt.MINIMUM_VALUE):!0);return n&&!o};dl.prototype._isDynamic=function(e,t){return!t.hierarchy.isConstant||!ie.isConstant(t.height)||!ie.isConstant(t.extrudedHeight)||!ie.isConstant(t.granularity)||!ie.isConstant(t.stRotation)||!ie.isConstant(t.textureCoordinates)||!ie.isConstant(t.outlineWidth)||!ie.isConstant(t.perPositionHeight)||!ie.isConstant(t.closeTop)||!ie.isConstant(t.closeBottom)||!ie.isConstant(t.zIndex)||!ie.isConstant(t.arcType)||this._onTerrain&&!ie.isConstant(this._materialProperty)&&!(this._materialProperty instanceof An)};dl.prototype._setStaticOptions=function(e,t){const n=this._materialProperty instanceof An,i=this._options;i.vertexFormat=n?kn.VERTEX_FORMAT:Dr.MaterialSupport.TEXTURED.vertexFormat;const o=t.hierarchy.getValue(wt.MINIMUM_VALUE);let r=ie.getValueOrUndefined(t.height,wt.MINIMUM_VALUE);const s=ie.getValueOrDefault(t.heightReference,wt.MINIMUM_VALUE,Ht.NONE);let a=ie.getValueOrUndefined(t.extrudedHeight,wt.MINIMUM_VALUE);const c=ie.getValueOrDefault(t.extrudedHeightReference,wt.MINIMUM_VALUE,Ht.NONE),u=ie.getValueOrDefault(t.perPositionHeight,wt.MINIMUM_VALUE,!1);r=_n.getGeometryHeight(r,s);let f;u?(l(r)&&(r=void 0,uo(lse)),s!==Ht.NONE&&u&&(r=void 0,uo(use))):(l(a)&&!l(r)&&(r=0),f=_n.computeGeometryOffsetAttribute(r,s,a,c)),i.polygonHierarchy=o,i.granularity=ie.getValueOrUndefined(t.granularity,wt.MINIMUM_VALUE),i.stRotation=ie.getValueOrUndefined(t.stRotation,wt.MINIMUM_VALUE),i.perPositionHeight=u,i.closeTop=ie.getValueOrDefault(t.closeTop,wt.MINIMUM_VALUE,!0),i.closeBottom=ie.getValueOrDefault(t.closeBottom,wt.MINIMUM_VALUE,!0),i.offsetAttribute=f,i.height=r,i.arcType=ie.getValueOrDefault(t.arcType,wt.MINIMUM_VALUE,Kn.GEODESIC),i.textureCoordinates=ie.getValueOrUndefined(t.textureCoordinates,wt.MINIMUM_VALUE),a=_n.getGeometryExtrudedHeight(a,c),a===_n.CLAMP_TO_GROUND&&(a=Ro.getMinimumMaximumHeights(bl.computeRectangle(i,pse)).minimumTerrainHeight),i.extrudedHeight=a};dl.prototype._getIsClosed=function(e){const t=e.height,n=e.extrudedHeight,i=l(n)&&n!==t;return!e.perPositionHeight&&(!i&&t===0||i&&e.closeTop&&e.closeBottom)};dl.DynamicGeometryUpdater=MA;function MA(e,t,n){Mi.call(this,e,t,n)}l(Object.create)&&(MA.prototype=Object.create(Mi.prototype),MA.prototype.constructor=MA);MA.prototype._isHidden=function(e,t,n){return!l(this._options.polygonHierarchy)||Mi.prototype._isHidden.call(this,e,t,n)};MA.prototype._setOptions=function(e,t,n){const i=this._options;i.polygonHierarchy=ie.getValueOrUndefined(t.hierarchy,n);let o=ie.getValueOrUndefined(t.height,n);const r=ie.getValueOrDefault(t.heightReference,n,Ht.NONE),s=ie.getValueOrDefault(t.extrudedHeightReference,n,Ht.NONE);let a=ie.getValueOrUndefined(t.extrudedHeight,n);const c=ie.getValueOrUndefined(t.perPositionHeight,n);o=_n.getGeometryHeight(o,s);let u;c?(l(o)&&(o=void 0,uo(lse)),r!==Ht.NONE&&c&&(o=void 0,uo(use))):(l(a)&&!l(o)&&(o=0),u=_n.computeGeometryOffsetAttribute(o,r,a,s)),i.granularity=ie.getValueOrUndefined(t.granularity,n),i.stRotation=ie.getValueOrUndefined(t.stRotation,n),i.textureCoordinates=ie.getValueOrUndefined(t.textureCoordinates,n),i.perPositionHeight=ie.getValueOrUndefined(t.perPositionHeight,n),i.closeTop=ie.getValueOrDefault(t.closeTop,n,!0),i.closeBottom=ie.getValueOrDefault(t.closeBottom,n,!0),i.offsetAttribute=u,i.height=o,i.arcType=ie.getValueOrDefault(t.arcType,n,Kn.GEODESIC),a=_n.getGeometryExtrudedHeight(a,s),a===_n.CLAMP_TO_GROUND&&(a=Ro.getMinimumMaximumHeights(bl.computeRectangle(i,pse)).minimumTerrainHeight),i.extrudedHeight=a};function _ht(e,t,n,i){const o=new To;i.position&&(o.position=new Xe({componentDatatype:oe.DOUBLE,componentsPerAttribute:3,values:e}));const r=t.length,s=e.length/3,a=(s-r*2)/(r*2),c=wo.triangulate(t),u=(a-1)*r*6+c.length*2,f=At.createTypedArray(s,u);let h,_,g,p,y,T;const b=r*2;let x=0;for(h=0;h<a-1;h++){for(_=0;_<r-1;_++)g=_*2+h*r*2,T=g+b,p=g+1,y=p+b,f[x++]=p,f[x++]=g,f[x++]=y,f[x++]=y,f[x++]=g,f[x++]=T;g=r*2-2+h*r*2,p=g+1,y=p+b,T=g+b,f[x++]=p,f[x++]=g,f[x++]=y,f[x++]=y,f[x++]=g,f[x++]=T}if(i.st||i.tangent||i.bitangent){const L=new Float32Array(s*2),B=1/(a-1),V=1/n.height,M=n.height/2;let H,G,I=0;for(h=0;h<a;h++){for(H=h*B,G=V*(t[0].y+M),L[I++]=H,L[I++]=G,_=1;_<r;_++)G=V*(t[_].y+M),L[I++]=H,L[I++]=G,L[I++]=H,L[I++]=G;G=V*(t[0].y+M),L[I++]=H,L[I++]=G}for(_=0;_<r;_++)H=0,G=V*(t[_].y+M),L[I++]=H,L[I++]=G;for(_=0;_<r;_++)H=(a-1)*B,G=V*(t[_].y+M),L[I++]=H,L[I++]=G;o.st=new Xe({componentDatatype:oe.FLOAT,componentsPerAttribute:2,values:new Float32Array(L)})}const v=s-r*2;for(h=0;h<c.length;h+=3){const L=c[h]+v,B=c[h+1]+v,V=c[h+2]+v;f[x++]=L,f[x++]=B,f[x++]=V,f[x++]=V+r,f[x++]=B+r,f[x++]=L+r}let D=new $t({attributes:o,indices:f,boundingSphere:Ae.fromVertices(e),primitiveType:dt.TRIANGLES});if(i.normal&&(D=mo.computeNormal(D)),i.tangent||i.bitangent){try{D=mo.computeTangentAndBitangent(D)}catch{uo("polyline-volume-tangent-bitangent","Unable to compute tangents and bitangents for polyline volume geometry")}i.tangent||(D.attributes.tangent=void 0),i.bitangent||(D.attributes.bitangent=void 0),i.st||(D.attributes.st=void 0)}return D}function QE(e){e=A(e,A.EMPTY_OBJECT);const t=e.polylinePositions,n=e.shapePositions;if(!l(t))throw new w("options.polylinePositions is required.");if(!l(n))throw new w("options.shapePositions is required.");this._positions=t,this._shape=n,this._ellipsoid=be.clone(A(e.ellipsoid,be.WGS84)),this._cornerType=A(e.cornerType,Hr.ROUNDED),this._vertexFormat=Ye.clone(A(e.vertexFormat,Ye.DEFAULT)),this._granularity=A(e.granularity,F.RADIANS_PER_DEGREE),this._workerName="createPolylineVolumeGeometry";let i=1+t.length*d.packedLength;i+=1+n.length*$.packedLength,this.packedLength=i+be.packedLength+Ye.packedLength+2}QE.pack=function(e,t,n){if(!l(e))throw new w("value is required");if(!l(t))throw new w("array is required");n=A(n,0);let i;const o=e._positions;let r=o.length;for(t[n++]=r,i=0;i<r;++i,n+=d.packedLength)d.pack(o[i],t,n);const s=e._shape;for(r=s.length,t[n++]=r,i=0;i<r;++i,n+=$.packedLength)$.pack(s[i],t,n);return be.pack(e._ellipsoid,t,n),n+=be.packedLength,Ye.pack(e._vertexFormat,t,n),n+=Ye.packedLength,t[n++]=e._cornerType,t[n]=e._granularity,t};const mse=be.clone(be.UNIT_SPHERE),_se=new Ye,ob={polylinePositions:void 0,shapePositions:void 0,ellipsoid:mse,vertexFormat:_se,cornerType:void 0,granularity:void 0};QE.unpack=function(e,t,n){if(!l(e))throw new w("array is required");t=A(t,0);let i,o=e[t++];const r=new Array(o);for(i=0;i<o;++i,t+=d.packedLength)r[i]=d.unpack(e,t);o=e[t++];const s=new Array(o);for(i=0;i<o;++i,t+=$.packedLength)s[i]=$.unpack(e,t);const a=be.unpack(e,t,mse);t+=be.packedLength;const c=Ye.unpack(e,t,_se);t+=Ye.packedLength;const u=e[t++],f=e[t];return l(n)?(n._positions=r,n._shape=s,n._ellipsoid=be.clone(a,n._ellipsoid),n._vertexFormat=Ye.clone(c,n._vertexFormat),n._cornerType=u,n._granularity=f,n):(ob.polylinePositions=r,ob.shapePositions=s,ob.cornerType=u,ob.granularity=f,new QE(ob))};const ght=new at;QE.createGeometry=function(e){const t=e._positions,n=Ya(t,d.equalsEpsilon);let i=e._shape;if(i=KE.removeDuplicatesFromShape(i),n.length<2||i.length<3)return;wo.computeWindingOrder2D(i)===pu.CLOCKWISE&&i.reverse();const o=at.fromPoints(i,ght),r=KE.computePositions(n,i,o,e,!0);return _ht(r,i,o,e._vertexFormat)};function yht(e,t){const n=new To;n.position=new Xe({componentDatatype:oe.DOUBLE,componentsPerAttribute:3,values:e});const i=t.length,o=n.position.values.length/3,s=e.length/3/i,a=At.createTypedArray(o,2*i*(s+1));let c,u,f=0;c=0;let h=c*i;for(u=0;u<i-1;u++)a[f++]=u+h,a[f++]=u+h+1;for(a[f++]=i-1+h,a[f++]=h,c=s-1,h=c*i,u=0;u<i-1;u++)a[f++]=u+h,a[f++]=u+h+1;for(a[f++]=i-1+h,a[f++]=h,c=0;c<s-1;c++){const g=i*c,p=g+i;for(u=0;u<i;u++)a[f++]=u+g,a[f++]=u+p}return new $t({attributes:n,indices:At.createTypedArray(o,a),boundingSphere:Ae.fromVertices(e),primitiveType:dt.LINES})}function ZE(e){e=A(e,A.EMPTY_OBJECT);const t=e.polylinePositions,n=e.shapePositions;if(!l(t))throw new w("options.polylinePositions is required.");if(!l(n))throw new w("options.shapePositions is required.");this._positions=t,this._shape=n,this._ellipsoid=be.clone(A(e.ellipsoid,be.WGS84)),this._cornerType=A(e.cornerType,Hr.ROUNDED),this._granularity=A(e.granularity,F.RADIANS_PER_DEGREE),this._workerName="createPolylineVolumeOutlineGeometry";let i=1+t.length*d.packedLength;i+=1+n.length*$.packedLength,this.packedLength=i+be.packedLength+2}ZE.pack=function(e,t,n){if(!l(e))throw new w("value is required");if(!l(t))throw new w("array is required");n=A(n,0);let i;const o=e._positions;let r=o.length;for(t[n++]=r,i=0;i<r;++i,n+=d.packedLength)d.pack(o[i],t,n);const s=e._shape;for(r=s.length,t[n++]=r,i=0;i<r;++i,n+=$.packedLength)$.pack(s[i],t,n);return be.pack(e._ellipsoid,t,n),n+=be.packedLength,t[n++]=e._cornerType,t[n]=e._granularity,t};const gse=be.clone(be.UNIT_SPHERE),rb={polylinePositions:void 0,shapePositions:void 0,ellipsoid:gse,height:void 0,cornerType:void 0,granularity:void 0};ZE.unpack=function(e,t,n){if(!l(e))throw new w("array is required");t=A(t,0);let i,o=e[t++];const r=new Array(o);for(i=0;i<o;++i,t+=d.packedLength)r[i]=d.unpack(e,t);o=e[t++];const s=new Array(o);for(i=0;i<o;++i,t+=$.packedLength)s[i]=$.unpack(e,t);const a=be.unpack(e,t,gse);t+=be.packedLength;const c=e[t++],u=e[t];return l(n)?(n._positions=r,n._shape=s,n._ellipsoid=be.clone(a,n._ellipsoid),n._cornerType=c,n._granularity=u,n):(rb.polylinePositions=r,rb.shapePositions=s,rb.cornerType=c,rb.granularity=u,new ZE(rb))};const Aht=new at;ZE.createGeometry=function(e){const t=e._positions,n=Ya(t,d.equalsEpsilon);let i=e._shape;if(i=KE.removeDuplicatesFromShape(i),n.length<2||i.length<3)return;wo.computeWindingOrder2D(i)===pu.CLOCKWISE&&i.reverse();const o=at.fromPoints(i,Aht),r=KE.computePositions(n,i,o,e,!1);return yht(r,i)};const yse=new k;function Tht(e){this.id=e,this.vertexFormat=void 0,this.polylinePositions=void 0,this.shapePositions=void 0,this.cornerType=void 0,this.granularity=void 0}function _d(e,t){li.call(this,{entity:e,scene:t,geometryOptions:new Tht(e),geometryPropertyName:"polylineVolume",observedPropertyNames:["availability","polylineVolume"]}),this._onEntityPropertyChanged(e,"polylineVolume",e.polylineVolume,void 0)}l(Object.create)&&(_d.prototype=Object.create(li.prototype),_d.prototype.constructor=_d);_d.prototype.createFillGeometryInstance=function(e){if(E.defined("time",e),!this._fillEnabled)throw new w("This instance does not represent a filled geometry.");const t=this._entity,n=t.isAvailable(e);let i,o;const r=new pi(n&&t.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),s=this._distanceDisplayConditionProperty.getValue(e),a=Yi.fromDistanceDisplayCondition(s);if(this._materialProperty instanceof An){let c;l(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(c=this._materialProperty.color.getValue(e,yse)),l(c)||(c=k.WHITE),o=Bn.fromColor(c),i={show:r,distanceDisplayCondition:a,color:o}}else i={show:r,distanceDisplayCondition:a};return new xn({id:t,geometry:new QE(this._options),attributes:i})};_d.prototype.createOutlineGeometryInstance=function(e){if(E.defined("time",e),!this._outlineEnabled)throw new w("This instance does not represent an outlined geometry.");const t=this._entity,n=t.isAvailable(e),i=ie.getValueOrDefault(this._outlineColorProperty,e,k.BLACK,yse),o=this._distanceDisplayConditionProperty.getValue(e);return new xn({id:t,geometry:new ZE(this._options),attributes:{show:new pi(n&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:Bn.fromColor(i),distanceDisplayCondition:Yi.fromDistanceDisplayCondition(o)}})};_d.prototype._isHidden=function(e,t){return!l(t.positions)||!l(t.shape)||li.prototype._isHidden.call(this,e,t)};_d.prototype._isDynamic=function(e,t){return!t.positions.isConstant||!t.shape.isConstant||!ie.isConstant(t.granularity)||!ie.isConstant(t.outlineWidth)||!ie.isConstant(t.cornerType)};_d.prototype._setStaticOptions=function(e,t){const n=t.granularity,i=t.cornerType,o=this._options,r=this._materialProperty instanceof An;o.vertexFormat=r?kn.VERTEX_FORMAT:Dr.MaterialSupport.TEXTURED.vertexFormat,o.polylinePositions=t.positions.getValue(wt.MINIMUM_VALUE,o.polylinePositions),o.shapePositions=t.shape.getValue(wt.MINIMUM_VALUE,o.shape),o.granularity=l(n)?n.getValue(wt.MINIMUM_VALUE):void 0,o.cornerType=l(i)?i.getValue(wt.MINIMUM_VALUE):void 0};_d.DynamicGeometryUpdater=FA;function FA(e,t,n){Mi.call(this,e,t,n)}l(Object.create)&&(FA.prototype=Object.create(Mi.prototype),FA.prototype.constructor=FA);FA.prototype._isHidden=function(e,t,n){const i=this._options;return!l(i.polylinePositions)||!l(i.shapePositions)||Mi.prototype._isHidden.call(this,e,t,n)};FA.prototype._setOptions=function(e,t,n){const i=this._options;i.polylinePositions=ie.getValueOrUndefined(t.positions,n,i.polylinePositions),i.shapePositions=ie.getValueOrUndefined(t.shape,n),i.granularity=ie.getValueOrUndefined(t.granularity,n),i.cornerType=ie.getValueOrUndefined(t.cornerType,n)};const tH=new d,Ase=new d,Tse=new d,Cse=new d,bse=new Ee,Cht=new $,bht=new Ae,Eht=new Ae;function Ese(e,t){const n=new $t({attributes:new To,primitiveType:dt.TRIANGLES});return n.attributes.position=new Xe({componentDatatype:oe.DOUBLE,componentsPerAttribute:3,values:t.positions}),e.normal&&(n.attributes.normal=new Xe({componentDatatype:oe.FLOAT,componentsPerAttribute:3,values:t.normals})),e.tangent&&(n.attributes.tangent=new Xe({componentDatatype:oe.FLOAT,componentsPerAttribute:3,values:t.tangents})),e.bitangent&&(n.attributes.bitangent=new Xe({componentDatatype:oe.FLOAT,componentsPerAttribute:3,values:t.bitangents})),n}function xht(e,t,n,i){const o=e.length,r=t.normal?new Float32Array(o):void 0,s=t.tangent?new Float32Array(o):void 0,a=t.bitangent?new Float32Array(o):void 0;let c=0;const u=Cse,f=Tse;let h=Ase;if(t.normal||t.tangent||t.bitangent)for(let _=0;_<o;_+=3){const g=d.fromArray(e,_,tH),p=c+1,y=c+2;h=n.geodeticSurfaceNormal(g,h),(t.tangent||t.bitangent)&&(d.cross(d.UNIT_Z,h,f),te.multiplyByVector(i,f,f),d.normalize(f,f),t.bitangent&&d.normalize(d.cross(h,f,u),u)),t.normal&&(r[c]=h.x,r[p]=h.y,r[y]=h.z),t.tangent&&(s[c]=f.x,s[p]=f.y,s[y]=f.z),t.bitangent&&(a[c]=u.x,a[p]=u.y,a[y]=u.z),c+=3}return Ese(t,{positions:e,normals:r,tangents:s,bitangents:a})}const nH=new d,xse=new d;function wht(e,t,n){const i=e.length,o=t.normal?new Float32Array(i):void 0,r=t.tangent?new Float32Array(i):void 0,s=t.bitangent?new Float32Array(i):void 0;let a=0,c=0,u=0,f=!0,h=Cse,_=Tse,g=Ase;if(t.normal||t.tangent||t.bitangent)for(let p=0;p<i;p+=6){const y=d.fromArray(e,p,tH),T=d.fromArray(e,(p+6)%i,nH);if(f){const b=d.fromArray(e,(p+3)%i,xse);d.subtract(T,y,T),d.subtract(b,y,b),g=d.normalize(d.cross(b,T,g),g),f=!1}d.equalsEpsilon(T,y,F.EPSILON10)&&(f=!0),(t.tangent||t.bitangent)&&(h=n.geodeticSurfaceNormal(y,h),t.tangent&&(_=d.normalize(d.cross(h,g,_),_))),t.normal&&(o[a++]=g.x,o[a++]=g.y,o[a++]=g.z,o[a++]=g.x,o[a++]=g.y,o[a++]=g.z),t.tangent&&(r[c++]=_.x,r[c++]=_.y,r[c++]=_.z,r[c++]=_.x,r[c++]=_.y,r[c++]=_.z),t.bitangent&&(s[u++]=h.x,s[u++]=h.y,s[u++]=h.z,s[u++]=h.x,s[u++]=h.y,s[u++]=h.z)}return Ese(t,{positions:e,normals:o,tangents:r,bitangents:s})}function wse(e,t){const n=e._vertexFormat,i=e._ellipsoid,o=t.height,r=t.width,s=t.northCap,a=t.southCap;let c=0,u=o,f=o,h=0;s&&(c=1,f-=1,h+=1),a&&(u-=1,f-=1,h+=1),h+=r*f;const _=n.position?new Float64Array(h*3):void 0,g=n.st?new Float32Array(h*2):void 0;let p=0,y=0;const T=tH,b=Cht;let x=Number.MAX_VALUE,v=Number.MAX_VALUE,D=-Number.MAX_VALUE,L=-Number.MAX_VALUE;for(let O=c;O<u;++O)for(let m=0;m<r;++m)dc.computePosition(t,i,n.st,O,m,T,b),_[p++]=T.x,_[p++]=T.y,_[p++]=T.z,n.st&&(g[y++]=b.x,g[y++]=b.y,x=Math.min(x,b.x),v=Math.min(v,b.y),D=Math.max(D,b.x),L=Math.max(L,b.y));if(s&&(dc.computePosition(t,i,n.st,0,0,T,b),_[p++]=T.x,_[p++]=T.y,_[p++]=T.z,n.st&&(g[y++]=b.x,g[y++]=b.y,x=b.x,v=b.y,D=b.x,L=b.y)),a&&(dc.computePosition(t,i,n.st,o-1,0,T,b),_[p++]=T.x,_[p++]=T.y,_[p]=T.z,n.st&&(g[y++]=b.x,g[y]=b.y,x=Math.min(x,b.x),v=Math.min(v,b.y),D=Math.max(D,b.x),L=Math.max(L,b.y))),n.st&&(x<0||v<0||D>1||L>1))for(let O=0;O<g.length;O+=2)g[O]=(g[O]-x)/(D-x),g[O+1]=(g[O+1]-v)/(L-v);const B=xht(_,n,i,t.tangentRotationMatrix);let V=6*(r-1)*(f-1);s&&(V+=3*(r-1)),a&&(V+=3*(r-1));const M=At.createTypedArray(h,V);let H=0,G=0,I;for(I=0;I<f-1;++I){for(let O=0;O<r-1;++O){const m=H,P=m+r,R=P+1,U=m+1;M[G++]=m,M[G++]=P,M[G++]=U,M[G++]=U,M[G++]=P,M[G++]=R,++H}++H}if(s||a){let O=h-1;const m=h-1;s&&a&&(O=h-2);let P,R;if(H=0,s)for(I=0;I<r-1;I++)P=H,R=P+1,M[G++]=O,M[G++]=P,M[G++]=R,++H;if(a)for(H=(f-1)*r,I=0;I<r-1;I++)P=H,R=P+1,M[G++]=P,M[G++]=m,M[G++]=R,++H}return B.indices=M,n.st&&(B.attributes.st=new Xe({componentDatatype:oe.FLOAT,componentsPerAttribute:2,values:g})),B}function V0(e,t,n,i,o){return e[t++]=i[n],e[t++]=i[n+1],e[t++]=i[n+2],e[t++]=o[n],e[t++]=o[n+1],e[t]=o[n+2],e}function k0(e,t,n,i){return e[t++]=i[n],e[t++]=i[n+1],e[t++]=i[n],e[t]=i[n+1],e}const iH=new Ye;function Sht(e,t){const n=e._shadowVolume,i=e._offsetAttribute,o=e._vertexFormat,r=e._extrudedHeight,s=e._surfaceHeight,a=e._ellipsoid,c=t.height,u=t.width;let f;if(n){const Ie=Ye.clone(o,iH);Ie.normal=!0,e._vertexFormat=Ie}const h=wse(e,t);n&&(e._vertexFormat=o);let _=wo.scaleToGeodeticHeight(h.attributes.position.values,s,a,!1);_=new Float64Array(_);let g=_.length;const p=g*2,y=new Float64Array(p);y.set(_);const T=wo.scaleToGeodeticHeight(h.attributes.position.values,r,a);y.set(T,g),h.attributes.position.values=y;const b=o.normal?new Float32Array(p):void 0,x=o.tangent?new Float32Array(p):void 0,v=o.bitangent?new Float32Array(p):void 0,D=o.st?new Float32Array(p/3*2):void 0;let L,B;if(o.normal){for(B=h.attributes.normal.values,b.set(B),f=0;f<g;f++)B[f]=-B[f];b.set(B,g),h.attributes.normal.values=b}if(n){B=h.attributes.normal.values,o.normal||(h.attributes.normal=void 0);const Ie=new Float32Array(p);for(f=0;f<g;f++)B[f]=-B[f];Ie.set(B,g),h.attributes.extrudeDirection=new Xe({componentDatatype:oe.FLOAT,componentsPerAttribute:3,values:Ie})}let V;const M=l(i);if(M){const Ie=g/3*2;let He=new Uint8Array(Ie);i===Fn.TOP?He=He.fill(1,0,Ie/2):(V=i===Fn.NONE?0:1,He=He.fill(V)),h.attributes.applyOffset=new Xe({componentDatatype:oe.UNSIGNED_BYTE,componentsPerAttribute:1,values:He})}if(o.tangent){const Ie=h.attributes.tangent.values;for(x.set(Ie),f=0;f<g;f++)Ie[f]=-Ie[f];x.set(Ie,g),h.attributes.tangent.values=x}if(o.bitangent){const Ie=h.attributes.bitangent.values;v.set(Ie),v.set(Ie,g),h.attributes.bitangent.values=v}o.st&&(L=h.attributes.st.values,D.set(L),D.set(L,g/3*2),h.attributes.st.values=D);const H=h.indices,G=H.length,I=g/3,O=At.createTypedArray(p/3,G*2);for(O.set(H),f=0;f<G;f+=3)O[f+G]=H[f+2]+I,O[f+1+G]=H[f+1]+I,O[f+2+G]=H[f]+I;h.indices=O;const m=t.northCap,P=t.southCap;let R=c,U=2,W=0,q=4,Y=4;m&&(U-=1,R-=1,W+=1,q-=2,Y-=1),P&&(U-=1,R-=1,W+=1,q-=2,Y-=1),W+=U*u+2*R-q;const j=(W+Y)*2;let ee=new Float64Array(j*3);const K=n?new Float32Array(j*3):void 0;let se=M?new Uint8Array(j):void 0,Q=o.st?new Float32Array(j*2):void 0;const Z=i===Fn.TOP;M&&!Z&&(V=i===Fn.ALL?1:0,se=se.fill(V));let J=0,de=0,_e=0,le=0;const Te=u*R;let pe;for(f=0;f<Te;f+=u)pe=f*3,ee=V0(ee,J,pe,_,T),J+=6,o.st&&(Q=k0(Q,de,f*2,L),de+=4),n&&(_e+=3,K[_e++]=B[pe],K[_e++]=B[pe+1],K[_e++]=B[pe+2]),Z&&(se[le++]=1,le+=1);if(P){const Ie=m?Te+1:Te;for(pe=Ie*3,f=0;f<2;f++)ee=V0(ee,J,pe,_,T),J+=6,o.st&&(Q=k0(Q,de,Ie*2,L),de+=4),n&&(_e+=3,K[_e++]=B[pe],K[_e++]=B[pe+1],K[_e++]=B[pe+2]),Z&&(se[le++]=1,le+=1)}else for(f=Te-u;f<Te;f++)pe=f*3,ee=V0(ee,J,pe,_,T),J+=6,o.st&&(Q=k0(Q,de,f*2,L),de+=4),n&&(_e+=3,K[_e++]=B[pe],K[_e++]=B[pe+1],K[_e++]=B[pe+2]),Z&&(se[le++]=1,le+=1);for(f=Te-1;f>0;f-=u)pe=f*3,ee=V0(ee,J,pe,_,T),J+=6,o.st&&(Q=k0(Q,de,f*2,L),de+=4),n&&(_e+=3,K[_e++]=B[pe],K[_e++]=B[pe+1],K[_e++]=B[pe+2]),Z&&(se[le++]=1,le+=1);if(m){const Ie=Te;for(pe=Ie*3,f=0;f<2;f++)ee=V0(ee,J,pe,_,T),J+=6,o.st&&(Q=k0(Q,de,Ie*2,L),de+=4),n&&(_e+=3,K[_e++]=B[pe],K[_e++]=B[pe+1],K[_e++]=B[pe+2]),Z&&(se[le++]=1,le+=1)}else for(f=u-1;f>=0;f--)pe=f*3,ee=V0(ee,J,pe,_,T),J+=6,o.st&&(Q=k0(Q,de,f*2,L),de+=4),n&&(_e+=3,K[_e++]=B[pe],K[_e++]=B[pe+1],K[_e++]=B[pe+2]),Z&&(se[le++]=1,le+=1);let ne=wht(ee,o,a);o.st&&(ne.attributes.st=new Xe({componentDatatype:oe.FLOAT,componentsPerAttribute:2,values:Q})),n&&(ne.attributes.extrudeDirection=new Xe({componentDatatype:oe.FLOAT,componentsPerAttribute:3,values:K})),M&&(ne.attributes.applyOffset=new Xe({componentDatatype:oe.UNSIGNED_BYTE,componentsPerAttribute:1,values:se}));const ae=At.createTypedArray(j,W*6);let ye,Ce,Be,Le;g=ee.length/3;let Ve=0;for(f=0;f<g-1;f+=2){ye=f,Le=(ye+2)%g;const Ie=d.fromArray(ee,ye*3,nH),He=d.fromArray(ee,Le*3,xse);d.equalsEpsilon(Ie,He,F.EPSILON10)||(Ce=(ye+1)%g,Be=(Ce+2)%g,ae[Ve++]=ye,ae[Ve++]=Ce,ae[Ve++]=Le,ae[Ve++]=Le,ae[Ve++]=Ce,ae[Ve++]=Be)}return ne.indices=ae,ne=mo.combineInstances([new xn({geometry:h}),new xn({geometry:ne})]),ne[0]}const vht=[new d,new d,new d,new d],Sse=new ve,Dht=new ve;function oH(e,t,n,i,o){if(n===0)return Ee.clone(e,o);const r=dc.computeOptions(e,t,n,0,bse,Sse),s=r.height,a=r.width,c=vht;return dc.computePosition(r,i,!1,0,0,c[0]),dc.computePosition(r,i,!1,0,a-1,c[1]),dc.computePosition(r,i,!1,s-1,0,c[2]),dc.computePosition(r,i,!1,s-1,a-1,c[3]),Ee.fromCartesianArray(c,i,o)}function Tu(e){e=A(e,A.EMPTY_OBJECT);const t=e.rectangle;if(E.typeOf.object("rectangle",t),Ee.validate(t),t.north<t.south)throw new w("options.rectangle.north must be greater than or equal to options.rectangle.south");const n=A(e.height,0),i=A(e.extrudedHeight,n);this._rectangle=Ee.clone(t),this._granularity=A(e.granularity,F.RADIANS_PER_DEGREE),this._ellipsoid=be.clone(A(e.ellipsoid,be.WGS84)),this._surfaceHeight=Math.max(n,i),this._rotation=A(e.rotation,0),this._stRotation=A(e.stRotation,0),this._vertexFormat=Ye.clone(A(e.vertexFormat,Ye.DEFAULT)),this._extrudedHeight=Math.min(n,i),this._shadowVolume=A(e.shadowVolume,!1),this._workerName="createRectangleGeometry",this._offsetAttribute=e.offsetAttribute,this._rotatedRectangle=void 0,this._textureCoordinateRotationPoints=void 0}Tu.packedLength=Ee.packedLength+be.packedLength+Ye.packedLength+7;Tu.pack=function(e,t,n){return E.typeOf.object("value",e),E.defined("array",t),n=A(n,0),Ee.pack(e._rectangle,t,n),n+=Ee.packedLength,be.pack(e._ellipsoid,t,n),n+=be.packedLength,Ye.pack(e._vertexFormat,t,n),n+=Ye.packedLength,t[n++]=e._granularity,t[n++]=e._surfaceHeight,t[n++]=e._rotation,t[n++]=e._stRotation,t[n++]=e._extrudedHeight,t[n++]=e._shadowVolume?1:0,t[n]=A(e._offsetAttribute,-1),t};const vse=new Ee,Dse=be.clone(be.UNIT_SPHERE),sm={rectangle:vse,ellipsoid:Dse,vertexFormat:iH,granularity:void 0,height:void 0,rotation:void 0,stRotation:void 0,extrudedHeight:void 0,shadowVolume:void 0,offsetAttribute:void 0};Tu.unpack=function(e,t,n){E.defined("array",e),t=A(t,0);const i=Ee.unpack(e,t,vse);t+=Ee.packedLength;const o=be.unpack(e,t,Dse);t+=be.packedLength;const r=Ye.unpack(e,t,iH);t+=Ye.packedLength;const s=e[t++],a=e[t++],c=e[t++],u=e[t++],f=e[t++],h=e[t++]===1,_=e[t];return l(n)?(n._rectangle=Ee.clone(i,n._rectangle),n._ellipsoid=be.clone(o,n._ellipsoid),n._vertexFormat=Ye.clone(r,n._vertexFormat),n._granularity=s,n._surfaceHeight=a,n._rotation=c,n._stRotation=u,n._extrudedHeight=f,n._shadowVolume=h,n._offsetAttribute=_===-1?void 0:_,n):(sm.granularity=s,sm.height=a,sm.rotation=c,sm.stRotation=u,sm.extrudedHeight=f,sm.shadowVolume=h,sm.offsetAttribute=_===-1?void 0:_,new Tu(sm))};Tu.computeRectangle=function(e,t){e=A(e,A.EMPTY_OBJECT);const n=e.rectangle;if(E.typeOf.object("rectangle",n),Ee.validate(n),n.north<n.south)throw new w("options.rectangle.north must be greater than or equal to options.rectangle.south");const i=A(e.granularity,F.RADIANS_PER_DEGREE),o=A(e.ellipsoid,be.WGS84),r=A(e.rotation,0);return oH(n,i,r,o,t)};const Iht=new te,zj=new De,Pht=new ve;Tu.createGeometry=function(e){if(F.equalsEpsilon(e._rectangle.north,e._rectangle.south,F.EPSILON10)||F.equalsEpsilon(e._rectangle.east,e._rectangle.west,F.EPSILON10))return;let t=e._rectangle;const n=e._ellipsoid,i=e._rotation,o=e._stRotation,r=e._vertexFormat,s=dc.computeOptions(t,e._granularity,i,o,bse,Sse,Dht),a=Iht;if(o!==0||i!==0){const g=Ee.center(t,Pht),p=n.geodeticSurfaceNormalCartographic(g,nH);De.fromAxisAngle(p,-o,zj),te.fromQuaternion(zj,a)}else te.clone(te.IDENTITY,a);const c=e._surfaceHeight,u=e._extrudedHeight,f=!F.equalsEpsilon(c,u,0,F.EPSILON2);s.lonScalar=1/e._rectangle.width,s.latScalar=1/e._rectangle.height,s.tangentRotationMatrix=a;let h,_;if(t=e._rectangle,f){h=Sht(e,s);const g=Ae.fromRectangle3D(t,n,c,Eht),p=Ae.fromRectangle3D(t,n,u,bht);_=Ae.union(g,p)}else{if(h=wse(e,s),h.attributes.position.values=wo.scaleToGeodeticHeight(h.attributes.position.values,c,n,!1),l(e._offsetAttribute)){const g=h.attributes.position.values.length,p=e._offsetAttribute===Fn.NONE?0:1,y=new Uint8Array(g/3).fill(p);h.attributes.applyOffset=new Xe({componentDatatype:oe.UNSIGNED_BYTE,componentsPerAttribute:1,values:y})}_=Ae.fromRectangle3D(t,n,c)}return r.position||delete h.attributes.position,new $t({attributes:h.attributes,indices:h.indices,primitiveType:h.primitiveType,boundingSphere:_,offsetAttribute:e._offsetAttribute})};Tu.createShadowVolume=function(e,t,n){const i=e._granularity,o=e._ellipsoid,r=t(i,o),s=n(i,o);return new Tu({rectangle:e._rectangle,rotation:e._rotation,ellipsoid:o,stRotation:e._stRotation,granularity:i,extrudedHeight:s,height:r,vertexFormat:Ye.POSITION_ONLY,shadowVolume:!0})};const Uj=new Ee,Oht=[new $,new $,new $],Lht=new Et,Bht=new ve;function Rht(e){if(e._stRotation===0)return[0,0,0,1,1,0];const t=Ee.clone(e._rectangle,Uj),n=e._granularity,i=e._ellipsoid,o=e._rotation-e._stRotation,r=oH(t,n,o,i,Uj),s=Oht;s[0].x=r.west,s[0].y=r.south,s[1].x=r.west,s[1].y=r.north,s[2].x=r.east,s[2].y=r.south;const a=e.rectangle,c=Et.fromRotation(e._stRotation,Lht),u=Ee.center(a,Bht);for(let p=0;p<3;++p){const y=s[p];y.x-=u.longitude,y.y-=u.latitude,Et.multiplyByVector(c,y,y),y.x+=u.longitude,y.y+=u.latitude,y.x=(y.x-a.west)/a.width,y.y=(y.y-a.south)/a.height}const f=s[0],h=s[1],_=s[2],g=new Array(6);return $.pack(f,g),$.pack(h,g,2),$.pack(_,g,4),g}Object.defineProperties(Tu.prototype,{rectangle:{get:function(){return l(this._rotatedRectangle)||(this._rotatedRectangle=oH(this._rectangle,this._granularity,this._rotation,this._ellipsoid)),this._rotatedRectangle}},textureCoordinateRotationPoints:{get:function(){return l(this._textureCoordinateRotationPoints)||(this._textureCoordinateRotationPoints=Rht(this)),this._textureCoordinateRotationPoints}}});const Ise=new k,Pse=d.ZERO,Ose=new d,Lse=new Ee,Nht=new Ee,Mht=new ve;function Fht(e){this.id=e,this.vertexFormat=void 0,this.rectangle=void 0,this.height=void 0,this.extrudedHeight=void 0,this.granularity=void 0,this.stRotation=void 0,this.rotation=void 0,this.offsetAttribute=void 0}function uf(e,t){_n.call(this,{entity:e,scene:t,geometryOptions:new Fht(e),geometryPropertyName:"rectangle",observedPropertyNames:["availability","rectangle"]}),this._onEntityPropertyChanged(e,"rectangle",e.rectangle,void 0)}l(Object.create)&&(uf.prototype=Object.create(_n.prototype),uf.prototype.constructor=uf);uf.prototype.createFillGeometryInstance=function(e){if(E.defined("time",e),!this._fillEnabled)throw new w("This instance does not represent a filled geometry.");const t=this._entity,n=t.isAvailable(e),i={show:new pi(n&&t.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),distanceDisplayCondition:Yi.fromDistanceDisplayCondition(this._distanceDisplayConditionProperty.getValue(e)),offset:void 0,color:void 0};if(this._materialProperty instanceof An){let o;l(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(o=this._materialProperty.color.getValue(e,Ise)),l(o)||(o=k.WHITE),i.color=Bn.fromColor(o)}return l(this._options.offsetAttribute)&&(i.offset=Ar.fromCartesian3(ie.getValueOrDefault(this._terrainOffsetProperty,e,Pse,Ose))),new xn({id:t,geometry:new Tu(this._options),attributes:i})};uf.prototype.createOutlineGeometryInstance=function(e){if(E.defined("time",e),!this._outlineEnabled)throw new w("This instance does not represent an outlined geometry.");const t=this._entity,n=t.isAvailable(e),i=ie.getValueOrDefault(this._outlineColorProperty,e,k.BLACK,Ise),o=this._distanceDisplayConditionProperty.getValue(e),r={show:new pi(n&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:Bn.fromColor(i),distanceDisplayCondition:Yi.fromDistanceDisplayCondition(o),offset:void 0};return l(this._options.offsetAttribute)&&(r.offset=Ar.fromCartesian3(ie.getValueOrDefault(this._terrainOffsetProperty,e,Pse,Ose))),new xn({id:t,geometry:new oy(this._options),attributes:r})};uf.prototype._computeCenter=function(e,t){const n=ie.getValueOrUndefined(this._entity.rectangle.coordinates,e,Nht);if(!l(n))return;const i=Ee.center(n,Mht);return ve.toCartesian(i,be.WGS84,t)};uf.prototype._isHidden=function(e,t){return!l(t.coordinates)||li.prototype._isHidden.call(this,e,t)};uf.prototype._isDynamic=function(e,t){return!t.coordinates.isConstant||!ie.isConstant(t.height)||!ie.isConstant(t.extrudedHeight)||!ie.isConstant(t.granularity)||!ie.isConstant(t.stRotation)||!ie.isConstant(t.rotation)||!ie.isConstant(t.outlineWidth)||!ie.isConstant(t.zIndex)||this._onTerrain&&!ie.isConstant(this._materialProperty)&&!(this._materialProperty instanceof An)};uf.prototype._setStaticOptions=function(e,t){const n=this._materialProperty instanceof An;let i=ie.getValueOrUndefined(t.height,wt.MINIMUM_VALUE);const o=ie.getValueOrDefault(t.heightReference,wt.MINIMUM_VALUE,Ht.NONE);let r=ie.getValueOrUndefined(t.extrudedHeight,wt.MINIMUM_VALUE);const s=ie.getValueOrDefault(t.extrudedHeightReference,wt.MINIMUM_VALUE,Ht.NONE);l(r)&&!l(i)&&(i=0);const a=this._options;a.vertexFormat=n?kn.VERTEX_FORMAT:Dr.MaterialSupport.TEXTURED.vertexFormat,a.rectangle=t.coordinates.getValue(wt.MINIMUM_VALUE,a.rectangle),a.granularity=ie.getValueOrUndefined(t.granularity,wt.MINIMUM_VALUE),a.stRotation=ie.getValueOrUndefined(t.stRotation,wt.MINIMUM_VALUE),a.rotation=ie.getValueOrUndefined(t.rotation,wt.MINIMUM_VALUE),a.offsetAttribute=_n.computeGeometryOffsetAttribute(i,o,r,s),a.height=_n.getGeometryHeight(i,o),r=_n.getGeometryExtrudedHeight(r,s),r===_n.CLAMP_TO_GROUND&&(r=Ro.getMinimumMaximumHeights(Tu.computeRectangle(a,Lse)).minimumTerrainHeight),a.extrudedHeight=r};uf.DynamicGeometryUpdater=zA;function zA(e,t,n){Mi.call(this,e,t,n)}l(Object.create)&&(zA.prototype=Object.create(Mi.prototype),zA.prototype.constructor=zA);zA.prototype._isHidden=function(e,t,n){return!l(this._options.rectangle)||Mi.prototype._isHidden.call(this,e,t,n)};zA.prototype._setOptions=function(e,t,n){const i=this._options;let o=ie.getValueOrUndefined(t.height,n);const r=ie.getValueOrDefault(t.heightReference,n,Ht.NONE);let s=ie.getValueOrUndefined(t.extrudedHeight,n);const a=ie.getValueOrDefault(t.extrudedHeightReference,n,Ht.NONE);l(s)&&!l(o)&&(o=0),i.rectangle=ie.getValueOrUndefined(t.coordinates,n,i.rectangle),i.granularity=ie.getValueOrUndefined(t.granularity,n),i.stRotation=ie.getValueOrUndefined(t.stRotation,n),i.rotation=ie.getValueOrUndefined(t.rotation,n),i.offsetAttribute=_n.computeGeometryOffsetAttribute(o,r,s,a),i.height=_n.getGeometryHeight(o,r),s=_n.getGeometryExtrudedHeight(s,a),s===_n.CLAMP_TO_GROUND&&(s=Ro.getMinimumMaximumHeights(Tu.computeRectangle(i,Lse)).minimumTerrainHeight),i.extrudedHeight=s};const Hj=new k,zht=new sn,Uht=new sn,Hht=d.ZERO,Vht=new d;function Nf(e,t,n,i,o,r,s){this.translucent=t,this.appearanceType=n,this.depthFailAppearanceType=i,this.depthFailMaterialProperty=o,this.depthFailMaterial=void 0,this.closed=r,this.shadows=s,this.primitives=e,this.createPrimitive=!1,this.waitingOnCreate=!1,this.primitive=void 0,this.oldPrimitive=void 0,this.geometry=new Vt,this.updaters=new Vt,this.updatersWithAttributes=new Vt,this.attributes=new Vt,this.subscriptions=new Vt,this.showsUpdated=new Vt,this.itemsToRemove=[],this.invalidated=!1;let a;l(o)&&(a=o.definitionChanged.addEventListener(Nf.prototype.onMaterialChanged,this)),this.removeMaterialSubscription=a}Nf.prototype.onMaterialChanged=function(){this.invalidated=!0};Nf.prototype.isMaterial=function(e){const t=this.depthFailMaterialProperty,n=e.depthFailMaterialProperty;return n===t?!0:l(t)?t.equals(n):!1};Nf.prototype.add=function(e,t){const n=e.id;if(this.createPrimitive=!0,this.geometry.set(n,t),this.updaters.set(n,e),!e.hasConstantFill||!e.fillMaterialProperty.isConstant||!ie.isConstant(e.distanceDisplayConditionProperty)||!ie.isConstant(e.terrainOffsetProperty))this.updatersWithAttributes.set(n,e);else{const i=this;this.subscriptions.set(n,e.entity.definitionChanged.addEventListener(function(o,r,s,a){r==="isShowing"&&i.showsUpdated.set(e.id,e)}))}};Nf.prototype.remove=function(e){const t=e.id;if(this.createPrimitive=this.geometry.remove(t)||this.createPrimitive,this.updaters.remove(t)){this.updatersWithAttributes.remove(t);const n=this.subscriptions.get(t);return l(n)&&(n(),this.subscriptions.remove(t),this.showsUpdated.remove(t)),!0}return!1};Nf.prototype.update=function(e){let t=!0,n=0,i=this.primitive;const o=this.primitives;let r;if(this.createPrimitive){const s=this.geometry.values;if(s.length>0){l(i)&&(l(this.oldPrimitive)?o.remove(i):this.oldPrimitive=i);let c;l(this.depthFailAppearanceType)&&(l(this.depthFailMaterialProperty)&&(this.depthFailMaterial=ls.getValue(e,this.depthFailMaterialProperty,this.depthFailMaterial)),c=new this.depthFailAppearanceType({material:this.depthFailMaterial,translucent:this.translucent,closed:this.closed})),i=new fn({show:!1,asynchronous:!0,geometryInstances:s.slice(),appearance:new this.appearanceType({translucent:this.translucent,closed:this.closed}),depthFailAppearance:c,shadows:this.shadows}),o.add(i),t=!1}else{l(i)&&(o.remove(i),i=void 0);const c=this.oldPrimitive;l(c)&&(o.remove(c),this.oldPrimitive=void 0)}this.attributes.removeAll(),this.primitive=i,this.createPrimitive=!1,this.waitingOnCreate=!0}else if(l(i)&&i.ready){i.show=!0,l(this.oldPrimitive)&&(o.remove(this.oldPrimitive),this.oldPrimitive=void 0),l(this.depthFailAppearanceType)&&!(this.depthFailMaterialProperty instanceof An)&&(this.depthFailMaterial=ls.getValue(e,this.depthFailMaterialProperty,this.depthFailMaterial),this.primitive.depthFailAppearance.material=this.depthFailMaterial);const s=this.updatersWithAttributes.values,a=s.length,c=this.waitingOnCreate;for(r=0;r<a;r++){const u=s[r],f=this.geometry.get(u.id);let h=this.attributes.get(f.id.id);if(l(h)||(h=i.getGeometryInstanceAttributes(f.id),this.attributes.set(f.id.id,h)),!u.fillMaterialProperty.isConstant||c){const T=u.fillMaterialProperty.color,b=ie.getValueOrDefault(T,e,k.WHITE,Hj);k.equals(h._lastColor,b)||(h._lastColor=k.clone(b,h._lastColor),h.color=Bn.toValue(b,h.color),(this.translucent&&h.color[3]===255||!this.translucent&&h.color[3]!==255)&&(this.itemsToRemove[n++]=u))}if(l(this.depthFailAppearanceType)&&u.depthFailMaterialProperty instanceof An&&(!u.depthFailMaterialProperty.isConstant||c)){const T=u.depthFailMaterialProperty.color,b=ie.getValueOrDefault(T,e,k.WHITE,Hj);k.equals(h._lastDepthFailColor,b)||(h._lastDepthFailColor=k.clone(b,h._lastDepthFailColor),h.depthFailColor=Bn.toValue(b,h.depthFailColor))}const _=u.entity.isShowing&&(u.hasConstantFill||u.isFilled(e)),g=h.show[0]===1;_!==g&&(h.show=pi.toValue(_,h.show));const p=u.distanceDisplayConditionProperty;if(!ie.isConstant(p)){const T=ie.getValueOrDefault(p,e,Uht,zht);sn.equals(T,h._lastDistanceDisplayCondition)||(h._lastDistanceDisplayCondition=sn.clone(T,h._lastDistanceDisplayCondition),h.distanceDisplayCondition=Yi.toValue(T,h.distanceDisplayCondition))}const y=u.terrainOffsetProperty;if(!ie.isConstant(y)){const T=ie.getValueOrDefault(y,e,Hht,Vht);d.equals(T,h._lastOffset)||(h._lastOffset=d.clone(T,h._lastOffset),h.offset=Ar.toValue(T,h.offset))}}this.updateShows(i),this.waitingOnCreate=!1}else l(i)&&!i.ready&&(t=!1);return this.itemsToRemove.length=n,t};Nf.prototype.updateShows=function(e){const t=this.showsUpdated.values,n=t.length;for(let i=0;i<n;i++){const o=t[i],r=this.geometry.get(o.id);let s=this.attributes.get(r.id.id);l(s)||(s=e.getGeometryInstanceAttributes(r.id),this.attributes.set(r.id.id,s));const a=o.entity.isShowing,c=s.show[0]===1;a!==c&&(s.show=pi.toValue(a,s.show),r.attributes.show.value[0]=s.show[0])}this.showsUpdated.removeAll()};Nf.prototype.contains=function(e){return this.updaters.contains(e.id)};Nf.prototype.getBoundingSphere=function(e,t){const n=this.primitive;if(!n.ready)return Ot.PENDING;const i=n.getGeometryInstanceAttributes(e.entity);return!l(i)||!l(i.boundingSphere)||l(i.show)&&i.show[0]===0?Ot.FAILED:(i.boundingSphere.clone(t),Ot.DONE)};Nf.prototype.destroy=function(){const e=this.primitive,t=this.primitives;l(e)&&t.remove(e);const n=this.oldPrimitive;l(n)&&t.remove(n),l(this.removeMaterialSubscription)&&this.removeMaterialSubscription()};function ou(e,t,n,i,o){this._solidItems=[],this._translucentItems=[],this._primitives=e,this._appearanceType=t,this._depthFailAppearanceType=n,this._closed=i,this._shadows=o}ou.prototype.add=function(e,t){let n,i;const o=t.createFillGeometryInstance(e);o.attributes.color.value[3]===255?(n=this._solidItems,i=!1):(n=this._translucentItems,i=!0);const r=n.length;for(let a=0;a<r;a++){const c=n[a];if(c.isMaterial(t)){c.add(t,o);return}}const s=new Nf(this._primitives,i,this._appearanceType,this._depthFailAppearanceType,t.depthFailMaterialProperty,this._closed,this._shadows);s.add(t,o),n.push(s)};function Vj(e,t){const n=e.length;for(let i=n-1;i>=0;i--){const o=e[i];if(o.remove(t))return o.updaters.length===0&&(e.splice(i,1),o.destroy()),!0}return!1}ou.prototype.remove=function(e){Vj(this._solidItems,e)||Vj(this._translucentItems,e)};function kj(e,t,n){let i=!1;const o=t.length;for(let r=0;r<o;++r){const s=t[r],a=s.itemsToRemove,c=a.length;if(c>0)for(r=0;r<c;r++){const u=a[r];s.remove(u),e.add(n,u),i=!0}}return i}function Kv(e,t,n,i){let o=t.length,r;for(r=o-1;r>=0;r--){const s=t[r];if(s.invalidated){t.splice(r,1);const a=s.updaters.values,c=a.length;for(let u=0;u<c;u++)e.add(n,a[u]);s.destroy()}}for(o=t.length,r=0;r<o;++r)i=t[r].update(n)&&i;return i}ou.prototype.update=function(e){let t=Kv(this,this._solidItems,e,!0);t=Kv(this,this._translucentItems,e,t)&&t;const n=kj(this,this._solidItems,e),i=kj(this,this._translucentItems,e);return(n||i)&&(t=Kv(this,this._solidItems,e,t)&&t,t=Kv(this,this._translucentItems,e,t)&&t),t};function Gj(e,t,n){const i=e.length;for(let o=0;o<i;o++){const r=e[o];if(r.contains(t))return r.getBoundingSphere(t,n)}return Ot.FAILED}ou.prototype.getBoundingSphere=function(e,t){const n=Gj(this._solidItems,e,t);return n===Ot.FAILED?Gj(this._translucentItems,e,t):n};function Wj(e){const t=e.length;for(let n=0;n<t;n++)e[n].destroy();e.length=0}ou.prototype.removeAllPrimitives=function(){Wj(this._solidItems),Wj(this._translucentItems)};const kht=new sn,Ght=new sn,Wht=d.ZERO,qht=new d;function Mf(e,t,n,i,o,r,s){this.primitives=e,this.appearanceType=t,this.materialProperty=n,this.depthFailAppearanceType=i,this.depthFailMaterialProperty=o,this.closed=r,this.shadows=s,this.updaters=new Vt,this.createPrimitive=!0,this.primitive=void 0,this.oldPrimitive=void 0,this.geometry=new Vt,this.material=void 0,this.depthFailMaterial=void 0,this.updatersWithAttributes=new Vt,this.attributes=new Vt,this.invalidated=!1,this.removeMaterialSubscription=n.definitionChanged.addEventListener(Mf.prototype.onMaterialChanged,this),this.subscriptions=new Vt,this.showsUpdated=new Vt}Mf.prototype.onMaterialChanged=function(){this.invalidated=!0};Mf.prototype.isMaterial=function(e){const t=this.materialProperty,n=e.fillMaterialProperty,i=this.depthFailMaterialProperty,o=e.depthFailMaterialProperty;if(n===t&&o===i)return!0;let r=l(t)&&t.equals(n);return r=(!l(i)&&!l(o)||l(i)&&i.equals(o))&&r,r};Mf.prototype.add=function(e,t){const n=t.id;if(this.updaters.set(n,t),this.geometry.set(n,t.createFillGeometryInstance(e)),!t.hasConstantFill||!t.fillMaterialProperty.isConstant||!ie.isConstant(t.distanceDisplayConditionProperty)||!ie.isConstant(t.terrainOffsetProperty))this.updatersWithAttributes.set(n,t);else{const i=this;this.subscriptions.set(n,t.entity.definitionChanged.addEventListener(function(o,r,s,a){r==="isShowing"&&i.showsUpdated.set(t.id,t)}))}this.createPrimitive=!0};Mf.prototype.remove=function(e){const t=e.id;if(this.createPrimitive=this.geometry.remove(t)||this.createPrimitive,this.updaters.remove(t)){this.updatersWithAttributes.remove(t);const n=this.subscriptions.get(t);return l(n)&&(n(),this.subscriptions.remove(t),this.showsUpdated.remove(t)),!0}return!1};const jht=new k;Mf.prototype.update=function(e){let t=!0,n=this.primitive;const i=this.primitives,o=this.geometry.values;let r;if(this.createPrimitive){if(o.length>0){l(n)&&(l(this.oldPrimitive)?i.remove(n):this.oldPrimitive=n),this.material=ls.getValue(e,this.materialProperty,this.material);let a;l(this.depthFailMaterialProperty)&&(this.depthFailMaterial=ls.getValue(e,this.depthFailMaterialProperty,this.depthFailMaterial),a=new this.depthFailAppearanceType({material:this.depthFailMaterial,translucent:this.depthFailMaterial.isTranslucent(),closed:this.closed})),n=new fn({show:!1,asynchronous:!0,geometryInstances:o.slice(),appearance:new this.appearanceType({material:this.material,translucent:this.material.isTranslucent(),closed:this.closed}),depthFailAppearance:a,shadows:this.shadows}),i.add(n),t=!1}else{l(n)&&(i.remove(n),n=void 0);const a=this.oldPrimitive;l(a)&&(i.remove(a),this.oldPrimitive=void 0)}this.attributes.removeAll(),this.primitive=n,this.createPrimitive=!1}else if(l(n)&&n.ready){n.show=!0,l(this.oldPrimitive)&&(i.remove(this.oldPrimitive),this.oldPrimitive=void 0),this.material=ls.getValue(e,this.materialProperty,this.material),this.primitive.appearance.material=this.material,l(this.depthFailAppearanceType)&&!(this.depthFailMaterialProperty instanceof An)&&(this.depthFailMaterial=ls.getValue(e,this.depthFailMaterialProperty,this.depthFailMaterial),this.primitive.depthFailAppearance.material=this.depthFailMaterial);const s=this.updatersWithAttributes.values,a=s.length;for(r=0;r<a;r++){const c=s[r],u=c.entity,f=this.geometry.get(c.id);let h=this.attributes.get(f.id.id);if(l(h)||(h=n.getGeometryInstanceAttributes(f.id),this.attributes.set(f.id.id,h)),l(this.depthFailAppearanceType)&&this.depthFailMaterialProperty instanceof An&&!c.depthFailMaterialProperty.isConstant){const T=c.depthFailMaterialProperty.color,b=ie.getValueOrDefault(T,e,k.WHITE,jht);k.equals(h._lastDepthFailColor,b)||(h._lastDepthFailColor=k.clone(b,h._lastDepthFailColor),h.depthFailColor=Bn.toValue(b,h.depthFailColor))}const _=u.isShowing&&(c.hasConstantFill||c.isFilled(e)),g=h.show[0]===1;_!==g&&(h.show=pi.toValue(_,h.show));const p=c.distanceDisplayConditionProperty;if(!ie.isConstant(p)){const T=ie.getValueOrDefault(p,e,Ght,kht);sn.equals(T,h._lastDistanceDisplayCondition)||(h._lastDistanceDisplayCondition=sn.clone(T,h._lastDistanceDisplayCondition),h.distanceDisplayCondition=Yi.toValue(T,h.distanceDisplayCondition))}const y=c.terrainOffsetProperty;if(!ie.isConstant(y)){const T=ie.getValueOrDefault(y,e,Wht,qht);d.equals(T,h._lastOffset)||(h._lastOffset=d.clone(T,h._lastOffset),h.offset=Ar.toValue(T,h.offset))}}this.updateShows(n)}else l(n)&&!n.ready&&(t=!1);return t};Mf.prototype.updateShows=function(e){const t=this.showsUpdated.values,n=t.length;for(let i=0;i<n;i++){const o=t[i],r=o.entity,s=this.geometry.get(o.id);let a=this.attributes.get(s.id.id);l(a)||(a=e.getGeometryInstanceAttributes(s.id),this.attributes.set(s.id.id,a));const c=r.isShowing,u=a.show[0]===1;c!==u&&(a.show=pi.toValue(c,a.show),s.attributes.show.value[0]=a.show[0])}this.showsUpdated.removeAll()};Mf.prototype.contains=function(e){return this.updaters.contains(e.id)};Mf.prototype.getBoundingSphere=function(e,t){const n=this.primitive;if(!n.ready)return Ot.PENDING;const i=n.getGeometryInstanceAttributes(e.entity);return!l(i)||!l(i.boundingSphere)||l(i.show)&&i.show[0]===0?Ot.FAILED:(i.boundingSphere.clone(t),Ot.DONE)};Mf.prototype.destroy=function(){const e=this.primitive,t=this.primitives;l(e)&&t.remove(e);const n=this.oldPrimitive;l(n)&&t.remove(n),this.removeMaterialSubscription()};function ru(e,t,n,i,o){this._items=[],this._primitives=e,this._appearanceType=t,this._depthFailAppearanceType=n,this._closed=i,this._shadows=o}ru.prototype.add=function(e,t){const n=this._items,i=n.length;for(let r=0;r<i;r++){const s=n[r];if(s.isMaterial(t)){s.add(e,t);return}}const o=new Mf(this._primitives,this._appearanceType,t.fillMaterialProperty,this._depthFailAppearanceType,t.depthFailMaterialProperty,this._closed,this._shadows);o.add(e,t),n.push(o)};ru.prototype.remove=function(e){const t=this._items,n=t.length;for(let i=n-1;i>=0;i--){const o=t[i];if(o.remove(e)){o.updaters.length===0&&(t.splice(i,1),o.destroy());break}}};ru.prototype.update=function(e){let t;const n=this._items,i=n.length;for(t=i-1;t>=0;t--){const r=n[t];if(r.invalidated){n.splice(t,1);const s=r.updaters.values,a=s.length;for(let c=0;c<a;c++)this.add(e,s[c]);r.destroy()}}let o=!0;for(t=0;t<n.length;t++)o=n[t].update(e)&&o;return o};ru.prototype.getBoundingSphere=function(e,t){const n=this._items,i=n.length;for(let o=0;o<i;o++){const r=n[o];if(r.contains(e))return r.getBoundingSphere(e,t)}return Ot.FAILED};ru.prototype.removeAllPrimitives=function(){const e=this._items,t=e.length;for(let n=0;n<t;n++)e[n].destroy();this._items.length=0};function Yht(e,t,n,i,o){Bse(e,t,n||0,i||e.length-1,o||$ht)}function Bse(e,t,n,i,o){for(;i>n;){if(i-n>600){var r=i-n+1,s=t-n+1,a=Math.log(r),c=.5*Math.exp(2*a/3),u=.5*Math.sqrt(a*c*(r-c)/r)*(s-r/2<0?-1:1),f=Math.max(n,Math.floor(t-s*c/r+u)),h=Math.min(i,Math.floor(t+(r-s)*c/r+u));Bse(e,t,f,h,o)}var _=e[t],g=n,p=i;for(sb(e,n,t),o(e[i],_)>0&&sb(e,n,i);g<p;){for(sb(e,g,p),g++,p--;o(e[g],_)<0;)g++;for(;o(e[p],_)>0;)p--}o(e[n],_)===0?sb(e,n,p):(p++,sb(e,p,i)),p<=t&&(n=p+1),t<=p&&(i=p-1)}}function sb(e,t,n){var i=e[t];e[t]=e[n],e[n]=i}function $ht(e,t){return e<t?-1:e>t?1:0}class Xht{constructor(t=9){this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(t){let n=this.data;const i=[];if(!Qv(t,n))return i;const o=this.toBBox,r=[];for(;n;){for(let s=0;s<n.children.length;s++){const a=n.children[s],c=n.leaf?o(a):a;Qv(t,c)&&(n.leaf?i.push(a):MN(t,c)?this._all(a,i):r.push(a))}n=r.pop()}return i}collides(t){let n=this.data;if(!Qv(t,n))return!1;const i=[];for(;n;){for(let o=0;o<n.children.length;o++){const r=n.children[o],s=n.leaf?this.toBBox(r):r;if(Qv(t,s)){if(n.leaf||MN(t,s))return!0;i.push(r)}}n=i.pop()}return!1}load(t){if(!(t&&t.length))return this;if(t.length<this._minEntries){for(let i=0;i<t.length;i++)this.insert(t[i]);return this}let n=this._build(t.slice(),0,t.length-1,0);if(!this.data.children.length)this.data=n;else if(this.data.height===n.height)this._splitRoot(this.data,n);else{if(this.data.height<n.height){const i=this.data;this.data=n,n=i}this._insert(n,this.data.height-n.height-1,!0)}return this}insert(t){return t&&this._insert(t,this.data.height-1),this}clear(){return this.data=sA([]),this}remove(t,n){if(!t)return this;let i=this.data;const o=this.toBBox(t),r=[],s=[];let a,c,u;for(;i||r.length;){if(i||(i=r.pop(),c=r[r.length-1],a=s.pop(),u=!0),i.leaf){const f=Kht(t,i.children,n);if(f!==-1)return i.children.splice(f,1),r.push(i),this._condense(r),this}!u&&!i.leaf&&MN(i,o)?(r.push(i),s.push(a),a=0,c=i,i=i.children[0]):c?(a++,i=c.children[a],u=!1):i=null}return this}toBBox(t){return t}compareMinX(t,n){return t.minX-n.minX}compareMinY(t,n){return t.minY-n.minY}toJSON(){return this.data}fromJSON(t){return this.data=t,this}_all(t,n){const i=[];for(;t;)t.leaf?n.push(...t.children):i.push(...t.children),t=i.pop();return n}_build(t,n,i,o){const r=i-n+1;let s=this._maxEntries,a;if(r<=s)return a=sA(t.slice(n,i+1)),G0(a,this.toBBox),a;o||(o=Math.ceil(Math.log(r)/Math.log(s)),s=Math.ceil(r/Math.pow(s,o-1))),a=sA([]),a.leaf=!1,a.height=o;const c=Math.ceil(r/s),u=c*Math.ceil(Math.sqrt(s));qj(t,n,i,u,this.compareMinX);for(let f=n;f<=i;f+=u){const h=Math.min(f+u-1,i);qj(t,f,h,c,this.compareMinY);for(let _=f;_<=h;_+=c){const g=Math.min(_+c-1,h);a.children.push(this._build(t,_,g,o-1))}}return G0(a,this.toBBox),a}_chooseSubtree(t,n,i,o){for(;o.push(n),!(n.leaf||o.length-1===i);){let r=1/0,s=1/0,a;for(let c=0;c<n.children.length;c++){const u=n.children[c],f=NN(u),h=Zht(t,u)-f;h<s?(s=h,r=f<r?f:r,a=u):h===s&&f<r&&(r=f,a=u)}n=a||n.children[0]}return n}_insert(t,n,i){const o=i?t:this.toBBox(t),r=[],s=this._chooseSubtree(o,this.data,n,r);for(s.children.push(t),Db(s,o);n>=0&&r[n].children.length>this._maxEntries;)this._split(r,n),n--;this._adjustParentBBoxes(o,r,n)}_split(t,n){const i=t[n],o=i.children.length,r=this._minEntries;this._chooseSplitAxis(i,r,o);const s=this._chooseSplitIndex(i,r,o),a=sA(i.children.splice(s,i.children.length-s));a.height=i.height,a.leaf=i.leaf,G0(i,this.toBBox),G0(a,this.toBBox),n?t[n-1].children.push(a):this._splitRoot(i,a)}_splitRoot(t,n){this.data=sA([t,n]),this.data.height=t.height+1,this.data.leaf=!1,G0(this.data,this.toBBox)}_chooseSplitIndex(t,n,i){let o,r=1/0,s=1/0;for(let a=n;a<=i-n;a++){const c=vb(t,0,a,this.toBBox),u=vb(t,a,i,this.toBBox),f=ept(c,u),h=NN(c)+NN(u);f<r?(r=f,o=a,s=h<s?h:s):f===r&&h<s&&(s=h,o=a)}return o||i-n}_chooseSplitAxis(t,n,i){const o=t.leaf?this.compareMinX:Jht,r=t.leaf?this.compareMinY:Qht,s=this._allDistMargin(t,n,i,o),a=this._allDistMargin(t,n,i,r);s<a&&t.children.sort(o)}_allDistMargin(t,n,i,o){t.children.sort(o);const r=this.toBBox,s=vb(t,0,n,r),a=vb(t,i-n,i,r);let c=Jv(s)+Jv(a);for(let u=n;u<i-n;u++){const f=t.children[u];Db(s,t.leaf?r(f):f),c+=Jv(s)}for(let u=i-n-1;u>=n;u--){const f=t.children[u];Db(a,t.leaf?r(f):f),c+=Jv(a)}return c}_adjustParentBBoxes(t,n,i){for(let o=i;o>=0;o--)Db(n[o],t)}_condense(t){for(let n=t.length-1,i;n>=0;n--)t[n].children.length===0?n>0?(i=t[n-1].children,i.splice(i.indexOf(t[n]),1)):this.clear():G0(t[n],this.toBBox)}}function Kht(e,t,n){if(!n)return t.indexOf(e);for(let i=0;i<t.length;i++)if(n(e,t[i]))return i;return-1}function G0(e,t){vb(e,0,e.children.length,t,e)}function vb(e,t,n,i,o){o||(o=sA(null)),o.minX=1/0,o.minY=1/0,o.maxX=-1/0,o.maxY=-1/0;for(let r=t;r<n;r++){const s=e.children[r];Db(o,e.leaf?i(s):s)}return o}function Db(e,t){return e.minX=Math.min(e.minX,t.minX),e.minY=Math.min(e.minY,t.minY),e.maxX=Math.max(e.maxX,t.maxX),e.maxY=Math.max(e.maxY,t.maxY),e}function Jht(e,t){return e.minX-t.minX}function Qht(e,t){return e.minY-t.minY}function NN(e){return(e.maxX-e.minX)*(e.maxY-e.minY)}function Jv(e){return e.maxX-e.minX+(e.maxY-e.minY)}function Zht(e,t){return(Math.max(t.maxX,e.maxX)-Math.min(t.minX,e.minX))*(Math.max(t.maxY,e.maxY)-Math.min(t.minY,e.minY))}function ept(e,t){const n=Math.max(e.minX,t.minX),i=Math.max(e.minY,t.minY),o=Math.min(e.maxX,t.maxX),r=Math.min(e.maxY,t.maxY);return Math.max(0,o-n)*Math.max(0,r-i)}function MN(e,t){return e.minX<=t.minX&&e.minY<=t.minY&&t.maxX<=e.maxX&&t.maxY<=e.maxY}function Qv(e,t){return t.minX<=e.maxX&&t.minY<=e.maxY&&t.maxX>=e.minX&&t.maxY>=e.minY}function sA(e){return{children:e,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function qj(e,t,n,i,o){const r=[t,n];for(;r.length;){if(n=r.pop(),t=r.pop(),n-t<=i)continue;const s=t+Math.ceil((n-t)/i/2)*i;Yht(e,s,t,n,o),r.push(t,s,s,n)}}function Xx(){this._tree=new Xht}function hy(){this.minX=0,this.minY=0,this.maxX=0,this.maxY=0,this.id=""}hy.fromRectangleAndId=function(e,t,n){return n.minX=t.west,n.minY=t.south,n.maxX=t.east,n.maxY=t.north,n.id=e,n};Xx.prototype.insert=function(e,t){E.typeOf.string("id",e),E.typeOf.object("rectangle",t);const n=hy.fromRectangleAndId(e,t,new hy);this._tree.insert(n)};function tpt(e,t){return e.id===t.id}const npt=new hy;Xx.prototype.remove=function(e,t){E.typeOf.string("id",e),E.typeOf.object("rectangle",t);const n=hy.fromRectangleAndId(e,t,npt);this._tree.remove(n,tpt)};const ipt=new hy;Xx.prototype.collides=function(e){E.typeOf.object("rectangle",e);const t=hy.fromRectangleAndId("",e,ipt);return this._tree.collides(t)};const opt=new k,rpt=new sn,spt=new sn;function Sp(e,t,n,i){this.primitives=e,this.zIndex=i,this.classificationType=t,this.color=n,this.createPrimitive=!1,this.waitingOnCreate=!1,this.primitive=void 0,this.oldPrimitive=void 0,this.geometry=new Vt,this.updaters=new Vt,this.updatersWithAttributes=new Vt,this.attributes=new Vt,this.subscriptions=new Vt,this.showsUpdated=new Vt,this.itemsToRemove=[],this.isDirty=!1,this.rectangleCollisionCheck=new Xx}Sp.prototype.overlapping=function(e){return this.rectangleCollisionCheck.collides(e)};Sp.prototype.add=function(e,t){const n=e.id;if(this.createPrimitive=!0,this.geometry.set(n,t),this.updaters.set(n,e),this.rectangleCollisionCheck.insert(n,t.geometry.rectangle),!e.hasConstantFill||!e.fillMaterialProperty.isConstant||!ie.isConstant(e.distanceDisplayConditionProperty))this.updatersWithAttributes.set(n,e);else{const i=this;this.subscriptions.set(n,e.entity.definitionChanged.addEventListener(function(o,r,s,a){r==="isShowing"&&i.showsUpdated.set(e.id,e)}))}};Sp.prototype.remove=function(e){const t=e.id,n=this.geometry.get(t);if(this.createPrimitive=this.geometry.remove(t)||this.createPrimitive,this.updaters.remove(t)){this.rectangleCollisionCheck.remove(t,n.geometry.rectangle),this.updatersWithAttributes.remove(t);const i=this.subscriptions.get(t);return l(i)&&(i(),this.subscriptions.remove(t),this.showsUpdated.remove(t)),!0}return!1};Sp.prototype.update=function(e){let t=!0;const n=0;let i=this.primitive;const o=this.primitives;let r;if(this.createPrimitive){const s=this.geometry.values;if(s.length>0)l(i)&&(l(this.oldPrimitive)?o.remove(i):this.oldPrimitive=i),i=new vs({show:!1,asynchronous:!0,geometryInstances:s.slice(),classificationType:this.classificationType}),o.add(i,this.zIndex),t=!1;else{l(i)&&(o.remove(i),i=void 0);const c=this.oldPrimitive;l(c)&&(o.remove(c),this.oldPrimitive=void 0)}this.attributes.removeAll(),this.primitive=i,this.createPrimitive=!1,this.waitingOnCreate=!0}else if(l(i)&&i.ready){i.show=!0,l(this.oldPrimitive)&&(o.remove(this.oldPrimitive),this.oldPrimitive=void 0);const s=this.updatersWithAttributes.values,a=s.length,c=this.waitingOnCreate;for(r=0;r<a;r++){const u=s[r],f=this.geometry.get(u.id);let h=this.attributes.get(f.id.id);if(l(h)||(h=i.getGeometryInstanceAttributes(f.id),this.attributes.set(f.id.id,h)),!u.fillMaterialProperty.isConstant||c){const y=u.fillMaterialProperty.color,T=ie.getValueOrDefault(y,e,k.WHITE,opt);k.equals(h._lastColor,T)||(h._lastColor=k.clone(T,h._lastColor),h.color=Bn.toValue(T,h.color))}const _=u.entity.isShowing&&(u.hasConstantFill||u.isFilled(e)),g=h.show[0]===1;_!==g&&(h.show=pi.toValue(_,h.show));const p=u.distanceDisplayConditionProperty;if(!ie.isConstant(p)){const y=ie.getValueOrDefault(p,e,spt,rpt);sn.equals(y,h._lastDistanceDisplayCondition)||(h._lastDistanceDisplayCondition=sn.clone(y,h._lastDistanceDisplayCondition),h.distanceDisplayCondition=Yi.toValue(y,h.distanceDisplayCondition))}}this.updateShows(i),this.waitingOnCreate=!1}else l(i)&&!i.ready&&(t=!1);return this.itemsToRemove.length=n,t};Sp.prototype.updateShows=function(e){const t=this.showsUpdated.values,n=t.length;for(let i=0;i<n;i++){const o=t[i],r=this.geometry.get(o.id);let s=this.attributes.get(r.id.id);l(s)||(s=e.getGeometryInstanceAttributes(r.id),this.attributes.set(r.id.id,s));const a=o.entity.isShowing,c=s.show[0]===1;a!==c&&(s.show=pi.toValue(a,s.show),r.attributes.show.value[0]=s.show[0])}this.showsUpdated.removeAll()};Sp.prototype.contains=function(e){return this.updaters.contains(e.id)};Sp.prototype.getBoundingSphere=function(e,t){const n=this.primitive;if(!n.ready)return Ot.PENDING;const i=n.getBoundingSphere(e.entity);return l(i)?(i.clone(t),Ot.DONE):Ot.FAILED};Sp.prototype.removeAllPrimitives=function(){const e=this.primitives,t=this.primitive;l(t)&&(e.remove(t),this.primitive=void 0,this.geometry.removeAll(),this.updaters.removeAll());const n=this.oldPrimitive;l(n)&&(e.remove(n),this.oldPrimitive=void 0)};function py(e,t){this._batches=[],this._primitives=e,this._classificationType=t}py.prototype.add=function(e,t){const n=t.createFillGeometryInstance(e),i=this._batches,o=ie.getValueOrDefault(t.zIndex,0);let r;const s=i.length;for(let a=0;a<s;++a){const c=i[a];if(c.zIndex===o&&!c.overlapping(n.geometry.rectangle)){r=c;break}}return l(r)||(r=new Sp(this._primitives,this._classificationType,n.attributes.color.value,o),i.push(r)),r.add(t,n),r};py.prototype.remove=function(e){const t=this._batches,n=t.length;for(let i=0;i<n;++i)if(t[i].remove(e))return};py.prototype.update=function(e){let t,n,i=!0;const o=this._batches,r=o.length;for(t=0;t<r;++t)i=o[t].update(e)&&i;for(t=0;t<r;++t){const s=o[t],a=s.itemsToRemove,c=a.length;for(let u=0;u<c;u++){n=a[u],s.remove(n);const f=this.add(e,n);s.isDirty=!0,f.isDirty=!0}}for(t=r-1;t>=0;--t){const s=o[t];s.isDirty&&(i=o[t].update(e)&&i,s.isDirty=!1),s.geometry.length===0&&o.splice(t,1)}return i};py.prototype.getBoundingSphere=function(e,t){const n=this._batches,i=n.length;for(let o=0;o<i;++o){const r=n[o];if(r.contains(e))return r.getBoundingSphere(e,t)}return Ot.FAILED};py.prototype.removeAllPrimitives=function(){const e=this._batches,t=e.length;for(let n=0;n<t;++n)e[n].removeAllPrimitives()};const apt=new sn,cpt=new sn;function vu(e,t,n,i,o,r){this.primitives=e,this.classificationType=t,this.appearanceType=n,this.materialProperty=i,this.updaters=new Vt,this.createPrimitive=!0,this.primitive=void 0,this.oldPrimitive=void 0,this.geometry=new Vt,this.material=void 0,this.updatersWithAttributes=new Vt,this.attributes=new Vt,this.invalidated=!1,this.removeMaterialSubscription=i.definitionChanged.addEventListener(vu.prototype.onMaterialChanged,this),this.subscriptions=new Vt,this.showsUpdated=new Vt,this.usingSphericalTextureCoordinates=o,this.zIndex=r,this.rectangleCollisionCheck=new Xx}vu.prototype.onMaterialChanged=function(){this.invalidated=!0};vu.prototype.overlapping=function(e){return this.rectangleCollisionCheck.collides(e)};vu.prototype.isMaterial=function(e){const t=this.materialProperty,n=e.fillMaterialProperty;return n===t||n instanceof An&&t instanceof An?!0:l(t)&&t.equals(n)};vu.prototype.add=function(e,t,n){const i=t.id;if(this.updaters.set(i,t),this.geometry.set(i,n),this.rectangleCollisionCheck.insert(i,n.geometry.rectangle),!t.hasConstantFill||!t.fillMaterialProperty.isConstant||!ie.isConstant(t.distanceDisplayConditionProperty))this.updatersWithAttributes.set(i,t);else{const o=this;this.subscriptions.set(i,t.entity.definitionChanged.addEventListener(function(r,s,a,c){s==="isShowing"&&o.showsUpdated.set(t.id,t)}))}this.createPrimitive=!0};vu.prototype.remove=function(e){const t=e.id,n=this.geometry.get(t);if(this.createPrimitive=this.geometry.remove(t)||this.createPrimitive,this.updaters.remove(t)){this.rectangleCollisionCheck.remove(t,n.geometry.rectangle),this.updatersWithAttributes.remove(t);const i=this.subscriptions.get(t);return l(i)&&(i(),this.subscriptions.remove(t)),!0}return!1};vu.prototype.update=function(e){let t=!0,n=this.primitive;const i=this.primitives,o=this.geometry.values;let r;if(this.createPrimitive){if(o.length>0)l(n)&&(l(this.oldPrimitive)?i.remove(n):this.oldPrimitive=n),this.material=ls.getValue(e,this.materialProperty,this.material),n=new vs({show:!1,asynchronous:!0,geometryInstances:o.slice(),appearance:new this.appearanceType({material:this.material}),classificationType:this.classificationType}),i.add(n,this.zIndex),t=!1;else{l(n)&&(i.remove(n),n=void 0);const a=this.oldPrimitive;l(a)&&(i.remove(a),this.oldPrimitive=void 0)}this.attributes.removeAll(),this.primitive=n,this.createPrimitive=!1}else if(l(n)&&n.ready){n.show=!0,l(this.oldPrimitive)&&(i.remove(this.oldPrimitive),this.oldPrimitive=void 0),this.material=ls.getValue(e,this.materialProperty,this.material),this.primitive.appearance.material=this.material;const s=this.updatersWithAttributes.values,a=s.length;for(r=0;r<a;r++){const c=s[r],u=c.entity,f=this.geometry.get(c.id);let h=this.attributes.get(f.id.id);l(h)||(h=n.getGeometryInstanceAttributes(f.id),this.attributes.set(f.id.id,h));const _=u.isShowing&&(c.hasConstantFill||c.isFilled(e)),g=h.show[0]===1;_!==g&&(h.show=pi.toValue(_,h.show));const p=c.distanceDisplayConditionProperty;if(!ie.isConstant(p)){const y=ie.getValueOrDefault(p,e,cpt,apt);sn.equals(y,h._lastDistanceDisplayCondition)||(h._lastDistanceDisplayCondition=sn.clone(y,h._lastDistanceDisplayCondition),h.distanceDisplayCondition=Yi.toValue(y,h.distanceDisplayCondition))}}this.updateShows(n)}else l(n)&&!n.ready&&(t=!1);return t};vu.prototype.updateShows=function(e){const t=this.showsUpdated.values,n=t.length;for(let i=0;i<n;i++){const o=t[i],r=o.entity,s=this.geometry.get(o.id);let a=this.attributes.get(s.id.id);l(a)||(a=e.getGeometryInstanceAttributes(s.id),this.attributes.set(s.id.id,a));const c=r.isShowing,u=a.show[0]===1;c!==u&&(a.show=pi.toValue(c,a.show),s.attributes.show.value[0]=a.show[0])}this.showsUpdated.removeAll()};vu.prototype.contains=function(e){return this.updaters.contains(e.id)};vu.prototype.getBoundingSphere=function(e,t){const n=this.primitive;if(!n.ready)return Ot.PENDING;const i=n.getGeometryInstanceAttributes(e.entity);return!l(i)||!l(i.boundingSphere)||l(i.show)&&i.show[0]===0?Ot.FAILED:(i.boundingSphere.clone(t),Ot.DONE)};vu.prototype.destroy=function(){const e=this.primitive,t=this.primitives;l(e)&&t.remove(e);const n=this.oldPrimitive;l(n)&&t.remove(n),this.removeMaterialSubscription()};function MT(e,t,n){this._items=[],this._primitives=e,this._classificationType=t,this._appearanceType=n}MT.prototype.add=function(e,t){const n=this._items,i=n.length,o=t.createFillGeometryInstance(e),r=Ys.shouldUseSphericalCoordinates(o.geometry.rectangle),s=ie.getValueOrDefault(t.zIndex,0);for(let c=0;c<i;++c){const u=n[c];if(u.isMaterial(t)&&u.usingSphericalTextureCoordinates===r&&u.zIndex===s&&!u.overlapping(o.geometry.rectangle)){u.add(e,t,o);return}}const a=new vu(this._primitives,this._classificationType,this._appearanceType,t.fillMaterialProperty,r,s);a.add(e,t,o),n.push(a)};MT.prototype.remove=function(e){const t=this._items,n=t.length;for(let i=n-1;i>=0;i--){const o=t[i];if(o.remove(e)){o.updaters.length===0&&(t.splice(i,1),o.destroy());break}}};MT.prototype.update=function(e){let t;const n=this._items,i=n.length;for(t=i-1;t>=0;t--){const r=n[t];if(r.invalidated){n.splice(t,1);const s=r.updaters.values,a=s.length;for(let c=0;c<a;c++)this.add(e,s[c]);r.destroy()}}let o=!0;for(t=0;t<n.length;t++)o=n[t].update(e)&&o;return o};MT.prototype.getBoundingSphere=function(e,t){const n=this._items,i=n.length;for(let o=0;o<i;o++){const r=n[o];if(r.contains(e))return r.getBoundingSphere(e,t)}return Ot.FAILED};MT.prototype.removeAllPrimitives=function(){const e=this._items,t=e.length;for(let n=0;n<t;n++)e[n].destroy();this._items.length=0};const lpt=new k,upt=new sn,fpt=new sn,dpt=d.ZERO,hpt=new d;function np(e,t,n,i){this.translucent=t,this.width=n,this.shadows=i,this.primitives=e,this.createPrimitive=!1,this.waitingOnCreate=!1,this.primitive=void 0,this.oldPrimitive=void 0,this.geometry=new Vt,this.updaters=new Vt,this.updatersWithAttributes=new Vt,this.attributes=new Vt,this.itemsToRemove=[],this.subscriptions=new Vt,this.showsUpdated=new Vt}np.prototype.add=function(e,t){const n=e.id;if(this.createPrimitive=!0,this.geometry.set(n,t),this.updaters.set(n,e),!e.hasConstantOutline||!e.outlineColorProperty.isConstant||!ie.isConstant(e.distanceDisplayConditionProperty)||!ie.isConstant(e.terrainOffsetProperty))this.updatersWithAttributes.set(n,e);else{const i=this;this.subscriptions.set(n,e.entity.definitionChanged.addEventListener(function(o,r,s,a){r==="isShowing"&&i.showsUpdated.set(e.id,e)}))}};np.prototype.remove=function(e){const t=e.id;if(this.createPrimitive=this.geometry.remove(t)||this.createPrimitive,this.updaters.remove(t)){this.updatersWithAttributes.remove(t);const n=this.subscriptions.get(t);return l(n)&&(n(),this.subscriptions.remove(t),this.showsUpdated.remove(t)),!0}return!1};np.prototype.update=function(e){let t=!0,n=0,i=this.primitive;const o=this.primitives;let r;if(this.createPrimitive){const s=this.geometry.values;if(s.length>0)l(i)&&(l(this.oldPrimitive)?o.remove(i):this.oldPrimitive=i),i=new fn({show:!1,asynchronous:!0,geometryInstances:s.slice(),appearance:new kn({flat:!0,translucent:this.translucent,renderState:{lineWidth:this.width}}),shadows:this.shadows}),o.add(i),t=!1;else{l(i)&&(o.remove(i),i=void 0);const c=this.oldPrimitive;l(c)&&(o.remove(c),this.oldPrimitive=void 0)}this.attributes.removeAll(),this.primitive=i,this.createPrimitive=!1,this.waitingOnCreate=!0}else if(l(i)&&i.ready){i.show=!0,l(this.oldPrimitive)&&(o.remove(this.oldPrimitive),this.oldPrimitive=void 0);const s=this.updatersWithAttributes.values,a=s.length,c=this.waitingOnCreate;for(r=0;r<a;r++){const u=s[r],f=this.geometry.get(u.id);let h=this.attributes.get(f.id.id);if(l(h)||(h=i.getGeometryInstanceAttributes(f.id),this.attributes.set(f.id.id,h)),!u.outlineColorProperty.isConstant||c){const T=u.outlineColorProperty,b=ie.getValueOrDefault(T,e,k.WHITE,lpt);k.equals(h._lastColor,b)||(h._lastColor=k.clone(b,h._lastColor),h.color=Bn.toValue(b,h.color),(this.translucent&&h.color[3]===255||!this.translucent&&h.color[3]!==255)&&(this.itemsToRemove[n++]=u))}const _=u.entity.isShowing&&(u.hasConstantOutline||u.isOutlineVisible(e)),g=h.show[0]===1;_!==g&&(h.show=pi.toValue(_,h.show));const p=u.distanceDisplayConditionProperty;if(!ie.isConstant(p)){const T=ie.getValueOrDefault(p,e,fpt,upt);sn.equals(T,h._lastDistanceDisplayCondition)||(h._lastDistanceDisplayCondition=sn.clone(T,h._lastDistanceDisplayCondition),h.distanceDisplayCondition=Yi.toValue(T,h.distanceDisplayCondition))}const y=u.terrainOffsetProperty;if(!ie.isConstant(y)){const T=ie.getValueOrDefault(y,e,dpt,hpt);d.equals(T,h._lastOffset)||(h._lastOffset=d.clone(T,h._lastOffset),h.offset=Ar.toValue(T,h.offset))}}this.updateShows(i),this.waitingOnCreate=!1}else l(i)&&!i.ready&&(t=!1);return this.itemsToRemove.length=n,t};np.prototype.updateShows=function(e){const t=this.showsUpdated.values,n=t.length;for(let i=0;i<n;i++){const o=t[i],r=this.geometry.get(o.id);let s=this.attributes.get(r.id.id);l(s)||(s=e.getGeometryInstanceAttributes(r.id),this.attributes.set(r.id.id,s));const a=o.entity.isShowing,c=s.show[0]===1;a!==c&&(s.show=pi.toValue(a,s.show),r.attributes.show.value[0]=s.show[0])}this.showsUpdated.removeAll()};np.prototype.contains=function(e){return this.updaters.contains(e.id)};np.prototype.getBoundingSphere=function(e,t){const n=this.primitive;if(!n.ready)return Ot.PENDING;const i=n.getGeometryInstanceAttributes(e.entity);return!l(i)||!l(i.boundingSphere)||l(i.show)&&i.show[0]===0?Ot.FAILED:(i.boundingSphere.clone(t),Ot.DONE)};np.prototype.removeAllPrimitives=function(){const e=this.primitives,t=this.primitive;l(t)&&(e.remove(t),this.primitive=void 0,this.geometry.removeAll(),this.updaters.removeAll());const n=this.oldPrimitive;l(n)&&(e.remove(n),this.oldPrimitive=void 0)};function my(e,t,n){this._primitives=e,this._scene=t,this._shadows=n,this._solidBatches=new Vt,this._translucentBatches=new Vt}my.prototype.add=function(e,t){const n=t.createOutlineGeometryInstance(e),i=this._scene.clampLineWidth(t.outlineWidth);let o,r;n.attributes.color.value[3]===255?(o=this._solidBatches,r=o.get(i),l(r)||(r=new np(this._primitives,!1,i,this._shadows),o.set(i,r)),r.add(t,n)):(o=this._translucentBatches,r=o.get(i),l(r)||(r=new np(this._primitives,!0,i,this._shadows),o.set(i,r)),r.add(t,n))};my.prototype.remove=function(e){let t;const n=this._solidBatches.values,i=n.length;for(t=0;t<i;t++)if(n[t].remove(e))return;const o=this._translucentBatches.values,r=o.length;for(t=0;t<r;t++)if(o[t].remove(e))return};my.prototype.update=function(e){let t,n,i,o;const r=this._solidBatches.values,s=r.length,a=this._translucentBatches.values,c=a.length;let u,f=!0,h=!1;do{for(h=!1,n=0;n<s;n++){o=r[n],f=o.update(e),u=o.itemsToRemove;const _=u.length;if(_>0)for(h=!0,t=0;t<_;t++)i=u[t],o.remove(i),this.add(e,i)}for(n=0;n<c;n++){o=a[n],f=o.update(e),u=o.itemsToRemove;const _=u.length;if(_>0)for(h=!0,t=0;t<_;t++)i=u[t],o.remove(i),this.add(e,i)}}while(h);return f};my.prototype.getBoundingSphere=function(e,t){let n;const i=this._solidBatches.values,o=i.length;for(n=0;n<o;n++){const a=i[n];if(a.contains(e))return a.getBoundingSphere(e,t)}const r=this._translucentBatches.values,s=r.length;for(n=0;n<s;n++){const a=r[n];if(a.contains(e))return a.getBoundingSphere(e,t)}return Ot.FAILED};my.prototype.removeAllPrimitives=function(){let e;const t=this._solidBatches.values,n=t.length;for(e=0;e<n;e++)t[e].removeAllPrimitives();const i=this._translucentBatches.values,o=i.length;for(e=0;e<o;e++)i[e].removeAllPrimitives()};const Rse={};function ppt(e,t){return F.equalsEpsilon(e.latitude,t.latitude,F.EPSILON10)&&F.equalsEpsilon(e.longitude,t.longitude,F.EPSILON10)}const mpt=new ve,_pt=new ve;function gpt(e,t,n,i){t=Ya(t,d.equalsEpsilon);const o=t.length;if(o<2)return;const r=l(i),s=l(n),a=new Array(o),c=new Array(o),u=new Array(o),f=t[0];a[0]=f;const h=e.cartesianToCartographic(f,mpt);s&&(h.height=n[0]),c[0]=h.height,r?u[0]=i[0]:u[0]=0;const _=c[0],g=u[0];let p=_===g,y=1;for(let T=1;T<o;++T){const b=t[T],x=e.cartesianToCartographic(b,_pt);s&&(x.height=n[T]),p=p&&x.height===0,ppt(h,x)?h.height<x.height&&(c[y-1]=x.height):(a[y]=b,c[y]=x.height,r?u[y]=i[T]:u[y]=0,p=p&&c[y]===u[y],ve.clone(x,h),++y)}if(!(p||y<2))return a.length=y,c.length=y,u.length=y,{positions:a,topHeights:c,bottomHeights:u}}const ypt=new Array(2),Apt=new Array(2),Tpt={positions:void 0,height:void 0,granularity:void 0,ellipsoid:void 0};Rse.computePositions=function(e,t,n,i,o,r){const s=gpt(e,t,n,i);if(!l(s))return;t=s.positions,n=s.topHeights,i=s.bottomHeights;const a=t.length,c=a-2;let u,f;const h=F.chordLength(o,e.maximumRadius),_=Tpt;if(_.minDistance=h,_.ellipsoid=e,r){let g=0,p;for(p=0;p<a-1;p++)g+=Jr.numberOfPoints(t[p],t[p+1],h)+1;u=new Float64Array(g*3),f=new Float64Array(g*3);const y=ypt,T=Apt;_.positions=y,_.height=T;let b=0;for(p=0;p<a-1;p++){y[0]=t[p],y[1]=t[p+1],T[0]=n[p],T[1]=n[p+1];const x=Jr.generateArc(_);u.set(x,b),T[0]=i[p],T[1]=i[p+1],f.set(Jr.generateArc(_),b),b+=x.length}}else _.positions=t,_.height=n,u=new Float64Array(Jr.generateArc(_)),_.height=i,f=new Float64Array(Jr.generateArc(_));return{bottomPositions:f,topPositions:u,numCorners:c}};const Nse=Rse,FN=new d,Zv=new d,Cpt=new d,jj=new d,bpt=new d,Ept=new d,xpt=new d;function _y(e){e=A(e,A.EMPTY_OBJECT);const t=e.positions,n=e.maximumHeights,i=e.minimumHeights;if(!l(t))throw new w("options.positions is required.");if(l(n)&&n.length!==t.length)throw new w("options.positions and options.maximumHeights must have the same length.");if(l(i)&&i.length!==t.length)throw new w("options.positions and options.minimumHeights must have the same length.");const o=A(e.vertexFormat,Ye.DEFAULT),r=A(e.granularity,F.RADIANS_PER_DEGREE),s=A(e.ellipsoid,be.WGS84);this._positions=t,this._minimumHeights=i,this._maximumHeights=n,this._vertexFormat=Ye.clone(o),this._granularity=r,this._ellipsoid=be.clone(s),this._workerName="createWallGeometry";let a=1+t.length*d.packedLength+2;l(i)&&(a+=i.length),l(n)&&(a+=n.length),this.packedLength=a+be.packedLength+Ye.packedLength+1}_y.pack=function(e,t,n){if(!l(e))throw new w("value is required");if(!l(t))throw new w("array is required");n=A(n,0);let i;const o=e._positions;let r=o.length;for(t[n++]=r,i=0;i<r;++i,n+=d.packedLength)d.pack(o[i],t,n);const s=e._minimumHeights;if(r=l(s)?s.length:0,t[n++]=r,l(s))for(i=0;i<r;++i)t[n++]=s[i];const a=e._maximumHeights;if(r=l(a)?a.length:0,t[n++]=r,l(a))for(i=0;i<r;++i)t[n++]=a[i];return be.pack(e._ellipsoid,t,n),n+=be.packedLength,Ye.pack(e._vertexFormat,t,n),n+=Ye.packedLength,t[n]=e._granularity,t};const Mse=be.clone(be.UNIT_SPHERE),Fse=new Ye,ab={positions:void 0,minimumHeights:void 0,maximumHeights:void 0,ellipsoid:Mse,vertexFormat:Fse,granularity:void 0};_y.unpack=function(e,t,n){if(!l(e))throw new w("array is required");t=A(t,0);let i,o=e[t++];const r=new Array(o);for(i=0;i<o;++i,t+=d.packedLength)r[i]=d.unpack(e,t);o=e[t++];let s;if(o>0)for(s=new Array(o),i=0;i<o;++i)s[i]=e[t++];o=e[t++];let a;if(o>0)for(a=new Array(o),i=0;i<o;++i)a[i]=e[t++];const c=be.unpack(e,t,Mse);t+=be.packedLength;const u=Ye.unpack(e,t,Fse);t+=Ye.packedLength;const f=e[t];return l(n)?(n._positions=r,n._minimumHeights=s,n._maximumHeights=a,n._ellipsoid=be.clone(c,n._ellipsoid),n._vertexFormat=Ye.clone(u,n._vertexFormat),n._granularity=f,n):(ab.positions=r,ab.minimumHeights=s,ab.maximumHeights=a,ab.granularity=f,new _y(ab))};_y.fromConstantHeights=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.positions;if(!l(t))throw new w("options.positions is required.");let n,i;const o=e.minimumHeight,r=e.maximumHeight,s=l(o),a=l(r);if(s||a){const u=t.length;n=s?new Array(u):void 0,i=a?new Array(u):void 0;for(let f=0;f<u;++f)s&&(n[f]=o),a&&(i[f]=r)}const c={positions:t,maximumHeights:i,minimumHeights:n,ellipsoid:e.ellipsoid,vertexFormat:e.vertexFormat};return new _y(c)};_y.createGeometry=function(e){const t=e._positions,n=e._minimumHeights,i=e._maximumHeights,o=e._vertexFormat,r=e._granularity,s=e._ellipsoid,a=Nse.computePositions(s,t,i,n,r,!0);if(!l(a))return;const c=a.bottomPositions,u=a.topPositions,f=a.numCorners;let h=u.length,_=h*2;const g=o.position?new Float64Array(_):void 0,p=o.normal?new Float32Array(_):void 0,y=o.tangent?new Float32Array(_):void 0,T=o.bitangent?new Float32Array(_):void 0,b=o.st?new Float32Array(_/3*2):void 0;let x=0,v=0,D=0,L=0,B=0,V=xpt,M=Ept,H=bpt,G=!0;h/=3;let I,O=0;const m=1/(h-f-1);for(I=0;I<h;++I){const q=I*3,Y=d.fromArray(u,q,FN),j=d.fromArray(c,q,Zv);if(o.position&&(g[x++]=j.x,g[x++]=j.y,g[x++]=j.z,g[x++]=Y.x,g[x++]=Y.y,g[x++]=Y.z),o.st&&(b[B++]=O,b[B++]=0,b[B++]=O,b[B++]=1),o.normal||o.tangent||o.bitangent){let ee=d.clone(d.ZERO,jj);const K=d.subtract(Y,s.geodeticSurfaceNormal(Y,Zv),Zv);if(I+1<h&&(ee=d.fromArray(u,q+3,jj)),G){const se=d.subtract(ee,Y,Cpt),Q=d.subtract(K,Y,FN);V=d.normalize(d.cross(Q,se,V),V),G=!1}d.equalsEpsilon(Y,ee,F.EPSILON10)?G=!0:(O+=m,o.tangent&&(M=d.normalize(d.subtract(ee,Y,M),M)),o.bitangent&&(H=d.normalize(d.cross(V,M,H),H))),o.normal&&(p[v++]=V.x,p[v++]=V.y,p[v++]=V.z,p[v++]=V.x,p[v++]=V.y,p[v++]=V.z),o.tangent&&(y[L++]=M.x,y[L++]=M.y,y[L++]=M.z,y[L++]=M.x,y[L++]=M.y,y[L++]=M.z),o.bitangent&&(T[D++]=H.x,T[D++]=H.y,T[D++]=H.z,T[D++]=H.x,T[D++]=H.y,T[D++]=H.z)}}const P=new To;o.position&&(P.position=new Xe({componentDatatype:oe.DOUBLE,componentsPerAttribute:3,values:g})),o.normal&&(P.normal=new Xe({componentDatatype:oe.FLOAT,componentsPerAttribute:3,values:p})),o.tangent&&(P.tangent=new Xe({componentDatatype:oe.FLOAT,componentsPerAttribute:3,values:y})),o.bitangent&&(P.bitangent=new Xe({componentDatatype:oe.FLOAT,componentsPerAttribute:3,values:T})),o.st&&(P.st=new Xe({componentDatatype:oe.FLOAT,componentsPerAttribute:2,values:b}));const R=_/3;_-=6*(f+1);const U=At.createTypedArray(R,_);let W=0;for(I=0;I<R-2;I+=2){const q=I,Y=I+2,j=d.fromArray(g,q*3,FN),ee=d.fromArray(g,Y*3,Zv);if(d.equalsEpsilon(j,ee,F.EPSILON10))continue;const K=I+1,se=I+3;U[W++]=K,U[W++]=q,U[W++]=se,U[W++]=se,U[W++]=q,U[W++]=Y}return new $t({attributes:P,indices:U,primitiveType:dt.TRIANGLES,boundingSphere:new Ae.fromVertices(g)})};const Yj=new d,$j=new d;function gy(e){e=A(e,A.EMPTY_OBJECT);const t=e.positions,n=e.maximumHeights,i=e.minimumHeights;if(!l(t))throw new w("options.positions is required.");if(l(n)&&n.length!==t.length)throw new w("options.positions and options.maximumHeights must have the same length.");if(l(i)&&i.length!==t.length)throw new w("options.positions and options.minimumHeights must have the same length.");const o=A(e.granularity,F.RADIANS_PER_DEGREE),r=A(e.ellipsoid,be.WGS84);this._positions=t,this._minimumHeights=i,this._maximumHeights=n,this._granularity=o,this._ellipsoid=be.clone(r),this._workerName="createWallOutlineGeometry";let s=1+t.length*d.packedLength+2;l(i)&&(s+=i.length),l(n)&&(s+=n.length),this.packedLength=s+be.packedLength+1}gy.pack=function(e,t,n){if(!l(e))throw new w("value is required");if(!l(t))throw new w("array is required");n=A(n,0);let i;const o=e._positions;let r=o.length;for(t[n++]=r,i=0;i<r;++i,n+=d.packedLength)d.pack(o[i],t,n);const s=e._minimumHeights;if(r=l(s)?s.length:0,t[n++]=r,l(s))for(i=0;i<r;++i)t[n++]=s[i];const a=e._maximumHeights;if(r=l(a)?a.length:0,t[n++]=r,l(a))for(i=0;i<r;++i)t[n++]=a[i];return be.pack(e._ellipsoid,t,n),n+=be.packedLength,t[n]=e._granularity,t};const zse=be.clone(be.UNIT_SPHERE),cb={positions:void 0,minimumHeights:void 0,maximumHeights:void 0,ellipsoid:zse,granularity:void 0};gy.unpack=function(e,t,n){if(!l(e))throw new w("array is required");t=A(t,0);let i,o=e[t++];const r=new Array(o);for(i=0;i<o;++i,t+=d.packedLength)r[i]=d.unpack(e,t);o=e[t++];let s;if(o>0)for(s=new Array(o),i=0;i<o;++i)s[i]=e[t++];o=e[t++];let a;if(o>0)for(a=new Array(o),i=0;i<o;++i)a[i]=e[t++];const c=be.unpack(e,t,zse);t+=be.packedLength;const u=e[t];return l(n)?(n._positions=r,n._minimumHeights=s,n._maximumHeights=a,n._ellipsoid=be.clone(c,n._ellipsoid),n._granularity=u,n):(cb.positions=r,cb.minimumHeights=s,cb.maximumHeights=a,cb.granularity=u,new gy(cb))};gy.fromConstantHeights=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.positions;if(!l(t))throw new w("options.positions is required.");let n,i;const o=e.minimumHeight,r=e.maximumHeight,s=l(o),a=l(r);if(s||a){const u=t.length;n=s?new Array(u):void 0,i=a?new Array(u):void 0;for(let f=0;f<u;++f)s&&(n[f]=o),a&&(i[f]=r)}const c={positions:t,maximumHeights:i,minimumHeights:n,ellipsoid:e.ellipsoid};return new gy(c)};gy.createGeometry=function(e){const t=e._positions,n=e._minimumHeights,i=e._maximumHeights,o=e._granularity,r=e._ellipsoid,s=Nse.computePositions(r,t,i,n,o,!1);if(!l(s))return;const a=s.bottomPositions,c=s.topPositions;let u=c.length,f=u*2;const h=new Float64Array(f);let _=0;u/=3;let g;for(g=0;g<u;++g){const x=g*3,v=d.fromArray(c,x,Yj),D=d.fromArray(a,x,$j);h[_++]=D.x,h[_++]=D.y,h[_++]=D.z,h[_++]=v.x,h[_++]=v.y,h[_++]=v.z}const p=new To({position:new Xe({componentDatatype:oe.DOUBLE,componentsPerAttribute:3,values:h})}),y=f/3;f=2*y-4+y;const T=At.createTypedArray(y,f);let b=0;for(g=0;g<y-2;g+=2){const x=g,v=g+2,D=d.fromArray(h,x*3,Yj),L=d.fromArray(h,v*3,$j);if(d.equalsEpsilon(D,L,F.EPSILON10))continue;const B=g+1,V=g+3;T[b++]=B,T[b++]=x,T[b++]=B,T[b++]=V,T[b++]=x,T[b++]=v}return T[b++]=y-2,T[b++]=y-1,new $t({attributes:p,indices:T,primitiveType:dt.LINES,boundingSphere:new Ae.fromVertices(h)})};const Use=new k;function wpt(e){this.id=e,this.vertexFormat=void 0,this.positions=void 0,this.minimumHeights=void 0,this.maximumHeights=void 0,this.granularity=void 0}function ff(e,t){li.call(this,{entity:e,scene:t,geometryOptions:new wpt(e),geometryPropertyName:"wall",observedPropertyNames:["availability","wall"]}),this._onEntityPropertyChanged(e,"wall",e.wall,void 0)}l(Object.create)&&(ff.prototype=Object.create(li.prototype),ff.prototype.constructor=ff);ff.prototype.createFillGeometryInstance=function(e){if(E.defined("time",e),!this._fillEnabled)throw new w("This instance does not represent a filled geometry.");const t=this._entity,n=t.isAvailable(e);let i,o;const r=new pi(n&&t.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),s=this._distanceDisplayConditionProperty.getValue(e),a=Yi.fromDistanceDisplayCondition(s);if(this._materialProperty instanceof An){let c;l(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(c=this._materialProperty.color.getValue(e,Use)),l(c)||(c=k.WHITE),o=Bn.fromColor(c),i={show:r,distanceDisplayCondition:a,color:o}}else i={show:r,distanceDisplayCondition:a};return new xn({id:t,geometry:new _y(this._options),attributes:i})};ff.prototype.createOutlineGeometryInstance=function(e){if(E.defined("time",e),!this._outlineEnabled)throw new w("This instance does not represent an outlined geometry.");const t=this._entity,n=t.isAvailable(e),i=ie.getValueOrDefault(this._outlineColorProperty,e,k.BLACK,Use),o=this._distanceDisplayConditionProperty.getValue(e);return new xn({id:t,geometry:new gy(this._options),attributes:{show:new pi(n&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:Bn.fromColor(i),distanceDisplayCondition:Yi.fromDistanceDisplayCondition(o)}})};ff.prototype._isHidden=function(e,t){return!l(t.positions)||li.prototype._isHidden.call(this,e,t)};ff.prototype._getIsClosed=function(e){return!1};ff.prototype._isDynamic=function(e,t){return!t.positions.isConstant||!ie.isConstant(t.minimumHeights)||!ie.isConstant(t.maximumHeights)||!ie.isConstant(t.outlineWidth)||!ie.isConstant(t.granularity)};ff.prototype._setStaticOptions=function(e,t){const n=t.minimumHeights,i=t.maximumHeights,o=t.granularity,r=this._materialProperty instanceof An,s=this._options;s.vertexFormat=r?kn.VERTEX_FORMAT:Dr.MaterialSupport.TEXTURED.vertexFormat,s.positions=t.positions.getValue(wt.MINIMUM_VALUE,s.positions),s.minimumHeights=l(n)?n.getValue(wt.MINIMUM_VALUE,s.minimumHeights):void 0,s.maximumHeights=l(i)?i.getValue(wt.MINIMUM_VALUE,s.maximumHeights):void 0,s.granularity=l(o)?o.getValue(wt.MINIMUM_VALUE):void 0};ff.DynamicGeometryUpdater=UA;function UA(e,t,n){Mi.call(this,e,t,n)}l(Object.create)&&(UA.prototype=Object.create(Mi.prototype),UA.prototype.constructor=UA);UA.prototype._isHidden=function(e,t,n){return!l(this._options.positions)||Mi.prototype._isHidden.call(this,e,t,n)};UA.prototype._setOptions=function(e,t,n){const i=this._options;i.positions=ie.getValueOrUndefined(t.positions,n,i.positions),i.minimumHeights=ie.getValueOrUndefined(t.minimumHeights,n,i.minimumHeights),i.maximumHeights=ie.getValueOrUndefined(t.maximumHeights,n,i.maximumHeights),i.granularity=ie.getValueOrUndefined(t.granularity,n)};const Spt=[],Xj=[ll,ul,cf,lf,fl,du,dl,_d,uf,ff];function Kx(e,t){this.entity=e,this.scene=t;const n=new Array(Xj.length),i=new lt;function o(s){i.raiseEvent(s)}const r=new Yd;for(let s=0;s<n.length;s++){const a=new Xj[s](e,t);r.add(a.geometryChanged,o),n[s]=a}this.updaters=n,this.geometryChanged=i,this.eventHelper=r,this._removeEntitySubscription=e.definitionChanged.addEventListener(Kx.prototype._onEntityPropertyChanged,this)}Kx.prototype._onEntityPropertyChanged=function(e,t,n,i){const o=this.updaters;for(let r=0;r<o.length;r++)o[r]._onEntityPropertyChanged(e,t,n,i)};Kx.prototype.forEach=function(e){const t=this.updaters;for(let n=0;n<t.length;n++)e(t[n])};Kx.prototype.destroy=function(){this.eventHelper.removeAll();const e=this.updaters;for(let t=0;t<e.length;t++)e[t].destroy();this._removeEntitySubscription(),Je(this)};function Cu(e,t,n,i){E.defined("scene",e),E.defined("entityCollection",t),n=A(n,e.primitives),i=A(i,e.groundPrimitives),this._scene=e,this._primitives=n,this._groundPrimitives=i,this._entityCollection=void 0,this._addedObjects=new Vt,this._removedObjects=new Vt,this._changedObjects=new Vt;const o=sr.NUMBER_OF_SHADOW_MODES;this._outlineBatches=new Array(o*2),this._closedColorBatches=new Array(o*2),this._closedMaterialBatches=new Array(o*2),this._openColorBatches=new Array(o*2),this._openMaterialBatches=new Array(o*2);const r=hs.supportsMaterialsforEntitiesOnTerrain(e);this._supportsMaterialsforEntitiesOnTerrain=r;let s;for(s=0;s<o;++s)this._outlineBatches[s]=new my(n,e,s),this._outlineBatches[o+s]=new my(n,e,s),this._closedColorBatches[s]=new ou(n,kn,void 0,!0,s),this._closedColorBatches[o+s]=new ou(n,kn,void 0,!0,s),this._closedMaterialBatches[s]=new ru(n,Dr,void 0,!0,s),this._closedMaterialBatches[o+s]=new ru(n,Dr,void 0,!0,s),this._openColorBatches[s]=new ou(n,kn,void 0,!1,s),this._openColorBatches[o+s]=new ou(n,kn,void 0,!1,s),this._openMaterialBatches[s]=new ru(n,Dr,void 0,!1,s),this._openMaterialBatches[o+s]=new ru(n,Dr,void 0,!1,s);const a=ir.NUMBER_OF_CLASSIFICATION_TYPES,c=new Array(a),u=[];if(r)for(s=0;s<a;++s)u.push(new MT(i,s,Dr)),c[s]=new py(i,s);else for(s=0;s<a;++s)c[s]=new py(i,s);this._groundColorBatches=c,this._groundMaterialBatches=u,this._dynamicBatch=new Yy(n,i),this._batches=this._outlineBatches.concat(this._closedColorBatches,this._closedMaterialBatches,this._openColorBatches,this._openMaterialBatches,this._groundColorBatches,this._groundMaterialBatches,this._dynamicBatch),this._subscriptions=new Vt,this._updaterSets=new Vt,this._entityCollection=t,t.collectionChanged.addEventListener(Cu.prototype._onCollectionChanged,this),this._onCollectionChanged(t,t.values,Spt)}Cu.prototype.update=function(e){E.defined("time",e);const t=this._addedObjects,n=t.values,i=this._removedObjects,o=i.values,r=this._changedObjects,s=r.values;let a,c,u,f;const h=this;for(a=s.length-1;a>-1;a--)c=s[a],u=c.id,f=this._updaterSets.get(u),f.entity===c?f.forEach(function(y){h._removeUpdater(y),h._insertUpdaterIntoBatch(e,y)}):(o.push(c),n.push(c));for(a=o.length-1;a>-1;a--)c=o[a],u=c.id,f=this._updaterSets.get(u),f.forEach(this._removeUpdater.bind(this)),f.destroy(),this._updaterSets.remove(u),this._subscriptions.get(u)(),this._subscriptions.remove(u);for(a=n.length-1;a>-1;a--)c=n[a],u=c.id,f=new Kx(c,this._scene),this._updaterSets.set(u,f),f.forEach(function(y){h._insertUpdaterIntoBatch(e,y)}),this._subscriptions.set(u,f.geometryChanged.addEventListener(Cu._onGeometryChanged,this));t.removeAll(),i.removeAll(),r.removeAll();let _=!0;const g=this._batches,p=g.length;for(a=0;a<p;a++)_=g[a].update(e)&&_;return _};const vpt=[],Dpt=new Ae;Cu.prototype.getBoundingSphere=function(e,t){E.defined("entity",e),E.defined("result",t);const n=vpt,i=Dpt;let o=0,r=Ot.DONE;const s=this._batches,a=s.length,c=e.id,u=this._updaterSets.get(c).updaters;for(let f=0;f<u.length;f++){const h=u[f];for(let _=0;_<a;_++){if(r=s[_].getBoundingSphere(h,i),r===Ot.PENDING)return Ot.PENDING;r===Ot.DONE&&(n[o]=Ae.clone(i,n[o]),o++)}}return o===0?Ot.FAILED:(n.length=o,Ae.fromBoundingSpheres(n,t),Ot.DONE)};Cu.prototype.isDestroyed=function(){return!1};Cu.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(Cu.prototype._onCollectionChanged,this),this._addedObjects.removeAll(),this._removedObjects.removeAll();let e;const t=this._batches;let n=t.length;for(e=0;e<n;e++)t[e].removeAllPrimitives();const i=this._subscriptions.values;for(n=i.length,e=0;e<n;e++)i[e]();this._subscriptions.removeAll();const o=this._updaterSets.values;for(n=o.length,e=0;e<n;e++)o[e].destroy();return this._updaterSets.removeAll(),Je(this)};Cu.prototype._removeUpdater=function(e){const t=this._batches,n=t.length;for(let i=0;i<n;i++)t[i].remove(e)};Cu.prototype._insertUpdaterIntoBatch=function(e,t){if(t.isDynamic){this._dynamicBatch.add(e,t);return}let n;(t.outlineEnabled||t.fillEnabled)&&(n=t.shadowsProperty.getValue(e));const i=sr.NUMBER_OF_SHADOW_MODES;if(t.outlineEnabled&&(l(t.terrainOffsetProperty)?this._outlineBatches[i+n].add(e,t):this._outlineBatches[n].add(e,t)),t.fillEnabled)if(t.onTerrain){const o=t.classificationTypeProperty.getValue(e);t.fillMaterialProperty instanceof An?this._groundColorBatches[o].add(e,t):this._groundMaterialBatches[o].add(e,t)}else t.isClosed?t.fillMaterialProperty instanceof An?l(t.terrainOffsetProperty)?this._closedColorBatches[i+n].add(e,t):this._closedColorBatches[n].add(e,t):l(t.terrainOffsetProperty)?this._closedMaterialBatches[i+n].add(e,t):this._closedMaterialBatches[n].add(e,t):t.fillMaterialProperty instanceof An?l(t.terrainOffsetProperty)?this._openColorBatches[i+n].add(e,t):this._openColorBatches[n].add(e,t):l(t.terrainOffsetProperty)?this._openMaterialBatches[i+n].add(e,t):this._openMaterialBatches[n].add(e,t)};Cu._onGeometryChanged=function(e){const t=this._removedObjects,n=this._changedObjects,i=e.entity,o=i.id;!l(t.get(o))&&!l(n.get(o))&&n.set(o,i)};Cu.prototype._onCollectionChanged=function(e,t,n){const i=this._addedObjects,o=this._removedObjects,r=this._changedObjects;let s,a,c;for(s=n.length-1;s>-1;s--)c=n[s],a=c.id,i.remove(a)||(o.set(a,c),r.remove(a));for(s=t.length-1;s>-1;s--)c=t[s],a=c.id,o.remove(a)?r.set(a,c):i.set(a,c)};const Ipt=1,Ppt="30px sans-serif",Opt=nf.FILL,Lpt=k.WHITE,Bpt=k.BLACK,Rpt=1,Npt=!1,Mpt=new k(.165,.165,.165,.8),Fpt=new $(7,5),zpt=$.ZERO,Upt=d.ZERO,Hpt=Ht.NONE,Vpt=yc.CENTER,kpt=co.CENTER,Gpt=new d,Wpt=new k,qpt=new k,jpt=new k,Ypt=new $,$pt=new d,Xpt=new $,Kpt=new tn,Jpt=new tn,Qpt=new tn,Zpt=new sn;function Kj(e){this.entity=e,this.label=void 0,this.index=void 0}function l_(e,t){if(!l(e))throw new w("entityCluster is required.");if(!l(t))throw new w("entityCollection is required.");t.collectionChanged.addEventListener(l_.prototype._onCollectionChanged,this),this._cluster=e,this._entityCollection=t,this._items=new Vt,this._onCollectionChanged(t,t.values,[],[])}l_.prototype.update=function(e){if(!l(e))throw new w("time is required.");const t=this._items.values,n=this._cluster;for(let i=0,o=t.length;i<o;i++){const r=t[i],s=r.entity,a=s._label;let c,u=r.label,f=s.isShowing&&s.isAvailable(e)&&ie.getValueOrDefault(a._show,e,!0),h;if(f&&(h=ie.getValueOrUndefined(s._position,e,Gpt),c=ie.getValueOrUndefined(a._text,e),f=l(h)&&l(c)),!f){x2(r,s,n);continue}ie.isConstant(s._position)||(n._clusterDirty=!0);let _=!1;const g=ie.getValueOrDefault(a._heightReference,e,Hpt);l(u)||(u=n.getLabel(s),u.id=s,r.label=u,_=d.equals(u.position,h)&&u.heightReference===g),u.show=!0,u.position=h,u.text=c,u.scale=ie.getValueOrDefault(a._scale,e,Ipt),u.font=ie.getValueOrDefault(a._font,e,Ppt),u.style=ie.getValueOrDefault(a._style,e,Opt),u.fillColor=ie.getValueOrDefault(a._fillColor,e,Lpt,Wpt),u.outlineColor=ie.getValueOrDefault(a._outlineColor,e,Bpt,qpt),u.outlineWidth=ie.getValueOrDefault(a._outlineWidth,e,Rpt),u.showBackground=ie.getValueOrDefault(a._showBackground,e,Npt),u.backgroundColor=ie.getValueOrDefault(a._backgroundColor,e,Mpt,jpt),u.backgroundPadding=ie.getValueOrDefault(a._backgroundPadding,e,Fpt,Ypt),u.pixelOffset=ie.getValueOrDefault(a._pixelOffset,e,zpt,Xpt),u.eyeOffset=ie.getValueOrDefault(a._eyeOffset,e,Upt,$pt),u.heightReference=g,u.horizontalOrigin=ie.getValueOrDefault(a._horizontalOrigin,e,Vpt),u.verticalOrigin=ie.getValueOrDefault(a._verticalOrigin,e,kpt),u.translucencyByDistance=ie.getValueOrUndefined(a._translucencyByDistance,e,Kpt),u.pixelOffsetScaleByDistance=ie.getValueOrUndefined(a._pixelOffsetScaleByDistance,e,Jpt),u.scaleByDistance=ie.getValueOrUndefined(a._scaleByDistance,e,Qpt),u.distanceDisplayCondition=ie.getValueOrUndefined(a._distanceDisplayCondition,e,Zpt),u.disableDepthTestDistance=ie.getValueOrUndefined(a._disableDepthTestDistance,e),_&&u._updateClamping()}return!0};l_.prototype.getBoundingSphere=function(e,t){if(!l(e))throw new w("entity is required.");if(!l(t))throw new w("result is required.");const n=this._items.get(e.id);if(!l(n)||!l(n.label))return Ot.FAILED;const i=n.label;return t.center=d.clone(A(i._clampedPosition,i.position),t.center),t.radius=0,Ot.DONE};l_.prototype.isDestroyed=function(){return!1};l_.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(l_.prototype._onCollectionChanged,this);const e=this._entityCollection.values;for(let t=0;t<e.length;t++)this._cluster.removeLabel(e[t]);return Je(this)};l_.prototype._onCollectionChanged=function(e,t,n,i){let o,r;const s=this._items,a=this._cluster;for(o=t.length-1;o>-1;o--)r=t[o],l(r._label)&&l(r._position)&&s.set(r.id,new Kj(r));for(o=i.length-1;o>-1;o--)r=i[o],l(r._label)&&l(r._position)?s.contains(r.id)||s.set(r.id,new Kj(r)):(x2(s.get(r.id),r,a),s.remove(r.id));for(o=n.length-1;o>-1;o--)r=n[o],x2(s.get(r.id),r,a),s.remove(r.id)};function x2(e,t,n){l(e)&&(e.label=void 0,n.removeLabel(t))}function emt(e,t,n){return E.typeOf.object("terrainProvider",e),E.typeOf.number("level",t),E.defined("positions",n),e.readyPromise.then(function(){return imt(e,t,n)})}function tmt(e,t){const n=e[0],i=n.terrainProvider.requestTileGeometry(n.x,n.y,n.level);if(!i)return!1;const o=i.then(omt(n)).catch(rmt(n));return e.shift(),t.push(o),!0}function nmt(e){return new Promise(function(t){setTimeout(t,e)})}function w2(e,t){return e.length?tmt(e,t)?w2(e,t):nmt(100).then(()=>w2(e,t)):Promise.resolve()}function imt(e,t,n){const i=e.tilingScheme;let o;const r=[],s={};for(o=0;o<n.length;++o){const c=i.positionToTileXY(n[o],t),u=c.toString();if(!s.hasOwnProperty(u)){const f={x:c.x,y:c.y,level:t,tilingScheme:i,terrainProvider:e,positions:[]};s[u]=f,r.push(f)}s[u].positions.push(n[o])}const a=[];return w2(r,a).then(function(){return Promise.all(a).then(function(){return n})})}function Jj(e,t,n){const i=t.interpolateHeight(n,e.longitude,e.latitude);return i===void 0?!1:(e.height=i,!0)}function omt(e){const t=e.positions,n=e.tilingScheme.tileXYToRectangle(e.x,e.y,e.level);return function(i){let o=!1;for(let r=0;r<t.length;++r){const s=t[r];if(!Jj(s,i,n)){o=!0;break}}return o?i.createMesh({tilingScheme:e.tilingScheme,x:e.x,y:e.y,level:e.level,throttle:!1}).then(function(){for(let r=0;r<t.length;++r){const s=t[r];Jj(s,i,n)}}):Promise.resolve()}}function rmt(e){const t=e.positions;return function(){for(let n=0;n<t.length;++n){const i=t[n];i.height=void 0}}}const zN=new $;function HP(e,t){if(!l(e))throw new w("terrainProvider is required.");if(!l(t))throw new w("positions is required.");return e.readyPromise.then(function(){const n=[],i=[],o=e.availability;if(!l(o))throw new w("sampleTerrainMostDetailed requires a terrain provider that has tile availability.");const r=[];for(let s=0;s<t.length;++s){const a=t[s],c=o.computeMaximumLevelAtPosition(a);if(i[s]=c,c===0){e.tilingScheme.positionToTileXY(a,1,zN);const f=e.loadTileDataAvailability(zN.x,zN.y,1);l(f)&&r.push(f)}let u=n[c];l(u)||(n[c]=u=[]),u.push(a)}return Promise.all(r).then(function(){return Promise.all(n.map(function(s,a){if(l(s))return emt(e,a,s)}))}).then(function(){const s=[];for(let a=0;a<t.length;++a){const c=t[a];o.computeMaximumLevelAtPosition(c)!==i[a]&&s.push(c)}if(s.length>0)return HP(e,s)}).then(function(){return t})})}const smt=1,amt=0,cmt=!0,lmt=!0,umt=sr.ENABLED,fmt=Ht.NONE,dmt=k.RED,hmt=0,pmt=k.WHITE,mmt=vP.HIGHLIGHT,_mt=.5,gmt=new $(1,1),ymt=new N,Amt=new N,Qj=new k;function wd(e,t){E.typeOf.object("scene",e),E.typeOf.object("entityCollection",t),t.collectionChanged.addEventListener(wd.prototype._onCollectionChanged,this),this._scene=e,this._primitives=e.primitives,this._entityCollection=t,this._modelHash={},this._entitiesToVisualize=new Vt,this._onCollectionChanged(t,t.values,[],[])}wd.prototype.update=function(e){if(!l(e))throw new w("time is required.");const t=this._entitiesToVisualize.values,n=this._modelHash,i=this._primitives;for(let o=0,r=t.length;o<r;o++){const s=t[o],a=s._model;let c,u=n[s.id],f=s.isShowing&&s.isAvailable(e)&&ie.getValueOrDefault(a._show,e,!0),h;if(f&&(h=s.computeModelMatrix(e,ymt),c=je.createIfNeeded(ie.getValueOrUndefined(a._uri,e)),f=l(h)&&l(c)),!f){l(u)&&(u.modelPrimitive.show=!1);continue}let _=l(u)?u.modelPrimitive:void 0;if((!l(_)||c.url!==u.url)&&(l(_)&&(i.removeAndDestroy(_),delete n[s.id]),_=Vi.fromGltf({url:c,incrementallyLoadTextures:ie.getValueOrDefault(a._incrementallyLoadTextures,e,cmt),scene:this._scene}),_.id=s,i.add(_),u={modelPrimitive:_,url:c.url,animationsRunning:!1,nodeTransformationsScratch:{},articulationsScratch:{},loadFail:!1,awaitingSampleTerrain:!1,clampedBoundingSphere:void 0,sampleTerrainFailed:!1},n[s.id]=u,Cmt(_,s,n)),_.show=!0,_.scale=ie.getValueOrDefault(a._scale,e,smt),_.minimumPixelSize=ie.getValueOrDefault(a._minimumPixelSize,e,amt),_.maximumScale=ie.getValueOrUndefined(a._maximumScale,e),_.modelMatrix=N.clone(h,_.modelMatrix),_.shadows=ie.getValueOrDefault(a._shadows,e,umt),_.heightReference=ie.getValueOrDefault(a._heightReference,e,fmt),_.distanceDisplayCondition=ie.getValueOrUndefined(a._distanceDisplayCondition,e),_.silhouetteColor=ie.getValueOrDefault(a._silhouetteColor,e,dmt,Qj),_.silhouetteSize=ie.getValueOrDefault(a._silhouetteSize,e,hmt),_.color=ie.getValueOrDefault(a._color,e,pmt,Qj),_.colorBlendMode=ie.getValueOrDefault(a._colorBlendMode,e,mmt),_.colorBlendAmount=ie.getValueOrDefault(a._colorBlendAmount,e,_mt),_.clippingPlanes=ie.getValueOrUndefined(a._clippingPlanes,e),_.clampAnimations=ie.getValueOrDefault(a._clampAnimations,e,lmt),_.imageBasedLighting.imageBasedLightingFactor=ie.getValueOrDefault(a._imageBasedLightingFactor,e,gmt),_.lightColor=ie.getValueOrUndefined(a._lightColor,e),_.customShader=ie.getValueOrUndefined(a._customShader,e),_.ready){const g=ie.getValueOrDefault(a._runAnimations,e,!0);u.animationsRunning!==g&&(g?_.activeAnimations.addAll({loop:Dh.REPEAT}):_.activeAnimations.removeAll(),u.animationsRunning=g);const p=ie.getValueOrUndefined(a._nodeTransformations,e,u.nodeTransformationsScratch);if(l(p)){const b=Object.keys(p);for(let x=0,v=b.length;x<v;++x){const D=b[x],L=p[D];if(!l(L))continue;const B=_.getNode(D);if(!l(B))continue;const V=N.fromTranslationRotationScale(L,Amt);B.matrix=N.multiply(B.originalMatrix,V,V)}}let y=!1;const T=ie.getValueOrUndefined(a._articulations,e,u.articulationsScratch);if(l(T)){const b=Object.keys(T);for(let x=0,v=b.length;x<v;++x){const D=b[x],L=T[D];l(L)&&(y=!0,_.setArticulationStage(D,L))}}y&&_.applyArticulations()}}return!0};wd.prototype.isDestroyed=function(){return!1};wd.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(wd.prototype._onCollectionChanged,this);const e=this._entitiesToVisualize.values,t=this._modelHash,n=this._primitives;for(let i=e.length-1;i>-1;i--)S2(this,e[i],t,n);return Je(this)};wd._sampleTerrainMostDetailed=HP;const W0=new d,Zj=new ve;wd.prototype.getBoundingSphere=function(e,t){if(!l(e))throw new w("entity is required.");if(!l(t))throw new w("result is required.");const n=this._modelHash[e.id];if(!l(n)||n.loadFail)return Ot.FAILED;const i=n.modelPrimitive;if(!l(i)||!i.show)return Ot.FAILED;if(!i.ready)return Ot.PENDING;const r=this._scene.globe,s=r.ellipsoid,a=r.terrainProvider;if(i.heightReference!==Ht.NONE){if(!a.ready)return Ot.PENDING;const u=i.modelMatrix;W0.x=u[12],W0.y=u[13],W0.z=u[14];const f=s.cartesianToCartographic(W0);if(!l(a.availability)){i.heightReference===Ht.CLAMP_TO_GROUND&&(f.height=0);const g=s.cartographicToCartesian(f);return Ae.clone(i.boundingSphere,t),t.center=g,Ot.DONE}let h=this._modelHash[e.id].clampedBoundingSphere;return this._modelHash[e.id].sampleTerrainFailed?(this._modelHash[e.id].sampleTerrainFailed=!1,Ot.FAILED):l(h)?(Ae.clone(h,t),this._modelHash[e.id].clampedBoundingSphere=void 0,Ot.DONE):(h=new Ae,this._modelHash[e.id].awaitingSampleTerrain||(ve.clone(f,Zj),this._modelHash[e.id].awaitingSampleTerrain=!0,wd._sampleTerrainMostDetailed(a,[Zj]).then(p=>{this._modelHash[e.id].awaitingSampleTerrain=!1;const y=p[0];i.heightReference===Ht.RELATIVE_TO_GROUND&&(y.height+=f.height),s.cartographicToCartesian(y,W0),Ae.clone(i.boundingSphere,h),h.center=W0,this._modelHash[e.id].clampedBoundingSphere=Ae.clone(h)}).catch(p=>{this._modelHash[e.id].sampleTerrainFailed=!0,this._modelHash[e.id].awaitingSampleTerrain=!1})),Ot.PENDING)}return Ae.clone(i.boundingSphere,t),Ot.DONE};wd.prototype._onCollectionChanged=function(e,t,n,i){let o,r;const s=this._entitiesToVisualize,a=this._modelHash,c=this._primitives;for(o=t.length-1;o>-1;o--)r=t[o],l(r._model)&&l(r._position)&&s.set(r.id,r);for(o=i.length-1;o>-1;o--)r=i[o],l(r._model)&&l(r._position)?(Tmt(r,a),s.set(r.id,r)):(S2(this,r,a,c),s.remove(r.id));for(o=n.length-1;o>-1;o--)r=n[o],S2(this,r,a,c),s.remove(r.id)};function S2(e,t,n,i){const o=n[t.id];l(o)&&(i.removeAndDestroy(o.modelPrimitive),delete n[t.id])}function Tmt(e,t){const n=t[e.id];l(n)&&(n.nodeTransformationsScratch={},n.articulationsScratch={})}function Cmt(e,t,n){e.readyPromise.catch(function(i){console.error(i),n[t.id].loadFail=!0})}function u_(e){this._definitionChanged=new lt,this._value=void 0,this._removeSubscription=void 0,this.setValue(e)}Object.defineProperties(u_.prototype,{isConstant:{get:function(){return ie.isConstant(this._value)}},definitionChanged:{get:function(){return this._definitionChanged}},referenceFrame:{get:function(){return l(this._value)?this._value.referenceFrame:$a.FIXED}}});u_.prototype.getValue=function(e,t){return this.getValueInReferenceFrame(e,$a.FIXED,t)};u_.prototype.setValue=function(e){this._value!==e&&(this._value=e,l(this._removeSubscription)&&(this._removeSubscription(),this._removeSubscription=void 0),l(e)&&(this._removeSubscription=e.definitionChanged.addEventListener(this._raiseDefinitionChanged,this)),this._definitionChanged.raiseEvent(this))};u_.prototype.getValueInReferenceFrame=function(e,t,n){if(!l(e))throw new w("time is required.");if(!l(t))throw new w("referenceFrame is required.");if(l(this._value))return n=this._value.getValueInReferenceFrame(e,t,n),l(n)?be.WGS84.scaleToGeodeticSurface(n,n):void 0};u_.prototype.equals=function(e){return this===e||e instanceof u_&&this._value===e._value};u_.prototype._raiseDefinitionChanged=function(){this._definitionChanged.raiseEvent(this)};const bmt=60,Emt=1,Hse=new bn,UN=new bn,HN=new bn;function e7(e){this.entity=e,this.polyline=void 0,this.index=void 0,this.updater=void 0}function xmt(e,t,n,i,o,r,s,a,c){let u=a,f;f=e.getValueInReferenceFrame(t,r,c[u]),l(f)&&(c[u++]=f);let h=!l(o)||ce.lessThanOrEquals(o,t)||ce.greaterThanOrEquals(o,n),_=0;const g=i.length;let p=i[_];const y=n;let T=!1,b,x,v;for(;_<g;){if(!h&&ce.greaterThanOrEquals(p,o)&&(f=e.getValueInReferenceFrame(o,r,c[u]),l(f)&&(c[u++]=f),h=!0),ce.greaterThan(p,t)&&ce.lessThan(p,y)&&!p.equals(o)&&(f=e.getValueInReferenceFrame(p,r,c[u]),l(f)&&(c[u++]=f)),_<g-1){if(s>0&&!T){const D=i[_+1],L=ce.secondsDifference(D,p);T=L>s,T&&(b=Math.ceil(L/s),x=0,v=L/Math.max(b,2),b=Math.max(b-1,1))}if(T&&x<b){p=ce.addSeconds(p,v,new ce),x++;continue}}T=!1,_++,p=i[_]}return f=e.getValueInReferenceFrame(n,r,c[u]),l(f)&&(c[u++]=f),u}function wmt(e,t,n,i,o,r,s,a){let c,u=0,f=s,h=t;const _=Math.max(r,60);let g=!l(i)||ce.lessThanOrEquals(i,t)||ce.greaterThanOrEquals(i,n);for(;ce.lessThan(h,n);)!g&&ce.greaterThanOrEquals(h,i)&&(g=!0,c=e.getValueInReferenceFrame(i,o,a[f]),l(c)&&(a[f]=c,f++)),c=e.getValueInReferenceFrame(h,o,a[f]),l(c)&&(a[f]=c,f++),u++,h=ce.addSeconds(t,_*u,new ce);return c=e.getValueInReferenceFrame(n,o,a[f]),l(c)&&(a[f]=c,f++),f}function Smt(e,t,n,i,o,r,s,a){HN.start=t,HN.stop=n;let c=s;const u=e.intervals;for(let f=0;f<u.length;f++){const h=u.get(f);if(!bn.intersect(h,HN,Hse).isEmpty){let _=h.start;h.isStartIncluded||(h.isStopIncluded?_=h.stop:_=ce.addSeconds(h.start,ce.secondsDifference(h.stop,h.start)/2,new ce));const g=e.getValueInReferenceFrame(_,o,a[c]);l(g)&&(a[c]=g,c++)}}return c}function vmt(e,t,n,i,o,r,s,a){const c=e.getValueInReferenceFrame(t,o,a[s]);return l(c)&&(a[s++]=c),s}function Dmt(e,t,n,i,o,r,s,a){UN.start=t,UN.stop=n;let c=s;const u=e.intervals;for(let f=0;f<u.length;f++){const h=u.get(f);if(!bn.intersect(h,UN,Hse).isEmpty){const _=h.start,g=h.stop;let p=t;ce.greaterThan(_,p)&&(p=_);let y=n;ce.lessThan(g,y)&&(y=g),c=Vse(h.data,p,y,i,o,r,c,a)}}return c}function Vse(e,t,n,i,o,r,s,a){for(;e instanceof Tl;)e=e.resolvedProperty;if(e instanceof Cl){const c=e._property._times;s=xmt(e,t,n,c,i,o,r,s,a)}else e instanceof a_?s=Dmt(e,t,n,i,o,r,s,a):e instanceof c_?s=Smt(e,t,n,i,o,r,s,a):e instanceof ep||e instanceof u_&&ie.isConstant(e)?s=vmt(e,t,n,i,o,r,s,a):s=wmt(e,t,n,i,o,r,s,a);return s}function kse(e,t,n,i,o,r,s){l(s)||(s=[]);const a=Vse(e,t,n,i,o,r,0,s);return s.length=a,s}const t7=new te;function Jx(e,t){this._unusedIndexes=[],this._polylineCollection=new Vc,this._scene=e,this._referenceFrame=t,e.primitives.add(this._polylineCollection)}Jx.prototype.update=function(e){if(this._referenceFrame===$a.INERTIAL){let t=En.computeIcrfToFixedMatrix(e,t7);l(t)||(t=En.computeTemeToPseudoFixedMatrix(e,t7)),N.fromRotationTranslation(t,d.ZERO,this._polylineCollection.modelMatrix)}};Jx.prototype.updateObject=function(e,t){const n=t.entity,i=n._path,o=n._position;let r,s;const a=i._show;let c=t.polyline,u=n.isShowing&&n.isAvailable(e)&&(!l(a)||a.getValue(e));if(u){const h=ie.getValueOrUndefined(i._leadTime,e),_=ie.getValueOrUndefined(i._trailTime,e),g=n._availability,p=l(g),y=l(h),T=l(_);if(u=p||y&&T,u){if(T&&(r=ce.addSeconds(e,-_,new ce)),y&&(s=ce.addSeconds(e,h,new ce)),p){const b=g.start,x=g.stop;(!T||ce.greaterThan(b,r))&&(r=b),(!y||ce.lessThan(x,s))&&(s=x)}u=ce.lessThan(r,s)}}if(!u){l(c)&&(this._unusedIndexes.push(t.index),t.polyline=void 0,c.show=!1,t.index=void 0);return}if(!l(c)){const h=this._unusedIndexes;if(h.length>0){const g=h.pop();c=this._polylineCollection.get(g),t.index=g}else t.index=this._polylineCollection.length,c=this._polylineCollection.add();c.id=n,t.polyline=c}const f=ie.getValueOrDefault(i._resolution,e,bmt);c.show=!0,c.positions=kse(o,r,s,e,this._referenceFrame,f,c.positions.slice()),c.material=ls.getValue(e,i._material,c.material),c.width=ie.getValueOrDefault(i._width,e,Emt),c.distanceDisplayCondition=ie.getValueOrUndefined(i._distanceDisplayCondition,e,c.distanceDisplayCondition)};Jx.prototype.removeObject=function(e){const t=e.polyline;l(t)&&(this._unusedIndexes.push(e.index),e.polyline=void 0,t.show=!1,t.id=void 0,e.index=void 0)};Jx.prototype.destroy=function(){return this._scene.primitives.remove(this._polylineCollection),Je(this)};function f_(e,t){if(!l(e))throw new w("scene is required.");if(!l(t))throw new w("entityCollection is required.");t.collectionChanged.addEventListener(f_.prototype._onCollectionChanged,this),this._scene=e,this._updaters={},this._entityCollection=t,this._items=new Vt,this._onCollectionChanged(t,t.values,[],[])}f_.prototype.update=function(e){if(!l(e))throw new w("time is required.");const t=this._updaters;for(const i in t)t.hasOwnProperty(i)&&t[i].update(e);const n=this._items.values;if(n.length===0&&l(this._updaters)&&Object.keys(this._updaters).length>0){for(const i in t)t.hasOwnProperty(i)&&t[i].destroy();this._updaters={}}for(let i=0,o=n.length;i<o;i++){const r=n[i],a=r.entity._position,c=r.updater;let u=$a.FIXED;this._scene.mode===me.SCENE3D&&(u=a.referenceFrame);let f=this._updaters[u];if(c===f&&l(f)){f.updateObject(e,r);continue}l(c)&&c.removeObject(r),l(f)||(f=new Jx(this._scene,u),f.update(e),this._updaters[u]=f),r.updater=f,l(f)&&f.updateObject(e,r)}return!0};f_.prototype.isDestroyed=function(){return!1};f_.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(f_.prototype._onCollectionChanged,this);const e=this._updaters;for(const t in e)e.hasOwnProperty(t)&&e[t].destroy();return Je(this)};f_.prototype._onCollectionChanged=function(e,t,n,i){let o,r,s;const a=this._items;for(o=t.length-1;o>-1;o--)r=t[o],l(r._path)&&l(r._position)&&a.set(r.id,new e7(r));for(o=i.length-1;o>-1;o--)r=i[o],l(r._path)&&l(r._position)?a.contains(r.id)||a.set(r.id,new e7(r)):(s=a.get(r.id),l(s)&&(l(s.updater)&&s.updater.removeObject(s),a.remove(r.id)));for(o=n.length-1;o>-1;o--)r=n[o],s=a.get(r.id),l(s)&&(l(s.updater)&&s.updater.removeObject(s),a.remove(r.id))};f_._subSample=kse;const n7=k.WHITE,i7=k.BLACK,o7=0,r7=1,s7=0,a7=new k,Imt=new d,c7=new k,l7=new tn,u7=new tn,f7=new sn;function d7(e){this.entity=e,this.pointPrimitive=void 0,this.billboard=void 0,this.color=void 0,this.outlineColor=void 0,this.pixelSize=void 0,this.outlineWidth=void 0}function d_(e,t){if(!l(e))throw new w("entityCluster is required.");if(!l(t))throw new w("entityCollection is required.");t.collectionChanged.addEventListener(d_.prototype._onCollectionChanged,this),this._cluster=e,this._entityCollection=t,this._items=new Vt,this._onCollectionChanged(t,t.values,[],[])}d_.prototype.update=function(e){if(!l(e))throw new w("time is required.");const t=this._items.values,n=this._cluster;for(let i=0,o=t.length;i<o;i++){const r=t[i],s=r.entity,a=s._point;let c=r.pointPrimitive,u=r.billboard;const f=ie.getValueOrDefault(a._heightReference,e,Ht.NONE);let h=s.isShowing&&s.isAvailable(e)&&ie.getValueOrDefault(a._show,e,!0),_;if(h&&(_=ie.getValueOrUndefined(s._position,e,Imt),h=l(_)),!h){sE(r,s,n);continue}ie.isConstant(s._position)||(n._clusterDirty=!0);let g=!1,p=!1;if(f!==Ht.NONE&&!l(u)?(l(c)&&(sE(r,s,n),c=void 0),u=n.getBillboard(s),u.id=s,u.image=void 0,r.billboard=u,g=!0,p=d.equals(u.position,_)&&u.heightReference===f):f===Ht.NONE&&!l(c)&&(l(u)&&(sE(r,s,n),u=void 0),c=n.getPoint(s),c.id=s,r.pointPrimitive=c),l(c))c.show=!0,c.position=_,c.scaleByDistance=ie.getValueOrUndefined(a._scaleByDistance,e,l7),c.translucencyByDistance=ie.getValueOrUndefined(a._translucencyByDistance,e,u7),c.color=ie.getValueOrDefault(a._color,e,n7,a7),c.outlineColor=ie.getValueOrDefault(a._outlineColor,e,i7,c7),c.outlineWidth=ie.getValueOrDefault(a._outlineWidth,e,o7),c.pixelSize=ie.getValueOrDefault(a._pixelSize,e,r7),c.distanceDisplayCondition=ie.getValueOrUndefined(a._distanceDisplayCondition,e,f7),c.disableDepthTestDistance=ie.getValueOrDefault(a._disableDepthTestDistance,e,s7);else if(l(u)){u.show=!0,u.position=_,u.scaleByDistance=ie.getValueOrUndefined(a._scaleByDistance,e,l7),u.translucencyByDistance=ie.getValueOrUndefined(a._translucencyByDistance,e,u7),u.distanceDisplayCondition=ie.getValueOrUndefined(a._distanceDisplayCondition,e,f7),u.disableDepthTestDistance=ie.getValueOrDefault(a._disableDepthTestDistance,e,s7),u.heightReference=f;const y=ie.getValueOrDefault(a._color,e,n7,a7),T=ie.getValueOrDefault(a._outlineColor,e,i7,c7),b=Math.round(ie.getValueOrDefault(a._outlineWidth,e,o7));let x=Math.max(1,Math.round(ie.getValueOrDefault(a._pixelSize,e,r7)));if(b>0?(u.scale=1,g=g||b!==r.outlineWidth||x!==r.pixelSize||!k.equals(y,r.color)||!k.equals(T,r.outlineColor)):(u.scale=x/50,x=50,g=g||b!==r.outlineWidth||!k.equals(y,r.color)||!k.equals(T,r.outlineColor)),g){r.color=k.clone(y,r.color),r.outlineColor=k.clone(T,r.outlineColor),r.pixelSize=x,r.outlineWidth=b;const v=y.alpha,D=y.toCssColorString(),L=T.toCssColorString(),B=JSON.stringify([D,x,L,b]);u.setImage(B,poe(v,D,L,b,x))}p&&u._updateClamping()}}return!0};d_.prototype.getBoundingSphere=function(e,t){if(!l(e))throw new w("entity is required.");if(!l(t))throw new w("result is required.");const n=this._items.get(e.id);if(!l(n)||!(l(n.pointPrimitive)||l(n.billboard)))return Ot.FAILED;if(l(n.pointPrimitive))t.center=d.clone(n.pointPrimitive.position,t.center);else{const i=n.billboard;if(!l(i._clampedPosition))return Ot.PENDING;t.center=d.clone(i._clampedPosition,t.center)}return t.radius=0,Ot.DONE};d_.prototype.isDestroyed=function(){return!1};d_.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(d_.prototype._onCollectionChanged,this);const e=this._entityCollection.values;for(let t=0;t<e.length;t++)this._cluster.removePoint(e[t]);return Je(this)};d_.prototype._onCollectionChanged=function(e,t,n,i){let o,r;const s=this._items,a=this._cluster;for(o=t.length-1;o>-1;o--)r=t[o],l(r._point)&&l(r._position)&&s.set(r.id,new d7(r));for(o=i.length-1;o>-1;o--)r=i[o],l(r._point)&&l(r._position)?s.contains(r.id)||s.set(r.id,new d7(r)):(sE(s.get(r.id),r,a),s.remove(r.id));for(o=n.length-1;o>-1;o--)r=n[o],sE(s.get(r.id),r,a),s.remove(r.id)};function sE(e,t,n){if(l(e)){const i=e.pointPrimitive;if(l(i)){e.pointPrimitive=void 0,n.removePoint(t);return}const o=e.billboard;l(o)&&(e.billboard=void 0,n.removeBillboard(t))}}const Gse=[];function Pmt(e,t,n,i,o){const r=Gse;r.length=o;let s;const a=n.red,c=n.green,u=n.blue,f=n.alpha,h=i.red,_=i.green,g=i.blue,p=i.alpha;if(k.equals(n,i)){for(s=0;s<o;s++)r[s]=k.clone(n);return r}const y=(h-a)/o,T=(_-c)/o,b=(g-u)/o,x=(p-f)/o;for(s=0;s<o;s++)r[s]=new k(a+s*y,c+s*T,u+s*b,f+s*x);return r}function ex(e){e=A(e,A.EMPTY_OBJECT);const t=e.positions,n=e.colors,i=A(e.width,1),o=A(e.colorsPerVertex,!1);if(!l(t)||t.length<2)throw new w("At least two positions are required.");if(typeof i!="number")throw new w("width must be a number");if(l(n)&&(o&&n.length<t.length||!o&&n.length<t.length-1))throw new w("colors has an invalid length.");this._positions=t,this._colors=n,this._width=i,this._colorsPerVertex=o,this._vertexFormat=Ye.clone(A(e.vertexFormat,Ye.DEFAULT)),this._arcType=A(e.arcType,Kn.GEODESIC),this._granularity=A(e.granularity,F.RADIANS_PER_DEGREE),this._ellipsoid=be.clone(A(e.ellipsoid,be.WGS84)),this._workerName="createPolylineGeometry";let r=1+t.length*d.packedLength;r+=l(n)?1+n.length*k.packedLength:1,this.packedLength=r+be.packedLength+Ye.packedLength+4}ex.pack=function(e,t,n){if(!l(e))throw new w("value is required");if(!l(t))throw new w("array is required");n=A(n,0);let i;const o=e._positions;let r=o.length;for(t[n++]=r,i=0;i<r;++i,n+=d.packedLength)d.pack(o[i],t,n);const s=e._colors;for(r=l(s)?s.length:0,t[n++]=r,i=0;i<r;++i,n+=k.packedLength)k.pack(s[i],t,n);return be.pack(e._ellipsoid,t,n),n+=be.packedLength,Ye.pack(e._vertexFormat,t,n),n+=Ye.packedLength,t[n++]=e._width,t[n++]=e._colorsPerVertex?1:0,t[n++]=e._arcType,t[n]=e._granularity,t};const Wse=be.clone(be.UNIT_SPHERE),qse=new Ye,_g={positions:void 0,colors:void 0,ellipsoid:Wse,vertexFormat:qse,width:void 0,colorsPerVertex:void 0,arcType:void 0,granularity:void 0};ex.unpack=function(e,t,n){if(!l(e))throw new w("array is required");t=A(t,0);let i,o=e[t++];const r=new Array(o);for(i=0;i<o;++i,t+=d.packedLength)r[i]=d.unpack(e,t);o=e[t++];const s=o>0?new Array(o):void 0;for(i=0;i<o;++i,t+=k.packedLength)s[i]=k.unpack(e,t);const a=be.unpack(e,t,Wse);t+=be.packedLength;const c=Ye.unpack(e,t,qse);t+=Ye.packedLength;const u=e[t++],f=e[t++]===1,h=e[t++],_=e[t];return l(n)?(n._positions=r,n._colors=s,n._ellipsoid=be.clone(a,n._ellipsoid),n._vertexFormat=Ye.clone(c,n._vertexFormat),n._width=u,n._colorsPerVertex=f,n._arcType=h,n._granularity=_,n):(_g.positions=r,_g.colors=s,_g.width=u,_g.colorsPerVertex=f,_g.arcType=h,_g.granularity=_,new ex(_g))};const h7=new d,p7=new d,m7=new d,_7=new d;ex.createGeometry=function(e){const t=e._width,n=e._vertexFormat;let i=e._colors;const o=e._colorsPerVertex,r=e._arcType,s=e._granularity,a=e._ellipsoid;let c,u,f;const h=[];let _=Ya(e._positions,d.equalsEpsilon,!1,h);if(l(i)&&h.length>0){let R=0,U=h[0];i=i.filter(function(W,q){let Y=!1;return o?Y=q===U||q===0&&U===1:Y=q+1===U,Y?(R++,U=h[R],!1):!0})}let g=_.length;if(g<2||t<=0)return;if(r===Kn.GEODESIC||r===Kn.RHUMB){let R,U;r===Kn.GEODESIC?(R=F.chordLength(s,a.maximumRadius),U=Jr.numberOfPoints):(R=s,U=Jr.numberOfPointsRhumbLine);const W=Jr.extractHeights(_,a);if(l(i)){let q=1;for(c=0;c<g-1;++c)q+=U(_[c],_[c+1],R);const Y=new Array(q);let j=0;for(c=0;c<g-1;++c){const ee=_[c],K=_[c+1],se=i[c],Q=U(ee,K,R);if(o&&c<q){const Z=i[c+1],J=Pmt(ee,K,se,Z,Q),de=J.length;for(u=0;u<de;++u)Y[j++]=J[u]}else for(u=0;u<Q;++u)Y[j++]=k.clone(se)}Y[j]=k.clone(i[i.length-1]),i=Y,Gse.length=0}r===Kn.GEODESIC?_=Jr.generateCartesianArc({positions:_,minDistance:R,ellipsoid:a,height:W}):_=Jr.generateCartesianRhumbArc({positions:_,granularity:R,ellipsoid:a,height:W})}g=_.length;const p=g*4-4,y=new Float64Array(p*3),T=new Float64Array(p*3),b=new Float64Array(p*3),x=new Float32Array(p*2),v=n.st?new Float32Array(p*2):void 0,D=l(i)?new Uint8Array(p*4):void 0;let L=0,B=0,V=0,M=0,H;for(u=0;u<g;++u){u===0?(H=h7,d.subtract(_[0],_[1],H),d.add(_[0],H,H)):H=_[u-1],d.clone(H,m7),d.clone(_[u],p7),u===g-1?(H=h7,d.subtract(_[g-1],_[g-2],H),d.add(_[g-1],H,H)):H=_[u+1],d.clone(H,_7);let R,U;l(D)&&(u!==0&&!o?R=i[u-1]:R=i[u],u!==g-1&&(U=i[u]));const W=u===0?2:0,q=u===g-1?2:4;for(f=W;f<q;++f){d.pack(p7,y,L),d.pack(m7,T,L),d.pack(_7,b,L),L+=3;const Y=f-2<0?-1:1;if(x[B++]=2*(f%2)-1,x[B++]=Y*t,n.st&&(v[V++]=u/(g-1),v[V++]=Math.max(x[B-2],0)),l(D)){const j=f<2?R:U;D[M++]=k.floatToByte(j.red),D[M++]=k.floatToByte(j.green),D[M++]=k.floatToByte(j.blue),D[M++]=k.floatToByte(j.alpha)}}}const G=new To;G.position=new Xe({componentDatatype:oe.DOUBLE,componentsPerAttribute:3,values:y}),G.prevPosition=new Xe({componentDatatype:oe.DOUBLE,componentsPerAttribute:3,values:T}),G.nextPosition=new Xe({componentDatatype:oe.DOUBLE,componentsPerAttribute:3,values:b}),G.expandAndWidth=new Xe({componentDatatype:oe.FLOAT,componentsPerAttribute:2,values:x}),n.st&&(G.st=new Xe({componentDatatype:oe.FLOAT,componentsPerAttribute:2,values:v})),l(D)&&(G.color=new Xe({componentDatatype:oe.UNSIGNED_BYTE,componentsPerAttribute:4,values:D,normalize:!0}));const I=At.createTypedArray(p,g*6-6);let O=0,m=0;const P=g-1;for(u=0;u<P;++u)I[m++]=O,I[m++]=O+2,I[m++]=O+1,I[m++]=O+1,I[m++]=O+2,I[m++]=O+3,O+=4;return new $t({attributes:G,indices:I,primitiveType:dt.TRIANGLES,boundingSphere:Ae.fromPoints(_),geometryType:fA.POLYLINES})};const Omt=new Cr(0),m1={},g7=new k,Lmt=new An(k.WHITE),Bmt=new Cr(!0),Rmt=new Cr(sr.DISABLED),Nmt=new Cr(new sn),Mmt=new Cr(ir.BOTH);function Fmt(){this.vertexFormat=void 0,this.positions=void 0,this.width=void 0,this.arcType=void 0,this.granularity=void 0}function zmt(){this.positions=void 0,this.width=void 0,this.arcType=void 0,this.granularity=void 0}function Ff(e,t){if(!l(e))throw new w("entity is required");if(!l(t))throw new w("scene is required");this._entity=e,this._scene=t,this._entitySubscription=e.definitionChanged.addEventListener(Ff.prototype._onEntityPropertyChanged,this),this._fillEnabled=!1,this._dynamic=!1,this._geometryChanged=new lt,this._showProperty=void 0,this._materialProperty=void 0,this._shadowsProperty=void 0,this._distanceDisplayConditionProperty=void 0,this._classificationTypeProperty=void 0,this._depthFailMaterialProperty=void 0,this._geometryOptions=new Fmt,this._groundGeometryOptions=new zmt,this._id=`polyline-${e.id}`,this._clampToGround=!1,this._supportsPolylinesOnTerrain=hs.supportsPolylinesOnTerrain(t),this._zIndex=0,this._onEntityPropertyChanged(e,"polyline",e.polyline,void 0)}Object.defineProperties(Ff.prototype,{id:{get:function(){return this._id}},entity:{get:function(){return this._entity}},fillEnabled:{get:function(){return this._fillEnabled}},hasConstantFill:{get:function(){return!this._fillEnabled||!l(this._entity.availability)&&ie.isConstant(this._showProperty)}},fillMaterialProperty:{get:function(){return this._materialProperty}},depthFailMaterialProperty:{get:function(){return this._depthFailMaterialProperty}},outlineEnabled:{value:!1},hasConstantOutline:{value:!0},outlineColorProperty:{value:void 0},shadowsProperty:{get:function(){return this._shadowsProperty}},distanceDisplayConditionProperty:{get:function(){return this._distanceDisplayConditionProperty}},classificationTypeProperty:{get:function(){return this._classificationTypeProperty}},isDynamic:{get:function(){return this._dynamic}},isClosed:{value:!1},geometryChanged:{get:function(){return this._geometryChanged}},arcType:{get:function(){return this._arcType}},clampToGround:{get:function(){return this._clampToGround&&this._supportsPolylinesOnTerrain}},zIndex:{get:function(){return this._zIndex}}});Ff.prototype.isOutlineVisible=function(e){return!1};Ff.prototype.isFilled=function(e){const t=this._entity,n=this._fillEnabled&&t.isAvailable(e)&&this._showProperty.getValue(e);return A(n,!1)};Ff.prototype.createFillGeometryInstance=function(e){if(!l(e))throw new w("time is required.");if(!this._fillEnabled)throw new w("This instance does not represent a filled geometry.");const t=this._entity,n=t.isAvailable(e),i=new pi(n&&t.isShowing&&this._showProperty.getValue(e)),o=this._distanceDisplayConditionProperty.getValue(e),r=Yi.fromDistanceDisplayCondition(o),s={show:i,distanceDisplayCondition:r};let a;return this._materialProperty instanceof An&&(l(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(a=this._materialProperty.color.getValue(e,g7)),l(a)||(a=k.WHITE),s.color=Bn.fromColor(a)),this.clampToGround?new xn({id:t,geometry:new Qh(this._groundGeometryOptions),attributes:s}):(l(this._depthFailMaterialProperty)&&this._depthFailMaterialProperty instanceof An&&(l(this._depthFailMaterialProperty.color)&&(this._depthFailMaterialProperty.color.isConstant||n)&&(a=this._depthFailMaterialProperty.color.getValue(e,g7)),l(a)||(a=k.WHITE),s.depthFailColor=Bn.fromColor(a)),new xn({id:t,geometry:new ex(this._geometryOptions),attributes:s}))};Ff.prototype.createOutlineGeometryInstance=function(e){throw new w("This instance does not represent an outlined geometry.")};Ff.prototype.isDestroyed=function(){return!1};Ff.prototype.destroy=function(){this._entitySubscription(),Je(this)};Ff.prototype._onEntityPropertyChanged=function(e,t,n,i){if(!(t==="availability"||t==="polyline"))return;const o=this._entity.polyline;if(!l(o)){this._fillEnabled&&(this._fillEnabled=!1,this._geometryChanged.raiseEvent(this));return}const r=o.positions,s=o.show;if(l(s)&&s.isConstant&&!s.getValue(wt.MINIMUM_VALUE)||!l(r)){this._fillEnabled&&(this._fillEnabled=!1,this._geometryChanged.raiseEvent(this));return}const a=o.zIndex,c=A(o.material,Lmt),u=c instanceof An;this._materialProperty=c,this._depthFailMaterialProperty=o.depthFailMaterial,this._showProperty=A(s,Bmt),this._shadowsProperty=A(o.shadows,Rmt),this._distanceDisplayConditionProperty=A(o.distanceDisplayCondition,Nmt),this._classificationTypeProperty=A(o.classificationType,Mmt),this._fillEnabled=!0,this._zIndex=A(a,Omt);const f=o.width,h=o.arcType,_=o.clampToGround,g=o.granularity;if(!r.isConstant||!ie.isConstant(f)||!ie.isConstant(h)||!ie.isConstant(g)||!ie.isConstant(_)||!ie.isConstant(a))this._dynamic||(this._dynamic=!0,this._geometryChanged.raiseEvent(this));else{const p=this._geometryOptions,y=r.getValue(wt.MINIMUM_VALUE,p.positions);if(!l(y)||y.length<2){this._fillEnabled&&(this._fillEnabled=!1,this._geometryChanged.raiseEvent(this));return}let T;u&&(!l(this._depthFailMaterialProperty)||this._depthFailMaterialProperty instanceof An)?T=Na.VERTEX_FORMAT:T=ca.VERTEX_FORMAT,p.vertexFormat=T,p.positions=y,p.width=l(f)?f.getValue(wt.MINIMUM_VALUE):void 0,p.arcType=l(h)?h.getValue(wt.MINIMUM_VALUE):void 0,p.granularity=l(g)?g.getValue(wt.MINIMUM_VALUE):void 0;const b=this._groundGeometryOptions;b.positions=y,b.width=p.width,b.arcType=p.arcType,b.granularity=p.granularity,this._clampToGround=l(_)?_.getValue(wt.MINIMUM_VALUE):!1,!this._clampToGround&&l(a)&&uo("Entity polylines must have clampToGround: true when using zIndex. zIndex will be ignored."),this._dynamic=!1,this._geometryChanged.raiseEvent(this)}};Ff.prototype.createDynamicUpdater=function(e,t){if(E.defined("primitives",e),E.defined("groundPrimitives",t),!this._dynamic)throw new w("This instance does not represent dynamic geometry.");return new Qx(e,t,this)};const q0={positions:void 0,granularity:void 0,height:void 0,ellipsoid:void 0};function Qx(e,t,n){this._line=void 0,this._primitives=e,this._groundPrimitives=t,this._groundPolylinePrimitive=void 0,this._material=void 0,this._geometryUpdater=n,this._positions=[]}function jse(e){if(l(e._line))return e._line;const t=e._geometryUpdater._scene.id;let n=m1[t];const i=e._primitives;!l(n)||n.isDestroyed()?(n=new Vc,m1[t]=n,i.add(n)):i.contains(n)||i.add(n);const o=n.add();return o.id=e._geometryUpdater._entity,e._line=o,o}Qx.prototype.update=function(e){const t=this._geometryUpdater,n=t._entity,i=n.polyline,o=i.positions;let r=ie.getValueOrUndefined(o,e,this._positions);t._clampToGround=ie.getValueOrDefault(i._clampToGround,e,!1),t._groundGeometryOptions.positions=r,t._groundGeometryOptions.width=ie.getValueOrDefault(i._width,e,1),t._groundGeometryOptions.arcType=ie.getValueOrDefault(i._arcType,e,Kn.GEODESIC),t._groundGeometryOptions.granularity=ie.getValueOrDefault(i._granularity,e,9999);const s=this._groundPrimitives;if(l(this._groundPolylinePrimitive)&&(s.remove(this._groundPolylinePrimitive),this._groundPolylinePrimitive=void 0),t.clampToGround){if(!n.isShowing||!n.isAvailable(e)||!ie.getValueOrDefault(i._show,e,!0)||!l(r)||r.length<2)return;const f=t.fillMaterialProperty;let h;if(f instanceof An)h=new Na;else{const _=ls.getValue(e,f,this._material);h=new ca({material:_,translucent:_.isTranslucent()}),this._material=_}this._groundPolylinePrimitive=s.add(new gu({geometryInstances:t.createFillGeometryInstance(e),appearance:h,classificationType:t.classificationTypeProperty.getValue(e),asynchronous:!1}),ie.getValueOrUndefined(t.zIndex,e)),l(this._line)&&(this._line.show=!1);return}const a=jse(this);if(!n.isShowing||!n.isAvailable(e)||!ie.getValueOrDefault(i._show,e,!0)){a.show=!1;return}if(!l(r)||r.length<2){a.show=!1;return}let c=Kn.GEODESIC;c=ie.getValueOrDefault(i._arcType,e,c);const u=t._scene.globe;c!==Kn.NONE&&l(u)&&(q0.ellipsoid=u.ellipsoid,q0.positions=r,q0.granularity=ie.getValueOrUndefined(i._granularity,e),q0.height=Jr.extractHeights(r,u.ellipsoid),c===Kn.GEODESIC?r=Jr.generateCartesianArc(q0):r=Jr.generateCartesianRhumbArc(q0)),a.show=!0,a.positions=r.slice(),a.material=ls.getValue(e,t.fillMaterialProperty,a.material),a.width=ie.getValueOrDefault(i._width,e,1),a.distanceDisplayCondition=ie.getValueOrUndefined(i._distanceDisplayCondition,e,a.distanceDisplayCondition)};Qx.prototype.getBoundingSphere=function(e){if(E.defined("result",e),this._geometryUpdater.clampToGround){const t=this._groundPolylinePrimitive;if(l(t)&&t.show&&t.ready){const n=t.getGeometryInstanceAttributes(this._geometryUpdater._entity);if(l(n)&&l(n.boundingSphere))return Ae.clone(n.boundingSphere,e),Ot.DONE}return l(t)&&!t.ready?Ot.PENDING:Ot.DONE}else{const t=jse(this);if(t.show&&t.positions.length>0)return Ae.fromPoints(t.positions,e),Ot.DONE}return Ot.FAILED};Qx.prototype.isDestroyed=function(){return!1};Qx.prototype.destroy=function(){const t=this._geometryUpdater._scene.id,n=m1[t];l(n)&&(n.remove(this._line),n.length===0&&(this._primitives.removeAndDestroy(n),delete m1[t])),l(this._groundPolylinePrimitive)&&this._groundPrimitives.remove(this._groundPolylinePrimitive),Je(this)};const Umt=new k,Hmt=new sn,Vmt=new sn;function zf(e,t,n,i,o){let r;n instanceof An?r=Na:r=ca,this.orderedGroundPrimitives=e,this.classificationType=t,this.appearanceType=r,this.materialProperty=n,this.updaters=new Vt,this.createPrimitive=!0,this.primitive=void 0,this.oldPrimitive=void 0,this.geometry=new Vt,this.material=void 0,this.updatersWithAttributes=new Vt,this.attributes=new Vt,this.invalidated=!1,this.removeMaterialSubscription=n.definitionChanged.addEventListener(zf.prototype.onMaterialChanged,this),this.subscriptions=new Vt,this.showsUpdated=new Vt,this.zIndex=i,this._asynchronous=o}zf.prototype.onMaterialChanged=function(){this.invalidated=!0};zf.prototype.isMaterial=function(e){const t=this.materialProperty,n=e.fillMaterialProperty;return n===t||n instanceof An&&t instanceof An?!0:l(t)&&t.equals(n)};zf.prototype.add=function(e,t,n){const i=t.id;if(this.updaters.set(i,t),this.geometry.set(i,n),!t.hasConstantFill||!t.fillMaterialProperty.isConstant||!ie.isConstant(t.distanceDisplayConditionProperty))this.updatersWithAttributes.set(i,t);else{const o=this;this.subscriptions.set(i,t.entity.definitionChanged.addEventListener(function(r,s,a,c){s==="isShowing"&&o.showsUpdated.set(t.id,t)}))}this.createPrimitive=!0};zf.prototype.remove=function(e){const t=e.id;if(this.createPrimitive=this.geometry.remove(t)||this.createPrimitive,this.updaters.remove(t)){this.updatersWithAttributes.remove(t);const n=this.subscriptions.get(t);return l(n)&&(n(),this.subscriptions.remove(t)),!0}return!1};zf.prototype.update=function(e){let t=!0,n=this.primitive;const i=this.orderedGroundPrimitives,o=this.geometry.values;let r;if(this.createPrimitive){if(o.length>0)l(n)&&(l(this.oldPrimitive)?i.remove(n):this.oldPrimitive=n),n=new gu({show:!1,asynchronous:this._asynchronous,geometryInstances:o.slice(),appearance:new this.appearanceType,classificationType:this.classificationType}),this.appearanceType===ca&&(this.material=ls.getValue(e,this.materialProperty,this.material),n.appearance.material=this.material),i.add(n,this.zIndex),t=!1;else{l(n)&&(i.remove(n),n=void 0);const a=this.oldPrimitive;l(a)&&(i.remove(a),this.oldPrimitive=void 0)}this.attributes.removeAll(),this.primitive=n,this.createPrimitive=!1}else if(l(n)&&n.ready){n.show=!0,l(this.oldPrimitive)&&(i.remove(this.oldPrimitive),this.oldPrimitive=void 0),this.appearanceType===ca&&(this.material=ls.getValue(e,this.materialProperty,this.material),this.primitive.appearance.material=this.material);const s=this.updatersWithAttributes.values,a=s.length;for(r=0;r<a;r++){const c=s[r],u=c.entity,f=this.geometry.get(c.id);let h=this.attributes.get(f.id.id);if(l(h)||(h=n.getGeometryInstanceAttributes(f.id),this.attributes.set(f.id.id,h)),!c.fillMaterialProperty.isConstant){const y=c.fillMaterialProperty.color,T=ie.getValueOrDefault(y,e,k.WHITE,Umt);k.equals(h._lastColor,T)||(h._lastColor=k.clone(T,h._lastColor),h.color=Bn.toValue(T,h.color))}const _=u.isShowing&&(c.hasConstantFill||c.isFilled(e)),g=h.show[0]===1;_!==g&&(h.show=pi.toValue(_,h.show));const p=c.distanceDisplayConditionProperty;if(!ie.isConstant(p)){const y=ie.getValueOrDefault(p,e,Vmt,Hmt);sn.equals(y,h._lastDistanceDisplayCondition)||(h._lastDistanceDisplayCondition=sn.clone(y,h._lastDistanceDisplayCondition),h.distanceDisplayCondition=Yi.toValue(y,h.distanceDisplayCondition))}}this.updateShows(n)}else l(n)&&!n.ready&&(t=!1);return t};zf.prototype.updateShows=function(e){const t=this.showsUpdated.values,n=t.length;for(let i=0;i<n;i++){const o=t[i],r=o.entity,s=this.geometry.get(o.id);let a=this.attributes.get(s.id.id);l(a)||(a=e.getGeometryInstanceAttributes(s.id),this.attributes.set(s.id.id,a));const c=r.isShowing,u=a.show[0]===1;c!==u&&(a.show=pi.toValue(c,a.show),s.attributes.show.value[0]=a.show[0])}this.showsUpdated.removeAll()};zf.prototype.contains=function(e){return this.updaters.contains(e.id)};zf.prototype.getBoundingSphere=function(e,t){const n=this.primitive;if(!n.ready)return Ot.PENDING;const i=n.getGeometryInstanceAttributes(e.entity);return!l(i)||!l(i.boundingSphere)||l(i.show)&&i.show[0]===0?Ot.FAILED:(i.boundingSphere.clone(t),Ot.DONE)};zf.prototype.destroy=function(){const e=this.primitive,t=this.orderedGroundPrimitives;l(e)&&t.remove(e);const n=this.oldPrimitive;l(n)&&t.remove(n),this.removeMaterialSubscription()};function FT(e,t,n){this._items=[],this._orderedGroundPrimitives=e,this._classificationType=t,this._asynchronous=A(n,!0)}FT.prototype.add=function(e,t){const n=this._items,i=n.length,o=t.createFillGeometryInstance(e),r=ie.getValueOrDefault(t.zIndex,0);for(let a=0;a<i;++a){const c=n[a];if(c.isMaterial(t)&&c.zIndex===r){c.add(e,t,o);return}}const s=new zf(this._orderedGroundPrimitives,this._classificationType,t.fillMaterialProperty,r,this._asynchronous);s.add(e,t,o),n.push(s)};FT.prototype.remove=function(e){const t=this._items,n=t.length;for(let i=n-1;i>=0;i--){const o=t[i];if(o.remove(e)){o.updaters.length===0&&(t.splice(i,1),o.destroy());break}}};FT.prototype.update=function(e){let t;const n=this._items,i=n.length;for(t=i-1;t>=0;t--){const r=n[t];if(r.invalidated){n.splice(t,1);const s=r.updaters.values,a=s.length;for(let c=0;c<a;c++)this.add(e,s[c]);r.destroy()}}let o=!0;for(t=0;t<n.length;t++)o=n[t].update(e)&&o;return o};FT.prototype.getBoundingSphere=function(e,t){const n=this._items,i=n.length;for(let o=0;o<i;o++){const r=n[o];if(r.contains(e))return r.getBoundingSphere(e,t)}return Ot.FAILED};FT.prototype.removeAllPrimitives=function(){const e=this._items,t=e.length;for(let n=0;n<t;n++)e[n].destroy();this._items.length=0};const kmt=[];function y7(e,t){const n=e._batches,i=n.length;for(let o=0;o<i;o++)n[o].remove(t)}function A7(e,t,n){if(n.isDynamic){e._dynamicBatch.add(t,n);return}if(n.clampToGround&&n.fillEnabled){const s=n.classificationTypeProperty.getValue(t);e._groundBatches[s].add(t,n);return}let i;n.fillEnabled&&(i=n.shadowsProperty.getValue(t));let o=0;l(n.depthFailMaterialProperty)&&(o=n.depthFailMaterialProperty instanceof An?1:2);let r;l(i)&&(r=i+o*sr.NUMBER_OF_SHADOW_MODES),n.fillEnabled&&(n.fillMaterialProperty instanceof An?e._colorBatches[r].add(t,n):e._materialBatches[r].add(t,n))}function Sd(e,t,n,i){E.defined("scene",e),E.defined("entityCollection",t),i=A(i,e.groundPrimitives),n=A(n,e.primitives),this._scene=e,this._primitives=n,this._entityCollection=void 0,this._addedObjects=new Vt,this._removedObjects=new Vt,this._changedObjects=new Vt;let o;const r=sr.NUMBER_OF_SHADOW_MODES;for(this._colorBatches=new Array(r*3),this._materialBatches=new Array(r*3),o=0;o<r;++o)this._colorBatches[o]=new ou(n,Na,void 0,!1,o),this._materialBatches[o]=new ru(n,ca,void 0,!1,o),this._colorBatches[o+r]=new ou(n,Na,Na,!1,o),this._materialBatches[o+r]=new ru(n,ca,Na,!1,o),this._colorBatches[o+r*2]=new ou(n,Na,ca,!1,o),this._materialBatches[o+r*2]=new ru(n,ca,ca,!1,o);this._dynamicBatch=new Yy(n,i);const s=ir.NUMBER_OF_CLASSIFICATION_TYPES;for(this._groundBatches=new Array(s),o=0;o<s;++o)this._groundBatches[o]=new FT(i,o);this._batches=this._colorBatches.concat(this._materialBatches,this._dynamicBatch,this._groundBatches),this._subscriptions=new Vt,this._updaters=new Vt,this._entityCollection=t,t.collectionChanged.addEventListener(Sd.prototype._onCollectionChanged,this),this._onCollectionChanged(t,t.values,kmt)}Sd.prototype.update=function(e){E.defined("time",e);const t=this._addedObjects,n=t.values,i=this._removedObjects,o=i.values,r=this._changedObjects,s=r.values;let a,c,u,f;for(a=s.length-1;a>-1;a--)c=s[a],u=c.id,f=this._updaters.get(u),f.entity===c?(y7(this,f),A7(this,e,f)):(o.push(c),n.push(c));for(a=o.length-1;a>-1;a--)c=o[a],u=c.id,f=this._updaters.get(u),y7(this,f),f.destroy(),this._updaters.remove(u),this._subscriptions.get(u)(),this._subscriptions.remove(u);for(a=n.length-1;a>-1;a--)c=n[a],u=c.id,f=new Ff(c,this._scene),this._updaters.set(u,f),A7(this,e,f),this._subscriptions.set(u,f.geometryChanged.addEventListener(Sd._onGeometryChanged,this));t.removeAll(),i.removeAll(),r.removeAll();let h=!0;const _=this._batches,g=_.length;for(a=0;a<g;a++)h=_[a].update(e)&&h;return h};const Gmt=[],Wmt=new Ae;Sd.prototype.getBoundingSphere=function(e,t){E.defined("entity",e),E.defined("result",t);const n=Gmt,i=Wmt;let o=0,r=Ot.DONE;const s=this._batches,a=s.length,c=this._updaters.get(e.id);for(let u=0;u<a;u++){if(r=s[u].getBoundingSphere(c,i),r===Ot.PENDING)return Ot.PENDING;r===Ot.DONE&&(n[o]=Ae.clone(i,n[o]),o++)}return o===0?Ot.FAILED:(n.length=o,Ae.fromBoundingSpheres(n,t),Ot.DONE)};Sd.prototype.isDestroyed=function(){return!1};Sd.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(Sd.prototype._onCollectionChanged,this),this._addedObjects.removeAll(),this._removedObjects.removeAll();let e;const t=this._batches;let n=t.length;for(e=0;e<n;e++)t[e].removeAllPrimitives();const i=this._subscriptions.values;for(n=i.length,e=0;e<n;e++)i[e]();return this._subscriptions.removeAll(),Je(this)};Sd._onGeometryChanged=function(e){const t=this._removedObjects,n=this._changedObjects,i=e.entity,o=i.id;!l(t.get(o))&&!l(n.get(o))&&n.set(o,i)};Sd.prototype._onCollectionChanged=function(e,t,n){const i=this._addedObjects,o=this._removedObjects,r=this._changedObjects;let s,a,c;for(s=n.length-1;s>-1;s--)c=n[s],a=c.id,i.remove(a)||(o.set(a,c),r.remove(a));for(s=t.length-1;s>-1;s--)c=t[s],a=c.id,o.remove(a)?r.set(a,c):i.set(a,c)};function Du(e){E.typeOf.object("options",e),E.typeOf.object("options.scene",e.scene),E.typeOf.object("options.dataSourceCollection",e.dataSourceCollection),vs.initializeTerrainHeights(),gu.initializeTerrainHeights();const t=e.scene,n=e.dataSourceCollection;this._eventHelper=new Yd,this._eventHelper.add(n.dataSourceAdded,this._onDataSourceAdded,this),this._eventHelper.add(n.dataSourceRemoved,this._onDataSourceRemoved,this),this._eventHelper.add(n.dataSourceMoved,this._onDataSourceMoved,this),this._eventHelper.add(t.postRender,this._postRender,this),this._dataSourceCollection=n,this._scene=t,this._visualizersCallback=A(e.visualizersCallback,Du.defaultVisualizersCallback);let i=!1;const o=new Tr,r=new Tr;n.length>0&&(t.primitives.add(o),t.groundPrimitives.add(r),i=!0),this._primitives=o,this._groundPrimitives=r;for(let u=0,f=n.length;u<f;u++)this._onDataSourceAdded(n,n.get(u));const s=new $U;this._onDataSourceAdded(void 0,s),this._defaultDataSource=s;let a,c;if(!i){const u=this,f=function(){t.primitives.add(o),t.groundPrimitives.add(r),a(),c(),u._removeDefaultDataSourceListener=void 0,u._removeDataSourceCollectionListener=void 0};a=s.entities.collectionChanged.addEventListener(f),c=n.dataSourceAdded.addEventListener(f)}this._removeDefaultDataSourceListener=a,this._removeDataSourceCollectionListener=c,this._ready=!1}Du.defaultVisualizersCallback=function(e,t,n){const i=n.entities;return[new n_(t,i),new Cu(e,i,n._primitives,n._groundPrimitives),new l_(t,i),new wd(e,i),new s_(e,i),new d_(t,i),new f_(e,i),new Sd(e,i,n._primitives,n._groundPrimitives)]};Object.defineProperties(Du.prototype,{scene:{get:function(){return this._scene}},dataSources:{get:function(){return this._dataSourceCollection}},defaultDataSource:{get:function(){return this._defaultDataSource}},ready:{get:function(){return this._ready}}});Du.prototype.isDestroyed=function(){return!1};Du.prototype.destroy=function(){this._eventHelper.removeAll();const e=this._dataSourceCollection;for(let t=0,n=e.length;t<n;++t)this._onDataSourceRemoved(this._dataSourceCollection,e.get(t));return this._onDataSourceRemoved(void 0,this._defaultDataSource),l(this._removeDefaultDataSourceListener)?(this._removeDefaultDataSourceListener(),this._removeDataSourceCollectionListener()):(this._scene.primitives.remove(this._primitives),this._scene.groundPrimitives.remove(this._groundPrimitives)),Je(this)};Du.prototype.update=function(e){if(E.defined("time",e),!Ro.initialized)return this._ready=!1,!1;let t=!0,n,i,o,r;const s=this._dataSourceCollection,a=s.length;for(n=0;n<a;n++){const c=s.get(n);for(l(c.update)&&(t=c.update(e)&&t),o=c._visualizers,r=o.length,i=0;i<r;i++)t=o[i].update(e)&&t}for(o=this._defaultDataSource._visualizers,r=o.length,i=0;i<r;i++)t=o[i].update(e)&&t;return this._ready=t,t};Du.prototype._postRender=function(){const e=this._scene.frameState,t=this._dataSourceCollection,n=t.length;for(let i=0;i<n;i++){const o=t.get(i),r=o.credit;l(r)&&e.creditDisplay.addCredit(r);const s=o._resourceCredits;if(l(s)){const a=s.length;for(let c=0;c<a;c++)e.creditDisplay.addCredit(s[c])}}};const qmt=[],jmt=new Ae;Du.prototype.getBoundingSphere=function(e,t,n){if(E.defined("entity",e),E.typeOf.bool("allowPartial",t),E.defined("result",n),!this._ready)return Ot.PENDING;let i,o,r=this._defaultDataSource;if(!r.entities.contains(e)){r=void 0;const _=this._dataSourceCollection;for(o=_.length,i=0;i<o;i++){const g=_.get(i);if(g.entities.contains(e)){r=g;break}}}if(!l(r))return Ot.FAILED;const s=qmt,a=jmt;let c=0,u=Ot.DONE;const f=r._visualizers,h=f.length;for(i=0;i<h;i++){const _=f[i];if(l(_.getBoundingSphere)){if(u=f[i].getBoundingSphere(e,a),!t&&u===Ot.PENDING)return Ot.PENDING;u===Ot.DONE&&(s[c]=Ae.clone(a,s[c]),c++)}}return c===0?Ot.FAILED:(s.length=c,Ae.fromBoundingSpheres(s,n),Ot.DONE)};Du.prototype._onDataSourceAdded=function(e,t){const n=this._scene,i=this._primitives,o=this._groundPrimitives,r=i.add(new Tr),s=o.add(new $d);t._primitives=r,t._groundPrimitives=s;const a=t.clustering;a._initialize(n),r.add(a),t._visualizers=this._visualizersCallback(n,a,t)};Du.prototype._onDataSourceRemoved=function(e,t){const n=this._primitives,i=this._groundPrimitives,o=t._primitives,r=t._groundPrimitives,s=t.clustering;o.remove(s);const a=t._visualizers,c=a.length;for(let u=0;u<c;u++)a[u].destroy();n.remove(o),i.remove(r),t._visualizers=void 0};Du.prototype._onDataSourceMoved=function(e,t,n){const i=this._primitives,o=this._groundPrimitives,r=e._primitives,s=e._groundPrimitives;t===n+1?(i.raise(r),o.raise(s)):t===n-1?(i.lower(r),o.lower(s)):t===0?(i.lowerToBottom(r),o.lowerToBottom(s),i.raise(r),o.raise(s)):(i.raiseToTop(r),o.raiseToTop(s))};const T7=new te,C7=new te,b7=new te,Ymt=new N,eD=new d,E7=new d,VN=new d,kN=new d,x7=new d,w7=new d,j0=new ce,$mt=1.25;function Xmt(e,t,n,i,o,r,s){const a=e.scene.mode;let c=o.getValue(r,e._lastCartesian);if(l(c)){let u=!1,f=!1,h,_,g;if(a===me.SCENE3D){ce.addSeconds(r,.001,j0);let x=o.getValue(j0,eD);if(l(x)||(ce.addSeconds(r,-.001,j0),x=o.getValue(j0,eD),f=!0),l(x)){let v=En.computeFixedToIcrfMatrix(r,T7),D=En.computeFixedToIcrfMatrix(j0,C7),L;!l(v)||!l(D)?(L=En.computeTemeToPseudoFixedMatrix(r,b7),v=te.transpose(L,T7),D=En.computeTemeToPseudoFixedMatrix(j0,C7),te.transpose(D,D)):L=te.transpose(v,b7);const B=te.multiplyByVector(v,c,x7),V=te.multiplyByVector(D,x,w7);d.subtract(B,V,kN);const M=d.magnitude(kN)*1e3,H=F.GRAVITATIONALPARAMETER,G=-H/(M*M-2*H/d.magnitude(B));G<0||G>$mt*s.maximumRadius?(h=E7,d.normalize(c,h),d.negate(h,h),g=d.clone(d.UNIT_Z,VN),_=d.cross(g,h,eD),d.magnitude(_)>F.EPSILON7&&(d.normalize(h,h),d.normalize(_,_),g=d.cross(h,_,VN),d.normalize(g,g),u=!0)):d.equalsEpsilon(c,x,F.EPSILON7)||(g=E7,d.normalize(B,g),d.normalize(V,V),_=d.cross(g,V,VN),f&&(_=d.multiplyByScalar(_,-1,_)),d.equalsEpsilon(_,d.ZERO,F.EPSILON7)||(h=d.cross(_,g,eD),te.multiplyByVector(L,h,h),te.multiplyByVector(L,_,_),te.multiplyByVector(L,g,g),d.normalize(h,h),d.normalize(_,_),d.normalize(g,g),u=!0))}}l(e.boundingSphere)&&(c=e.boundingSphere.center);let p,y,T;i&&(p=d.clone(t.position,kN),y=d.clone(t.direction,x7),T=d.clone(t.up,w7));const b=Ymt;u?(b[0]=h.x,b[1]=h.y,b[2]=h.z,b[3]=0,b[4]=_.x,b[5]=_.y,b[6]=_.z,b[7]=0,b[8]=g.x,b[9]=g.y,b[10]=g.z,b[11]=0,b[12]=c.x,b[13]=c.y,b[14]=c.z,b[15]=0):En.eastNorthUpToFixedFrame(c,s,b),t._setTransform(b),i&&(d.clone(p,t.position),d.clone(y,t.direction),d.clone(T,t.up),d.cross(y,T,t.right))}if(n){const u=a===me.SCENE2D||d.equals(e._offset3D,d.ZERO)?void 0:e._offset3D;t.lookAtTransform(t.transform,u)}}function tx(e,t,n){E.defined("entity",e),E.defined("scene",t),this.entity=e,this.scene=t,this.ellipsoid=A(n,be.WGS84),this.boundingSphere=void 0,this._lastEntity=void 0,this._mode=void 0,this._lastCartesian=new d,this._defaultOffset3D=void 0,this._offset3D=new d}Object.defineProperties(tx,{defaultOffset3D:{get:function(){return this._defaultOffset3D},set:function(e){this._defaultOffset3D=d.clone(e,new d)}}});tx.defaultOffset3D=new d(-14e3,3500,3500);const tD=new ry,Kmt=new d;tx.prototype.update=function(e,t){E.defined("time",e);const n=this.scene,i=this.ellipsoid,o=n.mode;if(o===me.MORPHING)return;const r=this.entity,s=r.position;if(!l(s))return;const a=r!==this._lastEntity,c=o!==this._mode,u=n.camera;let f=a||c,h=!0;if(a){const _=r.viewFrom,g=l(_);if(!g&&l(t)){tD.pitch=-F.PI_OVER_FOUR,tD.range=0;const p=s.getValue(e,Kmt);if(l(p)){const y=2-1/Math.max(1,d.magnitude(p)/i.maximumRadius);tD.pitch*=y}u.viewBoundingSphere(t,tD),this.boundingSphere=t,f=!1,h=!1}else(!g||!l(_.getValue(e,this._offset3D)))&&d.clone(tx._defaultOffset3D,this._offset3D)}else!c&&this._mode!==me.SCENE2D&&d.clone(u.position,this._offset3D);this._lastEntity=r,this._mode=o,Xmt(this,u,f,h,s,e,i)};function Ih(e,t){this._tilingScheme=e,this._maximumLevel=t,this._rootNodes=[]}const Cg=new Ee;function Jmt(e,t,n,i){const o=i.length;for(let r=0;r<o;++r){const s=i[r];if(s.x===t&&s.y===n&&s.level===e)return!0}return!1}Ih.prototype.addAvailableTileRange=function(e,t,n,i,o){const r=this._tilingScheme,s=this._rootNodes;if(e===0)for(let _=n;_<=o;++_)for(let g=t;g<=i;++g)Jmt(e,g,_,s)||s.push(new aA(r,void 0,0,g,_));r.tileXYToRectangle(t,n,e,Cg);const a=Cg.west,c=Cg.north;r.tileXYToRectangle(i,o,e,Cg);const u=Cg.east,f=Cg.south,h=new n_t(e,a,f,u,c);for(let _=0;_<s.length;++_){const g=s[_];rH(g.extent,h)&&i_t(this._maximumLevel,g,h)}};Ih.prototype.computeMaximumLevelAtPosition=function(e){let t;for(let n=0;n<this._rootNodes.length;++n){const i=this._rootNodes[n];if(cA(i.extent,e)){t=i;break}}return l(t)?Ib(void 0,t,e):-1};const Qmt=[],Zmt=[],e_t=new Ee,t_t=new Ee;Ih.prototype.computeBestAvailableLevelOverRectangle=function(e){const t=Qmt;t.length=0,e.east<e.west?(t.push(Ee.fromRadians(-Math.PI,e.south,e.east,e.north,e_t)),t.push(Ee.fromRadians(e.west,e.south,Math.PI,e.north,t_t))):t.push(e);const n=Zmt;n.length=0;let i;for(i=0;i<this._rootNodes.length;++i)Pb(n,this._rootNodes[i],t);for(i=n.length-1;i>=0;--i)if(l(n[i])&&n[i].length===0)return i;return 0};const S7=new ve;Ih.prototype.isTileAvailable=function(e,t,n){const i=this._tilingScheme.tileXYToRectangle(t,n,e,Cg);return Ee.center(i,S7),this.computeMaximumLevelAtPosition(S7)>=e};Ih.prototype.computeChildMaskForTile=function(e,t,n){const i=e+1;if(i>=this._maximumLevel)return 0;let o=0;return o|=this.isTileAvailable(i,2*t,2*n+1)?1:0,o|=this.isTileAvailable(i,2*t+1,2*n+1)?2:0,o|=this.isTileAvailable(i,2*t,2*n)?4:0,o|=this.isTileAvailable(i,2*t+1,2*n)?8:0,o};function aA(e,t,n,i,o){this.tilingScheme=e,this.parent=t,this.level=n,this.x=i,this.y=o,this.extent=e.tileXYToRectangle(i,o,n),this.rectangles=[],this._sw=void 0,this._se=void 0,this._nw=void 0,this._ne=void 0}Object.defineProperties(aA.prototype,{nw:{get:function(){return this._nw||(this._nw=new aA(this.tilingScheme,this,this.level+1,this.x*2,this.y*2)),this._nw}},ne:{get:function(){return this._ne||(this._ne=new aA(this.tilingScheme,this,this.level+1,this.x*2+1,this.y*2)),this._ne}},sw:{get:function(){return this._sw||(this._sw=new aA(this.tilingScheme,this,this.level+1,this.x*2,this.y*2+1)),this._sw}},se:{get:function(){return this._se||(this._se=new aA(this.tilingScheme,this,this.level+1,this.x*2+1,this.y*2+1)),this._se}}});function n_t(e,t,n,i,o){this.level=e,this.west=t,this.south=n,this.east=i,this.north=o}function rH(e,t){const n=Math.max(e.west,t.west),i=Math.max(e.south,t.south),o=Math.min(e.east,t.east),r=Math.min(e.north,t.north);return i<r&&n<o}function i_t(e,t,n){for(;t.level<e;)if(nD(t.nw.extent,n))t=t.nw;else if(nD(t.ne.extent,n))t=t.ne;else if(nD(t.sw.extent,n))t=t.sw;else if(nD(t.se.extent,n))t=t.se;else break;if(t.rectangles.length===0||t.rectangles[t.rectangles.length-1].level<=n.level)t.rectangles.push(n);else{let i=da(t.rectangles,n.level,o_t);i<0&&(i=~i),t.rectangles.splice(i,0,n)}}function o_t(e,t){return e.level-t}function nD(e,t){return t.west>=e.west&&t.east<=e.east&&t.south>=e.south&&t.north<=e.north}function cA(e,t){return t.longitude>=e.west&&t.longitude<=e.east&&t.latitude>=e.south&&t.latitude<=e.north}function Ib(e,t,n){let i=0,o=!1;for(;!o;){const r=t._nw&&cA(t._nw.extent,n),s=t._ne&&cA(t._ne.extent,n),a=t._sw&&cA(t._sw.extent,n),c=t._se&&cA(t._se.extent,n);if(r+s+a+c>1){r&&(i=Math.max(i,Ib(t,t._nw,n))),s&&(i=Math.max(i,Ib(t,t._ne,n))),a&&(i=Math.max(i,Ib(t,t._sw,n))),c&&(i=Math.max(i,Ib(t,t._se,n)));break}else r?t=t._nw:s?t=t._ne:a?t=t._sw:c?t=t._se:o=!0}for(;t!==e;){const r=t.rectangles;for(let s=r.length-1;s>=0&&r[s].level>i;--s){const a=r[s];cA(a,n)&&(i=a.level)}t=t.parent}return i}function Pb(e,t,n){if(!t)return;let i,o=!1;for(i=0;i<n.length;++i)o=o||rH(t.extent,n[i]);if(!o)return;const r=t.rectangles;for(i=0;i<r.length;++i){const s=r[i];e[s.level]||(e[s.level]=n),e[s.level]=r_t(e[s.level],s)}Pb(e,t._nw,n),Pb(e,t._ne,n),Pb(e,t._sw,n),Pb(e,t._se,n)}function r_t(e,t){const n=[];for(let i=0;i<e.length;++i){const o=e[i];rH(o,t)?(o.west<t.west&&n.push(new Ee(o.west,o.south,t.west,o.north)),o.east>t.east&&n.push(new Ee(t.east,o.south,o.east,o.north)),o.south<t.south&&n.push(new Ee(Math.max(t.west,o.west),o.south,Math.min(t.east,o.east),t.south)),o.north>t.north&&n.push(new Ee(Math.max(t.west,o.west),t.north,Math.min(t.east,o.east),o.north))):n.push(o)}return n}function Yse(){}Yse.prototype.geocode=function(e){E.typeOf.string("query",e);const t=e.match(/[^\s,\n]+/g);if(t.length===2||t.length===3){let n=+t[0],i=+t[1];const o=t.length===3?+t[2]:300;if(isNaN(n)&&isNaN(i)){const r=/^(\d+.?\d*)([nsew])/i;for(let s=0;s<t.length;++s){const a=t[s].match(r);r.test(t[s])&&a.length===3&&(/^[ns]/i.test(a[2])?i=/^[n]/i.test(a[2])?+a[1]:-a[1]:/^[ew]/i.test(a[2])&&(n=/^[e]/i.test(a[2])?+a[1]:-a[1]))}}if(!isNaN(n)&&!isNaN(i)&&!isNaN(o)){const r={displayName:e,destination:d.fromDegrees(n,i,o)};return Promise.resolve([r])}}return Promise.resolve([])};const VP={};VP.clipTriangleAtAxisAlignedThreshold=function(e,t,n,i,o,r){if(!l(e))throw new w("threshold is required.");if(!l(t))throw new w("keepAbove is required.");if(!l(n))throw new w("u0 is required.");if(!l(i))throw new w("u1 is required.");if(!l(o))throw new w("u2 is required.");l(r)?r.length=0:r=[];let s,a,c;t?(s=n<e,a=i<e,c=o<e):(s=n>e,a=i>e,c=o>e);const u=s+a+c;let f,h,_,g,p,y;return u===1?s?(f=(e-n)/(i-n),h=(e-n)/(o-n),r.push(1),r.push(2),h!==1&&(r.push(-1),r.push(0),r.push(2),r.push(h)),f!==1&&(r.push(-1),r.push(0),r.push(1),r.push(f))):a?(_=(e-i)/(o-i),g=(e-i)/(n-i),r.push(2),r.push(0),g!==1&&(r.push(-1),r.push(1),r.push(0),r.push(g)),_!==1&&(r.push(-1),r.push(1),r.push(2),r.push(_))):c&&(p=(e-o)/(n-o),y=(e-o)/(i-o),r.push(0),r.push(1),y!==1&&(r.push(-1),r.push(2),r.push(1),r.push(y)),p!==1&&(r.push(-1),r.push(2),r.push(0),r.push(p))):u===2?!s&&n!==e?(g=(e-i)/(n-i),p=(e-o)/(n-o),r.push(0),r.push(-1),r.push(1),r.push(0),r.push(g),r.push(-1),r.push(2),r.push(0),r.push(p)):!a&&i!==e?(y=(e-o)/(i-o),f=(e-n)/(i-n),r.push(1),r.push(-1),r.push(2),r.push(1),r.push(y),r.push(-1),r.push(0),r.push(1),r.push(f)):!c&&o!==e&&(h=(e-n)/(o-n),_=(e-i)/(o-i),r.push(2),r.push(-1),r.push(0),r.push(2),r.push(h),r.push(-1),r.push(1),r.push(2),r.push(_)):u!==3&&(r.push(0),r.push(1),r.push(2)),r};VP.computeBarycentricCoordinates=function(e,t,n,i,o,r,s,a,c){if(!l(e))throw new w("x is required.");if(!l(t))throw new w("y is required.");if(!l(n))throw new w("x1 is required.");if(!l(i))throw new w("y1 is required.");if(!l(o))throw new w("x2 is required.");if(!l(r))throw new w("y2 is required.");if(!l(s))throw new w("x3 is required.");if(!l(a))throw new w("y3 is required.");const u=n-s,f=s-o,h=r-a,_=i-a,g=1/(h*u+f*_),p=t-a,y=e-s,T=(h*y+f*p)*g,b=(-_*y+u*p)*g,x=1-T-b;return l(c)?(c.x=T,c.y=b,c.z=x,c):new d(T,b,x)};VP.computeLineSegmentLineSegmentIntersection=function(e,t,n,i,o,r,s,a,c){E.typeOf.number("x00",e),E.typeOf.number("y00",t),E.typeOf.number("x01",n),E.typeOf.number("y01",i),E.typeOf.number("x10",o),E.typeOf.number("y10",r),E.typeOf.number("x11",s),E.typeOf.number("y11",a);const u=(s-o)*(t-r)-(a-r)*(e-o),f=(n-e)*(t-r)-(i-t)*(e-o),h=(a-r)*(n-e)-(s-o)*(i-t);if(h===0)return;const _=u/h,g=f/h;if(_>=0&&_<=1&&g>=0&&g<=1)return l(c)||(c=new $),c.x=e+_*(n-e),c.y=t+_*(i-t),c};const $se=VP;function h_(e){if(!l(e)||!l(e.quantizedVertices))throw new w("options.quantizedVertices is required.");if(!l(e.indices))throw new w("options.indices is required.");if(!l(e.minimumHeight))throw new w("options.minimumHeight is required.");if(!l(e.maximumHeight))throw new w("options.maximumHeight is required.");if(!l(e.maximumHeight))throw new w("options.maximumHeight is required.");if(!l(e.boundingSphere))throw new w("options.boundingSphere is required.");if(!l(e.horizonOcclusionPoint))throw new w("options.horizonOcclusionPoint is required.");if(!l(e.westIndices))throw new w("options.westIndices is required.");if(!l(e.southIndices))throw new w("options.southIndices is required.");if(!l(e.eastIndices))throw new w("options.eastIndices is required.");if(!l(e.northIndices))throw new w("options.northIndices is required.");if(!l(e.westSkirtHeight))throw new w("options.westSkirtHeight is required.");if(!l(e.southSkirtHeight))throw new w("options.southSkirtHeight is required.");if(!l(e.eastSkirtHeight))throw new w("options.eastSkirtHeight is required.");if(!l(e.northSkirtHeight))throw new w("options.northSkirtHeight is required.");this._quantizedVertices=e.quantizedVertices,this._encodedNormals=e.encodedNormals,this._indices=e.indices,this._minimumHeight=e.minimumHeight,this._maximumHeight=e.maximumHeight,this._boundingSphere=e.boundingSphere,this._orientedBoundingBox=e.orientedBoundingBox,this._horizonOcclusionPoint=e.horizonOcclusionPoint,this._credits=e.credits;const t=this._quantizedVertices.length/3,n=this._uValues=this._quantizedVertices.subarray(0,t),i=this._vValues=this._quantizedVertices.subarray(t,2*t);this._heightValues=this._quantizedVertices.subarray(2*t,3*t);function o(s,a){return i[s]-i[a]}function r(s,a){return n[s]-n[a]}this._westIndices=oD(e.westIndices,o,t),this._southIndices=oD(e.southIndices,r,t),this._eastIndices=oD(e.eastIndices,o,t),this._northIndices=oD(e.northIndices,r,t),this._westSkirtHeight=e.westSkirtHeight,this._southSkirtHeight=e.southSkirtHeight,this._eastSkirtHeight=e.eastSkirtHeight,this._northSkirtHeight=e.northSkirtHeight,this._childTileMask=A(e.childTileMask,15),this._createdByUpsampling=A(e.createdByUpsampling,!1),this._waterMask=e.waterMask,this._mesh=void 0}Object.defineProperties(h_.prototype,{credits:{get:function(){return this._credits}},waterMask:{get:function(){return this._waterMask}},childTileMask:{get:function(){return this._childTileMask}},canUpsample:{get:function(){return l(this._mesh)}}});const iD=[];function oD(e,t,n){iD.length=e.length;let i=!1;for(let o=0,r=e.length;o<r;++o)iD[o]=e[o],i=i||o>0&&t(e[o-1],e[o])>0;return i?(iD.sort(t),At.createTypedArray(n,iD)):e}const Xse="createVerticesFromQuantizedTerrainMesh",s_t=new lo(Xse),a_t=new lo(Xse,Ld.maximumAsynchronousTasks);h_.prototype.createMesh=function(e){e=A(e,A.EMPTY_OBJECT),E.typeOf.object("options.tilingScheme",e.tilingScheme),E.typeOf.number("options.x",e.x),E.typeOf.number("options.y",e.y),E.typeOf.number("options.level",e.level);const t=e.tilingScheme,n=e.x,i=e.y,o=e.level,r=A(e.exaggeration,1),s=A(e.exaggerationRelativeHeight,0),a=A(e.throttle,!0),c=t.ellipsoid,u=t.tileXYToRectangle(n,i,o),h=(a?a_t:s_t).scheduleTask({minimumHeight:this._minimumHeight,maximumHeight:this._maximumHeight,quantizedVertices:this._quantizedVertices,octEncodedNormals:this._encodedNormals,includeWebMercatorT:!0,indices:this._indices,westIndices:this._westIndices,southIndices:this._southIndices,eastIndices:this._eastIndices,northIndices:this._northIndices,westSkirtHeight:this._westSkirtHeight,southSkirtHeight:this._southSkirtHeight,eastSkirtHeight:this._eastSkirtHeight,northSkirtHeight:this._northSkirtHeight,rectangle:u,relativeToCenter:this._boundingSphere.center,ellipsoid:c,exaggeration:r,exaggerationRelativeHeight:s});if(!l(h))return;const _=this;return Promise.resolve(h).then(function(g){const p=_._quantizedVertices.length/3,y=p+_._westIndices.length+_._southIndices.length+_._eastIndices.length+_._northIndices.length,T=At.createTypedArray(y,g.indices),b=new Float32Array(g.vertices),x=g.center,v=g.minimumHeight,D=g.maximumHeight,L=_._boundingSphere,B=_._orientedBoundingBox,V=A(d.clone(g.occludeePointInScaledSpace),_._horizonOcclusionPoint),M=g.vertexStride,H=ts.clone(g.encoding);return _._mesh=new J1(x,b,T,g.indexCountWithoutSkirts,p,v,D,L,V,M,B,H,g.westIndicesSouthToNorth,g.southIndicesEastToWest,g.eastIndicesNorthToSouth,g.northIndicesWestToEast),_._quantizedVertices=void 0,_._encodedNormals=void 0,_._indices=void 0,_._uValues=void 0,_._vValues=void 0,_._heightValues=void 0,_._westIndices=void 0,_._southIndices=void 0,_._eastIndices=void 0,_._northIndices=void 0,_._mesh})};const c_t=new lo("upsampleQuantizedTerrainMesh",Ld.maximumAsynchronousTasks);h_.prototype.upsample=function(e,t,n,i,o,r,s){if(!l(e))throw new w("tilingScheme is required.");if(!l(t))throw new w("thisX is required.");if(!l(n))throw new w("thisY is required.");if(!l(i))throw new w("thisLevel is required.");if(!l(o))throw new w("descendantX is required.");if(!l(r))throw new w("descendantY is required.");if(!l(s))throw new w("descendantLevel is required.");if(s-i>1)throw new w("Upsampling through more than one level at a time is not currently supported.");const c=this._mesh;if(!l(this._mesh))return;const u=t*2!==o,f=n*2===r,h=e.ellipsoid,_=e.tileXYToRectangle(o,r,s),g=c_t.scheduleTask({vertices:c.vertices,vertexCountWithoutSkirts:c.vertexCountWithoutSkirts,indices:c.indices,indexCountWithoutSkirts:c.indexCountWithoutSkirts,encoding:c.encoding,minimumHeight:this._minimumHeight,maximumHeight:this._maximumHeight,isEastChild:u,isNorthChild:f,childRectangle:_,ellipsoid:h});if(!l(g))return;let p=Math.min(this._westSkirtHeight,this._eastSkirtHeight);p=Math.min(p,this._southSkirtHeight),p=Math.min(p,this._northSkirtHeight);const y=u?p*.5:this._westSkirtHeight,T=f?p*.5:this._southSkirtHeight,b=u?this._eastSkirtHeight:p*.5,x=f?this._northSkirtHeight:p*.5,v=this._credits;return Promise.resolve(g).then(function(D){const L=new Uint16Array(D.vertices),B=At.createTypedArray(L.length/3,D.indices);let V;return l(D.encodedNormals)&&(V=new Uint8Array(D.encodedNormals)),new h_({quantizedVertices:L,indices:B,encodedNormals:V,minimumHeight:D.minimumHeight,maximumHeight:D.maximumHeight,boundingSphere:Ae.clone(D.boundingSphere),orientedBoundingBox:Zt.clone(D.orientedBoundingBox),horizonOcclusionPoint:d.clone(D.horizonOcclusionPoint),westIndices:D.westIndices,southIndices:D.southIndices,eastIndices:D.eastIndices,northIndices:D.northIndices,westSkirtHeight:y,southSkirtHeight:T,eastSkirtHeight:b,northSkirtHeight:x,childTileMask:0,credits:v,createdByUpsampling:!0})})};const v2=32767,Kse=new d;h_.prototype.interpolateHeight=function(e,t,n){let i=F.clamp((t-e.west)/e.width,0,1);i*=v2;let o=F.clamp((n-e.south)/e.height,0,1);return o*=v2,l(this._mesh)?d_t(this,i,o):h_t(this,i,o)};function Jse(e,t,n,i,o,r,s,a){const c=Math.min(n,o,s),u=Math.max(n,o,s),f=Math.min(i,r,a),h=Math.max(i,r,a);return e>=c&&e<=u&&t>=f&&t<=h}const l_t=new $,u_t=new $,f_t=new $;function d_t(e,t,n){const i=e._mesh,o=i.vertices,r=i.encoding,s=i.indices;for(let a=0,c=s.length;a<c;a+=3){const u=s[a],f=s[a+1],h=s[a+2],_=r.decodeTextureCoordinates(o,u,l_t),g=r.decodeTextureCoordinates(o,f,u_t),p=r.decodeTextureCoordinates(o,h,f_t);if(Jse(t,n,_.x,_.y,g.x,g.y,p.x,p.y)){const y=$se.computeBarycentricCoordinates(t,n,_.x,_.y,g.x,g.y,p.x,p.y,Kse);if(y.x>=-1e-15&&y.y>=-1e-15&&y.z>=-1e-15){const T=r.decodeHeight(o,u),b=r.decodeHeight(o,f),x=r.decodeHeight(o,h);return y.x*T+y.y*b+y.z*x}}}}function h_t(e,t,n){const i=e._uValues,o=e._vValues,r=e._heightValues,s=e._indices;for(let a=0,c=s.length;a<c;a+=3){const u=s[a],f=s[a+1],h=s[a+2],_=i[u],g=i[f],p=i[h],y=o[u],T=o[f],b=o[h];if(Jse(t,n,_,y,g,T,p,b)){const x=$se.computeBarycentricCoordinates(t,n,_,y,g,T,p,b,Kse);if(x.x>=-1e-15&&x.y>=-1e-15&&x.z>=-1e-15){const v=x.x*r[u]+x.y*r[f]+x.z*r[h];return F.lerp(e._minimumHeight,e._maximumHeight,v/v2)}}}}h_.prototype.isChildAvailable=function(e,t,n,i){if(!l(e))throw new w("thisX is required.");if(!l(t))throw new w("thisY is required.");if(!l(n))throw new w("childX is required.");if(!l(i))throw new w("childY is required.");let o=2;return n!==e*2&&++o,i!==t*2&&(o-=2),(this._childTileMask&1<<o)!==0};h_.prototype.wasCreatedByUpsampling=function(){return this._createdByUpsampling};function p_t(e){this.resource=e.resource,this.version=e.version,this.isHeightmap=e.isHeightmap,this.tileUrlTemplates=e.tileUrlTemplates,this.availability=e.availability,this.hasVertexNormals=e.hasVertexNormals,this.hasWaterMask=e.hasWaterMask,this.hasMetadata=e.hasMetadata,this.availabilityLevels=e.availabilityLevels,this.availabilityTilesLoaded=e.availabilityTilesLoaded,this.littleEndianExtensionSize=e.littleEndianExtensionSize,this.availabilityPromiseCache={}}function $y(e){if(!l(e)||!l(e.url))throw new w("options.url is required.");this._heightmapWidth=65,this._heightmapStructure=void 0,this._hasWaterMask=!1,this._hasVertexNormals=!1,this._ellipsoid=e.ellipsoid,this._requestVertexNormals=A(e.requestVertexNormals,!1),this._requestWaterMask=A(e.requestWaterMask,!1),this._requestMetadata=A(e.requestMetadata,!0),this._errorEvent=new lt;let t=e.credit;typeof t=="string"&&(t=new Si(t)),this._credit=t,this._availability=void 0,this._ready=!1,this._tileCredits=void 0;const n=this;let i,o,r;const s=this._layers=[];let a="";const c=[];let u=0;this._readyPromise=Promise.resolve(e.url).then(function(y){const T=je.createIfNeeded(y);return T.appendForwardSlash(),i=T,o=i.getDerivedResource({url:"layer.json"}),n._tileCredits=T.credits,p()});function f(y){let T;if(!y.format)return T="The tile format is not specified in the layer.json file.",r=Lo.reportError(r,n,n._errorEvent,T),r.retry?p():Promise.reject(new Fe(T));if(!y.tiles||y.tiles.length===0)return T="The layer.json file does not specify any tile URL templates.",r=Lo.reportError(r,n,n._errorEvent,T),r.retry?p():Promise.reject(new Fe(T));let b=!1,x=!1,v=!1,D=!0,L=!1;if(y.format==="heightmap-1.0")L=!0,l(n._heightmapStructure)||(n._heightmapStructure={heightScale:1/5,heightOffset:-1e3,elementsPerHeight:1,stride:1,elementMultiplier:256,isBigEndian:!1,lowestEncodedHeight:0,highestEncodedHeight:256*256-1}),x=!0,n._requestWaterMask=!0;else if(y.format.indexOf("quantized-mesh-1.")!==0)return T=`The tile format "${y.format}" is invalid or not supported.`,r=Lo.reportError(r,n,n._errorEvent,T),r.retry?p():Promise.reject(new Fe(T));const B=y.tiles,V=y.maxzoom;if(u=Math.max(u,V),!y.projection||y.projection==="EPSG:4326")n._tilingScheme=new Ga({numberOfLevelZeroTilesX:2,numberOfLevelZeroTilesY:1,ellipsoid:n._ellipsoid});else if(y.projection==="EPSG:3857")n._tilingScheme=new Za({numberOfLevelZeroTilesX:1,numberOfLevelZeroTilesY:1,ellipsoid:n._ellipsoid});else return T=`The projection "${y.projection}" is invalid or not supported.`,r=Lo.reportError(r,n,n._errorEvent,T),r.retry?p():Promise.reject(new Fe(T));if(n._levelZeroMaximumGeometricError=Pr.getEstimatedLevelZeroGeometricErrorForAHeightmap(n._tilingScheme.ellipsoid,n._heightmapWidth,n._tilingScheme.getNumberOfXTilesAtLevel(0)),!y.scheme||y.scheme==="tms"||y.scheme==="slippyMap")n._scheme=y.scheme;else return T=`The scheme "${y.scheme}" is invalid or not supported.`,r=Lo.reportError(r,n,n._errorEvent,T),r.retry?p():Promise.reject(new Fe(T));let M;l(y.extensions)&&y.extensions.indexOf("octvertexnormals")!==-1?b=!0:l(y.extensions)&&y.extensions.indexOf("vertexnormals")!==-1&&(b=!0,D=!1),l(y.extensions)&&y.extensions.indexOf("watermask")!==-1&&(x=!0),l(y.extensions)&&y.extensions.indexOf("metadata")!==-1&&(v=!0);const H=y.metadataAvailability,G=y.available;let I;if(l(G)&&!l(H)){I=new Ih(n._tilingScheme,G.length);for(let m=0;m<G.length;++m){const P=G[m],R=n._tilingScheme.getNumberOfYTilesAtLevel(m);l(c[m])||(c[m]=[]);for(let U=0;U<P.length;++U){const W=P[U],q=R-W.endY-1,Y=R-W.startY-1;c[m].push([W.startX,q,W.endX,Y]),I.addAvailableTileRange(m,W.startX,q,W.endX,Y)}}}else l(H)&&(M=new Ih(n._tilingScheme,V),I=new Ih(n._tilingScheme,V),c[0]=[[0,0,1,0]],I.addAvailableTileRange(0,0,0,1,0));n._hasWaterMask=n._hasWaterMask||x,n._hasVertexNormals=n._hasVertexNormals||b,n._hasMetadata=n._hasMetadata||v,l(y.attribution)&&(a.length>0&&(a+=" "),a+=y.attribution),s.push(new p_t({resource:i,version:y.version,isHeightmap:L,tileUrlTemplates:B,availability:I,hasVertexNormals:b,hasWaterMask:x,hasMetadata:v,availabilityLevels:H,availabilityTilesLoaded:M,littleEndianExtensionSize:D}));const O=y.parentUrl;if(l(O)){if(!l(I))return console.log("A layer.json can't have a parentUrl if it does't have an available array."),Promise.resolve(!0);i=i.getDerivedResource({url:O}),i.appendForwardSlash(),o=i.getDerivedResource({url:"layer.json"});const m=o.fetchJson();return Promise.resolve(m).then(f).catch(h)}return Promise.resolve(!0)}function h(y){const T=`An error occurred while accessing ${o.url}.`;return r=Lo.reportError(r,n,n._errorEvent,T),r.retry?p():Promise.reject(new Fe(T))}function _(y){return f(y).then(function(){if(l(r))return;const T=c.length;if(T>0){const b=n._availability=new Ih(n._tilingScheme,u);for(let x=0;x<T;++x){const v=c[x];for(let D=0;D<v.length;++D){const L=v[D];b.addAvailableTileRange(x,L[0],L[1],L[2],L[3])}}}if(a.length>0){const b=new Si(a);l(n._tileCredits)?n._tileCredits.push(b):n._tileCredits=[b]}return n._ready=!0,Promise.resolve(!0)})}function g(y){return l(y)&&y.statusCode===404?_({tilejson:"2.1.0",format:"heightmap-1.0",version:"1.0.0",scheme:"tms",tiles:["{z}/{x}/{y}.terrain?v={version}"]}):h()}function p(){return Promise.resolve(o.fetchJson()).then(_).catch(g)}}const GN={OCT_VERTEX_NORMALS:1,WATER_MASK:2,METADATA:4};function v7(e){return!l(e)||e.length===0?{Accept:"application/vnd.quantized-mesh,application/octet-stream;q=0.9,*/*;q=0.01"}:{Accept:`application/vnd.quantized-mesh;extensions=${e.join("-")},application/octet-stream;q=0.9,*/*;q=0.01`}}function m_t(e,t,n,i,o){const r=new Uint16Array(t,0,e._heightmapWidth*e._heightmapWidth);return new _f({buffer:r,childTileMask:new Uint8Array(t,r.byteLength,1)[0],waterMask:new Uint8Array(t,r.byteLength+1,t.byteLength-r.byteLength-1),width:e._heightmapWidth,height:e._heightmapWidth,structure:e._heightmapStructure,credits:e._tileCredits})}function __t(e,t,n,i,o,r){const s=r.littleEndianExtensionSize;let a=0;const c=3,u=c+1,f=Float64Array.BYTES_PER_ELEMENT*c,h=Float64Array.BYTES_PER_ELEMENT*u,_=3,g=Uint16Array.BYTES_PER_ELEMENT*_,p=3;let y=Uint16Array.BYTES_PER_ELEMENT,T=y*p;const b=new DataView(t),x=new d(b.getFloat64(a,!0),b.getFloat64(a+8,!0),b.getFloat64(a+16,!0));a+=f;const v=b.getFloat32(a,!0);a+=Float32Array.BYTES_PER_ELEMENT;const D=b.getFloat32(a,!0);a+=Float32Array.BYTES_PER_ELEMENT;const L=new Ae(new d(b.getFloat64(a,!0),b.getFloat64(a+8,!0),b.getFloat64(a+16,!0)),b.getFloat64(a+f,!0));a+=h;const B=new d(b.getFloat64(a,!0),b.getFloat64(a+8,!0),b.getFloat64(a+16,!0));a+=f;const V=b.getUint32(a,!0);a+=Uint32Array.BYTES_PER_ELEMENT;const M=new Uint16Array(t,a,V*3);a+=V*g,V>64*1024&&(y=Uint32Array.BYTES_PER_ELEMENT,T=y*p);const H=M.subarray(0,V),G=M.subarray(V,2*V),I=M.subarray(V*2,3*V);Ri.zigZagDeltaDecode(H,G,I),a%y!==0&&(a+=y-a%y);const O=b.getUint32(a,!0);a+=Uint32Array.BYTES_PER_ELEMENT;const m=At.createTypedArrayFromArrayBuffer(V,t,a,O*p);a+=O*T;let P=0;const R=m.length;for(let le=0;le<R;++le){const Te=m[le];m[le]=P-Te,Te===0&&++P}const U=b.getUint32(a,!0);a+=Uint32Array.BYTES_PER_ELEMENT;const W=At.createTypedArrayFromArrayBuffer(V,t,a,U);a+=U*y;const q=b.getUint32(a,!0);a+=Uint32Array.BYTES_PER_ELEMENT;const Y=At.createTypedArrayFromArrayBuffer(V,t,a,q);a+=q*y;const j=b.getUint32(a,!0);a+=Uint32Array.BYTES_PER_ELEMENT;const ee=At.createTypedArrayFromArrayBuffer(V,t,a,j);a+=j*y;const K=b.getUint32(a,!0);a+=Uint32Array.BYTES_PER_ELEMENT;const se=At.createTypedArrayFromArrayBuffer(V,t,a,K);a+=K*y;let Q,Z;for(;a<b.byteLength;){const le=b.getUint8(a,!0);a+=Uint8Array.BYTES_PER_ELEMENT;const Te=b.getUint32(a,s);if(a+=Uint32Array.BYTES_PER_ELEMENT,le===GN.OCT_VERTEX_NORMALS&&e._requestVertexNormals)Q=new Uint8Array(t,a,V*2);else if(le===GN.WATER_MASK&&e._requestWaterMask)Z=new Uint8Array(t,a,Te);else if(le===GN.METADATA&&e._requestMetadata){const pe=b.getUint32(a,!0);if(pe>0){const ae=zc(new Uint8Array(t),a+Uint32Array.BYTES_PER_ELEMENT,pe).available;if(l(ae))for(let ye=0;ye<ae.length;++ye){const Ce=n+ye+1,Be=ae[ye],Le=e._tilingScheme.getNumberOfYTilesAtLevel(Ce);for(let Ve=0;Ve<Be.length;++Ve){const Ie=Be[Ve],He=Le-Ie.endY-1,Me=Le-Ie.startY-1;e.availability.addAvailableTileRange(Ce,Ie.startX,He,Ie.endX,Me),r.availability.addAvailableTileRange(Ce,Ie.startX,He,Ie.endX,Me)}}}r.availabilityTilesLoaded.addAvailableTileRange(n,i,o,i,o)}a+=Te}const J=e.getLevelMaximumGeometricError(n)*5,de=e._tilingScheme.tileXYToRectangle(i,o,n),_e=Zt.fromRectangle(de,v,D,e._tilingScheme.ellipsoid);return new h_({center:x,minimumHeight:v,maximumHeight:D,boundingSphere:L,orientedBoundingBox:_e,horizonOcclusionPoint:B,quantizedVertices:M,encodedNormals:Q,indices:m,westIndices:W,southIndices:Y,eastIndices:ee,northIndices:se,westSkirtHeight:J,southSkirtHeight:J,eastSkirtHeight:J,northSkirtHeight:J,childTileMask:e.availability.computeChildMaskForTile(n,i,o),waterMask:Z,credits:e._tileCredits})}$y.prototype.requestTileGeometry=function(e,t,n,i){if(!this._ready)throw new w("requestTileGeometry must not be called before the terrain provider is ready.");const o=this._layers;let r;const s=o.length;if(s===1)r=o[0];else for(let a=0;a<s;++a){const c=o[a];if(!l(c.availability)||c.availability.isTileAvailable(n,e,t)){r=c;break}}return Qse(this,e,t,n,r,i)};function Qse(e,t,n,i,o,r){if(!l(o))return Promise.reject(new Fe("Terrain tile doesn't exist"));const s=o.tileUrlTemplates;if(s.length===0)return;let a;!e._scheme||e._scheme==="tms"?a=e._tilingScheme.getNumberOfYTilesAtLevel(i)-n-1:a=n;const c=[];e._requestVertexNormals&&o.hasVertexNormals&&c.push(o.littleEndianExtensionSize?"octvertexnormals":"vertexnormals"),e._requestWaterMask&&o.hasWaterMask&&c.push("watermask"),e._requestMetadata&&o.hasMetadata&&c.push("metadata");let u,f;const h=s[(t+a+i)%s.length],_=o.resource;l(_._ionEndpoint)&&!l(_._ionEndpoint.externalType)?(c.length!==0&&(f={extensions:c.join("-")}),u=v7(void 0)):u=v7(c);const g=_.getDerivedResource({url:h,templateValues:{version:o.version,z:i,x:t,y:a},queryParameters:f,headers:u,request:r}).fetchArrayBuffer();if(l(g))return g.then(function(p){return l(p)?l(e._heightmapStructure)?m_t(e,p):__t(e,p,i,t,n,o):Promise.reject(new Fe("Mesh buffer doesn't exist."))})}Object.defineProperties($y.prototype,{errorEvent:{get:function(){return this._errorEvent}},credit:{get:function(){if(!this._ready)throw new w("credit must not be called before the terrain provider is ready.");return this._credit}},tilingScheme:{get:function(){if(!this._ready)throw new w("tilingScheme must not be called before the terrain provider is ready.");return this._tilingScheme}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise}},hasWaterMask:{get:function(){if(!this._ready)throw new w("hasWaterMask must not be called before the terrain provider is ready.");return this._hasWaterMask&&this._requestWaterMask}},hasVertexNormals:{get:function(){if(!this._ready)throw new w("hasVertexNormals must not be called before the terrain provider is ready.");return this._hasVertexNormals&&this._requestVertexNormals}},hasMetadata:{get:function(){if(!this._ready)throw new w("hasMetadata must not be called before the terrain provider is ready.");return this._hasMetadata&&this._requestMetadata}},requestVertexNormals:{get:function(){return this._requestVertexNormals}},requestWaterMask:{get:function(){return this._requestWaterMask}},requestMetadata:{get:function(){return this._requestMetadata}},availability:{get:function(){if(!this._ready)throw new w("availability must not be called before the terrain provider is ready.");return this._availability}}});$y.prototype.getLevelMaximumGeometricError=function(e){return this._levelZeroMaximumGeometricError/(1<<e)};$y.prototype.getTileDataAvailable=function(e,t,n){if(!l(this._availability))return;if(n>this._availability._maximumLevel)return!1;if(this._availability.isTileAvailable(n,e,t))return!0;if(!this._hasMetadata)return!1;const i=this._layers,o=i.length;for(let r=0;r<o;++r)if(Zse(this,e,t,n,i[r],r===0).result)return;return!1};$y.prototype.loadTileDataAvailability=function(e,t,n){if(!l(this._availability)||n>this._availability._maximumLevel||this._availability.isTileAvailable(n,e,t)||!this._hasMetadata)return;const i=this._layers,o=i.length;for(let r=0;r<o;++r){const s=Zse(this,e,t,n,i[r],r===0);if(l(s.promise))return s.promise}};function D2(e,t,n,i){if(i===0)return;const o=e.availabilityLevels,r=i%o===0?i-o:(i/o|0)*o,s=1<<i-r,a=t/s|0,c=n/s|0;return{level:r,x:a,y:c}}function Zse(e,t,n,i,o,r){if(!l(o.availabilityLevels))return{result:!1};let s;const a=function(){delete o.availabilityPromiseCache[s]},c=o.availabilityTilesLoaded,u=o.availability;let f=D2(o,t,n,i);for(;l(f);){if(u.isTileAvailable(f.level,f.x,f.y)&&!c.isTileAvailable(f.level,f.x,f.y)){let h;if(!r&&(s=`${f.level}-${f.x}-${f.y}`,h=o.availabilityPromiseCache[s],!l(h))){const _=new Ad({throttle:!1,throttleByServer:!0,type:xy.TERRAIN});h=Qse(e,f.x,f.y,f.level,o,_),l(h)&&(o.availabilityPromiseCache[s]=h,h.then(a))}return{result:!0,promise:h}}f=D2(o,f.x,f.y,f.level)}return{result:!1}}$y._getAvailabilityTile=D2;function bf(e){E.typeOf.object("options",e),E.defined("options.comparator",e.comparator),l(e.maximumLength)&&E.typeOf.number.greaterThanOrEquals("options.maximumLength",e.maximumLength,0),this._comparator=e.comparator,this._maximumLength=e.maximumLength,this._array=l(e.maximumLength)?new Array(e.maximumLength):[],this._length=0}Object.defineProperties(bf.prototype,{length:{get:function(){return this._length}},maximumLength:{get:function(){return this._maximumLength},set:function(e){if(l(e)){for(E.typeOf.number.greaterThanOrEquals("maximumLength",e,0);this._length>e;)this.removeMinimum();this._array.length=e}this._maximumLength=e}},internalArray:{get:function(){return this._array}},comparator:{get:function(){return this._comparator}}});bf.prototype.clone=function(){const e=this._maximumLength,t=this._comparator,n=this._array,i=this._length,o=new bf({comparator:t,maximumLength:e});o._length=i;for(let r=0;r<i;r++)o._array[r]=n[r];return o};bf.prototype.reset=function(){this._length=0;const e=this._maximumLength;if(l(e))for(let t=0;t<e;t++)this._array[t]=void 0;else this._array.length=0};bf.prototype.resort=function(){const e=this._length;for(let t=0;t<e;t++)eae(this,t)};bf.prototype.insert=function(e){let t;const n=this._maximumLength;if(l(n)){if(n===0)return;if(this._length===n){const o=this._array[0];if(this._comparator(e,o)<=0)return e;t=this.removeMinimum()}}const i=this._length;return this._array[i]=e,this._length++,eae(this,i),t};bf.prototype.removeMinimum=function(){const e=this._length;if(e===0)return;this._length--;const t=this._array[0];return e>=2&&(this._array[0]=this._array[e-1],tae(this,0)),this._array[e-1]=void 0,t};bf.prototype.removeMaximum=function(){const e=this._length;if(e===0)return;this._length--;let t;if(e<=2)t=this._array[e-1];else{const n=sH(this,1,2)?1:2;t=this._array[n],this._array[n]=this._array[e-1],e>=4&&tae(this,n)}return this._array[e-1]=void 0,t};bf.prototype.getMinimum=function(){if(this._length!==0)return this._array[0]};bf.prototype.getMaximum=function(){const e=this._length;if(e!==0)return e<=2?this._array[e-1]:this._array[sH(this,1,2)?1:2]};function _1(e,t,n){const i=e._array,o=i[t];i[t]=i[n],i[n]=o}function aE(e,t,n){return e._comparator(e._array[t],e._array[n])<0}function sH(e,t,n){return e._comparator(e._array[t],e._array[n])>0}function eae(e,t){if(t===0)return;const n=Math.floor(F.log2(t+1))%2===0,i=Math.floor((t-1)/2),o=aE(e,t,i);for(o!==n&&(_1(e,t,i),t=i);t>=3;){const r=Math.floor((t-3)/4);if(aE(e,t,r)!==o)break;_1(e,t,r),t=r}}function tae(e,t){const n=e._length,i=Math.floor(F.log2(t+1))%2===0;let o;for(;(o=2*t+1)<n;){let r=o;const s=o+1;if(s<n){aE(e,s,r)===i&&(r=s);const a=2*o+1,c=Math.max(Math.min(n-a,4),0);for(let u=0;u<c;u++){const f=a+u;aE(e,f,r)===i&&(r=f)}}if(aE(e,r,t)===i&&(_1(e,r,t),r!==o&&r!==s)){const a=Math.floor((r-1)/2);sH(e,r,a)===i&&_1(e,r,a)}t=r}}const g_t={SEARCH:0,AUTOCOMPLETE:1},aH=Object.freeze(g_t);function cH(e){E.defined("url",e),this._url=je.createIfNeeded(e),this._url.appendForwardSlash()}Object.defineProperties(cH.prototype,{url:{get:function(){return this._url}}});cH.prototype.geocode=function(e,t){return E.typeOf.string("query",e),this._url.getDerivedResource({url:t===aH.AUTOCOMPLETE?"autocomplete":"search",queryParameters:{text:e}}).fetchJson().then(function(i){return i.features.map(function(o){let r;const s=o.bbox;if(l(s))r=Ee.fromDegrees(s[0],s[1],s[2],s[3]);else{const a=o.geometry.coordinates[0],c=o.geometry.coordinates[1];r=d.fromDegrees(a,c)}return{displayName:o.properties.label,destination:r}})})};function nae(e){e=A(e,A.EMPTY_OBJECT),E.typeOf.object("options.scene",e.scene);const t=A(e.accessToken,kg.defaultAccessToken),n=je.createIfNeeded(A(e.server,kg.defaultServer));n.appendForwardSlash();const i=kg.getDefaultTokenCredit(t);l(i)&&e.scene.frameState.creditDisplay.addDefaultCredit(Si.clone(i));const o=n.getDerivedResource({url:"v1/geocode"});l(t)&&o.appendQueryParameters({access_token:t}),this._accessToken=t,this._server=n,this._pelias=new cH(o)}nae.prototype.geocode=function(e,t){return this._pelias.geocode(e,t)};function y_t(e){return e=A(e,A.EMPTY_OBJECT),new $y({url:qs.fromAssetId(1),requestVertexNormals:A(e.requestVertexNormals,!1),requestWaterMask:A(e.requestWaterMask,!1)})}function A_t(e,t,n){const i=new Uint8ClampedArray(e.buffer),o=new ImageData(i,t,n),r=document.createElement("canvas");return r.width=t,r.height=n,r.getContext("2d").putImageData(o,0,0),r}function Fa(){this.orientedBoundingBox=new Zt,this.boundingSphere=new Ae,this.boundTransform=new N,this.shapeTransform=new N,this._minBounds=d.clone(Fa.DefaultMinBounds,new d),this._maxBounds=d.clone(Fa.DefaultMaxBounds,new d),this.shaderUniforms={boxUvToRenderBoundsTransform:new N,boxUvToRenderBoundsScale:new d,boxUvToRenderBoundsTranslate:new d,boxUvToShapeUvScale:new d,boxUvToShapeUvTranslate:new d},this.shaderDefines={BOX_INTERSECTION_INDEX:void 0,BOX_HAS_RENDER_BOUNDS:void 0,BOX_HAS_SHAPE_BOUNDS:void 0,BOX_IS_2D:void 0},this.shaderMaximumIntersectionsLength=0}const T_t=new d,I2=new d,C_t=new te,b_t=new N,E_t=new d,x_t=new d,w_t=new te,S_t=new d,v_t=new d,D_t=new d,I_t=new d,P_t=N.fromRotationTranslation(te.fromUniformScale(2,new te),new d(-1,-1,-1),new N),O_t=N.fromRotation(te.fromColumnMajorArray([0,0,1,0,1,0,1,0,0],new te),new N),L_t=N.fromRotation(te.fromColumnMajorArray([1,0,0,0,0,1,0,1,0],new te),new N);Fa.prototype.update=function(e,t,n,i,o){i=A(i,Fa.DefaultMinBounds),o=A(o,Fa.DefaultMaxBounds),E.typeOf.object("modelMatrix",e),E.typeOf.object("minBounds",t),E.typeOf.object("maxBounds",n);const r=Fa.DefaultMinBounds,s=Fa.DefaultMaxBounds;t=this._minBounds=d.clamp(t,r,s,this._minBounds),n=this._maxBounds=d.clamp(n,r,s,this._maxBounds),i=d.clamp(i,r,s,S_t),o=d.clamp(o,r,s,v_t);const a=d.clamp(t,i,o,D_t),c=d.clamp(n,i,o,I_t),u=N.getScale(e,I2);if(a.x>c.x||a.y>c.y||a.z>c.z||(a.x===c.x)+(a.y===c.y)+(a.z===c.z)>=2||i.x>o.x||i.y>o.y||i.z>o.z||u.x===0||u.y===0||u.z===0)return!1;this.shapeTransform=N.clone(e,this.shapeTransform),this.orientedBoundingBox=iae(a,c,this.shapeTransform,this.orientedBoundingBox),this.boundTransform=N.fromRotationTranslation(this.orientedBoundingBox.halfAxes,this.orientedBoundingBox.center,this.boundTransform),this.boundingSphere=Ae.fromOrientedBoundingBox(this.orientedBoundingBox,this.boundingSphere);const f=this.shaderUniforms,h=this.shaderDefines;for(const y in h)h.hasOwnProperty(y)&&(h[y]=void 0);const _=a.x!==r.x||c.x!==s.x||a.y!==r.y||c.y!==s.y||a.z!==r.z||c.z!==s.z,g=t.x!==r.x||n.x!==s.x||t.y!==r.y||n.y!==s.y||t.z!==r.z||n.z!==s.z;let p=0;if(h.BOX_INTERSECTION_INDEX=p,p+=1,_){h.BOX_HAS_RENDER_BOUNDS=!0;const y=a,T=c,b=d.fromElements(2/(y.x===T.x?1:T.x-y.x),2/(y.y===T.y?1:T.y-y.y),2/(y.z===T.z?1:T.z-y.z),x_t),x=d.fromElements(-b.x*.5*(y.x+T.x),-b.y*.5*(y.y+T.y),-b.z*.5*(y.z+T.z),E_t);let v=N.fromRotationTranslation(te.fromScale(b,w_t),x,b_t);if(y.x===T.x||y.y===T.y||y.z===T.z){h.BOX_IS_2D=!0;let D;y.x===T.x?D=O_t:y.y===T.y?D=L_t:y.z===T.z&&(D=N.IDENTITY),v=N.multiplyTransformation(D,v,v)}f.boxUvToRenderBoundsTransform=N.multiplyTransformation(v,P_t,f.boxUvToRenderBoundsTransform),f.boxUvToRenderBoundsScale=N.getScale(f.boxUvToRenderBoundsTransform,f.boxUvToRenderBoundsScale),f.boxUvToRenderBoundsTranslate=N.getTranslation(f.boxUvToRenderBoundsTransform,f.boxUvToRenderBoundsTranslate)}if(g){h.BOX_HAS_SHAPE_BOUNDS=!0;const y=t,T=n;f.boxUvToShapeUvScale=d.fromElements(2/(y.x===T.x?1:T.x-y.x),2/(y.y===T.y?1:T.y-y.y),2/(y.z===T.z?1:T.z-y.z),f.boxUvToShapeUvScale),f.boxUvToShapeUvTranslate=d.fromElements(-f.boxUvToShapeUvScale.x*(y.x*.5+.5),-f.boxUvToShapeUvScale.y*(y.y*.5+.5),-f.boxUvToShapeUvScale.z*(y.z*.5+.5),f.boxUvToShapeUvTranslate)}return this.shaderMaximumIntersectionsLength=p,!0};const B_t=new d,R_t=new d;Fa.prototype.computeOrientedBoundingBoxForTile=function(e,t,n,i,o){E.typeOf.number("tileLevel",e),E.typeOf.number("tileX",t),E.typeOf.number("tileY",n),E.typeOf.number("tileZ",i),E.typeOf.object("result",o);const r=this._minBounds,s=this._maxBounds,a=1/Math.pow(2,e),c=d.fromElements(F.lerp(r.x,s.x,a*t),F.lerp(r.y,s.y,a*n),F.lerp(r.z,s.z,a*i),B_t),u=d.fromElements(F.lerp(r.x,s.x,a*(t+1)),F.lerp(r.y,s.y,a*(n+1)),F.lerp(r.z,s.z,a*(i+1)),R_t);return iae(c,u,this.shapeTransform,o)};Fa.prototype.computeApproximateStepSize=function(e){return E.typeOf.object("dimensions",e),1/d.maximumComponent(e)};Fa.DefaultMinBounds=Object.freeze(new d(-1,-1,-1));Fa.DefaultMaxBounds=Object.freeze(new d(1,1,1));function iae(e,t,n,i){const o=Fa.DefaultMinBounds,r=Fa.DefaultMaxBounds;if(d.equals(e,o)&&d.equals(t,r))i.center=N.getTranslation(n,i.center),i.halfAxes=N.getMatrix3(n,i.halfAxes);else{let a=N.getScale(n,I2);const c=d.midpoint(e,t,T_t);i.center=N.multiplyByPoint(n,c,i.center),a=d.fromElements(a.x*.5*(t.x-e.x),a.y*.5*(t.y-e.y),a.z*.5*(t.z-e.z),I2);const u=N.getRotation(n,C_t);i.halfAxes=te.setScale(u,a,i.halfAxes)}return i}function dr(){this.orientedBoundingBox=new Zt,this.boundingSphere=new Ae,this.boundTransform=new N,this.shapeTransform=new N,this._minimumRadius=dr.DefaultMinBounds.x,this._maximumRadius=dr.DefaultMaxBounds.x,this._minimumHeight=dr.DefaultMinBounds.y,this._maximumHeight=dr.DefaultMaxBounds.y,this._minimumAngle=dr.DefaultMinBounds.z,this._maximumAngle=dr.DefaultMaxBounds.z,this.shaderUniforms={cylinderUvToRenderBoundsScale:new d,cylinderUvToRenderBoundsTranslate:new d,cylinderUvToRenderRadiusMin:0,cylinderRenderAngleMinMax:new $,cylinderUvToShapeUvRadius:new $,cylinderUvToShapeUvHeight:new $,cylinderUvToShapeUvAngle:new $,cylinderShapeUvAngleMinMax:new $,cylinderShapeUvAngleRangeZeroMid:0},this.shaderDefines={CYLINDER_HAS_RENDER_BOUNDS_RADIUS_MIN:void 0,CYLINDER_HAS_RENDER_BOUNDS_RADIUS_MAX:void 0,CYLINDER_HAS_RENDER_BOUNDS_RADIUS_FLAT:void 0,CYLINDER_HAS_RENDER_BOUNDS_HEIGHT:void 0,CYLINDER_HAS_RENDER_BOUNDS_HEIGHT_FLAT:void 0,CYLINDER_HAS_RENDER_BOUNDS_ANGLE:void 0,CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_EQUAL_ZERO:void 0,CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_UNDER_HALF:void 0,CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_EQUAL_HALF:void 0,CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_OVER_HALF:void 0,CYLINDER_HAS_SHAPE_BOUNDS_RADIUS:void 0,CYLINDER_HAS_SHAPE_BOUNDS_RADIUS_FLAT:void 0,CYLINDER_HAS_SHAPE_BOUNDS_HEIGHT:void 0,CYLINDER_HAS_SHAPE_BOUNDS_HEIGHT_FLAT:void 0,CYLINDER_HAS_SHAPE_BOUNDS_ANGLE:void 0,CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_RANGE_EQUAL_ZERO:void 0,CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MIN_DISCONTINUITY:void 0,CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MAX_DISCONTINUITY:void 0,CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MIN_MAX_REVERSED:void 0,CYLINDER_INTERSECTION_INDEX_RADIUS_MAX:void 0,CYLINDER_INTERSECTION_INDEX_RADIUS_MIN:void 0,CYLINDER_INTERSECTION_INDEX_ANGLE:void 0},this.shaderMaximumIntersectionsLength=0}const oae=new d,N_t=new d,M_t=new d,F_t=new te,z_t=new N,U_t=new N,H_t=N.fromRotationTranslation(te.fromUniformScale(2,new te),new d(-1,-1,-1),new N);dr.prototype.update=function(e,t,n,i,o){i=A(i,dr.DefaultMinBounds),o=A(o,dr.DefaultMaxBounds),E.typeOf.object("modelMatrix",e),E.typeOf.object("minBounds",t),E.typeOf.object("maxBounds",n);const r=dr.DefaultMinBounds.x,s=dr.DefaultMaxBounds.x,a=dr.DefaultMinBounds.y,c=dr.DefaultMaxBounds.y,u=dr.DefaultMinBounds.z,f=dr.DefaultMaxBounds.z,h=f-u,_=.5*h,g=F.EPSILON10,p=F.EPSILON3,y=F.EPSILON10,T=F.clamp(t.x,r,s),b=F.clamp(n.x,r,s),x=F.clamp(i.x,r,s),v=F.clamp(o.x,r,s),D=Math.max(T,x),L=Math.min(b,v),B=F.clamp(t.y,a,c),V=F.clamp(n.y,a,c),M=F.clamp(i.y,a,c),H=F.clamp(o.y,a,c),G=Math.max(B,M),I=Math.min(V,H),O=F.negativePiToPi(t.z),m=F.negativePiToPi(n.z),P=F.negativePiToPi(i.z),R=F.negativePiToPi(o.z),U=Math.max(O,P),W=Math.min(m,R),q=N.getScale(e,oae);if(L===0||D>L||G>I||F.equalsEpsilon(q.x,0,void 0,g)||F.equalsEpsilon(q.y,0,void 0,g)||F.equalsEpsilon(q.z,0,void 0,g))return!1;this._minimumRadius=T,this._maximumRadius=b,this._minimumHeight=B,this._maximumHeight=V,this._minimumAngle=O,this._maximumAngle=m,this.shapeTransform=N.clone(e,this.shapeTransform),this.orientedBoundingBox=lH(D,L,G,I,U,W,this.shapeTransform,this.orientedBoundingBox),this.boundTransform=N.fromRotationTranslation(this.orientedBoundingBox.halfAxes,this.orientedBoundingBox.center,this.boundTransform),this.boundingSphere=Ae.fromOrientedBoundingBox(this.orientedBoundingBox,this.boundingSphere);const ee=T===r&&b===s,K=B===a&&V===c,se=m<O,Q=m-O+se*h,Z=Q>_+y&&Q<h-y,J=Q>y&&Q<_-y,de=Q>=_-y&&Q<=_+y,_e=Q<=y,le=Z||J||de||_e,Te=F.equalsEpsilon(O,u,void 0,p),pe=F.equalsEpsilon(m,f,void 0,p),ne=L===s,ae=D===r,ye=G===a&&I===c,Ce=W<U,Be=W-U+Ce*h,Le=Be>_+y&&Be<h-y,Ve=Be>y&&Be<_-y,Ie=Be>=_-y&&Be<=_+y,He=Be<=y,Me=Le||Ve||Ie||He,qe=this.shaderUniforms,Ne=this.shaderDefines;for(const Qe in Ne)Ne.hasOwnProperty(Qe)&&(Ne[Qe]=void 0);let ke=0;if(Ne.CYLINDER_INTERSECTION_INDEX_RADIUS_MAX=ke,ke+=1,ae||(Ne.CYLINDER_HAS_RENDER_BOUNDS_RADIUS_MIN=!0,Ne.CYLINDER_INTERSECTION_INDEX_RADIUS_MIN=ke,ke+=1,qe.cylinderUvToRenderRadiusMin=L/D),ne||(Ne.CYLINDER_HAS_RENDER_BOUNDS_RADIUS_MAX=!0),D===L&&(Ne.CYLINDER_HAS_RENDER_BOUNDS_RADIUS_FLAT=!0),ye||(Ne.CYLINDER_HAS_RENDER_BOUNDS_HEIGHT=!0),G===I&&(Ne.CYLINDER_HAS_RENDER_BOUNDS_HEIGHT_FLAT=!0),B===V&&(Ne.CYLINDER_HAS_SHAPE_BOUNDS_HEIGHT_FLAT=!0),T===b&&(Ne.CYLINDER_HAS_SHAPE_BOUNDS_RADIUS_FLAT=!0),!ee){Ne.CYLINDER_HAS_SHAPE_BOUNDS_RADIUS=!0;const Qe=1/(b-T),Ge=T/(T-b);qe.cylinderUvToShapeUvRadius=$.fromElements(Qe,Ge,qe.cylinderUvToShapeUvRadius)}if(!K){Ne.CYLINDER_HAS_SHAPE_BOUNDS_HEIGHT=!0;const Qe=2/(V-B),Ge=(B+1)/(B-V);qe.cylinderUvToShapeUvHeight=$.fromElements(Qe,Ge,qe.cylinderUvToShapeUvHeight)}if(!ne||!ye){const Qe=.5*(I-G),Ge=d.fromElements(1/L,1/L,1/(Qe===0?1:Qe),M_t),Pt=d.fromElements(0,0,-Ge.z*.5*(G+I),N_t),Lt=N.fromRotationTranslation(te.fromScale(Ge,F_t),Pt,z_t),qt=N.multiplyTransformation(Lt,H_t,U_t);qe.cylinderUvToRenderBoundsScale=N.getScale(qt,qe.cylinderUvToRenderBoundsScale),qe.cylinderUvToRenderBoundsTranslate=N.getTranslation(qt,qe.cylinderUvToRenderBoundsTranslate)}if(se&&(Ne.CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MIN_MAX_REVERSED=!0),Me&&(Ne.CYLINDER_HAS_RENDER_BOUNDS_ANGLE=!0,Ne.CYLINDER_INTERSECTION_INDEX_ANGLE=ke,Le?(Ne.CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_UNDER_HALF=!0,ke+=1):Ve?(Ne.CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_OVER_HALF=!0,ke+=2):Ie?(Ne.CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_EQUAL_HALF=!0,ke+=1):He&&(Ne.CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_EQUAL_ZERO=!0,ke+=2),qe.cylinderRenderAngleMinMax=$.fromElements(U,W,qe.cylinderAngleMinMax)),le){Ne.CYLINDER_HAS_SHAPE_BOUNDS_ANGLE=!0,_e&&(Ne.CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_RANGE_EQUAL_ZERO=!0),Te&&(Ne.CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MIN_DISCONTINUITY=!0),pe&&(Ne.CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MAX_DISCONTINUITY=!0);const Qe=(O-u)/h,Ge=(m-u)/h,Pt=1-Q/h;qe.cylinderShapeUvAngleMinMax=$.fromElements(Qe,Ge,qe.cylinderShapeUvAngleMinMax),qe.cylinderShapeUvAngleRangeZeroMid=(Ge+.5*Pt)%1;const Lt=h/Q,qt=-(O-u)/Q;qe.cylinderUvToShapeUvAngle=$.fromElements(Lt,qt,qe.cylinderUvToShapeUvAngle)}return this.shaderMaximumIntersectionsLength=ke,!0};dr.prototype.computeOrientedBoundingBoxForTile=function(e,t,n,i,o){E.typeOf.number("tileLevel",e),E.typeOf.number("tileX",t),E.typeOf.number("tileY",n),E.typeOf.number("tileZ",i),E.typeOf.object("result",o);const r=this._minimumRadius,s=this._maximumRadius,a=this._minimumHeight,c=this._maximumHeight,u=this._minimumAngle,f=this._maximumAngle,h=1/Math.pow(2,e),_=F.lerp(r,s,t*h),g=F.lerp(r,s,(t+1)*h),p=F.lerp(a,c,n*h),y=F.lerp(a,c,(n+1)*h),T=F.lerp(u,f,i*h),b=F.lerp(u,f,(i+1)*h);return lH(_,g,p,y,T,b,this.shapeTransform,o)};const V_t=new Zt,k_t=new d,G_t=new d,W_t=new d;dr.prototype.computeApproximateStepSize=function(e){E.typeOf.object("dimensions",e);const t=this.shapeTransform,n=this._minimumRadius,i=this._maximumRadius,o=this._minimumHeight,r=this._maximumHeight,s=this._minimumAngle,a=this._maximumAngle,c=1-1/e.x,u=1-1/e.y,f=1-1/e.z,h=F.lerp(n,i,c),_=F.lerp(o,r,u),g=F.lerp(s,a,f),b=lH(h,i,_,r,g,a,t,V_t),x=te.getScale(b.halfAxes,k_t),v=N.getScale(t,G_t),D=d.divideComponents(x,v,W_t);return d.minimumComponent(D)};dr.DefaultMinBounds=Object.freeze(new d(0,-1,-F.PI));dr.DefaultMaxBounds=Object.freeze(new d(1,1,+F.PI));const q_t=5,j_t=new Array(q_t),Y_t=new d,$_t=new te,X_t=new N,K_t=new N,J_t=new N,WN=new N,Q_t=new d,Z_t=new d,egt=new d,rae=new Array(8);for(let e=0;e<8;e++)rae[e]=new d;function D7(e,t,n){return Math.abs(ue.dot(e,t))<n}function tgt(e){const t=N.getColumn(e,0,Q_t),n=N.getColumn(e,1,Z_t),i=N.getColumn(e,2,egt),o=F.EPSILON4;return D7(t,n,o)&&D7(n,i,o)}function ngt(e,t){const n=rae;d.fromElements(-.5,-.5,-.5,n[0]),d.fromElements(-.5,-.5,.5,n[1]),d.fromElements(-.5,.5,-.5,n[2]),d.fromElements(-.5,.5,.5,n[3]),d.fromElements(.5,-.5,-.5,n[4]),d.fromElements(.5,-.5,.5,n[5]),d.fromElements(.5,.5,-.5,n[6]),d.fromElements(.5,.5,.5,n[7]);for(let i=0;i<8;++i)N.multiplyByPoint(e,n[i],n[i]);return Zt.fromPoints(n,t)}function lH(e,t,n,i,o,r,s,a){const c=dr.DefaultMinBounds,u=dr.DefaultMaxBounds,f=c.x,h=u.x,_=c.y,g=u.y,p=c.z,y=u.z;if(e===f&&t===h&&n===_&&i===g&&o===p&&r===y)return a.center=N.getTranslation(s,a.center),a.halfAxes=N.getMatrix3(s,a.halfAxes),a;r<o&&(r+=F.TWO_PI);const b=r-o,x=o+b*.5,v=j_t;let D=0;v[D++]=o,v[D++]=r,v[D++]=x,b>F.PI&&(v[D++]=x-F.PI_OVER_TWO,v[D++]=x+F.PI_OVER_TWO);let L=1,B=1,V=-1,M=-1;for(let se=0;se<D;++se){const Q=v[se]-x,Z=Math.cos(Q),J=Math.sin(Q),de=Z*e,_e=J*e,le=Z*t,Te=J*t;L=Math.min(L,de),B=Math.min(B,_e),L=Math.min(L,le),B=Math.min(B,Te),V=Math.max(V,de),M=Math.max(M,_e),V=Math.max(V,le),M=Math.max(M,Te)}const H=V-L,G=M-B,I=i-n,O=(L+V)*.5,m=(B+M)*.5,P=(n+i)*.5,R=d.fromElements(O,m,P,Y_t),U=te.fromRotationZ(x,$_t),W=d.fromElements(H,G,I,oae),q=N.fromScale(W,J_t),Y=N.fromRotation(U,K_t),j=N.fromTranslation(R,X_t),ee=N.multiplyTransformation(Y,N.multiplyTransformation(j,q,WN),WN),K=N.multiplyTransformation(s,ee,WN);return tgt(K)?Zt.fromTransformation(K,a):ngt(K,a)}function Oa(){this.orientedBoundingBox=new Zt,this.boundingSphere=new Ae,this.boundTransform=new N,this.shapeTransform=new N,this._rectangle=new Ee,this._minimumHeight=Oa.DefaultMinBounds.z,this._maximumHeight=Oa.DefaultMaxBounds.z,this._ellipsoid=new be,this._translation=new d,this._rotation=new te,this.shaderUniforms={ellipsoidRadiiUv:new d,ellipsoidInverseRadiiSquaredUv:new d,ellipsoidRenderLongitudeMinMax:new $,ellipsoidShapeUvLongitudeMinMaxMid:new d,ellipsoidUvToShapeUvLongitude:new $,ellipsoidUvToShapeUvLatitude:new $,ellipsoidRenderLatitudeCosSqrHalfMinMax:new $,ellipsoidInverseHeightDifferenceUv:0,ellipseInnerRadiiUv:new $,ellipsoidInverseInnerScaleUv:0},this.shaderDefines={ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE:void 0,ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_EQUAL_ZERO:void 0,ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_UNDER_HALF:void 0,ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_EQUAL_HALF:void 0,ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_OVER_HALF:void 0,ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_MIN_DISCONTINUITY:void 0,ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_MAX_DISCONTINUITY:void 0,ELLIPSOID_HAS_SHAPE_BOUNDS_LONGITUDE:void 0,ELLIPSOID_HAS_SHAPE_BOUNDS_LONGITUDE_RANGE_EQUAL_ZERO:void 0,ELLIPSOID_HAS_SHAPE_BOUNDS_LONGITUDE_MIN_MAX_REVERSED:void 0,ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE:void 0,ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_UNDER_HALF:void 0,ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_EQUAL_HALF:void 0,ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_OVER_HALF:void 0,ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_UNDER_HALF:void 0,ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_EQUAL_HALF:void 0,ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_OVER_HALF:void 0,ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_RANGE_EQUAL_ZERO:void 0,ELLIPSOID_HAS_SHAPE_BOUNDS_LATITUDE:void 0,ELLIPSOID_HAS_SHAPE_BOUNDS_LATITUDE_RANGE_EQUAL_ZERO:void 0,ELLIPSOID_HAS_RENDER_BOUNDS_HEIGHT_MIN:void 0,ELLIPSOID_HAS_SHAPE_BOUNDS_HEIGHT_MIN:void 0,ELLIPSOID_HAS_SHAPE_BOUNDS_HEIGHT_FLAT:void 0,ELLIPSOID_IS_SPHERE:void 0,ELLIPSOID_INTERSECTION_INDEX_LONGITUDE:void 0,ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MAX:void 0,ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MIN:void 0,ELLIPSOID_INTERSECTION_INDEX_HEIGHT_MAX:void 0,ELLIPSOID_INTERSECTION_INDEX_HEIGHT_MIN:void 0},this.shaderMaximumIntersectionsLength=0}const igt=new d,ogt=new te,I7=new d,P7=new d,O7=new d,L7=new d,rgt=new Ee;Oa.prototype.update=function(e,t,n,i,o){i=A(i,Oa.DefaultMinBounds),o=A(o,Oa.DefaultMaxBounds),E.typeOf.object("modelMatrix",e),E.typeOf.object("minBounds",t),E.typeOf.object("maxBounds",n);const r=Oa.DefaultMinBounds.x,s=Oa.DefaultMaxBounds.x,a=s-r,c=.5*a,u=Oa.DefaultMinBounds.y,f=Oa.DefaultMaxBounds.y,h=f-u,_=F.EPSILON10,g=F.EPSILON3,p=F.EPSILON10,y=F.EPSILON10,T=F.EPSILON3,b=F.clamp(t.x,r,s),x=F.clamp(n.x,r,s),v=F.clamp(i.x,r,s),D=F.clamp(o.x,r,s),L=Math.max(b,v),B=Math.min(x,D),V=F.clamp(t.y,u,f),M=F.clamp(n.y,u,f),H=F.clamp(i.y,u,f),G=F.clamp(o.y,u,f),I=Math.max(V,H),O=Math.min(M,G),m=N.getScale(e,igt),P=m.x===m.y&&m.y===m.z,R=d.minimumComponent(m),U=Math.max(t.z,-R),W=Math.max(n.z,-R),q=Math.max(i.z,-R),Y=Math.max(o.z,-R),j=Math.max(U,q),ee=Math.min(W,Y),K=d.add(m,d.fromElements(U,U,U,P7),P7),se=d.add(m,d.fromElements(W,W,W,I7),I7),Q=d.maximumComponent(se),Z=d.add(m,d.fromElements(j,j,j,L7),L7),J=d.add(m,d.fromElements(ee,ee,ee,O7),O7),de=d.maximumComponent(J);if(I>O||I===f||O===u||j>ee||F.equalsEpsilon(J,d.ZERO,void 0,_))return!1;this._rectangle=Ee.fromRadians(b,V,x,M),this._translation=N.getTranslation(e,this._translation),this._rotation=N.getRotation(e,this._rotation),this._ellipsoid=be.fromCartesian3(m,this._ellipsoid),this._minimumHeight=U,this._maximumHeight=W;const _e=Ee.fromRadians(L,I,B,O,rgt);this.orientedBoundingBox=sae(_e,j,ee,this._ellipsoid,this._translation,this._rotation,this.orientedBoundingBox),this.shapeTransform=N.fromRotationTranslation(te.setScale(this._rotation,J,ogt),this._translation,this.shapeTransform),this.boundTransform=N.fromRotationTranslation(this.orientedBoundingBox.halfAxes,this.orientedBoundingBox.center,this.boundTransform),this.boundingSphere=Ae.fromOrientedBoundingBox(this.orientedBoundingBox,this.boundingSphere);const le=B<L,Te=B-L+le*a,pe=Te<=p,ne=Te>c+p&&Te<a-p,ae=Te>=c-p&&Te<=c+p,ye=Te>p&&Te<c-p,Ce=pe||ne||ae||ye,Be=B<L,Le=x-b+Be*a,Ve=Le<=p,Ie=Le>c+p&&Le<a-p,He=Le>=c-p&&Le<=c+p,Me=Le>p&&Le<c-p,qe=Ve||Ie||He||Me,Ne=O<-T,ke=O>=-T&&O<=+T,Qe=O>+T&&O<f-y,Ge=Ne||ke||Qe,Pt=I>u+y&&I<-T,Lt=I>=-T&&I<=+T,qt=I>+T,zn=Pt||Lt||qt,Gn=Ge||zn,Dn=M-V,hn=M<-T,jt=M>=-T&&M<=+T,In=M>+T&&M<f-y,Rn=hn||jt||In,Jt=V>u+y&&V<-T,ln=V>=-T&&V<=+T,ei=V>+T,pn=Rn||(Jt||ln||ei),Fi=!d.equals(Z,d.ZERO),Co=!d.equals(J,d.ZERO),Xi=Fi||Co,gi=ee-j,wn=!d.equals(K,d.ZERO),ti=!d.equals(se,d.ZERO),Jn=wn||ti,Tn=this.shaderUniforms,Rt=this.shaderDefines;for(const qn in Rt)Rt.hasOwnProperty(qn)&&(Rt[qn]=void 0);Tn.ellipsoidRadiiUv=d.divideByScalar(se,Q,Tn.ellipsoidRadiiUv),Tn.ellipsoidInverseRadiiSquaredUv=d.divideComponents(d.ONE,d.multiplyComponents(Tn.ellipsoidRadiiUv,Tn.ellipsoidRadiiUv,Tn.ellipsoidInverseRadiiSquaredUv),Tn.ellipsoidInverseRadiiSquaredUv);let et=0;if(Rt.ELLIPSOID_INTERSECTION_INDEX_HEIGHT_MAX=et,et+=1,Xi&&(gi===0&&(Rt.ELLIPSOID_HAS_RENDER_BOUNDS_HEIGHT_FLAT=!0),Fi&&(Rt.ELLIPSOID_HAS_RENDER_BOUNDS_HEIGHT_MIN=!0,Rt.ELLIPSOID_INTERSECTION_INDEX_HEIGHT_MIN=et,et+=1,Tn.ellipsoidInverseInnerScaleUv=de/(de-gi))),Jn){if(wn){Rt.ELLIPSOID_HAS_SHAPE_BOUNDS_HEIGHT_MIN=!0;const qn=(W-U)/Q;Tn.ellipsoidInverseHeightDifferenceUv=1/qn,Tn.ellipseInnerRadiiUv=$.fromElements(Tn.ellipsoidRadiiUv.x*(1-qn),Tn.ellipsoidRadiiUv.z*(1-qn),Tn.ellipseInnerRadiiUv)}U===W&&(Rt.ELLIPSOID_HAS_SHAPE_BOUNDS_HEIGHT_FLAT=!0)}if(Ce&&(Rt.ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE=!0,Rt.ELLIPSOID_INTERSECTION_INDEX_LONGITUDE=et,ne?(Rt.ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_UNDER_HALF=!0,et+=1):ye?(Rt.ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_OVER_HALF=!0,et+=2):ae?(Rt.ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_EQUAL_HALF=!0,et+=1):pe&&(Rt.ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_EQUAL_ZERO=!0,et+=2),Tn.ellipsoidRenderLongitudeMinMax=$.fromElements(L,B,Tn.ellipsoidRenderLongitudeMinMax)),qe){Rt.ELLIPSOID_HAS_SHAPE_BOUNDS_LONGITUDE=!0,x<b&&(Rt.ELLIPSOID_HAS_SHAPE_BOUNDS_LONGITUDE_MIN_MAX_REVERSED=!0);const Sn=a/Le,oo=-(b-r)/Le;Tn.ellipsoidUvToShapeUvLongitude=$.fromElements(Sn,oo,Tn.ellipsoidUvToShapeUvLongitude)}if(Ce){const qn=F.equalsEpsilon(L,r,void 0,g),Sn=F.equalsEpsilon(B,s,void 0,g);qn&&(Rt.ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_MIN_DISCONTINUITY=!0),Sn&&(Rt.ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_MAX_DISCONTINUITY=!0);const oo=(b-r)/a,jn=(x-r)/a,Ki=(B-r)/a,zo=1-Te/a,So=(Ki+.5*zo)%1;Tn.ellipsoidShapeUvLongitudeMinMaxMid=d.fromElements(oo,jn,So,Tn.ellipsoidShapeUvLongitudeMinMaxMid)}if(Gn){Rt.ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE=!0,zn&&(Rt.ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN=!0,Rt.ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MIN=et,Pt?(Rt.ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_UNDER_HALF=!0,et+=1):Lt?(Rt.ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_EQUAL_HALF=!0,et+=1):qt&&(Rt.ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_OVER_HALF=!0,et+=2)),Ge&&(Rt.ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX=!0,Rt.ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MAX=et,Ne?(Rt.ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_UNDER_HALF=!0,et+=2):ke?(Rt.ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_EQUAL_HALF=!0,et+=1):Qe&&(Rt.ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_OVER_HALF=!0,et+=1)),I===O&&(Rt.ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_RANGE_EQUAL_ZERO=!0);const qn=Math.pow(Math.cos(F.PI_OVER_TWO-Math.abs(I)),2),Sn=Math.pow(Math.cos(F.PI_OVER_TWO-Math.abs(O)),2);Tn.ellipsoidRenderLatitudeCosSqrHalfMinMax=$.fromElements(qn,Sn,Tn.ellipsoidRenderLatitudeCosSqrHalfMinMax)}if(pn){Rt.ELLIPSOID_HAS_SHAPE_BOUNDS_LATITUDE=!0,V===M&&(Rt.ELLIPSOID_HAS_SHAPE_BOUNDS_LATITUDE_RANGE_EQUAL_ZERO=!0);const qn=h/Dn,Sn=(u-V)/Dn;Tn.ellipsoidUvToShapeUvLatitude=$.fromElements(qn,Sn,Tn.ellipsoidUvToShapeUvLatitude)}return P&&(Rt.ELLIPSOID_IS_SPHERE=!0),this.shaderMaximumIntersectionsLength=et,!0};const sgt=new Ee;Oa.prototype.computeOrientedBoundingBoxForTile=function(e,t,n,i,o){E.typeOf.number("tileLevel",e),E.typeOf.number("tileX",t),E.typeOf.number("tileY",n),E.typeOf.number("tileZ",i),E.typeOf.object("result",o);const r=1/Math.pow(2,e),s=t*r,a=(t+1)*r,c=n*r,u=(n+1)*r,f=i*r,h=(i+1)*r,_=Ee.subsection(this._rectangle,s,c,a,u,sgt),g=F.lerp(this._minimumHeight,this._maximumHeight,f),p=F.lerp(this._minimumHeight,this._maximumHeight,h);return sae(_,g,p,this._ellipsoid,this._translation,this._rotation,o)};Oa.prototype.computeApproximateStepSize=function(e){E.typeOf.object("dimensions",e);const n=this._ellipsoid.maximumRadius,i=this._minimumHeight,o=this._maximumHeight;return .5*((o-i)/(n+o))/e.z};function sae(e,t,n,i,o,r,s){return s=Zt.fromRectangle(e,t,n,i,s),s.center=d.add(s.center,o,s.center),s.halfAxes=te.multiply(s.halfAxes,r,s.halfAxes),s}Oa.DefaultMinBounds=Object.freeze(new d(-F.PI,-F.PI_OVER_TWO,-Number.MAX_VALUE));Oa.DefaultMaxBounds=Object.freeze(new d(+F.PI,+F.PI_OVER_TWO,+Number.MAX_VALUE));const ol={BOX:"BOX",ELLIPSOID:"ELLIPSOID",CYLINDER:"CYLINDER"};ol.getMinBounds=function(e){switch(e){case ol.BOX:return Fa.DefaultMinBounds;case ol.ELLIPSOID:return Oa.DefaultMinBounds;case ol.CYLINDER:return dr.DefaultMinBounds;default:throw new w(`Invalid shape type ${e}`)}};ol.getMaxBounds=function(e){switch(e){case ol.BOX:return Fa.DefaultMaxBounds;case ol.ELLIPSOID:return Oa.DefaultMaxBounds;case ol.CYLINDER:return dr.DefaultMaxBounds;default:throw new w(`Invalid shape type ${e}`)}};ol.getShapeConstructor=function(e){switch(e){case ol.BOX:return Fa;case ol.ELLIPSOID:return Oa;case ol.CYLINDER:return dr;default:throw new w(`Invalid shape type ${e}`)}};const lA=Object.freeze(ol),aae=Object.freeze({UNLOADED:0,RECEIVING:1,RECEIVED:2,LOADED:3,FAILED:4,UNAVAILABLE:5});function Zi(e,t){this.spatialNode=e,this.keyframe=t,this.state=aae.UNLOADED,this.metadatas=[],this.megatextureIndex=-1,this.priority=-Number.MAX_VALUE,this.highPriorityFrameNumber=-1}Zi.priorityComparator=function(e,t){return e.priority-t.priority};Zi.searchComparator=function(e,t){return e.keyframe-t.keyframe};Zi.LoadState=aae;function vp(e,t,n,i,o){i===an.UNSIGNED_SHORT&&(i=an.FLOAT32);const r=e.floatingPointTexture;if(i===an.FLOAT32&&!r)throw new Fe("Floating point texture not supported");let s;i===an.FLOAT32||i===an.FLOAT64?s=ft.FLOAT:i===an.UINT8&&(s=ft.UNSIGNED_BYTE);let a;n===1?a=yt.LUMINANCE:n===2?a=yt.LUMINANCE_ALPHA:n===3?a=yt.RGB:n===4&&(a=yt.RGBA);const c=512*1024*1024,u=128*1024*1024;o=Math.min(A(o,u),c);const f=Gt.maximumTextureSize,h=an.getSizeInBytes(i),_=Math.floor(o/(n*h)),g=Math.min(f,F.previousPowerOfTwo(Math.floor(Math.sqrt(_)))),p=Math.ceil(Math.sqrt(t.x)),y=Math.ceil(t.z/p),T=p*t.x,b=y*t.y,x=Math.floor(g/T),v=Math.floor(g/b);if(x===0||v===0)throw new Fe("Tileset is too large to fit into megatexture");this.channelCount=n,this.componentType=i,this.voxelCountPerTile=d.clone(t,new d),this.maximumTileCount=x*v,this.regionCountPerMegatexture=new $(x,v),this.voxelCountPerRegion=new $(T,b),this.sliceCountPerRegion=new $(p,y),this.voxelSizeUv=new $(1/g,1/g),this.sliceSizeUv=new $(t.x/g,t.y/g),this.regionSizeUv=new $(T/g,b/g),this.texture=new rn({context:e,pixelFormat:a,pixelDatatype:s,flipY:!1,width:g,height:g,sampler:new Ci({wrapS:io.CLAMP_TO_EDGE,wrapT:io.CLAMP_TO_EDGE,minificationFilter:Wn.LINEAR,magnificationFilter:Ps.LINEAR})});const D=an.toComponentDatatype(i);this.tileVoxelDataTemp=oe.createTypedArray(D,T*b*n),this.nodes=new Array(this.maximumTileCount);for(let L=0;L<this.maximumTileCount;L++)this.nodes[L]=new agt(L);for(let L=0;L<this.maximumTileCount;L++){const B=this.nodes[L];B.previousNode=L>0?this.nodes[L-1]:void 0,B.nextNode=L<this.maximumTileCount-1?this.nodes[L+1]:void 0}this.occupiedList=void 0,this.emptyList=this.nodes[0],this.occupiedCount=0}function agt(e){this.index=e,this.nextNode=void 0,this.previousNode=void 0}vp.prototype.add=function(e){if(this.isFull())throw new w("Trying to add when there are no empty spots");const t=this.emptyList;this.emptyList=this.emptyList.nextNode,l(this.emptyList)&&(this.emptyList.previousNode=void 0),t.nextNode=this.occupiedList,l(t.nextNode)&&(t.nextNode.previousNode=t),this.occupiedList=t;const n=t.index;return this.writeDataToTexture(n,e),this.occupiedCount++,n};vp.prototype.remove=function(e){if(e<0||e>=this.maximumTileCount)throw new w("Megatexture index out of bounds");const t=this.nodes[e];l(t.previousNode)&&(t.previousNode.nextNode=t.nextNode),l(t.nextNode)&&(t.nextNode.previousNode=t.previousNode),t.nextNode=this.emptyList,l(t.nextNode)&&(t.nextNode.previousNode=t),t.previousNode=void 0,this.emptyList=t,this.occupiedCount--};vp.prototype.isFull=function(){return this.emptyList===void 0};vp.getApproximateTextureMemoryByteLength=function(e,t,n,i){i===an.UNSIGNED_SHORT&&(i=an.FLOAT32);const o=an.getSizeInBytes(i),r=e*t.x*t.y*t.z,s=Math.ceil(Math.sqrt(t.z)),a=Math.ceil(t.z/s),c=s*t.x,u=a*t.y;let f=F.previousPowerOfTwo(Math.floor(Math.sqrt(r)));for(;;){const _=Math.floor(f/c),g=Math.floor(f/u);if(_*g>=e)break;f*=2}return f*f*n*o};vp.prototype.writeDataToTexture=function(e,t){const n=t.constructor===Uint16Array?new Float32Array(t):t,i=this.voxelCountPerTile,o=this.sliceCountPerRegion,r=this.voxelCountPerRegion,s=this.channelCount,a=this.tileVoxelDataTemp;for(let y=0;y<i.z;y++){const T=y%o.x*i.x,b=Math.floor(y/o.x)*i.y;for(let x=0;x<i.y;x++)for(let v=0;v<i.x;v++){const D=y*i.y*i.x+x*i.x+v,L=(b+x)*r.x+(T+v);for(let B=0;B<s;B++)a[L*s+B]=n[D*s+B]}}const c=this.regionCountPerMegatexture,u=r.x,f=r.y,h=e%c.x*r.x,_=Math.floor(e/c.x)*r.y,p={source:{arrayBufferView:a,width:u,height:f},xOffset:h,yOffset:_};this.texture.copyFrom(p)};vp.prototype.isDestroyed=function(){return!1};vp.prototype.destroy=function(){return this.texture=this.texture&&this.texture.destroy(),Je(this)};const cgt=new Si("MapQuest, Open Street Map and contributors, CC-BY-SA");function HA(e){e=A(e,A.EMPTY_OBJECT);const t=je.createIfNeeded(A(e.url,"https://a.tile.openstreetmap.org/"));t.appendForwardSlash(),t.url+=`{z}/{x}/{y}.${A(e.fileExtension,"png")}`;const n=new Za({ellipsoid:e.ellipsoid}),i=256,o=256,r=A(e.minimumLevel,0),s=e.maximumLevel,a=A(e.rectangle,n.rectangle),c=n.positionToTileXY(Ee.southwest(a),r),u=n.positionToTileXY(Ee.northeast(a),r),f=(Math.abs(u.x-c.x)+1)*(Math.abs(u.y-c.y)+1);if(f>4)throw new w(`The rectangle and minimumLevel indicate that there are ${f} tiles at the minimum level. Imagery providers with more than four tiles at the minimum level are not supported.`);let h=A(e.credit,cgt);typeof h=="string"&&(h=new Si(h)),bu.call(this,{url:t,credit:h,tilingScheme:n,tileWidth:i,tileHeight:o,minimumLevel:r,maximumLevel:s,rectangle:a})}l(Object.create)&&(HA.prototype=Object.create(bu.prototype),HA.prototype.constructor=HA);function lgt(e,t,n){return E.typeOf.string("samplerUniformName",e),E.typeOf.string("matrixUniformName",t),E.typeOf.string("styleUniformName",n),` float clipDistance = clip(gl_FragCoord, ${e}, ${t});
|
||
vec4 clippingPlanesEdgeColor = vec4(1.0);
|
||
clippingPlanesEdgeColor.rgb = ${n}.rgb;
|
||
float clippingPlanesEdgeWidth = ${n}.a;
|
||
if (clipDistance > 0.0 && clipDistance < clippingPlanesEdgeWidth)
|
||
{
|
||
gl_FragColor = clippingPlanesEdgeColor;
|
||
}
|
||
`}const ugt={modifyFragmentShader:function(t){return t=nt.replaceMain(t,"czm_splitter_main"),t+=`uniform float czm_splitDirection;
|
||
void main()
|
||
{
|
||
#ifndef SHADOW_MAP
|
||
if (czm_splitDirection < 0.0 && gl_FragCoord.x > czm_splitPosition) discard;
|
||
if (czm_splitDirection > 0.0 && gl_FragCoord.x < czm_splitPosition) discard;
|
||
#endif
|
||
czm_splitter_main();
|
||
}
|
||
`,t},addUniforms:function(t,n){n.czm_splitDirection=function(){return t.splitDirection}}},cae=ugt,Pg={NEEDS_DECODE:0,DECODING:1,READY:2,FAILED:3};function Zx(e){E.typeOf.object("options",e),E.typeOf.object("options.arrayBuffer",e.arrayBuffer),this._parsedContent=void 0,this._drawCommand=void 0,this._isTranslucent=!1,this._styleTranslucent=!1,this._constantColor=k.clone(k.DARKGRAY),this._highlightColor=k.clone(k.WHITE),this._pointSize=1,this._rtcCenter=void 0,this._quantizedVolumeScale=void 0,this._quantizedVolumeOffset=void 0,this._styleableShaderAttributes=void 0,this._isQuantized=!1,this._isOctEncoded16P=!1,this._isRGB565=!1,this._hasColors=!1,this._hasNormals=!1,this._hasBatchIds=!1,this._decodingState=Pg.READY,this._dequantizeInShader=!0,this._isQuantizedDraco=!1,this._isOctEncodedDraco=!1,this._quantizedRange=0,this._octEncodedRange=0,this.backFaceCulling=!1,this._backFaceCulling=!1,this.normalShading=!0,this._normalShading=!0,this._opaqueRenderState=void 0,this._translucentRenderState=void 0,this._mode=void 0,this._ready=!1,this._pointsLength=0,this._geometryByteLength=0,this._vertexShaderLoaded=e.vertexShaderLoaded,this._fragmentShaderLoaded=e.fragmentShaderLoaded,this._uniformMapLoaded=e.uniformMapLoaded,this._batchTableLoaded=e.batchTableLoaded,this._pickIdLoaded=e.pickIdLoaded,this._opaquePass=A(e.opaquePass,We.OPAQUE),this._cull=A(e.cull,!0),this.style=void 0,this._style=void 0,this.styleDirty=!1,this.modelMatrix=N.clone(N.IDENTITY),this._modelMatrix=N.clone(N.IDENTITY),this.time=0,this.shadows=sr.ENABLED,this._boundingSphere=void 0,this.clippingPlanes=void 0,this.isClipped=!1,this.clippingPlanesDirty=!1,this.clippingPlanesOriginMatrix=void 0,this.attenuation=!1,this._attenuation=!1,this.geometricError=0,this.geometricErrorScale=1,this.maximumAttenuation=this._pointSize,this.splitDirection=A(e.splitDirection,Py.NONE),this._splittingEnabled=!1,this._resolveReadyPromise=void 0,this._rejectReadyPromise=void 0,this._readyPromise=fgt(this,e)}Object.defineProperties(Zx.prototype,{pointsLength:{get:function(){return this._pointsLength}},geometryByteLength:{get:function(){return this._geometryByteLength}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise}},color:{get:function(){return k.clone(this._highlightColor)},set:function(e){this._highlightColor=k.clone(e,this._highlightColor)}},boundingSphere:{get:function(){if(l(this._drawCommand))return this._drawCommand.boundingVolume},set:function(e){this._boundingSphere=Ae.clone(e,this._boundingSphere)}}});function fgt(e,t){const n=zie.parse(t.arrayBuffer,t.byteOffset);if(e._parsedContent=n,e._rtcCenter=n.rtcCenter,e._hasNormals=n.hasNormals,e._hasColors=n.hasColors,e._hasBatchIds=n.hasBatchIds,e._isTranslucent=n.isTranslucent,!n.hasBatchIds&&l(n.batchTableBinary)&&(n.styleableProperties=$i.getBinaryProperties(n.pointsLength,n.batchTableJson,n.batchTableBinary)),l(n.draco)){const a=n.draco;e._decodingState=Pg.NEEDS_DECODE,a.dequantizeInShader=e._dequantizeInShader}const i=n.positions;l(i)&&(e._isQuantized=i.isQuantized,e._quantizedVolumeScale=i.quantizedVolumeScale,e._quantizedVolumeOffset=i.quantizedVolumeOffset,e._quantizedRange=i.quantizedRange);const o=n.normals;l(o)&&(e._isOctEncoded16P=o.octEncoded);const r=n.colors;l(r)&&(l(r.constantColor)&&(e._constantColor=k.clone(r.constantColor,e._constantColor),e._hasColors=!1),e._isRGB565=r.isRGB565);const s=n.batchIds;return l(n.batchIds)&&(s.name="BATCH_ID",s.semantic="BATCH_ID",s.setIndex=void 0),n.hasBatchIds&&e._batchTableLoaded(n.batchLength,n.batchTableJson,n.batchTableBinary),e._pointsLength=n.pointsLength,new Promise(function(a,c){e._resolveReadyPromise=function(){e._ready=!0,a(e)},e._rejectReadyPromise=c})}const dgt=new d,hgt=new d,pgt=new d;let B7,rD;function mgt(e){if(!l(rD)){B7=new V1(0),rD=new Array(e);for(let t=0;t<e;++t)rD[t]=B7.random()}return rD}function _gt(e){const n=e.length/3,i=Math.min(n,20),o=mgt(20),r=Number.MAX_VALUE,s=-Number.MAX_VALUE,a=d.fromElements(r,r,r,dgt),c=d.fromElements(s,s,s,hgt);for(let f=0;f<i;++f){const h=Math.floor(o[f]*n),_=d.unpack(e,h*3,pgt);d.minimumByComponent(a,_,a),d.maximumByComponent(c,_,c)}const u=Ae.fromCornerPoints(a,c);return u.radius+=F.EPSILON2,u}function R7(e,t){const n=oe.fromTypedArray(e);return n===oe.INT||n===oe.UNSIGNED_INT||n===oe.DOUBLE?(uo("Cast pnts property to floats",`Point cloud property "${t}" will be cast to a float array because INT, UNSIGNED_INT, and DOUBLE are not valid WebGL vertex attribute types. Some precision may be lost.`),new Float32Array(e)):e}const ggt=new ue,ygt=new ue,Agt=new k,lae=0,g1=1,P2=2,uae=3,Tgt=4,qN=new N,Cgt=new N;function bgt(e,t){const n=t.context,i=e._parsedContent,o=e._pointsLength,r=i.positions,s=i.colors,a=i.normals,c=i.batchIds,u=i.styleableProperties,f=l(u),h=e._isQuantized,_=e._isQuantizedDraco,g=e._isOctEncoded16P,p=e._isOctEncodedDraco,y=e._quantizedRange,T=e._octEncodedRange,b=e._isRGB565,x=e._isTranslucent,v=e._hasColors,D=e._hasNormals,L=e._hasBatchIds;let B,V;const M=[],H={};if(e._styleableShaderAttributes=H,f){let q=Tgt;for(const Y in u)if(u.hasOwnProperty(Y)){const j=u[Y],ee=R7(j.typedArray,Y);B=j.componentCount,V=oe.fromTypedArray(ee);const K=Mt.createVertexBuffer({context:n,typedArray:ee,usage:mt.STATIC_DRAW});e._geometryByteLength+=K.sizeInBytes;const se={index:q,vertexBuffer:K,componentsPerAttribute:B,componentDatatype:V,normalize:!1,offsetInBytes:0,strideInBytes:0};M.push(se),H[Y]={location:q,componentCount:B},++q}}const G=Mt.createVertexBuffer({context:n,typedArray:r.typedArray,usage:mt.STATIC_DRAW});e._geometryByteLength+=G.sizeInBytes;let I;v&&(I=Mt.createVertexBuffer({context:n,typedArray:s.typedArray,usage:mt.STATIC_DRAW}),e._geometryByteLength+=I.sizeInBytes);let O;D&&(O=Mt.createVertexBuffer({context:n,typedArray:a.typedArray,usage:mt.STATIC_DRAW}),e._geometryByteLength+=O.sizeInBytes);let m;L&&(c.typedArray=R7(c.typedArray,"batchIds"),m=Mt.createVertexBuffer({context:n,typedArray:c.typedArray,usage:mt.STATIC_DRAW}),e._geometryByteLength+=m.sizeInBytes);let P=[];if(h?V=oe.UNSIGNED_SHORT:_?V=y<=255?oe.UNSIGNED_BYTE:oe.UNSIGNED_SHORT:V=oe.FLOAT,P.push({index:lae,vertexBuffer:G,componentsPerAttribute:3,componentDatatype:V,normalize:!1,offsetInBytes:0,strideInBytes:0}),e._cull&&(h||_?e._boundingSphere=Ae.fromCornerPoints(d.ZERO,e._quantizedVolumeScale):e._boundingSphere=_gt(r.typedArray)),v)if(b)P.push({index:g1,vertexBuffer:I,componentsPerAttribute:1,componentDatatype:oe.UNSIGNED_SHORT,normalize:!1,offsetInBytes:0,strideInBytes:0});else{const q=x?4:3;P.push({index:g1,vertexBuffer:I,componentsPerAttribute:q,componentDatatype:oe.UNSIGNED_BYTE,normalize:!0,offsetInBytes:0,strideInBytes:0})}D&&(g?(B=2,V=oe.UNSIGNED_BYTE):p?(B=2,V=T<=255?oe.UNSIGNED_BYTE:oe.UNSIGNED_SHORT):(B=3,V=oe.FLOAT),P.push({index:P2,vertexBuffer:O,componentsPerAttribute:B,componentDatatype:V,normalize:!1,offsetInBytes:0,strideInBytes:0})),L&&P.push({index:uae,vertexBuffer:m,componentsPerAttribute:1,componentDatatype:oe.fromTypedArray(c.typedArray),normalize:!1,offsetInBytes:0,strideInBytes:0}),f&&(P=P.concat(M));const R=new Fo({context:n,attributes:P}),U={depthTest:{enabled:!0}},W={depthTest:{enabled:!0},depthMask:!1,blending:fo.ALPHA_BLEND};e._opaquePass===We.CESIUM_3D_TILE&&(U.stencilTest=Kt.setCesium3DTileBit(),U.stencilMask=Kt.CESIUM_3D_TILE_MASK,W.stencilTest=Kt.setCesium3DTileBit(),W.stencilMask=Kt.CESIUM_3D_TILE_MASK),e._opaqueRenderState=ht.fromCache(U),e._translucentRenderState=ht.fromCache(W),e._drawCommand=new Dt({boundingVolume:new Ae,cull:e._cull,modelMatrix:new N,primitiveType:dt.POINTS,vertexArray:R,count:o,shaderProgram:void 0,uniformMap:void 0,renderState:x?e._translucentRenderState:e._opaqueRenderState,pass:x?We.TRANSLUCENT:e._opaquePass,owner:e,castShadows:!1,receiveShadows:!1,pickId:e._pickIdLoaded()})}function Egt(e,t){const n=t.context,i=e._isQuantized,o=e._isQuantizedDraco,r=e._isOctEncodedDraco;let s={u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier:function(){const a=ggt;if(a.x=e._attenuation?e.maximumAttenuation:e._pointSize,a.x*=t.pixelRatio,a.y=e.time,e._attenuation){const c=t.camera.frustum;let u;t.mode===me.SCENE2D||c instanceof nn?u=Number.POSITIVE_INFINITY:u=n.drawingBufferHeight/t.camera.frustum.sseDenominator,a.z=e.geometricError*e.geometricErrorScale,a.w=u}return a},u_highlightColor:function(){return e._highlightColor},u_constantColor:function(){return e._constantColor},u_clippingPlanes:function(){const a=e.clippingPlanes;return e.isClipped?a.texture:n.defaultTexture},u_clippingPlanesEdgeStyle:function(){const a=e.clippingPlanes;if(!l(a))return k.TRANSPARENT;const c=k.clone(a.edgeColor,Agt);return c.alpha=a.edgeWidth,c},u_clippingPlanesMatrix:function(){const a=e.clippingPlanes;if(!l(a))return N.IDENTITY;const c=A(e.clippingPlanesOriginMatrix,e._modelMatrix);N.multiply(n.uniformState.view3D,c,qN);const u=N.multiply(qN,a.modelMatrix,qN);return N.inverseTranspose(u,Cgt)}};cae.addUniforms(e,s),(i||o||r)&&(s=Ln(s,{u_quantizedVolumeScaleAndOctEncodedRange:function(){const a=ygt;if(l(e._quantizedVolumeScale)){const c=d.clone(e._quantizedVolumeScale,a);d.divideByScalar(c,e._quantizedRange,a)}return a.w=e._octEncodedRange,a}})),l(e._uniformMapLoaded)&&(s=e._uniformMapLoaded(s)),e._drawCommand.uniformMap=s}function jN(e,t){const n=/czm_3dtiles_property_(\d+)/g;let i=n.exec(e);for(;i!==null;){const o=parseInt(i[1]);t.indexOf(o)===-1&&t.push(o),i=n.exec(e)}}function YN(e,t){e=e.slice(e.indexOf(`
|
||
`));const n=/czm_3dtiles_builtin_property_(\w+)/g;let i=n.exec(e);for(;i!==null;){const o=i[1];t.indexOf(o)===-1&&t.push(o),i=n.exec(e)}}function $N(e,t){const n=e.numberOfAttributes;for(let i=0;i<n;++i){const o=e.getAttribute(i);if(o.index===t)return o}}const xgt={POSITION:"czm_3dtiles_builtin_property_POSITION",POSITION_ABSOLUTE:"czm_3dtiles_builtin_property_POSITION_ABSOLUTE",COLOR:"czm_3dtiles_builtin_property_COLOR",NORMAL:"czm_3dtiles_builtin_property_NORMAL"};function wgt(e,t,n){let i,o,r;const s=t.context,a=l(n),c=e._isQuantized,u=e._isQuantizedDraco,f=e._isOctEncoded16P,h=e._isOctEncodedDraco,_=e._isRGB565,g=e._isTranslucent,p=e._hasColors,y=e._hasNormals,T=e._hasBatchIds,b=e._backFaceCulling,x=e._normalShading,v=e._drawCommand.vertexArray,D=e.clippingPlanes,L=e._attenuation;let B,V,M,H=g;const G=St(xgt),I={},O=e._styleableShaderAttributes;for(o in O)O.hasOwnProperty(o)&&(r=O[o],G[o]=`czm_3dtiles_property_${r.location}`,I[r.location]=r);if(a){const le={translucent:!1},Te="(vec3 czm_3dtiles_builtin_property_POSITION, vec3 czm_3dtiles_builtin_property_POSITION_ABSOLUTE, vec4 czm_3dtiles_builtin_property_COLOR, vec3 czm_3dtiles_builtin_property_NORMAL)";B=n.getColorShaderFunction(`getColorFromStyle${Te}`,G,le),V=n.getShowShaderFunction(`getShowFromStyle${Te}`,G,le),M=n.getPointSizeShaderFunction(`getPointSizeFromStyle${Te}`,G,le),l(B)&&le.translucent&&(H=!0)}e._styleTranslucent=H;const m=l(B),P=l(V),R=l(M),U=e.isClipped,W=[],q=[];m&&(jN(B,W),YN(B,q)),P&&(jN(V,W),YN(V,q)),R&&(jN(M,W),YN(M,q));const Y=q.indexOf("COLOR")>=0,j=q.indexOf("NORMAL")>=0;if(j&&!y)throw new Fe("Style references the NORMAL semantic but the point cloud does not have normals");for(o in O)if(O.hasOwnProperty(o)){r=O[o];const le=W.indexOf(r.location)>=0,Te=$N(v,r.location);Te.enabled=le}const ee=p&&(!m||Y);if(p){const le=$N(v,g1);le.enabled=ee}const K=y&&(x||b||j);if(y){const le=$N(v,P2);le.enabled=K}const se={a_position:lae};ee&&(se.a_color=g1),K&&(se.a_normal=P2),T&&(se.a_batchId=uae);let Q="";const Z=W.length;for(i=0;i<Z;++i){const le=W[i];r=I[le];const Te=r.componentCount,pe=`czm_3dtiles_property_${le}`;let ne;Te===1?ne="float":ne=`vec${Te}`,Q+=`attribute ${ne} ${pe};
|
||
`,se[pe]=r.location}Egt(e,t);let J=`attribute vec3 a_position;
|
||
varying vec4 v_color;
|
||
uniform vec4 u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier;
|
||
uniform vec4 u_constantColor;
|
||
uniform vec4 u_highlightColor;
|
||
`;J+=`float u_pointSize;
|
||
float tiles3d_tileset_time;
|
||
`,L&&(J+=`float u_geometricError;
|
||
float u_depthMultiplier;
|
||
`),J+=Q,ee&&(g?J+=`attribute vec4 a_color;
|
||
`:_?J+=`attribute float a_color;
|
||
const float SHIFT_RIGHT_11 = 1.0 / 2048.0;
|
||
const float SHIFT_RIGHT_5 = 1.0 / 32.0;
|
||
const float SHIFT_LEFT_11 = 2048.0;
|
||
const float SHIFT_LEFT_5 = 32.0;
|
||
const float NORMALIZE_6 = 1.0 / 64.0;
|
||
const float NORMALIZE_5 = 1.0 / 32.0;
|
||
`:J+=`attribute vec3 a_color;
|
||
`),K&&(f||h?J+=`attribute vec2 a_normal;
|
||
`:J+=`attribute vec3 a_normal;
|
||
`),T&&(J+=`attribute float a_batchId;
|
||
`),(c||u||h)&&(J+=`uniform vec4 u_quantizedVolumeScaleAndOctEncodedRange;
|
||
`),m&&(J+=B),P&&(J+=V),R&&(J+=M),J+=`void main()
|
||
{
|
||
u_pointSize = u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier.x;
|
||
tiles3d_tileset_time = u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier.y;
|
||
`,L&&(J+=` u_geometricError = u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier.z;
|
||
u_depthMultiplier = u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier.w;
|
||
`),ee?g?J+=` vec4 color = a_color;
|
||
`:_?J+=` float compressed = a_color;
|
||
float r = floor(compressed * SHIFT_RIGHT_11);
|
||
compressed -= r * SHIFT_LEFT_11;
|
||
float g = floor(compressed * SHIFT_RIGHT_5);
|
||
compressed -= g * SHIFT_LEFT_5;
|
||
float b = compressed;
|
||
vec3 rgb = vec3(r * NORMALIZE_5, g * NORMALIZE_6, b * NORMALIZE_5);
|
||
vec4 color = vec4(rgb, 1.0);
|
||
`:J+=` vec4 color = vec4(a_color, 1.0);
|
||
`:J+=` vec4 color = u_constantColor;
|
||
`,c||u?J+=` vec3 position = a_position * u_quantizedVolumeScaleAndOctEncodedRange.xyz;
|
||
`:J+=` vec3 position = a_position;
|
||
`,J+=` vec3 position_absolute = vec3(czm_model * vec4(position, 1.0));
|
||
`,K?(f?J+=` vec3 normal = czm_octDecode(a_normal);
|
||
`:h?J+=` vec3 normal = czm_octDecode(a_normal, u_quantizedVolumeScaleAndOctEncodedRange.w).zxy;
|
||
`:J+=` vec3 normal = a_normal;
|
||
`,J+=` vec3 normalEC = czm_normal * normal;
|
||
`):J+=` vec3 normal = vec3(1.0);
|
||
`,m&&(J+=` color = getColorFromStyle(position, position_absolute, color, normal);
|
||
`),P&&(J+=` float show = float(getShowFromStyle(position, position_absolute, color, normal));
|
||
`),R?J+=` gl_PointSize = getPointSizeFromStyle(position, position_absolute, color, normal) * czm_pixelRatio;
|
||
`:L?J+=` vec4 positionEC = czm_modelView * vec4(position, 1.0);
|
||
float depth = -positionEC.z;
|
||
gl_PointSize = min((u_geometricError / depth) * u_depthMultiplier, u_pointSize);
|
||
`:J+=` gl_PointSize = u_pointSize;
|
||
`,J+=` color = color * u_highlightColor;
|
||
`,K&&x&&(J+=` float diffuseStrength = czm_getLambertDiffuse(czm_lightDirectionEC, normalEC);
|
||
diffuseStrength = max(diffuseStrength, 0.4);
|
||
color.xyz *= diffuseStrength * czm_lightColor;
|
||
`),J+=` v_color = color;
|
||
gl_Position = czm_modelViewProjection * vec4(position, 1.0);
|
||
`,K&&b&&(J+=` float visible = step(-normalEC.z, 0.0);
|
||
gl_Position *= visible;
|
||
gl_PointSize *= visible;
|
||
`),P&&(J+=` gl_Position.w *= float(show);
|
||
gl_PointSize *= float(show);
|
||
`),J+=`}
|
||
`;let de=`varying vec4 v_color;
|
||
`;U&&(de+=`uniform highp sampler2D u_clippingPlanes;
|
||
uniform mat4 u_clippingPlanesMatrix;
|
||
uniform vec4 u_clippingPlanesEdgeStyle;
|
||
`,de+=`
|
||
`,de+=_z(D,s),de+=`
|
||
`),de+=`void main()
|
||
{
|
||
gl_FragColor = czm_gammaCorrect(v_color);
|
||
`,U&&(de+=lgt("u_clippingPlanes","u_clippingPlanesMatrix","u_clippingPlanesEdgeStyle")),de+=`}
|
||
`,e.splitDirection!==Py.NONE&&(de=cae.modifyFragmentShader(de)),l(e._vertexShaderLoaded)&&(J=e._vertexShaderLoaded(J)),l(e._fragmentShaderLoaded)&&(de=e._fragmentShaderLoaded(de));const _e=e._drawCommand;l(_e.shaderProgram)&&_e.shaderProgram.destroy(),_e.shaderProgram=Hn.fromCache({context:s,vertexShaderSource:J,fragmentShaderSource:de,attributeLocations:se});try{_e.shaderProgram._bind()}catch{throw new Fe("Error generating style shader: this may be caused by a type mismatch, index out-of-bounds, or other syntax error.")}}function Sgt(e,t){if(e._decodingState===Pg.READY)return!1;if(e._decodingState===Pg.NEEDS_DECODE){const n=e._parsedContent,i=n.draco,o=ks.decodePointCloud(i,t);l(o)&&(e._decodingState=Pg.DECODING,o.then(function(r){e._decodingState=Pg.READY;const s=l(r.POSITION)?r.POSITION.array:void 0,a=l(r.RGB)?r.RGB.array:void 0,c=l(r.RGBA)?r.RGBA.array:void 0,u=l(r.NORMAL)?r.NORMAL.array:void 0,f=l(r.BATCH_ID)?r.BATCH_ID.array:void 0,h=l(s)&&l(r.POSITION.data.quantization),_=l(u)&&l(r.NORMAL.data.quantization);if(h){const T=r.POSITION.data.quantization,b=T.range;e._quantizedVolumeScale=d.fromElements(b,b,b),e._quantizedVolumeOffset=d.unpack(T.minValues),e._quantizedRange=(1<<T.quantizationBits)-1,e._isQuantizedDraco=!0}_&&(e._octEncodedRange=(1<<r.NORMAL.data.quantization.quantizationBits)-1,e._isOctEncodedDraco=!0);let g=n.styleableProperties;const p=i.batchTableProperties;for(const T in p)if(p.hasOwnProperty(T)){const b=r[T];l(g)||(g={}),g[T]={typedArray:b.array,componentCount:b.data.componentsPerAttribute}}l(s)&&(n.positions={typedArray:s});const y=A(c,a);l(y)&&(n.colors={typedArray:y}),l(u)&&(n.normals={typedArray:u}),l(f)&&(n.batchIds={typedArray:f}),n.styleableProperties=g}).catch(function(r){e._decodingState=Pg.FAILED,e._rejectReadyPromise(r)}))}return!0}const vgt=new ue,Dgt=new d;Zx.prototype.update=function(e){const t=e.context;if(Sgt(this,t))return;let i=!1,o=!N.equals(this._modelMatrix,this.modelMatrix);if(this._mode!==e.mode&&(this._mode=e.mode,o=!0),l(this._drawCommand)||(bgt(this,e),o=!0,i=!0,this._resolveReadyPromise(),this._parsedContent=void 0),o){N.clone(this.modelMatrix,this._modelMatrix);const u=this._drawCommand.modelMatrix;if(N.clone(this._modelMatrix,u),l(this._rtcCenter)&&N.multiplyByTranslation(u,this._rtcCenter,u),l(this._quantizedVolumeOffset)&&N.multiplyByTranslation(u,this._quantizedVolumeOffset,u),e.mode!==me.SCENE3D){const h=e.mapProjection,_=N.getColumn(u,3,vgt);ue.equals(_,ue.UNIT_W)||En.basisTo2D(h,u,u)}const f=this._drawCommand.boundingVolume;if(Ae.clone(this._boundingSphere,f),this._cull){const h=f.center;N.multiplyByPoint(u,h,h);const _=N.getScale(u,Dgt);f.radius*=d.maximumComponent(_)}}this.clippingPlanesDirty&&(this.clippingPlanesDirty=!1,i=!0),this._attenuation!==this.attenuation&&(this._attenuation=this.attenuation,i=!0),this.backFaceCulling!==this._backFaceCulling&&(this._backFaceCulling=this.backFaceCulling,i=!0),this.normalShading!==this._normalShading&&(this._normalShading=this.normalShading,i=!0),(this._style!==this.style||this.styleDirty)&&(this._style=this.style,this.styleDirty=!1,i=!0);const r=this.splitDirection!==Py.NONE;this._splittingEnabled!==r&&(this._splittingEnabled=r,i=!0),i&&wgt(this,e,this._style),this._drawCommand.castShadows=sr.castShadows(this.shadows),this._drawCommand.receiveShadows=sr.receiveShadows(this.shadows);const s=this._highlightColor.alpha<1||this._constantColor.alpha<1||this._styleTranslucent;this._drawCommand.renderState=s?this._translucentRenderState:this._opaqueRenderState,this._drawCommand.pass=s?We.TRANSLUCENT:this._opaquePass;const a=e.commandList,c=e.passes;(c.render||c.pick)&&a.push(this._drawCommand)};Zx.prototype.isDestroyed=function(){return!1};Zx.prototype.destroy=function(){const e=this._drawCommand;return l(e)&&(e.vertexArray=e.vertexArray&&e.vertexArray.destroy(),e.shaderProgram=e.shaderProgram&&e.shaderProgram.destroy()),Je(this)};function Iu(e,t,n,i,o,r,s){this.children=void 0,this.parent=o,this.level=e,this.x=t,this.y=n,this.z=i,this.keyframeNodes=[],this.renderableKeyframeNodes=[],this.renderableKeyframeNodeLerp=0,this.renderableKeyframeNodePrevious=void 0,this.renderableKeyframeNodeNext=void 0,this.orientedBoundingBox=new Zt,this.approximateVoxelSize=0,this.screenSpaceError=0,this.visitedFrameNumber=-1,this.computeBoundingVolumes(r,s)}Iu.spatialComparator=function(e,t){return t.screenSpaceError-e.screenSpaceError};const Igt=new d;Iu.prototype.computeBoundingVolumes=function(e,t){this.orientedBoundingBox=e.computeOrientedBoundingBoxForTile(this.level,this.x,this.y,this.z,this.orientedBoundingBox);const n=te.getScale(this.orientedBoundingBox.halfAxes,Igt),i=2*d.maximumComponent(n);this.approximateVoxelSize=i/d.minimumComponent(t)};Iu.prototype.visibility=function(e,t){const n=this.orientedBoundingBox;return e.cullingVolume.computeVisibilityWithPlaneMask(n,t)};Iu.prototype.computeScreenSpaceError=function(e,t){const n=this.orientedBoundingBox;let i=Math.sqrt(n.distanceSquaredTo(e));i=Math.max(i,F.EPSILON7);const o=this.approximateVoxelSize,r=t*(o/i);this.screenSpaceError=r};const N7={keyframe:0};function nx(e,t){return N7.keyframe=e,da(t,N7,Zi.searchComparator)}Iu.prototype.computeSurroundingRenderableKeyframeNodes=function(e){let t=this;const n=t.level,i=Math.floor(e),o=Math.ceil(e);let r,s,a=+Number.MAX_VALUE,c=+Number.MAX_VALUE;for(;l(t);){const u=t.renderableKeyframeNodes;if(u.length>=1){let f=nx(i,u);f<0&&(f=F.clamp(~f-1,0,u.length-1));const h=u[f],_=h.keyframe;let g;if(o===i||i<_)g=h;else{const V=Math.min(f+1,u.length-1);g=u[V]}const p=g.keyframe,y=i-_,T=p-o,b=n-t.level,x=Math.exp(b*4),v=1,D=200,L=b*x+(y>=0?y*v:-y*D),B=b*x+(T>=0?T*v:-T*D);if(L<a&&(a=L,r=h),B<c&&(c=B,s=g),y===0&&T===0)break}t=t.parent}if(this.renderableKeyframeNodePrevious=r,this.renderableKeyframeNodeNext=s,l(r)&&l(s)){const u=r.keyframe,f=s.keyframe;this.renderableKeyframeNodeLerp=u===f?0:F.clamp((e-u)/(f-u),0,1)}};Iu.prototype.isVisited=function(e){return this.visitedFrameNumber===e};Iu.prototype.createKeyframeNode=function(e){let t=nx(e,this.keyframeNodes);if(t<0){t=~t;const n=new Zi(this,e);this.keyframeNodes.splice(t,0,n)}};Iu.prototype.destroyKeyframeNode=function(e,t){const n=e.keyframe,i=nx(n,this.keyframeNodes);if(i<0)throw new w("Keyframe node does not exist.");if(this.keyframeNodes.splice(i,1),e.megatextureIndex!==-1){for(let r=0;r<t.length;r++)t[r].remove(e.megatextureIndex);const o=nx(n,this.renderableKeyframeNodes);if(o<0)throw new w("Renderable keyframe node does not exist.");this.renderableKeyframeNodes.splice(o,1)}e.spatialNode=void 0,e.state=Zi.LoadState.UNLOADED,e.metadatas={},e.megatextureIndex=-1,e.priority=-Number.MAX_VALUE,e.highPriorityFrameNumber=-1};Iu.prototype.addKeyframeNodeToMegatextures=function(e,t){if(e.state!==Zi.LoadState.RECEIVED||e.megatextureIndex!==-1||e.metadatas.length!==t.length)throw new w("Keyframe node cannot be added to megatexture");for(let o=0;o<t.length;o++){const r=t[o];e.megatextureIndex=r.add(e.metadatas[o]),e.metadatas[o]=void 0}e.state=Zi.LoadState.LOADED;const n=this.renderableKeyframeNodes;let i=nx(e.keyframe,n);if(i>=0)throw new w("Keyframe already renderable");i=~i,n.splice(i,0,e)};Iu.prototype.isRenderable=function(e){const t=this.renderableKeyframeNodePrevious,n=this.renderableKeyframeNodeNext,i=this.level;return l(t)&&l(n)&&(t.spatialNode.level===i||n.spatialNode.level===i)&&this.visitedFrameNumber===e};function D_(e){e=A(e,A.EMPTY_OBJECT),E.typeOf.object("options.clock",e.clock),E.typeOf.object("options.intervals",e.intervals),this.show=A(e.show,!0),this.modelMatrix=N.clone(A(e.modelMatrix,N.IDENTITY)),this.shadows=A(e.shadows,sr.ENABLED),this.maximumMemoryUsage=A(e.maximumMemoryUsage,256),this.shading=new Hx(e.shading),this.style=e.style,this.frameFailed=new lt,this.frameChanged=new lt,this._clock=e.clock,this._intervals=e.intervals,this._clippingPlanes=void 0,this.clippingPlanes=e.clippingPlanes,this._pointCloudEyeDomeLighting=new x_,this._loadTimestamp=void 0,this._clippingPlanesState=0,this._styleDirty=!1,this._pickId=void 0,this._totalMemoryUsageInBytes=0,this._frames=[],this._previousInterval=void 0,this._nextInterval=void 0,this._lastRenderedFrame=void 0,this._clockMultiplier=0,this._resolveReadyPromise=void 0;const t=this;this._readyPromise=new Promise(function(n){t._resolveReadyPromise=n}),this._runningSum=0,this._runningLength=0,this._runningIndex=0,this._runningSamples=new Array(5).fill(0),this._runningAverage=0}Object.defineProperties(D_.prototype,{clippingPlanes:{get:function(){return this._clippingPlanes},set:function(e){rr.setOwner(e,this,"_clippingPlanes")}},totalMemoryUsageInBytes:{get:function(){return this._totalMemoryUsageInBytes}},boundingSphere:{get:function(){if(l(this._lastRenderedFrame))return this._lastRenderedFrame.pointCloud.boundingSphere}},readyPromise:{get:function(){return this._readyPromise}}});function Pgt(e){return`uniform vec4 czm_pickColor;
|
||
${e}`}function Ogt(e){return function(t){return Ln(t,{czm_pickColor:function(){return e._pickId.color}})}}function Lgt(){return"czm_pickColor"}D_.prototype.makeStyleDirty=function(){this._styleDirty=!0};D_.prototype._getAverageLoadTime=function(){return this._runningLength===0?.05:this._runningAverage};const Bgt=new ce;function uH(e){const t=e._clock,n=t.canAnimate&&t.shouldAnimate,i=t.multiplier;return n?i:0}function yy(e,t){return e._intervals.indexOf(t.start)}function Rgt(e,t){const n=e._intervals,i=e._clock,o=uH(e);if(o===0)return;const r=e._getAverageLoadTime(),s=ce.addSeconds(i.currentTime,r*o,Bgt);let a=n.indexOf(s);const c=yy(e,t);return a===c&&(o>=0?++a:--a),n.get(a)}function Ngt(e){const t=e._intervals,i=e._clock.currentTime,o=t.indexOf(i);return t.get(o)}function Mgt(e,t,n){const i=uH(e),o=yy(e,t),r=yy(e,n);return i>=0?o>=r:o<=r}function Fgt(e,t){return function(n){const i=l(n.message)?n.message:n.toString();e.frameFailed.numberOfListeners>0?e.frameFailed.raiseEvent({uri:t,message:i}):(console.log(`A frame failed to load: ${t}`),console.log(`Error: ${i}`))}}function zgt(e,t,n){const i=yy(e,t),o=e._frames;let r=o[i];if(!l(r)){const s=t.data.transform,a=l(s)?N.fromArray(s):void 0,c=t.data.uri;r={pointCloud:void 0,transform:a,timestamp:Gr(),sequential:!0,ready:!1,touchedFrameNumber:n.frameNumber},o[i]=r,je.fetchArrayBuffer({url:c}).then(function(u){return r.pointCloud=new Zx({arrayBuffer:u,cull:!0,fragmentShaderLoaded:Pgt,uniformMapLoaded:Ogt(e),pickIdLoaded:Lgt}),r.pointCloud.readyPromise}).catch(Fgt(e,c))}return r}function Ugt(e,t){e._runningSum+=t,e._runningSum-=e._runningSamples[e._runningIndex],e._runningSamples[e._runningIndex]=t,e._runningLength=Math.min(e._runningLength+1,e._runningSamples.length),e._runningIndex=(e._runningIndex+1)%e._runningSamples.length,e._runningAverage=e._runningSum/e._runningLength}function Hgt(e,t,n,i){t.touchedFrameNumber<i.frameNumber-1&&(t.sequential=!1);const o=t.pointCloud;if(l(o)&&!t.ready){const r=i.commandList,s=r.length;if(fae(e,t,n,i),o.ready&&(t.ready=!0,e._totalMemoryUsageInBytes+=o.geometryByteLength,r.length=s,t.sequential)){const a=(Gr()-t.timestamp)/1e3;Ugt(e,a)}}t.touchedFrameNumber=i.frameNumber}const Vgt=new N;function kgt(e,t){const n=e.shading;return l(n)&&l(n.baseResolution)?n.baseResolution:l(t.boundingSphere)?F.cbrt(t.boundingSphere.volume()/t.pointsLength):0}function Ggt(e){const t=e.shading;return l(t)&&l(t.maximumAttenuation)?t.maximumAttenuation:10}const Wgt=new Hx;function fae(e,t,n,i){const o=A(e.shading,Wgt),r=t.pointCloud,s=A(t.transform,N.IDENTITY);r.modelMatrix=N.multiplyTransformation(e.modelMatrix,s,Vgt),r.style=e.style,r.time=n.timeSinceLoad,r.shadows=e.shadows,r.clippingPlanes=e._clippingPlanes,r.isClipped=n.isClipped,r.attenuation=o.attenuation,r.backFaceCulling=o.backFaceCulling,r.normalShading=o.normalShading,r.geometricError=kgt(e,r),r.geometricErrorScale=o.geometricErrorScale,r.maximumAttenuation=Ggt(e),r.update(i),t.touchedFrameNumber=i.frameNumber}function O2(e,t,n,i){const o=zgt(e,t,i);Hgt(e,o,n,i)}function qgt(e){return function(t){return t.touchedFrameNumber<e.frameNumber}}function dae(e,t){const n=e._frames,i=n.length;for(let o=0;o<i;++o){const r=n[o];if(l(r)&&(!l(t)||t(r))){const s=r.pointCloud;r.ready&&(e._totalMemoryUsageInBytes-=s.geometryByteLength),l(s)&&s.destroy(),r===e._lastRenderedFrame&&(e._lastRenderedFrame=void 0),n[o]=void 0}}}function jgt(e,t){const n=yy(e,t),i=e._frames[n];if(l(i)&&i.ready)return i}function M7(e,t,n,i,o){return l(n)?n.ready?!0:(O2(e,t,i,o),n.ready):!1}function Ygt(e,t,n,i,o){let r,s,a;const c=e._intervals,u=e._frames,f=yy(e,n),h=yy(e,t);if(f>=h){for(r=f;r>=h;--r)if(s=c.get(r),a=u[r],M7(e,s,a,i,o))return s}else for(r=f;r<=h;++r)if(s=c.get(r),a=u[r],M7(e,s,a,i,o))return s;return t}function $gt(e,t,n){const i=e._frames,o=i.length;for(let r=0;r<o;++r){const s=i[r];l(s)&&l(s.pointCloud)&&(s.pointCloud.clippingPlanesDirty=t,s.pointCloud.styleDirty=n)}}const Y0={timeSinceLoad:0,isClipped:!1,clippingPlanesDirty:!1};D_.prototype.update=function(e){if(e.mode===me.MORPHING||!this.show)return;l(this._pickId)||(this._pickId=e.context.createPickId({primitive:this})),l(this._loadTimestamp)||(this._loadTimestamp=ce.clone(e.time));const t=Math.max(ce.secondsDifference(e.time,this._loadTimestamp)*1e3,0),n=this._clippingPlanes;let i=0,o=!1;const r=l(n)&&n.enabled;r&&(n.update(e),i=n.clippingPlanesState),this._clippingPlanesState!==i&&(this._clippingPlanesState=i,o=!0);const s=this._styleDirty;this._styleDirty=!1,(o||s)&&$gt(this,o,s),Y0.timeSinceLoad=t,Y0.isClipped=r;const a=this.shading,c=this._pointCloudEyeDomeLighting,u=e.commandList,f=u.length;let h=this._previousInterval,_=this._nextInterval;const g=Ngt(this);if(!l(g))return;let p=!1;const y=uH(this),T=y===0;y!==this._clockMultiplier&&(p=!0,this._clockMultiplier=y),(!l(h)||T)&&(h=g),(!l(_)||p||Mgt(this,g,_))&&(_=Rgt(this,g)),h=Ygt(this,h,g,Y0,e);let b=jgt(this,h);l(b)||(O2(this,h,Y0,e),b=this._lastRenderedFrame),l(b)&&fae(this,b,Y0,e),l(_)&&O2(this,_,Y0,e);const x=this;l(b)&&!l(this._lastRenderedFrame)&&e.afterRender.push(function(){return x._resolveReadyPromise(x),!0}),l(b)&&b!==this._lastRenderedFrame&&x.frameChanged.numberOfListeners>0&&e.afterRender.push(function(){return x.frameChanged.raiseEvent(x),!0}),this._previousInterval=h,this._nextInterval=_,this._lastRenderedFrame=b;const v=this._totalMemoryUsageInBytes,D=this.maximumMemoryUsage*1024*1024;v>D&&dae(this,qgt(e));const B=u.length-f;l(a)&&a.attenuation&&a.eyeDomeLighting&&B>0&&c.update(e,f,a,this.boundingSphere)};D_.prototype.isDestroyed=function(){return!1};D_.prototype.destroy=function(){return dae(this),this._clippingPlanes=this._clippingPlanes&&this._clippingPlanes.destroy(),this._pickId=this._pickId&&this._pickId.destroy(),Je(this)};const Xgt=`// See Intersection.glsl for the definition of intersectScene
|
||
// See IntersectionUtils.glsl for the definition of nextIntersection
|
||
// See convertUvToBox.glsl, convertUvToCylinder.glsl, or convertUvToEllipsoid.glsl
|
||
// for the definition of convertUvToShapeUvSpace. The appropriate function is
|
||
// selected based on the VoxelPrimitive shape type, and added to the shader in
|
||
// Scene/VoxelRenderResources.js.
|
||
// See Octree.glsl for the definitions of TraversalData, SampleData,
|
||
// traverseOctreeFromBeginning, and traverseOctreeFromExisting
|
||
// See Megatexture.glsl for the definition of accumulatePropertiesFromMegatexture
|
||
|
||
#define STEP_COUNT_MAX 1000 // Harcoded value because GLSL doesn't like variable length loops
|
||
#define ALPHA_ACCUM_MAX 0.98 // Must be > 0.0 and <= 1.0
|
||
|
||
uniform mat3 u_transformDirectionViewToLocal;
|
||
uniform vec3 u_cameraPositionUv;
|
||
|
||
#if defined(PICKING)
|
||
uniform vec4 u_pickColor;
|
||
#endif
|
||
|
||
#if defined(JITTER)
|
||
float hash(vec2 p)
|
||
{
|
||
vec3 p3 = fract(vec3(p.xyx) * 50.0); // magic number = hashscale
|
||
p3 += dot(p3, p3.yzx + 19.19);
|
||
return fract((p3.x + p3.y) * p3.z);
|
||
}
|
||
#endif
|
||
|
||
void main()
|
||
{
|
||
vec4 fragCoord = gl_FragCoord;
|
||
vec2 screenCoord = (fragCoord.xy - czm_viewport.xy) / czm_viewport.zw; // [0,1]
|
||
vec3 eyeDirection = normalize(czm_windowToEyeCoordinates(fragCoord).xyz);
|
||
vec3 viewDirWorld = normalize(czm_inverseViewRotation * eyeDirection); // normalize again just in case
|
||
vec3 viewDirUv = normalize(u_transformDirectionViewToLocal * eyeDirection); // normalize again just in case
|
||
vec3 viewPosUv = u_cameraPositionUv;
|
||
|
||
Intersections ix;
|
||
vec2 entryExitT = intersectScene(screenCoord, viewPosUv, viewDirUv, ix);
|
||
|
||
// Exit early if the scene was completely missed.
|
||
if (entryExitT.x == NO_HIT) {
|
||
discard;
|
||
}
|
||
|
||
float currT = entryExitT.x;
|
||
float endT = entryExitT.y;
|
||
vec3 positionUv = viewPosUv + currT * viewDirUv;
|
||
// TODO: is it possible for this to be out of bounds, and does it matter?
|
||
vec3 positionUvShapeSpace = convertUvToShapeUvSpace(positionUv);
|
||
|
||
// Traverse the tree from the start position
|
||
TraversalData traversalData;
|
||
SampleData sampleDatas[SAMPLE_COUNT];
|
||
traverseOctreeFromBeginning(positionUvShapeSpace, traversalData, sampleDatas);
|
||
|
||
// TODO:
|
||
// - jitter doesn't affect the first traversal?
|
||
// - jitter is always > 0?
|
||
// - jitter is only applied at one step?
|
||
#if defined(JITTER)
|
||
float noise = hash(screenCoord); // [0,1]
|
||
currT += noise * traversalData.stepT;
|
||
positionUv += noise * traversalData.stepT * viewDirUv;
|
||
#endif
|
||
|
||
FragmentInput fragmentInput;
|
||
#if defined(STATISTICS)
|
||
setStatistics(fragmentInput.metadata.statistics);
|
||
#endif
|
||
|
||
vec4 colorAccum =vec4(0.0);
|
||
|
||
for (int stepCount = 0; stepCount < STEP_COUNT_MAX; ++stepCount) {
|
||
// Read properties from the megatexture based on the traversal state
|
||
Properties properties = accumulatePropertiesFromMegatexture(sampleDatas);
|
||
|
||
// Prepare the custom shader inputs
|
||
copyPropertiesToMetadata(properties, fragmentInput.metadata);
|
||
fragmentInput.voxel.positionUv = positionUv;
|
||
fragmentInput.voxel.positionShapeUv = positionUvShapeSpace;
|
||
fragmentInput.voxel.positionUvLocal = sampleDatas[0].tileUv;
|
||
fragmentInput.voxel.viewDirUv = viewDirUv;
|
||
fragmentInput.voxel.viewDirWorld = viewDirWorld;
|
||
fragmentInput.voxel.travelDistance = traversalData.stepT;
|
||
|
||
// Run the custom shader
|
||
czm_modelMaterial materialOutput;
|
||
fragmentMain(fragmentInput, materialOutput);
|
||
|
||
// Sanitize the custom shader output
|
||
vec4 color = vec4(materialOutput.diffuse, materialOutput.alpha);
|
||
color.rgb = max(color.rgb, vec3(0.0));
|
||
color.a = clamp(color.a, 0.0, 1.0);
|
||
|
||
// Pre-multiplied alpha blend
|
||
colorAccum += (1.0 - colorAccum.a) * vec4(color.rgb * color.a, color.a);
|
||
|
||
// Stop traversing if the alpha has been fully saturated
|
||
if (colorAccum.a > ALPHA_ACCUM_MAX) {
|
||
colorAccum.a = ALPHA_ACCUM_MAX;
|
||
break;
|
||
}
|
||
|
||
if (traversalData.stepT == 0.0) {
|
||
// Shape is infinitely thin, no need to traverse further
|
||
break;
|
||
}
|
||
|
||
// Keep raymarching
|
||
currT += traversalData.stepT;
|
||
positionUv += traversalData.stepT * viewDirUv;
|
||
|
||
// Check if there's more intersections.
|
||
if (currT > endT) {
|
||
#if (INTERSECTION_COUNT == 1)
|
||
break;
|
||
#else
|
||
vec2 entryExitT = nextIntersection(ix);
|
||
if (entryExitT.x == NO_HIT) {
|
||
break;
|
||
} else {
|
||
// Found another intersection. Resume raymarching there
|
||
currT = entryExitT.x;
|
||
endT = entryExitT.y;
|
||
positionUv = viewPosUv + currT * viewDirUv;
|
||
}
|
||
#endif
|
||
}
|
||
|
||
// Traverse the tree from the current ray position.
|
||
// This is similar to traverseOctree but is faster when the ray is in the same tile as the previous step.
|
||
positionUvShapeSpace = convertUvToShapeUvSpace(positionUv);
|
||
traverseOctreeFromExisting(positionUvShapeSpace, traversalData, sampleDatas);
|
||
}
|
||
|
||
// Convert the alpha from [0,ALPHA_ACCUM_MAX] to [0,1]
|
||
colorAccum.a /= ALPHA_ACCUM_MAX;
|
||
|
||
#if defined(PICKING)
|
||
// If alpha is 0.0 there is nothing to pick
|
||
if (colorAccum.a == 0.0) {
|
||
discard;
|
||
}
|
||
gl_FragColor = u_pickColor;
|
||
#else
|
||
gl_FragColor = colorAccum;
|
||
#endif
|
||
}
|
||
`,Kgt=`attribute vec2 position;
|
||
|
||
uniform vec4 u_ndcSpaceAxisAlignedBoundingBox;
|
||
|
||
void main() {
|
||
vec2 aabbMin = u_ndcSpaceAxisAlignedBoundingBox.xy;
|
||
vec2 aabbMax = u_ndcSpaceAxisAlignedBoundingBox.zw;
|
||
vec2 translation = 0.5 * (aabbMax + aabbMin);
|
||
vec2 scale = 0.5 * (aabbMax - aabbMin);
|
||
gl_Position = vec4(position * scale + translation, 0.0, 1.0);
|
||
}
|
||
`,Jgt=`/* Intersection defines
|
||
#define INTERSECTION_COUNT ###
|
||
*/
|
||
|
||
#define NO_HIT (-czm_infinity)
|
||
#define INF_HIT (czm_infinity * 0.5)
|
||
|
||
struct Ray {
|
||
vec3 pos;
|
||
vec3 dir;
|
||
};
|
||
|
||
struct Intersections {
|
||
// Don't access these member variables directly - call the functions instead.
|
||
|
||
#if (INTERSECTION_COUNT > 1)
|
||
// Store an array of intersections. Each intersection is composed of:
|
||
// x for the T value
|
||
// y for the shape type - which encodes positive vs negative and entering vs exiting
|
||
// For example:
|
||
// y = 0: positive shape entry
|
||
// y = 1: positive shape exit
|
||
// y = 2: negative shape entry
|
||
// y = 3: negative shape exit
|
||
vec2 intersections[INTERSECTION_COUNT * 2];
|
||
|
||
// Maintain state for future nextIntersection calls
|
||
int index;
|
||
int surroundCount;
|
||
bool surroundIsPositive;
|
||
#else
|
||
// When there's only one positive shape intersection none of the extra stuff is needed.
|
||
float intersections[2];
|
||
#endif
|
||
};
|
||
|
||
// Using a define instead of a real function because WebGL1 cannot access array with non-constant index.
|
||
#if (INTERSECTION_COUNT > 1)
|
||
#define getIntersection(/*inout Intersections*/ ix, /*int*/ index) (ix).intersections[(index)].x
|
||
#else
|
||
#define getIntersection(/*inout Intersections*/ ix, /*int*/ index) (ix).intersections[(index)]
|
||
#endif
|
||
|
||
// Using a define instead of a real function because WebGL1 cannot access array with non-constant index.
|
||
#define getIntersectionPair(/*inout Intersections*/ ix, /*int*/ index) vec2(getIntersection((ix), (index) * 2 + 0), getIntersection((ix), (index) * 2 + 1))
|
||
|
||
// Using a define instead of a real function because WebGL1 cannot access array with non-constant index.
|
||
#if (INTERSECTION_COUNT > 1)
|
||
#define setIntersection(/*inout Intersections*/ ix, /*int*/ index, /*float*/ t, /*bool*/ positive, /*enter*/ enter) (ix).intersections[(index)] = vec2((t), float(!positive) * 2.0 + float(!enter))
|
||
#else
|
||
#define setIntersection(/*inout Intersections*/ ix, /*int*/ index, /*float*/ t, /*bool*/ positive, /*enter*/ enter) (ix).intersections[(index)] = (t)
|
||
#endif
|
||
|
||
// Using a define instead of a real function because WebGL1 cannot access array with non-constant index.
|
||
#if (INTERSECTION_COUNT > 1)
|
||
#define setIntersectionPair(/*inout Intersections*/ ix, /*int*/ index, /*vec2*/ entryExit) (ix).intersections[(index) * 2 + 0] = vec2((entryExit).x, float((index) > 0) * 2.0 + 0.0); (ix).intersections[(index) * 2 + 1] = vec2((entryExit).y, float((index) > 0) * 2.0 + 1.0)
|
||
#else
|
||
#define setIntersectionPair(/*inout Intersections*/ ix, /*int*/ index, /*vec2*/ entryExit) (ix).intersections[(index) * 2 + 0] = (entryExit).x; (ix).intersections[(index) * 2 + 1] = (entryExit).y
|
||
#endif
|
||
|
||
#if (INTERSECTION_COUNT > 1)
|
||
void initializeIntersections(inout Intersections ix) {
|
||
// Sort the intersections from min T to max T with bubble sort.
|
||
// Note: If this sorting function changes, some of the intersection test may
|
||
// need to be updated. Search for "bubble sort" to find those areas.
|
||
const int sortPasses = INTERSECTION_COUNT * 2 - 1;
|
||
for (int n = sortPasses; n > 0; --n) {
|
||
for (int i = 0; i < sortPasses; ++i) {
|
||
// The loop should be: for (i = 0; i < n; ++i) {...} but WebGL1 cannot
|
||
// loop with non-constant condition, so it has to break early instead
|
||
if (i >= n) { break; }
|
||
|
||
vec2 intersect0 = ix.intersections[i + 0];
|
||
vec2 intersect1 = ix.intersections[i + 1];
|
||
|
||
float t0 = intersect0.x;
|
||
float t1 = intersect1.x;
|
||
float b0 = intersect0.y;
|
||
float b1 = intersect1.y;
|
||
|
||
float tmin = min(t0, t1);
|
||
float tmax = max(t0, t1);
|
||
float bmin = tmin == t0 ? b0 : b1;
|
||
float bmax = tmin == t0 ? b1 : b0;
|
||
|
||
ix.intersections[i + 0] = vec2(tmin, bmin);
|
||
ix.intersections[i + 1] = vec2(tmax, bmax);
|
||
}
|
||
}
|
||
|
||
// Prepare initial state for nextIntersection
|
||
ix.index = 0;
|
||
ix.surroundCount = 0;
|
||
ix.surroundIsPositive = false;
|
||
}
|
||
#endif
|
||
|
||
#if (INTERSECTION_COUNT > 1)
|
||
vec2 nextIntersection(inout Intersections ix) {
|
||
vec2 entryExitT = vec2(NO_HIT);
|
||
|
||
const int passCount = INTERSECTION_COUNT * 2;
|
||
|
||
if (ix.index == passCount) {
|
||
return entryExitT;
|
||
}
|
||
|
||
for (int i = 0; i < passCount; ++i) {
|
||
// The loop should be: for (i = ix.index; i < passCount; ++i) {...} but WebGL1 cannot
|
||
// loop with non-constant condition, so it has to continue instead.
|
||
if (i < ix.index) {
|
||
continue;
|
||
}
|
||
|
||
ix.index = i + 1;
|
||
|
||
vec2 intersect = ix.intersections[i];
|
||
float t = intersect.x;
|
||
bool currShapeIsPositive = intersect.y < 2.0;
|
||
bool enter = mod(intersect.y, 2.0) == 0.0;
|
||
|
||
ix.surroundCount += enter ? +1 : -1;
|
||
ix.surroundIsPositive = currShapeIsPositive ? enter : ix.surroundIsPositive;
|
||
|
||
// entering positive or exiting negative
|
||
if (ix.surroundCount == 1 && ix.surroundIsPositive && enter == currShapeIsPositive) {
|
||
entryExitT.x = t;
|
||
}
|
||
|
||
// exiting positive or entering negative after being inside positive
|
||
// TODO: Can this be simplified?
|
||
bool exitPositive = !enter && currShapeIsPositive && ix.surroundCount == 0;
|
||
bool enterNegativeFromPositive = enter && !currShapeIsPositive && ix.surroundCount == 2 && ix.surroundIsPositive;
|
||
if (exitPositive || enterNegativeFromPositive) {
|
||
entryExitT.y = t;
|
||
|
||
// entry and exit have been found, so the loop can stop
|
||
if (exitPositive) {
|
||
// After exiting positive shape there is nothing left to intersect, so jump to the end index.
|
||
ix.index = passCount;
|
||
}
|
||
break;
|
||
}
|
||
}
|
||
|
||
return entryExitT;
|
||
}
|
||
#endif
|
||
|
||
// NOTE: initializeIntersections, nextIntersection aren't even declared unless INTERSECTION_COUNT > 1
|
||
// export { NO_HIT, INF_HIT, Ray, Intersections, getIntersectionPair, setIntersectionPair, initializeIntersections, nextIntersection };
|
||
`,Qgt=`// See IntersectionUtils.glsl for the definitions of Ray, Intersections,
|
||
// setIntersectionPair, INF_HIT, NO_HIT
|
||
|
||
/* intersectDepth defines (set in Scene/VoxelRenderResources.js)
|
||
#define DEPTH_INTERSECTION_INDEX ###
|
||
*/
|
||
|
||
uniform mat4 u_transformPositionViewToUv;
|
||
|
||
void intersectDepth(vec2 screenCoord, Ray ray, inout Intersections ix) {
|
||
float logDepthOrDepth = czm_unpackDepth(texture2D(czm_globeDepthTexture, screenCoord));
|
||
if (logDepthOrDepth != 0.0) {
|
||
// Calculate how far the ray must travel before it hits the depth buffer.
|
||
vec4 eyeCoordinateDepth = czm_screenToEyeCoordinates(screenCoord, logDepthOrDepth);
|
||
eyeCoordinateDepth /= eyeCoordinateDepth.w;
|
||
vec3 depthPositionUv = vec3(u_transformPositionViewToUv * eyeCoordinateDepth);
|
||
float t = dot(depthPositionUv - ray.pos, ray.dir);
|
||
setIntersectionPair(ix, DEPTH_INTERSECTION_INDEX, vec2(t, +INF_HIT));
|
||
} else {
|
||
// There's no depth at this location.
|
||
setIntersectionPair(ix, DEPTH_INTERSECTION_INDEX, vec2(NO_HIT));
|
||
}
|
||
}
|
||
`,Zgt=`// See IntersectionUtils.glsl for the definitions of Ray, Intersections, INF_HIT,
|
||
// NO_HIT, setIntersectionPair
|
||
|
||
/* Clipping plane defines (set in Scene/VoxelRenderResources.js)
|
||
#define CLIPPING_PLANES_UNION
|
||
#define CLIPPING_PLANES_COUNT
|
||
#define CLIPPING_PLANES_INTERSECTION_INDEX
|
||
*/
|
||
|
||
uniform sampler2D u_clippingPlanesTexture;
|
||
uniform mat4 u_clippingPlanesMatrix;
|
||
|
||
// Plane is in Hessian Normal Form
|
||
vec2 intersectPlane(Ray ray, vec4 plane) {
|
||
vec3 o = ray.pos;
|
||
vec3 d = ray.dir;
|
||
vec3 n = plane.xyz; // normal
|
||
float w = plane.w; // -dot(pointOnPlane, normal)
|
||
|
||
float a = dot(o, n);
|
||
float b = dot(d, n);
|
||
float t = -(w + a) / b;
|
||
|
||
if (dot(d, n) > 0.0) {
|
||
return vec2(t, +INF_HIT);
|
||
} else {
|
||
return vec2(-INF_HIT, t);
|
||
}
|
||
}
|
||
|
||
void intersectClippingPlanes(Ray ray, inout Intersections ix) {
|
||
#if (CLIPPING_PLANES_COUNT == 1)
|
||
// Union and intersection are the same when there's one clipping plane, and the code
|
||
// is more simplified.
|
||
vec4 planeUv = getClippingPlane(u_clippingPlanesTexture, 0, u_clippingPlanesMatrix);
|
||
vec2 intersection = intersectPlane(ray, planeUv);
|
||
setIntersectionPair(ix, CLIPPING_PLANES_INTERSECTION_INDEX, intersection);
|
||
#elif defined(CLIPPING_PLANES_UNION)
|
||
float minPositiveT = +INF_HIT;
|
||
float maxNegativeT = -INF_HIT;
|
||
for (int i = 0; i < CLIPPING_PLANES_COUNT; i++) {
|
||
vec4 planeUv = getClippingPlane(u_clippingPlanesTexture, i, u_clippingPlanesMatrix);
|
||
vec2 intersection = intersectPlane(ray, planeUv);
|
||
if (intersection.y == +INF_HIT) {
|
||
minPositiveT = min(minPositiveT, intersection.x);
|
||
} else {
|
||
maxNegativeT = max(maxNegativeT, intersection.y);
|
||
}
|
||
}
|
||
setIntersectionPair(ix, CLIPPING_PLANES_INTERSECTION_INDEX + 0, vec2(-INF_HIT, maxNegativeT));
|
||
setIntersectionPair(ix, CLIPPING_PLANES_INTERSECTION_INDEX + 1, vec2(minPositiveT, +INF_HIT));
|
||
#else // intersection
|
||
float maxPositiveT = -INF_HIT;
|
||
float minNegativeT = +INF_HIT;
|
||
for (int i = 0; i < CLIPPING_PLANES_COUNT; i++) {
|
||
vec4 planeUv = getClippingPlane(u_clippingPlanesTexture, i, u_clippingPlanesMatrix);
|
||
vec2 intersection = intersectPlane(ray, planeUv);
|
||
if (intersection.y == +INF_HIT) {
|
||
maxPositiveT = max(maxPositiveT, intersection.x);
|
||
} else {
|
||
minNegativeT = min(minNegativeT, intersection.y);
|
||
}
|
||
}
|
||
if (maxPositiveT < minNegativeT) {
|
||
setIntersectionPair(ix, CLIPPING_PLANES_INTERSECTION_INDEX, vec2(maxPositiveT, minNegativeT));
|
||
} else {
|
||
setIntersectionPair(ix, CLIPPING_PLANES_INTERSECTION_INDEX, vec2(NO_HIT));
|
||
}
|
||
#endif
|
||
}
|
||
`,eyt=`// See IntersectionUtils.glsl for the definitions of Ray and NO_HIT
|
||
|
||
/* Box defines (set in Scene/VoxelBoxShape.js)
|
||
#define BOX_INTERSECTION_INDEX ### // always 0
|
||
#define BOX_HAS_RENDER_BOUNDS
|
||
#define BOX_IS_2D
|
||
*/
|
||
|
||
#if defined(BOX_HAS_RENDER_BOUNDS)
|
||
#if defined(BOX_IS_2D)
|
||
// This matrix bakes in an axis conversion so that the math works for XY plane.
|
||
uniform mat4 u_boxUvToRenderBoundsTransform;
|
||
#else
|
||
// Similar to u_boxTransformUvToBounds but fewer instructions needed.
|
||
uniform vec3 u_boxUvToRenderBoundsScale;
|
||
uniform vec3 u_boxUvToRenderBoundsTranslate;
|
||
#endif
|
||
#endif
|
||
|
||
vec2 intersectUnitCube(Ray ray) // Unit cube from [-1, +1]
|
||
{
|
||
vec3 o = ray.pos;
|
||
vec3 d = ray.dir;
|
||
|
||
vec3 dInv = 1.0 / d;
|
||
vec3 od = -o * dInv;
|
||
vec3 t0 = od - dInv;
|
||
vec3 t1 = od + dInv;
|
||
vec3 m0 = min(t0, t1);
|
||
vec3 m1 = max(t0, t1);
|
||
float tMin = max(max(m0.x, m0.y), m0.z);
|
||
float tMax = min(min(m1.x, m1.y), m1.z);
|
||
|
||
if (tMin >= tMax) {
|
||
return vec2(NO_HIT);
|
||
}
|
||
|
||
return vec2(tMin, tMax);
|
||
}
|
||
|
||
vec2 intersectUnitSquare(Ray ray) // Unit square from [-1, +1]
|
||
{
|
||
vec3 o = ray.pos;
|
||
vec3 d = ray.dir;
|
||
|
||
float t = -o.z / d.z;
|
||
vec2 planePos = o.xy + d.xy * t;
|
||
if (any(greaterThan(abs(planePos), vec2(1.0)))) {
|
||
return vec2(NO_HIT);
|
||
}
|
||
|
||
return vec2(t, t);
|
||
}
|
||
|
||
void intersectShape(Ray ray, inout Intersections ix)
|
||
{
|
||
#if defined(BOX_HAS_RENDER_BOUNDS)
|
||
#if defined(BOX_IS_2D)
|
||
// Transform the ray into unit square space on Z plane
|
||
// This matrix bakes in an axis conversion so that the math works for XY plane.
|
||
ray.pos = vec3(u_boxUvToRenderBoundsTransform * vec4(ray.pos, 1.0));
|
||
ray.dir = vec3(u_boxUvToRenderBoundsTransform * vec4(ray.dir, 0.0));
|
||
vec2 entryExit = intersectUnitSquare(ray);
|
||
#else
|
||
// Transform the ray into unit cube space
|
||
ray.pos = ray.pos * u_boxUvToRenderBoundsScale + u_boxUvToRenderBoundsTranslate;
|
||
ray.dir *= u_boxUvToRenderBoundsScale;
|
||
vec2 entryExit = intersectUnitCube(ray);
|
||
#endif
|
||
#else
|
||
// Position is converted from [0,1] to [-1,+1] because shape intersections assume unit space is [-1,+1].
|
||
// Direction is scaled as well to be in sync with position.
|
||
ray.pos = ray.pos * 2.0 - 1.0;
|
||
ray.dir = ray.dir * 2.0;
|
||
vec2 entryExit = intersectUnitCube(ray);
|
||
#endif
|
||
|
||
setIntersectionPair(ix, BOX_INTERSECTION_INDEX, entryExit);
|
||
}
|
||
`,tyt=`// See IntersectionUtils.glsl for the definitions of Ray, setIntersection,
|
||
// setIntersectionPair
|
||
|
||
/* Cylinder defines (set in Scene/VoxelCylinderShape.js)
|
||
#define CYLINDER_HAS_RENDER_BOUNDS_RADIUS_MIN
|
||
#define CYLINDER_HAS_RENDER_BOUNDS_RADIUS_MAX
|
||
#define CYLINDER_HAS_RENDER_BOUNDS_RADIUS_FLAT
|
||
#define CYLINDER_HAS_RENDER_BOUNDS_HEIGHT
|
||
#define CYLINDER_HAS_RENDER_BOUNDS_HEIGHT_FLAT
|
||
#define CYLINDER_HAS_RENDER_BOUNDS_ANGLE
|
||
#define CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_UNDER_HALF
|
||
#define CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_OVER_HALF
|
||
#define CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_EQUAL_HALF
|
||
#define CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_EQUAL_ZERO
|
||
|
||
#define CYLINDER_HAS_SHAPE_BOUNDS_RADIUS
|
||
#define CYLINDER_HAS_SHAPE_BOUNDS_RADIUS_FLAT
|
||
#define CYLINDER_HAS_SHAPE_BOUNDS_HEIGHT
|
||
#define CYLINDER_HAS_SHAPE_BOUNDS_HEIGHT_FLAT
|
||
#define CYLINDER_HAS_SHAPE_BOUNDS_ANGLE
|
||
#define CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_RANGE_EQUAL_ZERO
|
||
#define CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MIN_DISCONTINUITY
|
||
#define CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MAX_DISCONTINUITY
|
||
#define CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MIN_MAX_REVERSED
|
||
|
||
#define CYLINDER_INTERSECTION_INDEX_RADIUS_MAX
|
||
#define CYLINDER_INTERSECTION_INDEX_RADIUS_MIN
|
||
#define CYLINDER_INTERSECTION_INDEX_ANGLE
|
||
*/
|
||
|
||
// Cylinder uniforms
|
||
#if defined(CYLINDER_HAS_RENDER_BOUNDS_RADIUS_MAX) || defined(CYLINDER_HAS_RENDER_BOUNDS_HEIGHT)
|
||
uniform vec3 u_cylinderUvToRenderBoundsScale;
|
||
uniform vec3 u_cylinderUvToRenderBoundsTranslate;
|
||
#endif
|
||
#if defined(CYLINDER_HAS_RENDER_BOUNDS_RADIUS_MIN) && !defined(CYLINDER_HAS_RENDER_BOUNDS_RADIUS_FLAT)
|
||
uniform float u_cylinderUvToRenderRadiusMin;
|
||
#endif
|
||
#if defined(CYLINDER_HAS_RENDER_BOUNDS_ANGLE)
|
||
uniform vec2 u_cylinderRenderAngleMinMax;
|
||
#endif
|
||
|
||
vec4 intersectHalfPlane(Ray ray, float angle) {
|
||
vec2 o = ray.pos.xy;
|
||
vec2 d = ray.dir.xy;
|
||
vec2 planeDirection = vec2(cos(angle), sin(angle));
|
||
vec2 planeNormal = vec2(planeDirection.y, -planeDirection.x);
|
||
|
||
float a = dot(o, planeNormal);
|
||
float b = dot(d, planeNormal);
|
||
float t = -a / b;
|
||
|
||
vec2 p = o + t * d;
|
||
bool outside = dot(p, planeDirection) < 0.0;
|
||
if (outside) return vec4(-INF_HIT, +INF_HIT, NO_HIT, NO_HIT);
|
||
|
||
return vec4(-INF_HIT, t, t, +INF_HIT);
|
||
}
|
||
|
||
#define POSITIVE_HIT vec2(t, +INF_HIT);
|
||
#define NEGATIVE_HIT vec2(-INF_HIT, t);
|
||
|
||
vec2 intersectHalfSpace(Ray ray, float angle)
|
||
{
|
||
vec2 o = ray.pos.xy;
|
||
vec2 d = ray.dir.xy;
|
||
vec2 n = vec2(sin(angle), -cos(angle));
|
||
|
||
float a = dot(o, n);
|
||
float b = dot(d, n);
|
||
float t = -a / b;
|
||
float s = sign(a);
|
||
|
||
// Half space cuts right through the camera, pick the side to intersect
|
||
if (a == 0.0) {
|
||
if (b >= 0.0) {
|
||
return POSITIVE_HIT;
|
||
} else {
|
||
return NEGATIVE_HIT;
|
||
}
|
||
}
|
||
|
||
if (t >= 0.0 != s >= 0.0) {
|
||
return POSITIVE_HIT;
|
||
} else {
|
||
return NEGATIVE_HIT;
|
||
}
|
||
}
|
||
|
||
vec2 intersectRegularWedge(Ray ray, float minAngle, float maxAngle)
|
||
{
|
||
vec2 o = ray.pos.xy;
|
||
vec2 d = ray.dir.xy;
|
||
vec2 n1 = vec2(sin(minAngle), -cos(minAngle));
|
||
vec2 n2 = vec2(-sin(maxAngle), cos(maxAngle));
|
||
|
||
float a1 = dot(o, n1);
|
||
float a2 = dot(o, n2);
|
||
float b1 = dot(d, n1);
|
||
float b2 = dot(d, n2);
|
||
|
||
float t1 = -a1 / b1;
|
||
float t2 = -a2 / b2;
|
||
float s1 = sign(a1);
|
||
float s2 = sign(a2);
|
||
|
||
float tmin = min(t1, t2);
|
||
float tmax = max(t1, t2);
|
||
float smin = tmin == t1 ? s1 : s2;
|
||
float smax = tmin == t1 ? s2 : s1;
|
||
|
||
bool e = tmin >= 0.0;
|
||
bool f = tmax >= 0.0;
|
||
bool g = smin >= 0.0;
|
||
bool h = smax >= 0.0;
|
||
|
||
if (e != g && f == h) return vec2(tmin, tmax);
|
||
else if (e == g && f == h) return vec2(-INF_HIT, tmin);
|
||
else if (e != g && f != h) return vec2(tmax, +INF_HIT);
|
||
else return vec2(NO_HIT);
|
||
}
|
||
|
||
vec4 intersectFlippedWedge(Ray ray, float minAngle, float maxAngle)
|
||
{
|
||
vec2 planeIntersectMin = intersectHalfSpace(ray, minAngle);
|
||
vec2 planeIntersectMax = intersectHalfSpace(ray, maxAngle + czm_pi);
|
||
return vec4(planeIntersectMin, planeIntersectMax);
|
||
}
|
||
|
||
vec2 intersectUnitCylinder(Ray ray)
|
||
{
|
||
vec3 o = ray.pos;
|
||
vec3 d = ray.dir;
|
||
|
||
float a = dot(d.xy, d.xy);
|
||
float b = dot(o.xy, d.xy);
|
||
float c = dot(o.xy, o.xy) - 1.0;
|
||
float det = b * b - a * c;
|
||
|
||
if (det < 0.0) {
|
||
return vec2(NO_HIT);
|
||
}
|
||
|
||
det = sqrt(det);
|
||
float ta = (-b - det) / a;
|
||
float tb = (-b + det) / a;
|
||
float t1 = min(ta, tb);
|
||
float t2 = max(ta, tb);
|
||
|
||
float z1 = o.z + t1 * d.z;
|
||
float z2 = o.z + t2 * d.z;
|
||
|
||
if (abs(z1) >= 1.0)
|
||
{
|
||
float tCap = (sign(z1) - o.z) / d.z;
|
||
t1 = abs(b + a * tCap) < det ? tCap : NO_HIT;
|
||
}
|
||
|
||
if (abs(z2) >= 1.0)
|
||
{
|
||
float tCap = (sign(z2) - o.z) / d.z;
|
||
t2 = abs(b + a * tCap) < det ? tCap : NO_HIT;
|
||
}
|
||
|
||
return vec2(t1, t2);
|
||
}
|
||
|
||
vec2 intersectUnitCircle(Ray ray) {
|
||
vec3 o = ray.pos;
|
||
vec3 d = ray.dir;
|
||
|
||
float t = -o.z / d.z;
|
||
vec2 zPlanePos = o.xy + d.xy * t;
|
||
float distSqr = dot(zPlanePos, zPlanePos);
|
||
|
||
if (distSqr > 1.0) {
|
||
return vec2(NO_HIT);
|
||
}
|
||
|
||
return vec2(t, t);
|
||
}
|
||
|
||
vec2 intersectInfiniteUnitCylinder(Ray ray)
|
||
{
|
||
vec3 o = ray.pos;
|
||
vec3 d = ray.dir;
|
||
|
||
float a = dot(d.xy, d.xy);
|
||
float b = dot(o.xy, d.xy);
|
||
float c = dot(o.xy, o.xy) - 1.0;
|
||
float det = b * b - a * c;
|
||
|
||
if (det < 0.0) {
|
||
return vec2(NO_HIT);
|
||
}
|
||
|
||
det = sqrt(det);
|
||
float t1 = (-b - det) / a;
|
||
float t2 = (-b + det) / a;
|
||
float tmin = min(t1, t2);
|
||
float tmax = max(t1, t2);
|
||
|
||
return vec2(tmin, tmax);
|
||
}
|
||
|
||
void intersectShape(Ray ray, inout Intersections ix)
|
||
{
|
||
#if defined(CYLINDER_HAS_RENDER_BOUNDS_RADIUS_MAX) || defined(CYLINDER_HAS_RENDER_BOUNDS_HEIGHT)
|
||
ray.pos = ray.pos * u_cylinderUvToRenderBoundsScale + u_cylinderUvToRenderBoundsTranslate;
|
||
ray.dir *= u_cylinderUvToRenderBoundsScale;
|
||
#else
|
||
// Position is converted from [0,1] to [-1,+1] because shape intersections assume unit space is [-1,+1].
|
||
// Direction is scaled as well to be in sync with position.
|
||
ray.pos = ray.pos * 2.0 - 1.0;
|
||
ray.dir *= 2.0;
|
||
#endif
|
||
|
||
#if defined(CYLINDER_HAS_RENDER_BOUNDS_HEIGHT_FLAT)
|
||
vec2 outerIntersect = intersectUnitCircle(ray);
|
||
#else
|
||
vec2 outerIntersect = intersectUnitCylinder(ray);
|
||
#endif
|
||
|
||
setIntersectionPair(ix, CYLINDER_INTERSECTION_INDEX_RADIUS_MAX, outerIntersect);
|
||
|
||
if (outerIntersect.x == NO_HIT) {
|
||
return;
|
||
}
|
||
|
||
#if defined(CYLINDER_HAS_RENDER_BOUNDS_RADIUS_FLAT)
|
||
// When the cylinder is perfectly thin it's necessary to sandwich the
|
||
// inner cylinder intersection inside the outer cylinder intersection.
|
||
|
||
// Without this special case,
|
||
// [outerMin, outerMax, innerMin, innerMax] will bubble sort to
|
||
// [outerMin, innerMin, outerMax, innerMax] which will cause the back
|
||
// side of the cylinder to be invisible because it will think the ray
|
||
// is still inside the inner (negative) cylinder after exiting the
|
||
// outer (positive) cylinder.
|
||
|
||
// With this special case,
|
||
// [outerMin, innerMin, innerMax, outerMax] will bubble sort to
|
||
// [outerMin, innerMin, innerMax, outerMax] which will work correctly.
|
||
|
||
// Note: If initializeIntersections() changes its sorting function
|
||
// from bubble sort to something else, this code may need to change.
|
||
vec2 innerIntersect = intersectInfiniteUnitCylinder(ray);
|
||
setIntersection(ix, 0, outerIntersect.x, true, true); // positive, enter
|
||
setIntersection(ix, 1, innerIntersect.x, false, true); // negative, enter
|
||
setIntersection(ix, 2, innerIntersect.y, false, false); // negative, exit
|
||
setIntersection(ix, 3, outerIntersect.y, true, false); // positive, exit
|
||
#elif defined(CYLINDER_HAS_RENDER_BOUNDS_RADIUS_MIN)
|
||
Ray innerRay = Ray(ray.pos * u_cylinderUvToRenderRadiusMin, ray.dir * u_cylinderUvToRenderRadiusMin);
|
||
vec2 innerIntersect = intersectInfiniteUnitCylinder(innerRay);
|
||
setIntersectionPair(ix, CYLINDER_INTERSECTION_INDEX_RADIUS_MIN, innerIntersect);
|
||
#endif
|
||
|
||
#if defined(CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_UNDER_HALF)
|
||
vec2 wedgeIntersect = intersectRegularWedge(ray, u_cylinderRenderAngleMinMax.x, u_cylinderRenderAngleMinMax.y);
|
||
setIntersectionPair(ix, CYLINDER_INTERSECTION_INDEX_ANGLE, wedgeIntersect);
|
||
#elif defined(CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_OVER_HALF)
|
||
vec4 wedgeIntersect = intersectFlippedWedge(ray, u_cylinderRenderAngleMinMax.x, u_cylinderRenderAngleMinMax.y);
|
||
setIntersectionPair(ix, CYLINDER_INTERSECTION_INDEX_ANGLE + 0, wedgeIntersect.xy);
|
||
setIntersectionPair(ix, CYLINDER_INTERSECTION_INDEX_ANGLE + 1, wedgeIntersect.zw);
|
||
#elif defined(CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_EQUAL_HALF)
|
||
vec2 wedgeIntersect = intersectHalfSpace(ray, u_cylinderRenderAngleMinMax.x);
|
||
setIntersectionPair(ix, CYLINDER_INTERSECTION_INDEX_ANGLE, wedgeIntersect);
|
||
#elif defined(CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_EQUAL_ZERO)
|
||
vec4 wedgeIntersect = intersectHalfPlane(ray, u_cylinderRenderAngleMinMax.x);
|
||
setIntersectionPair(ix, CYLINDER_INTERSECTION_INDEX_ANGLE + 0, wedgeIntersect.xy);
|
||
setIntersectionPair(ix, CYLINDER_INTERSECTION_INDEX_ANGLE + 1, wedgeIntersect.zw);
|
||
#endif
|
||
}
|
||
`,nyt=`// See IntersectionUtils.glsl for the definitions of Ray, Intersections,
|
||
// setIntersection, setIntersectionPair, INF_HIT, NO_HIT
|
||
|
||
/* Ellipsoid defines (set in Scene/VoxelEllipsoidShape.js)
|
||
#define ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE
|
||
#define ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_EQUAL_ZERO
|
||
#define ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_UNDER_HALF
|
||
#define ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_EQUAL_HALF
|
||
#define ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_OVER_HALF
|
||
#define ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE
|
||
#define ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_UNDER_HALF
|
||
#define ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_EQUAL_HALF
|
||
#define ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_OVER_HALF
|
||
#define ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_UNDER_HALF
|
||
#define ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_EQUAL_HALF
|
||
#define ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_OVER_HALF
|
||
#define ELLIPSOID_HAS_RENDER_BOUNDS_HEIGHT_MIN
|
||
#define ELLIPSOID_HAS_RENDER_BOUNDS_HEIGHT_FLAT
|
||
#define ELLIPSOID_INTERSECTION_INDEX_LONGITUDE
|
||
#define ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MAX
|
||
#define ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MIN
|
||
#define ELLIPSOID_INTERSECTION_INDEX_HEIGHT_MAX
|
||
#define ELLIPSOID_INTERSECTION_INDEX_HEIGHT_MIN
|
||
*/
|
||
|
||
#if defined(ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE)
|
||
uniform vec2 u_ellipsoidRenderLongitudeMinMax;
|
||
#endif
|
||
#if defined(ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_UNDER_HALF) || defined(ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_OVER_HALF) || defined(ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_UNDER_HALF) || defined(ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_OVER_HALF)
|
||
uniform vec2 u_ellipsoidRenderLatitudeCosSqrHalfMinMax;
|
||
#endif
|
||
#if defined(ELLIPSOID_HAS_RENDER_BOUNDS_HEIGHT_MIN)
|
||
uniform float u_ellipsoidInverseInnerScaleUv;
|
||
#endif
|
||
|
||
vec2 intersectZPlane(Ray ray)
|
||
{
|
||
float o = ray.pos.z;
|
||
float d = ray.dir.z;
|
||
float t = -o / d;
|
||
float s = sign(o);
|
||
|
||
if (t >= 0.0 != s >= 0.0) return vec2(t, +INF_HIT);
|
||
else return vec2(-INF_HIT, t);
|
||
}
|
||
|
||
vec4 intersectHalfPlane(Ray ray, float angle) {
|
||
vec2 o = ray.pos.xy;
|
||
vec2 d = ray.dir.xy;
|
||
vec2 planeDirection = vec2(cos(angle), sin(angle));
|
||
vec2 planeNormal = vec2(planeDirection.y, -planeDirection.x);
|
||
|
||
float a = dot(o, planeNormal);
|
||
float b = dot(d, planeNormal);
|
||
float t = -a / b;
|
||
|
||
vec2 p = o + t * d;
|
||
bool outside = dot(p, planeDirection) < 0.0;
|
||
if (outside) return vec4(-INF_HIT, +INF_HIT, NO_HIT, NO_HIT);
|
||
|
||
return vec4(-INF_HIT, t, t, +INF_HIT);
|
||
}
|
||
|
||
vec2 intersectHalfSpace(Ray ray, float angle)
|
||
{
|
||
vec2 o = ray.pos.xy;
|
||
vec2 d = ray.dir.xy;
|
||
vec2 n = vec2(sin(angle), -cos(angle));
|
||
|
||
float a = dot(o, n);
|
||
float b = dot(d, n);
|
||
float t = -a / b;
|
||
float s = sign(a);
|
||
|
||
if (t >= 0.0 != s >= 0.0) return vec2(t, +INF_HIT);
|
||
else return vec2(-INF_HIT, t);
|
||
}
|
||
|
||
vec2 intersectRegularWedge(Ray ray, float minAngle, float maxAngle)
|
||
{
|
||
vec2 o = ray.pos.xy;
|
||
vec2 d = ray.dir.xy;
|
||
vec2 n1 = vec2(sin(minAngle), -cos(minAngle));
|
||
vec2 n2 = vec2(-sin(maxAngle), cos(maxAngle));
|
||
|
||
float a1 = dot(o, n1);
|
||
float a2 = dot(o, n2);
|
||
float b1 = dot(d, n1);
|
||
float b2 = dot(d, n2);
|
||
|
||
float t1 = -a1 / b1;
|
||
float t2 = -a2 / b2;
|
||
float s1 = sign(a1);
|
||
float s2 = sign(a2);
|
||
|
||
float tmin = min(t1, t2);
|
||
float tmax = max(t1, t2);
|
||
float smin = tmin == t1 ? s1 : s2;
|
||
float smax = tmin == t1 ? s2 : s1;
|
||
|
||
bool e = tmin >= 0.0;
|
||
bool f = tmax >= 0.0;
|
||
bool g = smin >= 0.0;
|
||
bool h = smax >= 0.0;
|
||
|
||
if (e != g && f == h) return vec2(tmin, tmax);
|
||
else if (e == g && f == h) return vec2(-INF_HIT, tmin);
|
||
else if (e != g && f != h) return vec2(tmax, +INF_HIT);
|
||
else return vec2(NO_HIT);
|
||
}
|
||
|
||
vec4 intersectFlippedWedge(Ray ray, float minAngle, float maxAngle)
|
||
{
|
||
vec2 planeIntersectMin = intersectHalfSpace(ray, minAngle);
|
||
vec2 planeIntersectMax = intersectHalfSpace(ray, maxAngle + czm_pi);
|
||
return vec4(planeIntersectMin, planeIntersectMax);
|
||
}
|
||
|
||
vec2 intersectUnitSphere(Ray ray)
|
||
{
|
||
vec3 o = ray.pos;
|
||
vec3 d = ray.dir;
|
||
|
||
float b = dot(d, o);
|
||
float c = dot(o, o) - 1.0;
|
||
float det = b * b - c;
|
||
|
||
if (det < 0.0) {
|
||
return vec2(NO_HIT);
|
||
}
|
||
|
||
det = sqrt(det);
|
||
float t1 = -b - det;
|
||
float t2 = -b + det;
|
||
float tmin = min(t1, t2);
|
||
float tmax = max(t1, t2);
|
||
|
||
return vec2(tmin, tmax);
|
||
}
|
||
|
||
vec2 intersectUnitSphereUnnormalizedDirection(Ray ray)
|
||
{
|
||
vec3 o = ray.pos;
|
||
vec3 d = ray.dir;
|
||
|
||
float a = dot(d, d);
|
||
float b = dot(d, o);
|
||
float c = dot(o, o) - 1.0;
|
||
float det = b * b - a * c;
|
||
|
||
if (det < 0.0) {
|
||
return vec2(NO_HIT);
|
||
}
|
||
|
||
det = sqrt(det);
|
||
float t1 = (-b - det) / a;
|
||
float t2 = (-b + det) / a;
|
||
float tmin = min(t1, t2);
|
||
float tmax = max(t1, t2);
|
||
|
||
return vec2(tmin, tmax);
|
||
}
|
||
|
||
vec2 intersectDoubleEndedCone(Ray ray, float cosSqrHalfAngle)
|
||
{
|
||
vec3 o = ray.pos;
|
||
vec3 d = ray.dir;
|
||
float a = d.z * d.z - dot(d, d) * cosSqrHalfAngle;
|
||
float b = d.z * o.z - dot(o, d) * cosSqrHalfAngle;
|
||
float c = o.z * o.z - dot(o, o) * cosSqrHalfAngle;
|
||
float det = b * b - a * c;
|
||
|
||
if (det < 0.0) {
|
||
return vec2(NO_HIT);
|
||
}
|
||
|
||
det = sqrt(det);
|
||
float t1 = (-b - det) / a;
|
||
float t2 = (-b + det) / a;
|
||
float tmin = min(t1, t2);
|
||
float tmax = max(t1, t2);
|
||
return vec2(tmin, tmax);
|
||
}
|
||
|
||
vec4 intersectFlippedCone(Ray ray, float cosSqrHalfAngle) {
|
||
vec2 intersect = intersectDoubleEndedCone(ray, cosSqrHalfAngle);
|
||
|
||
if (intersect.x == NO_HIT) {
|
||
return vec4(-INF_HIT, +INF_HIT, NO_HIT, NO_HIT);
|
||
}
|
||
|
||
vec3 o = ray.pos;
|
||
vec3 d = ray.dir;
|
||
float tmin = intersect.x;
|
||
float tmax = intersect.y;
|
||
float zmin = o.z + tmin * d.z;
|
||
float zmax = o.z + tmax * d.z;
|
||
|
||
// One interval
|
||
if (zmin < 0.0 && zmax < 0.0) return vec4(-INF_HIT, +INF_HIT, NO_HIT, NO_HIT);
|
||
else if (zmin < 0.0) return vec4(-INF_HIT, tmax, NO_HIT, NO_HIT);
|
||
else if (zmax < 0.0) return vec4(tmin, +INF_HIT, NO_HIT, NO_HIT);
|
||
// Two intervals
|
||
else return vec4(-INF_HIT, tmin, tmax, +INF_HIT);
|
||
}
|
||
|
||
vec2 intersectRegularCone(Ray ray, float cosSqrHalfAngle) {
|
||
vec2 intersect = intersectDoubleEndedCone(ray, cosSqrHalfAngle);
|
||
|
||
if (intersect.x == NO_HIT) {
|
||
return vec2(NO_HIT);
|
||
}
|
||
|
||
vec3 o = ray.pos;
|
||
vec3 d = ray.dir;
|
||
float tmin = intersect.x;
|
||
float tmax = intersect.y;
|
||
float zmin = o.z + tmin * d.z;
|
||
float zmax = o.z + tmax * d.z;
|
||
|
||
if (zmin < 0.0 && zmax < 0.0) return vec2(NO_HIT);
|
||
else if (zmin < 0.0) return vec2(tmax, +INF_HIT);
|
||
else if (zmax < 0.0) return vec2(-INF_HIT, tmin);
|
||
else return vec2(tmin, tmax);
|
||
}
|
||
|
||
void intersectShape(in Ray ray, inout Intersections ix) {
|
||
// Position is converted from [0,1] to [-1,+1] because shape intersections assume unit space is [-1,+1].
|
||
// Direction is scaled as well to be in sync with position.
|
||
ray.pos = ray.pos * 2.0 - 1.0;
|
||
ray.dir *= 2.0;
|
||
|
||
// Outer ellipsoid
|
||
vec2 outerIntersect = intersectUnitSphereUnnormalizedDirection(ray);
|
||
setIntersectionPair(ix, ELLIPSOID_INTERSECTION_INDEX_HEIGHT_MAX, outerIntersect);
|
||
|
||
// Exit early if the outer ellipsoid was missed.
|
||
if (outerIntersect.x == NO_HIT) {
|
||
return;
|
||
}
|
||
|
||
// Inner ellipsoid
|
||
#if defined(ELLIPSOID_HAS_RENDER_BOUNDS_HEIGHT_FLAT)
|
||
// When the ellipsoid is perfectly thin it's necessary to sandwich the
|
||
// inner ellipsoid intersection inside the outer ellipsoid intersection.
|
||
|
||
// Without this special case,
|
||
// [outerMin, outerMax, innerMin, innerMax] will bubble sort to
|
||
// [outerMin, innerMin, outerMax, innerMax] which will cause the back
|
||
// side of the ellipsoid to be invisible because it will think the ray
|
||
// is still inside the inner (negative) ellipsoid after exiting the
|
||
// outer (positive) ellipsoid.
|
||
|
||
// With this special case,
|
||
// [outerMin, innerMin, innerMax, outerMax] will bubble sort to
|
||
// [outerMin, innerMin, innerMax, outerMax] which will work correctly.
|
||
|
||
// Note: If initializeIntersections() changes its sorting function
|
||
// from bubble sort to something else, this code may need to change.
|
||
setIntersection(ix, 0, outerIntersect.x, true, true); // positive, enter
|
||
setIntersection(ix, 1, outerIntersect.x, false, true); // negative, enter
|
||
setIntersection(ix, 2, outerIntersect.y, false, false); // negative, exit
|
||
setIntersection(ix, 3, outerIntersect.y, true, false); // positive, exit
|
||
#elif defined(ELLIPSOID_HAS_RENDER_BOUNDS_HEIGHT_MIN)
|
||
Ray innerRay = Ray(ray.pos * u_ellipsoidInverseInnerScaleUv, ray.dir * u_ellipsoidInverseInnerScaleUv);
|
||
vec2 innerIntersect = intersectUnitSphereUnnormalizedDirection(innerRay);
|
||
|
||
if (innerIntersect == vec2(NO_HIT)) {
|
||
setIntersectionPair(ix, ELLIPSOID_INTERSECTION_INDEX_HEIGHT_MIN, innerIntersect);
|
||
} else {
|
||
// When the ellipsoid is very large and thin it's possible for floating
|
||
// point math to cause the ray to intersect the inner ellipsoid before
|
||
// the outer ellipsoid. To prevent this from happening, clamp innerIntersect
|
||
// to outerIntersect and sandwhich the intersections like described above.
|
||
//
|
||
// In theory a similar fix is needed for cylinders, however it's more
|
||
// complicated to implement because the inner shape is allowed to be
|
||
// intersected first.
|
||
innerIntersect.x = max(innerIntersect.x, outerIntersect.x);
|
||
innerIntersect.y = min(innerIntersect.y, outerIntersect.y);
|
||
setIntersection(ix, 0, outerIntersect.x, true, true); // positive, enter
|
||
setIntersection(ix, 1, innerIntersect.x, false, true); // negative, enter
|
||
setIntersection(ix, 2, innerIntersect.y, false, false); // negative, exit
|
||
setIntersection(ix, 3, outerIntersect.y, true, false); // positive, exit
|
||
}
|
||
#endif
|
||
|
||
// Flip the ray because the intersection function expects a cone growing towards +Z.
|
||
#if defined(ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_UNDER_HALF) || defined(ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_EQUAL_HALF) || defined(ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_UNDER_HALF)
|
||
Ray flippedRay = ray;
|
||
flippedRay.dir.z *= -1.0;
|
||
flippedRay.pos.z *= -1.0;
|
||
#endif
|
||
|
||
// Bottom cone
|
||
#if defined(ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_UNDER_HALF)
|
||
vec2 bottomConeIntersection = intersectRegularCone(flippedRay, u_ellipsoidRenderLatitudeCosSqrHalfMinMax.x);
|
||
setIntersectionPair(ix, ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MIN, bottomConeIntersection);
|
||
#elif defined(ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_EQUAL_HALF)
|
||
vec2 bottomConeIntersection = intersectZPlane(flippedRay);
|
||
setIntersectionPair(ix, ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MIN, bottomConeIntersection);
|
||
#elif defined(ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_OVER_HALF)
|
||
vec4 bottomConeIntersection = intersectFlippedCone(ray, u_ellipsoidRenderLatitudeCosSqrHalfMinMax.x);
|
||
setIntersectionPair(ix, ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MIN + 0, bottomConeIntersection.xy);
|
||
setIntersectionPair(ix, ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MIN + 1, bottomConeIntersection.zw);
|
||
#endif
|
||
|
||
// Top cone
|
||
#if defined(ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_UNDER_HALF)
|
||
vec4 topConeIntersection = intersectFlippedCone(flippedRay, u_ellipsoidRenderLatitudeCosSqrHalfMinMax.y);
|
||
setIntersectionPair(ix, ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MAX + 0, topConeIntersection.xy);
|
||
setIntersectionPair(ix, ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MAX + 1, topConeIntersection.zw);
|
||
#elif defined(ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_EQUAL_HALF)
|
||
vec2 topConeIntersection = intersectZPlane(ray);
|
||
setIntersectionPair(ix, ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MAX, topConeIntersection);
|
||
#elif defined(ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_OVER_HALF)
|
||
vec2 topConeIntersection = intersectRegularCone(ray, u_ellipsoidRenderLatitudeCosSqrHalfMinMax.y);
|
||
setIntersectionPair(ix, ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MAX, topConeIntersection);
|
||
#endif
|
||
|
||
// Wedge
|
||
#if defined(ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_EQUAL_ZERO)
|
||
vec4 wedgeIntersect = intersectHalfPlane(ray, u_ellipsoidRenderLongitudeMinMax.x);
|
||
setIntersectionPair(ix, ELLIPSOID_INTERSECTION_INDEX_LONGITUDE + 0, wedgeIntersect.xy);
|
||
setIntersectionPair(ix, ELLIPSOID_INTERSECTION_INDEX_LONGITUDE + 1, wedgeIntersect.zw);
|
||
#elif defined(ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_UNDER_HALF)
|
||
vec2 wedgeIntersect = intersectRegularWedge(ray, u_ellipsoidRenderLongitudeMinMax.x, u_ellipsoidRenderLongitudeMinMax.y);
|
||
setIntersectionPair(ix, ELLIPSOID_INTERSECTION_INDEX_LONGITUDE, wedgeIntersect);
|
||
#elif defined(ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_EQUAL_HALF)
|
||
vec2 wedgeIntersect = intersectHalfSpace(ray, u_ellipsoidRenderLongitudeMinMax.x);
|
||
setIntersectionPair(ix, ELLIPSOID_INTERSECTION_INDEX_LONGITUDE, wedgeIntersect);
|
||
#elif defined(ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_OVER_HALF)
|
||
vec4 wedgeIntersect = intersectFlippedWedge(ray, u_ellipsoidRenderLongitudeMinMax.x, u_ellipsoidRenderLongitudeMinMax.y);
|
||
setIntersectionPair(ix, ELLIPSOID_INTERSECTION_INDEX_LONGITUDE + 0, wedgeIntersect.xy);
|
||
setIntersectionPair(ix, ELLIPSOID_INTERSECTION_INDEX_LONGITUDE + 1, wedgeIntersect.zw);
|
||
#endif
|
||
}
|
||
`,XN=`// Main intersection function for Voxel scenes.
|
||
// See IntersectBox.glsl, IntersectCylinder.glsl, or IntersectEllipsoid.glsl
|
||
// for the definition of intersectShape. The appropriate function is selected
|
||
// based on the VoxelPrimitive shape type, and added to the shader in
|
||
// Scene/VoxelRenderResources.js.
|
||
// See also IntersectClippingPlane.glsl and IntersectDepth.glsl.
|
||
// See IntersectionUtils.glsl for the definitions of Ray, NO_HIT,
|
||
// getIntersectionPair, initializeIntersections, nextIntersection.
|
||
|
||
/* Intersection defines (set in Scene/VoxelRenderResources.js)
|
||
#define INTERSECTION_COUNT ###
|
||
*/
|
||
|
||
vec2 intersectScene(vec2 screenCoord, vec3 positionUv, vec3 directionUv, out Intersections ix) {
|
||
Ray ray = Ray(positionUv, directionUv);
|
||
|
||
// Do a ray-shape intersection to find the exact starting and ending points.
|
||
intersectShape(ray, ix);
|
||
|
||
// Exit early if the positive shape was completely missed or behind the ray.
|
||
vec2 entryExitT = getIntersectionPair(ix, 0);
|
||
if (entryExitT.x == NO_HIT) {
|
||
// Positive shape was completely missed - so exit early.
|
||
return vec2(NO_HIT);
|
||
}
|
||
|
||
// Clipping planes
|
||
#if defined(CLIPPING_PLANES)
|
||
intersectClippingPlanes(ray, ix);
|
||
#endif
|
||
|
||
// Depth
|
||
#if defined(DEPTH_TEST)
|
||
intersectDepth(screenCoord, ray, ix);
|
||
#endif
|
||
|
||
// Find the first intersection that's in front of the ray
|
||
#if (INTERSECTION_COUNT > 1)
|
||
initializeIntersections(ix);
|
||
for (int i = 0; i < INTERSECTION_COUNT; ++i) {
|
||
entryExitT = nextIntersection(ix);
|
||
if (entryExitT.y > 0.0) {
|
||
// Set start to 0.0 when ray is inside the shape.
|
||
entryExitT.x = max(entryExitT.x, 0.0);
|
||
break;
|
||
}
|
||
}
|
||
#else
|
||
// Set start to 0.0 when ray is inside the shape.
|
||
entryExitT.x = max(entryExitT.x, 0.0);
|
||
#endif
|
||
|
||
return entryExitT;
|
||
}
|
||
`,iyt=`/* Box defines (set in Scene/VoxelBoxShape.js)
|
||
#define BOX_HAS_SHAPE_BOUNDS
|
||
*/
|
||
|
||
#if defined(BOX_HAS_SHAPE_BOUNDS)
|
||
uniform vec3 u_boxUvToShapeUvScale;
|
||
uniform vec3 u_boxUvToShapeUvTranslate;
|
||
#endif
|
||
|
||
vec3 convertUvToShapeUvSpace(in vec3 positionUv) {
|
||
#if defined(BOX_HAS_SHAPE_BOUNDS)
|
||
return positionUv * u_boxUvToShapeUvScale + u_boxUvToShapeUvTranslate;
|
||
#else
|
||
return positionUv;
|
||
#endif
|
||
}
|
||
`,oyt=`/* Cylinder defines (set in Scene/VoxelCylinderShape.js)
|
||
#define CYLINDER_HAS_RENDER_BOUNDS_RADIUS_FLAT
|
||
#define CYLINDER_HAS_RENDER_BOUNDS_HEIGHT_FLAT
|
||
#define CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_EQUAL_ZERO
|
||
|
||
#define CYLINDER_HAS_SHAPE_BOUNDS_RADIUS
|
||
#define CYLINDER_HAS_SHAPE_BOUNDS_RADIUS_FLAT
|
||
#define CYLINDER_HAS_SHAPE_BOUNDS_HEIGHT
|
||
#define CYLINDER_HAS_SHAPE_BOUNDS_HEIGHT_FLAT
|
||
#define CYLINDER_HAS_SHAPE_BOUNDS_ANGLE
|
||
#define CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_RANGE_EQUAL_ZERO
|
||
#define CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MIN_DISCONTINUITY
|
||
#define CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MAX_DISCONTINUITY
|
||
#define CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MIN_MAX_REVERSED
|
||
*/
|
||
|
||
#if defined(CYLINDER_HAS_SHAPE_BOUNDS_RADIUS)
|
||
uniform vec2 u_cylinderUvToShapeUvRadius; // x = scale, y = offset
|
||
#endif
|
||
#if defined(CYLINDER_HAS_SHAPE_BOUNDS_HEIGHT)
|
||
uniform vec2 u_cylinderUvToShapeUvHeight; // x = scale, y = offset
|
||
#endif
|
||
#if defined(CYLINDER_HAS_SHAPE_BOUNDS_ANGLE)
|
||
uniform vec2 u_cylinderUvToShapeUvAngle; // x = scale, y = offset
|
||
#endif
|
||
#if defined(CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MIN_DISCONTINUITY) || defined(CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MAX_DISCONTINUITY)
|
||
uniform vec2 u_cylinderShapeUvAngleMinMax;
|
||
#endif
|
||
#if defined(CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MIN_DISCONTINUITY) || defined(CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MAX_DISCONTINUITY) || defined(CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MIN_MAX_REVERSED)
|
||
uniform float u_cylinderShapeUvAngleRangeZeroMid;
|
||
#endif
|
||
|
||
vec3 convertUvToShapeUvSpace(in vec3 positionUv) {
|
||
vec3 positionLocal = positionUv * 2.0 - 1.0; // [-1,+1]
|
||
|
||
// Compute radius
|
||
#if defined(CYLINDER_HAS_SHAPE_BOUNDS_RADIUS_FLAT) || defined(CYLINDER_HAS_RENDER_BOUNDS_RADIUS_FLAT)
|
||
float radius = length(positionLocal.xy); // [0,1]
|
||
#else
|
||
float radius = length(positionLocal.xy); // [0,1]
|
||
#if defined(CYLINDER_HAS_SHAPE_BOUNDS_RADIUS)
|
||
radius = radius * u_cylinderUvToShapeUvRadius.x + u_cylinderUvToShapeUvRadius.y; // x = scale, y = offset
|
||
#endif
|
||
#endif
|
||
|
||
// Compute height
|
||
#if defined(CYLINDER_HAS_SHAPE_BOUNDS_HEIGHT_FLAT) || defined(CYLINDER_HAS_RENDER_BOUNDS_HEIGHT_FLAT)
|
||
float height = positionUv.z; // [0,1]
|
||
#else
|
||
float height = positionUv.z; // [0,1]
|
||
#if defined(CYLINDER_HAS_SHAPE_BOUNDS_HEIGHT)
|
||
height = height * u_cylinderUvToShapeUvHeight.x + u_cylinderUvToShapeUvHeight.y; // x = scale, y = offset
|
||
#endif
|
||
#endif
|
||
|
||
// Compute angle
|
||
#if defined(CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_RANGE_EQUAL_ZERO) || defined(CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_EQUAL_ZERO)
|
||
float angle = 1.0;
|
||
#else
|
||
float angle = (atan(positionLocal.y, positionLocal.x) + czm_pi) / czm_twoPi; // [0,1]
|
||
#if defined(CYLINDER_HAS_SHAPE_BOUNDS_ANGLE)
|
||
#if defined(CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MIN_MAX_REVERSED)
|
||
// Comparing against u_cylinderShapeUvAngleMinMax has precision problems. u_cylinderShapeUvAngleRangeZeroMid is more conservative.
|
||
angle += float(angle < u_cylinderShapeUvAngleRangeZeroMid);
|
||
#endif
|
||
|
||
// Avoid flickering from reading voxels from both sides of the -pi/+pi discontinuity.
|
||
#if defined(CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MIN_DISCONTINUITY)
|
||
angle = angle > u_cylinderShapeUvAngleRangeZeroMid ? u_cylinderShapeUvAngleMinMax.x : angle;
|
||
#elif defined(CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MAX_DISCONTINUITY)
|
||
angle = angle < u_cylinderShapeUvAngleRangeZeroMid ? u_cylinderShapeUvAngleMinMax.y : angle;
|
||
#endif
|
||
|
||
angle = angle * u_cylinderUvToShapeUvAngle.x + u_cylinderUvToShapeUvAngle.y; // x = scale, y = offset
|
||
#endif
|
||
#endif
|
||
|
||
return vec3(radius, height, angle);
|
||
}
|
||
`,ryt=`/* Ellipsoid defines (set in Scene/VoxelEllipsoidShape.js)
|
||
#define ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_EQUAL_ZERO
|
||
#define ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_MIN_DISCONTINUITY
|
||
#define ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_MAX_DISCONTINUITY
|
||
#define ELLIPSOID_HAS_SHAPE_BOUNDS_LONGITUDE
|
||
#define ELLIPSOID_HAS_SHAPE_BOUNDS_LONGITUDE_RANGE_EQUAL_ZERO
|
||
#define ELLIPSOID_HAS_SHAPE_BOUNDS_LONGITUDE_MIN_MAX_REVERSED
|
||
#define ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_RANGE_EQUAL_ZERO
|
||
#define ELLIPSOID_HAS_SHAPE_BOUNDS_LATITUDE
|
||
#define ELLIPSOID_HAS_SHAPE_BOUNDS_LATITUDE_RANGE_EQUAL_ZERO
|
||
#define ELLIPSOID_HAS_RENDER_BOUNDS_HEIGHT_FLAT
|
||
#define ELLIPSOID_HAS_SHAPE_BOUNDS_HEIGHT_MIN
|
||
#define ELLIPSOID_HAS_SHAPE_BOUNDS_HEIGHT_FLAT
|
||
#define ELLIPSOID_IS_SPHERE
|
||
*/
|
||
|
||
uniform vec3 u_ellipsoidRadiiUv; // [0,1]
|
||
#if !defined(ELLIPSOID_IS_SPHERE)
|
||
uniform vec3 u_ellipsoidInverseRadiiSquaredUv;
|
||
#endif
|
||
#if defined(ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_MIN_DISCONTINUITY) || defined(ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_MAX_DISCONTINUITY) || defined(ELLIPSOID_HAS_SHAPE_BOUNDS_LONGITUDE_MIN_MAX_REVERSED)
|
||
uniform vec3 u_ellipsoidShapeUvLongitudeMinMaxMid;
|
||
#endif
|
||
#if defined(ELLIPSOID_HAS_SHAPE_BOUNDS_LONGITUDE)
|
||
uniform vec2 u_ellipsoidUvToShapeUvLongitude; // x = scale, y = offset
|
||
#endif
|
||
#if defined(ELLIPSOID_HAS_SHAPE_BOUNDS_LATITUDE)
|
||
uniform vec2 u_ellipsoidUvToShapeUvLatitude; // x = scale, y = offset
|
||
#endif
|
||
#if defined(ELLIPSOID_HAS_SHAPE_BOUNDS_HEIGHT_MIN) && !defined(ELLIPSOID_HAS_SHAPE_BOUNDS_HEIGHT_FLAT)
|
||
uniform float u_ellipsoidInverseHeightDifferenceUv;
|
||
uniform vec2 u_ellipseInnerRadiiUv; // [0,1]
|
||
#endif
|
||
|
||
// robust iterative solution without trig functions
|
||
// https://github.com/0xfaded/ellipse_demo/issues/1
|
||
// https://stackoverflow.com/questions/22959698/distance-from-given-point-to-given-ellipse
|
||
// Pro: Good when radii.x ~= radii.y
|
||
// Con: Breaks at pos.x ~= 0.0, especially inside the ellipse
|
||
// Con: Inaccurate with exterior points and thin ellipses
|
||
float ellipseDistanceIterative (vec2 pos, vec2 radii) {
|
||
vec2 p = abs(pos);
|
||
vec2 invRadii = 1.0 / radii;
|
||
vec2 a = vec2(1.0, -1.0) * (radii.x * radii.x - radii.y * radii.y) * invRadii;
|
||
vec2 t = vec2(0.70710678118); // sqrt(2) / 2
|
||
vec2 v = radii * t;
|
||
|
||
const int iterations = 3;
|
||
for (int i = 0; i < iterations; ++i) {
|
||
vec2 e = a * pow(t, vec2(3.0));
|
||
vec2 q = normalize(p - e) * length(v - e);
|
||
t = normalize((q + e) * invRadii);
|
||
v = radii * t;
|
||
}
|
||
return length(v * sign(pos) - pos) * sign(p.y - v.y);
|
||
}
|
||
|
||
vec3 convertUvToShapeUvSpace(in vec3 positionUv) {
|
||
// Compute position and normal.
|
||
// Convert positionUv [0,1] to local space [-1,+1] to "normalized" cartesian space [-a,+a] where a = (radii + height) / (max(radii) + height).
|
||
// A point on the largest ellipsoid axis would be [-1,+1] and everything else would be smaller.
|
||
vec3 positionLocal = positionUv * 2.0 - 1.0;
|
||
#if defined(ELLIPSOID_IS_SPHERE)
|
||
vec3 posEllipsoid = positionLocal * u_ellipsoidRadiiUv.x;
|
||
vec3 normal = normalize(posEllipsoid);
|
||
#else
|
||
vec3 posEllipsoid = positionLocal * u_ellipsoidRadiiUv;
|
||
vec3 normal = normalize(posEllipsoid * u_ellipsoidInverseRadiiSquaredUv); // geodetic surface normal
|
||
#endif
|
||
|
||
// Compute longitude
|
||
#if defined(ELLIPSOID_HAS_SHAPE_BOUNDS_LONGITUDE_RANGE_EQUAL_ZERO) || defined(ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_EQUAL_ZERO)
|
||
float longitude = 1.0;
|
||
#else
|
||
float longitude = (atan(normal.y, normal.x) + czm_pi) / czm_twoPi;
|
||
|
||
// Correct the angle when max < min
|
||
// Technically this should compare against min longitude - but it has precision problems so compare against the middle of empty space.
|
||
#if defined(ELLIPSOID_HAS_SHAPE_BOUNDS_LONGITUDE_MIN_MAX_REVERSED)
|
||
longitude += float(longitude < u_ellipsoidShapeUvLongitudeMinMaxMid.z);
|
||
#endif
|
||
|
||
// Avoid flickering from reading voxels from both sides of the -pi/+pi discontinuity.
|
||
#if defined(ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_MIN_DISCONTINUITY)
|
||
longitude = longitude > u_ellipsoidShapeUvLongitudeMinMaxMid.z ? u_ellipsoidShapeUvLongitudeMinMaxMid.x : longitude;
|
||
#endif
|
||
#if defined(ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_MAX_DISCONTINUITY)
|
||
longitude = longitude < u_ellipsoidShapeUvLongitudeMinMaxMid.z ? u_ellipsoidShapeUvLongitudeMinMaxMid.y : longitude;
|
||
#endif
|
||
|
||
#if defined(ELLIPSOID_HAS_SHAPE_BOUNDS_LONGITUDE)
|
||
longitude = longitude * u_ellipsoidUvToShapeUvLongitude.x + u_ellipsoidUvToShapeUvLongitude.y;
|
||
#endif
|
||
#endif
|
||
|
||
// Compute latitude
|
||
#if defined(ELLIPSOID_HAS_SHAPE_BOUNDS_LATITUDE_RANGE_EQUAL_ZERO) || defined(ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_RANGE_EQUAL_ZERO)
|
||
float latitude = 1.0;
|
||
#else
|
||
float latitude = (asin(normal.z) + czm_piOverTwo) / czm_pi;
|
||
#if defined(ELLIPSOID_HAS_SHAPE_BOUNDS_LATITUDE)
|
||
latitude = latitude * u_ellipsoidUvToShapeUvLatitude.x + u_ellipsoidUvToShapeUvLatitude.y;
|
||
#endif
|
||
#endif
|
||
|
||
// Compute height
|
||
#if defined(ELLIPSOID_HAS_SHAPE_BOUNDS_HEIGHT_FLAT) || defined(ELLIPSOID_HAS_RENDER_BOUNDS_HEIGHT_FLAT)
|
||
// TODO: This breaks down when minBounds == maxBounds. To fix it, this
|
||
// function would have to know if ray is intersecting the front or back of the shape
|
||
// and set the shape space position to 1 (front) or 0 (back) accordingly.
|
||
float height = 1.0;
|
||
#else
|
||
#if defined(ELLIPSOID_IS_SPHERE)
|
||
#if defined(ELLIPSOID_HAS_SHAPE_BOUNDS_HEIGHT_MIN)
|
||
float height = (length(posEllipsoid) - u_ellipseInnerRadiiUv.x) * u_ellipsoidInverseHeightDifferenceUv;
|
||
#else
|
||
float height = length(posEllipsoid);
|
||
#endif
|
||
#else
|
||
#if defined(ELLIPSOID_HAS_SHAPE_BOUNDS_HEIGHT_MIN)
|
||
// Convert the 3D position to a 2D position relative to the ellipse (radii.x, radii.z) (assuming radii.x == radii.y which is true for WGS84).
|
||
// This is an optimization so that math can be done with ellipses instead of ellipsoids.
|
||
vec2 posEllipse = vec2(length(posEllipsoid.xy), posEllipsoid.z);
|
||
float height = ellipseDistanceIterative(posEllipse, u_ellipseInnerRadiiUv) * u_ellipsoidInverseHeightDifferenceUv;
|
||
#else
|
||
// TODO: this is probably not correct
|
||
float height = length(posEllipsoid);
|
||
#endif
|
||
#endif
|
||
#endif
|
||
|
||
return vec3(longitude, latitude, height);
|
||
}
|
||
`,syt=`// These octree flags must be in sync with GpuOctreeFlag in VoxelTraversal.js
|
||
#define OCTREE_FLAG_INTERNAL 0
|
||
#define OCTREE_FLAG_LEAF 1
|
||
#define OCTREE_FLAG_PACKED_LEAF_FROM_PARENT 2
|
||
|
||
#define OCTREE_MAX_LEVELS 32 // Harcoded value because GLSL doesn't like variable length loops
|
||
|
||
uniform sampler2D u_octreeInternalNodeTexture;
|
||
uniform vec2 u_octreeInternalNodeTexelSizeUv;
|
||
uniform int u_octreeInternalNodeTilesPerRow;
|
||
uniform sampler2D u_octreeLeafNodeTexture;
|
||
uniform vec2 u_octreeLeafNodeTexelSizeUv;
|
||
uniform int u_octreeLeafNodeTilesPerRow;
|
||
|
||
uniform float u_stepSize;
|
||
|
||
struct OctreeNodeData {
|
||
int data;
|
||
int flag;
|
||
};
|
||
|
||
struct TraversalData {
|
||
float stepT;
|
||
ivec4 octreeCoords;
|
||
int parentOctreeIndex;
|
||
};
|
||
|
||
struct SampleData {
|
||
int megatextureIndex;
|
||
bool usingParentMegatextureIndex;
|
||
vec3 tileUv;
|
||
#if (SAMPLE_COUNT > 1)
|
||
float weight;
|
||
#endif
|
||
};
|
||
|
||
// Integer mod: For WebGL1 only
|
||
int intMod(in int a, in int b) {
|
||
return a - (b * (a / b));
|
||
}
|
||
int normU8_toInt(in float value) {
|
||
return int(value * 255.0);
|
||
}
|
||
int normU8x2_toInt(in vec2 value) {
|
||
return int(value.x * 255.0) + 256 * int(value.y * 255.0);
|
||
}
|
||
float normU8x2_toFloat(in vec2 value) {
|
||
return float(normU8x2_toInt(value)) / 65535.0;
|
||
}
|
||
|
||
OctreeNodeData getOctreeNodeData(in vec2 octreeUv) {
|
||
vec4 texData = texture2D(u_octreeInternalNodeTexture, octreeUv);
|
||
|
||
OctreeNodeData data;
|
||
data.data = normU8x2_toInt(texData.xy);
|
||
data.flag = normU8x2_toInt(texData.zw);
|
||
return data;
|
||
}
|
||
|
||
OctreeNodeData getOctreeChildData(in int parentOctreeIndex, in ivec3 childCoord) {
|
||
int childIndex = childCoord.z * 4 + childCoord.y * 2 + childCoord.x;
|
||
int octreeCoordX = intMod(parentOctreeIndex, u_octreeInternalNodeTilesPerRow) * 9 + 1 + childIndex;
|
||
int octreeCoordY = parentOctreeIndex / u_octreeInternalNodeTilesPerRow;
|
||
vec2 octreeUv = u_octreeInternalNodeTexelSizeUv * vec2(float(octreeCoordX) + 0.5, float(octreeCoordY) + 0.5);
|
||
return getOctreeNodeData(octreeUv);
|
||
}
|
||
|
||
int getOctreeParentIndex(in int octreeIndex) {
|
||
int octreeCoordX = intMod(octreeIndex, u_octreeInternalNodeTilesPerRow) * 9;
|
||
int octreeCoordY = octreeIndex / u_octreeInternalNodeTilesPerRow;
|
||
vec2 octreeUv = u_octreeInternalNodeTexelSizeUv * vec2(float(octreeCoordX) + 0.5, float(octreeCoordY) + 0.5);
|
||
vec4 parentData = texture2D(u_octreeInternalNodeTexture, octreeUv);
|
||
int parentOctreeIndex = normU8x2_toInt(parentData.xy);
|
||
return parentOctreeIndex;
|
||
}
|
||
|
||
/**
|
||
* Convert a position in the uv-space of the tileset bounding shape
|
||
* into the uv-space of a tile within the tileset
|
||
*/
|
||
vec3 getTileUv(in vec3 shapePosition, in ivec4 octreeCoords) {
|
||
// TODO: use bit-shifting (only in WebGL2)
|
||
float dimAtLevel = pow(2.0, float(octreeCoords.w));
|
||
return shapePosition * dimAtLevel - vec3(octreeCoords.xyz);
|
||
}
|
||
|
||
void setSampleUv(in vec3 shapePosition, in ivec4 octreeCoords, inout SampleData sampleData) {
|
||
ivec4 sampleCoords = sampleData.usingParentMegatextureIndex
|
||
? ivec4(octreeCoords.xyz / 2, octreeCoords.w - 1)
|
||
: octreeCoords;
|
||
sampleData.tileUv = getTileUv(shapePosition, sampleCoords);
|
||
}
|
||
|
||
void getOctreeLeafSampleData(in OctreeNodeData data, out SampleData sampleData) {
|
||
sampleData.megatextureIndex = data.data;
|
||
sampleData.usingParentMegatextureIndex = data.flag == OCTREE_FLAG_PACKED_LEAF_FROM_PARENT;
|
||
}
|
||
|
||
#if (SAMPLE_COUNT > 1)
|
||
void getOctreeLeafSampleDatas(in OctreeNodeData data, out SampleData sampleData0, out SampleData sampleData1) {
|
||
int leafIndex = data.data;
|
||
int leafNodeTexelCount = 2;
|
||
// Adding 0.5 moves to the center of the texel
|
||
float leafCoordXStart = float(intMod(leafIndex, u_octreeLeafNodeTilesPerRow) * leafNodeTexelCount) + 0.5;
|
||
float leafCoordY = float(leafIndex / u_octreeLeafNodeTilesPerRow) + 0.5;
|
||
|
||
vec2 leafUv0 = u_octreeLeafNodeTexelSizeUv * vec2(leafCoordXStart + 0.0, leafCoordY);
|
||
vec2 leafUv1 = u_octreeLeafNodeTexelSizeUv * vec2(leafCoordXStart + 1.0, leafCoordY);
|
||
vec4 leafData0 = texture2D(u_octreeLeafNodeTexture, leafUv0);
|
||
vec4 leafData1 = texture2D(u_octreeLeafNodeTexture, leafUv1);
|
||
|
||
float lerp = normU8x2_toFloat(leafData0.xy);
|
||
|
||
sampleData0.megatextureIndex = normU8x2_toInt(leafData1.xy);
|
||
sampleData1.megatextureIndex = normU8x2_toInt(leafData1.zw);
|
||
// TODO: this looks wrong? Should be comparing to OCTREE_FLAG_PACKED_LEAF_FROM_PARENT
|
||
sampleData0.usingParentMegatextureIndex = normU8_toInt(leafData0.z) == 1;
|
||
sampleData1.usingParentMegatextureIndex = normU8_toInt(leafData0.w) == 1;
|
||
sampleData0.weight = 1.0 - lerp;
|
||
sampleData1.weight = lerp;
|
||
}
|
||
#endif
|
||
|
||
void traverseOctreeDownwards(in vec3 shapePosition, inout TraversalData traversalData, out SampleData sampleDatas[SAMPLE_COUNT]) {
|
||
float sizeAtLevel = 1.0 / pow(2.0, float(traversalData.octreeCoords.w));
|
||
vec3 start = vec3(traversalData.octreeCoords.xyz) * sizeAtLevel;
|
||
vec3 end = start + vec3(sizeAtLevel);
|
||
|
||
for (int i = 0; i < OCTREE_MAX_LEVELS; ++i) {
|
||
// Find out which octree child contains the position
|
||
// 0 if before center, 1 if after
|
||
vec3 center = 0.5 * (start + end);
|
||
vec3 childCoord = step(center, shapePosition);
|
||
|
||
OctreeNodeData childData = getOctreeChildData(traversalData.parentOctreeIndex, ivec3(childCoord));
|
||
|
||
// Get octree coords for the next level down
|
||
ivec4 octreeCoords = traversalData.octreeCoords;
|
||
traversalData.octreeCoords = ivec4(octreeCoords.xyz * 2 + ivec3(childCoord), octreeCoords.w + 1);
|
||
|
||
if (childData.flag == OCTREE_FLAG_INTERNAL) {
|
||
// interior tile - keep going deeper
|
||
start = mix(start, center, childCoord);
|
||
end = mix(center, end, childCoord);
|
||
traversalData.parentOctreeIndex = childData.data;
|
||
} else {
|
||
// leaf tile - stop traversing
|
||
float dimAtLevel = pow(2.0, float(traversalData.octreeCoords.w));
|
||
traversalData.stepT = u_stepSize / dimAtLevel;
|
||
#if (SAMPLE_COUNT == 1)
|
||
getOctreeLeafSampleData(childData, sampleDatas[0]);
|
||
setSampleUv(shapePosition, traversalData.octreeCoords, sampleDatas[0]);
|
||
#else
|
||
getOctreeLeafSampleDatas(childData, sampleDatas[0], sampleDatas[1]);
|
||
setSampleUv(shapePosition, traversalData.octreeCoords, sampleDatas[0]);
|
||
setSampleUv(shapePosition, traversalData.octreeCoords, sampleDatas[1]);
|
||
#endif
|
||
return;
|
||
}
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Transform a given position to an octree tile coordinate and a position within that tile,
|
||
* and find the corresponding megatexture index and texture coordinates
|
||
*/
|
||
void traverseOctreeFromBeginning(in vec3 shapePosition, out TraversalData traversalData, out SampleData sampleDatas[SAMPLE_COUNT]) {
|
||
traversalData.octreeCoords = ivec4(0);
|
||
traversalData.parentOctreeIndex = 0;
|
||
|
||
OctreeNodeData rootData = getOctreeNodeData(vec2(0.0));
|
||
if (rootData.flag == OCTREE_FLAG_LEAF) {
|
||
// No child data, only the root tile has data
|
||
traversalData.stepT = u_stepSize;
|
||
#if (SAMPLE_COUNT == 1)
|
||
getOctreeLeafSampleData(rootData, sampleDatas[0]);
|
||
setSampleUv(shapePosition, traversalData.octreeCoords, sampleDatas[0]);
|
||
#else
|
||
getOctreeLeafSampleDatas(rootData, sampleDatas[0], sampleDatas[1]);
|
||
setSampleUv(shapePosition, traversalData.octreeCoords, sampleDatas[0]);
|
||
setSampleUv(shapePosition, traversalData.octreeCoords, sampleDatas[1]);
|
||
#endif
|
||
} else {
|
||
traverseOctreeDownwards(shapePosition, traversalData, sampleDatas);
|
||
}
|
||
}
|
||
|
||
bool inRange(in vec3 v, in vec3 minVal, in vec3 maxVal) {
|
||
return clamp(v, minVal, maxVal) == v;
|
||
}
|
||
|
||
bool insideTile(in vec3 shapePosition, in ivec4 octreeCoords) {
|
||
vec3 tileUv = getTileUv(shapePosition, octreeCoords);
|
||
bool inside = inRange(tileUv, vec3(0.0), vec3(1.0));
|
||
// Assume (!) the position is always inside the root tile.
|
||
return inside || octreeCoords.w == 0;
|
||
}
|
||
|
||
void traverseOctreeFromExisting(in vec3 shapePosition, inout TraversalData traversalData, inout SampleData sampleDatas[SAMPLE_COUNT]) {
|
||
if (insideTile(shapePosition, traversalData.octreeCoords)) {
|
||
for (int i = 0; i < SAMPLE_COUNT; i++) {
|
||
setSampleUv(shapePosition, traversalData.octreeCoords, sampleDatas[i]);
|
||
}
|
||
} else {
|
||
// Go up tree
|
||
for (int i = 0; i < OCTREE_MAX_LEVELS; ++i)
|
||
{
|
||
traversalData.octreeCoords.xyz /= 2;
|
||
traversalData.octreeCoords.w -= 1;
|
||
|
||
if (!insideTile(shapePosition, traversalData.octreeCoords)) {
|
||
traversalData.parentOctreeIndex = getOctreeParentIndex(traversalData.parentOctreeIndex);
|
||
} else {
|
||
break;
|
||
}
|
||
}
|
||
|
||
// Go down tree
|
||
traverseOctreeDownwards(shapePosition, traversalData, sampleDatas);
|
||
}
|
||
}
|
||
`,ayt=`// See Octree.glsl for the definitions of SampleData and intMod
|
||
|
||
/* Megatexture defines (set in Scene/VoxelRenderResources.js)
|
||
#define SAMPLE_COUNT ###
|
||
#define NEAREST_SAMPLING
|
||
#define PADDING
|
||
*/
|
||
|
||
uniform ivec2 u_megatextureSliceDimensions; // number of slices per tile, in two dimensions
|
||
uniform ivec2 u_megatextureTileDimensions; // number of tiles per megatexture, in two dimensions
|
||
uniform vec2 u_megatextureVoxelSizeUv;
|
||
uniform vec2 u_megatextureSliceSizeUv;
|
||
uniform vec2 u_megatextureTileSizeUv;
|
||
|
||
uniform ivec3 u_dimensions; // does not include padding
|
||
#if defined(PADDING)
|
||
uniform ivec3 u_paddingBefore;
|
||
uniform ivec3 u_paddingAfter;
|
||
#endif
|
||
|
||
// Integer min, max, clamp: For WebGL1 only
|
||
int intMin(int a, int b) {
|
||
return a <= b ? a : b;
|
||
}
|
||
int intMax(int a, int b) {
|
||
return a >= b ? a : b;
|
||
}
|
||
int intClamp(int v, int minVal, int maxVal) {
|
||
return intMin(intMax(v, minVal), maxVal);
|
||
}
|
||
|
||
vec2 index1DTo2DTexcoord(int index, ivec2 dimensions, vec2 uvScale)
|
||
{
|
||
int indexX = intMod(index, dimensions.x);
|
||
int indexY = index / dimensions.x;
|
||
return vec2(indexX, indexY) * uvScale;
|
||
}
|
||
|
||
/*
|
||
How is 3D data stored in a 2D megatexture?
|
||
|
||
In this example there is only one loaded tile and it has 2x2x2 voxels (8 voxels total).
|
||
The data is sliced by Z. The data at Z = 0 is placed in texels (0,0), (0,1), (1,0), (1,1) and
|
||
the data at Z = 1 is placed in texels (2,0), (2,1), (3,0), (3,1).
|
||
Note that there could be empty space in the megatexture because it's a power of two.
|
||
|
||
0 1 2 3
|
||
+---+---+---+---+
|
||
| | | | | 3
|
||
+---+---+---+---+
|
||
| | | | | 2
|
||
+-------+-------+
|
||
|010|110|011|111| 1
|
||
|--- ---|--- ---|
|
||
|000|100|001|101| 0
|
||
+-------+-------+
|
||
|
||
When doing linear interpolation the megatexture needs to be sampled twice: once for
|
||
the Z slice above the voxel coordinate and once for the slice below. The two slices
|
||
are interpolated with fract(coord.z - 0.5). For example, a Z coordinate of 1.0 is
|
||
halfway between two Z slices so the interpolation factor is 0.5. Below is a side view
|
||
of the 3D voxel grid with voxel coordinates on the left side.
|
||
|
||
2 +---+
|
||
|001|
|
||
1 +-z-+
|
||
|000|
|
||
0 +---+
|
||
|
||
When doing nearest neighbor the megatexture only needs to be sampled once at the closest Z slice.
|
||
*/
|
||
|
||
Properties getPropertiesFromMegatexture(in SampleData sampleData) {
|
||
vec3 tileUv = clamp(sampleData.tileUv, vec3(0.0), vec3(1.0)); // TODO is the clamp necessary?
|
||
int tileIndex = sampleData.megatextureIndex;
|
||
vec3 voxelCoord = tileUv * vec3(u_dimensions);
|
||
ivec3 voxelDimensions = u_dimensions;
|
||
|
||
#if defined(PADDING)
|
||
voxelDimensions += u_paddingBefore + u_paddingAfter;
|
||
voxelCoord += vec3(u_paddingBefore);
|
||
#endif
|
||
|
||
#if defined(NEAREST_SAMPLING)
|
||
// Round to the center of the nearest voxel
|
||
voxelCoord = floor(voxelCoord + vec3(0.5));
|
||
#endif
|
||
|
||
// Tile location
|
||
vec2 tileUvOffset = index1DTo2DTexcoord(tileIndex, u_megatextureTileDimensions, u_megatextureTileSizeUv);
|
||
|
||
// Slice location
|
||
float slice = voxelCoord.z - 0.5;
|
||
int sliceIndex = int(floor(slice));
|
||
int sliceIndex0 = intClamp(sliceIndex, 0, voxelDimensions.z - 1);
|
||
vec2 sliceUvOffset0 = index1DTo2DTexcoord(sliceIndex0, u_megatextureSliceDimensions, u_megatextureSliceSizeUv);
|
||
|
||
// Voxel location
|
||
vec2 voxelUvOffset = clamp(voxelCoord.xy, vec2(0.5), vec2(voxelDimensions.xy) - vec2(0.5)) * u_megatextureVoxelSizeUv;
|
||
|
||
// Final location in the megatexture
|
||
vec2 uv0 = tileUvOffset + sliceUvOffset0 + voxelUvOffset;
|
||
|
||
#if defined(NEAREST_SAMPLING)
|
||
return getPropertiesFromMegatextureAtUv(uv0);
|
||
#else
|
||
float sliceLerp = fract(slice);
|
||
int sliceIndex1 = intMin(sliceIndex + 1, voxelDimensions.z - 1);
|
||
vec2 sliceUvOffset1 = index1DTo2DTexcoord(sliceIndex1, u_megatextureSliceDimensions, u_megatextureSliceSizeUv);
|
||
vec2 uv1 = tileUvOffset + sliceUvOffset1 + voxelUvOffset;
|
||
Properties properties0 = getPropertiesFromMegatextureAtUv(uv0);
|
||
Properties properties1 = getPropertiesFromMegatextureAtUv(uv1);
|
||
return mixProperties(properties0, properties1, sliceLerp);
|
||
#endif
|
||
}
|
||
|
||
// Convert an array of sample datas to a final weighted properties.
|
||
Properties accumulatePropertiesFromMegatexture(in SampleData sampleDatas[SAMPLE_COUNT]) {
|
||
#if (SAMPLE_COUNT == 1)
|
||
return getPropertiesFromMegatexture(sampleDatas[0]);
|
||
#else
|
||
// When more than one sample is taken the accumulator needs to start at 0
|
||
Properties properties = clearProperties();
|
||
for (int i = 0; i < SAMPLE_COUNT; ++i) {
|
||
float weight = sampleDatas[i].weight;
|
||
|
||
// Avoid reading the megatexture when the weight is 0 as it can be costly.
|
||
if (weight > 0.0) {
|
||
Properties tempProperties = getPropertiesFromMegatexture(sampleDatas[i]);
|
||
tempProperties = scaleProperties(tempProperties, weight);
|
||
properties = sumProperties(properties, tempProperties);
|
||
}
|
||
}
|
||
return properties;
|
||
#endif
|
||
}
|
||
`;function cyt(e){const t=new Qa;this.shaderBuilder=t;const n=e._customShader,i=Ln(e._uniformMap,n.uniformMap);e._uniformMap=i;const o=n.uniforms;for(const _ in o)if(o.hasOwnProperty(_)){const g=o[_];t.addUniform(g.type,_,Re.FRAGMENT)}t.addUniform("sampler2D","u_megatextureTextures[METADATA_COUNT]",Re.FRAGMENT),this.uniformMap=i;const r=e._clippingPlanes,s=l(r)&&r.enabled?r.length:0;this.clippingPlanes=r,this.clippingPlanesLength=s,t.addVertexLines([Kgt]),t.addFragmentLines([n.fragmentShaderText,"#line 0",Jgt]),s>0&&(t.addDefine("CLIPPING_PLANES",void 0,Re.FRAGMENT),t.addDefine("CLIPPING_PLANES_COUNT",s,Re.FRAGMENT),r.unionClippingRegions&&t.addDefine("CLIPPING_PLANES_UNION",void 0,Re.FRAGMENT),t.addFragmentLines([Zgt])),e._depthTest&&(t.addDefine("DEPTH_TEST",void 0,Re.FRAGMENT),t.addFragmentLines([Qgt]));const a=e._provider.shape;a==="BOX"?t.addFragmentLines([eyt,XN,iyt]):a==="CYLINDER"?t.addFragmentLines([tyt,XN,oyt]):a==="ELLIPSOID"&&t.addFragmentLines([nyt,XN,ryt]),t.addFragmentLines([syt,ayt,Xgt]);const c=e._shape,u=c.shaderDefines;for(const _ in u)if(u.hasOwnProperty(_)){let g=u[_];l(g)&&(g=g===!0?void 0:g,t.addDefine(_,g,Re.FRAGMENT))}let f=c.shaderMaximumIntersectionsLength;s>0&&(t.addDefine("CLIPPING_PLANES_INTERSECTION_INDEX",f,Re.FRAGMENT),s===1?f+=1:r.unionClippingRegions?f+=2:f+=1),e._depthTest&&(t.addDefine("DEPTH_INTERSECTION_INDEX",f,Re.FRAGMENT),f+=1),t.addDefine("INTERSECTION_COUNT",f,Re.FRAGMENT),(!d.equals(e.paddingBefore,d.ZERO)||!d.equals(e.paddingAfter,d.ZERO))&&t.addDefine("PADDING",void 0,Re.FRAGMENT),e._useLogDepth&&t.addDefine("LOG_DEPTH_READ_ONLY",void 0,Re.FRAGMENT),e._jitter&&t.addDefine("JITTER",void 0,Re.FRAGMENT),e._nearestSampling&&t.addDefine("NEAREST_SAMPLING",void 0,Re.FRAGMENT);const h=e._traversal;t.addDefine("SAMPLE_COUNT",`${h._sampleCount}`,Re.FRAGMENT)}function lyt(e,t){const{shaderBuilder:n}=e,{names:i,types:o,componentTypes:r,minimumValues:s,maximumValues:a}=t._provider,c=o.length,u=l(s)&&l(a);n.addDefine("METADATA_COUNT",c,Re.FRAGMENT),u&&n.addDefine("STATISTICS",void 0,Re.FRAGMENT);for(let M=0;M<c;M++){const H=i[M],G=o[M],I=`PropertyStatistics_${H}`,O=`PropertyStatistics_${H}`;n.addStruct(I,O,Re.FRAGMENT);const m=sD(G);n.addStructField(I,m,"min"),n.addStructField(I,m,"max")}const f="Statistics",h="Statistics",_="statistics";n.addStruct(f,h,Re.FRAGMENT);for(let M=0;M<c;M++){const H=i[M],G=`PropertyStatistics_${H}`,I=H;n.addStructField(f,G,I)}const g="Metadata",p="Metadata",y="metadata";n.addStruct(g,p,Re.FRAGMENT),n.addStructField(g,h,_);for(let M=0;M<c;M++){const H=i[M],G=o[M],I=sD(G);n.addStructField(g,I,H)}for(let M=0;M<c;M++){const H=i[M],G=o[M],I=fyt(G),O=`VoxelProperty_${H}`,m=`VoxelProperty_${H}`;n.addStruct(O,m,Re.FRAGMENT),n.addStructField(O,I,"partialDerivativeLocal"),n.addStructField(O,I,"partialDerivativeWorld"),n.addStructField(O,I,"partialDerivativeView"),n.addStructField(O,I,"partialDerivativeValid")}const T="Voxel",b="Voxel",x="voxel";n.addStruct(T,b,Re.FRAGMENT);for(let M=0;M<c;M++){const H=i[M],G=`VoxelProperty_${H}`;n.addStructField(T,G,H)}n.addStructField(T,"vec3","positionEC"),n.addStructField(T,"vec3","positionUv"),n.addStructField(T,"vec3","positionShapeUv"),n.addStructField(T,"vec3","positionUvLocal"),n.addStructField(T,"vec3","viewDirUv"),n.addStructField(T,"vec3","viewDirWorld"),n.addStructField(T,"float","travelDistance");const v="FragmentInput",D="FragmentInput";n.addStruct(v,D,Re.FRAGMENT),n.addStructField(v,p,y),n.addStructField(v,b,x);const L="Properties",B="Properties",V="properties";n.addStruct(L,B,Re.FRAGMENT);for(let M=0;M<c;M++){const H=i[M],G=o[M],I=sD(G);n.addStructField(L,I,H)}{const M="clearProperties";n.addFunction(M,`${B} clearProperties()`,Re.FRAGMENT),n.addFunctionLines(M,[`${B} ${V};`]);for(let H=0;H<c;H++){const G=i[H],I=o[H];r[H];const O=sD(I);n.addFunctionLines(M,[`${V}.${G} = ${O}(0.0);`])}n.addFunctionLines(M,[`return ${V};`])}{const M="sumProperties";n.addFunction(M,`${B} sumProperties(${B} propertiesA, ${B} propertiesB)`,Re.FRAGMENT),n.addFunctionLines(M,[`${B} ${V};`]);for(let H=0;H<c;H++){const G=i[H];n.addFunctionLines(M,[`${V}.${G} = propertiesA.${G} + propertiesB.${G};`])}n.addFunctionLines(M,[`return ${V};`])}{const M="scaleProperties";n.addFunction(M,`${B} scaleProperties(${B} ${V}, float scale)`,Re.FRAGMENT),n.addFunctionLines(M,[`${B} scaledProperties = ${V};`]);for(let H=0;H<c;H++){const G=i[H];n.addFunctionLines(M,[`scaledProperties.${G} *= scale;`])}n.addFunctionLines(M,["return scaledProperties;"])}{const M="mixProperties";n.addFunction(M,`${B} mixProperties(${B} propertiesA, ${B} propertiesB, float mixFactor)`,Re.FRAGMENT),n.addFunctionLines(M,[`${B} ${V};`]);for(let H=0;H<c;H++){const G=i[H];n.addFunctionLines(M,[`${V}.${G} = mix(propertiesA.${G}, propertiesB.${G}, mixFactor);`])}n.addFunctionLines(M,[`return ${V};`])}{const M="copyPropertiesToMetadata";n.addFunction(M,`void copyPropertiesToMetadata(in ${B} ${V}, inout ${p} ${y})`,Re.FRAGMENT);for(let H=0;H<c;H++){const G=i[H];n.addFunctionLines(M,[`${y}.${G} = ${V}.${G};`])}}if(u){const M="setStatistics";n.addFunction(M,`void setStatistics(inout ${h} ${_})`,Re.FRAGMENT);for(let H=0;H<c;H++){const G=i[H],I=o[H],O=Xt.getComponentCount(I);for(let m=0;m<O;m++){const P=dyt(I,m),R=s[H][m],U=a[H][m];n.addFunctionLines(M,[`${_}.${G}.min${P} = ${F7(R)};`,`${_}.${G}.max${P} = ${F7(U)};`])}}}{const M="getPropertiesFromMegatextureAtUv";n.addFunction(M,`${B} getPropertiesFromMegatextureAtUv(vec2 texcoord)`,Re.FRAGMENT),n.addFunctionLines(M,[`${B} ${V};`]);for(let H=0;H<c;H++){const G=i[H],I=o[H];r[H];const O=uyt(I);n.addFunctionLines(M,[`properties.${G} = texture2D(u_megatextureTextures[${H}], texcoord)${O};`])}n.addFunctionLines(M,[`return ${V};`])}}function sD(e){if(e===Xt.SCALAR)return"float";if(e===Xt.VEC2)return"vec2";if(e===Xt.VEC3)return"vec3";if(e===Xt.VEC4)return"vec4"}function uyt(e){if(e===Xt.SCALAR)return".r";if(e===Xt.VEC2)return".ra";if(e===Xt.VEC3)return".rgb";if(e===Xt.VEC4)return""}function fyt(e){if(e===Xt.SCALAR)return"vec3";if(e===Xt.VEC2)return"mat2";if(e===Xt.VEC3)return"mat3";if(e===Xt.VEC4)return"mat4"}function F7(e){let t=e.toString();return t.indexOf(".")===-1&&(t=`${e}.0`),t}function dyt(e,t){return e===Xt.SCALAR?"":`[${t}]`}function hyt(e,t){const n=new cyt(e);lyt(n,e);const{shaderBuilder:i,clippingPlanes:o,clippingPlanesLength:r}=n;if(r>0){const p="getClippingPlane",y=_z(o,t),T=0,b=y.indexOf(")")+1,x=y.indexOf("{",b)+1,v=y.indexOf("}",x),D=y.slice(T,b),L=y.slice(x,v);i.addFunction(p,D,Re.FRAGMENT),i.addFunctionLines(p,[L])}const s=i.clone();s.addDefine("PICKING",void 0,Re.FRAGMENT);const a=i.buildShaderProgram(t),c=s.buildShaderProgram(t),u=ht.fromCache({cull:{enabled:!0,face:mr.BACK},depthTest:{enabled:!1},depthMask:!1,blending:fo.PRE_MULTIPLIED_ALPHA_BLEND}),f=t.getViewportQuadVertexArray(),h=e._depthTest,_=new Dt({vertexArray:f,primitiveType:dt.TRIANGLES,renderState:u,shaderProgram:a,uniformMap:n.uniformMap,pass:We.VOXELS,executeInClosestFrustum:!0,owner:this,cull:h,occlude:h}),g=Dt.shallowClone(_,new Dt);if(g.shaderProgram=c,g.pickOnly=!0,l(e._drawCommand)){const p=e._drawCommand;p.shaderProgram=p.shaderProgram&&p.shaderProgram.destroy()}if(l(e._drawCommandPick)){const p=e._drawCommandPick;p.shaderProgram=p.shaderProgram&&p.shaderProgram.destroy()}e._drawCommand=_,e._drawCommandPick=g}function ip(e,t,n,i,o,r,s){this._primitive=e;const a=i.length;this.megatextures=new Array(a);for(let L=0;L<a;L++){const B=i[L],V=Xt.getComponentCount(B),M=o[L];this.megatextures[L]=new vp(t,n,V,M,s)}const c=this.megatextures[0].maximumTileCount;this._simultaneousRequestCount=0,this._debugPrint=!1,this._frameNumber=0;const u=e._shape,f=0,h=0,_=0,g=0,p=void 0;this.rootNode=new Iu(f,h,_,g,p,u,n),this._priorityQueue=new bf({maximumLength:c,comparator:Zi.priorityComparator}),this._highPriorityKeyframeNodes=new Array(c),this._keyframeNodesInMegatexture=new Array(c),this._keyframeCount=r,this._sampleCount=void 0,this._keyframeLocation=0,this._binaryTreeKeyframeWeighting=new Array(r);function y(L,B,V,M){if(B>V)return;const H=Math.floor((B+V)/2);L[H]=M,y(L,B,H-1,M+1),y(L,H+1,V,M+1)}const T=this._binaryTreeKeyframeWeighting;T[0]=0,T[r-1]=0,y(T,1,r-2,0);const b=9,x=2048,v=Math.floor(x/b),D=Math.ceil(c/v);this.internalNodeTexture=new rn({context:t,pixelFormat:yt.RGBA,pixelDatatype:ft.UNSIGNED_BYTE,flipY:!1,width:x,height:D,sampler:new Ci({minificationFilter:Wn.NEAREST,magnificationFilter:Ps.NEAREST})}),this.internalNodeTilesPerRow=v,this.internalNodeTexelSizeUv=new $(1/x,1/D),this.leafNodeTexture=void 0,this.leafNodeTilesPerRow=void 0,this.leafNodeTexelSizeUv=new $}ip.simultaneousRequestCountMaximum=50;ip.prototype.update=function(e,t,n,i){const o=this._primitive,r=e.context,s=this.megatextures[0].maximumTileCount,a=this._keyframeCount,c=o._levelBlendFactor,u=c>0,f=a>1,h=(u?2:1)*(f?2:1);this._sampleCount=h;const _=h>=2;if(_&&!l(this.leafNodeTexture)){const x=Math.floor(512),v=Math.ceil(s/x);this.leafNodeTexture=new rn({context:r,pixelFormat:yt.RGBA,pixelDatatype:ft.UNSIGNED_BYTE,flipY:!1,width:1024,height:v,sampler:new Ci({minificationFilter:Wn.NEAREST,magnificationFilter:Ps.NEAREST})}),this.leafNodeTexelSizeUv=$.fromElements(1/1024,1/v,this.leafNodeTexelSizeUv),this.leafNodeTilesPerRow=x}else!_&&l(this.leafNodeTexture)&&(this.leafNodeTexture=this.leafNodeTexture.destroy());if(this._keyframeLocation=F.clamp(t,0,a-1),n&&hae(this,this.rootNode),i)return;this._frameNumber=e.frameNumber;const g=Gr();_yt(this,e);const p=Gr();Ayt(this,h,c);const y=Gr();if(this._debugPrint){const T=p-g,b=y-p,x=y-g;yyt(this,T,b,x)}};ip.prototype.isRenderable=function(e){return e.isRenderable(this._frameNumber)};ip.prototype.isDestroyed=function(){return!1};ip.prototype.destroy=function(){const e=this.megatextures,t=e.length;for(let n=0;n<t;n++)e[n]=e[n]&&e[n].destroy();return this.internalNodeTexture=this.internalNodeTexture&&this.internalNodeTexture.destroy(),this.leafNodeTexture=this.leafNodeTexture&&this.leafNodeTexture.destroy(),Je(this)};function hae(e,t){const n=e._primitive,i=n._shape,o=n._provider.dimensions;if(t.computeBoundingVolumes(i,o),l(t.children))for(let r=0;r<8;r++){const s=t.children[r];hae(e,s)}}function pyt(e,t){if(e._simultaneousRequestCount>=ip.simultaneousRequestCountMaximum)return;const n=e._primitive,i=n._provider,o=t.keyframe,r=t.spatialNode,s=r.level,a=r.x,c=r.y,u=r.z;function f(g){e._simultaneousRequestCount--;const p=n._provider.types.length;if(!l(g))t.state=Zi.LoadState.UNAVAILABLE;else if(g===Zi.LoadState.FAILED)t.state=Zi.LoadState.FAILED;else if(!Array.isArray(g)||g.length!==p)t.state=Zi.LoadState.FAILED;else{const y=e.megatextures;for(let T=0;T<p;T++){const{voxelCountPerTile:b,channelCount:x}=y[T],{x:v,y:D,z:L}=b,B=v*D*L,V=g[T],M=B*x;if(V.length===M)t.metadatas[T]=V,t.state=Zi.LoadState.RECEIVED;else{t.state=Zi.LoadState.FAILED;break}}}}function h(){e._simultaneousRequestCount--,t.state=Zi.LoadState.FAILED}const _=i.requestData({tileLevel:s,tileX:a,tileY:c,tileZ:u,keyframe:o});l(_)?(e._simultaneousRequestCount++,t.state=Zi.LoadState.RECEIVING,_.then(f).catch(h)):t.state=Zi.LoadState.FAILED}function myt(e){return e/(1+e)}function _yt(e,t){const n=e._frameNumber,i=e._primitive,o=i._shape,r=i._provider.dimensions,s=i._screenSpaceError,a=e._priorityQueue,c=e._keyframeLocation,u=e._keyframeCount,f=e.rootNode,h=t.camera.positionWC,_=t.camera.frustum.sseDenominator,p=t.context.drawingBufferHeight/t.pixelRatio/_;function y(M,H){if(M.computeScreenSpaceError(h,p),H=M.visibility(t,H),H===Ur.MASK_OUTSIDE)return;M.visitedFrameNumber=n;const G=F.clamp(Math.floor(c),0,u-2),I=G+1;if(u===1)M.createKeyframeNode(0);else if(M.keyframeNodes.length!==u)for(let U=0;U<u;U++)M.createKeyframeNode(U);const O=myt(M.screenSpaceError);let m=!1;const P=M.keyframeNodes;for(let U=0;U<P.length;U++){const W=P[U],q=W.keyframe,Y=Math.min(Math.abs(q-G),Math.abs(q-I)),j=Math.max(G,u-I-1,1),ee=Math.pow(1-Y/j,4),K=Math.exp(-e._binaryTreeKeyframeWeighting[q]);W.priority=10*O,W.priority+=F.lerp(K,ee,.15+.85*ee),W.state!==Zi.LoadState.UNAVAILABLE&&W.state!==Zi.LoadState.FAILED&&W.priority!==-Number.MAX_VALUE&&a.insert(W),W.state===Zi.LoadState.LOADED&&(m=!0)}if(M.screenSpaceError<s||!m){M.children=void 0;return}if(!l(M.children)){const U=gyt(M),W=M.level+1;M.children=U.map(([q,Y,j])=>new Iu(W,q,Y,j,M,o,r))}for(let U=0;U<8;U++){const W=M.children[U];y(W,H)}}a.reset(),y(f,Ur.MASK_INDETERMINATE);const T=e._highPriorityKeyframeNodes;let b=0,x;for(;a.length>0;)x=a.removeMaximum(),x.highPriorityFrameNumber=n,T[b]=x,b++;const v=e._keyframeNodesInMegatexture,D=e.megatextures[0],L=D.occupiedCount;v.length=L,v.sort(function(M,H){return M.highPriorityFrameNumber===H.highPriorityFrameNumber?H.priority-M.priority:H.highPriorityFrameNumber-M.highPriorityFrameNumber});let B=0,V=0;for(let M=0;M<b;M++)if(x=T[M],!(x.state===Zi.LoadState.LOADED||x.spatialNode===void 0)&&(x.state===Zi.LoadState.UNLOADED&&pyt(e,x),x.state===Zi.LoadState.RECEIVED)){let H=0;if(D.isFull()){H=L-1-B,B++;const G=v[H];G.spatialNode.destroyKeyframeNode(G,e.megatextures)}else H=L+V,V++;x.spatialNode.addKeyframeNodeToMegatextures(x,e.megatextures),v[H]=x}}function gyt(e){const{x:t,y:n,z:i}=e,o=t*2,r=n*2,s=i*2,a=r+1,c=o+1,u=s+1;return[[o,r,s],[c,r,s],[o,a,s],[c,a,s],[o,r,u],[c,r,u],[o,a,u],[c,a,u]]}function yyt(e,t,n,i){const o=e._keyframeCount,r=e.rootNode,s=Object.keys(Zi.LoadState).length,a=new Array(s),c=new Array(s);let u=0;for(let b=0;b<s;b++){const x=new Array(o);a[b]=x;for(let v=0;v<o;v++)x[v]=0;c[b]=0}function f(b){const x=b.keyframeNodes;for(let v=0;v<x.length;v++){const D=x[v],L=D.keyframe,B=D.state;a[B][L]+=1,c[B]+=1,u++}if(l(b.children))for(let v=0;v<8;v++){const D=b.children[v];f(D)}}f(r);const h=`KEYFRAMES: ${a[Zi.LoadState.LOADED]}`,_=`UNLOADED: ${c[Zi.LoadState.UNLOADED]} | RECEIVING: ${c[Zi.LoadState.RECEIVING]} | RECEIVED: ${c[Zi.LoadState.RECEIVED]} | LOADED: ${c[Zi.LoadState.LOADED]} | FAILED: ${c[Zi.LoadState.FAILED]} | UNAVAILABLE: ${c[Zi.LoadState.UNAVAILABLE]} | TOTAL: ${u}`,g=Math.round(t*100)/100,p=Math.round(n*100)/100,y=Math.round(i*100)/100,T=`LOAD: ${g} | OCT: ${p} | ALL: ${y}`;console.log(`${h} || ${_} || ${T}`)}const aD={INTERNAL:0,LEAF:1,PACKED_LEAF_FROM_PARENT:2};function Ayt(e,t,n){const i=e._primitive._screenSpaceError,o=e._keyframeLocation,r=e._frameNumber,s=t>=2;let a=0,c=0;const u=[],f=[];function h(g,p,y,T,b){let x=!1;if(l(g.children))for(let v=0;v<8;v++){const D=g.children[v];D.computeSurroundingRenderableKeyframeNodes(o),D.isRenderable(r)&&(x=!0)}if(x){u[b]=aD.INTERNAL<<16|p,u[y]=T,a++,T=p,b=T*9+1;for(let v=0;v<8;v++){const D=g.children[v];p=a,y=p*9+0,h(D,p,y,T,b+v)}}else{if(s){const v=c*5,D=g.renderableKeyframeNodePrevious,L=g.level-D.spatialNode.level,B=D.spatialNode.parent,V=l(B)?B.renderableKeyframeNodePrevious:D,M=Tyt(g,i,n),H=L,G=1,I=D.megatextureIndex,O=V.megatextureIndex;f[v+0]=M,f[v+1]=H,f[v+2]=G,f[v+3]=I,f[v+4]=O,u[b]=aD.LEAF<<16|c}else{const v=g.renderableKeyframeNodePrevious,L=g.level-v.spatialNode.level===0?aD.LEAF:aD.PACKED_LEAF_FROM_PARENT;u[b]=L<<16|v.megatextureIndex}c++}}const _=e.rootNode;_.computeSurroundingRenderableKeyframeNodes(o),_.isRenderable(r)&&h(_,0,0,0,0),Cyt(u,9,e.internalNodeTilesPerRow,e.internalNodeTexture),s&&byt(f,2,e.leafNodeTilesPerRow,e.leafNodeTexture)}function Tyt(e,t,n){if(e.parent===void 0)return 0;const i=e.screenSpaceError,o=e.parent.screenSpaceError,s=((t-i)/(o-i)+n-1)/n;return F.clamp(s,0,1)}function Cyt(e,t,n,i){const o=yt.componentsLength(i.pixelFormat),r=Math.ceil(e.length/t),s=Math.max(1,t*Math.min(r,n)),a=Math.max(1,Math.ceil(r/n)),c=new Uint8Array(s*a*o);for(let h=0;h<e.length;h++){const _=e[h],g=h*o;for(let p=0;p<o;p++)c[g+p]=_>>>p*8&255}const f={source:{arrayBufferView:c,width:s,height:a},xOffset:0,yOffset:0};i.copyFrom(f)}function byt(e,t,n,i){const o=yt.componentsLength(i.pixelFormat),r=5,s=Math.ceil(e.length/r),a=Math.max(1,t*Math.min(s,n)),c=Math.max(1,Math.ceil(s/n)),u=new Uint8Array(a*c*o);for(let _=0;_<s;_++){const g=e[_*r+0],p=e[_*r+1],y=e[_*r+2],T=e[_*r+3],b=e[_*r+4],x=F.clamp(Math.floor(65536*g),0,65535);u[_*8+0]=x>>>0&255,u[_*8+1]=x>>>8&255,u[_*8+2]=p&255,u[_*8+3]=y&255,u[_*8+4]=T>>>0&255,u[_*8+5]=T>>>8&255,u[_*8+6]=b>>>0&255,u[_*8+7]=b>>>8&255}const h={source:{arrayBufferView:u,width:a,height:c},xOffset:0,yOffset:0};i.copyFrom(h)}ip.getApproximateTextureMemoryByteLength=function(e,t,n,i){let o=0;const r=n.length;for(let s=0;s<r;s++){const a=n[s],c=i[s],u=Xt.getComponentCount(a);o+=vp.getApproximateTextureMemoryByteLength(e,t,u,c)}return o};const Eyt={FLOAT:"float",VEC2:"vec2",VEC3:"vec3",VEC4:"vec4",INT:"int",INT_VEC2:"ivec2",INT_VEC3:"ivec3",INT_VEC4:"ivec4",BOOL:"bool",BOOL_VEC2:"bvec2",BOOL_VEC3:"bvec3",BOOL_VEC4:"bvec4",MAT2:"mat2",MAT3:"mat2",MAT4:"mat4",SAMPLER_2D:"sampler2D",SAMPLER_CUBE:"samplerCube"},L2=Object.freeze(Eyt);function zT(){this._defaultTexture=void 0,this._textures={},this._loadedImages=[],this._lastUpdatedFrame=-1}zT.prototype.getTexture=function(e){return this._textures[e]};function xyt(e,t,n){n.resource.fetchImage().then(function(i){e._loadedImages.push({id:t,image:i,textureUniform:n})}).catch(function(){const i=e._textures[t];l(i)&&i!==e._defaultTexture&&i.destroy(),e._textures[t]=e._defaultTexture})}zT.prototype.loadTexture2D=function(e,t){l(t.typedArray)?this._loadedImages.push({id:e,textureUniform:t}):xyt(this,e,t)};function wyt(e,t,n){const{id:i,textureUniform:o,image:r}=t,s=n.webgl2?iI(o,r,n):Syt(o,r,n),a=e._textures[i];l(a)&&a!==n.defaultTexture&&a.destroy(),e._textures[i]=s}function iI(e,t,n){const{typedArray:i,sampler:o}=e,r=l(i)?mae(e,n):new rn({context:n,source:t,sampler:o});return pae(o)&&r.generateMipmap(),r}function Syt(e,t,n){const{typedArray:i,sampler:o}=e,r=pae(o),s=o.wrapS===io.REPEAT||o.wrapS===io.MIRRORED_REPEAT||o.wrapT===io.REPEAT||o.wrapT===io.MIRRORED_REPEAT,{width:a,height:c}=l(i)?e:t,u=[a,c].every(F.isPowerOfTwo);if((r||s)&&!u)if(l(i)){if(e.pixelDatatype===ft.UNSIGNED_BYTE){const h=A_t(i,a,c),_=XF(h);return iI({sampler:o},_,n)}}else{const h=XF(t);return iI(e,h,n)}else return iI(e,t,n);return r?console.warn("Texture requires resizing for mipmaps but pixelDataType cannot be resized. The texture may be rendered incorrectly."):s&&console.warn("Texture requires resizing for wrapping but pixelDataType cannot be resized. The texture may be rendered incorrectly."),mae(e,n)}function pae(e){return[Wn.NEAREST_MIPMAP_NEAREST,Wn.NEAREST_MIPMAP_LINEAR,Wn.LINEAR_MIPMAP_NEAREST,Wn.LINEAR_MIPMAP_LINEAR].includes(e.minificationFilter)}function mae(e,t){const{pixelFormat:n,pixelDatatype:i,width:o,height:r,typedArray:s,sampler:a}=e;return new rn({context:t,pixelFormat:n,pixelDatatype:i,source:{arrayBufferView:s,width:o,height:r},sampler:a,flipY:!1})}zT.prototype.update=function(e){if(e.frameNumber===this._lastUpdatedFrame)return;this._lastUpdatedFrame=e.frameNumber;const t=e.context;this._defaultTexture=t.defaultTexture;const n=this._loadedImages;for(let i=0;i<n.length;i++){const o=n[i];wyt(this,o,t)}n.length=0};zT.prototype.isDestroyed=function(){return!1};zT.prototype.destroy=function(){const e=this._textures;for(const t in e)if(e.hasOwnProperty(t)){const n=e[t];n!==this._defaultTexture&&n.destroy()}return Je(this)};function ew(e){e=A(e,A.EMPTY_OBJECT),this.mode=A(e.mode,SU.MODIFY_MATERIAL),this.lightingModel=e.lightingModel,this.uniforms=A(e.uniforms,A.EMPTY_OBJECT),this.varyings=A(e.varyings,A.EMPTY_OBJECT),this.vertexShaderText=e.vertexShaderText,this.fragmentShaderText=e.fragmentShaderText,this.translucencyMode=A(e.translucencyMode,o2.INHERIT),this._textureManager=new zT,this._defaultTexture=void 0,this.uniformMap=vyt(this),this.usedVariablesVertex={attributeSet:{},featureIdSet:{},metadataSet:{}},this.usedVariablesFragment={attributeSet:{},featureIdSet:{},metadataSet:{},materialSet:{}},Pyt(this),Oyt(this)}function vyt(e){const t=e.uniforms,n={};for(const i in t)if(t.hasOwnProperty(i)){const o=t[i],r=o.type;if(r===L2.SAMPLER_CUBE)throw new w("CustomShader does not support samplerCube uniforms");r===L2.SAMPLER_2D?(e._textureManager.loadTexture2D(i,o.value),n[i]=Dyt(e,i)):n[i]=Iyt(e,i)}return n}function Dyt(e,t){return function(){return A(e._textureManager.getTexture(t),e._defaultTexture)}}function Iyt(e,t){return function(){return e.uniforms[t].value}}function gg(e,t,n){let i;for(;(i=t.exec(e))!==null;){const o=i[1];n[o]=!0}}function Pyt(e){const t=/[vf]sInput\.attributes\.(\w+)/g,n=/[vf]sInput\.featureIds\.(\w+)/g,i=/[vf]sInput\.metadata.(\w+)/g;let o;const r=e.vertexShaderText;l(r)&&(o=e.usedVariablesVertex.attributeSet,gg(r,t,o),o=e.usedVariablesVertex.featureIdSet,gg(r,n,o),o=e.usedVariablesVertex.metadataSet,gg(r,i,o));const s=e.fragmentShaderText;if(l(s)){o=e.usedVariablesFragment.attributeSet,gg(s,t,o),o=e.usedVariablesFragment.featureIdSet,gg(s,n,o),o=e.usedVariablesFragment.metadataSet,gg(s,i,o);const a=/material\.(\w+)/g,c=e.usedVariablesFragment.materialSet;gg(s,a,c)}}function z7(e){const t=/^.*MC$/,n=/^.*WC$/,i=/^.*EC$/;return t.test(e)?`${e} (model coordinates)`:n.test(e)?`${e} (Cartesian world coordinates)`:i.test(e)?`${e} (eye coordinates)`:e}function wa(e,t,n,i){if(e.hasOwnProperty(t)){const o=`${z7(t)} is not available in the ${i} shader. Did you mean ${z7(n)} instead?`;throw new w(o)}}function Oyt(e){const t=e.usedVariablesVertex.attributeSet;wa(t,"position","positionMC","vertex"),wa(t,"normal","normalMC","vertex"),wa(t,"tangent","tangentMC","vertex"),wa(t,"bitangent","bitangentMC","vertex"),wa(t,"positionWC","positionMC","vertex"),wa(t,"positionEC","positionMC","vertex"),wa(t,"normalEC","normalMC","vertex"),wa(t,"tangentEC","tangentMC","vertex"),wa(t,"bitangentEC","bitangentMC","vertex");const n=e.usedVariablesFragment.attributeSet;wa(n,"position","positionEC","fragment"),wa(n,"normal","normalEC","fragment"),wa(n,"tangent","tangentEC","fragment"),wa(n,"bitangent","bitangentEC","fragment"),wa(n,"normalMC","normalEC","fragment"),wa(n,"tangentMC","tangentEC","fragment"),wa(n,"bitangentMC","bitangentEC","fragment")}ew.prototype.setUniform=function(e,t){if(E.typeOf.string("uniformName",e),E.defined("value",t),!l(this.uniforms[e]))throw new w(`Uniform ${e} must be declared in the CustomShader constructor.`);const n=this.uniforms[e];n.type===L2.SAMPLER_2D?this._textureManager.loadTexture2D(e,t):l(t.clone)?n.value=t.clone(n.value):n.value=t};ew.prototype.update=function(e){this._defaultTexture=e.context.defaultTexture,this._textureManager.update(e)};ew.prototype.isDestroyed=function(){return!1};ew.prototype.destroy=function(){this._textureManager=this._textureManager&&this._textureManager.destroy(),Je(this)};function Ef(e){e=A(e,A.EMPTY_OBJECT),this._ready=!1,this._provider=A(e.provider,Ef.DefaultProvider),this._traversal=void 0,this._shape=void 0,this._shapeVisible=!1,this._paddingBefore=new d,this._paddingAfter=new d,this._minBounds=new d,this._minBoundsOld=new d,this._maxBounds=new d,this._maxBoundsOld=new d,this._minClippingBounds=new d,this._minClippingBoundsOld=new d,this._maxClippingBounds=new d,this._maxClippingBoundsOld=new d,this._clippingPlanes=void 0,this._clippingPlanesState=0,this._clippingPlanesEnabled=!1,this._modelMatrix=N.clone(A(e.modelMatrix,N.IDENTITY)),this._compoundModelMatrix=new N,this._compoundModelMatrixOld=new N,this._customShader=A(e.customShader,Ef.DefaultCustomShader),this._customShaderCompilationEvent=new lt,this._shaderDirty=!0,this._drawCommand=void 0,this._drawCommandPick=void 0,this._pickId=void 0,this._clock=e.clock,this._transformPositionWorldToUv=new N,this._transformPositionUvToWorld=new N,this._transformDirectionWorldToLocal=new te,this._transformNormalLocalToWorld=new te,this._stepSizeUv=1,this._jitter=!0,this._nearestSampling=!1,this._levelBlendFactor=0,this._stepSizeMultiplier=1,this._depthTest=!0,this._useLogDepth=void 0,this._screenSpaceError=4,this._debugPolylines=new Vc,this._debugDraw=!1,this._disableRender=!1,this._disableUpdate=!1,this._uniforms={octreeInternalNodeTexture:void 0,octreeInternalNodeTilesPerRow:0,octreeInternalNodeTexelSizeUv:new $,octreeLeafNodeTexture:void 0,octreeLeafNodeTilesPerRow:0,octreeLeafNodeTexelSizeUv:new $,megatextureTextures:[],megatextureSliceDimensions:new $,megatextureTileDimensions:new $,megatextureVoxelSizeUv:new $,megatextureSliceSizeUv:new $,megatextureTileSizeUv:new $,dimensions:new d,paddingBefore:new d,paddingAfter:new d,transformPositionViewToUv:new N,transformPositionUvToView:new N,transformDirectionViewToLocal:new te,transformNormalLocalToWorld:new te,cameraPositionUv:new d,ndcSpaceAxisAlignedBoundingBox:new ue,clippingPlanesTexture:void 0,clippingPlanesMatrix:new N,stepSize:0,pickColor:new k},this._shapeDefinesOld={},this._uniformMap={};const t=this._uniforms,n=this._uniformMap;for(const o in t)if(t.hasOwnProperty(o)){const r=`u_${o}`;n[r]=function(){return t[o]}}const i=this._provider;this._completeLoad=function(o,r){},this._readyPromise=Lyt(this,i)}function Lyt(e,t){const n=new Promise(function(i){e._completeLoad=function(o,r){r.afterRender.push(function(){return o._ready=!0,i(o),!0})}});return t.readyPromise.then(function(){return n})}Object.defineProperties(Ef.prototype,{ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise}},provider:{get:function(){return this._provider}},boundingSphere:{get:function(){if(!this._ready)throw new w("boundingSphere must not be called before the primitive is ready.");return this._shape.boundingSphere}},orientedBoundingBox:{get:function(){if(!this._ready)throw new w("orientedBoundingBox must not be called before the primitive is ready.");return this._shape.orientedBoundingBox}},modelMatrix:{get:function(){return this._modelMatrix},set:function(e){E.typeOf.object("modelMatrix",e),this._modelMatrix=N.clone(e,this._modelMatrix)}},shape:{get:function(){if(!this._ready)throw new w("shape must not be called before the primitive is ready.");return this._provider.shape}},dimensions:{get:function(){if(!this._ready)throw new w("dimensions must not be called before the primitive is ready.");return this._provider.dimensions}},minimumValues:{get:function(){if(!this._ready)throw new w("minimumValues must not be called before the primitive is ready.");return this._provider.minimumValues}},maximumValues:{get:function(){if(!this._ready)throw new w("maximumValues must not be called before the primitive is ready.");return this._provider.maximumValues}},show:{get:function(){return!this._disableRender},set:function(e){E.typeOf.bool("show",e),this._disableRender=!e}},disableUpdate:{get:function(){return this._disableUpdate},set:function(e){E.typeOf.bool("disableUpdate",e),this._disableUpdate=e}},debugDraw:{get:function(){return this._debugDraw},set:function(e){E.typeOf.bool("debugDraw",e),this._debugDraw=e}},depthTest:{get:function(){return this._depthTest},set:function(e){E.typeOf.bool("depthTest",e),this._depthTest!==e&&(this._depthTest=e,this._shaderDirty=!0)}},jitter:{get:function(){return this._jitter},set:function(e){E.typeOf.bool("jitter",e),this._jitter!==e&&(this._jitter=e,this._shaderDirty=!0)}},nearestSampling:{get:function(){return this._nearestSampling},set:function(e){E.typeOf.bool("nearestSampling",e),this._nearestSampling!==e&&(this._nearestSampling=e,this._shaderDirty=!0)}},levelBlendFactor:{get:function(){return this._levelBlendFactor},set:function(e){E.typeOf.number("levelBlendFactor",e),this._levelBlendFactor=F.clamp(e,0,1)}},screenSpaceError:{get:function(){return this._screenSpaceError},set:function(e){E.typeOf.number("screenSpaceError",e),this._screenSpaceError=e}},stepSize:{get:function(){return this._stepSizeMultiplier},set:function(e){E.typeOf.number("stepSize",e),this._stepSizeMultiplier=e}},minBounds:{get:function(){return this._minBounds},set:function(e){E.defined("minBounds",e),this._minBounds=d.clone(e,this._minBounds)}},maxBounds:{get:function(){return this._maxBounds},set:function(e){E.defined("maxBounds",e),this._maxBounds=d.clone(e,this._maxBounds)}},minClippingBounds:{get:function(){return this._minClippingBounds},set:function(e){E.defined("minClippingBounds",e),this._minClippingBounds=d.clone(e,this._minClippingBounds)}},maxClippingBounds:{get:function(){return this._maxClippingBounds},set:function(e){E.defined("maxClippingBounds",e),this._maxClippingBounds=d.clone(e,this._maxClippingBounds)}},clippingPlanes:{get:function(){return this._clippingPlanes},set:function(e){rr.setOwner(e,this,"_clippingPlanes")}},customShader:{get:function(){return this._customShader},set:function(e){if(this._customShader!==e){const t=this._uniformMap,i=this._customShader.uniformMap;for(const o in i)i.hasOwnProperty(o)&&delete t[o];l(e)?this._customShader=e:this._customShader=Ef.DefaultCustomShader,this._shaderDirty=!0}}},customShaderCompilationEvent:{get:function(){return this._customShaderCompilationEvent}}});const Byt=new d,Ryt=new ue,Nyt=new ue,Myt=new d,Fyt=new d,zyt=new te,Uyt=new te,Hyt=new N,Vyt=new N,kyt=new N,Gyt=N.fromRotationTranslation(te.fromUniformScale(.5,new te),new d(.5,.5,.5),new N),Wyt=N.fromRotationTranslation(te.fromUniformScale(2,new te),new d(-1,-1,-1),new N);Ef.prototype.update=function(e){const t=this._provider;if(this._customShader.update(e),!this._ready&&!t.ready)return;const n=e.context;if(!this._ready){qyt(this,t,n),this._completeLoad(this,e);return}const i=_ae(this,t),o=this._shape;if(i&&(this._shapeVisible=gae(this,o,t),$yt(this,o)&&(this._shaderDirty=!0)),!this._shapeVisible)return;const r=Xyt(t.timeIntervalCollection,this._clock),s=this._traversal,a=s._sampleCount;if(s.update(e,r,i,this._disableUpdate),a!==s._sampleCount&&(this._shaderDirty=!0),!s.isRenderable(s.rootNode)||(this._debugDraw&&i0t(this,e),this._disableRender))return;this._useLogDepth!==e.useLogDepth&&(this._useLogDepth=e.useLogDepth,this._shaderDirty=!0),Kyt(this,e)&&(this._shaderDirty=!0);const u=s.leafNodeTexture,f=this._uniforms;l(u)&&(f.octreeLeafNodeTexture=s.leafNodeTexture,f.octreeLeafNodeTexelSizeUv=$.clone(s.leafNodeTexelSizeUv,f.octreeLeafNodeTexelSizeUv),f.octreeLeafNodeTilesPerRow=s.leafNodeTilesPerRow),this._shaderDirty&&(hyt(this,n),this._shaderDirty=!1);const h=n.uniformState.viewProjection,_=o.orientedBoundingBox,g=Zyt(_,h,Nyt);if(g.x===1||g.y===1||g.z===-1||g.w===-1)return;f.ndcSpaceAxisAlignedBoundingBox=ue.clone(g,f.ndcSpaceAxisAlignedBoundingBox);const y=n.uniformState.inverseView;f.transformPositionViewToUv=N.multiply(this._transformPositionWorldToUv,y,f.transformPositionViewToUv);const T=n.uniformState.view;f.transformPositionUvToView=N.multiply(T,this._transformPositionUvToWorld,f.transformPositionUvToView);const b=n.uniformState.inverseViewRotation;f.transformDirectionViewToLocal=te.multiply(this._transformDirectionWorldToLocal,b,f.transformDirectionViewToLocal),f.transformNormalLocalToWorld=te.clone(this._transformNormalLocalToWorld,f.transformNormalLocalToWorld);const x=e.camera.positionWC;f.cameraPositionUv=N.multiplyByPoint(this._transformPositionWorldToUv,x,f.cameraPositionUv),f.stepSize=this._stepSizeUv*this._stepSizeMultiplier;const v=e.passes.pick?this._drawCommandPick:this._drawCommand;v.boundingVolume=o.boundingSphere,e.commandList.push(v)};function qyt(e,t,n){const i=e._uniforms;e._pickId=n.createPickId({primitive:e}),i.pickColor=k.clone(e._pickId.color,i.pickColor);const{shape:o,minBounds:r=lA.getMinBounds(o),maxBounds:s=lA.getMaxBounds(o)}=t;e.minBounds=r,e.maxBounds=s,e.minClippingBounds=lA.getMinBounds(o),e.maxClippingBounds=lA.getMaxBounds(o),_ae(e,t);const a=lA.getShapeConstructor(o);e._shape=new a,e._shapeVisible=gae(e,e._shape,t);const{shaderDefines:c,shaderUniforms:u}=e._shape;e._shapeDefinesOld=St(c,!0);const f=e._uniformMap;for(const h in u)if(u.hasOwnProperty(h)){const _=`u_${h}`;l(f[_])&&uo(`VoxelPrimitive: Uniform name "${_}" is already defined`),f[_]=function(){return u[h]}}i.dimensions=d.clone(t.dimensions,i.dimensions),e._paddingBefore=d.clone(A(t.paddingBefore,d.ZERO),e._paddingBefore),i.paddingBefore=d.clone(e._paddingBefore,i.paddingBefore),e._paddingAfter=d.clone(A(t.paddingAfter,d.ZERO),e._paddingBefore),i.paddingAfter=d.clone(e._paddingAfter,i.paddingAfter),e._traversal=jyt(e,t,n),Yyt(e._traversal,i)}function _ae(e,t){const n=A(t.shapeTransform,N.IDENTITY),i=A(t.globalTransform,N.IDENTITY);return N.multiplyTransformation(i,e._modelMatrix,e._compoundModelMatrix),N.multiplyTransformation(e._compoundModelMatrix,n,e._compoundModelMatrix),lb(e,"_compoundModelMatrix","_compoundModelMatrixOld")+lb(e,"_minBounds","_minBoundsOld")+lb(e,"_maxBounds","_maxBoundsOld")+lb(e,"_minClippingBounds","_minClippingBoundsOld")+lb(e,"_maxClippingBounds","_maxClippingBoundsOld")>0}function lb(e,t,n){const i=e[t],o=e[n],r=!i.equals(o);return r&&i.clone(o),r?1:0}function gae(e,t,n){if(!t.update(e._compoundModelMatrix,e.minBounds,e.maxBounds,e.minClippingBounds,e.maxClippingBounds))return!1;const o=t.shapeTransform,r=N.inverse(o,Hyt),s=N.getRotation(o,zyt),a=N.getScale(o,Myt),c=d.maximumComponent(a),u=d.divideByScalar(a,c,Fyt),f=te.multiplyByScale(s,u,Uyt),h=n.dimensions;return e._stepSizeUv=t.computeApproximateStepSize(h),e._transformPositionWorldToUv=N.multiply(Gyt,r,e._transformPositionWorldToUv),e._transformPositionUvToWorld=N.multiply(o,Wyt,e._transformPositionUvToWorld),e._transformDirectionWorldToLocal=N.getMatrix3(r,e._transformDirectionWorldToLocal),e._transformNormalLocalToWorld=te.inverseTranspose(f,e._transformNormalLocalToWorld),!0}function jyt(e,t,n){const i=d.clone(t.dimensions,Byt);d.add(i,e._paddingBefore,i),d.add(i,e._paddingAfter,i);const o=t.maximumTileCount,r=l(o)?ip.getApproximateTextureMemoryByteLength(o,i,t.types,t.componentTypes):void 0,s=A(t.keyframeCount,1);return new ip(e,n,i,t.types,t.componentTypes,s,r)}function Yyt(e,t){t.octreeInternalNodeTexture=e.internalNodeTexture,t.octreeInternalNodeTexelSizeUv=$.clone(e.internalNodeTexelSizeUv,t.octreeInternalNodeTexelSizeUv),t.octreeInternalNodeTilesPerRow=e.internalNodeTilesPerRow;const n=e.megatextures,i=n[0],o=n.length;t.megatextureTextures=new Array(o);for(let r=0;r<o;r++)t.megatextureTextures[r]=n[r].texture;t.megatextureSliceDimensions=$.clone(i.sliceCountPerRegion,t.megatextureSliceDimensions),t.megatextureTileDimensions=$.clone(i.regionCountPerMegatexture,t.megatextureTileDimensions),t.megatextureVoxelSizeUv=$.clone(i.voxelSizeUv,t.megatextureVoxelSizeUv),t.megatextureSliceSizeUv=$.clone(i.sliceSizeUv,t.megatextureSliceSizeUv),t.megatextureTileSizeUv=$.clone(i.regionSizeUv,t.megatextureTileSizeUv)}function $yt(e,t){const n=t.shaderDefines,i=Object.keys(n).some(o=>n[o]!==e._shapeDefinesOld[o]);return i&&(e._shapeDefinesOld=St(n,!0)),i}function Xyt(e,t){if(!l(e)||!l(t))return 0;let n=t.currentTime,i,o=e.indexOf(n);o>=0?i=e.get(o):(o=~o,o===e.length?(o=e.length-1,i=e.get(o),n=i.stop):(i=e.get(o),n=i.start));const r=ce.secondsDifference(i.stop,i.start),a=ce.secondsDifference(n,i.start)/r;return o+a}function Kyt(e,t){const n=e.clippingPlanes;if(!l(n))return!1;n.update(t);const{clippingPlanesState:i,enabled:o}=n;if(o){const r=e._uniforms;r.clippingPlanesTexture=n.texture,r.clippingPlanesMatrix=N.transpose(N.multiplyTransformation(N.inverse(n.modelMatrix,r.clippingPlanesMatrix),e._transformPositionUvToWorld,r.clippingPlanesMatrix),r.clippingPlanesMatrix)}return e._clippingPlanesState===i&&e._clippingPlanesEnabled===o?!1:(e._clippingPlanesState=i,e._clippingPlanesEnabled=o,!0)}Ef.prototype.isDestroyed=function(){return!1};Ef.prototype.destroy=function(){const e=this._drawCommand;l(e)&&(e.shaderProgram=e.shaderProgram&&e.shaderProgram.destroy());const t=this._drawCommandPick;return l(t)&&(t.shaderProgram=t.shaderProgram&&t.shaderProgram.destroy()),this._pickId=this._pickId&&this._pickId.destroy(),this._traversal=this._traversal&&this._traversal.destroy(),this._clippingPlanes=this._clippingPlanes&&this._clippingPlanes.destroy(),Je(this)};const U7=new Array(new ue(-1,-1,-1,1),new ue(1,-1,-1,1),new ue(-1,1,-1,1),new ue(1,1,-1,1),new ue(-1,-1,1,1),new ue(1,-1,1,1),new ue(-1,1,1,1),new ue(1,1,1,1)),Jyt=new Array(1,2,4,0,3,5,0,3,6,1,2,7,0,5,6,1,4,7,2,4,7,3,5,6),Qyt=new Array(new ue,new ue,new ue,new ue,new ue,new ue,new ue,new ue);function Zyt(e,t,n){const i=N.fromRotationTranslation(e.halfAxes,e.center,Vyt),o=N.multiply(t,i,kyt);let r=+Number.MAX_VALUE,s=-Number.MAX_VALUE,a=+Number.MAX_VALUE,c=-Number.MAX_VALUE,u;const f=Qyt,h=U7.length;for(u=0;u<h;u++)N.multiplyByVector(o,U7[u],f[u]);for(u=0;u<h;u++){const _=f[u];if(_.z>=-_.w){const g=_.x/_.w,p=_.y/_.w;r=Math.min(r,g),s=Math.max(s,g),a=Math.min(a,p),c=Math.max(c,p)}else for(let g=0;g<3;g++){const p=Jyt[u*3+g],y=f[p];if(y.z>=-y.w){const T=_.z+_.w,b=y.z+y.w,x=T/(T-b),v=ue.lerp(_,y,x,Ryt),D=v.x/v.w,L=v.y/v.w;r=Math.min(r,D),s=Math.max(s,D),a=Math.min(a,L),c=Math.max(c,L)}}}return r=F.clamp(r,-1,1),a=F.clamp(a,-1,1),s=F.clamp(s,-1,1),c=F.clamp(c,-1,1),n=ue.fromElements(r,a,s,c,n),n}const fH=3e7,e0t=new d(fH,0,0),t0t=new d(0,fH,0),n0t=new d(0,0,fH);function i0t(e,t){const n=e._traversal,i=e._debugPolylines;i.removeAll();function o(c,u,f,h){i.add({positions:[c,u],width:h,material:$e.fromType("Color",{color:f})})}function r(c,u,f){const h=c.computeCorners();o(h[0],h[1],u,f),o(h[2],h[3],u,f),o(h[4],h[5],u,f),o(h[6],h[7],u,f),o(h[0],h[2],u,f),o(h[4],h[6],u,f),o(h[1],h[3],u,f),o(h[5],h[7],u,f),o(h[0],h[4],u,f),o(h[2],h[6],u,f),o(h[1],h[5],u,f),o(h[3],h[7],u,f)}function s(c){if(!n.isRenderable(c))return;const u=c.level,h=Math.max(1,5/Math.pow(2,u)),g=[k.RED,k.LIME,k.BLUE][u%3];if(r(c.orientedBoundingBox,g,h),l(c.children))for(let p=0;p<8;p++)s(c.children[p])}r(e._shape.orientedBoundingBox,k.WHITE,5),s(n.rootNode);const a=10;o(d.ZERO,e0t,k.RED,a),o(d.ZERO,t0t,k.LIME,a),o(d.ZERO,n0t,k.BLUE,a),i.update(t)}Ef.DefaultCustomShader=new ew({fragmentShaderText:`void fragmentMain(FragmentInput fsInput, inout czm_modelMaterial material)
|
||
{
|
||
material.diffuse = vec3(1.0);
|
||
material.alpha = 1.0;
|
||
}`});function yae(){this.ready=!0,this.readyPromise=Promise.resolve(this),this.shape=lA.BOX,this.dimensions=new d(1,1,1),this.names=["data"],this.types=[Xt.SCALAR],this.componentTypes=[an.FLOAT32],this.maximumTileCount=1}yae.prototype.requestData=function(e){if(!((l(e)?A(e.tileLevel,0):0)>=1))return Promise.resolve([new Float32Array(1)])};Ef.DefaultProvider=new yae;function kP(e,t){const n=t.terrainProvider,i=t.mapProjection,o=i.ellipsoid;let r;const s=t.camera.getRectangleCameraCoordinates(e);return t.mode===me.SCENE3D?r=o.cartesianToCartographic(s):r=i.unproject(s),l(n)?n.readyPromise.then(function(){const a=n.availability;if(!l(a)||t.mode===me.SCENE2D)return r;const c=[Ee.center(e),Ee.southeast(e),Ee.southwest(e),Ee.northeast(e),Ee.northwest(e)];return kP._sampleTerrainMostDetailed(n,c).then(function(u){const f=u.reduce(function(_,g){return Math.max(g.height,_)},-Number.MAX_VALUE),h=r;return h.height+=f,h})}):Promise.resolve(r)}kP._sampleTerrainMostDetailed=HP;var Ob;typeof ko<"u"&&(Ob=ko);(function(){/*!
|
||
* Knockout JavaScript library v3.5.1
|
||
* (c) The Knockout.js team - http://knockoutjs.com/
|
||
* License: MIT (http://www.opensource.org/licenses/mit-license.php)
|
||
*/(function(){(function(e){var t=this||(0,eval)("this"),n=t.document,i=t.navigator,o=t.jQuery,r=t.JSON;o||typeof jQuery>"u"||(o=jQuery),function(s){s(t.ko={})}(function(s,a){function c(I,O){return I===null||typeof I in y?I===O:!1}function u(I,O){var m;return function(){m||(m=p.a.setTimeout(function(){m=e,I()},O))}}function f(I,O){var m;return function(){clearTimeout(m),m=p.a.setTimeout(I,O)}}function h(I,O){O&&O!=="change"?O==="beforeChange"?this.pc(I):this.gb(I,O):this.qc(I)}function _(I,O){O!==null&&O.s&&O.s()}function g(I,O){var m=this.qd,P=m[D];P.ra||(this.Qb&&this.mb[O]?(m.uc(O,I,this.mb[O]),this.mb[O]=null,--this.Qb):P.I[O]||m.uc(O,I,P.J?{da:I}:m.$c(I)),I.Ja&&I.gd())}var p=typeof s<"u"?s:{};p.b=function(I,O){for(var m=I.split("."),P=p,R=0;R<m.length-1;R++)P=P[m[R]];P[m[m.length-1]]=O},p.L=function(I,O,m){I[O]=m},p.version="3.5.1",p.b("version",p.version),p.options={deferUpdates:!1,useOnlyNativeEvents:!1,foreachHidesDestroyed:!1},p.a=function(){function I(Q,Z){for(var J in Q)R.call(Q,J)&&Z(J,Q[J])}function O(Q,Z){if(Z)for(var J in Z)R.call(Z,J)&&(Q[J]=Z[J]);return Q}function m(Q,Z){return Q.__proto__=Z,Q}function P(Q,Z,J,de){var _e=Q[Z].match(K)||[];p.a.D(J.match(K),function(le){p.a.Na(_e,le,de)}),Q[Z]=_e.join(" ")}var R=Object.prototype.hasOwnProperty,U={__proto__:[]}instanceof Array,W=typeof Symbol=="function",q={},Y={};q[i&&/Firefox\/2/i.test(i.userAgent)?"KeyboardEvent":"UIEvents"]=["keyup","keydown","keypress"],q.MouseEvents="click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave".split(" "),I(q,function(Q,Z){if(Z.length)for(var J=0,de=Z.length;J<de;J++)Y[Z[J]]=Q});var j={propertychange:!0},ee=n&&function(){for(var Q=3,Z=n.createElement("div"),J=Z.getElementsByTagName("i");Z.innerHTML="<!--[if gt IE "+ ++Q+"]><i></i><![endif]-->",J[0];);return 4<Q?Q:e}(),K=/\S+/g,se;return{Jc:["authenticity_token",/^__RequestVerificationToken(_.*)?$/],D:function(Q,Z,J){for(var de=0,_e=Q.length;de<_e;de++)Z.call(J,Q[de],de,Q)},A:typeof Array.prototype.indexOf=="function"?function(Q,Z){return Array.prototype.indexOf.call(Q,Z)}:function(Q,Z){for(var J=0,de=Q.length;J<de;J++)if(Q[J]===Z)return J;return-1},Lb:function(Q,Z,J){for(var de=0,_e=Q.length;de<_e;de++)if(Z.call(J,Q[de],de,Q))return Q[de];return e},Pa:function(Q,Z){var J=p.a.A(Q,Z);0<J?Q.splice(J,1):J===0&&Q.shift()},wc:function(Q){var Z=[];return Q&&p.a.D(Q,function(J){0>p.a.A(Z,J)&&Z.push(J)}),Z},Mb:function(Q,Z,J){var de=[];if(Q)for(var _e=0,le=Q.length;_e<le;_e++)de.push(Z.call(J,Q[_e],_e));return de},jb:function(Q,Z,J){var de=[];if(Q)for(var _e=0,le=Q.length;_e<le;_e++)Z.call(J,Q[_e],_e)&&de.push(Q[_e]);return de},Nb:function(Q,Z){if(Z instanceof Array)Q.push.apply(Q,Z);else for(var J=0,de=Z.length;J<de;J++)Q.push(Z[J]);return Q},Na:function(Q,Z,J){var de=p.a.A(p.a.bc(Q),Z);0>de?J&&Q.push(Z):J||Q.splice(de,1)},Ba:U,extend:O,setPrototypeOf:m,Ab:U?m:O,P:I,Ga:function(Q,Z,J){if(!Q)return Q;var de={},_e;for(_e in Q)R.call(Q,_e)&&(de[_e]=Z.call(J,Q[_e],_e,Q));return de},Tb:function(Q){for(;Q.firstChild;)p.removeNode(Q.firstChild)},Yb:function(Q){Q=p.a.la(Q);for(var Z=(Q[0]&&Q[0].ownerDocument||n).createElement("div"),J=0,de=Q.length;J<de;J++)Z.appendChild(p.oa(Q[J]));return Z},Ca:function(Q,Z){for(var J=0,de=Q.length,_e=[];J<de;J++){var le=Q[J].cloneNode(!0);_e.push(Z?p.oa(le):le)}return _e},va:function(Q,Z){if(p.a.Tb(Q),Z)for(var J=0,de=Z.length;J<de;J++)Q.appendChild(Z[J])},Xc:function(Q,Z){var J=Q.nodeType?[Q]:Q;if(0<J.length){for(var de=J[0],_e=de.parentNode,le=0,Te=Z.length;le<Te;le++)_e.insertBefore(Z[le],de);for(le=0,Te=J.length;le<Te;le++)p.removeNode(J[le])}},Ua:function(Q,Z){if(Q.length){for(Z=Z.nodeType===8&&Z.parentNode||Z;Q.length&&Q[0].parentNode!==Z;)Q.splice(0,1);for(;1<Q.length&&Q[Q.length-1].parentNode!==Z;)Q.length--;if(1<Q.length){var J=Q[0],de=Q[Q.length-1];for(Q.length=0;J!==de;)Q.push(J),J=J.nextSibling;Q.push(de)}}return Q},Zc:function(Q,Z){7>ee?Q.setAttribute("selected",Z):Q.selected=Z},Db:function(Q){return Q===null||Q===e?"":Q.trim?Q.trim():Q.toString().replace(/^[\s\xa0]+|[\s\xa0]+$/g,"")},Ud:function(Q,Z){return Q=Q||"",Z.length>Q.length?!1:Q.substring(0,Z.length)===Z},vd:function(Q,Z){if(Q===Z)return!0;if(Q.nodeType===11)return!1;if(Z.contains)return Z.contains(Q.nodeType!==1?Q.parentNode:Q);if(Z.compareDocumentPosition)return(Z.compareDocumentPosition(Q)&16)==16;for(;Q&&Q!=Z;)Q=Q.parentNode;return!!Q},Sb:function(Q){return p.a.vd(Q,Q.ownerDocument.documentElement)},kd:function(Q){return!!p.a.Lb(Q,p.a.Sb)},R:function(Q){return Q&&Q.tagName&&Q.tagName.toLowerCase()},Ac:function(Q){return p.onError?function(){try{return Q.apply(this,arguments)}catch(Z){throw p.onError&&p.onError(Z),Z}}:Q},setTimeout:function(Q,Z){return setTimeout(p.a.Ac(Q),Z)},Gc:function(Q){setTimeout(function(){throw p.onError&&p.onError(Q),Q},0)},B:function(Q,Z,J){var de=p.a.Ac(J);if(J=j[Z],p.options.useOnlyNativeEvents||J||!o)if(J||typeof Q.addEventListener!="function")if(typeof Q.attachEvent<"u"){var _e=function(Te){de.call(Q,Te)},le="on"+Z;Q.attachEvent(le,_e),p.a.K.za(Q,function(){Q.detachEvent(le,_e)})}else throw Error("Browser doesn't support addEventListener or attachEvent");else Q.addEventListener(Z,de,!1);else se||(se=typeof o(Q).on=="function"?"on":"bind"),o(Q)[se](Z,de)},Fb:function(Q,Z){if(!Q||!Q.nodeType)throw Error("element must be a DOM node when calling triggerEvent");var J;if(p.a.R(Q)==="input"&&Q.type&&Z.toLowerCase()=="click"?(J=Q.type,J=J=="checkbox"||J=="radio"):J=!1,p.options.useOnlyNativeEvents||!o||J)if(typeof n.createEvent=="function")if(typeof Q.dispatchEvent=="function")J=n.createEvent(Y[Z]||"HTMLEvents"),J.initEvent(Z,!0,!0,t,0,0,0,0,0,!1,!1,!1,!1,0,Q),Q.dispatchEvent(J);else throw Error("The supplied element doesn't support dispatchEvent");else if(J&&Q.click)Q.click();else if(typeof Q.fireEvent<"u")Q.fireEvent("on"+Z);else throw Error("Browser doesn't support triggering events");else o(Q).trigger(Z)},f:function(Q){return p.O(Q)?Q():Q},bc:function(Q){return p.O(Q)?Q.v():Q},Eb:function(Q,Z,J){var de;Z&&(typeof Q.classList=="object"?(de=Q.classList[J?"add":"remove"],p.a.D(Z.match(K),function(_e){de.call(Q.classList,_e)})):typeof Q.className.baseVal=="string"?P(Q.className,"baseVal",Z,J):P(Q,"className",Z,J))},Bb:function(Q,Z){var J=p.a.f(Z);(J===null||J===e)&&(J="");var de=p.h.firstChild(Q);!de||de.nodeType!=3||p.h.nextSibling(de)?p.h.va(Q,[Q.ownerDocument.createTextNode(J)]):de.data=J,p.a.Ad(Q)},Yc:function(Q,Z){if(Q.name=Z,7>=ee)try{var J=Q.name.replace(/[&<>'"]/g,function(de){return"&#"+de.charCodeAt(0)+";"});Q.mergeAttributes(n.createElement("<input name='"+J+"'/>"),!1)}catch{}},Ad:function(Q){9<=ee&&(Q=Q.nodeType==1?Q:Q.parentNode,Q.style&&(Q.style.zoom=Q.style.zoom))},wd:function(Q){if(ee){var Z=Q.style.width;Q.style.width=0,Q.style.width=Z}},Pd:function(Q,Z){Q=p.a.f(Q),Z=p.a.f(Z);for(var J=[],de=Q;de<=Z;de++)J.push(de);return J},la:function(Q){for(var Z=[],J=0,de=Q.length;J<de;J++)Z.push(Q[J]);return Z},Da:function(Q){return W?Symbol(Q):Q},Zd:ee===6,$d:ee===7,W:ee,Lc:function(Q,Z){for(var J=p.a.la(Q.getElementsByTagName("input")).concat(p.a.la(Q.getElementsByTagName("textarea"))),de=typeof Z=="string"?function(Te){return Te.name===Z}:function(Te){return Z.test(Te.name)},_e=[],le=J.length-1;0<=le;le--)de(J[le])&&_e.push(J[le]);return _e},Nd:function(Q){return typeof Q=="string"&&(Q=p.a.Db(Q))?r&&r.parse?r.parse(Q):new Function("return "+Q)():null},hc:function(Q,Z,J){if(!r||!r.stringify)throw Error("Cannot find JSON.stringify(). Some browsers (e.g., IE < 8) don't support it natively, but you can overcome this by adding a script reference to json2.js, downloadable from http://www.json.org/json2.js");return r.stringify(p.a.f(Q),Z,J)},Od:function(Q,Z,J){J=J||{};var de=J.params||{},_e=J.includeFields||this.Jc,le=Q;if(typeof Q=="object"&&p.a.R(Q)==="form")for(var le=Q.action,Te=_e.length-1;0<=Te;Te--)for(var pe=p.a.Lc(Q,_e[Te]),ne=pe.length-1;0<=ne;ne--)de[pe[ne].name]=pe[ne].value;Z=p.a.f(Z);var ae=n.createElement("form");ae.style.display="none",ae.action=le,ae.method="post";for(var ye in Z)Q=n.createElement("input"),Q.type="hidden",Q.name=ye,Q.value=p.a.hc(p.a.f(Z[ye])),ae.appendChild(Q);I(de,function(Ce,Be){var Le=n.createElement("input");Le.type="hidden",Le.name=Ce,Le.value=Be,ae.appendChild(Le)}),n.body.appendChild(ae),J.submitter?J.submitter(ae):ae.submit(),setTimeout(function(){ae.parentNode.removeChild(ae)},0)}}}(),p.b("utils",p.a),p.b("utils.arrayForEach",p.a.D),p.b("utils.arrayFirst",p.a.Lb),p.b("utils.arrayFilter",p.a.jb),p.b("utils.arrayGetDistinctValues",p.a.wc),p.b("utils.arrayIndexOf",p.a.A),p.b("utils.arrayMap",p.a.Mb),p.b("utils.arrayPushAll",p.a.Nb),p.b("utils.arrayRemoveItem",p.a.Pa),p.b("utils.cloneNodes",p.a.Ca),p.b("utils.createSymbolOrString",p.a.Da),p.b("utils.extend",p.a.extend),p.b("utils.fieldsIncludedWithJsonPost",p.a.Jc),p.b("utils.getFormFields",p.a.Lc),p.b("utils.objectMap",p.a.Ga),p.b("utils.peekObservable",p.a.bc),p.b("utils.postJson",p.a.Od),p.b("utils.parseJson",p.a.Nd),p.b("utils.registerEventHandler",p.a.B),p.b("utils.stringifyJson",p.a.hc),p.b("utils.range",p.a.Pd),p.b("utils.toggleDomNodeCssClass",p.a.Eb),p.b("utils.triggerEvent",p.a.Fb),p.b("utils.unwrapObservable",p.a.f),p.b("utils.objectForEach",p.a.P),p.b("utils.addOrRemoveItem",p.a.Na),p.b("utils.setTextContent",p.a.Bb),p.b("unwrap",p.a.f),Function.prototype.bind||(Function.prototype.bind=function(I){var O=this;if(arguments.length===1)return function(){return O.apply(I,arguments)};var m=Array.prototype.slice.call(arguments,1);return function(){var P=m.slice(0);return P.push.apply(P,arguments),O.apply(I,P)}}),p.a.g=new function(){var I=0,O="__ko__"+new Date().getTime(),m={},P,R;return p.a.W?(P=function(U,W){var q=U[O];if(!q||q==="null"||!m[q]){if(!W)return e;q=U[O]="ko"+I++,m[q]={}}return m[q]},R=function(U){var W=U[O];return W?(delete m[W],U[O]=null,!0):!1}):(P=function(U,W){var q=U[O];return!q&&W&&(q=U[O]={}),q},R=function(U){return U[O]?(delete U[O],!0):!1}),{get:function(U,W){var q=P(U,!1);return q&&q[W]},set:function(U,W,q){(U=P(U,q!==e))&&(U[W]=q)},Ub:function(U,W,q){return U=P(U,!0),U[W]||(U[W]=q)},clear:R,Z:function(){return I+++O}}},p.b("utils.domData",p.a.g),p.b("utils.domData.clear",p.a.g.clear),p.a.K=new function(){function I(W,q){var Y=p.a.g.get(W,P);return Y===e&&q&&(Y=[],p.a.g.set(W,P,Y)),Y}function O(W){var q=I(W,!1);if(q)for(var q=q.slice(0),Y=0;Y<q.length;Y++)q[Y](W);p.a.g.clear(W),p.a.K.cleanExternalData(W),U[W.nodeType]&&m(W.childNodes,!0)}function m(W,q){for(var Y=[],j,ee=0;ee<W.length;ee++)if((!q||W[ee].nodeType===8)&&(O(Y[Y.length]=j=W[ee]),W[ee]!==j))for(;ee--&&p.a.A(Y,W[ee])==-1;);}var P=p.a.g.Z(),R={1:!0,8:!0,9:!0},U={1:!0,9:!0};return{za:function(W,q){if(typeof q!="function")throw Error("Callback must be a function");I(W,!0).push(q)},yb:function(W,q){var Y=I(W,!1);Y&&(p.a.Pa(Y,q),Y.length==0&&p.a.g.set(W,P,e))},oa:function(W){return p.u.G(function(){R[W.nodeType]&&(O(W),U[W.nodeType]&&m(W.getElementsByTagName("*")))}),W},removeNode:function(W){p.oa(W),W.parentNode&&W.parentNode.removeChild(W)},cleanExternalData:function(W){o&&typeof o.cleanData=="function"&&o.cleanData([W])}}},p.oa=p.a.K.oa,p.removeNode=p.a.K.removeNode,p.b("cleanNode",p.oa),p.b("removeNode",p.removeNode),p.b("utils.domNodeDisposal",p.a.K),p.b("utils.domNodeDisposal.addDisposeCallback",p.a.K.za),p.b("utils.domNodeDisposal.removeDisposeCallback",p.a.K.yb),function(){var I=[0,"",""],O=[1,"<table>","</table>"],m=[3,"<table><tbody><tr>","</tr></tbody></table>"],P=[1,"<select multiple='multiple'>","</select>"],R={thead:O,tbody:O,tfoot:O,tr:[2,"<table><tbody>","</tbody></table>"],td:m,th:m,option:P,optgroup:P},U=8>=p.a.W;p.a.ua=function(W,q){var Y;if(o){if(o.parseHTML)Y=o.parseHTML(W,q)||[];else if((Y=o.clean([W],q))&&Y[0]){for(var j=Y[0];j.parentNode&&j.parentNode.nodeType!==11;)j=j.parentNode;j.parentNode&&j.parentNode.removeChild(j)}}else{(Y=q)||(Y=n);var j=Y.parentWindow||Y.defaultView||t,ee=p.a.Db(W).toLowerCase(),K=Y.createElement("div"),se;for(se=(ee=ee.match(/^(?:\x3c!--.*?--\x3e\s*?)*?<([a-z]+)[\s>]/))&&R[ee[1]]||I,ee=se[0],se="ignored<div>"+se[1]+W+se[2]+"</div>",typeof j.innerShiv=="function"?K.appendChild(j.innerShiv(se)):(U&&Y.body.appendChild(K),K.innerHTML=se,U&&K.parentNode.removeChild(K));ee--;)K=K.lastChild;Y=p.a.la(K.lastChild.childNodes)}return Y},p.a.Md=function(W,q){var Y=p.a.ua(W,q);return Y.length&&Y[0].parentElement||p.a.Yb(Y)},p.a.fc=function(W,q){if(p.a.Tb(W),q=p.a.f(q),q!==null&&q!==e)if(typeof q!="string"&&(q=q.toString()),o)o(W).html(q);else for(var Y=p.a.ua(q,W.ownerDocument),j=0;j<Y.length;j++)W.appendChild(Y[j])}}(),p.b("utils.parseHtmlFragment",p.a.ua),p.b("utils.setHtml",p.a.fc),p.aa=function(){function I(m,P){if(m){if(m.nodeType==8){var R=p.aa.Uc(m.nodeValue);R!=null&&P.push({ud:m,Kd:R})}else if(m.nodeType==1)for(var R=0,U=m.childNodes,W=U.length;R<W;R++)I(U[R],P)}}var O={};return{Xb:function(m){if(typeof m!="function")throw Error("You can only pass a function to ko.memoization.memoize()");var P=(4294967296*(1+Math.random())|0).toString(16).substring(1)+(4294967296*(1+Math.random())|0).toString(16).substring(1);return O[P]=m,"<!--[ko_memo:"+P+"]-->"},bd:function(m,P){var R=O[m];if(R===e)throw Error("Couldn't find any memo with ID "+m+". Perhaps it's already been unmemoized.");try{return R.apply(null,P||[]),!0}finally{delete O[m]}},cd:function(m,P){var R=[];I(m,R);for(var U=0,W=R.length;U<W;U++){var q=R[U].ud,Y=[q];P&&p.a.Nb(Y,P),p.aa.bd(R[U].Kd,Y),q.nodeValue="",q.parentNode&&q.parentNode.removeChild(q)}},Uc:function(m){return(m=m.match(/^\[ko_memo\:(.*?)\]$/))?m[1]:null}}}(),p.b("memoization",p.aa),p.b("memoization.memoize",p.aa.Xb),p.b("memoization.unmemoize",p.aa.bd),p.b("memoization.parseMemoText",p.aa.Uc),p.b("memoization.unmemoizeDomNodeAndDescendants",p.aa.cd),p.na=function(){function I(){if(R){for(var q=R,Y=0,j;W<R;)if(j=P[W++]){if(W>q){if(5e3<=++Y){W=R,p.a.Gc(Error("'Too much recursion' after processing "+Y+" task groups."));break}q=R}try{j()}catch(ee){p.a.Gc(ee)}}}}function O(){I(),W=R=P.length=0}var m,P=[],R=0,U=1,W=0;return t.MutationObserver?m=function(q){var Y=n.createElement("div");return new MutationObserver(q).observe(Y,{attributes:!0}),function(){Y.classList.toggle("foo")}}(O):m=n&&"onreadystatechange"in n.createElement("script")?function(q){var Y=n.createElement("script");Y.onreadystatechange=function(){Y.onreadystatechange=null,n.documentElement.removeChild(Y),Y=null,q()},n.documentElement.appendChild(Y)}:function(q){setTimeout(q,0)},{scheduler:m,zb:function(q){return R||p.na.scheduler(O),P[R++]=q,U++},cancel:function(q){q=q-(U-R),q>=W&&q<R&&(P[q]=null)},resetForTesting:function(){var q=R-W;return W=R=P.length=0,q},Sd:I}}(),p.b("tasks",p.na),p.b("tasks.schedule",p.na.zb),p.b("tasks.runEarly",p.na.Sd),p.Ta={throttle:function(I,O){I.throttleEvaluation=O;var m=null;return p.$({read:I,write:function(P){clearTimeout(m),m=p.a.setTimeout(function(){I(P)},O)}})},rateLimit:function(I,O){var m,P,R;typeof O=="number"?m=O:(m=O.timeout,P=O.method),I.Hb=!1,R=typeof P=="function"?P:P=="notifyWhenChangesStop"?f:u,I.ub(function(U){return R(U,m,O)})},deferred:function(I,O){if(O!==!0)throw Error("The 'deferred' extender only accepts the value 'true', because it is not supported to turn deferral off once enabled.");I.Hb||(I.Hb=!0,I.ub(function(m){var P,R=!1;return function(){if(!R){p.na.cancel(P),P=p.na.zb(m);try{R=!0,I.notifySubscribers(e,"dirty")}finally{R=!1}}}}))},notify:function(I,O){I.equalityComparer=O=="always"?null:c}};var y={undefined:1,boolean:1,number:1,string:1};p.b("extenders",p.Ta),p.ic=function(I,O,m){this.da=I,this.lc=O,this.mc=m,this.Ib=!1,this.fb=this.Jb=null,p.L(this,"dispose",this.s),p.L(this,"disposeWhenNodeIsRemoved",this.l)},p.ic.prototype.s=function(){this.Ib||(this.fb&&p.a.K.yb(this.Jb,this.fb),this.Ib=!0,this.mc(),this.da=this.lc=this.mc=this.Jb=this.fb=null)},p.ic.prototype.l=function(I){this.Jb=I,p.a.K.za(I,this.fb=this.s.bind(this))},p.T=function(){p.a.Ab(this,T),T.qb(this)};var T={qb:function(I){I.U={change:[]},I.sc=1},subscribe:function(I,O,m){var P=this;m=m||"change";var R=new p.ic(P,O?I.bind(O):I,function(){p.a.Pa(P.U[m],R),P.hb&&P.hb(m)});return P.Qa&&P.Qa(m),P.U[m]||(P.U[m]=[]),P.U[m].push(R),R},notifySubscribers:function(I,O){if(O=O||"change",O==="change"&&this.Gb(),this.Wa(O)){var m=O==="change"&&this.ed||this.U[O].slice(0);try{p.u.xc();for(var P=0,R;R=m[P];++P)R.Ib||R.lc(I)}finally{p.u.end()}}},ob:function(){return this.sc},Dd:function(I){return this.ob()!==I},Gb:function(){++this.sc},ub:function(I){var O=this,m=p.O(O),P,R,U,W,q;O.gb||(O.gb=O.notifySubscribers,O.notifySubscribers=h);var Y=I(function(){O.Ja=!1,m&&W===O&&(W=O.nc?O.nc():O());var j=R||q&&O.sb(U,W);q=R=P=!1,j&&O.gb(U=W)});O.qc=function(j,ee){ee&&O.Ja||(q=!ee),O.ed=O.U.change.slice(0),O.Ja=P=!0,W=j,Y()},O.pc=function(j){P||(U=j,O.gb(j,"beforeChange"))},O.rc=function(){q=!0},O.gd=function(){O.sb(U,O.v(!0))&&(R=!0)}},Wa:function(I){return this.U[I]&&this.U[I].length},Bd:function(I){if(I)return this.U[I]&&this.U[I].length||0;var O=0;return p.a.P(this.U,function(m,P){m!=="dirty"&&(O+=P.length)}),O},sb:function(I,O){return!this.equalityComparer||!this.equalityComparer(I,O)},toString:function(){return"[object Object]"},extend:function(I){var O=this;return I&&p.a.P(I,function(m,P){var R=p.Ta[m];typeof R=="function"&&(O=R(O,P)||O)}),O}};p.L(T,"init",T.qb),p.L(T,"subscribe",T.subscribe),p.L(T,"extend",T.extend),p.L(T,"getSubscriptionsCount",T.Bd),p.a.Ba&&p.a.setPrototypeOf(T,Function.prototype),p.T.fn=T,p.Qc=function(I){return I!=null&&typeof I.subscribe=="function"&&typeof I.notifySubscribers=="function"},p.b("subscribable",p.T),p.b("isSubscribable",p.Qc),p.S=p.u=function(){function I(U){m.push(P),P=U}function O(){P=m.pop()}var m=[],P,R=0;return{xc:I,end:O,cc:function(U){if(P){if(!p.Qc(U))throw Error("Only subscribable things can act as dependencies");P.od.call(P.pd,U,U.fd||(U.fd=++R))}},G:function(U,W,q){try{return I(),U.apply(W,q||[])}finally{O()}},qa:function(){if(P)return P.o.qa()},Va:function(){if(P)return P.o.Va()},Ya:function(){if(P)return P.Ya},o:function(){if(P)return P.o}}}(),p.b("computedContext",p.S),p.b("computedContext.getDependenciesCount",p.S.qa),p.b("computedContext.getDependencies",p.S.Va),p.b("computedContext.isInitial",p.S.Ya),p.b("computedContext.registerDependency",p.S.cc),p.b("ignoreDependencies",p.Yd=p.u.G);var b=p.a.Da("_latestValue");p.ta=function(I){function O(){return 0<arguments.length?(O.sb(O[b],arguments[0])&&(O.ya(),O[b]=arguments[0],O.xa()),this):(p.u.cc(O),O[b])}return O[b]=I,p.a.Ba||p.a.extend(O,p.T.fn),p.T.fn.qb(O),p.a.Ab(O,x),p.options.deferUpdates&&p.Ta.deferred(O,!0),O};var x={equalityComparer:c,v:function(){return this[b]},xa:function(){this.notifySubscribers(this[b],"spectate"),this.notifySubscribers(this[b])},ya:function(){this.notifySubscribers(this[b],"beforeChange")}};p.a.Ba&&p.a.setPrototypeOf(x,p.T.fn);var v=p.ta.Ma="__ko_proto__";x[v]=p.ta,p.O=function(I){if((I=typeof I=="function"&&I[v])&&I!==x[v]&&I!==p.o.fn[v])throw Error("Invalid object that looks like an observable; possibly from another Knockout instance");return!!I},p.Za=function(I){return typeof I=="function"&&(I[v]===x[v]||I[v]===p.o.fn[v]&&I.Nc)},p.b("observable",p.ta),p.b("isObservable",p.O),p.b("isWriteableObservable",p.Za),p.b("isWritableObservable",p.Za),p.b("observable.fn",x),p.L(x,"peek",x.v),p.L(x,"valueHasMutated",x.xa),p.L(x,"valueWillMutate",x.ya),p.Ha=function(I){if(I=I||[],typeof I!="object"||!("length"in I))throw Error("The argument passed when initializing an observable array must be an array, or null, or undefined.");return I=p.ta(I),p.a.Ab(I,p.Ha.fn),I.extend({trackArrayChanges:!0})},p.Ha.fn={remove:function(I){for(var O=this.v(),m=[],P=typeof I!="function"||p.O(I)?function(W){return W===I}:I,R=0;R<O.length;R++){var U=O[R];if(P(U)){if(m.length===0&&this.ya(),O[R]!==U)throw Error("Array modified during remove; cannot remove item");m.push(U),O.splice(R,1),R--}}return m.length&&this.xa(),m},removeAll:function(I){if(I===e){var O=this.v(),m=O.slice(0);return this.ya(),O.splice(0,O.length),this.xa(),m}return I?this.remove(function(P){return 0<=p.a.A(I,P)}):[]},destroy:function(I){var O=this.v(),m=typeof I!="function"||p.O(I)?function(U){return U===I}:I;this.ya();for(var P=O.length-1;0<=P;P--){var R=O[P];m(R)&&(R._destroy=!0)}this.xa()},destroyAll:function(I){return I===e?this.destroy(function(){return!0}):I?this.destroy(function(O){return 0<=p.a.A(I,O)}):[]},indexOf:function(I){var O=this();return p.a.A(O,I)},replace:function(I,O){var m=this.indexOf(I);0<=m&&(this.ya(),this.v()[m]=O,this.xa())},sorted:function(I){var O=this().slice(0);return I?O.sort(I):O.sort()},reversed:function(){return this().slice(0).reverse()}},p.a.Ba&&p.a.setPrototypeOf(p.Ha.fn,p.ta.fn),p.a.D("pop push reverse shift sort splice unshift".split(" "),function(I){p.Ha.fn[I]=function(){var O=this.v();this.ya(),this.zc(O,I,arguments);var m=O[I].apply(O,arguments);return this.xa(),m===O?this:m}}),p.a.D(["slice"],function(I){p.Ha.fn[I]=function(){var O=this();return O[I].apply(O,arguments)}}),p.Pc=function(I){return p.O(I)&&typeof I.remove=="function"&&typeof I.push=="function"},p.b("observableArray",p.Ha),p.b("isObservableArray",p.Pc),p.Ta.trackArrayChanges=function(I,O){function m(){function K(){if(q){var se=[].concat(I.v()||[]),Q;I.Wa("arrayChange")&&((!R||1<q)&&(R=p.a.Pb(Y,se,I.Ob)),Q=R),Y=se,R=null,q=0,Q&&Q.length&&I.notifySubscribers(Q,"arrayChange")}}P?K():(P=!0,W=I.subscribe(function(){++q},null,"spectate"),Y=[].concat(I.v()||[]),R=null,U=I.subscribe(K))}if(I.Ob={},O&&typeof O=="object"&&p.a.extend(I.Ob,O),I.Ob.sparse=!0,!I.zc){var P=!1,R=null,U,W,q=0,Y,j=I.Qa,ee=I.hb;I.Qa=function(K){j&&j.call(I,K),K==="arrayChange"&&m()},I.hb=function(K){ee&&ee.call(I,K),K!=="arrayChange"||I.Wa("arrayChange")||(U&&U.s(),W&&W.s(),W=U=null,P=!1,Y=e)},I.zc=function(K,se,Q){function Z(ae,ye,Ce){return J[J.length]={status:ae,value:ye,index:Ce}}if(P&&!q){var J=[],de=K.length,_e=Q.length,le=0;switch(se){case"push":le=de;case"unshift":for(se=0;se<_e;se++)Z("added",Q[se],le+se);break;case"pop":le=de-1;case"shift":de&&Z("deleted",K[le],le);break;case"splice":se=Math.min(Math.max(0,0>Q[0]?de+Q[0]:Q[0]),de);for(var de=_e===1?de:Math.min(se+(Q[1]||0),de),_e=se+_e-2,le=Math.max(de,_e),Te=[],pe=[],ne=2;se<le;++se,++ne)se<de&&pe.push(Z("deleted",K[se],se)),se<_e&&Te.push(Z("added",Q[ne],se));p.a.Kc(pe,Te);break;default:return}R=J}}}};var D=p.a.Da("_state");p.o=p.$=function(I,O,m){function P(){if(0<arguments.length){if(typeof R=="function")R.apply(U.nb,arguments);else throw Error("Cannot write a value to a ko.computed unless you specify a 'write' option. If you wish to read the current value, don't pass any parameters.");return this}return U.ra||p.u.cc(P),(U.ka||U.J&&P.Xa())&&P.ha(),U.X}if(typeof I=="object"?m=I:(m=m||{},I&&(m.read=I)),typeof m.read!="function")throw Error("Pass a function that returns the value of the ko.computed");var R=m.write,U={X:e,sa:!0,ka:!0,rb:!1,jc:!1,ra:!1,wb:!1,J:!1,Wc:m.read,nb:O||m.owner,l:m.disposeWhenNodeIsRemoved||m.l||null,Sa:m.disposeWhen||m.Sa,Rb:null,I:{},V:0,Ic:null};return P[D]=U,P.Nc=typeof R=="function",p.a.Ba||p.a.extend(P,p.T.fn),p.T.fn.qb(P),p.a.Ab(P,L),m.pure?(U.wb=!0,U.J=!0,p.a.extend(P,B)):m.deferEvaluation&&p.a.extend(P,V),p.options.deferUpdates&&p.Ta.deferred(P,!0),U.l&&(U.jc=!0,U.l.nodeType||(U.l=null)),U.J||m.deferEvaluation||P.ha(),U.l&&P.ja()&&p.a.K.za(U.l,U.Rb=function(){P.s()}),P};var L={equalityComparer:c,qa:function(){return this[D].V},Va:function(){var I=[];return p.a.P(this[D].I,function(O,m){I[m.Ka]=m.da}),I},Vb:function(I){if(!this[D].V)return!1;var O=this.Va();return p.a.A(O,I)!==-1?!0:!!p.a.Lb(O,function(m){return m.Vb&&m.Vb(I)})},uc:function(I,O,m){if(this[D].wb&&O===this)throw Error("A 'pure' computed must not be called recursively");this[D].I[I]=m,m.Ka=this[D].V++,m.La=O.ob()},Xa:function(){var I,O,m=this[D].I;for(I in m)if(Object.prototype.hasOwnProperty.call(m,I)&&(O=m[I],this.Ia&&O.da.Ja||O.da.Dd(O.La)))return!0},Jd:function(){this.Ia&&!this[D].rb&&this.Ia(!1)},ja:function(){var I=this[D];return I.ka||0<I.V},Rd:function(){this.Ja?this[D].ka&&(this[D].sa=!0):this.Hc()},$c:function(I){if(I.Hb){var O=I.subscribe(this.Jd,this,"dirty"),m=I.subscribe(this.Rd,this);return{da:I,s:function(){O.s(),m.s()}}}return I.subscribe(this.Hc,this)},Hc:function(){var I=this,O=I.throttleEvaluation;O&&0<=O?(clearTimeout(this[D].Ic),this[D].Ic=p.a.setTimeout(function(){I.ha(!0)},O)):I.Ia?I.Ia(!0):I.ha(!0)},ha:function(I){var O=this[D],m=O.Sa,P=!1;if(!O.rb&&!O.ra){if(O.l&&!p.a.Sb(O.l)||m&&m()){if(!O.jc){this.s();return}}else O.jc=!1;O.rb=!0;try{P=this.zd(I)}finally{O.rb=!1}return P}},zd:function(I){var O=this[D],P=!1,m=O.wb?e:!O.V,P={qd:this,mb:O.I,Qb:O.V};p.u.xc({pd:P,od:g,o:this,Ya:m}),O.I={},O.V=0;var R=this.yd(O,P);return O.V?P=this.sb(O.X,R):(this.s(),P=!0),P&&(O.J?this.Gb():this.notifySubscribers(O.X,"beforeChange"),O.X=R,this.notifySubscribers(O.X,"spectate"),!O.J&&I&&this.notifySubscribers(O.X),this.rc&&this.rc()),m&&this.notifySubscribers(O.X,"awake"),P},yd:function(I,O){try{var m=I.Wc;return I.nb?m.call(I.nb):m()}finally{p.u.end(),O.Qb&&!I.J&&p.a.P(O.mb,_),I.sa=I.ka=!1}},v:function(I){var O=this[D];return(O.ka&&(I||!O.V)||O.J&&this.Xa())&&this.ha(),O.X},ub:function(I){p.T.fn.ub.call(this,I),this.nc=function(){return this[D].J||(this[D].sa?this.ha():this[D].ka=!1),this[D].X},this.Ia=function(O){this.pc(this[D].X),this[D].ka=!0,O&&(this[D].sa=!0),this.qc(this,!O)}},s:function(){var I=this[D];!I.J&&I.I&&p.a.P(I.I,function(O,m){m.s&&m.s()}),I.l&&I.Rb&&p.a.K.yb(I.l,I.Rb),I.I=e,I.V=0,I.ra=!0,I.sa=!1,I.ka=!1,I.J=!1,I.l=e,I.Sa=e,I.Wc=e,this.Nc||(I.nb=e)}},B={Qa:function(I){var O=this,m=O[D];if(!m.ra&&m.J&&I=="change"){if(m.J=!1,m.sa||O.Xa())m.I=null,m.V=0,O.ha()&&O.Gb();else{var P=[];p.a.P(m.I,function(R,U){P[U.Ka]=R}),p.a.D(P,function(R,U){var W=m.I[R],q=O.$c(W.da);q.Ka=U,q.La=W.La,m.I[R]=q}),O.Xa()&&O.ha()&&O.Gb()}m.ra||O.notifySubscribers(m.X,"awake")}},hb:function(I){var O=this[D];O.ra||I!="change"||this.Wa("change")||(p.a.P(O.I,function(m,P){P.s&&(O.I[m]={da:P.da,Ka:P.Ka,La:P.La},P.s())}),O.J=!0,this.notifySubscribers(e,"asleep"))},ob:function(){var I=this[D];return I.J&&(I.sa||this.Xa())&&this.ha(),p.T.fn.ob.call(this)}},V={Qa:function(I){I!="change"&&I!="beforeChange"||this.v()}};p.a.Ba&&p.a.setPrototypeOf(L,p.T.fn);var M=p.ta.Ma;L[M]=p.o,p.Oc=function(I){return typeof I=="function"&&I[M]===L[M]},p.Fd=function(I){return p.Oc(I)&&I[D]&&I[D].wb},p.b("computed",p.o),p.b("dependentObservable",p.o),p.b("isComputed",p.Oc),p.b("isPureComputed",p.Fd),p.b("computed.fn",L),p.L(L,"peek",L.v),p.L(L,"dispose",L.s),p.L(L,"isActive",L.ja),p.L(L,"getDependenciesCount",L.qa),p.L(L,"getDependencies",L.Va),p.xb=function(I,O){return typeof I=="function"?p.o(I,O,{pure:!0}):(I=p.a.extend({},I),I.pure=!0,p.o(I,O))},p.b("pureComputed",p.xb),function(){function I(P,R,U){if(U=U||new m,P=R(P),typeof P!="object"||P===null||P===e||P instanceof RegExp||P instanceof Date||P instanceof String||P instanceof Number||P instanceof Boolean)return P;var W=P instanceof Array?[]:{};return U.save(P,W),O(P,function(q){var Y=R(P[q]);switch(typeof Y){case"boolean":case"number":case"string":case"function":W[q]=Y;break;case"object":case"undefined":var j=U.get(Y);W[q]=j!==e?j:I(Y,R,U)}}),W}function O(P,R){if(P instanceof Array){for(var U=0;U<P.length;U++)R(U);typeof P.toJSON=="function"&&R("toJSON")}else for(U in P)R(U)}function m(){this.keys=[],this.values=[]}p.ad=function(P){if(arguments.length==0)throw Error("When calling ko.toJS, pass the object you want to convert.");return I(P,function(R){for(var U=0;p.O(R)&&10>U;U++)R=R();return R})},p.toJSON=function(P,R,U){return P=p.ad(P),p.a.hc(P,R,U)},m.prototype={constructor:m,save:function(P,R){var U=p.a.A(this.keys,P);0<=U?this.values[U]=R:(this.keys.push(P),this.values.push(R))},get:function(P){return P=p.a.A(this.keys,P),0<=P?this.values[P]:e}}}(),p.b("toJS",p.ad),p.b("toJSON",p.toJSON),p.Wd=function(I,O,m){function P(R){var U=p.xb(I,m).extend({ma:"always"}),W=U.subscribe(function(q){q&&(W.s(),R(q))});return U.notifySubscribers(U.v()),W}return typeof Promise!="function"||O?P(O.bind(m)):new Promise(P)},p.b("when",p.Wd),function(){p.w={M:function(I){switch(p.a.R(I)){case"option":return I.__ko__hasDomDataOptionValue__===!0?p.a.g.get(I,p.c.options.$b):7>=p.a.W?I.getAttributeNode("value")&&I.getAttributeNode("value").specified?I.value:I.text:I.value;case"select":return 0<=I.selectedIndex?p.w.M(I.options[I.selectedIndex]):e;default:return I.value}},cb:function(I,O,m){switch(p.a.R(I)){case"option":typeof O=="string"?(p.a.g.set(I,p.c.options.$b,e),"__ko__hasDomDataOptionValue__"in I&&delete I.__ko__hasDomDataOptionValue__,I.value=O):(p.a.g.set(I,p.c.options.$b,O),I.__ko__hasDomDataOptionValue__=!0,I.value=typeof O=="number"?O:"");break;case"select":(O===""||O===null)&&(O=e);for(var P=-1,R=0,U=I.options.length,W;R<U;++R)if(W=p.w.M(I.options[R]),W==O||W===""&&O===e){P=R;break}(m||0<=P||O===e&&1<I.size)&&(I.selectedIndex=P,p.a.W===6&&p.a.setTimeout(function(){I.selectedIndex=P},0));break;default:(O===null||O===e)&&(O=""),I.value=O}}}}(),p.b("selectExtensions",p.w),p.b("selectExtensions.readValue",p.w.M),p.b("selectExtensions.writeValue",p.w.cb),p.m=function(){function I(q){q=p.a.Db(q),q.charCodeAt(0)===123&&(q=q.slice(1,-1)),q+=`
|
||
,`;var Y=[],j=q.match(P),ee,K=[],se=0;if(1<j.length){for(var Q=0,Z;Z=j[Q];++Q){var J=Z.charCodeAt(0);if(J===44){if(0>=se){Y.push(ee&&K.length?{key:ee,value:K.join("")}:{unknown:ee||K.join("")}),ee=se=0,K=[];continue}}else if(J===58){if(!se&&!ee&&K.length===1){ee=K.pop();continue}}else{if(J===47&&1<Z.length&&(Z.charCodeAt(1)===47||Z.charCodeAt(1)===42))continue;J===47&&Q&&1<Z.length?(J=j[Q-1].match(R))&&!U[J[0]]&&(q=q.substr(q.indexOf(Z)+1),j=q.match(P),Q=-1,Z="/"):J===40||J===123||J===91?++se:J===41||J===125||J===93?--se:ee||K.length||J!==34&&J!==39||(Z=Z.slice(1,-1))}K.push(Z)}if(0<se)throw Error("Unbalanced parentheses, braces, or brackets")}return Y}var O=["true","false","null","undefined"],m=/^(?:[$_a-z][$\w]*|(.+)(\.\s*[$_a-z][$\w]*|\[.+\]))$/i,P=RegExp(`"(?:\\\\.|[^"])*"|'(?:\\\\.|[^'])*'|\`(?:\\\\.|[^\`])*\`|/\\*(?:[^*]|\\*+[^*/])*\\*+/|//.*
|
||
|/(?:\\\\.|[^/])+/w*|[^\\s:,/][^,"'\`{}()/:[\\]]*[^\\s,"'\`{}()/:[\\]]|[^\\s]`,"g"),R=/[\])"'A-Za-z0-9_$]+$/,U={in:1,return:1,typeof:1},W={};return{Ra:[],wa:W,ac:I,vb:function(q,Y){function j(J,de){var _e;if(!Q){var le=p.getBindingHandler(J);if(le&&le.preprocess&&!(de=le.preprocess(de,J,j)))return;(le=W[J])&&(_e=de,0<=p.a.A(O,_e)?_e=!1:(le=_e.match(m),_e=le===null?!1:le[1]?"Object("+le[1]+")"+le[2]:_e),le=_e),le&&K.push("'"+(typeof W[J]=="string"?W[J]:J)+"':function(_z){"+_e+"=_z}")}se&&(de="function(){return "+de+" }"),ee.push("'"+J+"':"+de)}Y=Y||{};var ee=[],K=[],se=Y.valueAccessors,Q=Y.bindingParams,Z=typeof q=="string"?I(q):q;return p.a.D(Z,function(J){j(J.key||J.unknown,J.value)}),K.length&&j("_ko_property_writers","{"+K.join(",")+" }"),ee.join(",")},Id:function(q,Y){for(var j=0;j<q.length;j++)if(q[j].key==Y)return!0;return!1},eb:function(q,Y,j,ee,K){q&&p.O(q)?!p.Za(q)||K&&q.v()===ee||q(ee):(q=Y.get("_ko_property_writers"))&&q[j]&&q[j](ee)}}}(),p.b("expressionRewriting",p.m),p.b("expressionRewriting.bindingRewriteValidators",p.m.Ra),p.b("expressionRewriting.parseObjectLiteral",p.m.ac),p.b("expressionRewriting.preProcessBindings",p.m.vb),p.b("expressionRewriting._twoWayBindings",p.m.wa),p.b("jsonExpressionRewriting",p.m),p.b("jsonExpressionRewriting.insertPropertyAccessorsIntoJson",p.m.vb),function(){function I(j){return j.nodeType==8&&U.test(R?j.text:j.nodeValue)}function O(j){return j.nodeType==8&&W.test(R?j.text:j.nodeValue)}function m(j,ee){for(var K=j,se=1,Q=[];K=K.nextSibling;){if(O(K)&&(p.a.g.set(K,Y,!0),se--,se===0))return Q;Q.push(K),I(K)&&se++}if(!ee)throw Error("Cannot find closing comment tag to match: "+j.nodeValue);return null}function P(j,ee){var K=m(j,ee);return K?0<K.length?K[K.length-1].nextSibling:j.nextSibling:null}var R=n&&n.createComment("test").text==="<!--test-->",U=R?/^\x3c!--\s*ko(?:\s+([\s\S]+))?\s*--\x3e$/:/^\s*ko(?:\s+([\s\S]+))?\s*$/,W=R?/^\x3c!--\s*\/ko\s*--\x3e$/:/^\s*\/ko\s*$/,q={ul:!0,ol:!0},Y="__ko_matchedEndComment__";p.h={ea:{},childNodes:function(j){return I(j)?m(j):j.childNodes},Ea:function(j){if(I(j)){j=p.h.childNodes(j);for(var ee=0,K=j.length;ee<K;ee++)p.removeNode(j[ee])}else p.a.Tb(j)},va:function(j,ee){if(I(j)){p.h.Ea(j);for(var K=j.nextSibling,se=0,Q=ee.length;se<Q;se++)K.parentNode.insertBefore(ee[se],K)}else p.a.va(j,ee)},Vc:function(j,ee){var K;I(j)?(K=j.nextSibling,j=j.parentNode):K=j.firstChild,K?ee!==K&&j.insertBefore(ee,K):j.appendChild(ee)},Wb:function(j,ee,K){K?(K=K.nextSibling,I(j)&&(j=j.parentNode),K?ee!==K&&j.insertBefore(ee,K):j.appendChild(ee)):p.h.Vc(j,ee)},firstChild:function(j){if(I(j))return!j.nextSibling||O(j.nextSibling)?null:j.nextSibling;if(j.firstChild&&O(j.firstChild))throw Error("Found invalid end comment, as the first child of "+j);return j.firstChild},nextSibling:function(j){if(I(j)&&(j=P(j)),j.nextSibling&&O(j.nextSibling)){var ee=j.nextSibling;if(O(ee)&&!p.a.g.get(ee,Y))throw Error("Found end comment without a matching opening comment, as child of "+j);return null}return j.nextSibling},Cd:I,Vd:function(j){return(j=(R?j.text:j.nodeValue).match(U))?j[1]:null},Sc:function(j){if(q[p.a.R(j)]){var ee=j.firstChild;if(ee)do if(ee.nodeType===1){var K;K=ee.firstChild;var se=null;if(K)do if(se)se.push(K);else if(I(K)){var Q=P(K,!0);Q?K=Q:se=[K]}else O(K)&&(se=[K]);while(K=K.nextSibling);if(K=se)for(se=ee.nextSibling,Q=0;Q<K.length;Q++)se?j.insertBefore(K[Q],se):j.appendChild(K[Q])}while(ee=ee.nextSibling)}}}}(),p.b("virtualElements",p.h),p.b("virtualElements.allowedBindings",p.h.ea),p.b("virtualElements.emptyNode",p.h.Ea),p.b("virtualElements.insertAfter",p.h.Wb),p.b("virtualElements.prepend",p.h.Vc),p.b("virtualElements.setDomNodeChildren",p.h.va),function(){p.ga=function(){this.nd={}},p.a.extend(p.ga.prototype,{nodeHasBindings:function(I){switch(I.nodeType){case 1:return I.getAttribute("data-bind")!=null||p.j.getComponentNameForNode(I);case 8:return p.h.Cd(I);default:return!1}},getBindings:function(I,O){var m=this.getBindingsString(I,O),m=m?this.parseBindingsString(m,O,I):null;return p.j.tc(m,I,O,!1)},getBindingAccessors:function(I,O){var m=this.getBindingsString(I,O),m=m?this.parseBindingsString(m,O,I,{valueAccessors:!0}):null;return p.j.tc(m,I,O,!0)},getBindingsString:function(I){switch(I.nodeType){case 1:return I.getAttribute("data-bind");case 8:return p.h.Vd(I);default:return null}},parseBindingsString:function(I,O,m,P){try{var R=this.nd,U=I+(P&&P.valueAccessors||""),W;if(!(W=R[U])){var q,Y="with($context){with($data||{}){return{"+p.m.vb(I,P)+"}}}";q=new Function("$context","$element",Y),W=R[U]=q}return W(O,m)}catch(j){throw j.message=`Unable to parse bindings.
|
||
Bindings value: `+I+`
|
||
Message: `+j.message,j}}}),p.ga.instance=new p.ga}(),p.b("bindingProvider",p.ga),function(){function I(le){var Te=(le=p.a.g.get(le,_e))&&le.N;Te&&(le.N=null,Te.Tc())}function O(le,Te,pe){this.node=le,this.yc=Te,this.kb=[],this.H=!1,Te.N||p.a.K.za(le,I),pe&&pe.N&&(pe.N.kb.push(le),this.Kb=pe)}function m(le){return function(){return le}}function P(le){return le()}function R(le){return p.a.Ga(p.u.G(le),function(Te,pe){return function(){return le()[pe]}})}function U(le,Te,pe){return typeof le=="function"?R(le.bind(null,Te,pe)):p.a.Ga(le,m)}function W(le,Te){return R(this.getBindings.bind(this,le,Te))}function q(le,Te){var pe=p.h.firstChild(Te);if(pe){var ne,ae=p.ga.instance,ye=ae.preprocessNode;if(ye){for(;ne=pe;)pe=p.h.nextSibling(ne),ye.call(ae,ne);pe=p.h.firstChild(Te)}for(;ne=pe;)pe=p.h.nextSibling(ne),Y(le,ne)}p.i.ma(Te,p.i.H)}function Y(le,Te){var pe=le,ne=Te.nodeType===1;ne&&p.h.Sc(Te),(ne||p.ga.instance.nodeHasBindings(Te))&&(pe=ee(Te,null,le).bindingContextForDescendants),pe&&!J[p.a.R(Te)]&&q(pe,Te)}function j(le){var Te=[],pe={},ne=[];return p.a.P(le,function ae(ye){if(!pe[ye]){var Ce=p.getBindingHandler(ye);Ce&&(Ce.after&&(ne.push(ye),p.a.D(Ce.after,function(Be){if(le[Be]){if(p.a.A(ne,Be)!==-1)throw Error("Cannot combine the following bindings, because they have a cyclic dependency: "+ne.join(", "));ae(Be)}}),ne.length--),Te.push({key:ye,Mc:Ce})),pe[ye]=!0}}),Te}function ee(le,Te,pe){var ne=p.a.g.Ub(le,_e,{}),ae=ne.hd;if(!Te){if(ae)throw Error("You cannot apply bindings multiple times to the same element.");ne.hd=!0}ae||(ne.context=pe),ne.Zb||(ne.Zb={});var ye;if(Te&&typeof Te!="function")ye=Te;else{var Ce=p.ga.instance,Be=Ce.getBindingAccessors||W,Le=p.$(function(){return(ye=Te?Te(pe,le):Be.call(Ce,le,pe))&&(pe[se]&&pe[se](),pe[Z]&&pe[Z]()),ye},null,{l:le});ye&&Le.ja()||(Le=null)}var Ve=pe,Ie;if(ye){var He=function(){return p.a.Ga(Le?Le():ye,P)},Me=Le?function(qe){return function(){return P(Le()[qe])}}:function(qe){return ye[qe]};He.get=function(qe){return ye[qe]&&P(Me(qe))},He.has=function(qe){return qe in ye},p.i.H in ye&&p.i.subscribe(le,p.i.H,function(){var qe=(0,ye[p.i.H])();if(qe){var Ne=p.h.childNodes(le);Ne.length&&qe(Ne,p.Ec(Ne[0]))}}),p.i.pa in ye&&(Ve=p.i.Cb(le,pe),p.i.subscribe(le,p.i.pa,function(){var qe=(0,ye[p.i.pa])();qe&&p.h.firstChild(le)&&qe(le)})),ne=j(ye),p.a.D(ne,function(qe){var Ne=qe.Mc.init,ke=qe.Mc.update,Qe=qe.key;if(le.nodeType===8&&!p.h.ea[Qe])throw Error("The binding '"+Qe+"' cannot be used with virtual elements");try{typeof Ne=="function"&&p.u.G(function(){var Ge=Ne(le,Me(Qe),He,Ve.$data,Ve);if(Ge&&Ge.controlsDescendantBindings){if(Ie!==e)throw Error("Multiple bindings ("+Ie+" and "+Qe+") are trying to control descendant bindings of the same element. You cannot use these bindings together on the same element.");Ie=Qe}}),typeof ke=="function"&&p.$(function(){ke(le,Me(Qe),He,Ve.$data,Ve)},null,{l:le})}catch(Ge){throw Ge.message='Unable to process binding "'+Qe+": "+ye[Qe]+`"
|
||
Message: `+Ge.message,Ge}})}return ne=Ie===e,{shouldBindDescendants:ne,bindingContextForDescendants:ne&&Ve}}function K(le,Te){return le&&le instanceof p.fa?le:new p.fa(le,e,e,Te)}var se=p.a.Da("_subscribable"),Q=p.a.Da("_ancestorBindingInfo"),Z=p.a.Da("_dataDependency");p.c={};var J={script:!0,textarea:!0,template:!0};p.getBindingHandler=function(le){return p.c[le]};var de={};p.fa=function(le,Te,pe,ne,ae){function ye(){var Me=Ve?Le():Le,qe=p.a.f(Me);return Te?(p.a.extend(Ce,Te),Q in Te&&(Ce[Q]=Te[Q])):(Ce.$parents=[],Ce.$root=qe,Ce.ko=p),Ce[se]=Ie,Be?qe=Ce.$data:(Ce.$rawData=Me,Ce.$data=qe),pe&&(Ce[pe]=qe),ne&&ne(Ce,Te,qe),Te&&Te[se]&&!p.S.o().Vb(Te[se])&&Te[se](),He&&(Ce[Z]=He),Ce.$data}var Ce=this,Be=le===de,Le=Be?e:le,Ve=typeof Le=="function"&&!p.O(Le),Ie,He=ae&&ae.dataDependency;ae&&ae.exportDependencies?ye():(Ie=p.xb(ye),Ie.v(),Ie.ja()?Ie.equalityComparer=null:Ce[se]=e)},p.fa.prototype.createChildContext=function(le,Te,pe,ne){if(!ne&&Te&&typeof Te=="object"&&(ne=Te,Te=ne.as,pe=ne.extend),Te&&ne&&ne.noChildContext){var ae=typeof le=="function"&&!p.O(le);return new p.fa(de,this,null,function(ye){pe&&pe(ye),ye[Te]=ae?le():le},ne)}return new p.fa(le,this,Te,function(ye,Ce){ye.$parentContext=Ce,ye.$parent=Ce.$data,ye.$parents=(Ce.$parents||[]).slice(0),ye.$parents.unshift(ye.$parent),pe&&pe(ye)},ne)},p.fa.prototype.extend=function(le,Te){return new p.fa(de,this,null,function(pe){p.a.extend(pe,typeof le=="function"?le(pe):le)},Te)};var _e=p.a.g.Z();O.prototype.Tc=function(){this.Kb&&this.Kb.N&&this.Kb.N.sd(this.node)},O.prototype.sd=function(le){p.a.Pa(this.kb,le),!this.kb.length&&this.H&&this.Cc()},O.prototype.Cc=function(){this.H=!0,this.yc.N&&!this.kb.length&&(this.yc.N=null,p.a.K.yb(this.node,I),p.i.ma(this.node,p.i.pa),this.Tc())},p.i={H:"childrenComplete",pa:"descendantsComplete",subscribe:function(le,Te,pe,ne,ae){var ye=p.a.g.Ub(le,_e,{});return ye.Fa||(ye.Fa=new p.T),ae&&ae.notifyImmediately&&ye.Zb[Te]&&p.u.G(pe,ne,[le]),ye.Fa.subscribe(pe,ne,Te)},ma:function(le,Te){var pe=p.a.g.get(le,_e);if(pe&&(pe.Zb[Te]=!0,pe.Fa&&pe.Fa.notifySubscribers(le,Te),Te==p.i.H)){if(pe.N)pe.N.Cc();else if(pe.N===e&&pe.Fa&&pe.Fa.Wa(p.i.pa))throw Error("descendantsComplete event not supported for bindings on this node")}},Cb:function(le,Te){var pe=p.a.g.Ub(le,_e,{});return pe.N||(pe.N=new O(le,pe,Te[Q])),Te[Q]==pe?Te:Te.extend(function(ne){ne[Q]=pe})}},p.Td=function(le){return(le=p.a.g.get(le,_e))&&le.context},p.ib=function(le,Te,pe){return le.nodeType===1&&p.h.Sc(le),ee(le,Te,K(pe))},p.ld=function(le,Te,pe){return pe=K(pe),p.ib(le,U(Te,pe,le),pe)},p.Oa=function(le,Te){Te.nodeType!==1&&Te.nodeType!==8||q(K(le),Te)},p.vc=function(le,Te,pe){if(!o&&t.jQuery&&(o=t.jQuery),2>arguments.length){if(Te=n.body,!Te)throw Error("ko.applyBindings: could not find document.body; has the document been loaded?")}else if(!Te||Te.nodeType!==1&&Te.nodeType!==8)throw Error("ko.applyBindings: first parameter should be your view model; second parameter should be a DOM node");Y(K(le,pe),Te)},p.Dc=function(le){return!le||le.nodeType!==1&&le.nodeType!==8?e:p.Td(le)},p.Ec=function(le){return(le=p.Dc(le))?le.$data:e},p.b("bindingHandlers",p.c),p.b("bindingEvent",p.i),p.b("bindingEvent.subscribe",p.i.subscribe),p.b("bindingEvent.startPossiblyAsyncContentBinding",p.i.Cb),p.b("applyBindings",p.vc),p.b("applyBindingsToDescendants",p.Oa),p.b("applyBindingAccessorsToNode",p.ib),p.b("applyBindingsToNode",p.ld),p.b("contextFor",p.Dc),p.b("dataFor",p.Ec)}(),function(I){function O(W,q){var Y=Object.prototype.hasOwnProperty.call(R,W)?R[W]:I,j;Y?Y.subscribe(q):(Y=R[W]=new p.T,Y.subscribe(q),m(W,function(ee,K){var se=!(!K||!K.synchronous);U[W]={definition:ee,Gd:se},delete R[W],j||se?Y.notifySubscribers(ee):p.na.zb(function(){Y.notifySubscribers(ee)})}),j=!0)}function m(W,q){P("getConfig",[W],function(Y){Y?P("loadComponent",[W,Y],function(j){q(j,Y)}):q(null,null)})}function P(W,q,Y,j){j||(j=p.j.loaders.slice(0));var ee=j.shift();if(ee){var K=ee[W];if(K){var se=!1;if(K.apply(ee,q.concat(function(Q){se?Y(null):Q!==null?Y(Q):P(W,q,Y,j)}))!==I&&(se=!0,!ee.suppressLoaderExceptions))throw Error("Component loaders must supply values by invoking the callback, not by returning values synchronously.")}else P(W,q,Y,j)}else Y(null)}var R={},U={};p.j={get:function(W,q){var Y=Object.prototype.hasOwnProperty.call(U,W)?U[W]:I;Y?Y.Gd?p.u.G(function(){q(Y.definition)}):p.na.zb(function(){q(Y.definition)}):O(W,q)},Bc:function(W){delete U[W]},oc:P},p.j.loaders=[],p.b("components",p.j),p.b("components.get",p.j.get),p.b("components.clearCachedDefinition",p.j.Bc)}(),function(){function I(Y,j,ee,K){function se(){--Z===0&&K(Q)}var Q={},Z=2,J=ee.template;ee=ee.viewModel,J?R(j,J,function(de){p.j.oc("loadTemplate",[Y,de],function(_e){Q.template=_e,se()})}):se(),ee?R(j,ee,function(de){p.j.oc("loadViewModel",[Y,de],function(_e){Q[q]=_e,se()})}):se()}function O(Y,j,ee){if(typeof j=="function")ee(function(se){return new j(se)});else if(typeof j[q]=="function")ee(j[q]);else if("instance"in j){var K=j.instance;ee(function(){return K})}else"viewModel"in j?O(Y,j.viewModel,ee):Y("Unknown viewModel value: "+j)}function m(Y){switch(p.a.R(Y)){case"script":return p.a.ua(Y.text);case"textarea":return p.a.ua(Y.value);case"template":if(P(Y.content))return p.a.Ca(Y.content.childNodes)}return p.a.Ca(Y.childNodes)}function P(Y){return t.DocumentFragment?Y instanceof DocumentFragment:Y&&Y.nodeType===11}function R(Y,j,ee){typeof j.require=="string"?a||t.require?(a||t.require)([j.require],function(K){K&&typeof K=="object"&&K.Xd&&K.default&&(K=K.default),ee(K)}):Y("Uses require, but no AMD loader is present"):ee(j)}function U(Y){return function(j){throw Error("Component '"+Y+"': "+j)}}var W={};p.j.register=function(Y,j){if(!j)throw Error("Invalid configuration for "+Y);if(p.j.tb(Y))throw Error("Component "+Y+" is already registered");W[Y]=j},p.j.tb=function(Y){return Object.prototype.hasOwnProperty.call(W,Y)},p.j.unregister=function(Y){delete W[Y],p.j.Bc(Y)},p.j.Fc={getConfig:function(Y,j){j(p.j.tb(Y)?W[Y]:null)},loadComponent:function(Y,j,ee){var K=U(Y);R(K,j,function(se){I(Y,K,se,ee)})},loadTemplate:function(Y,j,ee){if(Y=U(Y),typeof j=="string")ee(p.a.ua(j));else if(j instanceof Array)ee(j);else if(P(j))ee(p.a.la(j.childNodes));else if(j.element)if(j=j.element,t.HTMLElement?j instanceof HTMLElement:j&&j.tagName&&j.nodeType===1)ee(m(j));else if(typeof j=="string"){var K=n.getElementById(j);K?ee(m(K)):Y("Cannot find element with ID "+j)}else Y("Unknown element type: "+j);else Y("Unknown template value: "+j)},loadViewModel:function(Y,j,ee){O(U(Y),j,ee)}};var q="createViewModel";p.b("components.register",p.j.register),p.b("components.isRegistered",p.j.tb),p.b("components.unregister",p.j.unregister),p.b("components.defaultLoader",p.j.Fc),p.j.loaders.push(p.j.Fc),p.j.dd=W}(),function(){function I(m,P){var R=m.getAttribute("params");if(R){var R=O.parseBindingsString(R,P,m,{valueAccessors:!0,bindingParams:!0}),R=p.a.Ga(R,function(q){return p.o(q,null,{l:m})}),U=p.a.Ga(R,function(q){var Y=q.v();return q.ja()?p.o({read:function(){return p.a.f(q())},write:p.Za(Y)&&function(j){q()(j)},l:m}):Y});return Object.prototype.hasOwnProperty.call(U,"$raw")||(U.$raw=R),U}return{$raw:{}}}p.j.getComponentNameForNode=function(m){var P=p.a.R(m);if(p.j.tb(P)&&(P.indexOf("-")!=-1||""+m=="[object HTMLUnknownElement]"||8>=p.a.W&&m.tagName===P))return P},p.j.tc=function(m,P,R,U){if(P.nodeType===1){var W=p.j.getComponentNameForNode(P);if(W){if(m=m||{},m.component)throw Error('Cannot use the "component" binding on a custom element matching a component');var q={name:W,params:I(P,R)};m.component=U?function(){return q}:q}}return m};var O=new p.ga;9>p.a.W&&(p.j.register=function(m){return function(P){return m.apply(this,arguments)}}(p.j.register),n.createDocumentFragment=function(m){return function(){var P=m();return p.j.dd,P}}(n.createDocumentFragment))}(),function(){function I(P,R,U){if(R=R.template,!R)throw Error("Component '"+P+"' has no template");P=p.a.Ca(R),p.h.va(U,P)}function O(P,R,U){var W=P.createViewModel;return W?W.call(P,R,U):R}var m=0;p.c.component={init:function(P,R,U,W,q){function Y(){var Q=j&&j.dispose;typeof Q=="function"&&Q.call(j),K&&K.s(),ee=j=K=null}var j,ee,K,se=p.a.la(p.h.childNodes(P));return p.h.Ea(P),p.a.K.za(P,Y),p.o(function(){var Q=p.a.f(R()),Z,J;if(typeof Q=="string"?Z=Q:(Z=p.a.f(Q.name),J=p.a.f(Q.params)),!Z)throw Error("No component name specified");var de=p.i.Cb(P,q),_e=ee=++m;p.j.get(Z,function(le){if(ee===_e){if(Y(),!le)throw Error("Unknown component '"+Z+"'");I(Z,le,P);var Te=O(le,J,{element:P,templateNodes:se});le=de.createChildContext(Te,{extend:function(pe){pe.$component=Te,pe.$componentTemplateNodes=se}}),Te&&Te.koDescendantsComplete&&(K=p.i.subscribe(P,p.i.pa,Te.koDescendantsComplete,Te)),j=Te,p.Oa(le,P)}})},null,{l:P}),{controlsDescendantBindings:!0}}},p.h.ea.component=!0}();var H={class:"className",for:"htmlFor"};p.c.attr={update:function(I,O){var m=p.a.f(O())||{};p.a.P(m,function(P,R){R=p.a.f(R);var U=P.indexOf(":"),U="lookupNamespaceURI"in I&&0<U&&I.lookupNamespaceURI(P.substr(0,U)),W=R===!1||R===null||R===e;W?U?I.removeAttributeNS(U,P):I.removeAttribute(P):R=R.toString(),8>=p.a.W&&P in H?(P=H[P],W?I.removeAttribute(P):I[P]=R):W||(U?I.setAttributeNS(U,P,R):I.setAttribute(P,R)),P==="name"&&p.a.Yc(I,W?"":R)})}},function(){p.c.checked={after:["value","attr"],init:function(I,O,m){function P(){var Q=I.checked,Z=U();if(!p.S.Ya()&&(Q||!q&&!p.S.qa())){var J=p.u.G(O);if(j){var de=ee?J.v():J,_e=se;se=Z,_e!==Z?Q&&(p.a.Na(de,Z,!0),p.a.Na(de,_e,!1)):p.a.Na(de,Z,Q),ee&&p.Za(J)&&J(de)}else W&&(Z===e?Z=Q:Q||(Z=e)),p.m.eb(J,m,"checked",Z,!0)}}function R(){var Q=p.a.f(O()),Z=U();j?(I.checked=0<=p.a.A(Q,Z),se=Z):I.checked=W&&Z===e?!!Q:U()===Q}var U=p.xb(function(){if(m.has("checkedValue"))return p.a.f(m.get("checkedValue"));if(K)return m.has("value")?p.a.f(m.get("value")):I.value}),W=I.type=="checkbox",q=I.type=="radio";if(W||q){var Y=O(),j=W&&p.a.f(Y)instanceof Array,ee=!(j&&Y.push&&Y.splice),K=q||j,se=j?U():e;q&&!I.name&&p.c.uniqueName.init(I,function(){return!0}),p.o(P,null,{l:I}),p.a.B(I,"click",P),p.o(R,null,{l:I}),Y=e}}},p.m.wa.checked=!0,p.c.checkedValue={update:function(I,O){I.value=p.a.f(O())}}}(),p.c.class={update:function(I,O){var m=p.a.Db(p.a.f(O()));p.a.Eb(I,I.__ko__cssValue,!1),I.__ko__cssValue=m,p.a.Eb(I,m,!0)}},p.c.css={update:function(I,O){var m=p.a.f(O());m!==null&&typeof m=="object"?p.a.P(m,function(P,R){R=p.a.f(R),p.a.Eb(I,P,R)}):p.c.class.update(I,O)}},p.c.enable={update:function(I,O){var m=p.a.f(O());m&&I.disabled?I.removeAttribute("disabled"):m||I.disabled||(I.disabled=!0)}},p.c.disable={update:function(I,O){p.c.enable.update(I,function(){return!p.a.f(O())})}},p.c.event={init:function(I,O,m,P,R){var U=O()||{};p.a.P(U,function(W){typeof W=="string"&&p.a.B(I,W,function(q){var Y,j=O()[W];if(j){try{var ee=p.a.la(arguments);P=R.$data,ee.unshift(P),Y=j.apply(P,ee)}finally{Y!==!0&&(q.preventDefault?q.preventDefault():q.returnValue=!1)}m.get(W+"Bubble")===!1&&(q.cancelBubble=!0,q.stopPropagation&&q.stopPropagation())}})})}},p.c.foreach={Rc:function(I){return function(){var O=I(),m=p.a.bc(O);return!m||typeof m.length=="number"?{foreach:O,templateEngine:p.ba.Ma}:(p.a.f(O),{foreach:m.data,as:m.as,noChildContext:m.noChildContext,includeDestroyed:m.includeDestroyed,afterAdd:m.afterAdd,beforeRemove:m.beforeRemove,afterRender:m.afterRender,beforeMove:m.beforeMove,afterMove:m.afterMove,templateEngine:p.ba.Ma})}},init:function(I,O){return p.c.template.init(I,p.c.foreach.Rc(O))},update:function(I,O,m,P,R){return p.c.template.update(I,p.c.foreach.Rc(O),m,P,R)}},p.m.Ra.foreach=!1,p.h.ea.foreach=!0,p.c.hasfocus={init:function(I,O,m){function P(W){I.__ko_hasfocusUpdating=!0;var q=I.ownerDocument;if("activeElement"in q){var Y;try{Y=q.activeElement}catch{Y=q.body}W=Y===I}q=O(),p.m.eb(q,m,"hasfocus",W,!0),I.__ko_hasfocusLastValue=W,I.__ko_hasfocusUpdating=!1}var R=P.bind(null,!0),U=P.bind(null,!1);p.a.B(I,"focus",R),p.a.B(I,"focusin",R),p.a.B(I,"blur",U),p.a.B(I,"focusout",U),I.__ko_hasfocusLastValue=!1},update:function(I,O){var m=!!p.a.f(O());I.__ko_hasfocusUpdating||I.__ko_hasfocusLastValue===m||(m?I.focus():I.blur(),!m&&I.__ko_hasfocusLastValue&&I.ownerDocument.body.focus(),p.u.G(p.a.Fb,null,[I,m?"focusin":"focusout"]))}},p.m.wa.hasfocus=!0,p.c.hasFocus=p.c.hasfocus,p.m.wa.hasFocus="hasfocus",p.c.html={init:function(){return{controlsDescendantBindings:!0}},update:function(I,O){p.a.fc(I,O())}},function(){function I(O,m,P){p.c[O]={init:function(R,U,W,q,Y){var j,ee,K={},se,Q,Z;if(m){q=W.get("as");var J=W.get("noChildContext");Z=!(q&&J),K={as:q,noChildContext:J,exportDependencies:Z}}return Q=(se=W.get("completeOn")=="render")||W.has(p.i.pa),p.o(function(){var de=p.a.f(U()),_e=!P!=!de,le=!ee,Te;(Z||_e!==j)&&(Q&&(Y=p.i.Cb(R,Y)),_e&&((!m||Z)&&(K.dataDependency=p.S.o()),Te=m?Y.createChildContext(typeof de=="function"?de:U,K):p.S.qa()?Y.extend(null,K):Y),le&&p.S.qa()&&(ee=p.a.Ca(p.h.childNodes(R),!0)),_e?(le||p.h.va(R,p.a.Ca(ee)),p.Oa(Te,R)):(p.h.Ea(R),se||p.i.ma(R,p.i.H)),j=_e)},null,{l:R}),{controlsDescendantBindings:!0}}},p.m.Ra[O]=!1,p.h.ea[O]=!0}I("if"),I("ifnot",!1,!0),I("with",!0)}(),p.c.let={init:function(I,O,m,P,R){return O=R.extend(O),p.Oa(O,I),{controlsDescendantBindings:!0}}},p.h.ea.let=!0;var G={};p.c.options={init:function(I){if(p.a.R(I)!=="select")throw Error("options binding applies only to SELECT elements");for(;0<I.length;)I.remove(0);return{controlsDescendantBindings:!0}},update:function(I,O,m){function P(){return p.a.jb(I.options,function(J){return J.selected})}function R(J,de,_e){var le=typeof de;return le=="function"?de(J):le=="string"?J[de]:_e}function U(J,de){if(Q&&j)p.i.ma(I,p.i.H);else if(se.length){var _e=0<=p.a.A(se,p.w.M(de[0]));p.a.Zc(de[0],_e),Q&&!_e&&p.u.G(p.a.Fb,null,[I,"change"])}}var W=I.multiple,q=I.length!=0&&W?I.scrollTop:null,Y=p.a.f(O()),j=m.get("valueAllowUnset")&&m.has("value"),ee=m.get("optionsIncludeDestroyed");O={};var K,se=[];j||(W?se=p.a.Mb(P(),p.w.M):0<=I.selectedIndex&&se.push(p.w.M(I.options[I.selectedIndex]))),Y&&(typeof Y.length>"u"&&(Y=[Y]),K=p.a.jb(Y,function(J){return ee||J===e||J===null||!p.a.f(J._destroy)}),m.has("optionsCaption")&&(Y=p.a.f(m.get("optionsCaption")),Y!==null&&Y!==e&&K.unshift(G)));var Q=!1;if(O.beforeRemove=function(J){I.removeChild(J)},Y=U,m.has("optionsAfterRender")&&typeof m.get("optionsAfterRender")=="function"&&(Y=function(J,de){U(0,de),p.u.G(m.get("optionsAfterRender"),null,[de[0],J!==G?J:e])}),p.a.ec(I,K,function(J,de,_e){return _e.length&&(se=!j&&_e[0].selected?[p.w.M(_e[0])]:[],Q=!0),de=I.ownerDocument.createElement("option"),J===G?(p.a.Bb(de,m.get("optionsCaption")),p.w.cb(de,e)):(_e=R(J,m.get("optionsValue"),J),p.w.cb(de,p.a.f(_e)),J=R(J,m.get("optionsText"),_e),p.a.Bb(de,J)),[de]},O,Y),!j){var Z;W?Z=se.length&&P().length<se.length:Z=se.length&&0<=I.selectedIndex?p.w.M(I.options[I.selectedIndex])!==se[0]:se.length||0<=I.selectedIndex,Z&&p.u.G(p.a.Fb,null,[I,"change"])}(j||p.S.Ya())&&p.i.ma(I,p.i.H),p.a.wd(I),q&&20<Math.abs(q-I.scrollTop)&&(I.scrollTop=q)}},p.c.options.$b=p.a.g.Z(),p.c.selectedOptions={init:function(I,O,m){function P(){var W=O(),q=[];p.a.D(I.getElementsByTagName("option"),function(Y){Y.selected&&q.push(p.w.M(Y))}),p.m.eb(W,m,"selectedOptions",q)}function R(){var W=p.a.f(O()),q=I.scrollTop;W&&typeof W.length=="number"&&p.a.D(I.getElementsByTagName("option"),function(Y){var j=0<=p.a.A(W,p.w.M(Y));Y.selected!=j&&p.a.Zc(Y,j)}),I.scrollTop=q}if(p.a.R(I)!="select")throw Error("selectedOptions binding applies only to SELECT elements");var U;p.i.subscribe(I,p.i.H,function(){U?P():(p.a.B(I,"change",P),U=p.o(R,null,{l:I}))},null,{notifyImmediately:!0})},update:function(){}},p.m.wa.selectedOptions=!0,p.c.style={update:function(I,O){var m=p.a.f(O()||{});p.a.P(m,function(P,R){if(R=p.a.f(R),(R===null||R===e||R===!1)&&(R=""),o)o(I).css(P,R);else if(/^--/.test(P))I.style.setProperty(P,R);else{P=P.replace(/-(\w)/g,function(W,q){return q.toUpperCase()});var U=I.style[P];I.style[P]=R,R===U||I.style[P]!=U||isNaN(R)||(I.style[P]=R+"px")}})}},p.c.submit={init:function(I,O,m,P,R){if(typeof O()!="function")throw Error("The value for a submit binding must be a function");p.a.B(I,"submit",function(U){var W,q=O();try{W=q.call(R.$data,I)}finally{W!==!0&&(U.preventDefault?U.preventDefault():U.returnValue=!1)}})}},p.c.text={init:function(){return{controlsDescendantBindings:!0}},update:function(I,O){p.a.Bb(I,O())}},p.h.ea.text=!0,function(){if(t&&t.navigator){var I=function(K){if(K)return parseFloat(K[1])},O=t.navigator.userAgent,m,P,R,U,W;(m=t.opera&&t.opera.version&&parseInt(t.opera.version()))||(W=I(O.match(/Edge\/([^ ]+)$/)))||I(O.match(/Chrome\/([^ ]+)/))||(P=I(O.match(/Version\/([^ ]+) Safari/)))||(R=I(O.match(/Firefox\/([^ ]+)/)))||(U=p.a.W||I(O.match(/MSIE ([^ ]+)/)))||(U=I(O.match(/rv:([^ )]+)/)))}if(8<=U&&10>U)var q=p.a.g.Z(),Y=p.a.g.Z(),j=function(K){var se=this.activeElement;(se=se&&p.a.g.get(se,Y))&&se(K)},ee=function(K,se){var Q=K.ownerDocument;p.a.g.get(Q,q)||(p.a.g.set(Q,q,!0),p.a.B(Q,"selectionchange",j)),p.a.g.set(K,Y,se)};p.c.textInput={init:function(K,se,Q){function Z(ye,Ce){p.a.B(K,ye,Ce)}function J(){var ye=p.a.f(se());(ye===null||ye===e)&&(ye=""),pe!==e&&ye===pe?p.a.setTimeout(J,4):K.value!==ye&&(ae=!0,K.value=ye,ae=!1,le=K.value)}function de(){Te||(pe=K.value,Te=p.a.setTimeout(_e,4))}function _e(){clearTimeout(Te),pe=Te=e;var ye=K.value;le!==ye&&(le=ye,p.m.eb(se(),Q,"textInput",ye))}var le=K.value,Te,pe,ne=p.a.W==9?de:_e,ae=!1;U&&Z("keypress",_e),11>U&&Z("propertychange",function(ye){ae||ye.propertyName!=="value"||ne()}),U==8&&(Z("keyup",_e),Z("keydown",_e)),ee&&(ee(K,ne),Z("dragend",de)),(!U||9<=U)&&Z("input",ne),5>P&&p.a.R(K)==="textarea"?(Z("keydown",de),Z("paste",de),Z("cut",de)):11>m?Z("keydown",de):4>R?(Z("DOMAutoComplete",_e),Z("dragdrop",_e),Z("drop",_e)):W&&K.type==="number"&&Z("keydown",de),Z("change",_e),Z("blur",_e),p.o(J,null,{l:K})}},p.m.wa.textInput=!0,p.c.textinput={preprocess:function(K,se,Q){Q("textInput",K)}}}(),p.c.uniqueName={init:function(I,O){if(O()){var m="ko_unique_"+ ++p.c.uniqueName.rd;p.a.Yc(I,m)}}},p.c.uniqueName.rd=0,p.c.using={init:function(I,O,m,P,R){var U;return m.has("as")&&(U={as:m.get("as"),noChildContext:m.get("noChildContext")}),O=R.createChildContext(O,U),p.Oa(O,I),{controlsDescendantBindings:!0}}},p.h.ea.using=!0,p.c.value={init:function(I,O,m){var P=p.a.R(I),R=P=="input";if(!R||I.type!="checkbox"&&I.type!="radio"){var U=[],W=m.get("valueUpdate"),q=!1,Y=null;W&&(typeof W=="string"?U=[W]:U=p.a.wc(W),p.a.Pa(U,"change"));var j=function(){Y=null,q=!1;var se=O(),Q=p.w.M(I);p.m.eb(se,m,"value",Q)};!p.a.W||!R||I.type!="text"||I.autocomplete=="off"||I.form&&I.form.autocomplete=="off"||p.a.A(U,"propertychange")!=-1||(p.a.B(I,"propertychange",function(){q=!0}),p.a.B(I,"focus",function(){q=!1}),p.a.B(I,"blur",function(){q&&j()})),p.a.D(U,function(se){var Q=j;p.a.Ud(se,"after")&&(Q=function(){Y=p.w.M(I),p.a.setTimeout(j,0)},se=se.substring(5)),p.a.B(I,se,Q)});var ee;if(ee=R&&I.type=="file"?function(){var se=p.a.f(O());se===null||se===e||se===""?I.value="":p.u.G(j)}:function(){var se=p.a.f(O()),Q=p.w.M(I);Y!==null&&se===Y?p.a.setTimeout(ee,0):(se!==Q||Q===e)&&(P==="select"?(Q=m.get("valueAllowUnset"),p.w.cb(I,se,Q),Q||se===p.w.M(I)||p.u.G(j)):p.w.cb(I,se))},P==="select"){var K;p.i.subscribe(I,p.i.H,function(){K?m.get("valueAllowUnset")?ee():j():(p.a.B(I,"change",j),K=p.o(ee,null,{l:I}))},null,{notifyImmediately:!0})}else p.a.B(I,"change",j),p.o(ee,null,{l:I})}else p.ib(I,{checkedValue:O})},update:function(){}},p.m.wa.value=!0,p.c.visible={update:function(I,O){var m=p.a.f(O()),P=I.style.display!="none";m&&!P?I.style.display="":!m&&P&&(I.style.display="none")}},p.c.hidden={update:function(I,O){p.c.visible.update(I,function(){return!p.a.f(O())})}},function(I){p.c[I]={init:function(O,m,P,R,U){return p.c.event.init.call(this,O,function(){var W={};return W[I]=m(),W},P,R,U)}}}("click"),p.ca=function(){},p.ca.prototype.renderTemplateSource=function(){throw Error("Override renderTemplateSource")},p.ca.prototype.createJavaScriptEvaluatorBlock=function(){throw Error("Override createJavaScriptEvaluatorBlock")},p.ca.prototype.makeTemplateSource=function(I,O){if(typeof I=="string"){O=O||n;var m=O.getElementById(I);if(!m)throw Error("Cannot find template with ID "+I);return new p.C.F(m)}if(I.nodeType==1||I.nodeType==8)return new p.C.ia(I);throw Error("Unknown template type: "+I)},p.ca.prototype.renderTemplate=function(I,O,m,P){return I=this.makeTemplateSource(I,P),this.renderTemplateSource(I,O,m,P)},p.ca.prototype.isTemplateRewritten=function(I,O){return this.allowTemplateRewriting===!1?!0:this.makeTemplateSource(I,O).data("isRewritten")},p.ca.prototype.rewriteTemplate=function(I,O,m){I=this.makeTemplateSource(I,m),O=O(I.text()),I.text(O),I.data("isRewritten",!0)},p.b("templateEngine",p.ca),p.kc=function(){function I(P,R,U,W){P=p.m.ac(P);for(var q=p.m.Ra,Y=0;Y<P.length;Y++){var j=P[Y].key;if(Object.prototype.hasOwnProperty.call(q,j)){var ee=q[j];if(typeof ee=="function"){if(j=ee(P[Y].value))throw Error(j)}else if(!ee)throw Error("This template engine does not support the '"+j+"' binding within its templates")}}return U="ko.__tr_ambtns(function($context,$element){return(function(){return{ "+p.m.vb(P,{valueAccessors:!0})+" } })()},'"+U.toLowerCase()+"')",W.createJavaScriptEvaluatorBlock(U)+R}var O=/(<([a-z]+\d*)(?:\s+(?!data-bind\s*=\s*)[a-z0-9\-]+(?:=(?:\"[^\"]*\"|\'[^\']*\'|[^>]*))?)*\s+)data-bind\s*=\s*(["'])([\s\S]*?)\3/gi,m=/\x3c!--\s*ko\b\s*([\s\S]*?)\s*--\x3e/g;return{xd:function(P,R,U){R.isTemplateRewritten(P,U)||R.rewriteTemplate(P,function(W){return p.kc.Ld(W,R)},U)},Ld:function(P,R){return P.replace(O,function(U,W,q,Y,j){return I(j,W,q,R)}).replace(m,function(U,W){return I(W,"<!-- ko -->","#comment",R)})},md:function(P,R){return p.aa.Xb(function(U,W){var q=U.nextSibling;q&&q.nodeName.toLowerCase()===R&&p.ib(q,P,W)})}}}(),p.b("__tr_ambtns",p.kc.md),function(){p.C={},p.C.F=function(m){if(this.F=m){var P=p.a.R(m);this.ab=P==="script"?1:P==="textarea"?2:P=="template"&&m.content&&m.content.nodeType===11?3:4}},p.C.F.prototype.text=function(){var m=this.ab===1?"text":this.ab===2?"value":"innerHTML";if(arguments.length==0)return this.F[m];var P=arguments[0];m==="innerHTML"?p.a.fc(this.F,P):this.F[m]=P};var I=p.a.g.Z()+"_";p.C.F.prototype.data=function(m){if(arguments.length===1)return p.a.g.get(this.F,I+m);p.a.g.set(this.F,I+m,arguments[1])};var O=p.a.g.Z();p.C.F.prototype.nodes=function(){var m=this.F;if(arguments.length==0){var P=p.a.g.get(m,O)||{},R=P.lb||(this.ab===3?m.content:this.ab===4?m:e);if(!R||P.jd){var U=this.text();U&&U!==P.bb&&(R=p.a.Md(U,m.ownerDocument),p.a.g.set(m,O,{lb:R,bb:U,jd:!0}))}return R}P=arguments[0],this.ab!==e&&this.text(""),p.a.g.set(m,O,{lb:P})},p.C.ia=function(m){this.F=m},p.C.ia.prototype=new p.C.F,p.C.ia.prototype.constructor=p.C.ia,p.C.ia.prototype.text=function(){if(arguments.length==0){var m=p.a.g.get(this.F,O)||{};return m.bb===e&&m.lb&&(m.bb=m.lb.innerHTML),m.bb}p.a.g.set(this.F,O,{bb:arguments[0]})},p.b("templateSources",p.C),p.b("templateSources.domElement",p.C.F),p.b("templateSources.anonymousTemplate",p.C.ia)}(),function(){function I(Y,j,ee){var K;for(j=p.h.nextSibling(j);Y&&(K=Y)!==j;)Y=p.h.nextSibling(K),ee(K,Y)}function O(Y,j){if(Y.length){var ee=Y[0],K=Y[Y.length-1],se=ee.parentNode,Q=p.ga.instance,Z=Q.preprocessNode;if(Z){if(I(ee,K,function(J,de){var _e=J.previousSibling,le=Z.call(Q,J);le&&(J===ee&&(ee=le[0]||de),J===K&&(K=le[le.length-1]||_e))}),Y.length=0,!ee)return;ee===K?Y.push(ee):(Y.push(ee,K),p.a.Ua(Y,se))}I(ee,K,function(J){J.nodeType!==1&&J.nodeType!==8||p.vc(j,J)}),I(ee,K,function(J){J.nodeType!==1&&J.nodeType!==8||p.aa.cd(J,[j])}),p.a.Ua(Y,se)}}function m(Y){return Y.nodeType?Y:0<Y.length?Y[0]:null}function P(Y,j,ee,K,se){se=se||{};var Q=(Y&&m(Y)||ee||{}).ownerDocument,Z=se.templateEngine||U;if(p.kc.xd(ee,Z,Q),ee=Z.renderTemplate(ee,K,se,Q),typeof ee.length!="number"||0<ee.length&&typeof ee[0].nodeType!="number")throw Error("Template engine must return an array of DOM nodes");switch(Q=!1,j){case"replaceChildren":p.h.va(Y,ee),Q=!0;break;case"replaceNode":p.a.Xc(Y,ee),Q=!0;break;case"ignoreTargetNode":break;default:throw Error("Unknown renderMode: "+j)}return Q&&(O(ee,K),se.afterRender&&p.u.G(se.afterRender,null,[ee,K[se.as||"$data"]]),j=="replaceChildren"&&p.i.ma(Y,p.i.H)),ee}function R(Y,j,ee){return p.O(Y)?Y():typeof Y=="function"?Y(j,ee):Y}var U;p.gc=function(Y){if(Y!=e&&!(Y instanceof p.ca))throw Error("templateEngine must inherit from ko.templateEngine");U=Y},p.dc=function(Y,j,ee,K,se){if(ee=ee||{},(ee.templateEngine||U)==e)throw Error("Set a template engine before calling renderTemplate");if(se=se||"replaceChildren",K){var Q=m(K);return p.$(function(){var J=j&&j instanceof p.fa?j:new p.fa(j,null,null,null,{exportDependencies:!0}),Z=R(Y,J.$data,J),J=P(K,se,Z,J,ee);se=="replaceNode"&&(K=J,Q=m(K))},null,{Sa:function(){return!Q||!p.a.Sb(Q)},l:Q&&se=="replaceNode"?Q.parentNode:Q})}return p.aa.Xb(function(Z){p.dc(Y,j,ee,Z,"replaceNode")})},p.Qd=function(Y,j,ee,K,se){function Q(pe,ne){p.u.G(p.a.ec,null,[K,pe,J,ee,Z,ne]),p.i.ma(K,p.i.H)}function Z(pe,ne){O(ne,de),ee.afterRender&&ee.afterRender(ne,pe),de=null}function J(pe,ne){de=se.createChildContext(pe,{as:_e,noChildContext:ee.noChildContext,extend:function(ye){ye.$index=ne,_e&&(ye[_e+"Index"]=ne)}});var ae=R(Y,pe,de);return P(K,"ignoreTargetNode",ae,de,ee)}var de,_e=ee.as,le=ee.includeDestroyed===!1||p.options.foreachHidesDestroyed&&!ee.includeDestroyed;if(le||ee.beforeRemove||!p.Pc(j))return p.$(function(){var pe=p.a.f(j)||[];typeof pe.length>"u"&&(pe=[pe]),le&&(pe=p.a.jb(pe,function(ne){return ne===e||ne===null||!p.a.f(ne._destroy)})),Q(pe)},null,{l:K});Q(j.v());var Te=j.subscribe(function(pe){Q(j(),pe)},null,"arrayChange");return Te.l(K),Te};var W=p.a.g.Z(),q=p.a.g.Z();p.c.template={init:function(Y,j){var ee=p.a.f(j());if(typeof ee=="string"||"name"in ee)p.h.Ea(Y);else if("nodes"in ee){if(ee=ee.nodes||[],p.O(ee))throw Error('The "nodes" option must be a plain, non-observable array.');var K=ee[0]&&ee[0].parentNode;K&&p.a.g.get(K,q)||(K=p.a.Yb(ee),p.a.g.set(K,q,!0)),new p.C.ia(Y).nodes(K)}else if(ee=p.h.childNodes(Y),0<ee.length)K=p.a.Yb(ee),new p.C.ia(Y).nodes(K);else throw Error("Anonymous template defined, but no template content was provided");return{controlsDescendantBindings:!0}},update:function(Y,j,ee,K,se){var Q=j();j=p.a.f(Q),ee=!0,K=null,typeof j=="string"?j={}:(Q="name"in j?j.name:Y,"if"in j&&(ee=p.a.f(j.if)),ee&&"ifnot"in j&&(ee=!p.a.f(j.ifnot)),ee&&!Q&&(ee=!1)),"foreach"in j?K=p.Qd(Q,ee&&j.foreach||[],j,Y,se):ee?(ee=se,"data"in j&&(ee=se.createChildContext(j.data,{as:j.as,noChildContext:j.noChildContext,exportDependencies:!0})),K=p.dc(Q,ee,j,Y)):p.h.Ea(Y),se=K,(j=p.a.g.get(Y,W))&&typeof j.s=="function"&&j.s(),p.a.g.set(Y,W,!se||se.ja&&!se.ja()?e:se)}},p.m.Ra.template=function(Y){return Y=p.m.ac(Y),Y.length==1&&Y[0].unknown||p.m.Id(Y,"name")?null:"This template engine does not support anonymous templates nested within its templates"},p.h.ea.template=!0}(),p.b("setTemplateEngine",p.gc),p.b("renderTemplate",p.dc),p.a.Kc=function(I,O,m){if(I.length&&O.length){var P,R,U,W,q;for(P=R=0;(!m||P<m)&&(W=I[R]);++R){for(U=0;q=O[U];++U)if(W.value===q.value){W.moved=q.index,q.moved=W.index,O.splice(U,1),P=U=0;break}P+=U}}},p.a.Pb=function(){function I(O,m,P,R,U){var W=Math.min,q=Math.max,Y=[],j,ee=O.length,K,se=m.length,Q=se-ee||1,Z=ee+se+1,J,de,_e;for(j=0;j<=ee;j++)for(de=J,Y.push(J=[]),_e=W(se,j+Q),K=q(0,j-1);K<=_e;K++)J[K]=K?j?O[j-1]===m[K-1]?de[K-1]:W(de[K]||Z,J[K-1]||Z)+1:K+1:j+1;for(W=[],q=[],Q=[],j=ee,K=se;j||K;)se=Y[j][K]-1,K&&se===Y[j][K-1]?q.push(W[W.length]={status:P,value:m[--K],index:K}):j&&se===Y[j-1][K]?Q.push(W[W.length]={status:R,value:O[--j],index:j}):(--K,--j,U.sparse||W.push({status:"retained",value:m[K]}));return p.a.Kc(Q,q,!U.dontLimitMoves&&10*ee),W.reverse()}return function(O,m,P){return P=typeof P=="boolean"?{dontLimitMoves:P}:P||{},O=O||[],m=m||[],O.length<m.length?I(O,m,"added","deleted",P):I(m,O,"deleted","added",P)}}(),p.b("utils.compareArrays",p.a.Pb),function(){function I(P,R,U,W,q){var Y=[],j=p.$(function(){var ee=R(U,q,p.a.Ua(Y,P))||[];0<Y.length&&(p.a.Xc(Y,ee),W&&p.u.G(W,null,[U,ee,q])),Y.length=0,p.a.Nb(Y,ee)},null,{l:P,Sa:function(){return!p.a.kd(Y)}});return{Y,$:j.ja()?j:e}}var O=p.a.g.Z(),m=p.a.g.Z();p.a.ec=function(P,R,U,W,q,Y){function j(qe){ae={Aa:qe,pb:p.ta(de++)},Z.push(ae),Q||ne.push(ae)}function ee(qe){ae=se[qe],de!==ae.pb.v()&&pe.push(ae),ae.pb(de++),p.a.Ua(ae.Y,P),Z.push(ae)}function K(qe,Ne){if(qe)for(var ke=0,Qe=Ne.length;ke<Qe;ke++)p.a.D(Ne[ke].Y,function(Ge){qe(Ge,ke,Ne[ke].Aa)})}R=R||[],typeof R.length>"u"&&(R=[R]),W=W||{};var se=p.a.g.get(P,O),Q=!se,Z=[],J=0,de=0,_e=[],le=[],Te=[],pe=[],ne=[],ae,ye=0;if(Q)p.a.D(R,j);else{if(!Y||se&&se._countWaitingForRemove){var Ce=p.a.Mb(se,function(qe){return qe.Aa});Y=p.a.Pb(Ce,R,{dontLimitMoves:W.dontLimitMoves,sparse:!0})}for(var Ce=0,Be,Le,Ve;Be=Y[Ce];Ce++)switch(Le=Be.moved,Ve=Be.index,Be.status){case"deleted":for(;J<Ve;)ee(J++);Le===e&&(ae=se[J],ae.$&&(ae.$.s(),ae.$=e),p.a.Ua(ae.Y,P).length&&(W.beforeRemove&&(Z.push(ae),ye++,ae.Aa===m?ae=null:Te.push(ae)),ae&&_e.push.apply(_e,ae.Y))),J++;break;case"added":for(;de<Ve;)ee(J++);Le!==e?(le.push(Z.length),ee(Le)):j(Be.value)}for(;de<R.length;)ee(J++);Z._countWaitingForRemove=ye}p.a.g.set(P,O,Z),K(W.beforeMove,pe),p.a.D(_e,W.beforeRemove?p.oa:p.removeNode);var Ie,He,Me;try{Me=P.ownerDocument.activeElement}catch{}if(le.length)for(;(Ce=le.shift())!=e;){for(ae=Z[Ce],Ie=e;Ce;)if((He=Z[--Ce].Y)&&He.length){Ie=He[He.length-1];break}for(R=0;J=ae.Y[R];Ie=J,R++)p.h.Wb(P,J,Ie)}for(Ce=0;ae=Z[Ce];Ce++){for(ae.Y||p.a.extend(ae,I(P,U,ae.Aa,q,ae.pb)),R=0;J=ae.Y[R];Ie=J,R++)p.h.Wb(P,J,Ie);!ae.Ed&&q&&(q(ae.Aa,ae.Y,ae.pb),ae.Ed=!0,Ie=ae.Y[ae.Y.length-1])}for(Me&&P.ownerDocument.activeElement!=Me&&Me.focus(),K(W.beforeRemove,Te),Ce=0;Ce<Te.length;++Ce)Te[Ce].Aa=m;K(W.afterMove,pe),K(W.afterAdd,ne)}}(),p.b("utils.setDomNodeChildrenFromArrayMapping",p.a.ec),p.ba=function(){this.allowTemplateRewriting=!1},p.ba.prototype=new p.ca,p.ba.prototype.constructor=p.ba,p.ba.prototype.renderTemplateSource=function(I,O,m,P){return(O=!(9>p.a.W)&&I.nodes?I.nodes():null)?p.a.la(O.cloneNode(!0).childNodes):(I=I.text(),p.a.ua(I,P))},p.ba.Ma=new p.ba,p.gc(p.ba.Ma),p.b("nativeTemplateEngine",p.ba),function(){p.$a=function(){var O=this.Hd=function(){if(!o||!o.tmpl)return 0;try{if(0<=o.tmpl.tag.tmpl.open.toString().indexOf("__"))return 2}catch{}return 1}();this.renderTemplateSource=function(m,P,R,U){if(U=U||n,R=R||{},2>O)throw Error("Your version of jQuery.tmpl is too old. Please upgrade to jQuery.tmpl 1.0.0pre or later.");var W=m.data("precompiled");return W||(W=m.text()||"",W=o.template(null,"{{ko_with $item.koBindingContext}}"+W+"{{/ko_with}}"),m.data("precompiled",W)),m=[P.$data],P=o.extend({koBindingContext:P},R.templateOptions),P=o.tmpl(W,m,P),P.appendTo(U.createElement("div")),o.fragments={},P},this.createJavaScriptEvaluatorBlock=function(m){return"{{ko_code ((function() { return "+m+" })()) }}"},this.addTemplate=function(m,P){n.write("<script type='text/html' id='"+m+"'>"+P+"<\/script>")},0<O&&(o.tmpl.tag.ko_code={open:"__.push($1 || '');"},o.tmpl.tag.ko_with={open:"with($1) {",close:"} "})},p.$a.prototype=new p.ca,p.$a.prototype.constructor=p.$a;var I=new p.$a;0<I.Hd&&p.gc(I),p.b("jqueryTmplTemplateEngine",p.$a)}()})})()})()})();var o0t=ko;typeof window<"u"?(ko=window.ko,typeof Ob<"u"?window.ko=Ob:delete window.ko):(ko=global.ko,typeof Ob<"u"?global.ko=Ob:delete global.ko);const _t=o0t;/**
|
||
* @license
|
||
* Knockout ES5 plugin - https://github.com/SteveSanderson/knockout-es5
|
||
* Copyright (c) Steve Sanderson
|
||
* MIT license
|
||
*/var B2="__knockoutObservables",R2="__knockoutSubscribable";function Aae(e,t){if(!e)throw new Error("When calling ko.track, you must pass an object as the first parameter.");var n=this,i=Tae(e,!0);return t=t||Object.getOwnPropertyNames(e),t.forEach(function(o){if(!(o===B2||o===R2)&&!(o in i)){var r=e[o],s=r instanceof Array,a=n.isObservable(r)?r:s?n.observableArray(r):n.observable(r);Object.defineProperty(e,o,{configurable:!0,enumerable:!0,get:a,set:n.isWriteableObservable(a)?a:void 0}),i[o]=a,s&&s0t(n,a)}}),e}function Tae(e,t){var n=e[B2];return!n&&t&&(n={},Object.defineProperty(e,B2,{value:n})),n}function r0t(e,t,n){var i=this,o={owner:e,deferEvaluation:!0};if(typeof n=="function")o.read=n;else{if("value"in n)throw new Error('For ko.defineProperty, you must not specify a "value" for the property. You must provide a "get" function.');if(typeof n.get!="function")throw new Error('For ko.defineProperty, the third parameter must be either an evaluator function, or an options object containing a function called "get".');o.read=n.get,o.write=n.set}return e[t]=i.computed(o),Aae.call(i,e,[t]),e}function s0t(e,t){var n=null;e.computed(function(){n&&(n.dispose(),n=null);var i=t();i instanceof Array&&(n=a0t(e,t,i))})}function a0t(e,t,n){var i=c0t(e,n);return i.subscribe(t)}function c0t(e,t){var n=t[R2];if(!n){n=new e.subscribable,Object.defineProperty(t,R2,{value:n});var i={};l0t(t,n,i),u0t(e,t,n,i)}return n}function l0t(e,t,n){["pop","push","reverse","shift","sort","splice","unshift"].forEach(function(i){var o=e[i];e[i]=function(){var r=o.apply(this,arguments);return n.pause!==!0&&t.notifySubscribers(this),r}})}function u0t(e,t,n,i){["remove","removeAll","destroy","destroyAll","replace"].forEach(function(o){Object.defineProperty(t,o,{enumerable:!1,value:function(){var r;i.pause=!0;try{r=e.observableArray.fn[o].apply(e.observableArray(t),arguments)}finally{i.pause=!1}return n.notifySubscribers(t),r}})})}function Cae(e,t){if(!e)return null;var n=Tae(e,!1);return n&&n[t]||null}function f0t(e,t){var n=Cae(e,t);n&&n.valueHasMutated()}function d0t(e){e.track=Aae,e.getObservable=Cae,e.valueHasMutated=f0t,e.defineProperty=r0t}const h0t={attachToKo:d0t},H7="http://www.w3.org/2000/svg",V7="cesium-svgPath-svg",p0t={register:function(e){e.bindingHandlers.cesiumSvgPath={init:function(t,n){const i=document.createElementNS(H7,"svg:svg");i.setAttribute("class",V7);const o=document.createElementNS(H7,"path");return i.appendChild(o),e.virtualElements.setDomNodeChildren(t,[i]),e.computed({read:function(){const r=e.unwrap(n());o.setAttribute("d",e.unwrap(r.path));const s=e.unwrap(r.width),a=e.unwrap(r.height);i.setAttribute("width",s),i.setAttribute("height",a),i.setAttribute("viewBox",`0 0 ${s} ${a}`),r.css&&i.setAttribute("class",`${V7} ${e.unwrap(r.css)}`)},disposeWhenNodeIsRemoved:t}),{controlsDescendantBindings:!0}}},e.virtualElements.allowedBindings.cesiumSvgPath=!0}},m0t=p0t;h0t.attachToKo(_t);m0t.register(_t);function tw(e){l(e)||(e=new Ax),this._clock=e,this._eventHelper=new Yd,this._eventHelper.add(e.onTick,this.synchronize,this),this.systemTime=_t.observable(ce.now()),this.systemTime.equalityComparer=ce.equals,this.startTime=_t.observable(e.startTime),this.startTime.equalityComparer=ce.equals,this.startTime.subscribe(function(t){e.startTime=t,this.synchronize()},this),this.stopTime=_t.observable(e.stopTime),this.stopTime.equalityComparer=ce.equals,this.stopTime.subscribe(function(t){e.stopTime=t,this.synchronize()},this),this.currentTime=_t.observable(e.currentTime),this.currentTime.equalityComparer=ce.equals,this.currentTime.subscribe(function(t){e.currentTime=t,this.synchronize()},this),this.multiplier=_t.observable(e.multiplier),this.multiplier.subscribe(function(t){e.multiplier=t,this.synchronize()},this),this.clockStep=_t.observable(e.clockStep),this.clockStep.subscribe(function(t){e.clockStep=t,this.synchronize()},this),this.clockRange=_t.observable(e.clockRange),this.clockRange.subscribe(function(t){e.clockRange=t,this.synchronize()},this),this.canAnimate=_t.observable(e.canAnimate),this.canAnimate.subscribe(function(t){e.canAnimate=t,this.synchronize()},this),this.shouldAnimate=_t.observable(e.shouldAnimate),this.shouldAnimate.subscribe(function(t){e.shouldAnimate=t,this.synchronize()},this),_t.track(this,["systemTime","startTime","stopTime","currentTime","multiplier","clockStep","clockRange","canAnimate","shouldAnimate"])}Object.defineProperties(tw.prototype,{clock:{get:function(){return this._clock}}});tw.prototype.synchronize=function(){const e=this._clock;this.systemTime=ce.now(),this.startTime=e.startTime,this.stopTime=e.stopTime,this.currentTime=e.currentTime,this.multiplier=e.multiplier,this.clockStep=e.clockStep,this.clockRange=e.clockRange,this.canAnimate=e.canAnimate,this.shouldAnimate=e.shouldAnimate};tw.prototype.isDestroyed=function(){return!1};tw.prototype.destroy=function(){this._eventHelper.removeAll(),Je(this)};function Lb(e,t){if(!l(e))throw new w("command is required.");this._command=e,t=A(t,A.EMPTY_OBJECT),this.toggled=A(t.toggled,!1),this.tooltip=A(t.tooltip,""),_t.track(this,["toggled","tooltip"])}Object.defineProperties(Lb.prototype,{command:{get:function(){return this._command}}});function zr(e,t){if(!l(e))throw new w("func is required.");t=A(t,!0);const n=new lt,i=new lt;function o(){if(!o.canExecute)throw new w("Cannot execute command, canExecute is false.");const r={args:arguments,cancel:!1};let s;return n.raiseEvent(r),r.cancel||(s=e.apply(null,arguments),i.raiseEvent(s)),s}return o.canExecute=t,_t.track(o,["canExecute"]),Object.defineProperties(o,{beforeExecute:{value:n},afterExecute:{value:i}}),o}function tu(e,t,n,i,o){return n.call(i,e[t]),_t.getObservable(e,t).subscribe(n,i,o)}const Ng="http://www.w3.org/2000/svg",bae="http://www.w3.org/1999/xlink";let cD;const ub=k.fromCssColorString("rgba(247,250,255,0.384)"),lD=k.fromCssColorString("rgba(143,191,255,0.216)"),KN=k.fromCssColorString("rgba(153,197,255,0.098)"),uD=k.fromCssColorString("rgba(255,255,255,0.086)"),_0t=k.fromCssColorString("rgba(255,255,255,0.267)"),g0t=k.fromCssColorString("rgba(255,255,255,0)"),k7=k.fromCssColorString("rgba(66,67,68,0.3)"),G7=k.fromCssColorString("rgba(0,0,0,0.5)");function am(e){return k.fromCssColorString(window.getComputedStyle(e).getPropertyValue("color"))}const ix={animation_pathReset:{tagName:"path",transform:"translate(16,16) scale(0.85) translate(-16,-16)",d:"M24.316,5.318,9.833,13.682,9.833,5.5,5.5,5.5,5.5,25.5,9.833,25.5,9.833,17.318,24.316,25.682z"},animation_pathPause:{tagName:"path",transform:"translate(16,16) scale(0.85) translate(-16,-16)",d:"M13,5.5,7.5,5.5,7.5,25.5,13,25.5zM24.5,5.5,19,5.5,19,25.5,24.5,25.5z"},animation_pathPlay:{tagName:"path",transform:"translate(16,16) scale(0.85) translate(-16,-16)",d:"M6.684,25.682L24.316,15.5L6.684,5.318V25.682z"},animation_pathPlayReverse:{tagName:"path",transform:"translate(16,16) scale(-0.85,0.85) translate(-16,-16)",d:"M6.684,25.682L24.316,15.5L6.684,5.318V25.682z"},animation_pathLoop:{tagName:"path",transform:"translate(16,16) scale(0.85) translate(-16,-16)",d:"M24.249,15.499c-0.009,4.832-3.918,8.741-8.75,8.75c-2.515,0-4.768-1.064-6.365-2.763l2.068-1.442l-7.901-3.703l0.744,8.694l2.193-1.529c2.244,2.594,5.562,4.242,9.26,4.242c6.767,0,12.249-5.482,12.249-12.249H24.249zM15.499,6.75c2.516,0,4.769,1.065,6.367,2.764l-2.068,1.443l7.901,3.701l-0.746-8.693l-2.192,1.529c-2.245-2.594-5.562-4.245-9.262-4.245C8.734,3.25,3.25,8.734,3.249,15.499H6.75C6.758,10.668,10.668,6.758,15.499,6.75z"},animation_pathClock:{tagName:"path",transform:"translate(16,16) scale(0.85) translate(-16,-15.5)",d:"M15.5,2.374C8.251,2.375,2.376,8.251,2.374,15.5C2.376,22.748,8.251,28.623,15.5,28.627c7.249-0.004,13.124-5.879,13.125-13.127C28.624,8.251,22.749,2.375,15.5,2.374zM15.5,25.623C9.909,25.615,5.385,21.09,5.375,15.5C5.385,9.909,9.909,5.384,15.5,5.374c5.59,0.01,10.115,4.535,10.124,10.125C25.615,21.09,21.091,25.615,15.5,25.623zM8.625,15.5c-0.001-0.552-0.448-0.999-1.001-1c-0.553,0-1,0.448-1,1c0,0.553,0.449,1,1,1C8.176,16.5,8.624,16.053,8.625,15.5zM8.179,18.572c-0.478,0.277-0.642,0.889-0.365,1.367c0.275,0.479,0.889,0.641,1.365,0.365c0.479-0.275,0.643-0.887,0.367-1.367C9.27,18.461,8.658,18.297,8.179,18.572zM9.18,10.696c-0.479-0.276-1.09-0.112-1.366,0.366s-0.111,1.09,0.365,1.366c0.479,0.276,1.09,0.113,1.367-0.366C9.821,11.584,9.657,10.973,9.18,10.696zM22.822,12.428c0.478-0.275,0.643-0.888,0.366-1.366c-0.275-0.478-0.89-0.642-1.366-0.366c-0.479,0.278-0.642,0.89-0.366,1.367C21.732,12.54,22.344,12.705,22.822,12.428zM12.062,21.455c-0.478-0.275-1.089-0.111-1.366,0.367c-0.275,0.479-0.111,1.09,0.366,1.365c0.478,0.277,1.091,0.111,1.365-0.365C12.704,22.344,12.54,21.732,12.062,21.455zM12.062,9.545c0.479-0.276,0.642-0.888,0.366-1.366c-0.276-0.478-0.888-0.642-1.366-0.366s-0.642,0.888-0.366,1.366C10.973,9.658,11.584,9.822,12.062,9.545zM22.823,18.572c-0.48-0.275-1.092-0.111-1.367,0.365c-0.275,0.479-0.112,1.092,0.367,1.367c0.477,0.275,1.089,0.113,1.365-0.365C23.464,19.461,23.3,18.848,22.823,18.572zM19.938,7.813c-0.477-0.276-1.091-0.111-1.365,0.366c-0.275,0.48-0.111,1.091,0.366,1.367s1.089,0.112,1.366-0.366C20.581,8.702,20.418,8.089,19.938,7.813zM23.378,14.5c-0.554,0.002-1.001,0.45-1.001,1c0.001,0.552,0.448,1,1.001,1c0.551,0,1-0.447,1-1C24.378,14.949,23.929,14.5,23.378,14.5zM15.501,6.624c-0.552,0-1,0.448-1,1l-0.466,7.343l-3.004,1.96c-0.478,0.277-0.642,0.889-0.365,1.365c0.275,0.479,0.889,0.643,1.365,0.367l3.305-1.676C15.39,16.99,15.444,17,15.501,17c0.828,0,1.5-0.671,1.5-1.5l-0.5-7.876C16.501,7.072,16.053,6.624,15.501,6.624zM15.501,22.377c-0.552,0-1,0.447-1,1s0.448,1,1,1s1-0.447,1-1S16.053,22.377,15.501,22.377zM18.939,21.455c-0.479,0.277-0.643,0.889-0.366,1.367c0.275,0.477,0.888,0.643,1.366,0.365c0.478-0.275,0.642-0.889,0.366-1.365C20.028,21.344,19.417,21.18,18.939,21.455z"},animation_pathWingButton:{tagName:"path",d:"m 4.5,0.5 c -2.216,0 -4,1.784 -4,4 l 0,24 c 0,2.216 1.784,4 4,4 l 13.71875,0 C 22.478584,27.272785 27.273681,22.511272 32.5,18.25 l 0,-13.75 c 0,-2.216 -1.784,-4 -4,-4 l -24,0 z"},animation_pathPointer:{tagName:"path",d:"M-15,-65,-15,-55,15,-55,15,-65,0,-95z"},animation_pathSwooshFX:{tagName:"path",d:"m 85,0 c 0,16.617 -4.813944,35.356 -13.131081,48.4508 h 6.099803 c 8.317138,-13.0948 13.13322,-28.5955 13.13322,-45.2124 0,-46.94483 -38.402714,-85.00262 -85.7743869,-85.00262 -1.0218522,0 -2.0373001,0.0241 -3.0506131,0.0589 45.958443,1.59437 82.723058,35.77285 82.723058,81.70532 z"}};function $u(e){const t=document.createElementNS(Ng,e.tagName);for(const n in e)if(e.hasOwnProperty(n)&&n!=="tagName")if(n==="children"){const i=e.children.length;for(let o=0;o<i;++o)t.appendChild($u(e.children[o]))}else n.indexOf("xlink:")===0?t.setAttributeNS(bae,n.substring(6),e[n]):n==="textContent"?t.textContent=e[n]:t.setAttribute(n,e[n]);return t}function JN(e,t,n){const i=document.createElementNS(Ng,"text");i.setAttribute("x",e),i.setAttribute("y",t),i.setAttribute("class","cesium-animation-svgText");const o=document.createElementNS(Ng,"tspan");return o.textContent=n,i.appendChild(o),i}function y0t(e,t,n){e.setAttribute("transform",`translate(100,100) rotate(${n})`),t.setAttribute("transform",`rotate(${n})`)}const fD=new k;function Fr(e,t){const n=t.alpha,i=1-n;return fD.red=e.red*i+t.red*n,fD.green=e.green*i+t.green*n,fD.blue=e.blue*i+t.blue*n,fD.toCssColorString()}function QN(e,t,n){const i=ix[n],o={tagName:"g",class:"cesium-animation-rectButton",transform:`translate(${e},${t})`,children:[{tagName:"rect",class:"cesium-animation-buttonGlow",width:32,height:32,rx:2,ry:2},{tagName:"rect",class:"cesium-animation-buttonMain",width:32,height:32,rx:4,ry:4},{class:"cesium-animation-buttonPath",id:n,tagName:i.tagName,transform:i.transform,d:i.d},{tagName:"title",textContent:""}]};return $u(o)}function A0t(e,t,n){const i=ix[n],o=ix.animation_pathWingButton,r={tagName:"g",class:"cesium-animation-rectButton",transform:`translate(${e},${t})`,children:[{class:"cesium-animation-buttonGlow",id:"animation_pathWingButton",tagName:o.tagName,d:o.d},{class:"cesium-animation-buttonMain",id:"animation_pathWingButton",tagName:o.tagName,d:o.d},{class:"cesium-animation-buttonPath",id:n,tagName:i.tagName,transform:i.transform,d:i.d},{tagName:"title",textContent:""}]};return $u(r)}function T0t(e,t){const n=e._viewModel,i=n.shuttleRingDragging;if(!(i&&cD!==e))if(t.type==="mousedown"||i&&t.type==="mousemove"||t.type==="touchstart"&&t.touches.length===1||i&&t.type==="touchmove"&&t.touches.length===1){const o=e._centerX,r=e._centerY,a=e._svgNode.getBoundingClientRect();let c,u;if(t.type==="touchstart"||t.type==="touchmove"?(c=t.touches[0].clientX,u=t.touches[0].clientY):(c=t.clientX,u=t.clientY),!i&&(c>a.right||c<a.left||u<a.top||u>a.bottom))return;const f=e._shuttleRingPointer.getBoundingClientRect(),h=c-o-a.left,_=u-r-a.top;let g=Math.atan2(_,h)*180/Math.PI+90;g>180&&(g-=360);const p=n.shuttleRingAngle;i||c<f.right&&c>f.left&&u>f.top&&u<f.bottom?(cD=e,n.shuttleRingDragging=!0,n.shuttleRingAngle=g):g<p?n.slower():g>p&&n.faster(),t.preventDefault()}else e===cD&&(cD=void 0),n.shuttleRingDragging=!1}function Ph(e,t){this._viewModel=t,this.svgElement=e,this._enabled=void 0,this._toggled=void 0;const n=this;this._clickFunction=function(){const i=n._viewModel.command;i.canExecute&&i()},e.addEventListener("click",this._clickFunction,!0),this._subscriptions=[tu(t,"toggled",this.setToggled,this),tu(t,"tooltip",this.setTooltip,this),tu(t.command,"canExecute",this.setEnabled,this)]}Ph.prototype.destroy=function(){this.svgElement.removeEventListener("click",this._clickFunction,!0);const e=this._subscriptions;for(let t=0,n=e.length;t<n;t++)e[t].dispose();Je(this)};Ph.prototype.isDestroyed=function(){return!1};Ph.prototype.setEnabled=function(e){if(this._enabled!==e){if(this._enabled=e,!e){this.svgElement.setAttribute("class","cesium-animation-buttonDisabled");return}if(this._toggled){this.svgElement.setAttribute("class","cesium-animation-rectButton cesium-animation-buttonToggled");return}this.svgElement.setAttribute("class","cesium-animation-rectButton")}};Ph.prototype.setToggled=function(e){this._toggled!==e&&(this._toggled=e,this._enabled&&(e?this.svgElement.setAttribute("class","cesium-animation-rectButton cesium-animation-buttonToggled"):this.svgElement.setAttribute("class","cesium-animation-rectButton")))};Ph.prototype.setTooltip=function(e){this.svgElement.getElementsByTagName("title")[0].textContent=e};function UT(e,t){if(!l(e))throw new w("container is required.");if(!l(t))throw new w("viewModel is required.");e=Zr(e),this._viewModel=t,this._container=e,this._centerX=0,this._centerY=0,this._defsElement=void 0,this._svgNode=void 0,this._topG=void 0,this._lastHeight=void 0,this._lastWidth=void 0;const n=e.ownerDocument,i=document.createElement("style");i.textContent=".cesium-animation-rectButton .cesium-animation-buttonGlow { filter: url(#animation_blurred); }.cesium-animation-rectButton .cesium-animation-buttonMain { fill: url(#animation_buttonNormal); }.cesium-animation-buttonToggled .cesium-animation-buttonMain { fill: url(#animation_buttonToggled); }.cesium-animation-rectButton:hover .cesium-animation-buttonMain { fill: url(#animation_buttonHovered); }.cesium-animation-buttonDisabled .cesium-animation-buttonMain { fill: url(#animation_buttonDisabled); }.cesium-animation-shuttleRingG .cesium-animation-shuttleRingSwoosh { fill: url(#animation_shuttleRingSwooshGradient); }.cesium-animation-shuttleRingG:hover .cesium-animation-shuttleRingSwoosh { fill: url(#animation_shuttleRingSwooshHovered); }.cesium-animation-shuttleRingPointer { fill: url(#animation_shuttleRingPointerGradient); }.cesium-animation-shuttleRingPausePointer { fill: url(#animation_shuttleRingPointerPaused); }.cesium-animation-knobOuter { fill: url(#animation_knobOuter); }.cesium-animation-knobInner { fill: url(#animation_knobInner); }",n.head.insertBefore(i,n.head.childNodes[0]);const o=document.createElement("div");o.className="cesium-animation-theme",o.innerHTML='<div class="cesium-animation-themeNormal"></div><div class="cesium-animation-themeHover"></div><div class="cesium-animation-themeSelect"></div><div class="cesium-animation-themeDisabled"></div><div class="cesium-animation-themeKnob"></div><div class="cesium-animation-themePointer"></div><div class="cesium-animation-themeSwoosh"></div><div class="cesium-animation-themeSwooshHover"></div>',this._theme=o,this._themeNormal=o.childNodes[0],this._themeHover=o.childNodes[1],this._themeSelect=o.childNodes[2],this._themeDisabled=o.childNodes[3],this._themeKnob=o.childNodes[4],this._themePointer=o.childNodes[5],this._themeSwoosh=o.childNodes[6],this._themeSwooshHover=o.childNodes[7];const r=document.createElementNS(Ng,"svg:svg");this._svgNode=r,r.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:xlink",bae);const s=document.createElementNS(Ng,"g");this._topG=s,this._realtimeSVG=new Ph(A0t(3,4,"animation_pathClock"),t.playRealtimeViewModel),this._playReverseSVG=new Ph(QN(44,99,"animation_pathPlayReverse"),t.playReverseViewModel),this._playForwardSVG=new Ph(QN(124,99,"animation_pathPlay"),t.playForwardViewModel),this._pauseSVG=new Ph(QN(84,99,"animation_pathPause"),t.pauseViewModel);const a=document.createElementNS(Ng,"g");a.appendChild(this._realtimeSVG.svgElement),a.appendChild(this._playReverseSVG.svgElement),a.appendChild(this._playForwardSVG.svgElement),a.appendChild(this._pauseSVG.svgElement);const c=$u({tagName:"circle",class:"cesium-animation-shuttleRingBack",cx:100,cy:100,r:99});this._shuttleRingBackPanel=c;const u=ix.animation_pathSwooshFX,f=ix.animation_pathPointer,h=$u({tagName:"g",class:"cesium-animation-shuttleRingSwoosh",children:[{tagName:u.tagName,transform:"translate(100,97) scale(-1,1)",id:"animation_pathSwooshFX",d:u.d},{tagName:u.tagName,transform:"translate(100,97)",id:"animation_pathSwooshFX",d:u.d},{tagName:"line",x1:100,y1:8,x2:100,y2:22}]});this._shuttleRingSwooshG=h,this._shuttleRingPointer=$u({class:"cesium-animation-shuttleRingPointer",id:"animation_pathPointer",tagName:f.tagName,d:f.d});const _=$u({tagName:"g",transform:"translate(100,100)"});this._knobOuter=$u({tagName:"circle",class:"cesium-animation-knobOuter",cx:0,cy:0,r:71});const g=61,p=$u({tagName:"circle",class:"cesium-animation-knobInner",cx:0,cy:0,r:g});this._knobDate=JN(0,-24,""),this._knobTime=JN(0,-7,""),this._knobStatus=JN(0,-41,"");const y=$u({tagName:"circle",class:"cesium-animation-blank",cx:0,cy:0,r:g}),T=document.createElementNS(Ng,"g");T.setAttribute("class","cesium-animation-shuttleRingG"),e.appendChild(o),s.appendChild(T),s.appendChild(_),s.appendChild(a),T.appendChild(c),T.appendChild(h),T.appendChild(this._shuttleRingPointer),_.appendChild(this._knobOuter),_.appendChild(p),_.appendChild(this._knobDate),_.appendChild(this._knobTime),_.appendChild(this._knobStatus),_.appendChild(y),r.appendChild(s),e.appendChild(r);const b=this;function x(V){T0t(b,V)}this._mouseCallback=x,c.addEventListener("mousedown",x,!0),c.addEventListener("touchstart",x,!0),h.addEventListener("mousedown",x,!0),h.addEventListener("touchstart",x,!0),n.addEventListener("mousemove",x,!0),n.addEventListener("touchmove",x,!0),n.addEventListener("mouseup",x,!0),n.addEventListener("touchend",x,!0),n.addEventListener("touchcancel",x,!0),this._shuttleRingPointer.addEventListener("mousedown",x,!0),this._shuttleRingPointer.addEventListener("touchstart",x,!0),this._knobOuter.addEventListener("mousedown",x,!0),this._knobOuter.addEventListener("touchstart",x,!0);const v=this._knobTime.childNodes[0],D=this._knobDate.childNodes[0],L=this._knobStatus.childNodes[0];let B;this._subscriptions=[tu(t.pauseViewModel,"toggled",function(V){B!==V&&(B=V,B?b._shuttleRingPointer.setAttribute("class","cesium-animation-shuttleRingPausePointer"):b._shuttleRingPointer.setAttribute("class","cesium-animation-shuttleRingPointer"))}),tu(t,"shuttleRingAngle",function(V){y0t(b._shuttleRingPointer,b._knobOuter,V)}),tu(t,"dateLabel",function(V){D.textContent!==V&&(D.textContent=V)}),tu(t,"timeLabel",function(V){v.textContent!==V&&(v.textContent=V)}),tu(t,"multiplierLabel",function(V){L.textContent!==V&&(L.textContent=V)})],this.applyThemeChanges(),this.resize()}Object.defineProperties(UT.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}});UT.prototype.isDestroyed=function(){return!1};UT.prototype.destroy=function(){l(this._observer)&&(this._observer.disconnect(),this._observer=void 0);const e=this._container.ownerDocument,t=this._mouseCallback;this._shuttleRingBackPanel.removeEventListener("mousedown",t,!0),this._shuttleRingBackPanel.removeEventListener("touchstart",t,!0),this._shuttleRingSwooshG.removeEventListener("mousedown",t,!0),this._shuttleRingSwooshG.removeEventListener("touchstart",t,!0),e.removeEventListener("mousemove",t,!0),e.removeEventListener("touchmove",t,!0),e.removeEventListener("mouseup",t,!0),e.removeEventListener("touchend",t,!0),e.removeEventListener("touchcancel",t,!0),this._shuttleRingPointer.removeEventListener("mousedown",t,!0),this._shuttleRingPointer.removeEventListener("touchstart",t,!0),this._knobOuter.removeEventListener("mousedown",t,!0),this._knobOuter.removeEventListener("touchstart",t,!0),this._container.removeChild(this._svgNode),this._container.removeChild(this._theme),this._realtimeSVG.destroy(),this._playReverseSVG.destroy(),this._playForwardSVG.destroy(),this._pauseSVG.destroy();const n=this._subscriptions;for(let i=0,o=n.length;i<o;i++)n[i].dispose();return Je(this)};UT.prototype.resize=function(){const e=this._container.clientWidth,t=this._container.clientHeight;if(e===this._lastWidth&&t===this._lastHeight)return;const n=this._svgNode,i=200,o=132;let r=e,s=t;e===0&&t===0?(r=i,s=o):e===0?(s=t,r=i*(t/o)):t===0&&(r=e,s=o*(e/i));const a=r/i,c=s/o;n.style.cssText=`width: ${r}px; height: ${s}px; position: absolute; bottom: 0; left: 0; overflow: hidden;`,n.setAttribute("width",r),n.setAttribute("height",s),n.setAttribute("viewBox",`0 0 ${r} ${s}`),this._topG.setAttribute("transform",`scale(${a},${c})`),this._centerX=Math.max(1,100*a),this._centerY=Math.max(1,100*c),this._lastHeight=e,this._lastWidth=t};UT.prototype.applyThemeChanges=function(){const e=this._container.ownerDocument;if(!e.body.contains(this._container)){if(l(this._observer))return;const f=this;f._observer=new MutationObserver(function(){e.body.contains(f._container)&&(f._observer.disconnect(),f._observer=void 0,f.applyThemeChanges())}),f._observer.observe(e,{childList:!0,subtree:!0});return}const t=am(this._themeNormal),n=am(this._themeHover),i=am(this._themeSelect),o=am(this._themeDisabled),r=am(this._themeKnob),s=am(this._themePointer),a=am(this._themeSwoosh),c=am(this._themeSwooshHover),u=$u({tagName:"defs",children:[{id:"animation_buttonNormal",tagName:"linearGradient",x1:"50%",y1:"0%",x2:"50%",y2:"100%",children:[{tagName:"stop",offset:"0%","stop-color":Fr(t,ub)},{tagName:"stop",offset:"12%","stop-color":Fr(t,lD)},{tagName:"stop",offset:"46%","stop-color":Fr(t,KN)},{tagName:"stop",offset:"81%","stop-color":Fr(t,uD)}]},{id:"animation_buttonHovered",tagName:"linearGradient",x1:"50%",y1:"0%",x2:"50%",y2:"100%",children:[{tagName:"stop",offset:"0%","stop-color":Fr(n,ub)},{tagName:"stop",offset:"12%","stop-color":Fr(n,lD)},{tagName:"stop",offset:"46%","stop-color":Fr(n,KN)},{tagName:"stop",offset:"81%","stop-color":Fr(n,uD)}]},{id:"animation_buttonToggled",tagName:"linearGradient",x1:"50%",y1:"0%",x2:"50%",y2:"100%",children:[{tagName:"stop",offset:"0%","stop-color":Fr(i,ub)},{tagName:"stop",offset:"12%","stop-color":Fr(i,lD)},{tagName:"stop",offset:"46%","stop-color":Fr(i,KN)},{tagName:"stop",offset:"81%","stop-color":Fr(i,uD)}]},{id:"animation_buttonDisabled",tagName:"linearGradient",x1:"50%",y1:"0%",x2:"50%",y2:"100%",children:[{tagName:"stop",offset:"0%","stop-color":Fr(o,_0t)},{tagName:"stop",offset:"75%","stop-color":Fr(o,g0t)}]},{id:"animation_blurred",tagName:"filter",width:"200%",height:"200%",x:"-50%",y:"-50%",children:[{tagName:"feGaussianBlur",stdDeviation:4,in:"SourceGraphic"}]},{id:"animation_shuttleRingSwooshGradient",tagName:"linearGradient",x1:"50%",y1:"0%",x2:"50%",y2:"100%",children:[{tagName:"stop",offset:"0%","stop-opacity":.2,"stop-color":a.toCssColorString()},{tagName:"stop",offset:"85%","stop-opacity":.85,"stop-color":a.toCssColorString()},{tagName:"stop",offset:"95%","stop-opacity":.05,"stop-color":a.toCssColorString()}]},{id:"animation_shuttleRingSwooshHovered",tagName:"linearGradient",x1:"50%",y1:"0%",x2:"50%",y2:"100%",children:[{tagName:"stop",offset:"0%","stop-opacity":.2,"stop-color":c.toCssColorString()},{tagName:"stop",offset:"85%","stop-opacity":.85,"stop-color":c.toCssColorString()},{tagName:"stop",offset:"95%","stop-opacity":.05,"stop-color":c.toCssColorString()}]},{id:"animation_shuttleRingPointerGradient",tagName:"linearGradient",x1:"0%",y1:"50%",x2:"100%",y2:"50%",children:[{tagName:"stop",offset:"0%","stop-color":s.toCssColorString()},{tagName:"stop",offset:"40%","stop-color":s.toCssColorString()},{tagName:"stop",offset:"60%","stop-color":Fr(s,G7)},{tagName:"stop",offset:"100%","stop-color":Fr(s,G7)}]},{id:"animation_shuttleRingPointerPaused",tagName:"linearGradient",x1:"0%",y1:"50%",x2:"100%",y2:"50%",children:[{tagName:"stop",offset:"0%","stop-color":"#CCC"},{tagName:"stop",offset:"40%","stop-color":"#CCC"},{tagName:"stop",offset:"60%","stop-color":"#555"},{tagName:"stop",offset:"100%","stop-color":"#555"}]},{id:"animation_knobOuter",tagName:"linearGradient",x1:"20%",y1:"0%",x2:"90%",y2:"100%",children:[{tagName:"stop",offset:"5%","stop-color":Fr(r,ub)},{tagName:"stop",offset:"60%","stop-color":Fr(r,k7)},{tagName:"stop",offset:"85%","stop-color":Fr(r,lD)}]},{id:"animation_knobInner",tagName:"linearGradient",x1:"20%",y1:"0%",x2:"90%",y2:"100%",children:[{tagName:"stop",offset:"5%","stop-color":Fr(r,k7)},{tagName:"stop",offset:"60%","stop-color":Fr(r,ub)},{tagName:"stop",offset:"85%","stop-color":Fr(r,uD)}]}]});l(this._defsElement)?this._svgNode.replaceChild(u,this._defsElement):this._svgNode.appendChild(u),this._defsElement=u};const C0t=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],jm=15,VA=105;function Eae(e,t){return e-t}function ZN(e,t){const n=da(t,e,Eae);return n<0?~n:n}function b0t(e,t){if(Math.abs(e)<=jm)return e/jm;const n=jm,i=VA;let o;const r=0;let s;return e>0?(o=Math.log(t[t.length-1]),s=(o-r)/(i-n),Math.exp(r+s*(e-n))):(o=Math.log(-t[0]),s=(o-r)/(i-n),-Math.exp(r+s*(Math.abs(e)-n)))}function E0t(e,t,n){if(n.clockStep===Pa.SYSTEM_CLOCK)return jm;if(Math.abs(e)<=1)return e*jm;const i=t[t.length-1];e>i?e=i:e<-i&&(e=-i);const o=jm,r=VA;let s;const a=0;let c;return e>0?(s=Math.log(i),c=(s-a)/(r-o),(Math.log(e)-a)/c+o):(s=Math.log(-t[0]),c=(s-a)/(r-o),-((Math.log(Math.abs(e))-a)/c+o))}function hu(e){if(!l(e))throw new w("clockViewModel is required.");const t=this;this._clockViewModel=e,this._allShuttleRingTicks=[],this._dateFormatter=hu.defaultDateFormatter,this._timeFormatter=hu.defaultTimeFormatter,this.shuttleRingDragging=!1,this.snapToTicks=!1,_t.track(this,["_allShuttleRingTicks","_dateFormatter","_timeFormatter","shuttleRingDragging","snapToTicks"]),this._sortedFilteredPositiveTicks=[],this.setShuttleRingTicks(hu.defaultTicks),this.timeLabel=void 0,_t.defineProperty(this,"timeLabel",function(){return t._timeFormatter(t._clockViewModel.currentTime,t)}),this.dateLabel=void 0,_t.defineProperty(this,"dateLabel",function(){return t._dateFormatter(t._clockViewModel.currentTime,t)}),this.multiplierLabel=void 0,_t.defineProperty(this,"multiplierLabel",function(){const s=t._clockViewModel;if(s.clockStep===Pa.SYSTEM_CLOCK)return"Today";const a=s.multiplier;return a%1===0?`${a.toFixed(0)}x`:`${a.toFixed(3).replace(/0{0,3}$/,"")}x`}),this.shuttleRingAngle=void 0,_t.defineProperty(this,"shuttleRingAngle",{get:function(){return E0t(e.multiplier,t._allShuttleRingTicks,e)},set:function(s){s=Math.max(Math.min(s,VA),-VA);const a=t._allShuttleRingTicks,c=t._clockViewModel;if(c.clockStep=Pa.SYSTEM_CLOCK_MULTIPLIER,Math.abs(s)===VA){c.multiplier=s>0?a[a.length-1]:a[0];return}let u=b0t(s,a);if(t.snapToTicks)u=a[ZN(u,a)];else if(u!==0){const f=Math.abs(u);if(f>100){const h=f.toFixed(0).length-2,_=Math.pow(10,h);u=Math.round(u/_)*_|0}else f>jm?u=Math.round(u):f>1?u=+u.toFixed(1):f>0&&(u=+u.toFixed(2))}c.multiplier=u}}),this._canAnimate=void 0,_t.defineProperty(this,"_canAnimate",function(){const s=t._clockViewModel,a=s.clockRange;if(t.shuttleRingDragging||a===Mm.UNBOUNDED)return!0;const c=s.multiplier,u=s.currentTime,f=s.startTime;let h=!1;if(a===Mm.LOOP_STOP)h=ce.greaterThan(u,f)||u.equals(f)&&c>0;else{const _=s.stopTime;h=ce.greaterThan(u,f)&&ce.lessThan(u,_)||u.equals(f)&&c>0||u.equals(_)&&c<0}return h||(s.shouldAnimate=!1),h}),this._isSystemTimeAvailable=void 0,_t.defineProperty(this,"_isSystemTimeAvailable",function(){const s=t._clockViewModel;if(s.clockRange===Mm.UNBOUNDED)return!0;const c=s.systemTime;return ce.greaterThanOrEquals(c,s.startTime)&&ce.lessThanOrEquals(c,s.stopTime)}),this._isAnimating=void 0,_t.defineProperty(this,"_isAnimating",function(){return t._clockViewModel.shouldAnimate&&(t._canAnimate||t.shuttleRingDragging)});const n=zr(function(){const s=t._clockViewModel;s.shouldAnimate?s.shouldAnimate=!1:t._canAnimate&&(s.shouldAnimate=!0)});this._pauseViewModel=new Lb(n,{toggled:_t.computed(function(){return!t._isAnimating}),tooltip:"Pause"});const i=zr(function(){const s=t._clockViewModel,a=s.multiplier;a>0&&(s.multiplier=-a),s.shouldAnimate=!0});this._playReverseViewModel=new Lb(i,{toggled:_t.computed(function(){return t._isAnimating&&e.multiplier<0}),tooltip:"Play Reverse"});const o=zr(function(){const s=t._clockViewModel,a=s.multiplier;a<0&&(s.multiplier=-a),s.shouldAnimate=!0});this._playForwardViewModel=new Lb(o,{toggled:_t.computed(function(){return t._isAnimating&&e.multiplier>0&&e.clockStep!==Pa.SYSTEM_CLOCK}),tooltip:"Play Forward"});const r=zr(function(){t._clockViewModel.clockStep=Pa.SYSTEM_CLOCK},_t.getObservable(this,"_isSystemTimeAvailable"));this._playRealtimeViewModel=new Lb(r,{toggled:_t.computed(function(){return e.clockStep===Pa.SYSTEM_CLOCK}),tooltip:_t.computed(function(){return t._isSystemTimeAvailable?"Today (real-time)":"Current time not in range"})}),this._slower=zr(function(){const s=t._clockViewModel,a=t._allShuttleRingTicks,c=s.multiplier,u=ZN(c,a)-1;u>=0&&(s.multiplier=a[u])}),this._faster=zr(function(){const s=t._clockViewModel,a=t._allShuttleRingTicks,c=s.multiplier,u=ZN(c,a)+1;u<a.length&&(s.multiplier=a[u])})}hu.defaultDateFormatter=function(e,t){const n=ce.toGregorianDate(e);return`${C0t[n.month-1]} ${n.day} ${n.year}`};hu.defaultTicks=[.001,.002,.005,.01,.02,.05,.1,.25,.5,1,2,5,10,15,30,60,120,300,600,900,1800,3600,7200,14400,21600,43200,86400,172800,345600,604800];hu.defaultTimeFormatter=function(e,t){const n=ce.toGregorianDate(e),i=Math.round(n.millisecond);return Math.abs(t._clockViewModel.multiplier)<1?`${n.hour.toString().padStart(2,"0")}:${n.minute.toString().padStart(2,"0")}:${n.second.toString().padStart(2,"0")}.${i.toString().padStart(3,"0")}`:`${n.hour.toString().padStart(2,"0")}:${n.minute.toString().padStart(2,"0")}:${n.second.toString().padStart(2,"0")} UTC`};hu.prototype.getShuttleRingTicks=function(){return this._sortedFilteredPositiveTicks.slice(0)};hu.prototype.setShuttleRingTicks=function(e){if(!l(e))throw new w("positiveTicks is required.");let t,n,i;const o={},r=this._sortedFilteredPositiveTicks;for(r.length=0,t=0,n=e.length;t<n;++t)i=e[t],o.hasOwnProperty(i)||(o[i]=!0,r.push(i));r.sort(Eae);const s=[];for(n=r.length,t=n-1;t>=0;--t)i=r[t],i!==0&&s.push(-i);Array.prototype.push.apply(s,r),this._allShuttleRingTicks=s};Object.defineProperties(hu.prototype,{slower:{get:function(){return this._slower}},faster:{get:function(){return this._faster}},clockViewModel:{get:function(){return this._clockViewModel}},pauseViewModel:{get:function(){return this._pauseViewModel}},playReverseViewModel:{get:function(){return this._playReverseViewModel}},playForwardViewModel:{get:function(){return this._playForwardViewModel}},playRealtimeViewModel:{get:function(){return this._playRealtimeViewModel}},dateFormatter:{get:function(){return this._dateFormatter},set:function(e){if(typeof e!="function")throw new w("dateFormatter must be a function");this._dateFormatter=e}},timeFormatter:{get:function(){return this._timeFormatter},set:function(e){if(typeof e!="function")throw new w("timeFormatter must be a function");this._timeFormatter=e}}});hu._maxShuttleRingAngle=VA;hu._realtimeShuttleRingAngle=jm;function xae(e){e=A(e,A.EMPTY_OBJECT);const t=e.globe,n=A(e.imageryProviderViewModels,[]),i=A(e.terrainProviderViewModels,[]);if(!l(t))throw new w("globe is required");this._globe=t,this.imageryProviderViewModels=n.slice(0),this.terrainProviderViewModels=i.slice(0),this.dropDownVisible=!1,_t.track(this,["imageryProviderViewModels","terrainProviderViewModels","dropDownVisible"]);const o=_t.getObservable(this,"imageryProviderViewModels"),r=_t.pureComputed(function(){const h=o(),_={};let g;for(g=0;g<h.length;g++){const T=h[g],b=T.category;l(_[b])?_[b].push(T):_[b]=[T]}const p=Object.keys(_),y=[];for(g=0;g<p.length;g++){const T=p[g];y.push({name:T,providers:_[T]})}return y});this._imageryProviders=r;const s=_t.getObservable(this,"terrainProviderViewModels"),a=_t.pureComputed(function(){const h=s(),_={};let g;for(g=0;g<h.length;g++){const T=h[g],b=T.category;l(_[b])?_[b].push(T):_[b]=[T]}const p=Object.keys(_),y=[];for(g=0;g<p.length;g++){const T=p[g];y.push({name:T,providers:_[T]})}return y});this._terrainProviders=a,this.buttonTooltip=void 0,_t.defineProperty(this,"buttonTooltip",function(){const h=this.selectedImagery,_=this.selectedTerrain,g=l(h)?h.name:void 0,p=l(_)?_.name:void 0;return l(g)&&l(p)?`${g}
|
||
${p}`:l(g)?g:p}),this.buttonImageUrl=void 0,_t.defineProperty(this,"buttonImageUrl",function(){const h=this.selectedImagery;if(l(h))return h.iconUrl}),this.selectedImagery=void 0;const c=_t.observable();this._currentImageryProviders=[],_t.defineProperty(this,"selectedImagery",{get:function(){return c()},set:function(h){if(c()===h){this.dropDownVisible=!1;return}let _;const g=this._currentImageryProviders,p=g.length,y=this._globe.imageryLayers;let T=!1;for(_=0;_<p;_++){const b=y.length;for(let x=0;x<b;x++){const v=y.get(x);if(v.imageryProvider===g[_]){y.remove(v),T=!0;break}}}if(l(h)){const b=h.creationCommand();if(Array.isArray(b)){const x=b.length;for(_=x-1;_>=0;_--)y.addImageryProvider(b[_],0);this._currentImageryProviders=b.slice(0)}else if(this._currentImageryProviders=[b],T)y.addImageryProvider(b,0);else{const x=y.get(0);l(x)&&y.remove(x),y.addImageryProvider(b,0)}}c(h),this.dropDownVisible=!1}}),this.selectedTerrain=void 0;const u=_t.observable();_t.defineProperty(this,"selectedTerrain",{get:function(){return u()},set:function(h){if(u()===h){this.dropDownVisible=!1;return}let _;l(h)&&(_=h.creationCommand()),this._globe.depthTestAgainstTerrain=!(_ instanceof y_),this._globe.terrainProvider=_,u(h),this.dropDownVisible=!1}});const f=this;this._toggleDropDown=zr(function(){f.dropDownVisible=!f.dropDownVisible}),this.selectedImagery=A(e.selectedImageryProviderViewModel,n[0]),this.selectedTerrain=A(e.selectedTerrainProviderViewModel,i[0])}Object.defineProperties(xae.prototype,{toggleDropDown:{get:function(){return this._toggleDropDown}},globe:{get:function(){return this._globe}}});function GP(e,t){if(!l(e))throw new w("container is required.");e=Zr(e);const n=new xae(t),i=document.createElement("button");i.type="button",i.className="cesium-button cesium-toolbar-button",i.setAttribute("data-bind","attr: { title: buttonTooltip },click: toggleDropDown"),e.appendChild(i);const o=document.createElement("img");o.setAttribute("draggable","false"),o.className="cesium-baseLayerPicker-selected",o.setAttribute("data-bind","attr: { src: buttonImageUrl }, visible: !!buttonImageUrl"),i.appendChild(o);const r=document.createElement("div");r.className="cesium-baseLayerPicker-dropDown",r.setAttribute("data-bind",'css: { "cesium-baseLayerPicker-dropDown-visible" : dropDownVisible }'),e.appendChild(r);const s=document.createElement("div");s.className="cesium-baseLayerPicker-sectionTitle",s.setAttribute("data-bind","visible: imageryProviderViewModels.length > 0"),s.innerHTML="Imagery",r.appendChild(s);const a=document.createElement("div");a.className="cesium-baseLayerPicker-section",a.setAttribute("data-bind","foreach: _imageryProviders"),r.appendChild(a);const c=document.createElement("div");c.className="cesium-baseLayerPicker-category",a.appendChild(c);const u=document.createElement("div");u.className="cesium-baseLayerPicker-categoryTitle",u.setAttribute("data-bind","text: name"),c.appendChild(u);const f=document.createElement("div");f.className="cesium-baseLayerPicker-choices",f.setAttribute("data-bind","foreach: providers"),c.appendChild(f);const h=document.createElement("div");h.className="cesium-baseLayerPicker-item",h.setAttribute("data-bind",'css: { "cesium-baseLayerPicker-selectedItem" : $data === $parents[1].selectedImagery },attr: { title: tooltip },visible: creationCommand.canExecute,click: function($data) { $parents[1].selectedImagery = $data; }'),f.appendChild(h);const _=document.createElement("img");_.className="cesium-baseLayerPicker-itemIcon",_.setAttribute("data-bind","attr: { src: iconUrl }"),_.setAttribute("draggable","false"),h.appendChild(_);const g=document.createElement("div");g.className="cesium-baseLayerPicker-itemLabel",g.setAttribute("data-bind","text: name"),h.appendChild(g);const p=document.createElement("div");p.className="cesium-baseLayerPicker-sectionTitle",p.setAttribute("data-bind","visible: terrainProviderViewModels.length > 0"),p.innerHTML="Terrain",r.appendChild(p);const y=document.createElement("div");y.className="cesium-baseLayerPicker-section",y.setAttribute("data-bind","foreach: _terrainProviders"),r.appendChild(y);const T=document.createElement("div");T.className="cesium-baseLayerPicker-category",y.appendChild(T);const b=document.createElement("div");b.className="cesium-baseLayerPicker-categoryTitle",b.setAttribute("data-bind","text: name"),T.appendChild(b);const x=document.createElement("div");x.className="cesium-baseLayerPicker-choices",x.setAttribute("data-bind","foreach: providers"),T.appendChild(x);const v=document.createElement("div");v.className="cesium-baseLayerPicker-item",v.setAttribute("data-bind",'css: { "cesium-baseLayerPicker-selectedItem" : $data === $parents[1].selectedTerrain },attr: { title: tooltip },visible: creationCommand.canExecute,click: function($data) { $parents[1].selectedTerrain = $data; }'),x.appendChild(v);const D=document.createElement("img");D.className="cesium-baseLayerPicker-itemIcon",D.setAttribute("data-bind","attr: { src: iconUrl }"),D.setAttribute("draggable","false"),v.appendChild(D);const L=document.createElement("div");L.className="cesium-baseLayerPicker-itemLabel",L.setAttribute("data-bind","text: name"),v.appendChild(L),_t.applyBindings(n,i),_t.applyBindings(n,r),this._viewModel=n,this._container=e,this._element=i,this._dropPanel=r,this._closeDropDown=function(B){i.contains(B.target)||r.contains(B.target)||(n.dropDownVisible=!1)},Mn.supportsPointerEvents()?document.addEventListener("pointerdown",this._closeDropDown,!0):(document.addEventListener("mousedown",this._closeDropDown,!0),document.addEventListener("touchstart",this._closeDropDown,!0))}Object.defineProperties(GP.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}});GP.prototype.isDestroyed=function(){return!1};GP.prototype.destroy=function(){return Mn.supportsPointerEvents()?document.removeEventListener("pointerdown",this._closeDropDown,!0):(document.removeEventListener("mousedown",this._closeDropDown,!0),document.removeEventListener("touchstart",this._closeDropDown,!0)),_t.cleanNode(this._element),_t.cleanNode(this._dropPanel),this._container.removeChild(this._element),this._container.removeChild(this._dropPanel),Je(this)};function Sa(e){if(!l(e.name))throw new w("options.name is required.");if(!l(e.tooltip))throw new w("options.tooltip is required.");if(!l(e.iconUrl))throw new w("options.iconUrl is required.");if(typeof e.creationFunction!="function")throw new w("options.creationFunction is required.");let t=e.creationFunction;l(t.canExecute)||(t=zr(t)),this._creationCommand=t,this.name=e.name,this.tooltip=e.tooltip,this.iconUrl=e.iconUrl,this._category=A(e.category,""),_t.track(this,["name","tooltip","iconUrl"])}Object.defineProperties(Sa.prototype,{creationCommand:{get:function(){return this._creationCommand}},category:{get:function(){return this._category}}});function x0t(){const e=[];return e.push(new Sa({name:"Bing Maps Aerial",iconUrl:Un("Widgets/Images/ImageryProviders/bingAerial.png"),tooltip:"Bing Maps aerial imagery, provided by Cesium ion",category:"Cesium ion",creationFunction:function(){return DD({style:vD.AERIAL})}})),e.push(new Sa({name:"Bing Maps Aerial with Labels",iconUrl:Un("Widgets/Images/ImageryProviders/bingAerialLabels.png"),tooltip:"Bing Maps aerial imagery with labels, provided by Cesium ion",category:"Cesium ion",creationFunction:function(){return DD({style:vD.AERIAL_WITH_LABELS})}})),e.push(new Sa({name:"Bing Maps Roads",iconUrl:Un("Widgets/Images/ImageryProviders/bingRoads.png"),tooltip:"Bing Maps standard road maps, provided by Cesium ion",category:"Cesium ion",creationFunction:function(){return DD({style:vD.ROAD})}})),e.push(new Sa({name:"ESRI World Imagery",iconUrl:Un("Widgets/Images/ImageryProviders/esriWorldImagery.png"),tooltip:`World Imagery provides one meter or better satellite and aerial imagery in many parts of the world and lower resolution satellite imagery worldwide. The map includes NASA Blue Marble: Next Generation 500m resolution imagery at small scales (above 1:1,000,000), i-cubed 15m eSAT imagery at medium-to-large scales (down to 1:70,000) for the world, and USGS 15m Landsat imagery for Antarctica. The map features 0.3m resolution imagery in the continental United States and 0.6m resolution imagery in parts of Western Europe from DigitalGlobe. In other parts of the world, 1 meter resolution imagery is available from GeoEye IKONOS, i-cubed Nationwide Prime, Getmapping, AeroGRID, IGN Spain, and IGP Portugal. Additionally, imagery at different resolutions has been contributed by the GIS User Community.
|
||
http://www.esri.com`,category:"Other",creationFunction:function(){return new Nm({url:"https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer",enablePickFeatures:!1})}})),e.push(new Sa({name:"ESRI World Street Map",iconUrl:Un("Widgets/Images/ImageryProviders/esriWorldStreetMap.png"),tooltip:`This worldwide street map presents highway-level data for the world. Street-level data includes the United States; much of Canada; Japan; most countries in Europe; Australia and New Zealand; India; parts of South America including Argentina, Brazil, Chile, Colombia, and Venezuela; Ghana; and parts of southern Africa including Botswana, Lesotho, Namibia, South Africa, and Swaziland.
|
||
http://www.esri.com`,category:"Other",creationFunction:function(){return new Nm({url:"https://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer",enablePickFeatures:!1})}})),e.push(new Sa({name:"ESRI National Geographic",iconUrl:Un("Widgets/Images/ImageryProviders/esriNationalGeographic.png"),tooltip:`This web map contains the National Geographic World Map service. This map service is designed to be used as a general reference map for informational and educational purposes as well as a basemap by GIS professionals and other users for creating web maps and web mapping applications.
|
||
http://www.esri.com`,category:"Other",creationFunction:function(){return new Nm({url:"https://services.arcgisonline.com/ArcGIS/rest/services/NatGeo_World_Map/MapServer/",enablePickFeatures:!1})}})),e.push(new Sa({name:"OpenStreetMap",iconUrl:Un("Widgets/Images/ImageryProviders/openStreetMap.png"),tooltip:`OpenStreetMap (OSM) is a collaborative project to create a free editable map of the world.
|
||
http://www.openstreetmap.org`,category:"Other",creationFunction:function(){return new HA({url:"https://a.tile.openstreetmap.org/"})}})),e.push(new Sa({name:"Stamen Watercolor",iconUrl:Un("Widgets/Images/ImageryProviders/stamenWatercolor.png"),tooltip:`Reminiscent of hand drawn maps, Stamen watercolor maps apply raster effect area washes and organic edges over a paper texture to add warm pop to any map.
|
||
http://maps.stamen.com`,category:"Other",creationFunction:function(){return new HA({url:"https://stamen-tiles.a.ssl.fastly.net/watercolor/",credit:"Map tiles by Stamen Design, under CC BY 3.0. Data by OpenStreetMap, under CC BY SA."})}})),e.push(new Sa({name:"Stamen Toner",iconUrl:Un("Widgets/Images/ImageryProviders/stamenToner.png"),tooltip:`A high contrast black and white map.
|
||
http://maps.stamen.com`,category:"Other",creationFunction:function(){return new HA({url:"https://stamen-tiles.a.ssl.fastly.net/toner/",credit:"Map tiles by Stamen Design, under CC BY 3.0. Data by OpenStreetMap, under CC BY SA."})}})),e.push(new Sa({name:"Sentinel-2",iconUrl:Un("Widgets/Images/ImageryProviders/sentinel-2.png"),tooltip:"Sentinel-2 cloudless by EOX IT Services GmbH (Contains modified Copernicus Sentinel data 2016 and 2017).",category:"Cesium ion",creationFunction:function(){return new rf({assetId:3954})}})),e.push(new Sa({name:"Blue Marble",iconUrl:Un("Widgets/Images/ImageryProviders/blueMarble.png"),tooltip:"Blue Marble Next Generation July, 2004 imagery from NASA.",category:"Cesium ion",creationFunction:function(){return new rf({assetId:3845})}})),e.push(new Sa({name:"Earth at night",iconUrl:Un("Widgets/Images/ImageryProviders/earthAtNight.png"),tooltip:"The Earth at night, also known as The Black Marble, is a 500 meter resolution global composite imagery layer released by NASA.",category:"Cesium ion",creationFunction:function(){return new rf({assetId:3812})}})),e.push(new Sa({name:"Natural Earth II",iconUrl:Un("Widgets/Images/ImageryProviders/naturalEarthII.png"),tooltip:`Natural Earth II, darkened for contrast.
|
||
http://www.naturalearthdata.com/`,category:"Cesium ion",creationFunction:function(){return new Nh({url:Un("Assets/Textures/NaturalEarthII")})}})),e}function w0t(){const e=[];return e.push(new Sa({name:"WGS84 Ellipsoid",iconUrl:Un("Widgets/Images/TerrainProviders/Ellipsoid.png"),tooltip:"WGS84 standard ellipsoid, also known as EPSG:4326",category:"Cesium ion",creationFunction:function(){return new y_}})),e.push(new Sa({name:"Cesium World Terrain",iconUrl:Un("Widgets/Images/TerrainProviders/CesiumWorldTerrain.png"),tooltip:"High-resolution global terrain tileset curated from several datasources and hosted by Cesium ion",category:"Cesium ion",creationFunction:function(){return y_t({requestWaterMask:!0,requestVertexNormals:!0})}})),e}function WP(e,t){l(t)||(t=document.body),t=Zr(t);const n=this,i=_t.observable(zs.fullscreen),o=_t.observable(zs.enabled),r=t.ownerDocument;this.isFullscreen=void 0,_t.defineProperty(this,"isFullscreen",{get:function(){return i()}}),this.isFullscreenEnabled=void 0,_t.defineProperty(this,"isFullscreenEnabled",{get:function(){return o()},set:function(s){o(s&&zs.enabled)}}),this.tooltip=void 0,_t.defineProperty(this,"tooltip",function(){return this.isFullscreenEnabled?i()?"Exit full screen":"Full screen":"Full screen unavailable"}),this._command=zr(function(){zs.fullscreen?zs.exitFullscreen():zs.requestFullscreen(n._fullscreenElement)},_t.getObservable(this,"isFullscreenEnabled")),this._fullscreenElement=A(Zr(e),r.body),this._callback=function(){i(zs.fullscreen)},r.addEventListener(zs.changeEventName,this._callback)}Object.defineProperties(WP.prototype,{fullscreenElement:{get:function(){return this._fullscreenElement},set:function(e){if(!(e instanceof Element))throw new w("value must be a valid Element.");this._fullscreenElement=e}},command:{get:function(){return this._command}}});WP.prototype.isDestroyed=function(){return!1};WP.prototype.destroy=function(){document.removeEventListener(zs.changeEventName,this._callback),Je(this)};const S0t="M 83.96875 17.5625 L 83.96875 17.59375 L 76.65625 24.875 L 97.09375 24.96875 L 76.09375 45.96875 L 81.9375 51.8125 L 102.78125 30.9375 L 102.875 51.15625 L 110.15625 43.875 L 110.1875 17.59375 L 83.96875 17.5625 z M 44.125 17.59375 L 17.90625 17.625 L 17.9375 43.90625 L 25.21875 51.1875 L 25.3125 30.96875 L 46.15625 51.8125 L 52 45.96875 L 31 25 L 51.4375 24.90625 L 44.125 17.59375 z M 46.0625 76.03125 L 25.1875 96.875 L 25.09375 76.65625 L 17.8125 83.9375 L 17.8125 110.21875 L 44 110.25 L 51.3125 102.9375 L 30.90625 102.84375 L 51.875 81.875 L 46.0625 76.03125 z M 82 76.15625 L 76.15625 82 L 97.15625 103 L 76.71875 103.0625 L 84.03125 110.375 L 110.25 110.34375 L 110.21875 84.0625 L 102.9375 76.8125 L 102.84375 97 L 82 76.15625 z",v0t="M 104.34375 17.5625 L 83.5 38.4375 L 83.40625 18.21875 L 76.125 25.5 L 76.09375 51.78125 L 102.3125 51.8125 L 102.3125 51.78125 L 109.625 44.5 L 89.1875 44.40625 L 110.1875 23.40625 L 104.34375 17.5625 z M 23.75 17.59375 L 17.90625 23.4375 L 38.90625 44.4375 L 18.5 44.53125 L 25.78125 51.8125 L 52 51.78125 L 51.96875 25.53125 L 44.6875 18.25 L 44.625 38.46875 L 23.75 17.59375 z M 25.6875 76.03125 L 18.375 83.3125 L 38.78125 83.40625 L 17.8125 104.40625 L 23.625 110.25 L 44.5 89.375 L 44.59375 109.59375 L 51.875 102.3125 L 51.875 76.0625 L 25.6875 76.03125 z M 102.375 76.15625 L 76.15625 76.1875 L 76.1875 102.4375 L 83.46875 109.71875 L 83.5625 89.53125 L 104.40625 110.375 L 110.25 104.53125 L 89.25 83.53125 L 109.6875 83.46875 L 102.375 76.15625 z";function qP(e,t){if(!l(e))throw new w("container is required.");e=Zr(e);const n=new WP(t,e);n._exitFullScreenPath=v0t,n._enterFullScreenPath=S0t;const i=document.createElement("button");i.type="button",i.className="cesium-button cesium-fullscreenButton",i.setAttribute("data-bind","attr: { title: tooltip },click: command,enable: isFullscreenEnabled,cesiumSvgPath: { path: isFullscreen ? _exitFullScreenPath : _enterFullScreenPath, width: 128, height: 128 }"),e.appendChild(i),_t.applyBindings(n,i),this._container=e,this._viewModel=n,this._element=i}Object.defineProperties(qP.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}});qP.prototype.isDestroyed=function(){return!1};qP.prototype.destroy=function(){return this._viewModel.destroy(),_t.cleanNode(this._element),this._container.removeChild(this._element),Je(this)};const W7=1e3;function vd(e){if(!l(e)||!l(e.scene))throw new w("options.scene is required.");l(e.geocoderServices)?this._geocoderServices=e.geocoderServices:this._geocoderServices=[new Yse,new nae({scene:e.scene})],this._viewContainer=e.container,this._scene=e.scene,this._flightDuration=e.flightDuration,this._searchText="",this._isSearchInProgress=!1,this._geocodePromise=void 0,this._complete=new lt,this._suggestions=[],this._selectedSuggestion=void 0,this._showSuggestions=!0,this._handleArrowDown=j7,this._handleArrowUp=q7;const t=this;this._suggestionsVisible=_t.pureComputed(function(){const o=_t.getObservable(t,"_suggestions")().length>0,r=_t.getObservable(t,"_showSuggestions")();return o&&r}),this._searchCommand=zr(function(i){if(i=A(i,aH.SEARCH),t._focusTextbox=!1,l(t._selectedSuggestion))return t.activateSuggestion(t._selectedSuggestion),!1;t.hideSuggestions(),t.isSearchInProgress?B0t(t):O0t(t,t._geocoderServices,i)}),this.deselectSuggestion=function(){t._selectedSuggestion=void 0},this.handleKeyDown=function(i,o){const r=o.key==="ArrowDown"||o.key==="Down"||o.keyCode===40,s=o.key==="ArrowUp"||o.key==="Up"||o.keyCode===38;return(r||s)&&o.preventDefault(),!0},this.handleKeyUp=function(i,o){const r=o.key==="ArrowDown"||o.key==="Down"||o.keyCode===40,s=o.key==="ArrowUp"||o.key==="Up"||o.keyCode===38,a=o.key==="Enter"||o.keyCode===13;return s?q7(t):r?j7(t):a&&t._searchCommand(),!0},this.activateSuggestion=function(i){t.hideSuggestions(),t._searchText=i.displayName;const o=i.destination;Sae(t),t.destinationFound(t,o)},this.hideSuggestions=function(){t._showSuggestions=!1,t._selectedSuggestion=void 0},this.showSuggestions=function(){t._showSuggestions=!0},this.handleMouseover=function(i,o){i!==t._selectedSuggestion&&(t._selectedSuggestion=i)},this.keepExpanded=!1,this.autoComplete=A(e.autocomplete,!0),this.destinationFound=A(e.destinationFound,vd.flyToDestination),this._focusTextbox=!1,_t.track(this,["_searchText","_isSearchInProgress","keepExpanded","_suggestions","_selectedSuggestion","_showSuggestions","_focusTextbox"]);const n=_t.getObservable(this,"_searchText");n.extend({rateLimit:{timeout:500}}),this._suggestionSubscription=n.subscribe(function(){vd._updateSearchSuggestions(t)}),this.isSearchInProgress=void 0,_t.defineProperty(this,"isSearchInProgress",{get:function(){return this._isSearchInProgress}}),this.searchText=void 0,_t.defineProperty(this,"searchText",{get:function(){return this.isSearchInProgress?"Searching...":this._searchText},set:function(i){if(typeof i!="string")throw new w("value must be a valid string.");this._searchText=i}}),this.flightDuration=void 0,_t.defineProperty(this,"flightDuration",{get:function(){return this._flightDuration},set:function(i){if(l(i)&&i<0)throw new w("value must be positive.");this._flightDuration=i}})}Object.defineProperties(vd.prototype,{complete:{get:function(){return this._complete}},scene:{get:function(){return this._scene}},search:{get:function(){return this._searchCommand}},selectedSuggestion:{get:function(){return this._selectedSuggestion}},suggestions:{get:function(){return this._suggestions}}});vd.prototype.destroy=function(){this._suggestionSubscription.dispose()};function q7(e){if(e._suggestions.length===0)return;const t=e._suggestions.indexOf(e._selectedSuggestion);if(t===-1||t===0){e._selectedSuggestion=void 0;return}const n=t-1;e._selectedSuggestion=e._suggestions[n],vd._adjustSuggestionsScroll(e,n)}function j7(e){if(e._suggestions.length===0)return;const t=e._suggestions.length,i=(e._suggestions.indexOf(e._selectedSuggestion)+1)%t;e._selectedSuggestion=e._suggestions[i],vd._adjustSuggestionsScroll(e,i)}function D0t(e,t){const n=l(t)?t.availability:void 0;return l(n)?HP(t,[e]).then(function(i){return e=i[0],e.height+=W7,e}):(e.height+=W7,Promise.resolve(e))}function I0t(e,t){const n=e._scene,o=n.mapProjection.ellipsoid,r=n.camera,s=n.terrainProvider;let a=t,c;return t instanceof Ee?F.equalsEpsilon(t.south,t.north,F.EPSILON7)&&F.equalsEpsilon(t.east,t.west,F.EPSILON7)?t=Ee.center(t):c=kP(t,n):t=o.cartesianToCartographic(t),l(c)||(c=D0t(t,s)),c.then(function(u){a=o.cartographicToCartesian(u)}).finally(function(){r.flyTo({destination:a,complete:function(){e._complete.raiseEvent()},duration:e._flightDuration,endTransform:N.IDENTITY})})}function P0t(e,t,n,i){return e.then(function(o){return l(o)&&o.state==="fulfilled"&&o.value.length>0?o:t.geocode(n,i).then(function(s){return{state:"fulfilled",value:s}}).catch(function(s){return{state:"rejected",reason:s}})})}function O0t(e,t,n){const i=e._searchText;if(wae(i)){e.showSuggestions();return}e._isSearchInProgress=!0;let o=Promise.resolve();for(let r=0;r<t.length;r++)o=P0t(o,t[r],i,n);e._geocodePromise=o,o.then(function(r){if(o.cancel)return;e._isSearchInProgress=!1;const s=r.value;if(r.state==="fulfilled"&&l(s)&&s.length>0){e._searchText=s[0].displayName,e.destinationFound(e,s[0].destination);return}e._searchText=`${i} (not found)`})}function L0t(e,t){const n=Zr(e._viewContainer),i=n.getElementsByClassName("search-results")[0],r=n.getElementsByTagName("li")[t];if(t===0){i.scrollTop=0;return}const s=r.offsetTop;s+r.clientHeight>i.clientHeight?i.scrollTop=s+r.clientHeight:s<i.scrollTop&&(i.scrollTop=s)}function B0t(e){e._isSearchInProgress=!1,l(e._geocodePromise)&&(e._geocodePromise.cancel=!0,e._geocodePromise=void 0)}function wae(e){return/^\s*$/.test(e)}function Sae(e){_t.getObservable(e,"_suggestions").removeAll()}function R0t(e){if(!e.autoComplete)return;const t=e._searchText;if(Sae(e),wae(t))return;let n=Promise.resolve([]);return e._geocoderServices.forEach(function(i){n=n.then(function(o){return o.length>=5?o:i.geocode(t,aH.AUTOCOMPLETE).then(function(r){return o=o.concat(r),o})})}),n.then(function(i){const o=e._suggestions;for(let r=0;r<i.length;r++)o.push(i[r])})}vd.flyToDestination=I0t;vd._updateSearchSuggestions=R0t;vd._adjustSuggestionsScroll=L0t;const N0t="M29.772,26.433l-7.126-7.126c0.96-1.583,1.523-3.435,1.524-5.421C24.169,8.093,19.478,3.401,13.688,3.399C7.897,3.401,3.204,8.093,3.204,13.885c0,5.789,4.693,10.481,10.484,10.481c1.987,0,3.839-0.563,5.422-1.523l7.128,7.127L29.772,26.433zM7.203,13.885c0.006-3.582,2.903-6.478,6.484-6.486c3.579,0.008,6.478,2.904,6.484,6.486c-0.007,3.58-2.905,6.476-6.484,6.484C10.106,20.361,7.209,17.465,7.203,13.885z",M0t="M24.778,21.419 19.276,15.917 24.777,10.415 21.949,7.585 16.447,13.087 10.945,7.585 8.117,10.415 13.618,15.917 8.116,21.419 10.946,24.248 16.447,18.746 21.948,24.248z";function jP(e){if(!l(e)||!l(e.container))throw new w("options.container is required.");if(!l(e.scene))throw new w("options.scene is required.");const t=Zr(e.container),n=new vd(e);n._startSearchPath=N0t,n._stopSearchPath=M0t;const i=document.createElement("form");i.setAttribute("data-bind","submit: search");const o=document.createElement("input");o.type="search",o.className="cesium-geocoder-input",o.setAttribute("placeholder","Enter an address or landmark..."),o.setAttribute("data-bind",'textInput: searchText,disable: isSearchInProgress,event: { keyup: handleKeyUp, keydown: handleKeyDown, mouseover: deselectSuggestion },css: { "cesium-geocoder-input-wide" : keepExpanded || searchText.length > 0 },hasFocus: _focusTextbox'),this._onTextBoxFocus=function(){setTimeout(function(){o.select()},0)},o.addEventListener("focus",this._onTextBoxFocus,!1),i.appendChild(o),this._textBox=o;const r=document.createElement("span");r.className="cesium-geocoder-searchButton",r.setAttribute("data-bind","click: search,cesiumSvgPath: { path: isSearchInProgress ? _stopSearchPath : _startSearchPath, width: 32, height: 32 }"),i.appendChild(r),t.appendChild(i);const s=document.createElement("div");s.className="search-results",s.setAttribute("data-bind","visible: _suggestionsVisible");const a=document.createElement("ul");a.setAttribute("data-bind","foreach: _suggestions");const c=document.createElement("li");a.appendChild(c),c.setAttribute("data-bind","text: $data.displayName, click: $parent.activateSuggestion, event: { mouseover: $parent.handleMouseover}, css: { active: $data === $parent._selectedSuggestion }"),s.appendChild(a),t.appendChild(s),_t.applyBindings(n,i),_t.applyBindings(n,s),this._container=t,this._searchSuggestionsContainer=s,this._viewModel=n,this._form=i,this._onInputBegin=function(u){let f=u.target;typeof u.composedPath=="function"&&(f=u.composedPath()[0]),t.contains(f)||(n._focusTextbox=!1,n.hideSuggestions())},this._onInputEnd=function(u){n._focusTextbox=!0,n.showSuggestions()},Mn.supportsPointerEvents()?(document.addEventListener("pointerdown",this._onInputBegin,!0),t.addEventListener("pointerup",this._onInputEnd,!0),t.addEventListener("pointercancel",this._onInputEnd,!0)):(document.addEventListener("mousedown",this._onInputBegin,!0),t.addEventListener("mouseup",this._onInputEnd,!0),document.addEventListener("touchstart",this._onInputBegin,!0),t.addEventListener("touchend",this._onInputEnd,!0),t.addEventListener("touchcancel",this._onInputEnd,!0))}Object.defineProperties(jP.prototype,{container:{get:function(){return this._container}},searchSuggestionsContainer:{get:function(){return this._searchSuggestionsContainer}},viewModel:{get:function(){return this._viewModel}}});jP.prototype.isDestroyed=function(){return!1};jP.prototype.destroy=function(){const e=this._container;return Mn.supportsPointerEvents()?(document.removeEventListener("pointerdown",this._onInputBegin,!0),e.removeEventListener("pointerup",this._onInputEnd,!0)):(document.removeEventListener("mousedown",this._onInputBegin,!0),e.removeEventListener("mouseup",this._onInputEnd,!0),document.removeEventListener("touchstart",this._onInputBegin,!0),e.removeEventListener("touchend",this._onInputEnd,!0)),this._viewModel.destroy(),_t.cleanNode(this._form),_t.cleanNode(this._searchSuggestionsContainer),e.removeChild(this._form),e.removeChild(this._searchSuggestionsContainer),this._textBox.removeEventListener("focus",this._onTextBoxFocus,!1),Je(this)};function vae(e,t){if(!l(e))throw new w("scene is required.");this._scene=e,this._duration=t;const n=this;this._command=zr(function(){n._scene.camera.flyHome(n._duration)}),this.tooltip="View Home",_t.track(this,["tooltip"])}Object.defineProperties(vae.prototype,{scene:{get:function(){return this._scene}},command:{get:function(){return this._command}},duration:{get:function(){return this._duration},set:function(e){if(l(e)&&e<0)throw new w("value must be positive.");this._duration=e}}});function YP(e,t,n){if(!l(e))throw new w("container is required.");e=Zr(e);const i=new vae(t,n);i._svgPath="M14,4l-10,8.75h20l-4.25-3.7188v-4.6562h-2.812v2.1875l-2.938-2.5625zm-7.0938,9.906v10.094h14.094v-10.094h-14.094zm2.1876,2.313h3.3122v4.25h-3.3122v-4.25zm5.8442,1.281h3.406v6.438h-3.406v-6.438z";const o=document.createElement("button");o.type="button",o.className="cesium-button cesium-toolbar-button cesium-home-button",o.setAttribute("data-bind","attr: { title: tooltip },click: command,cesiumSvgPath: { path: _svgPath, width: 28, height: 28 }"),e.appendChild(o),_t.applyBindings(i,o),this._container=e,this._viewModel=i,this._element=o}Object.defineProperties(YP.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}});YP.prototype.isDestroyed=function(){return!1};YP.prototype.destroy=function(){return _t.cleanNode(this._element),this._container.removeChild(this._element),Je(this)};const F0t="M 13.84375 7.03125 C 11.412798 7.03125 9.46875 8.975298 9.46875 11.40625 L 9.46875 11.59375 L 2.53125 7.21875 L 2.53125 24.0625 L 9.46875 19.6875 C 9.4853444 22.104033 11.423165 24.0625 13.84375 24.0625 L 25.875 24.0625 C 28.305952 24.0625 30.28125 22.087202 30.28125 19.65625 L 30.28125 11.40625 C 30.28125 8.975298 28.305952 7.03125 25.875 7.03125 L 13.84375 7.03125 z",z0t="M 27.34375 1.65625 L 5.28125 27.9375 L 8.09375 30.3125 L 30.15625 4.03125 L 27.34375 1.65625 z M 13.84375 7.03125 C 11.412798 7.03125 9.46875 8.975298 9.46875 11.40625 L 9.46875 11.59375 L 2.53125 7.21875 L 2.53125 24.0625 L 9.46875 19.6875 C 9.4724893 20.232036 9.5676108 20.7379 9.75 21.21875 L 21.65625 7.03125 L 13.84375 7.03125 z M 28.21875 7.71875 L 14.53125 24.0625 L 25.875 24.0625 C 28.305952 24.0625 30.28125 22.087202 30.28125 19.65625 L 30.28125 11.40625 C 30.28125 9.8371439 29.456025 8.4902779 28.21875 7.71875 z";function dH(){this._cameraClicked=new lt,this._closeClicked=new lt,this.maxHeight=500,this.enableCamera=!1,this.isCameraTracking=!1,this.showInfo=!1,this.titleText="",this.description="",_t.track(this,["showInfo","titleText","description","maxHeight","enableCamera","isCameraTracking"]),this._loadingIndicatorHtml='<div class="cesium-infoBox-loadingContainer"><span class="cesium-infoBox-loading"></span></div>',this.cameraIconPath=void 0,_t.defineProperty(this,"cameraIconPath",{get:function(){return!this.enableCamera||this.isCameraTracking?z0t:F0t}}),_t.defineProperty(this,"_bodyless",{get:function(){return!l(this.description)||this.description.length===0}})}dH.prototype.maxHeightOffset=function(e){return`${this.maxHeight-e}px`};Object.defineProperties(dH.prototype,{cameraClicked:{get:function(){return this._cameraClicked}},closeClicked:{get:function(){return this._closeClicked}}});function $P(e){E.defined("container",e),e=Zr(e);const t=document.createElement("div");t.className="cesium-infoBox",t.setAttribute("data-bind",'css: { "cesium-infoBox-visible" : showInfo, "cesium-infoBox-bodyless" : _bodyless }'),e.appendChild(t);const n=document.createElement("div");n.className="cesium-infoBox-title",n.setAttribute("data-bind","text: titleText"),t.appendChild(n);const i=document.createElement("button");i.type="button",i.className="cesium-button cesium-infoBox-camera",i.setAttribute("data-bind",'attr: { title: "Focus camera on object" },click: function () { cameraClicked.raiseEvent(this); },enable: enableCamera,cesiumSvgPath: { path: cameraIconPath, width: 32, height: 32 }'),t.appendChild(i);const o=document.createElement("button");o.type="button",o.className="cesium-infoBox-close",o.setAttribute("data-bind","click: function () { closeClicked.raiseEvent(this); }"),o.innerHTML="×",t.appendChild(o);const r=document.createElement("iframe");r.className="cesium-infoBox-iframe",r.setAttribute("sandbox","allow-same-origin allow-popups allow-forms"),r.setAttribute("data-bind","style : { maxHeight : maxHeightOffset(40) }"),r.setAttribute("allowfullscreen",!0),t.appendChild(r);const s=new dH;_t.applyBindings(s,t),this._container=e,this._element=t,this._frame=r,this._viewModel=s,this._descriptionSubscription=void 0;const a=this;r.addEventListener("load",function(){const c=r.contentDocument,u=c.createElement("link");u.href=Un("Widgets/InfoBox/InfoBoxDescription.css"),u.rel="stylesheet",u.type="text/css";const f=c.createElement("div");f.className="cesium-infoBox-description",c.head.appendChild(u),c.body.appendChild(f),a._descriptionSubscription=tu(s,"description",function(h){r.style.height="5px",f.innerHTML=h;let _=null;const g=f.firstElementChild;if(g!==null&&f.childNodes.length===1){const y=window.getComputedStyle(g);if(y!==null){const T=y["background-color"],b=k.fromCssColorString(T);l(b)&&b.alpha!==0&&(_=y["background-color"])}}t.style["background-color"]=_;const p=f.getBoundingClientRect().height;r.style.height=`${p}px`})}),r.setAttribute("src","about:blank")}Object.defineProperties($P.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}},frame:{get:function(){return this._frame}}});$P.prototype.isDestroyed=function(){return!1};$P.prototype.destroy=function(){const e=this._container;return _t.cleanNode(this._element),e.removeChild(this._element),l(this._descriptionSubscription)&&this._descriptionSubscription.dispose(),Je(this)};function Dae(){this.showInstructions=!1;const e=this;this._command=zr(function(){e.showInstructions=!e.showInstructions}),this._showClick=zr(function(){e._touch=!1}),this._showTouch=zr(function(){e._touch=!0}),this._touch=!1,this.tooltip="Navigation Instructions",_t.track(this,["tooltip","showInstructions","_touch"])}Object.defineProperties(Dae.prototype,{command:{get:function(){return this._command}},showClick:{get:function(){return this._showClick}},showTouch:{get:function(){return this._showTouch}}});function XP(e){if(!l(e)||!l(e.container))throw new w("options.container is required.");const t=Zr(e.container),n=new Dae,i=A(e.instructionsInitiallyVisible,!1);n.showInstructions=i,n._svgPath="M16,1.466C7.973,1.466,1.466,7.973,1.466,16c0,8.027,6.507,14.534,14.534,14.534c8.027,0,14.534-6.507,14.534-14.534C30.534,7.973,24.027,1.466,16,1.466z M17.328,24.371h-2.707v-2.596h2.707V24.371zM17.328,19.003v0.858h-2.707v-1.057c0-3.19,3.63-3.696,3.63-5.963c0-1.034-0.924-1.826-2.134-1.826c-1.254,0-2.354,0.924-2.354,0.924l-1.541-1.915c0,0,1.519-1.584,4.137-1.584c2.487,0,4.796,1.54,4.796,4.136C21.156,16.208,17.328,16.627,17.328,19.003z";const o=document.createElement("span");o.className="cesium-navigationHelpButton-wrapper",t.appendChild(o);const r=document.createElement("button");r.type="button",r.className="cesium-button cesium-toolbar-button cesium-navigation-help-button",r.setAttribute("data-bind","attr: { title: tooltip },click: command,cesiumSvgPath: { path: _svgPath, width: 32, height: 32 }"),o.appendChild(r);const s=document.createElement("div");s.className="cesium-navigation-help",s.setAttribute("data-bind",'css: { "cesium-navigation-help-visible" : showInstructions}'),o.appendChild(s);const a=document.createElement("button");a.type="button",a.className="cesium-navigation-button cesium-navigation-button-left",a.setAttribute("data-bind",'click: showClick, css: {"cesium-navigation-button-selected": !_touch, "cesium-navigation-button-unselected": _touch}');const c=document.createElement("img");c.src=Un("Widgets/Images/NavigationHelp/Mouse.svg"),c.className="cesium-navigation-button-icon",c.style.width="25px",c.style.height="25px",a.appendChild(c),a.appendChild(document.createTextNode("Mouse"));const u=document.createElement("button");u.type="button",u.className="cesium-navigation-button cesium-navigation-button-right",u.setAttribute("data-bind",'click: showTouch, css: {"cesium-navigation-button-selected": _touch, "cesium-navigation-button-unselected": !_touch}');const f=document.createElement("img");f.src=Un("Widgets/Images/NavigationHelp/Touch.svg"),f.className="cesium-navigation-button-icon",f.style.width="25px",f.style.height="25px",u.appendChild(f),u.appendChild(document.createTextNode("Touch")),s.appendChild(a),s.appendChild(u);const h=document.createElement("div");h.className="cesium-click-navigation-help cesium-navigation-help-instructions",h.setAttribute("data-bind",'css: { "cesium-click-navigation-help-visible" : !_touch}'),h.innerHTML=` <table> <tr> <td><img src="${Un("Widgets/Images/NavigationHelp/MouseLeft.svg")}" width="48" height="48" /></td> <td> <div class="cesium-navigation-help-pan">Pan view</div> <div class="cesium-navigation-help-details">Left click + drag</div> </td> </tr> <tr> <td><img src="${Un("Widgets/Images/NavigationHelp/MouseRight.svg")}" width="48" height="48" /></td> <td> <div class="cesium-navigation-help-zoom">Zoom view</div> <div class="cesium-navigation-help-details">Right click + drag, or</div> <div class="cesium-navigation-help-details">Mouse wheel scroll</div> </td> </tr> <tr> <td><img src="${Un("Widgets/Images/NavigationHelp/MouseMiddle.svg")}" width="48" height="48" /></td> <td> <div class="cesium-navigation-help-rotate">Rotate view</div> <div class="cesium-navigation-help-details">Middle click + drag, or</div> <div class="cesium-navigation-help-details">CTRL + Left/Right click + drag</div> </td> </tr> </table>`,s.appendChild(h);const _=document.createElement("div");_.className="cesium-touch-navigation-help cesium-navigation-help-instructions",_.setAttribute("data-bind",'css: { "cesium-touch-navigation-help-visible" : _touch}'),_.innerHTML=` <table> <tr> <td><img src="${Un("Widgets/Images/NavigationHelp/TouchDrag.svg")}" width="70" height="48" /></td> <td> <div class="cesium-navigation-help-pan">Pan view</div> <div class="cesium-navigation-help-details">One finger drag</div> </td> </tr> <tr> <td><img src="${Un("Widgets/Images/NavigationHelp/TouchZoom.svg")}" width="70" height="48" /></td> <td> <div class="cesium-navigation-help-zoom">Zoom view</div> <div class="cesium-navigation-help-details">Two finger pinch</div> </td> </tr> <tr> <td><img src="${Un("Widgets/Images/NavigationHelp/TouchTilt.svg")}" width="70" height="48" /></td> <td> <div class="cesium-navigation-help-rotate">Tilt view</div> <div class="cesium-navigation-help-details">Two finger drag, same direction</div> </td> </tr> <tr> <td><img src="${Un("Widgets/Images/NavigationHelp/TouchRotate.svg")}" width="70" height="48" /></td> <td> <div class="cesium-navigation-help-tilt">Rotate view</div> <div class="cesium-navigation-help-details">Two finger drag, opposite direction</div> </td> </tr> </table>`,s.appendChild(_),_t.applyBindings(n,o),this._container=t,this._viewModel=n,this._wrapper=o,this._closeInstructions=function(g){o.contains(g.target)||(n.showInstructions=!1)},Mn.supportsPointerEvents()?document.addEventListener("pointerdown",this._closeInstructions,!0):(document.addEventListener("mousedown",this._closeInstructions,!0),document.addEventListener("touchstart",this._closeInstructions,!0))}Object.defineProperties(XP.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}});XP.prototype.isDestroyed=function(){return!1};XP.prototype.destroy=function(){return Mn.supportsPointerEvents()?document.removeEventListener("pointerdown",this._closeInstructions,!0):(document.removeEventListener("mousedown",this._closeInstructions,!0),document.removeEventListener("touchstart",this._closeInstructions,!0)),_t.cleanNode(this._wrapper),this._container.removeChild(this._wrapper),Je(this)};function KP(e){if(!l(e))throw new w("scene is required.");this._scene=e,this._orthographic=e.camera.frustum instanceof nn,this._flightInProgress=!1,this.dropDownVisible=!1,this.tooltipPerspective="Perspective Projection",this.tooltipOrthographic="Orthographic Projection",this.selectedTooltip=void 0,this.sceneMode=e.mode,_t.track(this,["_orthographic","_flightInProgress","sceneMode","dropDownVisible","tooltipPerspective","tooltipOrthographic"]);const t=this;_t.defineProperty(this,"selectedTooltip",function(){return t._orthographic?t.tooltipOrthographic:t.tooltipPerspective}),this._toggleDropDown=zr(function(){t.sceneMode===me.SCENE2D||t._flightInProgress||(t.dropDownVisible=!t.dropDownVisible)}),this._eventHelper=new Yd,this._eventHelper.add(e.morphComplete,function(n,i,o,r){t.sceneMode=o,t._orthographic=o===me.SCENE2D||t._scene.camera.frustum instanceof nn}),this._eventHelper.add(e.preRender,function(){t._flightInProgress=l(e.camera._currentFlight)}),this._switchToPerspective=zr(function(){t.sceneMode!==me.SCENE2D&&(t._scene.camera.switchToPerspectiveFrustum(),t._orthographic=!1,t.dropDownVisible=!1)}),this._switchToOrthographic=zr(function(){t.sceneMode!==me.SCENE2D&&(t._scene.camera.switchToOrthographicFrustum(),t._orthographic=!0,t.dropDownVisible=!1)}),this._sceneMode=me}Object.defineProperties(KP.prototype,{scene:{get:function(){return this._scene}},toggleDropDown:{get:function(){return this._toggleDropDown}},switchToPerspective:{get:function(){return this._switchToPerspective}},switchToOrthographic:{get:function(){return this._switchToOrthographic}},isOrthographicProjection:{get:function(){return this._orthographic}}});KP.prototype.isDestroyed=function(){return!1};KP.prototype.destroy=function(){this._eventHelper.removeAll(),Je(this)};const U0t="M 28.15625,10.4375 9.125,13.21875 13.75,43.25 41.75,55.09375 50.8125,37 54.5,11.9375 z m 0.125,3 19.976451,0.394265 L 43.03125,16.875 22.6875,14.28125 z M 50.971746,15.705477 47.90625,36.03125 42.53125,46 44.84375,19.3125 z M 12.625,16.03125 l 29.15625,3.6875 -2.65625,31 L 16.4375,41.125 z",H0t="m 31.560594,6.5254438 -20.75,12.4687502 0.1875,24.5625 22.28125,11.8125 19.5,-12 0.65625,-0.375 0,-0.75 0.0312,-23.21875 z m 0.0625,3.125 16.65625,9.5000002 -16.125,10.28125 -17.34375,-9.71875 z m 18.96875,11.1875002 0.15625,20.65625 -17.46875,10.59375 0.15625,-20.28125 z m -37.0625,1.25 17.21875,9.625 -0.15625,19.21875 -16.9375,-9 z";function JP(e,t){if(!l(e))throw new w("container is required.");if(!l(t))throw new w("scene is required.");e=Zr(e);const n=new KP(t);n._perspectivePath=U0t,n._orthographicPath=H0t;const i=document.createElement("span");i.className="cesium-projectionPicker-wrapper cesium-toolbar-button",e.appendChild(i);const o=document.createElement("button");o.type="button",o.className="cesium-button cesium-toolbar-button",o.setAttribute("data-bind",'css: { "cesium-projectionPicker-buttonPerspective": !_orthographic, "cesium-projectionPicker-buttonOrthographic": _orthographic, "cesium-button-disabled" : sceneMode === _sceneMode.SCENE2D || _flightInProgress, "cesium-projectionPicker-selected": dropDownVisible },attr: { title: selectedTooltip },click: toggleDropDown'),o.innerHTML='<!-- ko cesiumSvgPath: { path: _perspectivePath, width: 64, height: 64, css: "cesium-projectionPicker-iconPerspective" } --><!-- /ko --><!-- ko cesiumSvgPath: { path: _orthographicPath, width: 64, height: 64, css: "cesium-projectionPicker-iconOrthographic" } --><!-- /ko -->',i.appendChild(o);const r=document.createElement("button");r.type="button",r.className="cesium-button cesium-toolbar-button cesium-projectionPicker-dropDown-icon",r.setAttribute("data-bind",'css: { "cesium-projectionPicker-visible" : (dropDownVisible && _orthographic), "cesium-projectionPicker-none" : !_orthographic, "cesium-projectionPicker-hidden" : !dropDownVisible },attr: { title: tooltipPerspective },click: switchToPerspective,cesiumSvgPath: { path: _perspectivePath, width: 64, height: 64 }'),i.appendChild(r);const s=document.createElement("button");s.type="button",s.className="cesium-button cesium-toolbar-button cesium-projectionPicker-dropDown-icon",s.setAttribute("data-bind",'css: { "cesium-projectionPicker-visible" : (dropDownVisible && !_orthographic), "cesium-projectionPicker-none" : _orthographic, "cesium-projectionPicker-hidden" : !dropDownVisible},attr: { title: tooltipOrthographic },click: switchToOrthographic,cesiumSvgPath: { path: _orthographicPath, width: 64, height: 64 }'),i.appendChild(s),_t.applyBindings(n,i),this._viewModel=n,this._container=e,this._wrapper=i,this._closeDropDown=function(a){i.contains(a.target)||(n.dropDownVisible=!1)},Mn.supportsPointerEvents()?document.addEventListener("pointerdown",this._closeDropDown,!0):(document.addEventListener("mousedown",this._closeDropDown,!0),document.addEventListener("touchstart",this._closeDropDown,!0))}Object.defineProperties(JP.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}});JP.prototype.isDestroyed=function(){return!1};JP.prototype.destroy=function(){return this._viewModel.destroy(),Mn.supportsPointerEvents()?document.removeEventListener("pointerdown",this._closeDropDown,!0):(document.removeEventListener("mousedown",this._closeDropDown,!0),document.removeEventListener("touchstart",this._closeDropDown,!0)),_t.cleanNode(this._wrapper),this._container.removeChild(this._wrapper),Je(this)};function QP(e,t){if(!l(e))throw new w("scene is required.");this._scene=e;const n=this,i=function(o,r,s,a){n.sceneMode=s,n.dropDownVisible=!1};this._eventHelper=new Yd,this._eventHelper.add(e.morphStart,i),this._duration=A(t,2),this.sceneMode=e.mode,this.dropDownVisible=!1,this.tooltip2D="2D",this.tooltip3D="3D",this.tooltipColumbusView="Columbus View",_t.track(this,["sceneMode","dropDownVisible","tooltip2D","tooltip3D","tooltipColumbusView"]),this.selectedTooltip=void 0,_t.defineProperty(this,"selectedTooltip",function(){const o=n.sceneMode;return o===me.SCENE2D?n.tooltip2D:o===me.SCENE3D?n.tooltip3D:n.tooltipColumbusView}),this._toggleDropDown=zr(function(){n.dropDownVisible=!n.dropDownVisible}),this._morphTo2D=zr(function(){e.morphTo2D(n._duration)}),this._morphTo3D=zr(function(){e.morphTo3D(n._duration)}),this._morphToColumbusView=zr(function(){e.morphToColumbusView(n._duration)}),this._sceneMode=me}Object.defineProperties(QP.prototype,{scene:{get:function(){return this._scene}},duration:{get:function(){return this._duration},set:function(e){if(e<0)throw new w("duration value must be positive.");this._duration=e}},toggleDropDown:{get:function(){return this._toggleDropDown}},morphTo2D:{get:function(){return this._morphTo2D}},morphTo3D:{get:function(){return this._morphTo3D}},morphToColumbusView:{get:function(){return this._morphToColumbusView}}});QP.prototype.isDestroyed=function(){return!1};QP.prototype.destroy=function(){this._eventHelper.removeAll(),Je(this)};const V0t="m 32.401392,4.9330437 c -7.087603,0 -14.096095,2.884602 -19.10793,7.8946843 -5.0118352,5.010083 -7.9296167,11.987468 -7.9296167,19.072999 0,7.085531 2.9177815,14.097848 7.9296167,19.107931 4.837653,4.835961 11.541408,7.631372 18.374354,7.82482 0.05712,0.01231 0.454119,0.139729 0.454119,0.139729 l 0.03493,-0.104797 c 0.08246,7.84e-4 0.162033,0.03493 0.244525,0.03493 0.08304,0 0.161515,-0.03414 0.244526,-0.03493 l 0.03493,0.104797 c 0,0 0.309474,-0.129487 0.349323,-0.139729 6.867765,-0.168094 13.582903,-2.965206 18.444218,-7.82482 2.558195,-2.5573 4.551081,-5.638134 5.903547,-8.977584 1.297191,-3.202966 2.02607,-6.661489 2.02607,-10.130347 0,-6.237309 -2.366261,-12.31219 -6.322734,-17.116794 -0.0034,-0.02316 0.0049,-0.04488 0,-0.06986 -0.01733,-0.08745 -0.104529,-0.278855 -0.104797,-0.279458 -5.31e-4,-0.0012 -0.522988,-0.628147 -0.523984,-0.62878 -3.47e-4,-2.2e-4 -0.133444,-0.03532 -0.244525,-0.06987 C 51.944299,13.447603 51.751076,13.104317 51.474391,12.827728 46.462556,7.8176457 39.488996,4.9330437 32.401392,4.9330437 z m -2.130866,3.5281554 0.104797,9.6762289 c -4.111695,-0.08361 -7.109829,-0.423664 -9.257041,-0.943171 1.198093,-2.269271 2.524531,-4.124404 3.91241,-5.414496 2.167498,-2.0147811 3.950145,-2.8540169 5.239834,-3.3185619 z m 2.794579,0 c 1.280302,0.4754953 3.022186,1.3285948 5.065173,3.2486979 1.424667,1.338973 2.788862,3.303645 3.982275,5.728886 -2.29082,0.403367 -5.381258,0.621049 -8.942651,0.698645 L 33.065105,8.4611991 z m 5.728886,0.2445256 c 4.004072,1.1230822 7.793098,3.1481363 10.724195,6.0782083 0.03468,0.03466 0.07033,0.06991 0.104797,0.104797 -0.45375,0.313891 -0.923054,0.663002 -1.956205,1.082899 -0.647388,0.263114 -1.906242,0.477396 -2.829511,0.733577 -1.382296,-2.988132 -3.027146,-5.368585 -4.785716,-7.0213781 -0.422866,-0.397432 -0.835818,-0.6453247 -1.25756,-0.9781032 z m -15.33525,0.7685092 c -0.106753,0.09503 -0.207753,0.145402 -0.31439,0.244526 -1.684973,1.5662541 -3.298068,3.8232211 -4.680919,6.5672591 -0.343797,-0.14942 -1.035052,-0.273198 -1.292493,-0.419186 -0.956528,-0.542427 -1.362964,-1.022024 -1.537018,-1.292493 -0.0241,-0.03745 -0.01868,-0.0401 -0.03493,-0.06986 2.250095,-2.163342 4.948824,-3.869984 7.859752,-5.0302421 z m -9.641296,7.0912431 c 0.464973,0.571618 0.937729,1.169056 1.956205,1.746612 0.349907,0.198425 1.107143,0.335404 1.537018,0.523983 -1.20166,3.172984 -1.998037,7.051901 -2.165798,11.772162 C 14.256557,30.361384 12.934823,30.161483 12.280427,29.90959 10.644437,29.279855 9.6888882,28.674891 9.1714586,28.267775 8.6540289,27.860658 8.6474751,27.778724 8.6474751,27.778724 l -0.069864,0.03493 C 9.3100294,23.691285 11.163248,19.798527 13.817445,16.565477 z m 37.552149,0.523984 c 2.548924,3.289983 4.265057,7.202594 4.890513,11.318043 -0.650428,0.410896 -1.756876,1.001936 -3.563088,1.606882 -1.171552,0.392383 -3.163859,0.759153 -4.960377,1.117832 -0.04367,-4.752703 -0.784809,-8.591423 -1.88634,-11.807094 0.917574,-0.263678 2.170552,-0.486495 2.864443,-0.76851 1.274693,-0.518066 2.003942,-1.001558 2.654849,-1.467153 z m -31.439008,2.619917 c 2.487341,0.672766 5.775813,1.137775 10.479669,1.222628 l 0.104797,10.689263 0,0.03493 0,0.733577 c -5.435005,-0.09059 -9.512219,-0.519044 -12.610536,-1.117831 0.106127,-4.776683 0.879334,-8.55791 2.02607,-11.562569 z m 23.264866,0.31439 c 1.073459,3.067541 1.833795,6.821314 1.816476,11.702298 -3.054474,0.423245 -7.062018,0.648559 -11.702298,0.698644 l 0,-0.838373 -0.104796,-10.654331 c 4.082416,-0.0864 7.404468,-0.403886 9.990618,-0.908238 z M 8.2632205,30.922625 c 0.7558676,0.510548 1.5529563,1.013339 3.0041715,1.57195 0.937518,0.360875 2.612202,0.647642 3.91241,0.978102 0.112814,3.85566 0.703989,7.107756 1.606883,9.920754 -1.147172,-0.324262 -2.644553,-0.640648 -3.423359,-0.978102 -1.516688,-0.657177 -2.386627,-1.287332 -2.864443,-1.71168 -0.477816,-0.424347 -0.489051,-0.489051 -0.489051,-0.489051 L 9.8002387,40.319395 C 8.791691,37.621767 8.1584238,34.769583 8.1584238,31.900727 c 0,-0.330153 0.090589,-0.648169 0.1047967,-0.978102 z m 48.2763445,0.419186 c 0.0047,0.188973 0.06986,0.36991 0.06986,0.558916 0,2.938869 -0.620228,5.873558 -1.676747,8.628261 -0.07435,0.07583 -0.06552,0.07411 -0.454119,0.349323 -0.606965,0.429857 -1.631665,1.042044 -3.318562,1.676747 -1.208528,0.454713 -3.204964,0.850894 -5.135038,1.25756 0.84593,-2.765726 1.41808,-6.005357 1.606883,-9.815957 2.232369,-0.413371 4.483758,-0.840201 5.938479,-1.327425 1.410632,-0.472457 2.153108,-0.89469 2.96924,-1.327425 z m -38.530252,2.864443 c 3.208141,0.56697 7.372279,0.898588 12.575603,0.978103 l 0.174662,9.885821 c -4.392517,-0.06139 -8.106722,-0.320566 -10.863925,-0.803441 -1.051954,-2.664695 -1.692909,-6.043794 -1.88634,-10.060483 z m 26.793022,0.31439 c -0.246298,3.923551 -0.877762,7.263679 -1.816476,9.885822 -2.561957,0.361954 -5.766249,0.560708 -9.431703,0.62878 l -0.174661,-9.815957 c 4.491734,-0.04969 8.334769,-0.293032 11.42284,-0.698645 z M 12.035901,44.860585 c 0.09977,0.04523 0.105535,0.09465 0.209594,0.139729 1.337656,0.579602 3.441099,1.058072 5.589157,1.537018 1.545042,3.399208 3.548524,5.969402 5.589157,7.789888 -3.034411,-1.215537 -5.871615,-3.007978 -8.174142,-5.309699 -1.245911,-1.245475 -2.271794,-2.662961 -3.213766,-4.156936 z m 40.69605,0 c -0.941972,1.493975 -1.967855,2.911461 -3.213765,4.156936 -2.74253,2.741571 -6.244106,4.696717 -9.955686,5.868615 0.261347,-0.241079 0.507495,-0.394491 0.768509,-0.663713 1.674841,-1.727516 3.320792,-4.181056 4.645987,-7.265904 2.962447,-0.503021 5.408965,-1.122293 7.161107,-1.781544 0.284034,-0.106865 0.337297,-0.207323 0.593848,-0.31439 z m -31.404076,2.305527 c 2.645807,0.376448 5.701178,0.649995 9.466635,0.698645 l 0.139729,7.789888 c -1.38739,-0.480844 -3.316218,-1.29837 -5.659022,-3.388427 -1.388822,-1.238993 -2.743668,-3.0113 -3.947342,-5.100106 z m 20.365491,0.104797 c -1.04872,2.041937 -2.174337,3.779068 -3.353494,4.995309 -1.853177,1.911459 -3.425515,2.82679 -4.611055,3.353494 l -0.139729,-7.789887 c 3.13091,-0.05714 5.728238,-0.278725 8.104278,-0.558916 z",k0t="m 2.9825053,17.550598 0,1.368113 0,26.267766 0,1.368113 1.36811,0 54.9981397,0 1.36811,0 0,-1.368113 0,-26.267766 0,-1.368113 -1.36811,0 -54.9981397,0 -1.36811,0 z m 2.73623,2.736226 10.3292497,0 0,10.466063 -10.3292497,0 0,-10.466063 z m 13.0654697,0 11.69737,0 0,10.466063 -11.69737,0 0,-10.466063 z m 14.43359,0 11.69737,0 0,10.466063 -11.69737,0 0,-10.466063 z m 14.43359,0 10.32926,0 0,10.466063 -10.32926,0 0,-10.466063 z m -41.9326497,13.202288 10.3292497,0 0,10.329252 -10.3292497,0 0,-10.329252 z m 13.0654697,0 11.69737,0 0,10.329252 -11.69737,0 0,-10.329252 z m 14.43359,0 11.69737,0 0,10.329252 -11.69737,0 0,-10.329252 z m 14.43359,0 10.32926,0 0,10.329252 -10.32926,0 0,-10.329252 z",G0t="m 14.723969,17.675598 -0.340489,0.817175 -11.1680536,26.183638 -0.817175,1.872692 2.076986,0 54.7506996,0 2.07698,0 -0.81717,-1.872692 -11.16805,-26.183638 -0.34049,-0.817175 -0.91933,0 -32.414586,0 -0.919322,0 z m 1.838643,2.723916 6.196908,0 -2.928209,10.418977 -7.729111,0 4.460412,-10.418977 z m 9.02297,0 4.903049,0 0,10.418977 -7.831258,0 2.928209,-10.418977 z m 7.626964,0 5.584031,0 2.62176,10.418977 -8.205791,0 0,-10.418977 z m 8.410081,0 5.51593,0 4.46042,10.418977 -7.38863,0 -2.58772,-10.418977 z m -30.678091,13.142892 8.103649,0 -2.89416,10.282782 -9.6018026,0 4.3923136,-10.282782 z m 10.929711,0 8.614384,0 0,10.282782 -11.508544,0 2.89416,-10.282782 z m 11.338299,0 8.852721,0 2.58772,10.282782 -11.440441,0 0,-10.282782 z m 11.678781,0 7.86531,0 4.39231,10.282782 -9.6699,0 -2.58772,-10.282782 z";function ZP(e,t,n){if(!l(e))throw new w("container is required.");if(!l(t))throw new w("scene is required.");e=Zr(e);const i=new QP(t,n);i._globePath=V0t,i._flatMapPath=k0t,i._columbusViewPath=G0t;const o=document.createElement("span");o.className="cesium-sceneModePicker-wrapper cesium-toolbar-button",e.appendChild(o);const r=document.createElement("button");r.type="button",r.className="cesium-button cesium-toolbar-button",r.setAttribute("data-bind",'css: { "cesium-sceneModePicker-button2D": sceneMode === _sceneMode.SCENE2D, "cesium-sceneModePicker-button3D": sceneMode === _sceneMode.SCENE3D, "cesium-sceneModePicker-buttonColumbusView": sceneMode === _sceneMode.COLUMBUS_VIEW, "cesium-sceneModePicker-selected": dropDownVisible },attr: { title: selectedTooltip },click: toggleDropDown'),r.innerHTML='<!-- ko cesiumSvgPath: { path: _globePath, width: 64, height: 64, css: "cesium-sceneModePicker-slide-svg cesium-sceneModePicker-icon3D" } --><!-- /ko --><!-- ko cesiumSvgPath: { path: _flatMapPath, width: 64, height: 64, css: "cesium-sceneModePicker-slide-svg cesium-sceneModePicker-icon2D" } --><!-- /ko --><!-- ko cesiumSvgPath: { path: _columbusViewPath, width: 64, height: 64, css: "cesium-sceneModePicker-slide-svg cesium-sceneModePicker-iconColumbusView" } --><!-- /ko -->',o.appendChild(r);const s=document.createElement("button");s.type="button",s.className="cesium-button cesium-toolbar-button cesium-sceneModePicker-dropDown-icon",s.setAttribute("data-bind",'css: { "cesium-sceneModePicker-visible" : (dropDownVisible && (sceneMode !== _sceneMode.SCENE3D)) || (!dropDownVisible && (sceneMode === _sceneMode.SCENE3D)), "cesium-sceneModePicker-none" : sceneMode === _sceneMode.SCENE3D, "cesium-sceneModePicker-hidden" : !dropDownVisible },attr: { title: tooltip3D },click: morphTo3D,cesiumSvgPath: { path: _globePath, width: 64, height: 64 }'),o.appendChild(s);const a=document.createElement("button");a.type="button",a.className="cesium-button cesium-toolbar-button cesium-sceneModePicker-dropDown-icon",a.setAttribute("data-bind",'css: { "cesium-sceneModePicker-visible" : (dropDownVisible && (sceneMode !== _sceneMode.SCENE2D)), "cesium-sceneModePicker-none" : sceneMode === _sceneMode.SCENE2D, "cesium-sceneModePicker-hidden" : !dropDownVisible },attr: { title: tooltip2D },click: morphTo2D,cesiumSvgPath: { path: _flatMapPath, width: 64, height: 64 }'),o.appendChild(a);const c=document.createElement("button");c.type="button",c.className="cesium-button cesium-toolbar-button cesium-sceneModePicker-dropDown-icon",c.setAttribute("data-bind",'css: { "cesium-sceneModePicker-visible" : (dropDownVisible && (sceneMode !== _sceneMode.COLUMBUS_VIEW)) || (!dropDownVisible && (sceneMode === _sceneMode.COLUMBUS_VIEW)), "cesium-sceneModePicker-none" : sceneMode === _sceneMode.COLUMBUS_VIEW, "cesium-sceneModePicker-hidden" : !dropDownVisible},attr: { title: tooltipColumbusView },click: morphToColumbusView,cesiumSvgPath: { path: _columbusViewPath, width: 64, height: 64 }'),o.appendChild(c),_t.applyBindings(i,o),this._viewModel=i,this._container=e,this._wrapper=o,this._closeDropDown=function(u){o.contains(u.target)||(i.dropDownVisible=!1)},Mn.supportsPointerEvents()?document.addEventListener("pointerdown",this._closeDropDown,!0):(document.addEventListener("mousedown",this._closeDropDown,!0),document.addEventListener("touchstart",this._closeDropDown,!0))}Object.defineProperties(ZP.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}});ZP.prototype.isDestroyed=function(){return!1};ZP.prototype.destroy=function(){return this._viewModel.destroy(),Mn.supportsPointerEvents()?document.removeEventListener("pointerdown",this._closeDropDown,!0):(document.removeEventListener("mousedown",this._closeDropDown,!0),document.removeEventListener("touchstart",this._closeDropDown,!0)),_t.cleanNode(this._wrapper),this._container.removeChild(this._wrapper),Je(this)};const W0t=new $,y1="-1000px";function nw(e,t,n){if(!l(e))throw new w("scene is required.");if(!l(t))throw new w("selectionIndicatorElement is required.");if(!l(n))throw new w("container is required.");this._scene=e,this._screenPositionX=y1,this._screenPositionY=y1,this._tweens=e.tweens,this._container=A(n,document.body),this._selectionIndicatorElement=t,this._scale=1,this.position=void 0,this.showSelection=!1,_t.track(this,["position","_screenPositionX","_screenPositionY","_scale","showSelection"]),this.isVisible=void 0,_t.defineProperty(this,"isVisible",{get:function(){return this.showSelection&&l(this.position)}}),_t.defineProperty(this,"_transform",{get:function(){return`scale(${this._scale})`}}),this.computeScreenSpacePosition=function(i,o){return es.wgs84ToWindowCoordinates(e,i,o)}}nw.prototype.update=function(){if(this.showSelection&&l(this.position)){const e=this.computeScreenSpacePosition(this.position,W0t);if(!l(e))this._screenPositionX=y1,this._screenPositionY=y1;else{const t=this._container,n=t.parentNode.clientWidth,i=t.parentNode.clientHeight,o=this._selectionIndicatorElement.clientWidth,r=o*.5;e.x=Math.min(Math.max(e.x,-o),n+o)-r,e.y=Math.min(Math.max(e.y,-o),i+o)-r,this._screenPositionX=`${Math.floor(e.x+.25)}px`,this._screenPositionY=`${Math.floor(e.y+.25)}px`}}};nw.prototype.animateAppear=function(){this._tweens.addProperty({object:this,property:"_scale",startValue:2,stopValue:1,duration:.8,easingFunction:_l.EXPONENTIAL_OUT})};nw.prototype.animateDepart=function(){this._tweens.addProperty({object:this,property:"_scale",startValue:this._scale,stopValue:1.5,duration:.8,easingFunction:_l.EXPONENTIAL_OUT})};Object.defineProperties(nw.prototype,{container:{get:function(){return this._container}},selectionIndicatorElement:{get:function(){return this._selectionIndicatorElement}},scene:{get:function(){return this._scene}}});function eO(e,t){if(!l(e))throw new w("container is required.");e=Zr(e),this._container=e;const n=document.createElement("div");n.className="cesium-selection-wrapper",n.setAttribute("data-bind",'style: { "top" : _screenPositionY, "left" : _screenPositionX },css: { "cesium-selection-wrapper-visible" : isVisible }'),e.appendChild(n),this._element=n;const i="http://www.w3.org/2000/svg",o="M -34 -34 L -34 -11.25 L -30 -15.25 L -30 -30 L -15.25 -30 L -11.25 -34 L -34 -34 z M 11.25 -34 L 15.25 -30 L 30 -30 L 30 -15.25 L 34 -11.25 L 34 -34 L 11.25 -34 z M -34 11.25 L -34 34 L -11.25 34 L -15.25 30 L -30 30 L -30 15.25 L -34 11.25 z M 34 11.25 L 30 15.25 L 30 30 L 15.25 30 L 11.25 34 L 34 34 L 34 11.25 z",r=document.createElementNS(i,"svg:svg");r.setAttribute("width",160),r.setAttribute("height",160),r.setAttribute("viewBox","0 0 160 160");const s=document.createElementNS(i,"g");s.setAttribute("transform","translate(80,80)"),r.appendChild(s);const a=document.createElementNS(i,"path");a.setAttribute("data-bind","attr: { transform: _transform }"),a.setAttribute("d",o),s.appendChild(a),n.appendChild(r);const c=new nw(t,this._element,this._container);this._viewModel=c,_t.applyBindings(this._viewModel,this._element)}Object.defineProperties(eO.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}});eO.prototype.isDestroyed=function(){return!1};eO.prototype.destroy=function(){const e=this._container;return _t.cleanNode(this._element),e.removeChild(this._element),Je(this)};function Xy(e,t,n){this._color=e,this._height=t,this._base=A(n,0)}Xy.prototype.getHeight=function(){return this._height};Xy.prototype.getBase=function(){return this._base};Xy.prototype.getStartTime=function(){return this._start};Xy.prototype.getStopTime=function(){return this._stop};Xy.prototype.setRange=function(e,t){this._start=e,this._stop=t};Xy.prototype.render=function(e){let t="";if(this._start&&this._stop&&this._color){const n=ce.secondsDifference(this._start,e.epochJulian);let i=Math.round(e.timeBarWidth*e.getAlpha(n));const o=ce.secondsDifference(this._stop,e.epochJulian);let r=Math.round(e.timeBarWidth*e.getAlpha(o))-i;i<0&&(r+=i,i=0),i+r>e.timeBarWidth&&(r=e.timeBarWidth-i),r>0&&(t=`<span class="cesium-timeline-highlight" style="left: ${i.toString()}px; width: ${r.toString()}px; bottom: ${this._base.toString()}px; height: ${this._height}px; background-color: ${this._color};"></span>`)}return t};function Iae(e,t,n,i){this.interval=e,this.height=t,this.color=n||new k(.5,.5,.5,1),this.backgroundColor=i||new k(0,0,0,0)}Iae.prototype.render=function(e,t){const n=this.interval.start,i=this.interval.stop,o=t.startJulian,r=ce.addSeconds(t.startJulian,t.duration,new ce);if(ce.lessThan(n,o)&&ce.greaterThan(i,r))e.fillStyle=this.color.toCssColorString(),e.fillRect(0,t.y,t.timeBarWidth,this.height);else if(ce.lessThanOrEquals(n,r)&&ce.greaterThanOrEquals(i,o)){let s,a,c;for(s=0;s<t.timeBarWidth;++s){const u=ce.addSeconds(t.startJulian,s/t.timeBarWidth*t.duration,new ce);!l(a)&&ce.greaterThanOrEquals(u,n)?a=s:!l(c)&&ce.greaterThanOrEquals(u,i)&&(c=s)}e.fillStyle=this.backgroundColor.toCssColorString(),e.fillRect(0,t.y,t.timeBarWidth,this.height),l(a)&&(l(c)||(c=t.timeBarWidth),e.fillStyle=this.color.toCssColorString(),e.fillRect(a,t.y,Math.max(c-a,1),this.height))}};let eM=1e12;const su={none:0,scrub:1,slide:2,zoom:3,touchOnly:4},fc={none:0,scrub:1,slideZoom:2,singleTap:3,ignore:4},cm=[.001,.002,.005,.01,.02,.05,.1,.25,.5,1,2,5,10,15,30,60,120,300,600,900,1800,3600,7200,14400,21600,43200,86400,172800,345600,604800,1296e3,2592e3,5184e3,7776e3,15552e3,31536e3,63072e3,126144e3,15768e4,31536e4,63072e4,126144e4,15768e5,31536e5,63072e5,126144e5,15768e6,31536e6],q0t=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function tc(e,t){if(!l(e))throw new w("container is required.");if(!l(t))throw new w("clock is required.");e=Zr(e);const n=e.ownerDocument;this.container=e;const i=n.createElement("div");i.className="cesium-timeline-main",e.appendChild(i),this._topDiv=i,this._endJulian=void 0,this._epochJulian=void 0,this._lastXPos=void 0,this._scrubElement=void 0,this._startJulian=void 0,this._timeBarSecondsSpan=void 0,this._clock=t,this._scrubJulian=t.currentTime,this._mainTicSpan=-1,this._mouseMode=su.none,this._touchMode=fc.none,this._touchState={centerX:0,spanX:0},this._mouseX=0,this._timelineDrag=0,this._timelineDragLocation=void 0,this._lastHeight=void 0,this._lastWidth=void 0,this._topDiv.innerHTML='<div class="cesium-timeline-bar"></div><div class="cesium-timeline-trackContainer"><canvas class="cesium-timeline-tracks" width="10" height="1"></canvas></div><div class="cesium-timeline-needle"></div><span class="cesium-timeline-ruler"></span>',this._timeBarEle=this._topDiv.childNodes[0],this._trackContainer=this._topDiv.childNodes[1],this._trackListEle=this._topDiv.childNodes[1].childNodes[0],this._needleEle=this._topDiv.childNodes[2],this._rulerEle=this._topDiv.childNodes[3],this._context=this._trackListEle.getContext("2d"),this._trackList=[],this._highlightRanges=[],this.zoomTo(t.startTime,t.stopTime),this._onMouseDown=j0t(this),this._onMouseUp=Y0t(this),this._onMouseMove=$0t(this),this._onMouseWheel=X0t(this),this._onTouchStart=K0t(this),this._onTouchMove=Q0t(this),this._onTouchEnd=J0t(this);const o=this._timeBarEle;n.addEventListener("mouseup",this._onMouseUp,!1),n.addEventListener("mousemove",this._onMouseMove,!1),o.addEventListener("mousedown",this._onMouseDown,!1),o.addEventListener("DOMMouseScroll",this._onMouseWheel,!1),o.addEventListener("mousewheel",this._onMouseWheel,!1),o.addEventListener("touchstart",this._onTouchStart,!1),o.addEventListener("touchmove",this._onTouchMove,!1),o.addEventListener("touchend",this._onTouchEnd,!1),o.addEventListener("touchcancel",this._onTouchEnd,!1),this._topDiv.oncontextmenu=function(){return!1},t.onTick.addEventListener(this.updateFromClock,this),this.updateFromClock()}tc.prototype.addEventListener=function(e,t,n){this._topDiv.addEventListener(e,t,n)};tc.prototype.removeEventListener=function(e,t,n){this._topDiv.removeEventListener(e,t,n)};tc.prototype.isDestroyed=function(){return!1};tc.prototype.destroy=function(){this._clock.onTick.removeEventListener(this.updateFromClock,this);const e=this.container.ownerDocument;e.removeEventListener("mouseup",this._onMouseUp,!1),e.removeEventListener("mousemove",this._onMouseMove,!1);const t=this._timeBarEle;t.removeEventListener("mousedown",this._onMouseDown,!1),t.removeEventListener("DOMMouseScroll",this._onMouseWheel,!1),t.removeEventListener("mousewheel",this._onMouseWheel,!1),t.removeEventListener("touchstart",this._onTouchStart,!1),t.removeEventListener("touchmove",this._onTouchMove,!1),t.removeEventListener("touchend",this._onTouchEnd,!1),t.removeEventListener("touchcancel",this._onTouchEnd,!1),this.container.removeChild(this._topDiv),Je(this)};tc.prototype.addHighlightRange=function(e,t,n){const i=new Xy(e,t,n);return this._highlightRanges.push(i),this.resize(),i};tc.prototype.addTrack=function(e,t,n,i){const o=new Iae(e,t,n,i);return this._trackList.push(o),this._lastHeight=void 0,this.resize(),o};tc.prototype.zoomTo=function(e,t){if(!l(e))throw new w("startTime is required.");if(!l(t))throw new w("stopTime is required");if(ce.lessThanOrEquals(t,e))throw new w("Start time must come before end time.");if(this._startJulian=e,this._endJulian=t,this._timeBarSecondsSpan=ce.secondsDifference(t,e),this._clock&&this._clock.clockRange!==Mm.UNBOUNDED){const i=this._clock.startTime,o=this._clock.stopTime,r=ce.secondsDifference(o,i),s=ce.secondsDifference(i,this._startJulian),a=ce.secondsDifference(o,this._endJulian);this._timeBarSecondsSpan>=r?(this._timeBarSecondsSpan=r,this._startJulian=this._clock.startTime,this._endJulian=this._clock.stopTime):s>0?(this._endJulian=ce.addSeconds(this._endJulian,s,new ce),this._startJulian=i,this._timeBarSecondsSpan=ce.secondsDifference(this._endJulian,this._startJulian)):a<0&&(this._startJulian=ce.addSeconds(this._startJulian,a,new ce),this._endJulian=o,this._timeBarSecondsSpan=ce.secondsDifference(this._endJulian,this._startJulian))}this._makeTics();const n=document.createEvent("Event");n.initEvent("setzoom",!0,!0),n.startJulian=this._startJulian,n.endJulian=this._endJulian,n.epochJulian=this._epochJulian,n.totalSpan=this._timeBarSecondsSpan,n.mainTicSpan=this._mainTicSpan,this._topDiv.dispatchEvent(n)};tc.prototype.zoomFrom=function(e){let t=ce.secondsDifference(this._scrubJulian,this._startJulian);e>1||t<0||t>this._timeBarSecondsSpan?t=this._timeBarSecondsSpan*.5:t+=t-this._timeBarSecondsSpan*.5;const n=this._timeBarSecondsSpan-t;this.zoomTo(ce.addSeconds(this._startJulian,t-t*e,new ce),ce.addSeconds(this._endJulian,n*e-n,new ce))};function tM(e){return e<10?`0${e.toString()}`:e.toString()}tc.prototype.makeLabel=function(e){const t=ce.toGregorianDate(e),n=t.millisecond;let i=" UTC";if(n>0&&this._timeBarSecondsSpan<3600){for(i=Math.floor(n).toString();i.length<3;)i=`0${i}`;i=`.${i}`}return`${q0t[t.month-1]} ${t.day} ${t.year} ${tM(t.hour)}:${tM(t.minute)}:${tM(t.second)}${i}`};tc.prototype.smallestTicInPixels=7;tc.prototype._makeTics=function(){const e=this._timeBarEle,t=ce.secondsDifference(this._scrubJulian,this._startJulian),n=Math.round(t*this._topDiv.clientWidth/this._timeBarSecondsSpan),i=n-8;let o;const r=this;this._needleEle.style.left=`${n.toString()}px`;let s="";const a=.01,c=31536e6,u=1e-10;let f=0,h=this._timeBarSecondsSpan;h<a?(h=a,this._timeBarSecondsSpan=a,this._endJulian=ce.addSeconds(this._startJulian,a,new ce)):h>c&&(h=c,this._timeBarSecondsSpan=c,this._endJulian=ce.addSeconds(this._startJulian,c,new ce));let _=this._timeBarEle.clientWidth;_<10&&(_=10);const g=this._startJulian,p=Math.min(h/_*1e-5,.4);let y;const T=ce.toGregorianDate(g);h>31536e4?y=ce.fromDate(new Date(Date.UTC(Math.floor(T.year/100)*100,0))):h>31536e3?y=ce.fromDate(new Date(Date.UTC(Math.floor(T.year/10)*10,0))):h>86400?y=ce.fromDate(new Date(Date.UTC(T.year,0))):y=ce.fromDate(new Date(Date.UTC(T.year,T.month,T.day)));const b=ce.secondsDifference(this._startJulian,ce.addSeconds(y,p,new ce));let x=b+h;this._epochJulian=y;function v(j){return Math.floor(b/j)*j}function D(j,ee){return Math.ceil(j/ee+.5)*ee}function L(j){return(j-b)/h}function B(j,ee){return j-ee*Math.round(j/ee)}this._rulerEle.innerHTML=this.makeLabel(ce.addSeconds(this._endJulian,-a,new ce));let V=this._rulerEle.offsetWidth+20;V<30&&(V=180);const M=f;f-=u;const H={startTime:b,startJulian:g,epochJulian:y,duration:h,timeBarWidth:_,getAlpha:L};this._highlightRanges.forEach(function(j){s+=j.render(H)});let G=0,I=0,O=0,m=V/_;m>1&&(m=1),m*=this._timeBarSecondsSpan;let P=-1,R=-1;const U=cm.length;let W;for(W=0;W<U;++W){const j=cm[W];if(++P,G=j,j>m&&j>f)break;R<0&&_*(j/this._timeBarSecondsSpan)>=this.smallestTicInPixels&&(R=P)}if(P>0){for(;P>0;)if(--P,Math.abs(B(G,cm[P]))<1e-5){cm[P]>=f&&(I=cm[P]);break}if(R>=0)for(;R<P;){if(Math.abs(B(I,cm[R]))<1e-5&&cm[R]>=f){O=cm[R];break}++R}}f=M,f>u&&O<1e-5&&Math.abs(f-G)>u&&(O=f,f<=G+u&&(I=0));let q=-999999,Y;if(_*(O/this._timeBarSecondsSpan)>=3)for(o=v(O);o<=x;o=D(o,O))s+=`<span class="cesium-timeline-ticTiny" style="left: ${Math.round(_*L(o)).toString()}px;"></span>`;if(_*(I/this._timeBarSecondsSpan)>=3)for(o=v(I);o<=x;o=D(o,I))s+=`<span class="cesium-timeline-ticSub" style="left: ${Math.round(_*L(o)).toString()}px;"></span>`;if(_*(G/this._timeBarSecondsSpan)>=2){this._mainTicSpan=G,x+=G,o=v(G);const j=ce.computeTaiMinusUtc(y);for(;o<=x;){let ee=ce.addSeconds(g,o-b,new ce);if(G>2.1){const Z=ce.computeTaiMinusUtc(ee);Math.abs(Z-j)>.1&&(o+=Z-j,ee=ce.addSeconds(g,o-b,new ce))}const K=Math.round(_*L(o)),se=this.makeLabel(ee);this._rulerEle.innerHTML=se,Y=this._rulerEle.offsetWidth,Y<10&&(Y=V);const Q=K-(Y/2-1);Q>q?(q=Q+Y+5,s+=`<span class="cesium-timeline-ticMain" style="left: ${K.toString()}px;"></span><span class="cesium-timeline-ticLabel" style="left: ${Q.toString()}px;">${se}</span>`):s+=`<span class="cesium-timeline-ticSub" style="left: ${K.toString()}px;"></span>`,o=D(o,G)}}else this._mainTicSpan=-1;s+=`<span class="cesium-timeline-icon16" style="left:${i}px;bottom:0;background-position: 0 0;"></span>`,e.innerHTML=s,this._scrubElement=e.lastChild,this._context.clearRect(0,0,this._trackListEle.width,this._trackListEle.height),H.y=0,this._trackList.forEach(function(j){j.render(r._context,H),H.y+=j.height})};tc.prototype.updateFromClock=function(){this._scrubJulian=this._clock.currentTime;const e=this._scrubElement;if(l(this._scrubElement)){const t=ce.secondsDifference(this._scrubJulian,this._startJulian),n=Math.round(t*this._topDiv.clientWidth/this._timeBarSecondsSpan);this._lastXPos!==n&&(this._lastXPos=n,e.style.left=`${n-8}px`,this._needleEle.style.left=`${n}px`)}l(this._timelineDragLocation)&&(this._setTimeBarTime(this._timelineDragLocation,this._timelineDragLocation*this._timeBarSecondsSpan/this._topDiv.clientWidth),this.zoomTo(ce.addSeconds(this._startJulian,this._timelineDrag,new ce),ce.addSeconds(this._endJulian,this._timelineDrag,new ce)))};tc.prototype._setTimeBarTime=function(e,t){if(e=Math.round(e),this._scrubJulian=ce.addSeconds(this._startJulian,t,new ce),this._scrubElement){const i=e-8;this._scrubElement.style.left=`${i.toString()}px`,this._needleEle.style.left=`${e.toString()}px`}const n=document.createEvent("Event");n.initEvent("settime",!0,!0),n.clientX=e,n.timeSeconds=t,n.timeJulian=this._scrubJulian,n.clock=this._clock,this._topDiv.dispatchEvent(n)};function j0t(e){return function(t){e._mouseMode!==su.touchOnly&&(t.button===0?(e._mouseMode=su.scrub,e._scrubElement&&(e._scrubElement.style.backgroundPosition="-16px 0"),e._onMouseMove(t)):(e._mouseX=t.clientX,t.button===2?e._mouseMode=su.zoom:e._mouseMode=su.slide)),t.preventDefault()}}function Y0t(e){return function(t){e._mouseMode=su.none,e._scrubElement&&(e._scrubElement.style.backgroundPosition="0 0"),e._timelineDrag=0,e._timelineDragLocation=void 0}}function $0t(e){return function(t){let n;if(e._mouseMode===su.scrub){t.preventDefault();const i=t.clientX-e._topDiv.getBoundingClientRect().left;i<0?(e._timelineDragLocation=0,e._timelineDrag=-.01*e._timeBarSecondsSpan):i>e._topDiv.clientWidth?(e._timelineDragLocation=e._topDiv.clientWidth,e._timelineDrag=.01*e._timeBarSecondsSpan):(e._timelineDragLocation=void 0,e._setTimeBarTime(i,i*e._timeBarSecondsSpan/e._topDiv.clientWidth))}else if(e._mouseMode===su.slide){if(n=e._mouseX-t.clientX,e._mouseX=t.clientX,n!==0){const i=n*e._timeBarSecondsSpan/e._topDiv.clientWidth;e.zoomTo(ce.addSeconds(e._startJulian,i,new ce),ce.addSeconds(e._endJulian,i,new ce))}}else e._mouseMode===su.zoom&&(n=e._mouseX-t.clientX,e._mouseX=t.clientX,n!==0&&e.zoomFrom(Math.pow(1.01,n)))}}function X0t(e){return function(t){let n=t.wheelDeltaY||t.wheelDelta||-t.detail;eM=Math.max(Math.min(Math.abs(n),eM),1),n/=eM,e.zoomFrom(Math.pow(1.05,-n))}}function K0t(e){return function(t){const n=t.touches.length;let i,o;const r=e._topDiv.getBoundingClientRect().left;t.preventDefault(),e._mouseMode=su.touchOnly,n===1?(i=ce.secondsDifference(e._scrubJulian,e._startJulian),o=Math.round(i*e._topDiv.clientWidth/e._timeBarSecondsSpan+r),Math.abs(t.touches[0].clientX-o)<50?(e._touchMode=fc.scrub,e._scrubElement&&(e._scrubElement.style.backgroundPosition=n===1?"-16px 0":"0 0")):(e._touchMode=fc.singleTap,e._touchState.centerX=t.touches[0].clientX-r)):n===2?(e._touchMode=fc.slideZoom,e._touchState.centerX=(t.touches[0].clientX+t.touches[1].clientX)*.5-r,e._touchState.spanX=Math.abs(t.touches[0].clientX-t.touches[1].clientX)):e._touchMode=fc.ignore}}function J0t(e){return function(t){const n=t.touches.length,i=e._topDiv.getBoundingClientRect().left;e._touchMode===fc.singleTap?(e._touchMode=fc.scrub,e._onTouchMove(t)):e._touchMode===fc.scrub&&e._onTouchMove(t),e._mouseMode=su.touchOnly,n!==1?e._touchMode=n>0?fc.ignore:fc.none:e._touchMode===fc.slideZoom&&(e._touchState.centerX=t.touches[0].clientX-i),e._scrubElement&&(e._scrubElement.style.backgroundPosition="0 0")}}function Q0t(e){return function(t){let n,i,o,r,s,a,c=1;const u=e._topDiv.getBoundingClientRect().left;e._touchMode===fc.singleTap&&(e._touchMode=fc.slideZoom),e._mouseMode=su.touchOnly,e._touchMode===fc.scrub?(t.preventDefault(),t.changedTouches.length===1&&(i=t.changedTouches[0].clientX-u,i>=0&&i<=e._topDiv.clientWidth&&e._setTimeBarTime(i,i*e._timeBarSecondsSpan/e._topDiv.clientWidth))):e._touchMode===fc.slideZoom&&(o=t.touches.length,o===2?(r=(t.touches[0].clientX+t.touches[1].clientX)*.5-u,s=Math.abs(t.touches[0].clientX-t.touches[1].clientX)):o===1&&(r=t.touches[0].clientX-u,s=0),l(r)&&(s>0&&e._touchState.spanX>0?(c=e._touchState.spanX/s,a=ce.addSeconds(e._startJulian,(e._touchState.centerX*e._timeBarSecondsSpan-r*e._timeBarSecondsSpan*c)/e._topDiv.clientWidth,new ce)):(n=e._touchState.centerX-r,a=ce.addSeconds(e._startJulian,n*e._timeBarSecondsSpan/e._topDiv.clientWidth,new ce)),e.zoomTo(a,ce.addSeconds(a,e._timeBarSecondsSpan*c,new ce)),e._touchState.centerX=r,e._touchState.spanX=s))}}tc.prototype.resize=function(){const e=this.container.clientWidth,t=this.container.clientHeight;if(e===this._lastWidth&&t===this._lastHeight)return;this._trackContainer.style.height=`${t}px`;let n=1;this._trackList.forEach(function(i){n+=i.height}),this._trackListEle.style.height=`${n.toString()}px`,this._trackListEle.width=this._trackListEle.clientWidth,this._trackListEle.height=n,this._makeTics(),this._lastXPos=void 0,this._lastWidth=e,this._lastHeight=t};var Z0t={webm:"data:video/webm;base64,GkXfowEAAAAAAAAfQoaBAUL3gQFC8oEEQvOBCEKChHdlYm1Ch4EEQoWBAhhTgGcBAAAAAAAVkhFNm3RALE27i1OrhBVJqWZTrIHfTbuMU6uEFlSua1OsggEwTbuMU6uEHFO7a1OsghV17AEAAAAAAACkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmAQAAAAAAAEUq17GDD0JATYCNTGF2ZjU1LjMzLjEwMFdBjUxhdmY1NS4zMy4xMDBzpJBlrrXf3DCDVB8KcgbMpcr+RImIQJBgAAAAAAAWVK5rAQAAAAAAD++uAQAAAAAAADLXgQFzxYEBnIEAIrWcg3VuZIaFVl9WUDiDgQEj44OEAmJaAOABAAAAAAAABrCBsLqBkK4BAAAAAAAPq9eBAnPFgQKcgQAitZyDdW5khohBX1ZPUkJJU4OBAuEBAAAAAAAAEZ+BArWIQOdwAAAAAABiZIEgY6JPbwIeVgF2b3JiaXMAAAAAAoC7AAAAAAAAgLUBAAAAAAC4AQN2b3JiaXMtAAAAWGlwaC5PcmcgbGliVm9yYmlzIEkgMjAxMDExMDEgKFNjaGF1ZmVudWdnZXQpAQAAABUAAABlbmNvZGVyPUxhdmM1NS41Mi4xMDIBBXZvcmJpcyVCQ1YBAEAAACRzGCpGpXMWhBAaQlAZ4xxCzmvsGUJMEYIcMkxbyyVzkCGkoEKIWyiB0JBVAABAAACHQXgUhIpBCCGEJT1YkoMnPQghhIg5eBSEaUEIIYQQQgghhBBCCCGERTlokoMnQQgdhOMwOAyD5Tj4HIRFOVgQgydB6CCED0K4moOsOQghhCQ1SFCDBjnoHITCLCiKgsQwuBaEBDUojILkMMjUgwtCiJqDSTX4GoRnQXgWhGlBCCGEJEFIkIMGQcgYhEZBWJKDBjm4FITLQagahCo5CB+EIDRkFQCQAACgoiiKoigKEBqyCgDIAAAQQFEUx3EcyZEcybEcCwgNWQUAAAEACAAAoEiKpEiO5EiSJFmSJVmSJVmS5omqLMuyLMuyLMsyEBqyCgBIAABQUQxFcRQHCA1ZBQBkAAAIoDiKpViKpWiK54iOCISGrAIAgAAABAAAEDRDUzxHlETPVFXXtm3btm3btm3btm3btm1blmUZCA1ZBQBAAAAQ0mlmqQaIMAMZBkJDVgEACAAAgBGKMMSA0JBVAABAAACAGEoOogmtOd+c46BZDppKsTkdnEi1eZKbirk555xzzsnmnDHOOeecopxZDJoJrTnnnMSgWQqaCa0555wnsXnQmiqtOeeccc7pYJwRxjnnnCateZCajbU555wFrWmOmkuxOeecSLl5UptLtTnnnHPOOeecc84555zqxekcnBPOOeecqL25lpvQxTnnnE/G6d6cEM4555xzzjnnnHPOOeecIDRkFQAABABAEIaNYdwpCNLnaCBGEWIaMulB9+gwCRqDnELq0ehopJQ6CCWVcVJKJwgNWQUAAAIAQAghhRRSSCGFFFJIIYUUYoghhhhyyimnoIJKKqmooowyyyyzzDLLLLPMOuyssw47DDHEEEMrrcRSU2011lhr7jnnmoO0VlprrbVSSimllFIKQkNWAQAgAAAEQgYZZJBRSCGFFGKIKaeccgoqqIDQkFUAACAAgAAAAABP8hzRER3RER3RER3RER3R8RzPESVREiVREi3TMjXTU0VVdWXXlnVZt31b2IVd933d933d+HVhWJZlWZZlWZZlWZZlWZZlWZYgNGQVAAACAAAghBBCSCGFFFJIKcYYc8w56CSUEAgNWQUAAAIACAAAAHAUR3EcyZEcSbIkS9IkzdIsT/M0TxM9URRF0zRV0RVdUTdtUTZl0zVdUzZdVVZtV5ZtW7Z125dl2/d93/d93/d93/d93/d9XQdCQ1YBABIAADqSIymSIimS4ziOJElAaMgqAEAGAEAAAIriKI7jOJIkSZIlaZJneZaomZrpmZ4qqkBoyCoAABAAQAAAAAAAAIqmeIqpeIqoeI7oiJJomZaoqZoryqbsuq7ruq7ruq7ruq7ruq7ruq7ruq7ruq7ruq7ruq7ruq7ruq4LhIasAgAkAAB0JEdyJEdSJEVSJEdygNCQVQCADACAAAAcwzEkRXIsy9I0T/M0TxM90RM901NFV3SB0JBVAAAgAIAAAAAAAAAMybAUy9EcTRIl1VItVVMt1VJF1VNVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVN0zRNEwgNWQkAkAEAkBBTLS3GmgmLJGLSaqugYwxS7KWxSCpntbfKMYUYtV4ah5RREHupJGOKQcwtpNApJq3WVEKFFKSYYyoVUg5SIDRkhQAQmgHgcBxAsixAsiwAAAAAAAAAkDQN0DwPsDQPAAAAAAAAACRNAyxPAzTPAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABA0jRA8zxA8zwAAAAAAAAA0DwP8DwR8EQRAAAAAAAAACzPAzTRAzxRBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABA0jRA8zxA8zwAAAAAAAAAsDwP8EQR0DwRAAAAAAAAACzPAzxRBDzRAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAEOAAABBgIRQasiIAiBMAcEgSJAmSBM0DSJYFTYOmwTQBkmVB06BpME0AAAAAAAAAAAAAJE2DpkHTIIoASdOgadA0iCIAAAAAAAAAAAAAkqZB06BpEEWApGnQNGgaRBEAAAAAAAAAAAAAzzQhihBFmCbAM02IIkQRpgkAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAGHAAAAgwoQwUGrIiAIgTAHA4imUBAIDjOJYFAACO41gWAABYliWKAABgWZooAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAYcAAACDChDBQashIAiAIAcCiKZQHHsSzgOJYFJMmyAJYF0DyApgFEEQAIAAAocAAACLBBU2JxgEJDVgIAUQAABsWxLE0TRZKkaZoniiRJ0zxPFGma53meacLzPM80IYqiaJoQRVE0TZimaaoqME1VFQAAUOAAABBgg6bE4gCFhqwEAEICAByKYlma5nmeJ4qmqZokSdM8TxRF0TRNU1VJkqZ5niiKommapqqyLE3zPFEURdNUVVWFpnmeKIqiaaqq6sLzPE8URdE0VdV14XmeJ4qiaJqq6roQRVE0TdNUTVV1XSCKpmmaqqqqrgtETxRNU1Vd13WB54miaaqqq7ouEE3TVFVVdV1ZBpimaaqq68oyQFVV1XVdV5YBqqqqruu6sgxQVdd1XVmWZQCu67qyLMsCAAAOHAAAAoygk4wqi7DRhAsPQKEhKwKAKAAAwBimFFPKMCYhpBAaxiSEFEImJaXSUqogpFJSKRWEVEoqJaOUUmopVRBSKamUCkIqJZVSAADYgQMA2IGFUGjISgAgDwCAMEYpxhhzTiKkFGPOOScRUoox55yTSjHmnHPOSSkZc8w556SUzjnnnHNSSuacc845KaVzzjnnnJRSSuecc05KKSWEzkEnpZTSOeecEwAAVOAAABBgo8jmBCNBhYasBABSAQAMjmNZmuZ5omialiRpmud5niiapiZJmuZ5nieKqsnzPE8URdE0VZXneZ4oiqJpqirXFUXTNE1VVV2yLIqmaZqq6rowTdNUVdd1XZimaaqq67oubFtVVdV1ZRm2raqq6rqyDFzXdWXZloEsu67s2rIAAPAEBwCgAhtWRzgpGgssNGQlAJABAEAYg5BCCCFlEEIKIYSUUggJAAAYcAAACDChDBQashIASAUAAIyx1lprrbXWQGettdZaa62AzFprrbXWWmuttdZaa6211lJrrbXWWmuttdZaa6211lprrbXWWmuttdZaa6211lprrbXWWmuttdZaa6211lprrbXWWmstpZRSSimllFJKKaWUUkoppZRSSgUA+lU4APg/2LA6wknRWGChISsBgHAAAMAYpRhzDEIppVQIMeacdFRai7FCiDHnJKTUWmzFc85BKCGV1mIsnnMOQikpxVZjUSmEUlJKLbZYi0qho5JSSq3VWIwxqaTWWoutxmKMSSm01FqLMRYjbE2ptdhqq7EYY2sqLbQYY4zFCF9kbC2m2moNxggjWywt1VprMMYY3VuLpbaaizE++NpSLDHWXAAAd4MDAESCjTOsJJ0VjgYXGrISAAgJACAQUooxxhhzzjnnpFKMOeaccw5CCKFUijHGnHMOQgghlIwx5pxzEEIIIYRSSsaccxBCCCGEkFLqnHMQQgghhBBKKZ1zDkIIIYQQQimlgxBCCCGEEEoopaQUQgghhBBCCKmklEIIIYRSQighlZRSCCGEEEIpJaSUUgohhFJCCKGElFJKKYUQQgillJJSSimlEkoJJYQSUikppRRKCCGUUkpKKaVUSgmhhBJKKSWllFJKIYQQSikFAAAcOAAABBhBJxlVFmGjCRcegEJDVgIAZAAAkKKUUiktRYIipRikGEtGFXNQWoqocgxSzalSziDmJJaIMYSUk1Qy5hRCDELqHHVMKQYtlRhCxhik2HJLoXMOAAAAQQCAgJAAAAMEBTMAwOAA4XMQdAIERxsAgCBEZohEw0JweFAJEBFTAUBigkIuAFRYXKRdXECXAS7o4q4DIQQhCEEsDqCABByccMMTb3jCDU7QKSp1IAAAAAAADADwAACQXAAREdHMYWRobHB0eHyAhIiMkAgAAAAAABcAfAAAJCVAREQ0cxgZGhscHR4fICEiIyQBAIAAAgAAAAAggAAEBAQAAAAAAAIAAAAEBB9DtnUBAAAAAAAEPueBAKOFggAAgACjzoEAA4BwBwCdASqwAJAAAEcIhYWIhYSIAgIABhwJ7kPfbJyHvtk5D32ych77ZOQ99snIe+2TkPfbJyHvtk5D32ych77ZOQ99YAD+/6tQgKOFggADgAqjhYIAD4AOo4WCACSADqOZgQArADECAAEQEAAYABhYL/QACIBDmAYAAKOFggA6gA6jhYIAT4AOo5mBAFMAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCAGSADqOFggB6gA6jmYEAewAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYIAj4AOo5mBAKMAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCAKSADqOFggC6gA6jmYEAywAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYIAz4AOo4WCAOSADqOZgQDzADECAAEQEAAYABhYL/QACIBDmAYAAKOFggD6gA6jhYIBD4AOo5iBARsAEQIAARAQFGAAYWC/0AAiAQ5gGACjhYIBJIAOo4WCATqADqOZgQFDADECAAEQEAAYABhYL/QACIBDmAYAAKOFggFPgA6jhYIBZIAOo5mBAWsAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCAXqADqOFggGPgA6jmYEBkwAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYIBpIAOo4WCAbqADqOZgQG7ADECAAEQEAAYABhYL/QACIBDmAYAAKOFggHPgA6jmYEB4wAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYIB5IAOo4WCAfqADqOZgQILADECAAEQEAAYABhYL/QACIBDmAYAAKOFggIPgA6jhYICJIAOo5mBAjMAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCAjqADqOFggJPgA6jmYECWwAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYICZIAOo4WCAnqADqOZgQKDADECAAEQEAAYABhYL/QACIBDmAYAAKOFggKPgA6jhYICpIAOo5mBAqsAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCArqADqOFggLPgA6jmIEC0wARAgABEBAUYABhYL/QACIBDmAYAKOFggLkgA6jhYIC+oAOo5mBAvsAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCAw+ADqOZgQMjADECAAEQEAAYABhYL/QACIBDmAYAAKOFggMkgA6jhYIDOoAOo5mBA0sAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCA0+ADqOFggNkgA6jmYEDcwAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYIDeoAOo4WCA4+ADqOZgQObADECAAEQEAAYABhYL/QACIBDmAYAAKOFggOkgA6jhYIDuoAOo5mBA8MAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCA8+ADqOFggPkgA6jhYID+oAOo4WCBA+ADhxTu2sBAAAAAAAAEbuPs4EDt4r3gQHxghEr8IEK",mp4:"data:video/mp4;base64,AAAAHGZ0eXBNNFYgAAACAGlzb21pc28yYXZjMQAAAAhmcmVlAAAGF21kYXTeBAAAbGliZmFhYyAxLjI4AABCAJMgBDIARwAAArEGBf//rdxF6b3m2Ui3lizYINkj7u94MjY0IC0gY29yZSAxNDIgcjIgOTU2YzhkOCAtIEguMjY0L01QRUctNCBBVkMgY29kZWMgLSBDb3B5bGVmdCAyMDAzLTIwMTQgLSBodHRwOi8vd3d3LnZpZGVvbGFuLm9yZy94MjY0Lmh0bWwgLSBvcHRpb25zOiBjYWJhYz0wIHJlZj0zIGRlYmxvY2s9MTowOjAgYW5hbHlzZT0weDE6MHgxMTEgbWU9aGV4IHN1Ym1lPTcgcHN5PTEgcHN5X3JkPTEuMDA6MC4wMCBtaXhlZF9yZWY9MSBtZV9yYW5nZT0xNiBjaHJvbWFfbWU9MSB0cmVsbGlzPTEgOHg4ZGN0PTAgY3FtPTAgZGVhZHpvbmU9MjEsMTEgZmFzdF9wc2tpcD0xIGNocm9tYV9xcF9vZmZzZXQ9LTIgdGhyZWFkcz02IGxvb2thaGVhZF90aHJlYWRzPTEgc2xpY2VkX3RocmVhZHM9MCBucj0wIGRlY2ltYXRlPTEgaW50ZXJsYWNlZD0wIGJsdXJheV9jb21wYXQ9MCBjb25zdHJhaW5lZF9pbnRyYT0wIGJmcmFtZXM9MCB3ZWlnaHRwPTAga2V5aW50PTI1MCBrZXlpbnRfbWluPTI1IHNjZW5lY3V0PTQwIGludHJhX3JlZnJlc2g9MCByY19sb29rYWhlYWQ9NDAgcmM9Y3JmIG1idHJlZT0xIGNyZj0yMy4wIHFjb21wPTAuNjAgcXBtaW49MCBxcG1heD02OSBxcHN0ZXA9NCB2YnZfbWF4cmF0ZT03NjggdmJ2X2J1ZnNpemU9MzAwMCBjcmZfbWF4PTAuMCBuYWxfaHJkPW5vbmUgZmlsbGVyPTAgaXBfcmF0aW89MS40MCBhcT0xOjEuMDAAgAAAAFZliIQL8mKAAKvMnJycnJycnJycnXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXiEASZACGQAjgCEASZACGQAjgAAAAAdBmjgX4GSAIQBJkAIZACOAAAAAB0GaVAX4GSAhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZpgL8DJIQBJkAIZACOAIQBJkAIZACOAAAAABkGagC/AySEASZACGQAjgAAAAAZBmqAvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZrAL8DJIQBJkAIZACOAAAAABkGa4C/AySEASZACGQAjgCEASZACGQAjgAAAAAZBmwAvwMkhAEmQAhkAI4AAAAAGQZsgL8DJIQBJkAIZACOAIQBJkAIZACOAAAAABkGbQC/AySEASZACGQAjgCEASZACGQAjgAAAAAZBm2AvwMkhAEmQAhkAI4AAAAAGQZuAL8DJIQBJkAIZACOAIQBJkAIZACOAAAAABkGboC/AySEASZACGQAjgAAAAAZBm8AvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZvgL8DJIQBJkAIZACOAAAAABkGaAC/AySEASZACGQAjgCEASZACGQAjgAAAAAZBmiAvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZpAL8DJIQBJkAIZACOAAAAABkGaYC/AySEASZACGQAjgCEASZACGQAjgAAAAAZBmoAvwMkhAEmQAhkAI4AAAAAGQZqgL8DJIQBJkAIZACOAIQBJkAIZACOAAAAABkGawC/AySEASZACGQAjgAAAAAZBmuAvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZsAL8DJIQBJkAIZACOAAAAABkGbIC/AySEASZACGQAjgCEASZACGQAjgAAAAAZBm0AvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZtgL8DJIQBJkAIZACOAAAAABkGbgCvAySEASZACGQAjgCEASZACGQAjgAAAAAZBm6AnwMkhAEmQAhkAI4AhAEmQAhkAI4AhAEmQAhkAI4AhAEmQAhkAI4AAAAhubW9vdgAAAGxtdmhkAAAAAAAAAAAAAAAAAAAD6AAABDcAAQAAAQAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAzB0cmFrAAAAXHRraGQAAAADAAAAAAAAAAAAAAABAAAAAAAAA+kAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAABAAAAAALAAAACQAAAAAAAkZWR0cwAAABxlbHN0AAAAAAAAAAEAAAPpAAAAAAABAAAAAAKobWRpYQAAACBtZGhkAAAAAAAAAAAAAAAAAAB1MAAAdU5VxAAAAAAALWhkbHIAAAAAAAAAAHZpZGUAAAAAAAAAAAAAAABWaWRlb0hhbmRsZXIAAAACU21pbmYAAAAUdm1oZAAAAAEAAAAAAAAAAAAAACRkaW5mAAAAHGRyZWYAAAAAAAAAAQAAAAx1cmwgAAAAAQAAAhNzdGJsAAAAr3N0c2QAAAAAAAAAAQAAAJ9hdmMxAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAALAAkABIAAAASAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGP//AAAALWF2Y0MBQsAN/+EAFWdCwA3ZAsTsBEAAAPpAADqYA8UKkgEABWjLg8sgAAAAHHV1aWRraEDyXyRPxbo5pRvPAyPzAAAAAAAAABhzdHRzAAAAAAAAAAEAAAAeAAAD6QAAABRzdHNzAAAAAAAAAAEAAAABAAAAHHN0c2MAAAAAAAAAAQAAAAEAAAABAAAAAQAAAIxzdHN6AAAAAAAAAAAAAAAeAAADDwAAAAsAAAALAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAAiHN0Y28AAAAAAAAAHgAAAEYAAANnAAADewAAA5gAAAO0AAADxwAAA+MAAAP2AAAEEgAABCUAAARBAAAEXQAABHAAAASMAAAEnwAABLsAAATOAAAE6gAABQYAAAUZAAAFNQAABUgAAAVkAAAFdwAABZMAAAWmAAAFwgAABd4AAAXxAAAGDQAABGh0cmFrAAAAXHRraGQAAAADAAAAAAAAAAAAAAACAAAAAAAABDcAAAAAAAAAAAAAAAEBAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAkZWR0cwAAABxlbHN0AAAAAAAAAAEAAAQkAAADcAABAAAAAAPgbWRpYQAAACBtZGhkAAAAAAAAAAAAAAAAAAC7gAAAykBVxAAAAAAALWhkbHIAAAAAAAAAAHNvdW4AAAAAAAAAAAAAAABTb3VuZEhhbmRsZXIAAAADi21pbmYAAAAQc21oZAAAAAAAAAAAAAAAJGRpbmYAAAAcZHJlZgAAAAAAAAABAAAADHVybCAAAAABAAADT3N0YmwAAABnc3RzZAAAAAAAAAABAAAAV21wNGEAAAAAAAAAAQAAAAAAAAAAAAIAEAAAAAC7gAAAAAAAM2VzZHMAAAAAA4CAgCIAAgAEgICAFEAVBbjYAAu4AAAADcoFgICAAhGQBoCAgAECAAAAIHN0dHMAAAAAAAAAAgAAADIAAAQAAAAAAQAAAkAAAAFUc3RzYwAAAAAAAAAbAAAAAQAAAAEAAAABAAAAAgAAAAIAAAABAAAAAwAAAAEAAAABAAAABAAAAAIAAAABAAAABgAAAAEAAAABAAAABwAAAAIAAAABAAAACAAAAAEAAAABAAAACQAAAAIAAAABAAAACgAAAAEAAAABAAAACwAAAAIAAAABAAAADQAAAAEAAAABAAAADgAAAAIAAAABAAAADwAAAAEAAAABAAAAEAAAAAIAAAABAAAAEQAAAAEAAAABAAAAEgAAAAIAAAABAAAAFAAAAAEAAAABAAAAFQAAAAIAAAABAAAAFgAAAAEAAAABAAAAFwAAAAIAAAABAAAAGAAAAAEAAAABAAAAGQAAAAIAAAABAAAAGgAAAAEAAAABAAAAGwAAAAIAAAABAAAAHQAAAAEAAAABAAAAHgAAAAIAAAABAAAAHwAAAAQAAAABAAAA4HN0c3oAAAAAAAAAAAAAADMAAAAaAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAACMc3RjbwAAAAAAAAAfAAAALAAAA1UAAANyAAADhgAAA6IAAAO+AAAD0QAAA+0AAAQAAAAEHAAABC8AAARLAAAEZwAABHoAAASWAAAEqQAABMUAAATYAAAE9AAABRAAAAUjAAAFPwAABVIAAAVuAAAFgQAABZ0AAAWwAAAFzAAABegAAAX7AAAGFwAAAGJ1ZHRhAAAAWm1ldGEAAAAAAAAAIWhkbHIAAAAAAAAAAG1kaXJhcHBsAAAAAAAAAAAAAAAALWlsc3QAAAAlqXRvbwAAAB1kYXRhAAAAAQAAAABMYXZmNTUuMzMuMTAw"};const{webm:eAt,mp4:tAt}=Z0t,nM=()=>typeof navigator<"u"&&parseFloat((""+(/CPU.*OS ([0-9_]{3,4})[0-9_]{0,1}|(CPU like).*AppleWebKit.*Mobile/i.exec(navigator.userAgent)||[0,""])[1]).replace("undefined","3_2").replace("_",".").replace("_",""))<10&&!window.MSStream,iM=()=>"wakeLock"in navigator;class nAt{constructor(){if(this.enabled=!1,iM()){this._wakeLock=null;const t=()=>{this._wakeLock!==null&&document.visibilityState==="visible"&&this.enable()};document.addEventListener("visibilitychange",t),document.addEventListener("fullscreenchange",t)}else nM()?this.noSleepTimer=null:(this.noSleepVideo=document.createElement("video"),this.noSleepVideo.setAttribute("title","No Sleep"),this.noSleepVideo.setAttribute("playsinline",""),this._addSourceToVideo(this.noSleepVideo,"webm",eAt),this._addSourceToVideo(this.noSleepVideo,"mp4",tAt),this.noSleepVideo.addEventListener("loadedmetadata",()=>{this.noSleepVideo.duration<=1?this.noSleepVideo.setAttribute("loop",""):this.noSleepVideo.addEventListener("timeupdate",()=>{this.noSleepVideo.currentTime>.5&&(this.noSleepVideo.currentTime=Math.random())})}))}_addSourceToVideo(t,n,i){var o=document.createElement("source");o.src=i,o.type=`video/${n}`,t.appendChild(o)}get isEnabled(){return this.enabled}enable(){return iM()?navigator.wakeLock.request("screen").then(t=>{this._wakeLock=t,this.enabled=!0,console.log("Wake Lock active."),this._wakeLock.addEventListener("release",()=>{console.log("Wake Lock released.")})}).catch(t=>{throw this.enabled=!1,console.error(`${t.name}, ${t.message}`),t}):nM()?(this.disable(),console.warn(`
|
||
NoSleep enabled for older iOS devices. This can interrupt
|
||
active or long-running network requests from completing successfully.
|
||
See https://github.com/richtr/NoSleep.js/issues/15 for more details.
|
||
`),this.noSleepTimer=window.setInterval(()=>{document.hidden||(window.location.href=window.location.href.split("#")[0],window.setTimeout(window.stop,0))},15e3),this.enabled=!0,Promise.resolve()):this.noSleepVideo.play().then(n=>(this.enabled=!0,n)).catch(n=>{throw this.enabled=!1,n})}disable(){iM()?(this._wakeLock&&this._wakeLock.release(),this._wakeLock=null):nM()?this.noSleepTimer&&(console.warn(`
|
||
NoSleep now disabled for older iOS devices.
|
||
`),window.clearInterval(this.noSleepTimer),this.noSleepTimer=null):this.noSleepVideo.pause(),this.enabled=!1}}var iAt=nAt;function oAt(e){let t=!1;const n=window.screen;return l(n)&&(l(n.lockOrientation)?t=n.lockOrientation(e):l(n.mozLockOrientation)?t=n.mozLockOrientation(e):l(n.msLockOrientation)?t=n.msLockOrientation(e):l(n.orientation&&n.orientation.lock)&&(t=n.orientation.lock(e))),t}function Pae(){const e=window.screen;l(e)&&(l(e.unlockOrientation)?e.unlockOrientation():l(e.mozUnlockOrientation)?e.mozUnlockOrientation():l(e.msUnlockOrientation)?e.msUnlockOrientation():l(e.orientation&&e.orientation.unlock)&&e.orientation.unlock())}function rAt(e,t,n,i){i()||(n()?(t.useWebVR=!1,e._locked&&(Pae(),e._locked=!1),e._noSleep.disable(),zs.exitFullscreen(),n(!1)):(zs.fullscreen||zs.requestFullscreen(e._vrElement),e._noSleep.enable(),e._locked||(e._locked=oAt("landscape")),t.useWebVR=!0,n(!0)))}function tO(e,t){if(!l(e))throw new w("scene is required.");const n=this,i=_t.observable(zs.enabled),o=_t.observable(!1);this.isVRMode=void 0,_t.defineProperty(this,"isVRMode",{get:function(){return o()}}),this.isVREnabled=void 0,_t.defineProperty(this,"isVREnabled",{get:function(){return i()},set:function(s){i(s&&zs.enabled)}}),this.tooltip=void 0,_t.defineProperty(this,"tooltip",function(){return i()?o()?"Exit VR mode":"Enter VR mode":"VR mode is unavailable"});const r=_t.observable(!1);this._isOrthographic=void 0,_t.defineProperty(this,"_isOrthographic",{get:function(){return r()}}),this._eventHelper=new Yd,this._eventHelper.add(e.preRender,function(){r(e.camera.frustum instanceof nn)}),this._locked=!1,this._noSleep=new iAt,this._command=zr(function(){rAt(n,e,o,r)},_t.getObservable(this,"isVREnabled")),this._vrElement=A(Zr(t),document.body),this._callback=function(){!zs.fullscreen&&o()&&(e.useWebVR=!1,n._locked&&(Pae(),n._locked=!1),n._noSleep.disable(),o(!1))},document.addEventListener(zs.changeEventName,this._callback)}Object.defineProperties(tO.prototype,{vrElement:{get:function(){return this._vrElement},set:function(e){if(!(e instanceof Element))throw new w("value must be a valid Element.");this._vrElement=e}},command:{get:function(){return this._command}}});tO.prototype.isDestroyed=function(){return!1};tO.prototype.destroy=function(){this._eventHelper.removeAll(),document.removeEventListener(zs.changeEventName,this._callback),Je(this)};const sAt="M 5.3125 6.375 C 4.008126 6.375 2.96875 7.4141499 2.96875 8.71875 L 2.96875 19.5 C 2.96875 20.8043 4.008126 21.875 5.3125 21.875 L 13.65625 21.875 C 13.71832 20.0547 14.845166 18.59375 16.21875 18.59375 C 17.592088 18.59375 18.71881 20.0552 18.78125 21.875 L 27.09375 21.875 C 28.398125 21.875 29.4375 20.8043 29.4375 19.5 L 29.4375 8.71875 C 29.4375 7.4141499 28.398125 6.375 27.09375 6.375 L 5.3125 6.375 z M 9.625 10.4375 C 11.55989 10.4375 13.125 12.03385 13.125 13.96875 C 13.125 15.90365 11.55989 17.46875 9.625 17.46875 C 7.69011 17.46875 6.125 15.90365 6.125 13.96875 C 6.125 12.03385 7.69011 10.4375 9.625 10.4375 z M 22.46875 10.4375 C 24.40364 10.4375 25.96875 12.03385 25.96875 13.96875 C 25.96875 15.90365 24.40364 17.46875 22.46875 17.46875 C 20.53386 17.46875 18.96875 15.90365 18.96875 13.96875 C 18.96875 12.03385 20.53386 10.4375 22.46875 10.4375 z",aAt="M 25.770585,2.4552065 C 15.72282,13.962707 10.699956,19.704407 8.1768352,22.580207 c -1.261561,1.4379 -1.902282,2.1427 -2.21875,2.5 -0.141624,0.1599 -0.208984,0.2355 -0.25,0.2813 l 0.6875,0.75 c 10e-5,-10e-5 0.679191,0.727 0.6875,0.7187 0.01662,-0.016 0.02451,-0.024 0.03125,-0.031 0.01348,-0.014 0.04013,-0.038 0.0625,-0.062 0.04474,-0.05 0.120921,-0.1315 0.28125,-0.3126 0.320657,-0.3619 0.956139,-1.0921 2.2187499,-2.5312 2.5252219,-2.8781 7.5454589,-8.6169 17.5937499,-20.1250005 l -1.5,-1.3125 z m -20.5624998,3.9063 c -1.304375,0 -2.34375,1.0391 -2.34375,2.3437 l 0,10.8125005 c 0,1.3043 1.039375,2.375 2.34375,2.375 l 2.25,0 c 1.9518039,-2.2246 7.4710958,-8.5584 13.5624998,-15.5312005 l -15.8124998,0 z m 21.1249998,0 c -1.855467,2.1245 -2.114296,2.4005 -3.59375,4.0936995 1.767282,0.1815 3.15625,1.685301 3.15625,3.500001 0,1.9349 -1.56511,3.5 -3.5,3.5 -1.658043,0 -3.043426,-1.1411 -3.40625,-2.6875 -1.089617,1.2461 -2.647139,2.9988 -3.46875,3.9375 0.191501,-0.062 0.388502,-0.094 0.59375,-0.094 1.373338,0 2.50006,1.4614 2.5625,3.2812 l 8.3125,0 c 1.304375,0 2.34375,-1.0707 2.34375,-2.375 l 0,-10.8125005 c 0,-1.3046 -1.039375,-2.3437 -2.34375,-2.3437 l -0.65625,0 z M 9.5518351,10.423906 c 1.9348899,0 3.4999999,1.596401 3.4999999,3.531301 0,1.9349 -1.56511,3.5 -3.4999999,3.5 -1.9348899,0 -3.4999999,-1.5651 -3.4999999,-3.5 0,-1.9349 1.56511,-3.531301 3.4999999,-3.531301 z m 4.2187499,10.312601 c -0.206517,0.2356 -0.844218,0.9428 -1.03125,1.1562 l 0.8125,0 c 0.01392,-0.4081 0.107026,-0.7968 0.21875,-1.1562 z";function nO(e,t,n){if(!l(e))throw new w("container is required.");if(!l(t))throw new w("scene is required.");e=Zr(e);const i=new tO(t,n);i._exitVRPath=aAt,i._enterVRPath=sAt;const o=document.createElement("button");o.type="button",o.className="cesium-button cesium-vrButton",o.setAttribute("data-bind",'css: { "cesium-button-disabled" : _isOrthographic }, attr: { title: tooltip },click: command,enable: isVREnabled,cesiumSvgPath: { path: isVRMode ? _exitVRPath : _enterVRPath, width: 32, height: 32 }'),e.appendChild(o),_t.applyBindings(i,o),this._container=e,this._viewModel=i,this._element=o}Object.defineProperties(nO.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}});nO.prototype.isDestroyed=function(){return!1};nO.prototype.destroy=function(){return this._viewModel.destroy(),_t.cleanNode(this._element),this._container.removeChild(this._element),Je(this)};const Pm=new Ae;function Oae(e){const t=e.clock;t.currentTime=e.timeJulian,t.shouldAnimate=!1}function cAt(e){const t=e.getPropertyIds();let n="";return t.forEach(function(i){const o=e.getProperty(i);l(o)&&(n+=`<tr><th>${i}</th><td>${o}</td></tr>`)}),n.length>0&&(n=`<table class="cesium-infoBox-defaultTable"><tbody>${n}</tbody></table>`),n}function lAt(e){let t;const n=[],i=e.getPropertyIds();for(t=0;t<i.length;t++){const r=i[t];/^name$/i.test(r)?n[0]=e.getProperty(r):/name/i.test(r)?n[1]=e.getProperty(r):/^title$/i.test(r)?n[2]=e.getProperty(r):/^(id|identifier)$/i.test(r)?n[3]=e.getProperty(r):/element/i.test(r)?n[4]=e.getProperty(r):/(id|identifier)$/i.test(r)&&(n[5]=e.getProperty(r))}const o=n.length;for(t=0;t<o;t++){const r=n[t];if(l(r)&&r!=="")return r}return"Unnamed Feature"}function Y7(e,t){const n=e.scene.pick(t.position);if(l(n)){const i=A(n.id,n.primitive.id);if(i instanceof hs)return i;if(n instanceof Js)return new hs({name:lAt(n),description:cAt(n),feature:n})}if(l(e.scene.globe))return dAt(e,t.position)}const uAt=new ce;function Lae(e,t,n){if(l(n)){const i=n.clock;if(l(i)&&(i.getValue(t),l(e))){const o=i.startTime;let r=i.stopTime;ce.equals(o,r)&&(r=ce.addSeconds(o,F.EPSILON2,uAt)),e.updateFromClock(),e.zoomTo(o,r)}}}const fAt=new d;function dAt(e,t){const n=e.scene,i=n.camera.getPickRay(t),o=n.imageryLayers.pickImageryLayerFeatures(i,n);if(!l(o))return;const r=new hs({id:"Loading...",description:"Loading feature information..."});return o.then(function(s){if(e.selectedEntity!==r)return;if(!l(s)||s.length===0){e.selectedEntity=$7();return}const a=s[0],c=new hs({id:a.name,description:a.description});if(l(a.position)){const u=e.scene.globe.ellipsoid.cartographicToCartesian(a.position,fAt);c.position=new ep(u)}e.selectedEntity=c},function(){e.selectedEntity===r&&(e.selectedEntity=$7())}),r}function $7(){return new hs({id:"None",description:"No features found."})}function hAt(e,t){const n=e._geocoder,i=e._homeButton,o=e._sceneModePicker,r=e._projectionPicker,s=e._baseLayerPicker,a=e._animation,c=e._timeline,u=e._fullscreenButton,f=e._infoBox,h=e._selectionIndicator,_=t?"hidden":"visible";if(l(n)&&(n.container.style.visibility=_),l(i)&&(i.container.style.visibility=_),l(o)&&(o.container.style.visibility=_),l(r)&&(r.container.style.visibility=_),l(s)&&(s.container.style.visibility=_),l(a)&&(a.container.style.visibility=_),l(c)&&(c.container.style.visibility=_),l(u)&&u.viewModel.isFullscreenEnabled&&(u.container.style.visibility=_),l(f)&&(f.container.style.visibility=_),l(h)&&(h.container.style.visibility=_),e._container){const g=t||!l(u)?0:u.container.clientWidth;e._vrButton.container.style.right=`${g}px`,e.forceResize()}}function xi(e,t){if(!l(e))throw new w("container is required.");e=Zr(e),t=A(t,A.EMPTY_OBJECT);const n=(!l(t.globe)||t.globe!==!1)&&(!l(t.baseLayerPicker)||t.baseLayerPicker!==!1);if(!n&&l(t.selectedImageryProviderViewModel))throw new w("options.selectedImageryProviderViewModel is not available when not using the BaseLayerPicker widget. Either specify options.imageryProvider instead or set options.baseLayerPicker to true.");if(!n&&l(t.selectedTerrainProviderViewModel))throw new w("options.selectedTerrainProviderViewModel is not available when not using the BaseLayerPicker widget. Either specify options.terrainProvider instead or set options.baseLayerPicker to true.");const i=this,o=document.createElement("div");o.className="cesium-viewer",e.appendChild(o);const r=document.createElement("div");r.className="cesium-viewer-cesiumWidgetContainer",o.appendChild(r);const s=document.createElement("div");s.className="cesium-viewer-bottom",o.appendChild(s);const a=A(t.scene3DOnly,!1);let c,u,f=!1;l(t.clockViewModel)?(u=t.clockViewModel,c=u.clock):(c=new Ax,u=new tw(c),f=!0),l(t.shouldAnimate)&&(c.shouldAnimate=t.shouldAnimate);const h=new Vy(r,{imageryProvider:n||l(t.imageryProvider)?!1:void 0,clock:c,skyBox:t.skyBox,skyAtmosphere:t.skyAtmosphere,sceneMode:t.sceneMode,mapProjection:t.mapProjection,globe:t.globe,orderIndependentTranslucency:t.orderIndependentTranslucency,contextOptions:t.contextOptions,useDefaultRenderLoop:t.useDefaultRenderLoop,targetFrameRate:t.targetFrameRate,showRenderLoopErrors:t.showRenderLoopErrors,useBrowserRecommendedResolution:t.useBrowserRecommendedResolution,creditContainer:l(t.creditContainer)?t.creditContainer:s,creditViewport:t.creditViewport,scene3DOnly:a,shadows:t.shadows,terrainShadows:t.terrainShadows,mapMode2D:t.mapMode2D,blurActiveElementOnCanvasFocus:t.blurActiveElementOnCanvasFocus,requestRenderMode:t.requestRenderMode,maximumRenderTimeChange:t.maximumRenderTimeChange,depthPlaneEllipsoidOffset:t.depthPlaneEllipsoidOffset,msaaSamples:t.msaaSamples});let _=t.dataSources,g=!1;l(_)||(_=new Ec,g=!0);const p=h.scene,y=new Du({scene:p,dataSourceCollection:_}),T=new Yd;T.add(c.onTick,xi.prototype._onTick,this),T.add(p.morphStart,xi.prototype._clearTrackedObject,this);let b;if(!l(t.selectionIndicator)||t.selectionIndicator!==!1){const K=document.createElement("div");K.className="cesium-viewer-selectionIndicatorContainer",o.appendChild(K),b=new eO(K,p)}let x;if(!l(t.infoBox)||t.infoBox!==!1){const K=document.createElement("div");K.className="cesium-viewer-infoBoxContainer",o.appendChild(K),x=new $P(K);const se=x.viewModel;T.add(se.cameraClicked,xi.prototype._onInfoBoxCameraClicked,this),T.add(se.closeClicked,xi.prototype._onInfoBoxClockClicked,this)}const v=document.createElement("div");v.className="cesium-viewer-toolbar",o.appendChild(v);let D;if(!l(t.geocoder)||t.geocoder!==!1){const K=document.createElement("div");K.className="cesium-viewer-geocoderContainer",v.appendChild(K);let se;l(t.geocoder)&&typeof t.geocoder!="boolean"&&(se=Array.isArray(t.geocoder)?t.geocoder:[t.geocoder]),D=new jP({container:K,geocoderServices:se,scene:p}),T.add(D.viewModel.search.beforeExecute,xi.prototype._clearObjects,this)}let L;if((!l(t.homeButton)||t.homeButton!==!1)&&(L=new YP(v,p),l(D)&&T.add(L.viewModel.command.afterExecute,function(){const K=D.viewModel;K.searchText="",K.isSearchInProgress&&K.search()}),T.add(L.viewModel.command.beforeExecute,xi.prototype._clearTrackedObject,this)),t.sceneModePicker===!0&&a)throw new w("options.sceneModePicker is not available when options.scene3DOnly is set to true.");let B;!a&&(!l(t.sceneModePicker)||t.sceneModePicker!==!1)&&(B=new ZP(v,p));let V;t.projectionPicker&&(V=new JP(v,p));let M,H;if(n){const K=A(t.imageryProviderViewModels,x0t()),se=A(t.terrainProviderViewModels,w0t());M=new GP(v,{globe:p.globe,imageryProviderViewModels:K,selectedImageryProviderViewModel:t.selectedImageryProviderViewModel,terrainProviderViewModels:se,selectedTerrainProviderViewModel:t.selectedTerrainProviderViewModel}),H=v.getElementsByClassName("cesium-baseLayerPicker-dropDown")[0]}l(t.imageryProvider)&&t.imageryProvider!==!1&&(n&&(M.viewModel.selectedImagery=void 0),p.imageryLayers.removeAll(),p.imageryLayers.addImageryProvider(t.imageryProvider)),l(t.terrainProvider)&&(n&&(M.viewModel.selectedTerrain=void 0),p.terrainProvider=t.terrainProvider);let G;if(!l(t.navigationHelpButton)||t.navigationHelpButton!==!1){let K=!0;try{if(l(window.localStorage)){const se=window.localStorage.getItem("cesium-hasSeenNavHelp");l(se)&&Boolean(se)?K=!1:window.localStorage.setItem("cesium-hasSeenNavHelp","true")}}catch{}G=new XP({container:v,instructionsInitiallyVisible:A(t.navigationInstructionsInitiallyVisible,K)})}let I;if(!l(t.animation)||t.animation!==!1){const K=document.createElement("div");K.className="cesium-viewer-animationContainer",o.appendChild(K),I=new UT(K,new hu(u))}let O;if(!l(t.timeline)||t.timeline!==!1){const K=document.createElement("div");K.className="cesium-viewer-timelineContainer",o.appendChild(K),O=new tc(K,c),O.addEventListener("settime",Oae,!1),O.zoomTo(c.startTime,c.stopTime)}let m,P,R;(!l(t.fullscreenButton)||t.fullscreenButton!==!1)&&(R=document.createElement("div"),R.className="cesium-viewer-fullscreenContainer",o.appendChild(R),m=new qP(R,t.fullscreenElement),P=tu(m.viewModel,"isFullscreenEnabled",function(K){R.style.display=K?"block":"none",l(O)&&(O.container.style.right=`${R.clientWidth}px`,O.resize())}));let U,W,q;if(t.vrButton){const K=document.createElement("div");K.className="cesium-viewer-vrContainer",o.appendChild(K),U=new nO(K,p,t.fullScreenElement),W=tu(U.viewModel,"isVREnabled",function(se){K.style.display=se?"block":"none",l(m)&&(K.style.right=`${R.clientWidth}px`),l(O)&&(O.container.style.right=`${K.clientWidth}px`,O.resize())}),q=tu(U.viewModel,"isVRMode",function(se){hAt(i,se)})}this._baseLayerPickerDropDown=H,this._fullscreenSubscription=P,this._vrSubscription=W,this._vrModeSubscription=q,this._dataSourceChangedListeners={},this._automaticallyTrackDataSourceClocks=A(t.automaticallyTrackDataSourceClocks,!0),this._container=e,this._bottomContainer=s,this._element=o,this._cesiumWidget=h,this._selectionIndicator=b,this._infoBox=x,this._dataSourceCollection=_,this._destroyDataSourceCollection=g,this._dataSourceDisplay=y,this._clockViewModel=u,this._destroyClockViewModel=f,this._toolbar=v,this._homeButton=L,this._sceneModePicker=B,this._projectionPicker=V,this._baseLayerPicker=M,this._navigationHelpButton=G,this._animation=I,this._timeline=O,this._fullscreenButton=m,this._vrButton=U,this._geocoder=D,this._eventHelper=T,this._lastWidth=0,this._lastHeight=0,this._allowDataSourcesToSuspendAnimation=!0,this._entityView=void 0,this._enableInfoOrSelection=l(x)||l(b),this._clockTrackedDataSource=void 0,this._trackedEntity=void 0,this._needTrackedEntityUpdate=!1,this._selectedEntity=void 0,this._zoomIsFlight=!1,this._zoomTarget=void 0,this._zoomPromise=void 0,this._zoomOptions=void 0,this._selectedEntityChanged=new lt,this._trackedEntityChanged=new lt,_t.track(this,["_trackedEntity","_selectedEntity","_clockTrackedDataSource"]),T.add(_.dataSourceAdded,xi.prototype._onDataSourceAdded,this),T.add(_.dataSourceRemoved,xi.prototype._onDataSourceRemoved,this),T.add(p.postUpdate,xi.prototype.resize,this),T.add(p.postRender,xi.prototype._postRender,this);const Y=_.length;for(let K=0;K<Y;K++)this._dataSourceAdded(_,_.get(K));this._dataSourceAdded(void 0,y.defaultDataSource),T.add(_.dataSourceAdded,xi.prototype._dataSourceAdded,this),T.add(_.dataSourceRemoved,xi.prototype._dataSourceRemoved,this);function j(K){const se=Y7(i,K);l(se)?ie.getValueOrUndefined(se.position,i.clock.currentTime)?i.trackedEntity=se:i.zoomTo(se):l(i.trackedEntity)&&(i.trackedEntity=void 0)}function ee(K){i.selectedEntity=Y7(i,K)}h.screenSpaceEventHandler.setInputAction(ee,ai.LEFT_CLICK),h.screenSpaceEventHandler.setInputAction(j,ai.LEFT_DOUBLE_CLICK)}Object.defineProperties(xi.prototype,{container:{get:function(){return this._container}},bottomContainer:{get:function(){return this._bottomContainer}},cesiumWidget:{get:function(){return this._cesiumWidget}},selectionIndicator:{get:function(){return this._selectionIndicator}},infoBox:{get:function(){return this._infoBox}},geocoder:{get:function(){return this._geocoder}},homeButton:{get:function(){return this._homeButton}},sceneModePicker:{get:function(){return this._sceneModePicker}},projectionPicker:{get:function(){return this._projectionPicker}},baseLayerPicker:{get:function(){return this._baseLayerPicker}},navigationHelpButton:{get:function(){return this._navigationHelpButton}},animation:{get:function(){return this._animation}},timeline:{get:function(){return this._timeline}},fullscreenButton:{get:function(){return this._fullscreenButton}},vrButton:{get:function(){return this._vrButton}},dataSourceDisplay:{get:function(){return this._dataSourceDisplay}},entities:{get:function(){return this._dataSourceDisplay.defaultDataSource.entities}},dataSources:{get:function(){return this._dataSourceCollection}},canvas:{get:function(){return this._cesiumWidget.canvas}},scene:{get:function(){return this._cesiumWidget.scene}},shadows:{get:function(){return this.scene.shadowMap.enabled},set:function(e){this.scene.shadowMap.enabled=e}},terrainShadows:{get:function(){return this.scene.globe.shadows},set:function(e){this.scene.globe.shadows=e}},shadowMap:{get:function(){return this.scene.shadowMap}},imageryLayers:{get:function(){return this.scene.imageryLayers}},terrainProvider:{get:function(){return this.scene.terrainProvider},set:function(e){this.scene.terrainProvider=e}},camera:{get:function(){return this.scene.camera}},postProcessStages:{get:function(){return this.scene.postProcessStages}},clock:{get:function(){return this._clockViewModel.clock}},clockViewModel:{get:function(){return this._clockViewModel}},screenSpaceEventHandler:{get:function(){return this._cesiumWidget.screenSpaceEventHandler}},targetFrameRate:{get:function(){return this._cesiumWidget.targetFrameRate},set:function(e){this._cesiumWidget.targetFrameRate=e}},useDefaultRenderLoop:{get:function(){return this._cesiumWidget.useDefaultRenderLoop},set:function(e){this._cesiumWidget.useDefaultRenderLoop=e}},resolutionScale:{get:function(){return this._cesiumWidget.resolutionScale},set:function(e){this._cesiumWidget.resolutionScale=e}},useBrowserRecommendedResolution:{get:function(){return this._cesiumWidget.useBrowserRecommendedResolution},set:function(e){this._cesiumWidget.useBrowserRecommendedResolution=e}},allowDataSourcesToSuspendAnimation:{get:function(){return this._allowDataSourcesToSuspendAnimation},set:function(e){this._allowDataSourcesToSuspendAnimation=e}},trackedEntity:{get:function(){return this._trackedEntity},set:function(e){if(this._trackedEntity!==e){this._trackedEntity=e,A1(this);const t=this.scene,n=t.mode;!l(e)||!l(e.position)?(this._needTrackedEntityUpdate=!1,(n===me.COLUMBUS_VIEW||n===me.SCENE2D)&&(t.screenSpaceCameraController.enableTranslate=!0),(n===me.COLUMBUS_VIEW||n===me.SCENE3D)&&(t.screenSpaceCameraController.enableTilt=!0),this._entityView=void 0,this.camera.lookAtTransform(N.IDENTITY)):this._needTrackedEntityUpdate=!0,this._trackedEntityChanged.raiseEvent(e),this.scene.requestRender()}}},selectedEntity:{get:function(){return this._selectedEntity},set:function(e){if(this._selectedEntity!==e){this._selectedEntity=e;const t=l(this._selectionIndicator)?this._selectionIndicator.viewModel:void 0;l(e)?l(t)&&t.animateAppear():l(t)&&t.animateDepart(),this._selectedEntityChanged.raiseEvent(e)}}},selectedEntityChanged:{get:function(){return this._selectedEntityChanged}},trackedEntityChanged:{get:function(){return this._trackedEntityChanged}},clockTrackedDataSource:{get:function(){return this._clockTrackedDataSource},set:function(e){this._clockTrackedDataSource!==e&&(this._clockTrackedDataSource=e,Lae(this._timeline,this.clock,e))}}});xi.prototype.extend=function(e,t){if(!l(e))throw new w("mixin is required.");e(this,t)};xi.prototype.resize=function(){const e=this._cesiumWidget,t=this._container,n=t.clientWidth,i=t.clientHeight,o=l(this._animation),r=l(this._timeline);if(e.resize(),n===this._lastWidth&&i===this._lastHeight)return;const s=i-125,a=this._baseLayerPickerDropDown;if(l(a)&&(a.style.maxHeight=`${s}px`),l(this._geocoder)){const g=this._geocoder.searchSuggestionsContainer;g.style.maxHeight=`${s}px`}l(this._infoBox)&&(this._infoBox.viewModel.maxHeight=s);const c=this._timeline;let u,f=0,h=0,_=0;if(o&&window.getComputedStyle(this._animation.container).visibility!=="hidden"){const g=this._lastWidth;u=this._animation.container,n>900?(f=169,g<=900&&(u.style.width="169px",u.style.height="112px",this._animation.resize())):n>=600?(f=136,(g<600||g>900)&&(u.style.width="136px",u.style.height="90px",this._animation.resize())):(f=106,(g>600||g===0)&&(u.style.width="106px",u.style.height="70px",this._animation.resize())),h=f+5}if(r&&window.getComputedStyle(this._timeline.container).visibility!=="hidden"){const g=this._fullscreenButton,p=this._vrButton,y=c.container,T=y.style;_=y.clientHeight+3,T.left=`${f}px`;let b=0;l(g)&&(b+=g.container.clientWidth),l(p)&&(b+=p.container.clientWidth),T.right=`${b}px`,c.resize()}this._bottomContainer.style.left=`${h}px`,this._bottomContainer.style.bottom=`${_}px`,this._lastWidth=n,this._lastHeight=i};xi.prototype.forceResize=function(){this._lastWidth=0,this.resize()};xi.prototype.render=function(){this._cesiumWidget.render()};xi.prototype.isDestroyed=function(){return!1};xi.prototype.destroy=function(){let e;this.screenSpaceEventHandler.removeInputAction(ai.LEFT_CLICK),this.screenSpaceEventHandler.removeInputAction(ai.LEFT_DOUBLE_CLICK);const t=this.dataSources,n=t.length;for(e=0;e<n;e++)this._dataSourceRemoved(t,t.get(e));return this._dataSourceRemoved(void 0,this._dataSourceDisplay.defaultDataSource),this._container.removeChild(this._element),this._element.removeChild(this._toolbar),this._eventHelper.removeAll(),l(this._geocoder)&&(this._geocoder=this._geocoder.destroy()),l(this._homeButton)&&(this._homeButton=this._homeButton.destroy()),l(this._sceneModePicker)&&(this._sceneModePicker=this._sceneModePicker.destroy()),l(this._projectionPicker)&&(this._projectionPicker=this._projectionPicker.destroy()),l(this._baseLayerPicker)&&(this._baseLayerPicker=this._baseLayerPicker.destroy()),l(this._animation)&&(this._element.removeChild(this._animation.container),this._animation=this._animation.destroy()),l(this._timeline)&&(this._timeline.removeEventListener("settime",Oae,!1),this._element.removeChild(this._timeline.container),this._timeline=this._timeline.destroy()),l(this._fullscreenButton)&&(this._fullscreenSubscription.dispose(),this._element.removeChild(this._fullscreenButton.container),this._fullscreenButton=this._fullscreenButton.destroy()),l(this._vrButton)&&(this._vrSubscription.dispose(),this._vrModeSubscription.dispose(),this._element.removeChild(this._vrButton.container),this._vrButton=this._vrButton.destroy()),l(this._infoBox)&&(this._element.removeChild(this._infoBox.container),this._infoBox=this._infoBox.destroy()),l(this._selectionIndicator)&&(this._element.removeChild(this._selectionIndicator.container),this._selectionIndicator=this._selectionIndicator.destroy()),this._destroyClockViewModel&&(this._clockViewModel=this._clockViewModel.destroy()),this._dataSourceDisplay=this._dataSourceDisplay.destroy(),this._cesiumWidget=this._cesiumWidget.destroy(),this._destroyDataSourceCollection&&(this._dataSourceCollection=this._dataSourceCollection.destroy()),Je(this)};xi.prototype._dataSourceAdded=function(e,t){t.entities.collectionChanged.addEventListener(xi.prototype._onEntityCollectionChanged,this)};xi.prototype._dataSourceRemoved=function(e,t){const n=t.entities;n.collectionChanged.removeEventListener(xi.prototype._onEntityCollectionChanged,this),l(this.trackedEntity)&&n.getById(this.trackedEntity.id)===this.trackedEntity&&(this.trackedEntity=void 0),l(this.selectedEntity)&&n.getById(this.selectedEntity.id)===this.selectedEntity&&(this.selectedEntity=void 0)};xi.prototype._onTick=function(e){const t=e.currentTime,n=this._dataSourceDisplay.update(t);this._allowDataSourcesToSuspendAnimation&&(this._clockViewModel.canAnimate=n);const i=this._entityView;if(l(i)){const f=this._trackedEntity;this._dataSourceDisplay.getBoundingSphere(f,!1,Pm)===Ot.DONE&&i.update(t,Pm)}let o,r=!1;const s=this.selectedEntity,a=l(s)&&this._enableInfoOrSelection;a&&s.isShowing&&s.isAvailable(t)&&(this._dataSourceDisplay.getBoundingSphere(s,!0,Pm)!==Ot.FAILED?o=Pm.center:l(s.position)&&(o=s.position.getValue(t,o)),r=l(o));const c=l(this._selectionIndicator)?this._selectionIndicator.viewModel:void 0;l(c)&&(c.position=d.clone(o,c.position),c.showSelection=a&&r,c.update());const u=l(this._infoBox)?this._infoBox.viewModel:void 0;l(u)&&(u.showInfo=a,u.enableCamera=r,u.isCameraTracking=this.trackedEntity===this.selectedEntity,a?(u.titleText=A(s.name,s.id),u.description=ie.getValueOrDefault(s.description,t,"")):(u.titleText="",u.description=""))};xi.prototype._onEntityCollectionChanged=function(e,t,n){const i=n.length;for(let o=0;o<i;o++){const r=n[o];this.trackedEntity===r&&(this.trackedEntity=void 0),this.selectedEntity===r&&(this.selectedEntity=void 0)}};xi.prototype._onInfoBoxCameraClicked=function(e){if(e.isCameraTracking&&this.trackedEntity===this.selectedEntity)this.trackedEntity=void 0;else{const n=this.selectedEntity.position;l(n)?this.trackedEntity=this.selectedEntity:this.zoomTo(this.selectedEntity)}};xi.prototype._clearTrackedObject=function(){this.trackedEntity=void 0};xi.prototype._onInfoBoxClockClicked=function(e){this.selectedEntity=void 0};xi.prototype._clearObjects=function(){this.trackedEntity=void 0,this.selectedEntity=void 0};xi.prototype._onDataSourceChanged=function(e){this.clockTrackedDataSource===e&&Lae(this.timeline,this.clock,e)};xi.prototype._onDataSourceAdded=function(e,t){this._automaticallyTrackDataSourceClocks&&(this.clockTrackedDataSource=t);const n=t.entities.id,i=this._eventHelper.add(t.changedEvent,xi.prototype._onDataSourceChanged,this);this._dataSourceChangedListeners[n]=i};xi.prototype._onDataSourceRemoved=function(e,t){const n=this.clockTrackedDataSource===t,i=t.entities.id;if(this._dataSourceChangedListeners[i](),this._dataSourceChangedListeners[i]=void 0,n){const o=e.length;this._automaticallyTrackDataSourceClocks&&o>0?this.clockTrackedDataSource=e.get(o-1):this.clockTrackedDataSource=void 0}};xi.prototype.zoomTo=function(e,t){return Bae(this,e,{offset:t},!1)};xi.prototype.flyTo=function(e,t){return Bae(this,e,t,!0)};function Bae(e,t,n,i){if(!l(t))throw new w("zoomTarget is required.");A1(e);const o=new Promise(r=>{e._completeZoom=function(s){r(s)}});return e._zoomPromise=o,e._zoomIsFlight=i,e._zoomOptions=n,Promise.resolve(t).then(function(r){if(e._zoomPromise===o){if(r instanceof si){r.getViewableRectangle().then(function(s){return kP(s,e.scene)}).then(function(s){e._zoomPromise===o&&(e._zoomTarget=s)});return}if(r instanceof ps||r instanceof D_||r instanceof Ef){e._zoomTarget=r;return}if(r.isLoading&&l(r.loadingEvent)){const s=r.loadingEvent.addEventListener(function(){s(),e._zoomPromise===o&&(e._zoomTarget=r.entities.values.slice(0))});return}if(Array.isArray(r)){e._zoomTarget=r.slice(0);return}r=A(r.values,r),l(r.entities)&&(r=r.entities.values),Array.isArray(r)?e._zoomTarget=r.slice(0):e._zoomTarget=[r]}}),e.scene.requestRender(),o}function uA(e){e._zoomPromise=void 0,e._zoomTarget=void 0,e._zoomOptions=void 0}function A1(e){const t=e._zoomPromise;l(t)&&(uA(e),e._completeZoom(!1))}xi.prototype._postRender=function(){pAt(this),mAt(this)};function pAt(e){const t=e._zoomTarget;if(!l(t)||e.scene.mode===me.MORPHING)return;const n=e.scene,i=n.camera,o=A(e._zoomOptions,{});let r;if(t instanceof ps||t instanceof Ef)return t.readyPromise.then(function(){const u=t.boundingSphere;l(o.offset)||(o.offset=new ry(0,-.5,u.radius)),r={offset:o.offset,duration:o.duration,maximumHeight:o.maximumHeight,complete:function(){e._completeZoom(!0)},cancel:function(){e._completeZoom(!1)}},e._zoomIsFlight?i.flyToBoundingSphere(t.boundingSphere,r):(i.viewBoundingSphere(u,o.offset),i.lookAtTransform(N.IDENTITY),e._completeZoom(!0)),uA(e)}).catch(()=>{A1(e)});if(t instanceof D_)return t.readyPromise.then(function(){const u=t.boundingSphere;l(o.offset)||(o.offset=new ry(0,-.5,u.radius)),r={offset:o.offset,duration:o.duration,maximumHeight:o.maximumHeight,complete:function(){e._completeZoom(!0)},cancel:function(){e._completeZoom(!1)}},e._zoomIsFlight?i.flyToBoundingSphere(u,r):(i.viewBoundingSphere(u,o.offset),i.lookAtTransform(N.IDENTITY),e._completeZoom(!0)),uA(e)});if(t instanceof ve){r={destination:n.mapProjection.ellipsoid.cartographicToCartesian(t),duration:o.duration,maximumHeight:o.maximumHeight,complete:function(){e._completeZoom(!0)},cancel:function(){e._completeZoom(!1)}},e._zoomIsFlight?i.flyTo(r):(i.setView(r),e._completeZoom(!0)),uA(e);return}const s=t,a=[];for(let u=0,f=s.length;u<f;u++){const h=e._dataSourceDisplay.getBoundingSphere(s[u],!1,Pm);if(h===Ot.PENDING)return;h!==Ot.FAILED&&a.push(Ae.clone(Pm))}if(a.length===0){A1(e);return}e.trackedEntity=void 0;const c=Ae.fromBoundingSpheres(a);e._zoomIsFlight?(uA(e),i.flyToBoundingSphere(c,{duration:o.duration,maximumHeight:o.maximumHeight,complete:function(){e._completeZoom(!0)},cancel:function(){e._completeZoom(!1)},offset:o.offset})):(i.viewBoundingSphere(c,o.offset),i.lookAtTransform(N.IDENTITY),uA(e),e._completeZoom(!0))}function mAt(e){if(!e._needTrackedEntityUpdate)return;const t=e._trackedEntity,n=e.clock.currentTime,i=ie.getValueOrUndefined(t.position,n);if(!l(i))return;const o=e.scene,r=e._dataSourceDisplay.getBoundingSphere(t,!1,Pm);if(r===Ot.PENDING)return;const s=o.mode;(s===me.COLUMBUS_VIEW||s===me.SCENE2D)&&(o.screenSpaceCameraController.enableTranslate=!1),(s===me.COLUMBUS_VIEW||s===me.SCENE3D)&&(o.screenSpaceCameraController.enableTilt=!1);const a=r!==Ot.FAILED?Pm:void 0;e._entityView=new tx(t,o,o.mapProjection.ellipsoid),e._entityView.update(n,a),e._needTrackedEntityUpdate=!1}function Rae(e,t){return function(){return e.apply(t,arguments)}}const{toString:Nae}=Object.prototype,{getPrototypeOf:hH}=Object,pH=(e=>t=>{const n=Nae.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),Dp=e=>(e=e.toLowerCase(),t=>pH(t)===e),iO=e=>t=>typeof t===e,{isArray:HT}=Array,ox=iO("undefined");function _At(e){return e!==null&&!ox(e)&&e.constructor!==null&&!ox(e.constructor)&&Ay(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Mae=Dp("ArrayBuffer");function gAt(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Mae(e.buffer),t}const yAt=iO("string"),Ay=iO("function"),Fae=iO("number"),mH=e=>e!==null&&typeof e=="object",AAt=e=>e===!0||e===!1,oI=e=>{if(pH(e)!=="object")return!1;const t=hH(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},TAt=Dp("Date"),CAt=Dp("File"),bAt=Dp("Blob"),EAt=Dp("FileList"),xAt=e=>mH(e)&&Ay(e.pipe),wAt=e=>{const t="[object FormData]";return e&&(typeof FormData=="function"&&e instanceof FormData||Nae.call(e)===t||Ay(e.toString)&&e.toString()===t)},SAt=Dp("URLSearchParams"),vAt=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function iw(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let i,o;if(typeof e!="object"&&(e=[e]),HT(e))for(i=0,o=e.length;i<o;i++)t.call(null,e[i],i,e);else{const r=n?Object.getOwnPropertyNames(e):Object.keys(e),s=r.length;let a;for(i=0;i<s;i++)a=r[i],t.call(null,e[a],a,e)}}function zae(e,t){t=t.toLowerCase();const n=Object.keys(e);let i=n.length,o;for(;i-- >0;)if(o=n[i],t===o.toLowerCase())return o;return null}const Uae=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global)(),Hae=e=>!ox(e)&&e!==Uae;function N2(){const{caseless:e}=Hae(this)&&this||{},t={},n=(i,o)=>{const r=e&&zae(t,o)||o;oI(t[r])&&oI(i)?t[r]=N2(t[r],i):oI(i)?t[r]=N2({},i):HT(i)?t[r]=i.slice():t[r]=i};for(let i=0,o=arguments.length;i<o;i++)arguments[i]&&iw(arguments[i],n);return t}const DAt=(e,t,n,{allOwnKeys:i}={})=>(iw(t,(o,r)=>{n&&Ay(o)?e[r]=Rae(o,n):e[r]=o},{allOwnKeys:i}),e),IAt=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),PAt=(e,t,n,i)=>{e.prototype=Object.create(t.prototype,i),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},OAt=(e,t,n,i)=>{let o,r,s;const a={};if(t=t||{},e==null)return t;do{for(o=Object.getOwnPropertyNames(e),r=o.length;r-- >0;)s=o[r],(!i||i(s,e,t))&&!a[s]&&(t[s]=e[s],a[s]=!0);e=n!==!1&&hH(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},LAt=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const i=e.indexOf(t,n);return i!==-1&&i===n},BAt=e=>{if(!e)return null;if(HT(e))return e;let t=e.length;if(!Fae(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},RAt=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&hH(Uint8Array)),NAt=(e,t)=>{const i=(e&&e[Symbol.iterator]).call(e);let o;for(;(o=i.next())&&!o.done;){const r=o.value;t.call(e,r[0],r[1])}},MAt=(e,t)=>{let n;const i=[];for(;(n=e.exec(t))!==null;)i.push(n);return i},FAt=Dp("HTMLFormElement"),zAt=e=>e.toLowerCase().replace(/[_-\s]([a-z\d])(\w*)/g,function(n,i,o){return i.toUpperCase()+o}),X7=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),UAt=Dp("RegExp"),Vae=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),i={};iw(n,(o,r)=>{t(o,r,e)!==!1&&(i[r]=o)}),Object.defineProperties(e,i)},HAt=e=>{Vae(e,(t,n)=>{if(Ay(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const i=e[n];if(Ay(i)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},VAt=(e,t)=>{const n={},i=o=>{o.forEach(r=>{n[r]=!0})};return HT(e)?i(e):i(String(e).split(t)),n},kAt=()=>{},GAt=(e,t)=>(e=+e,Number.isFinite(e)?e:t),WAt=e=>{const t=new Array(10),n=(i,o)=>{if(mH(i)){if(t.indexOf(i)>=0)return;if(!("toJSON"in i)){t[o]=i;const r=HT(i)?[]:{};return iw(i,(s,a)=>{const c=n(s,o+1);!ox(c)&&(r[a]=c)}),t[o]=void 0,r}}return i};return n(e,0)},it={isArray:HT,isArrayBuffer:Mae,isBuffer:_At,isFormData:wAt,isArrayBufferView:gAt,isString:yAt,isNumber:Fae,isBoolean:AAt,isObject:mH,isPlainObject:oI,isUndefined:ox,isDate:TAt,isFile:CAt,isBlob:bAt,isRegExp:UAt,isFunction:Ay,isStream:xAt,isURLSearchParams:SAt,isTypedArray:RAt,isFileList:EAt,forEach:iw,merge:N2,extend:DAt,trim:vAt,stripBOM:IAt,inherits:PAt,toFlatObject:OAt,kindOf:pH,kindOfTest:Dp,endsWith:LAt,toArray:BAt,forEachEntry:NAt,matchAll:MAt,isHTMLForm:FAt,hasOwnProperty:X7,hasOwnProp:X7,reduceDescriptors:Vae,freezeMethods:HAt,toObjectSet:VAt,toCamelCase:zAt,noop:kAt,toFiniteNumber:GAt,findKey:zae,global:Uae,isContextDefined:Hae,toJSONObject:WAt};function Wi(e,t,n,i,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),i&&(this.request=i),o&&(this.response=o)}it.inherits(Wi,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:it.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const kae=Wi.prototype,Gae={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{Gae[e]={value:e}});Object.defineProperties(Wi,Gae);Object.defineProperty(kae,"isAxiosError",{value:!0});Wi.from=(e,t,n,i,o,r)=>{const s=Object.create(kae);return it.toFlatObject(e,s,function(c){return c!==Error.prototype},a=>a!=="isAxiosError"),Wi.call(s,e.message,t,n,i,o),s.cause=e,s.name=e.name,r&&Object.assign(s,r),s};var qAt=typeof self=="object"?self.FormData:window.FormData;const jAt=qAt;function M2(e){return it.isPlainObject(e)||it.isArray(e)}function Wae(e){return it.endsWith(e,"[]")?e.slice(0,-2):e}function K7(e,t,n){return e?e.concat(t).map(function(o,r){return o=Wae(o),!n&&r?"["+o+"]":o}).join(n?".":""):t}function YAt(e){return it.isArray(e)&&!e.some(M2)}const $At=it.toFlatObject(it,{},null,function(t){return/^is[A-Z]/.test(t)});function XAt(e){return e&&it.isFunction(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator]}function oO(e,t,n){if(!it.isObject(e))throw new TypeError("target must be an object");t=t||new(jAt||FormData),n=it.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(y,T){return!it.isUndefined(T[y])});const i=n.metaTokens,o=n.visitor||f,r=n.dots,s=n.indexes,c=(n.Blob||typeof Blob<"u"&&Blob)&&XAt(t);if(!it.isFunction(o))throw new TypeError("visitor must be a function");function u(p){if(p===null)return"";if(it.isDate(p))return p.toISOString();if(!c&&it.isBlob(p))throw new Wi("Blob is not supported. Use a Buffer instead.");return it.isArrayBuffer(p)||it.isTypedArray(p)?c&&typeof Blob=="function"?new Blob([p]):Buffer.from(p):p}function f(p,y,T){let b=p;if(p&&!T&&typeof p=="object"){if(it.endsWith(y,"{}"))y=i?y:y.slice(0,-2),p=JSON.stringify(p);else if(it.isArray(p)&&YAt(p)||it.isFileList(p)||it.endsWith(y,"[]")&&(b=it.toArray(p)))return y=Wae(y),b.forEach(function(v,D){!(it.isUndefined(v)||v===null)&&t.append(s===!0?K7([y],D,r):s===null?y:y+"[]",u(v))}),!1}return M2(p)?!0:(t.append(K7(T,y,r),u(p)),!1)}const h=[],_=Object.assign($At,{defaultVisitor:f,convertValue:u,isVisitable:M2});function g(p,y){if(!it.isUndefined(p)){if(h.indexOf(p)!==-1)throw Error("Circular reference detected in "+y.join("."));h.push(p),it.forEach(p,function(b,x){(!(it.isUndefined(b)||b===null)&&o.call(t,b,it.isString(x)?x.trim():x,y,_))===!0&&g(b,y?y.concat(x):[x])}),h.pop()}}if(!it.isObject(e))throw new TypeError("data must be an object");return g(e),t}function J7(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(i){return t[i]})}function _H(e,t){this._pairs=[],e&&oO(e,this,t)}const qae=_H.prototype;qae.append=function(t,n){this._pairs.push([t,n])};qae.toString=function(t){const n=t?function(i){return t.call(this,i,J7)}:J7;return this._pairs.map(function(o){return n(o[0])+"="+n(o[1])},"").join("&")};function KAt(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function jae(e,t,n){if(!t)return e;const i=n&&n.encode||KAt,o=n&&n.serialize;let r;if(o?r=o(t,n):r=it.isURLSearchParams(t)?t.toString():new _H(t,n).toString(i),r){const s=e.indexOf("#");s!==-1&&(e=e.slice(0,s)),e+=(e.indexOf("?")===-1?"?":"&")+r}return e}class JAt{constructor(){this.handlers=[]}use(t,n,i){return this.handlers.push({fulfilled:t,rejected:n,synchronous:i?i.synchronous:!1,runWhen:i?i.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){it.forEach(this.handlers,function(i){i!==null&&t(i)})}}const Q7=JAt,Yae={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},QAt=typeof URLSearchParams<"u"?URLSearchParams:_H,ZAt=FormData,eTt=(()=>{let e;return typeof navigator<"u"&&((e=navigator.product)==="ReactNative"||e==="NativeScript"||e==="NS")?!1:typeof window<"u"&&typeof document<"u"})(),tTt=(()=>typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")(),ud={isBrowser:!0,classes:{URLSearchParams:QAt,FormData:ZAt,Blob},isStandardBrowserEnv:eTt,isStandardBrowserWebWorkerEnv:tTt,protocols:["http","https","file","blob","url","data"]};function nTt(e,t){return oO(e,new ud.classes.URLSearchParams,Object.assign({visitor:function(n,i,o,r){return ud.isNode&&it.isBuffer(n)?(this.append(i,n.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)}},t))}function iTt(e){return it.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function oTt(e){const t={},n=Object.keys(e);let i;const o=n.length;let r;for(i=0;i<o;i++)r=n[i],t[r]=e[r];return t}function $ae(e){function t(n,i,o,r){let s=n[r++];const a=Number.isFinite(+s),c=r>=n.length;return s=!s&&it.isArray(o)?o.length:s,c?(it.hasOwnProp(o,s)?o[s]=[o[s],i]:o[s]=i,!a):((!o[s]||!it.isObject(o[s]))&&(o[s]=[]),t(n,i,o[s],r)&&it.isArray(o[s])&&(o[s]=oTt(o[s])),!a)}if(it.isFormData(e)&&it.isFunction(e.entries)){const n={};return it.forEachEntry(e,(i,o)=>{t(iTt(i),o,n,0)}),n}return null}const rTt={"Content-Type":void 0};function sTt(e,t,n){if(it.isString(e))try{return(t||JSON.parse)(e),it.trim(e)}catch(i){if(i.name!=="SyntaxError")throw i}return(n||JSON.stringify)(e)}const rO={transitional:Yae,adapter:["xhr","http"],transformRequest:[function(t,n){const i=n.getContentType()||"",o=i.indexOf("application/json")>-1,r=it.isObject(t);if(r&&it.isHTMLForm(t)&&(t=new FormData(t)),it.isFormData(t))return o&&o?JSON.stringify($ae(t)):t;if(it.isArrayBuffer(t)||it.isBuffer(t)||it.isStream(t)||it.isFile(t)||it.isBlob(t))return t;if(it.isArrayBufferView(t))return t.buffer;if(it.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let a;if(r){if(i.indexOf("application/x-www-form-urlencoded")>-1)return nTt(t,this.formSerializer).toString();if((a=it.isFileList(t))||i.indexOf("multipart/form-data")>-1){const c=this.env&&this.env.FormData;return oO(a?{"files[]":t}:t,c&&new c,this.formSerializer)}}return r||o?(n.setContentType("application/json",!1),sTt(t)):t}],transformResponse:[function(t){const n=this.transitional||rO.transitional,i=n&&n.forcedJSONParsing,o=this.responseType==="json";if(t&&it.isString(t)&&(i&&!this.responseType||o)){const s=!(n&&n.silentJSONParsing)&&o;try{return JSON.parse(t)}catch(a){if(s)throw a.name==="SyntaxError"?Wi.from(a,Wi.ERR_BAD_RESPONSE,this,null,this.response):a}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:ud.classes.FormData,Blob:ud.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};it.forEach(["delete","get","head"],function(t){rO.headers[t]={}});it.forEach(["post","put","patch"],function(t){rO.headers[t]=it.merge(rTt)});const gH=rO,aTt=it.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),cTt=e=>{const t={};let n,i,o;return e&&e.split(`
|
||
`).forEach(function(s){o=s.indexOf(":"),n=s.substring(0,o).trim().toLowerCase(),i=s.substring(o+1).trim(),!(!n||t[n]&&aTt[n])&&(n==="set-cookie"?t[n]?t[n].push(i):t[n]=[i]:t[n]=t[n]?t[n]+", "+i:i)}),t},Z7=Symbol("internals");function fb(e){return e&&String(e).trim().toLowerCase()}function rI(e){return e===!1||e==null?e:it.isArray(e)?e.map(rI):String(e)}function lTt(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let i;for(;i=n.exec(e);)t[i[1]]=i[2];return t}function uTt(e){return/^[-_a-zA-Z]+$/.test(e.trim())}function eY(e,t,n,i){if(it.isFunction(i))return i.call(this,t,n);if(it.isString(t)){if(it.isString(i))return t.indexOf(i)!==-1;if(it.isRegExp(i))return i.test(t)}}function fTt(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,i)=>n.toUpperCase()+i)}function dTt(e,t){const n=it.toCamelCase(" "+t);["get","set","has"].forEach(i=>{Object.defineProperty(e,i+n,{value:function(o,r,s){return this[i].call(this,t,o,r,s)},configurable:!0})})}class sO{constructor(t){t&&this.set(t)}set(t,n,i){const o=this;function r(a,c,u){const f=fb(c);if(!f)throw new Error("header name must be a non-empty string");const h=it.findKey(o,f);(!h||o[h]===void 0||u===!0||u===void 0&&o[h]!==!1)&&(o[h||c]=rI(a))}const s=(a,c)=>it.forEach(a,(u,f)=>r(u,f,c));return it.isPlainObject(t)||t instanceof this.constructor?s(t,n):it.isString(t)&&(t=t.trim())&&!uTt(t)?s(cTt(t),n):t!=null&&r(n,t,i),this}get(t,n){if(t=fb(t),t){const i=it.findKey(this,t);if(i){const o=this[i];if(!n)return o;if(n===!0)return lTt(o);if(it.isFunction(n))return n.call(this,o,i);if(it.isRegExp(n))return n.exec(o);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=fb(t),t){const i=it.findKey(this,t);return!!(i&&(!n||eY(this,this[i],i,n)))}return!1}delete(t,n){const i=this;let o=!1;function r(s){if(s=fb(s),s){const a=it.findKey(i,s);a&&(!n||eY(i,i[a],a,n))&&(delete i[a],o=!0)}}return it.isArray(t)?t.forEach(r):r(t),o}clear(){return Object.keys(this).forEach(this.delete.bind(this))}normalize(t){const n=this,i={};return it.forEach(this,(o,r)=>{const s=it.findKey(i,r);if(s){n[s]=rI(o),delete n[r];return}const a=t?fTt(r):String(r).trim();a!==r&&delete n[r],n[a]=rI(o),i[a]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return it.forEach(this,(i,o)=>{i!=null&&i!==!1&&(n[o]=t&&it.isArray(i)?i.join(", "):i)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(`
|
||
`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const i=new this(t);return n.forEach(o=>i.set(o)),i}static accessor(t){const i=(this[Z7]=this[Z7]={accessors:{}}).accessors,o=this.prototype;function r(s){const a=fb(s);i[a]||(dTt(o,s),i[a]=!0)}return it.isArray(t)?t.forEach(r):r(t),this}}sO.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent"]);it.freezeMethods(sO.prototype);it.freezeMethods(sO);const jh=sO;function oM(e,t){const n=this||gH,i=t||n,o=jh.from(i.headers);let r=i.data;return it.forEach(e,function(a){r=a.call(n,r,o.normalize(),t?t.status:void 0)}),o.normalize(),r}function Xae(e){return!!(e&&e.__CANCEL__)}function ow(e,t,n){Wi.call(this,e??"canceled",Wi.ERR_CANCELED,t,n),this.name="CanceledError"}it.inherits(ow,Wi,{__CANCEL__:!0});const hTt=null;function pTt(e,t,n){const i=n.config.validateStatus;!n.status||!i||i(n.status)?e(n):t(new Wi("Request failed with status code "+n.status,[Wi.ERR_BAD_REQUEST,Wi.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}const mTt=ud.isStandardBrowserEnv?function(){return{write:function(n,i,o,r,s,a){const c=[];c.push(n+"="+encodeURIComponent(i)),it.isNumber(o)&&c.push("expires="+new Date(o).toGMTString()),it.isString(r)&&c.push("path="+r),it.isString(s)&&c.push("domain="+s),a===!0&&c.push("secure"),document.cookie=c.join("; ")},read:function(n){const i=document.cookie.match(new RegExp("(^|;\\s*)("+n+")=([^;]*)"));return i?decodeURIComponent(i[3]):null},remove:function(n){this.write(n,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}();function _Tt(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function gTt(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}function Kae(e,t){return e&&!_Tt(t)?gTt(e,t):t}const yTt=ud.isStandardBrowserEnv?function(){const t=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");let i;function o(r){let s=r;return t&&(n.setAttribute("href",s),s=n.href),n.setAttribute("href",s),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:n.pathname.charAt(0)==="/"?n.pathname:"/"+n.pathname}}return i=o(window.location.href),function(s){const a=it.isString(s)?o(s):s;return a.protocol===i.protocol&&a.host===i.host}}():function(){return function(){return!0}}();function ATt(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function TTt(e,t){e=e||10;const n=new Array(e),i=new Array(e);let o=0,r=0,s;return t=t!==void 0?t:1e3,function(c){const u=Date.now(),f=i[r];s||(s=u),n[o]=c,i[o]=u;let h=r,_=0;for(;h!==o;)_+=n[h++],h=h%e;if(o=(o+1)%e,o===r&&(r=(r+1)%e),u-s<t)return;const g=f&&u-f;return g?Math.round(_*1e3/g):void 0}}function tY(e,t){let n=0;const i=TTt(50,250);return o=>{const r=o.loaded,s=o.lengthComputable?o.total:void 0,a=r-n,c=i(a),u=r<=s;n=r;const f={loaded:r,total:s,progress:s?r/s:void 0,bytes:a,rate:c||void 0,estimated:c&&s&&u?(s-r)/c:void 0,event:o};f[t?"download":"upload"]=!0,e(f)}}const CTt=typeof XMLHttpRequest<"u",bTt=CTt&&function(e){return new Promise(function(n,i){let o=e.data;const r=jh.from(e.headers).normalize(),s=e.responseType;let a;function c(){e.cancelToken&&e.cancelToken.unsubscribe(a),e.signal&&e.signal.removeEventListener("abort",a)}it.isFormData(o)&&(ud.isStandardBrowserEnv||ud.isStandardBrowserWebWorkerEnv)&&r.setContentType(!1);let u=new XMLHttpRequest;if(e.auth){const g=e.auth.username||"",p=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";r.set("Authorization","Basic "+btoa(g+":"+p))}const f=Kae(e.baseURL,e.url);u.open(e.method.toUpperCase(),jae(f,e.params,e.paramsSerializer),!0),u.timeout=e.timeout;function h(){if(!u)return;const g=jh.from("getAllResponseHeaders"in u&&u.getAllResponseHeaders()),y={data:!s||s==="text"||s==="json"?u.responseText:u.response,status:u.status,statusText:u.statusText,headers:g,config:e,request:u};pTt(function(b){n(b),c()},function(b){i(b),c()},y),u=null}if("onloadend"in u?u.onloadend=h:u.onreadystatechange=function(){!u||u.readyState!==4||u.status===0&&!(u.responseURL&&u.responseURL.indexOf("file:")===0)||setTimeout(h)},u.onabort=function(){u&&(i(new Wi("Request aborted",Wi.ECONNABORTED,e,u)),u=null)},u.onerror=function(){i(new Wi("Network Error",Wi.ERR_NETWORK,e,u)),u=null},u.ontimeout=function(){let p=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const y=e.transitional||Yae;e.timeoutErrorMessage&&(p=e.timeoutErrorMessage),i(new Wi(p,y.clarifyTimeoutError?Wi.ETIMEDOUT:Wi.ECONNABORTED,e,u)),u=null},ud.isStandardBrowserEnv){const g=(e.withCredentials||yTt(f))&&e.xsrfCookieName&&mTt.read(e.xsrfCookieName);g&&r.set(e.xsrfHeaderName,g)}o===void 0&&r.setContentType(null),"setRequestHeader"in u&&it.forEach(r.toJSON(),function(p,y){u.setRequestHeader(y,p)}),it.isUndefined(e.withCredentials)||(u.withCredentials=!!e.withCredentials),s&&s!=="json"&&(u.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&u.addEventListener("progress",tY(e.onDownloadProgress,!0)),typeof e.onUploadProgress=="function"&&u.upload&&u.upload.addEventListener("progress",tY(e.onUploadProgress)),(e.cancelToken||e.signal)&&(a=g=>{u&&(i(!g||g.type?new ow(null,e,u):g),u.abort(),u=null)},e.cancelToken&&e.cancelToken.subscribe(a),e.signal&&(e.signal.aborted?a():e.signal.addEventListener("abort",a)));const _=ATt(f);if(_&&ud.protocols.indexOf(_)===-1){i(new Wi("Unsupported protocol "+_+":",Wi.ERR_BAD_REQUEST,e));return}u.send(o||null)})},sI={http:hTt,xhr:bTt};it.forEach(sI,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const ETt={getAdapter:e=>{e=it.isArray(e)?e:[e];const{length:t}=e;let n,i;for(let o=0;o<t&&(n=e[o],!(i=it.isString(n)?sI[n.toLowerCase()]:n));o++);if(!i)throw i===!1?new Wi(`Adapter ${n} is not supported by the environment`,"ERR_NOT_SUPPORT"):new Error(it.hasOwnProp(sI,n)?`Adapter '${n}' is not available in the build`:`Unknown adapter '${n}'`);if(!it.isFunction(i))throw new TypeError("adapter is not a function");return i},adapters:sI};function rM(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new ow(null,e)}function nY(e){return rM(e),e.headers=jh.from(e.headers),e.data=oM.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),ETt.getAdapter(e.adapter||gH.adapter)(e).then(function(i){return rM(e),i.data=oM.call(e,e.transformResponse,i),i.headers=jh.from(i.headers),i},function(i){return Xae(i)||(rM(e),i&&i.response&&(i.response.data=oM.call(e,e.transformResponse,i.response),i.response.headers=jh.from(i.response.headers))),Promise.reject(i)})}const iY=e=>e instanceof jh?e.toJSON():e;function dT(e,t){t=t||{};const n={};function i(u,f,h){return it.isPlainObject(u)&&it.isPlainObject(f)?it.merge.call({caseless:h},u,f):it.isPlainObject(f)?it.merge({},f):it.isArray(f)?f.slice():f}function o(u,f,h){if(it.isUndefined(f)){if(!it.isUndefined(u))return i(void 0,u,h)}else return i(u,f,h)}function r(u,f){if(!it.isUndefined(f))return i(void 0,f)}function s(u,f){if(it.isUndefined(f)){if(!it.isUndefined(u))return i(void 0,u)}else return i(void 0,f)}function a(u,f,h){if(h in t)return i(u,f);if(h in e)return i(void 0,u)}const c={url:r,method:r,data:r,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:a,headers:(u,f)=>o(iY(u),iY(f),!0)};return it.forEach(Object.keys(e).concat(Object.keys(t)),function(f){const h=c[f]||o,_=h(e[f],t[f],f);it.isUndefined(_)&&h!==a||(n[f]=_)}),n}const Jae="1.2.2",yH={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{yH[e]=function(i){return typeof i===e||"a"+(t<1?"n ":" ")+e}});const oY={};yH.transitional=function(t,n,i){function o(r,s){return"[Axios v"+Jae+"] Transitional option '"+r+"'"+s+(i?". "+i:"")}return(r,s,a)=>{if(t===!1)throw new Wi(o(s," has been removed"+(n?" in "+n:"")),Wi.ERR_DEPRECATED);return n&&!oY[s]&&(oY[s]=!0,console.warn(o(s," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(r,s,a):!0}};function xTt(e,t,n){if(typeof e!="object")throw new Wi("options must be an object",Wi.ERR_BAD_OPTION_VALUE);const i=Object.keys(e);let o=i.length;for(;o-- >0;){const r=i[o],s=t[r];if(s){const a=e[r],c=a===void 0||s(a,r,e);if(c!==!0)throw new Wi("option "+r+" must be "+c,Wi.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new Wi("Unknown option "+r,Wi.ERR_BAD_OPTION)}}const F2={assertOptions:xTt,validators:yH},lm=F2.validators;class T1{constructor(t){this.defaults=t,this.interceptors={request:new Q7,response:new Q7}}request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=dT(this.defaults,n);const{transitional:i,paramsSerializer:o,headers:r}=n;i!==void 0&&F2.assertOptions(i,{silentJSONParsing:lm.transitional(lm.boolean),forcedJSONParsing:lm.transitional(lm.boolean),clarifyTimeoutError:lm.transitional(lm.boolean)},!1),o!==void 0&&F2.assertOptions(o,{encode:lm.function,serialize:lm.function},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let s;s=r&&it.merge(r.common,r[n.method]),s&&it.forEach(["delete","get","head","post","put","patch","common"],p=>{delete r[p]}),n.headers=jh.concat(s,r);const a=[];let c=!0;this.interceptors.request.forEach(function(y){typeof y.runWhen=="function"&&y.runWhen(n)===!1||(c=c&&y.synchronous,a.unshift(y.fulfilled,y.rejected))});const u=[];this.interceptors.response.forEach(function(y){u.push(y.fulfilled,y.rejected)});let f,h=0,_;if(!c){const p=[nY.bind(this),void 0];for(p.unshift.apply(p,a),p.push.apply(p,u),_=p.length,f=Promise.resolve(n);h<_;)f=f.then(p[h++],p[h++]);return f}_=a.length;let g=n;for(h=0;h<_;){const p=a[h++],y=a[h++];try{g=p(g)}catch(T){y.call(this,T);break}}try{f=nY.call(this,g)}catch(p){return Promise.reject(p)}for(h=0,_=u.length;h<_;)f=f.then(u[h++],u[h++]);return f}getUri(t){t=dT(this.defaults,t);const n=Kae(t.baseURL,t.url);return jae(n,t.params,t.paramsSerializer)}}it.forEach(["delete","get","head","options"],function(t){T1.prototype[t]=function(n,i){return this.request(dT(i||{},{method:t,url:n,data:(i||{}).data}))}});it.forEach(["post","put","patch"],function(t){function n(i){return function(r,s,a){return this.request(dT(a||{},{method:t,headers:i?{"Content-Type":"multipart/form-data"}:{},url:r,data:s}))}}T1.prototype[t]=n(),T1.prototype[t+"Form"]=n(!0)});const aI=T1;class AH{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(r){n=r});const i=this;this.promise.then(o=>{if(!i._listeners)return;let r=i._listeners.length;for(;r-- >0;)i._listeners[r](o);i._listeners=null}),this.promise.then=o=>{let r;const s=new Promise(a=>{i.subscribe(a),r=a}).then(o);return s.cancel=function(){i.unsubscribe(r)},s},t(function(r,s,a){i.reason||(i.reason=new ow(r,s,a),n(i.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}static source(){let t;return{token:new AH(function(o){t=o}),cancel:t}}}const wTt=AH;function STt(e){return function(n){return e.apply(null,n)}}function vTt(e){return it.isObject(e)&&e.isAxiosError===!0}const z2={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(z2).forEach(([e,t])=>{z2[t]=e});const DTt=z2;function Qae(e){const t=new aI(e),n=Rae(aI.prototype.request,t);return it.extend(n,aI.prototype,t,{allOwnKeys:!0}),it.extend(n,t,null,{allOwnKeys:!0}),n.create=function(o){return Qae(dT(e,o))},n}const Ls=Qae(gH);Ls.Axios=aI;Ls.CanceledError=ow;Ls.CancelToken=wTt;Ls.isCancel=Xae;Ls.VERSION=Jae;Ls.toFormData=oO;Ls.AxiosError=Wi;Ls.Cancel=Ls.CanceledError;Ls.all=function(t){return Promise.all(t)};Ls.spread=STt;Ls.isAxiosError=vTt;Ls.mergeConfig=dT;Ls.AxiosHeaders=jh;Ls.formToJSON=e=>$ae(it.isHTMLForm(e)?new FormData(e):e);Ls.HttpStatusCode=DTt;Ls.default=Ls;const ITt=Ls,PTt="https://celestrak.org";function OTt(e=""){let t=`${PTt}/NORAD/elements/gp.php?GROUP=${e}&FORMAT=tle`;return ITt.get(t).then(n=>n.status===200?(SG.success("获取TLE成功"),localStorage.setItem(e,n.data),Promise.resolve(n.data)):(SG.error("获取TLE失败"),Promise.reject(n.statusText)))}/*!
|
||
* satellite-js v4.1.4
|
||
* (c) 2013 Shashwat Kandadai and UCSC
|
||
* https://github.com/shashwatak/satellite-js
|
||
* License: MIT
|
||
*/var op=Math.PI,Vr=op*2,Bb=op/180,LTt=1440,BTt=398600.5,el=6378.137,Oh=60/Math.sqrt(el*el*el/BTt),sM=el*Oh/60,RTt=1/Oh,Mg=.00108262998905,NTt=-253215306e-14,MTt=-161098761e-14,Fg=NTt/Mg,rx=2/3;function FTt(e,t){for(var n=[31,e%4===0?29:28,31,30,31,30,31,31,30,31,30,31],i=Math.floor(t),o=1,r=0;i>r+n[o-1]&&o<12;)r+=n[o-1],o+=1;var s=o,a=i-r,c=(t-i)*24,u=Math.floor(c);c=(c-u)*60;var f=Math.floor(c),h=(c-f)*60;return{mon:s,day:a,hr:u,minute:f,sec:h}}function rY(e,t,n,i,o,r){var s=arguments.length>6&&arguments[6]!==void 0?arguments[6]:0;return 367*e-Math.floor(7*(e+Math.floor((t+9)/12))*.25)+Math.floor(275*t/9)+n+17210135e-1+((s/6e4+r/60+o)/60+i)/24}function TH(e,t,n,i,o,r,s){if(e instanceof Date){var a=e;return rY(a.getUTCFullYear(),a.getUTCMonth()+1,a.getUTCDate(),a.getUTCHours(),a.getUTCMinutes(),a.getUTCSeconds(),a.getUTCMilliseconds())}return rY(e,t,n,i,o,r,s)}function Zae(e,t){var n=e.e3,i=e.ee2,o=e.peo,r=e.pgho,s=e.pho,a=e.pinco,c=e.plo,u=e.se2,f=e.se3,h=e.sgh2,_=e.sgh3,g=e.sgh4,p=e.sh2,y=e.sh3,T=e.si2,b=e.si3,x=e.sl2,v=e.sl3,D=e.sl4,L=e.t,B=e.xgh2,V=e.xgh3,M=e.xgh4,H=e.xh2,G=e.xh3,I=e.xi2,O=e.xi3,m=e.xl2,P=e.xl3,R=e.xl4,U=e.zmol,W=e.zmos,q=t.init,Y=t.opsmode,j=t.ep,ee=t.inclp,K=t.nodep,se=t.argpp,Q=t.mp,Z,J,de,_e,le,Te,pe,ne,ae,ye,Ce,Be,Le,Ve,Ie,He,Me,qe,Ne,ke,Qe,Ge=119459e-10,Pt=.01675,Lt=.00015835218,qt=.0549;Qe=W+Ge*L,q==="y"&&(Qe=W),ke=Qe+2*Pt*Math.sin(Qe),Me=Math.sin(ke),ye=.5*Me*Me-.25,Ce=-.5*Me*Math.cos(ke);var zn=u*ye+f*Ce,Gn=T*ye+b*Ce,Dn=x*ye+v*Ce+D*Me,hn=h*ye+_*Ce+g*Me,jt=p*ye+y*Ce;Qe=U+Lt*L,q==="y"&&(Qe=U),ke=Qe+2*qt*Math.sin(Qe),Me=Math.sin(ke),ye=.5*Me*Me-.25,Ce=-.5*Me*Math.cos(ke);var In=i*ye+n*Ce,Rn=I*ye+O*Ce,Jt=m*ye+P*Ce+R*Me,ln=B*ye+V*Ce+M*Me,ei=H*ye+G*Ce;return Be=zn+In,Ie=Gn+Rn,He=Dn+Jt,Le=hn+ln,Ve=jt+ei,q==="n"&&(Be-=o,Ie-=a,He-=c,Le-=r,Ve-=s,ee+=Ie,j+=Be,_e=Math.sin(ee),de=Math.cos(ee),ee>=.2?(Ve/=_e,Le-=de*Ve,se+=Le,K+=Ve,Q+=He):(Te=Math.sin(K),le=Math.cos(K),Z=_e*Te,J=_e*le,pe=Ve*le+Ie*de*Te,ne=-Ve*Te+Ie*de*le,Z+=pe,J+=ne,K%=Vr,K<0&&Y==="a"&&(K+=Vr),qe=Q+se+de*K,ae=He+Le-Ie*K*_e,qe+=ae,Ne=K,K=Math.atan2(Z,J),K<0&&Y==="a"&&(K+=Vr),Math.abs(Ne-K)>op&&(K<Ne?K+=Vr:K-=Vr),Q+=He,se=qe-Q-de*K)),{ep:j,inclp:ee,nodep:K,argpp:se,mp:Q}}function zTt(e){var t=e.epoch,n=e.ep,i=e.argpp,o=e.tc,r=e.inclp,s=e.nodep,a=e.np,c,u,f,h,_,g,p,y,T,b,x,v,D,L,B,V,M,H,G,I,O,m,P,R,U,W,q,Y,j,ee,K,se,Q,Z,J,de,_e,le,Te,pe,ne,ae,ye,Ce,Be,Le,Ve,Ie,He,Me,qe,Ne,ke,Qe,Ge,Pt,Lt,qt,zn,Gn,Dn,hn,jt,In=.01675,Rn=.0549,Jt=29864797e-13,ln=47968065e-14,ei=.39785416,bi=.91744867,pn=.1945905,Fi=-.98088458,Co=a,Xi=n,gi=Math.sin(s),wn=Math.cos(s),ti=Math.sin(i),Jn=Math.cos(i),Tn=Math.sin(r),Rt=Math.cos(r),et=Xi*Xi,qn=1-et,Sn=Math.sqrt(qn),oo=0,jn=0,Ki=0,zo=0,So=0,Yr=t+18261.5+o/1440,ro=(4.523602-.00092422029*Yr)%Vr,Ji=Math.sin(ro),Rr=Math.cos(ro),Zs=.91375164-.03568096*Rr,Nt=Math.sqrt(1-Zs*Zs),Oe=.089683511*Ji/Nt,st=Math.sqrt(1-Oe*Oe),gt=5.8351514+.001944368*Yr,oi=.39785416*Ji/Nt,br=st*Rr+.91744867*Oe*Ji;oi=Math.atan2(oi,br),oi+=gt-ro;var Nr=Math.cos(oi),Uo=Math.sin(oi);I=pn,O=Fi,R=bi,U=ei,m=wn,P=gi,x=Jt;for(var Uf=1/Co,Ho=0;Ho<2;)Ho+=1,c=I*m+O*R*P,f=-O*m+I*R*P,p=-I*P+O*R*m,y=O*U,T=O*P+I*R*m,b=I*U,u=Rt*p+Tn*y,h=Rt*T+Tn*b,_=-Tn*p+Rt*y,g=-Tn*T+Rt*b,v=c*Jn+u*ti,D=f*Jn+h*ti,L=-c*ti+u*Jn,B=-f*ti+h*Jn,V=_*ti,M=g*ti,H=_*Jn,G=g*Jn,Dn=12*v*v-3*L*L,hn=24*v*D-6*L*B,jt=12*D*D-3*B*B,Ne=3*(c*c+u*u)+Dn*et,ke=6*(c*f+u*h)+hn*et,Qe=3*(f*f+h*h)+jt*et,Ge=-6*c*_+et*(-24*v*H-6*L*V),Pt=-6*(c*g+f*_)+et*(-24*(D*H+v*G)+-6*(L*M+B*V)),Lt=-6*f*g+et*(-24*D*G-6*B*M),qt=6*u*_+et*(24*v*V-6*L*H),zn=6*(h*_+u*g)+et*(24*(D*V+v*M)-6*(B*H+L*G)),Gn=6*h*g+et*(24*D*M-6*B*G),Ne=Ne+Ne+qn*Dn,ke=ke+ke+qn*hn,Qe=Qe+Qe+qn*jt,Ve=x*Uf,Le=-.5*Ve/Sn,Ie=Ve*Sn,Be=-15*Xi*Ie,He=v*L+D*B,Me=D*L+v*B,qe=D*B-v*L,Ho===1&&(W=Be,q=Le,Y=Ve,j=Ie,ee=He,K=Me,se=qe,Q=Ne,Z=ke,J=Qe,de=Ge,_e=Pt,le=Lt,Te=qt,pe=zn,ne=Gn,ae=Dn,ye=hn,Ce=jt,I=Nr,O=Uo,R=Zs,U=Nt,m=st*wn+Oe*gi,P=gi*st-wn*Oe,x=ln);var Pu=(4.7199672+(.2299715*Yr-gt))%Vr,Xd=(6.2565837+.017201977*Yr)%Vr,I_=2*W*K,Hf=2*W*se,Kd=2*q*_e,VT=2*q*(le-de),kT=-2*Y*Z,GT=-2*Y*(J-Q),Ky=-2*Y*(-21-9*et)*In,Jd=2*j*ye,Jy=2*j*(Ce-ae),P_=-18*j*In,O_=-2*q*pe,L_=-2*q*(ne-Te),Vf=2*Be*Me,Qy=2*Be*qe,WT=2*Le*Pt,rw=2*Le*(Lt-Ge),sw=-2*Ve*ke,qT=-2*Ve*(Qe-Ne),aO=-2*Ve*(-21-9*et)*Rn,aw=2*Ie*hn,jT=2*Ie*(jt-Dn),YT=-18*Ie*Rn,Ip=-2*Le*zn,cw=-2*Le*(Gn-qt);return{snodm:gi,cnodm:wn,sinim:Tn,cosim:Rt,sinomm:ti,cosomm:Jn,day:Yr,e3:Qy,ee2:Vf,em:Xi,emsq:et,gam:gt,peo:oo,pgho:zo,pho:So,pinco:jn,plo:Ki,rtemsq:Sn,se2:I_,se3:Hf,sgh2:Jd,sgh3:Jy,sgh4:P_,sh2:O_,sh3:L_,si2:Kd,si3:VT,sl2:kT,sl3:GT,sl4:Ky,s1:Be,s2:Le,s3:Ve,s4:Ie,s5:He,s6:Me,s7:qe,ss1:W,ss2:q,ss3:Y,ss4:j,ss5:ee,ss6:K,ss7:se,sz1:Q,sz2:Z,sz3:J,sz11:de,sz12:_e,sz13:le,sz21:Te,sz22:pe,sz23:ne,sz31:ae,sz32:ye,sz33:Ce,xgh2:aw,xgh3:jT,xgh4:YT,xh2:Ip,xh3:cw,xi2:WT,xi3:rw,xl2:sw,xl3:qT,xl4:aO,nm:Co,z1:Ne,z2:ke,z3:Qe,z11:Ge,z12:Pt,z13:Lt,z21:qt,z22:zn,z23:Gn,z31:Dn,z32:hn,z33:jt,zmol:Pu,zmos:Xd}}function UTt(e){var t=e.cosim,n=e.argpo,i=e.s1,o=e.s2,r=e.s3,s=e.s4,a=e.s5,c=e.sinim,u=e.ss1,f=e.ss2,h=e.ss3,_=e.ss4,g=e.ss5,p=e.sz1,y=e.sz3,T=e.sz11,b=e.sz13,x=e.sz21,v=e.sz23,D=e.sz31,L=e.sz33,B=e.t,V=e.tc,M=e.gsto,H=e.mo,G=e.mdot,I=e.no,O=e.nodeo,m=e.nodedot,P=e.xpidot,R=e.z1,U=e.z3,W=e.z11,q=e.z13,Y=e.z21,j=e.z23,ee=e.z31,K=e.z33,se=e.ecco,Q=e.eccsq,Z=e.emsq,J=e.em,de=e.argpm,_e=e.inclm,le=e.mm,Te=e.nm,pe=e.nodem,ne=e.irez,ae=e.atime,ye=e.d2201,Ce=e.d2211,Be=e.d3210,Le=e.d3222,Ve=e.d4410,Ie=e.d4422,He=e.d5220,Me=e.d5232,qe=e.d5421,Ne=e.d5433,ke=e.dedt,Qe=e.didt,Ge=e.dmdt,Pt=e.dnodt,Lt=e.domdt,qt=e.del1,zn=e.del2,Gn=e.del3,Dn=e.xfact,hn=e.xlamo,jt=e.xli,In=e.xni,Rn,Jt,ln,ei,bi,pn,Fi,Co,Xi,gi,wn,ti,Jn,Tn,Rt,et,qn,Sn,oo,jn,Ki,zo,So,Yr,ro,Ji,Rr,Zs,Nt,Oe,st,gt,oi=17891679e-13,br=21460748e-13,Nr=22123015e-14,Uo=17891679e-13,Uf=73636953e-16,Ho=21765803e-16,Pu=.0043752690880113,Xd=37393792e-14,I_=11428639e-14,Hf=.00015835218,Kd=119459e-10;ne=0,Te<.0052359877&&Te>.0034906585&&(ne=1),Te>=.00826&&Te<=.00924&&J>=.5&&(ne=2);var VT=u*Kd*g,kT=f*Kd*(T+b),GT=-Kd*h*(p+y-14-6*Z),Ky=_*Kd*(D+L-6),Jd=-Kd*f*(x+v);(_e<.052359877||_e>op-.052359877)&&(Jd=0),c!==0&&(Jd/=c);var Jy=Ky-t*Jd;ke=VT+i*Hf*a,Qe=kT+o*Hf*(W+q),Ge=GT-Hf*r*(R+U-14-6*Z);var P_=s*Hf*(ee+K-6),O_=-Hf*o*(Y+j);(_e<.052359877||_e>op-.052359877)&&(O_=0),Lt=Jy+P_,Pt=Jd,c!==0&&(Lt-=t/c*O_,Pt+=O_/c);var L_=0,Vf=(M+V*Pu)%Vr;if(J+=ke*B,_e+=Qe*B,de+=Lt*B,pe+=Pt*B,le+=Ge*B,ne!==0){if(Oe=Math.pow(Te/Oh,rx),ne===2){st=t*t;var Qy=J;J=se;var WT=Z;Z=Q,gt=J*Z,Tn=-.306-(J-.64)*.44,J<=.65?(Rt=3.616-13.247*J+16.29*Z,qn=-19.302+117.39*J-228.419*Z+156.591*gt,Sn=-18.9068+109.7927*J-214.6334*Z+146.5816*gt,oo=-41.122+242.694*J-471.094*Z+313.953*gt,jn=-146.407+841.88*J-1629.014*Z+1083.435*gt,Ki=-532.114+3017.977*J-5740.032*Z+3708.276*gt):(Rt=-72.099+331.819*J-508.738*Z+266.724*gt,qn=-346.844+1582.851*J-2415.925*Z+1246.113*gt,Sn=-342.585+1554.908*J-2366.899*Z+1215.972*gt,oo=-1052.797+4758.686*J-7193.992*Z+3651.957*gt,jn=-3581.69+16178.11*J-24462.77*Z+12422.52*gt,J>.715?Ki=-5149.66+29936.92*J-54087.36*Z+31324.56*gt:Ki=1464.74-4664.75*J+3763.64*Z),J<.7?(Yr=-919.2277+4988.61*J-9064.77*Z+5542.21*gt,zo=-822.71072+4568.6173*J-8491.4146*Z+5337.524*gt,So=-853.666+4690.25*J-8624.77*Z+5341.4*gt):(Yr=-37995.78+161616.52*J-229838.2*Z+109377.94*gt,zo=-51752.104+218913.95*J-309468.16*Z+146349.42*gt,So=-40023.88+170470.89*J-242699.48*Z+115605.82*gt),ro=c*c,Rn=.75*(1+2*t+st),Jt=1.5*ro,ei=1.875*c*(1-2*t-3*st),bi=-1.875*c*(1+2*t-3*st),Fi=35*ro*Rn,Co=39.375*ro*ro,Xi=9.84375*c*(ro*(1-2*t-5*st)+.33333333*(-2+4*t+6*st)),gi=c*(4.92187512*ro*(-2-4*t+10*st)+6.56250012*(1+2*t-3*st)),wn=29.53125*c*(2-8*t+st*(-12+8*t+10*st)),ti=29.53125*c*(-2-8*t+st*(12+8*t-10*st)),Zs=Te*Te,Nt=Oe*Oe,Rr=3*Zs*Nt,Ji=Rr*Uo,ye=Ji*Rn*Tn,Ce=Ji*Jt*Rt,Rr*=Oe,Ji=Rr*Xd,Be=Ji*ei*qn,Le=Ji*bi*Sn,Rr*=Oe,Ji=2*Rr*Uf,Ve=Ji*Fi*oo,Ie=Ji*Co*jn,Rr*=Oe,Ji=Rr*I_,He=Ji*Xi*Ki,Me=Ji*gi*So,Ji=2*Rr*Ho,qe=Ji*wn*zo,Ne=Ji*ti*Yr,hn=(H+O+O-(Vf+Vf))%Vr,Dn=G+Ge+2*(m+Pt-Pu)-I,J=Qy,Z=WT}ne===1&&(Jn=1+Z*(-2.5+.8125*Z),qn=1+2*Z,et=1+Z*(-6+6.60937*Z),Rn=.75*(1+t)*(1+t),ln=.9375*c*c*(1+3*t)-.75*(1+t),pn=1+t,pn*=1.875*pn*pn,qt=3*Te*Te*Oe*Oe,zn=2*qt*Rn*Jn*oi,Gn=3*qt*pn*et*Nr*Oe,qt=qt*ln*qn*br*Oe,hn=(H+O+n-Vf)%Vr,Dn=G+P+Ge+Lt+Pt-(I+Pu)),jt=hn,In=I,ae=0,Te=I+L_}return{em:J,argpm:de,inclm:_e,mm:le,nm:Te,nodem:pe,irez:ne,atime:ae,d2201:ye,d2211:Ce,d3210:Be,d3222:Le,d4410:Ve,d4422:Ie,d5220:He,d5232:Me,d5421:qe,d5433:Ne,dedt:ke,didt:Qe,dmdt:Ge,dndt:L_,dnodt:Pt,domdt:Lt,del1:qt,del2:zn,del3:Gn,xfact:Dn,xlamo:hn,xli:jt,xni:In}}function sY(e){var t=(e-2451545)/36525,n=-62e-7*t*t*t+.093104*t*t+(876600*3600+8640184812866e-6)*t+67310.54841;return n=n*Bb/240%Vr,n<0&&(n+=Vr),n}function HTt(){return(arguments.length<=0?void 0:arguments[0])instanceof Date||arguments.length>1?sY(TH.apply(void 0,arguments)):sY.apply(void 0,arguments)}function VTt(e){var t=e.ecco,n=e.epoch,i=e.inclo,o=e.opsmode,r=e.no,s=t*t,a=1-s,c=Math.sqrt(a),u=Math.cos(i),f=u*u,h=Math.pow(Oh/r,rx),_=.75*Mg*(3*f-1)/(c*a),g=_/(h*h),p=h*(1-g*g-g*(1/3+134*g*g/81));g=_/(p*p),r/=1+g;var y=Math.pow(Oh/r,rx),T=Math.sin(i),b=y*a,x=1-5*f,v=-x-f-f,D=1/y,L=b*b,B=y*(1-t),V="n",M;if(o==="a"){var H=n-7305,G=Math.floor(H+1e-8),I=H-G,O=.017202791694070362,m=1.7321343856509375,P=5075514194322695e-30,R=O+Vr;M=(m+O*G+R*I+H*H*P)%Vr,M<0&&(M+=Vr)}else M=HTt(n+24332815e-1);return{no:r,method:V,ainv:D,ao:y,con41:v,con42:x,cosio:u,cosio2:f,eccsq:s,omeosq:a,posq:L,rp:B,rteosq:c,sinio:T,gsto:M}}function kTt(e){var t=e.irez,n=e.d2201,i=e.d2211,o=e.d3210,r=e.d3222,s=e.d4410,a=e.d4422,c=e.d5220,u=e.d5232,f=e.d5421,h=e.d5433,_=e.dedt,g=e.del1,p=e.del2,y=e.del3,T=e.didt,b=e.dmdt,x=e.dnodt,v=e.domdt,D=e.argpo,L=e.argpdot,B=e.t,V=e.tc,M=e.gsto,H=e.xfact,G=e.xlamo,I=e.no,O=e.atime,m=e.em,P=e.argpm,R=e.inclm,U=e.xli,W=e.mm,q=e.xni,Y=e.nodem,j=e.nm,ee=.13130908,K=2.8843198,se=.37448087,Q=5.7686396,Z=.95240898,J=1.8014998,de=1.050833,_e=4.4108898,le=.0043752690880113,Te=720,pe=-720,ne=259200,ae,ye,Ce,Be,Le,Ve,Ie,He,Me=0,qe=0,Ne=(M+V*le)%Vr;if(m+=_*B,R+=T*B,P+=v*B,Y+=x*B,W+=b*B,t!==0){(O===0||B*O<=0||Math.abs(B)<Math.abs(O))&&(O=0,q=I,U=G),B>0?ae=Te:ae=pe;for(var ke=381;ke===381;)t!==2?(Ie=g*Math.sin(U-ee)+p*Math.sin(2*(U-K))+y*Math.sin(3*(U-se)),Le=q+H,Ve=g*Math.cos(U-ee)+2*p*Math.cos(2*(U-K))+3*y*Math.cos(3*(U-se)),Ve*=Le):(He=D+L*O,Ce=He+He,ye=U+U,Ie=n*Math.sin(Ce+U-Q)+i*Math.sin(U-Q)+o*Math.sin(He+U-Z)+r*Math.sin(-He+U-Z)+s*Math.sin(Ce+ye-J)+a*Math.sin(ye-J)+c*Math.sin(He+U-de)+u*Math.sin(-He+U-de)+f*Math.sin(He+ye-_e)+h*Math.sin(-He+ye-_e),Le=q+H,Ve=n*Math.cos(Ce+U-Q)+i*Math.cos(U-Q)+o*Math.cos(He+U-Z)+r*Math.cos(-He+U-Z)+c*Math.cos(He+U-de)+u*Math.cos(-He+U-de)+2*s*Math.cos(Ce+ye-J)+a*Math.cos(ye-J)+f*Math.cos(He+ye-_e)+h*Math.cos(-He+ye-_e),Ve*=Le),Math.abs(B-O)>=Te?ke=381:(qe=B-O,ke=0),ke===381&&(U+=Le*ae+Ie*ne,q+=Ie*ae+Ve*ne,O+=ae);j=q+Ie*qe+Ve*qe*qe*.5,Be=U+Le*qe+Ie*qe*qe*.5,t!==1?(W=Be-2*Y+2*Ne,Me=j-I):(W=Be-Y-P+Ne,Me=j-I),j=I+Me}return{atime:O,em:m,argpm:P,inclm:R,xli:U,mm:W,xni:q,nodem:Y,dndt:Me,nm:j}}function ece(e,t){var n,i,o,r,s,a,c,u,f,h,_,g,p,y,T,b,x,v,D,L,B,V,M,H,G,I,O,m=15e-13;e.t=t,e.error=0;var P=e.mo+e.mdot*e.t,R=e.argpo+e.argpdot*e.t,U=e.nodeo+e.nodedot*e.t;f=R,B=P;var W=e.t*e.t;if(M=U+e.nodecf*W,x=1-e.cc1*e.t,v=e.bstar*e.cc4*e.t,D=e.t2cof*W,e.isimp!==1){c=e.omgcof*e.t;var q=1+e.eta*Math.cos(P);a=e.xmcof*(q*q*q-e.delmo),b=c+a,B=P+b,f=R-b,g=W*e.t,p=g*e.t,x=x-e.d2*W-e.d3*g-e.d4*p,v+=e.bstar*e.cc5*(Math.sin(B)-e.sinmao),D=D+e.t3cof*g+p*(e.t4cof+e.t*e.t5cof)}V=e.no;var Y=e.ecco;if(L=e.inclo,e.method==="d"){y=e.t;var j={irez:e.irez,d2201:e.d2201,d2211:e.d2211,d3210:e.d3210,d3222:e.d3222,d4410:e.d4410,d4422:e.d4422,d5220:e.d5220,d5232:e.d5232,d5421:e.d5421,d5433:e.d5433,dedt:e.dedt,del1:e.del1,del2:e.del2,del3:e.del3,didt:e.didt,dmdt:e.dmdt,dnodt:e.dnodt,domdt:e.domdt,argpo:e.argpo,argpdot:e.argpdot,t:e.t,tc:y,gsto:e.gsto,xfact:e.xfact,xlamo:e.xlamo,no:e.no,atime:e.atime,em:Y,argpm:f,inclm:L,xli:e.xli,mm:B,xni:e.xni,nodem:M,nm:V},ee=kTt(j);Y=ee.em,f=ee.argpm,L=ee.inclm,B=ee.mm,M=ee.nodem,V=ee.nm}if(V<=0)return e.error=2,[!1,!1];var K=Math.pow(Oh/V,rx)*x*x;if(V=Oh/Math.pow(K,1.5),Y-=v,Y>=1||Y<-.001)return e.error=1,[!1,!1];Y<1e-6&&(Y=1e-6),B+=e.no*D,G=B+f+M,M%=Vr,f%=Vr,G%=Vr,B=(G-f-M)%Vr;var se=Math.sin(L),Q=Math.cos(L),Z=Y;if(H=L,h=f,O=M,I=B,r=se,o=Q,e.method==="d"){var J={inclo:e.inclo,init:"n",ep:Z,inclp:H,nodep:O,argpp:h,mp:I,opsmode:e.operationmode},de=Zae(e,J);if(Z=de.ep,O=de.nodep,h=de.argpp,I=de.mp,H=de.inclp,H<0&&(H=-H,O+=op,h-=op),Z<0||Z>1)return e.error=3,[!1,!1]}e.method==="d"&&(r=Math.sin(H),o=Math.cos(H),e.aycof=-.5*Fg*r,Math.abs(o+1)>15e-13?e.xlcof=-.25*Fg*r*(3+5*o)/(1+o):e.xlcof=-.25*Fg*r*(3+5*o)/m);var _e=Z*Math.cos(h);b=1/(K*(1-Z*Z));var le=Z*Math.sin(h)+b*e.aycof,Te=I+h+O+b*e.xlcof*_e,pe=(Te-O)%Vr;u=pe,T=9999.9;for(var ne=1;Math.abs(T)>=1e-12&&ne<=10;)i=Math.sin(u),n=Math.cos(u),T=1-n*_e-i*le,T=(pe-le*n+_e*i-u)/T,Math.abs(T)>=.95&&(T>0?T=.95:T=-.95),u+=T,ne+=1;var ae=_e*n+le*i,ye=_e*i-le*n,Ce=_e*_e+le*le,Be=K*(1-Ce);if(Be<0)return e.error=4,[!1,!1];var Le=K*(1-ae),Ve=Math.sqrt(K)*ye/Le,Ie=Math.sqrt(Be)/Le,He=Math.sqrt(1-Ce);b=ye/(1+He);var Me=K/Le*(i-le-_e*b),qe=K/Le*(n-_e+le*b);_=Math.atan2(Me,qe);var Ne=(qe+qe)*Me,ke=1-2*Me*Me;b=1/Be;var Qe=.5*Mg*b,Ge=Qe*b;e.method==="d"&&(s=o*o,e.con41=3*s-1,e.x1mth2=1-s,e.x7thm1=7*s-1);var Pt=Le*(1-1.5*Ge*He*e.con41)+.5*Qe*e.x1mth2*ke;if(Pt<1)return e.error=6,{position:!1,velocity:!1};_-=.25*Ge*e.x7thm1*Ne;var Lt=O+1.5*Ge*o*Ne,qt=H+1.5*Ge*o*r*ke,zn=Ve-V*Qe*e.x1mth2*Ne/Oh,Gn=Ie+V*Qe*(e.x1mth2*ke+1.5*e.con41)/Oh,Dn=Math.sin(_),hn=Math.cos(_),jt=Math.sin(Lt),In=Math.cos(Lt),Rn=Math.sin(qt),Jt=Math.cos(qt),ln=-jt*Jt,ei=In*Jt,bi=ln*Dn+In*hn,pn=ei*Dn+jt*hn,Fi=Rn*Dn,Co=ln*hn-In*Dn,Xi=ei*hn-jt*Dn,gi=Rn*hn,wn={x:Pt*bi*el,y:Pt*pn*el,z:Pt*Fi*el},ti={x:(zn*bi+Gn*Co)*sM,y:(zn*pn+Gn*Xi)*sM,z:(zn*Fi+Gn*gi)*sM};return{position:wn,velocity:ti}}function GTt(e,t){var n=t.opsmode,i=t.satn,o=t.epoch,r=t.xbstar,s=t.xecco,a=t.xargpo,c=t.xinclo,u=t.xmo,f=t.xno,h=t.xnodeo,_,g,p,y,T,b,x,v,D,L,B,V,M,H,G,I,O,m,P,R,U,W,q,Y,j,ee,K,se,Q,Z,J,de,_e,le,Te,pe,ne,ae,ye,Ce,Be,Le,Ve,Ie,He,Me,qe,Ne,ke,Qe,Ge,Pt,Lt,qt,zn,Gn,Dn=15e-13;e.isimp=0,e.method="n",e.aycof=0,e.con41=0,e.cc1=0,e.cc4=0,e.cc5=0,e.d2=0,e.d3=0,e.d4=0,e.delmo=0,e.eta=0,e.argpdot=0,e.omgcof=0,e.sinmao=0,e.t=0,e.t2cof=0,e.t3cof=0,e.t4cof=0,e.t5cof=0,e.x1mth2=0,e.x7thm1=0,e.mdot=0,e.nodedot=0,e.xlcof=0,e.xmcof=0,e.nodecf=0,e.irez=0,e.d2201=0,e.d2211=0,e.d3210=0,e.d3222=0,e.d4410=0,e.d4422=0,e.d5220=0,e.d5232=0,e.d5421=0,e.d5433=0,e.dedt=0,e.del1=0,e.del2=0,e.del3=0,e.didt=0,e.dmdt=0,e.dnodt=0,e.domdt=0,e.e3=0,e.ee2=0,e.peo=0,e.pgho=0,e.pho=0,e.pinco=0,e.plo=0,e.se2=0,e.se3=0,e.sgh2=0,e.sgh3=0,e.sgh4=0,e.sh2=0,e.sh3=0,e.si2=0,e.si3=0,e.sl2=0,e.sl3=0,e.sl4=0,e.gsto=0,e.xfact=0,e.xgh2=0,e.xgh3=0,e.xgh4=0,e.xh2=0,e.xh3=0,e.xi2=0,e.xi3=0,e.xl2=0,e.xl3=0,e.xl4=0,e.xlamo=0,e.zmol=0,e.zmos=0,e.atime=0,e.xli=0,e.xni=0,e.bstar=r,e.ecco=s,e.argpo=a,e.inclo=c,e.mo=u,e.no=f,e.nodeo=h,e.operationmode=n;var hn=78/el+1,jt=(120-78)/el,In=jt*jt*jt*jt;e.init="y",e.t=0;var Rn={satn:i,ecco:e.ecco,epoch:o,inclo:e.inclo,no:e.no,method:e.method,opsmode:e.operationmode},Jt=VTt(Rn),ln=Jt.ao,ei=Jt.con42,bi=Jt.cosio,pn=Jt.cosio2,Fi=Jt.eccsq,Co=Jt.omeosq,Xi=Jt.posq,gi=Jt.rp,wn=Jt.rteosq,ti=Jt.sinio;if(e.no=Jt.no,e.con41=Jt.con41,e.gsto=Jt.gsto,e.error=0,Co>=0||e.no>=0){if(e.isimp=0,gi<220/el+1&&(e.isimp=1),K=hn,U=In,m=(gi-1)*el,m<156){K=m-78,m<98&&(K=20);var Jn=(120-K)/el;U=Jn*Jn*Jn*Jn,K=K/el+1}P=1/Xi,Me=1/(ln-K),e.eta=ln*e.ecco*Me,V=e.eta*e.eta,B=e.ecco*e.eta,R=Math.abs(1-V),b=U*Math.pow(Me,4),x=b/Math.pow(R,3.5),y=x*e.no*(ln*(1+1.5*V+B*(4+V))+.375*Mg*Me/R*e.con41*(8+3*V*(8+V))),e.cc1=e.bstar*y,T=0,e.ecco>1e-4&&(T=-2*b*Me*Fg*e.no*ti/e.ecco),e.x1mth2=1-pn,e.cc4=2*e.no*x*ln*Co*(e.eta*(2+.5*V)+e.ecco*(.5+2*V)-Mg*Me/(ln*R)*(-3*e.con41*(1-2*B+V*(1.5-.5*B))+.75*e.x1mth2*(2*V-B*(1+V))*Math.cos(2*e.argpo))),e.cc5=2*x*ln*Co*(1+2.75*(V+B)+B*V),v=pn*pn,Ve=1.5*Mg*P*e.no,Ie=.5*Ve*Mg*P,He=-.46875*MTt*P*P*e.no,e.mdot=e.no+.5*Ve*wn*e.con41+.0625*Ie*wn*(13-78*pn+137*v),e.argpdot=-.5*Ve*ei+.0625*Ie*(7-114*pn+395*v)+He*(3-36*pn+49*v),Ne=-Ve*bi,e.nodedot=Ne+(.5*Ie*(4-19*pn)+2*He*(3-7*pn))*bi,qe=e.argpdot+e.nodedot,e.omgcof=e.bstar*T*Math.cos(e.argpo),e.xmcof=0,e.ecco>1e-4&&(e.xmcof=-rx*b*e.bstar/B),e.nodecf=3.5*Co*Ne*e.cc1,e.t2cof=1.5*e.cc1,Math.abs(bi+1)>15e-13?e.xlcof=-.25*Fg*ti*(3+5*bi)/(1+bi):e.xlcof=-.25*Fg*ti*(3+5*bi)/Dn,e.aycof=-.5*Fg*ti;var Tn=1+e.eta*Math.cos(e.mo);if(e.delmo=Tn*Tn*Tn,e.sinmao=Math.sin(e.mo),e.x7thm1=7*pn-1,2*op/e.no>=225){e.method="d",e.isimp=1,Be=0,G=e.inclo;var Rt={epoch:o,ep:e.ecco,argpp:e.argpo,tc:Be,inclp:e.inclo,nodep:e.nodeo,np:e.no,e3:e.e3,ee2:e.ee2,peo:e.peo,pgho:e.pgho,pho:e.pho,pinco:e.pinco,plo:e.plo,se2:e.se2,se3:e.se3,sgh2:e.sgh2,sgh3:e.sgh3,sgh4:e.sgh4,sh2:e.sh2,sh3:e.sh3,si2:e.si2,si3:e.si3,sl2:e.sl2,sl3:e.sl3,sl4:e.sl4,xgh2:e.xgh2,xgh3:e.xgh3,xgh4:e.xgh4,xh2:e.xh2,xh3:e.xh3,xi2:e.xi2,xi3:e.xi3,xl2:e.xl2,xl3:e.xl3,xl4:e.xl4,zmol:e.zmol,zmos:e.zmos},et=zTt(Rt);e.e3=et.e3,e.ee2=et.ee2,e.peo=et.peo,e.pgho=et.pgho,e.pho=et.pho,e.pinco=et.pinco,e.plo=et.plo,e.se2=et.se2,e.se3=et.se3,e.sgh2=et.sgh2,e.sgh3=et.sgh3,e.sgh4=et.sgh4,e.sh2=et.sh2,e.sh3=et.sh3,e.si2=et.si2,e.si3=et.si3,e.sl2=et.sl2,e.sl3=et.sl3,e.sl4=et.sl4,g=et.sinim,_=et.cosim,D=et.em,L=et.emsq,W=et.s1,q=et.s2,Y=et.s3,j=et.s4,ee=et.s5,se=et.ss1,Q=et.ss2,Z=et.ss3,J=et.ss4,de=et.ss5,_e=et.sz1,le=et.sz3,Te=et.sz11,pe=et.sz13,ne=et.sz21,ae=et.sz23,ye=et.sz31,Ce=et.sz33,e.xgh2=et.xgh2,e.xgh3=et.xgh3,e.xgh4=et.xgh4,e.xh2=et.xh2,e.xh3=et.xh3,e.xi2=et.xi2,e.xi3=et.xi3,e.xl2=et.xl2,e.xl3=et.xl3,e.xl4=et.xl4,e.zmol=et.zmol,e.zmos=et.zmos,O=et.nm,ke=et.z1,Qe=et.z3,Ge=et.z11,Pt=et.z13,Lt=et.z21,qt=et.z23,zn=et.z31,Gn=et.z33;var qn={inclo:G,init:e.init,ep:e.ecco,inclp:e.inclo,nodep:e.nodeo,argpp:e.argpo,mp:e.mo,opsmode:e.operationmode},Sn=Zae(e,qn);e.ecco=Sn.ep,e.inclo=Sn.inclp,e.nodeo=Sn.nodep,e.argpo=Sn.argpp,e.mo=Sn.mp,M=0,H=0,I=0;var oo={cosim:_,emsq:L,argpo:e.argpo,s1:W,s2:q,s3:Y,s4:j,s5:ee,sinim:g,ss1:se,ss2:Q,ss3:Z,ss4:J,ss5:de,sz1:_e,sz3:le,sz11:Te,sz13:pe,sz21:ne,sz23:ae,sz31:ye,sz33:Ce,t:e.t,tc:Be,gsto:e.gsto,mo:e.mo,mdot:e.mdot,no:e.no,nodeo:e.nodeo,nodedot:e.nodedot,xpidot:qe,z1:ke,z3:Qe,z11:Ge,z13:Pt,z21:Lt,z23:qt,z31:zn,z33:Gn,ecco:e.ecco,eccsq:Fi,em:D,argpm:M,inclm:G,mm:I,nm:O,nodem:H,irez:e.irez,atime:e.atime,d2201:e.d2201,d2211:e.d2211,d3210:e.d3210,d3222:e.d3222,d4410:e.d4410,d4422:e.d4422,d5220:e.d5220,d5232:e.d5232,d5421:e.d5421,d5433:e.d5433,dedt:e.dedt,didt:e.didt,dmdt:e.dmdt,dnodt:e.dnodt,domdt:e.domdt,del1:e.del1,del2:e.del2,del3:e.del3,xfact:e.xfact,xlamo:e.xlamo,xli:e.xli,xni:e.xni},jn=UTt(oo);e.irez=jn.irez,e.atime=jn.atime,e.d2201=jn.d2201,e.d2211=jn.d2211,e.d3210=jn.d3210,e.d3222=jn.d3222,e.d4410=jn.d4410,e.d4422=jn.d4422,e.d5220=jn.d5220,e.d5232=jn.d5232,e.d5421=jn.d5421,e.d5433=jn.d5433,e.dedt=jn.dedt,e.didt=jn.didt,e.dmdt=jn.dmdt,e.dnodt=jn.dnodt,e.domdt=jn.domdt,e.del1=jn.del1,e.del2=jn.del2,e.del3=jn.del3,e.xfact=jn.xfact,e.xlamo=jn.xlamo,e.xli=jn.xli,e.xni=jn.xni}e.isimp!==1&&(p=e.cc1*e.cc1,e.d2=4*ln*Me*p,Le=e.d2*Me*e.cc1/3,e.d3=(17*ln+K)*Le,e.d4=.5*Le*ln*Me*(221*ln+31*K)*e.cc1,e.t3cof=e.d2+2*p,e.t4cof=.25*(3*e.d3+e.cc1*(12*e.d2+10*p)),e.t5cof=.2*(3*e.d4+12*e.cc1*e.d3+6*e.d2*e.d2+15*p*(2*e.d2+p)))}ece(e,0),e.init="n"}function WTt(e,t){var n="i",i=1440/(2*op),o=0,r={};r.error=0,r.satnum=e.substring(2,7),r.epochyr=parseInt(e.substring(18,20),10),r.epochdays=parseFloat(e.substring(20,32)),r.ndot=parseFloat(e.substring(33,43)),r.nddot=parseFloat(".".concat(parseInt(e.substring(44,50),10),"E").concat(e.substring(50,52))),r.bstar=parseFloat("".concat(e.substring(53,54),".").concat(parseInt(e.substring(54,59),10),"E").concat(e.substring(59,61))),r.inclo=parseFloat(t.substring(8,16)),r.nodeo=parseFloat(t.substring(17,25)),r.ecco=parseFloat(".".concat(t.substring(26,33))),r.argpo=parseFloat(t.substring(34,42)),r.mo=parseFloat(t.substring(43,51)),r.no=parseFloat(t.substring(52,63)),r.no/=i,r.a=Math.pow(r.no*RTt,-2/3),r.ndot/=i*1440,r.nddot/=i*1440*1440,r.inclo*=Bb,r.nodeo*=Bb,r.argpo*=Bb,r.mo*=Bb,r.alta=r.a*(1+r.ecco)-1,r.altp=r.a*(1-r.ecco)-1,r.epochyr<57?o=r.epochyr+2e3:o=r.epochyr+1900;var s=FTt(o,r.epochdays),a=s.mon,c=s.day,u=s.hr,f=s.minute,h=s.sec;return r.jdsatepoch=TH(o,a,c,u,f,h),GTt(r,{opsmode:n,satn:r.satnum,epoch:r.jdsatepoch-24332815e-1,xbstar:r.bstar,xecco:r.ecco,xargpo:r.argpo,xinclo:r.inclo,xmo:r.mo,xno:r.no,xnodeo:r.nodeo}),r}function qTt(e){return jTt(e)||YTt(e)||$Tt(e)||XTt()}function jTt(e){if(Array.isArray(e))return U2(e)}function YTt(e){if(typeof Symbol<"u"&&Symbol.iterator in Object(e))return Array.from(e)}function $Tt(e,t){if(e){if(typeof e=="string")return U2(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return U2(e,t)}}function U2(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function XTt(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
||
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function KTt(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var i=t[0],o=Array.prototype.slice.call(t,1),r=TH.apply(void 0,qTt(o)),s=(r-i.jdsatepoch)*LTt;return ece(i,s)}class JTt{constructor(t="",n={}){const[i,o,r]=this._checkTle(t);let s=r.slice(52,64);this.name=i.trim(),this.tleLine1=o.trim(),this.tleLine2=r.trim(),this.satrec=WTt(this.tleLine1,this.tleLine2),this.totalSeconds=86400,this.stepSeconds=100,this.leadTime=parseInt(24*3600/s),this.trailTime=0}_checkTle(t){let n=t.split(`
|
||
`);if(n.length!==3)throw new Error("tle data error");return n}getPositionEci(t){return KTt(this.satrec,t).position}_getPositionProperty(){const t=ce.fromIso8601(new Date().toISOString()),n=new Cl($a.INERTIAL);let i=Date.now();for(let o=0;o<this.totalSeconds/this.stepSeconds;o++){let r=new Date(i+o*this.stepSeconds*1e3),s=this.getPositionEci(r);if(!s)continue;const a=ce.addSeconds(t,o*this.stepSeconds,new ce),c={x:s.x*1e3,y:s.y*1e3,z:s.z*1e3};n.addSample(a,c)}return n}createSatelliteEntity(){const t=ce.fromIso8601(new Date().toISOString()),n=ce.addSeconds(t,this.totalSeconds,new ce);return{name:this.name,description:this.name,availability:new ar([new bn({start:t,stop:n})]),position:this._getPositionProperty(),point:{pixelSize:8,color:k.fromRandom({alpha:1})},path:new sT({width:1,show:!1,leadTime:this.leadTime,trailTime:this.trailTime,material:k.LIME}),label:{text:this.name,font:"12px sans-serif",showBackground:!0,backgroundColor:new k(.165,.165,.165,.5),backgroundPadding:new $(4,4),outlineWidth:1,verticalOrigin:co.TOP,horizontalOrigin:co.LEFT,pixelOffset:new $(0,5),fillColor:k.WHITE,distanceDisplayCondition:new sn(10,5e6)}}}}let QTt=[{label:"特殊卫星",value:null,group:null,type:"title"},{label:"Last 30 Days' Launches",value:1,group:"last-30-days"},{label:"Space Stations",value:2,group:"stations"},{label:"100 (or so) Brightest",value:3,group:"visual"},{label:"Active Satellites",value:4,group:"active"},{label:"Analyst Satellites ",value:5,group:"analyst"}],ZTt=[{label:"气象和地球资源卫星",value:null,group:null,type:"title"},{label:"Weather",value:6,group:"weather"},{label:"NOAA",value:7,group:"noaa"},{label:"GOES",value:8,group:"goes"},{label:"Earth Resources",value:9,group:"resource"},{label:"Search & Rescue (SARSAT) ",value:10,group:"sarsat"},{label:"Disaster Monitoring",value:11,group:"dmc"},{label:"TDRSS",value:12,group:"tdrss"},{label:"ARGOS Data Collection System",value:13,group:"argos"},{label:"Planet",value:14,group:"planet"},{label:"Spire",value:15,group:"spire"}],eCt=[{label:"通讯卫星",value:null,group:null,type:"title"},{label:"Active Geosynchronous",value:16,group:"geo"},{label:"GEO Protected Zone",value:17,group:"gpz"},{label:"GEO Protected Zone Plus",value:18,group:"gpz-plus"},{label:"Intelsat",value:19,group:"intelsat"},{label:"SES",value:20,group:"ses"},{label:"Iridium",value:21,group:"iridium"},{label:"Iridium NEXT",value:22,group:"iridium-NEXT"},{label:"Starlink",value:23,group:"starlink"},{label:"OneWeb",value:24,group:"oneweb"},{label:"Orbcomm",value:25,group:"orbcomm"},{label:"Globalstar",value:26,group:"globalstar"},{label:"Swarm",value:27,group:"swarm"},{label:"Amateur Radio",value:28,group:"amateur"},{label:"Experimental Comm",value:29,group:"x-comm"},{label:"Other Comm",value:30,group:"other-comm"},{label:"SatNOGS",value:31,group:"satnogs"},{label:"Gorizont",value:32,group:"gorizont"},{label:"Raduga",value:33,group:"raduga"},{label:"Molniya",value:34,group:"molniya"}],tCt=[{label:"导航卫星",value:null,group:null,type:"title"},{label:"GNSS",value:35,group:"gnss"},{label:"GPS Operational",value:36,group:"gps-ops"},{label:"GLONASS Operational",value:37,group:"glo-ops"},{label:"Galileo",value:38,group:"galileo"},{label:"Beidou",value:39,group:"beidou"},{label:"Satellite-Based Augmentation System",value:40,group:"sbas"},{label:"Navy Navigation Satellite System (NNSS)",value:41,group:"nnss"},{label:"Russian LEO Navigation",value:42,group:"musson"}],nCt=[{label:"科学卫星",value:null,group:null,type:"title"},{label:"Space & Earth Science",value:43,group:"science"},{label:"Geodetic",value:44,group:"geodetic"},{label:"Engineering",value:45,group:"engineering"},{label:"Education",value:46,group:"education"}],iCt=[{label:"其他卫星",value:null,group:null,type:"title"},{label:"Miscellaneous Military",value:47,group:"military"},{label:"Radar Calibration",value:48,group:"radar"},{label:"CubeSats",value:49,group:"cubesat"},{label:"Other Satellites",value:50,group:"other"}];var H2={},oCt={get exports(){return H2},set exports(e){H2=e}};/**
|
||
* @license
|
||
* Lodash <https://lodash.com/>
|
||
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
||
* Released under MIT license <https://lodash.com/license>
|
||
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
||
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
||
*/(function(e,t){(function(){var n,i="4.17.21",o=200,r="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",s="Expected a function",a="Invalid `variable` option passed into `_.template`",c="__lodash_hash_undefined__",u=500,f="__lodash_placeholder__",h=1,_=2,g=4,p=1,y=2,T=1,b=2,x=4,v=8,D=16,L=32,B=64,V=128,M=256,H=512,G=30,I="...",O=800,m=16,P=1,R=2,U=3,W=1/0,q=9007199254740991,Y=17976931348623157e292,j=0/0,ee=4294967295,K=ee-1,se=ee>>>1,Q=[["ary",V],["bind",T],["bindKey",b],["curry",v],["curryRight",D],["flip",H],["partial",L],["partialRight",B],["rearg",M]],Z="[object Arguments]",J="[object Array]",de="[object AsyncFunction]",_e="[object Boolean]",le="[object Date]",Te="[object DOMException]",pe="[object Error]",ne="[object Function]",ae="[object GeneratorFunction]",ye="[object Map]",Ce="[object Number]",Be="[object Null]",Le="[object Object]",Ve="[object Promise]",Ie="[object Proxy]",He="[object RegExp]",Me="[object Set]",qe="[object String]",Ne="[object Symbol]",ke="[object Undefined]",Qe="[object WeakMap]",Ge="[object WeakSet]",Pt="[object ArrayBuffer]",Lt="[object DataView]",qt="[object Float32Array]",zn="[object Float64Array]",Gn="[object Int8Array]",Dn="[object Int16Array]",hn="[object Int32Array]",jt="[object Uint8Array]",In="[object Uint8ClampedArray]",Rn="[object Uint16Array]",Jt="[object Uint32Array]",ln=/\b__p \+= '';/g,ei=/\b(__p \+=) '' \+/g,bi=/(__e\(.*?\)|\b__t\)) \+\n'';/g,pn=/&(?:amp|lt|gt|quot|#39);/g,Fi=/[&<>"']/g,Co=RegExp(pn.source),Xi=RegExp(Fi.source),gi=/<%-([\s\S]+?)%>/g,wn=/<%([\s\S]+?)%>/g,ti=/<%=([\s\S]+?)%>/g,Jn=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Tn=/^\w*$/,Rt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,et=/[\\^$.*+?()[\]{}|]/g,qn=RegExp(et.source),Sn=/^\s+/,oo=/\s/,jn=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Ki=/\{\n\/\* \[wrapped with (.+)\] \*/,zo=/,? & /,So=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Yr=/[()=,{}\[\]\/\s]/,ro=/\\(\\)?/g,Ji=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Rr=/\w*$/,Zs=/^[-+]0x[0-9a-f]+$/i,Nt=/^0b[01]+$/i,Oe=/^\[object .+?Constructor\]$/,st=/^0o[0-7]+$/i,gt=/^(?:0|[1-9]\d*)$/,oi=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,br=/($^)/,Nr=/['\n\r\u2028\u2029\\]/g,Uo="\\ud800-\\udfff",Uf="\\u0300-\\u036f",Ho="\\ufe20-\\ufe2f",Pu="\\u20d0-\\u20ff",Xd=Uf+Ho+Pu,I_="\\u2700-\\u27bf",Hf="a-z\\xdf-\\xf6\\xf8-\\xff",Kd="\\xac\\xb1\\xd7\\xf7",VT="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",kT="\\u2000-\\u206f",GT=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ky="A-Z\\xc0-\\xd6\\xd8-\\xde",Jd="\\ufe0e\\ufe0f",Jy=Kd+VT+kT+GT,P_="['’]",O_="["+Uo+"]",L_="["+Jy+"]",Vf="["+Xd+"]",Qy="\\d+",WT="["+I_+"]",rw="["+Hf+"]",sw="[^"+Uo+Jy+Qy+I_+Hf+Ky+"]",qT="\\ud83c[\\udffb-\\udfff]",aO="(?:"+Vf+"|"+qT+")",aw="[^"+Uo+"]",jT="(?:\\ud83c[\\udde6-\\uddff]){2}",YT="[\\ud800-\\udbff][\\udc00-\\udfff]",Ip="["+Ky+"]",cw="\\u200d",bH="(?:"+rw+"|"+sw+")",tce="(?:"+Ip+"|"+sw+")",EH="(?:"+P_+"(?:d|ll|m|re|s|t|ve))?",xH="(?:"+P_+"(?:D|LL|M|RE|S|T|VE))?",wH=aO+"?",SH="["+Jd+"]?",nce="(?:"+cw+"(?:"+[aw,jT,YT].join("|")+")"+SH+wH+")*",ice="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",oce="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",vH=SH+wH+nce,rce="(?:"+[WT,jT,YT].join("|")+")"+vH,sce="(?:"+[aw+Vf+"?",Vf,jT,YT,O_].join("|")+")",ace=RegExp(P_,"g"),cce=RegExp(Vf,"g"),cO=RegExp(qT+"(?="+qT+")|"+sce+vH,"g"),lce=RegExp([Ip+"?"+rw+"+"+EH+"(?="+[L_,Ip,"$"].join("|")+")",tce+"+"+xH+"(?="+[L_,Ip+bH,"$"].join("|")+")",Ip+"?"+bH+"+"+EH,Ip+"+"+xH,oce,ice,Qy,rce].join("|"),"g"),uce=RegExp("["+cw+Uo+Xd+Jd+"]"),fce=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,dce=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],hce=-1,Yo={};Yo[qt]=Yo[zn]=Yo[Gn]=Yo[Dn]=Yo[hn]=Yo[jt]=Yo[In]=Yo[Rn]=Yo[Jt]=!0,Yo[Z]=Yo[J]=Yo[Pt]=Yo[_e]=Yo[Lt]=Yo[le]=Yo[pe]=Yo[ne]=Yo[ye]=Yo[Ce]=Yo[Le]=Yo[He]=Yo[Me]=Yo[qe]=Yo[Qe]=!1;var Vo={};Vo[Z]=Vo[J]=Vo[Pt]=Vo[Lt]=Vo[_e]=Vo[le]=Vo[qt]=Vo[zn]=Vo[Gn]=Vo[Dn]=Vo[hn]=Vo[ye]=Vo[Ce]=Vo[Le]=Vo[He]=Vo[Me]=Vo[qe]=Vo[Ne]=Vo[jt]=Vo[In]=Vo[Rn]=Vo[Jt]=!0,Vo[pe]=Vo[ne]=Vo[Qe]=!1;var pce={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},mce={"&":"&","<":"<",">":">",'"':""","'":"'"},_ce={"&":"&","<":"<",">":">",""":'"',"'":"'"},gce={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},yce=parseFloat,Ace=parseInt,DH=typeof Ku=="object"&&Ku&&Ku.Object===Object&&Ku,Tce=typeof self=="object"&&self&&self.Object===Object&&self,ea=DH||Tce||Function("return this")(),lO=t&&!t.nodeType&&t,B_=lO&&!0&&e&&!e.nodeType&&e,IH=B_&&B_.exports===lO,uO=IH&&DH.process,Dl=function(){try{var ze=B_&&B_.require&&B_.require("util").types;return ze||uO&&uO.binding&&uO.binding("util")}catch{}}(),PH=Dl&&Dl.isArrayBuffer,OH=Dl&&Dl.isDate,LH=Dl&&Dl.isMap,BH=Dl&&Dl.isRegExp,RH=Dl&&Dl.isSet,NH=Dl&&Dl.isTypedArray;function kc(ze,tt,Ke){switch(Ke.length){case 0:return ze.call(tt);case 1:return ze.call(tt,Ke[0]);case 2:return ze.call(tt,Ke[0],Ke[1]);case 3:return ze.call(tt,Ke[0],Ke[1],Ke[2])}return ze.apply(tt,Ke)}function Cce(ze,tt,Ke,kt){for(var Yn=-1,so=ze==null?0:ze.length;++Yn<so;){var ys=ze[Yn];tt(kt,ys,Ke(ys),ze)}return kt}function Il(ze,tt){for(var Ke=-1,kt=ze==null?0:ze.length;++Ke<kt&&tt(ze[Ke],Ke,ze)!==!1;);return ze}function bce(ze,tt){for(var Ke=ze==null?0:ze.length;Ke--&&tt(ze[Ke],Ke,ze)!==!1;);return ze}function MH(ze,tt){for(var Ke=-1,kt=ze==null?0:ze.length;++Ke<kt;)if(!tt(ze[Ke],Ke,ze))return!1;return!0}function Pp(ze,tt){for(var Ke=-1,kt=ze==null?0:ze.length,Yn=0,so=[];++Ke<kt;){var ys=ze[Ke];tt(ys,Ke,ze)&&(so[Yn++]=ys)}return so}function lw(ze,tt){var Ke=ze==null?0:ze.length;return!!Ke&&Zy(ze,tt,0)>-1}function fO(ze,tt,Ke){for(var kt=-1,Yn=ze==null?0:ze.length;++kt<Yn;)if(Ke(tt,ze[kt]))return!0;return!1}function cr(ze,tt){for(var Ke=-1,kt=ze==null?0:ze.length,Yn=Array(kt);++Ke<kt;)Yn[Ke]=tt(ze[Ke],Ke,ze);return Yn}function Op(ze,tt){for(var Ke=-1,kt=tt.length,Yn=ze.length;++Ke<kt;)ze[Yn+Ke]=tt[Ke];return ze}function dO(ze,tt,Ke,kt){var Yn=-1,so=ze==null?0:ze.length;for(kt&&so&&(Ke=ze[++Yn]);++Yn<so;)Ke=tt(Ke,ze[Yn],Yn,ze);return Ke}function Ece(ze,tt,Ke,kt){var Yn=ze==null?0:ze.length;for(kt&&Yn&&(Ke=ze[--Yn]);Yn--;)Ke=tt(Ke,ze[Yn],Yn,ze);return Ke}function hO(ze,tt){for(var Ke=-1,kt=ze==null?0:ze.length;++Ke<kt;)if(tt(ze[Ke],Ke,ze))return!0;return!1}var xce=pO("length");function wce(ze){return ze.split("")}function Sce(ze){return ze.match(So)||[]}function FH(ze,tt,Ke){var kt;return Ke(ze,function(Yn,so,ys){if(tt(Yn,so,ys))return kt=so,!1}),kt}function uw(ze,tt,Ke,kt){for(var Yn=ze.length,so=Ke+(kt?1:-1);kt?so--:++so<Yn;)if(tt(ze[so],so,ze))return so;return-1}function Zy(ze,tt,Ke){return tt===tt?zce(ze,tt,Ke):uw(ze,zH,Ke)}function vce(ze,tt,Ke,kt){for(var Yn=Ke-1,so=ze.length;++Yn<so;)if(kt(ze[Yn],tt))return Yn;return-1}function zH(ze){return ze!==ze}function UH(ze,tt){var Ke=ze==null?0:ze.length;return Ke?_O(ze,tt)/Ke:j}function pO(ze){return function(tt){return tt==null?n:tt[ze]}}function mO(ze){return function(tt){return ze==null?n:ze[tt]}}function HH(ze,tt,Ke,kt,Yn){return Yn(ze,function(so,ys,Io){Ke=kt?(kt=!1,so):tt(Ke,so,ys,Io)}),Ke}function Dce(ze,tt){var Ke=ze.length;for(ze.sort(tt);Ke--;)ze[Ke]=ze[Ke].value;return ze}function _O(ze,tt){for(var Ke,kt=-1,Yn=ze.length;++kt<Yn;){var so=tt(ze[kt]);so!==n&&(Ke=Ke===n?so:Ke+so)}return Ke}function gO(ze,tt){for(var Ke=-1,kt=Array(ze);++Ke<ze;)kt[Ke]=tt(Ke);return kt}function Ice(ze,tt){return cr(tt,function(Ke){return[Ke,ze[Ke]]})}function VH(ze){return ze&&ze.slice(0,qH(ze)+1).replace(Sn,"")}function Gc(ze){return function(tt){return ze(tt)}}function yO(ze,tt){return cr(tt,function(Ke){return ze[Ke]})}function $T(ze,tt){return ze.has(tt)}function kH(ze,tt){for(var Ke=-1,kt=ze.length;++Ke<kt&&Zy(tt,ze[Ke],0)>-1;);return Ke}function GH(ze,tt){for(var Ke=ze.length;Ke--&&Zy(tt,ze[Ke],0)>-1;);return Ke}function Pce(ze,tt){for(var Ke=ze.length,kt=0;Ke--;)ze[Ke]===tt&&++kt;return kt}var Oce=mO(pce),Lce=mO(mce);function Bce(ze){return"\\"+gce[ze]}function Rce(ze,tt){return ze==null?n:ze[tt]}function e0(ze){return uce.test(ze)}function Nce(ze){return fce.test(ze)}function Mce(ze){for(var tt,Ke=[];!(tt=ze.next()).done;)Ke.push(tt.value);return Ke}function AO(ze){var tt=-1,Ke=Array(ze.size);return ze.forEach(function(kt,Yn){Ke[++tt]=[Yn,kt]}),Ke}function WH(ze,tt){return function(Ke){return ze(tt(Ke))}}function Lp(ze,tt){for(var Ke=-1,kt=ze.length,Yn=0,so=[];++Ke<kt;){var ys=ze[Ke];(ys===tt||ys===f)&&(ze[Ke]=f,so[Yn++]=Ke)}return so}function fw(ze){var tt=-1,Ke=Array(ze.size);return ze.forEach(function(kt){Ke[++tt]=kt}),Ke}function Fce(ze){var tt=-1,Ke=Array(ze.size);return ze.forEach(function(kt){Ke[++tt]=[kt,kt]}),Ke}function zce(ze,tt,Ke){for(var kt=Ke-1,Yn=ze.length;++kt<Yn;)if(ze[kt]===tt)return kt;return-1}function Uce(ze,tt,Ke){for(var kt=Ke+1;kt--;)if(ze[kt]===tt)return kt;return kt}function t0(ze){return e0(ze)?Vce(ze):xce(ze)}function Ou(ze){return e0(ze)?kce(ze):wce(ze)}function qH(ze){for(var tt=ze.length;tt--&&oo.test(ze.charAt(tt)););return tt}var Hce=mO(_ce);function Vce(ze){for(var tt=cO.lastIndex=0;cO.test(ze);)++tt;return tt}function kce(ze){return ze.match(cO)||[]}function Gce(ze){return ze.match(lce)||[]}var Wce=function ze(tt){tt=tt==null?ea:n0.defaults(ea.Object(),tt,n0.pick(ea,dce));var Ke=tt.Array,kt=tt.Date,Yn=tt.Error,so=tt.Function,ys=tt.Math,Io=tt.Object,TO=tt.RegExp,qce=tt.String,Pl=tt.TypeError,dw=Ke.prototype,jce=so.prototype,i0=Io.prototype,hw=tt["__core-js_shared__"],pw=jce.toString,bo=i0.hasOwnProperty,Yce=0,jH=function(){var C=/[^.]+$/.exec(hw&&hw.keys&&hw.keys.IE_PROTO||"");return C?"Symbol(src)_1."+C:""}(),mw=i0.toString,$ce=pw.call(Io),Xce=ea._,Kce=TO("^"+pw.call(bo).replace(et,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),_w=IH?tt.Buffer:n,Bp=tt.Symbol,gw=tt.Uint8Array,YH=_w?_w.allocUnsafe:n,yw=WH(Io.getPrototypeOf,Io),$H=Io.create,XH=i0.propertyIsEnumerable,Aw=dw.splice,KH=Bp?Bp.isConcatSpreadable:n,XT=Bp?Bp.iterator:n,R_=Bp?Bp.toStringTag:n,Tw=function(){try{var C=U_(Io,"defineProperty");return C({},"",{}),C}catch{}}(),Jce=tt.clearTimeout!==ea.clearTimeout&&tt.clearTimeout,Qce=kt&&kt.now!==ea.Date.now&&kt.now,Zce=tt.setTimeout!==ea.setTimeout&&tt.setTimeout,Cw=ys.ceil,bw=ys.floor,CO=Io.getOwnPropertySymbols,ele=_w?_w.isBuffer:n,JH=tt.isFinite,tle=dw.join,nle=WH(Io.keys,Io),As=ys.max,ya=ys.min,ile=kt.now,ole=tt.parseInt,QH=ys.random,rle=dw.reverse,bO=U_(tt,"DataView"),KT=U_(tt,"Map"),EO=U_(tt,"Promise"),o0=U_(tt,"Set"),JT=U_(tt,"WeakMap"),QT=U_(Io,"create"),Ew=JT&&new JT,r0={},sle=H_(bO),ale=H_(KT),cle=H_(EO),lle=H_(o0),ule=H_(JT),xw=Bp?Bp.prototype:n,ZT=xw?xw.valueOf:n,ZH=xw?xw.toString:n;function he(C){if(Mr(C)&&!Qn(C)&&!(C instanceof vi)){if(C instanceof Ol)return C;if(bo.call(C,"__wrapped__"))return e4(C)}return new Ol(C)}var s0=function(){function C(){}return function(S){if(!Er(S))return{};if($H)return $H(S);C.prototype=S;var z=new C;return C.prototype=n,z}}();function ww(){}function Ol(C,S){this.__wrapped__=C,this.__actions__=[],this.__chain__=!!S,this.__index__=0,this.__values__=n}he.templateSettings={escape:gi,evaluate:wn,interpolate:ti,variable:"",imports:{_:he}},he.prototype=ww.prototype,he.prototype.constructor=he,Ol.prototype=s0(ww.prototype),Ol.prototype.constructor=Ol;function vi(C){this.__wrapped__=C,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=ee,this.__views__=[]}function fle(){var C=new vi(this.__wrapped__);return C.__actions__=xc(this.__actions__),C.__dir__=this.__dir__,C.__filtered__=this.__filtered__,C.__iteratees__=xc(this.__iteratees__),C.__takeCount__=this.__takeCount__,C.__views__=xc(this.__views__),C}function dle(){if(this.__filtered__){var C=new vi(this);C.__dir__=-1,C.__filtered__=!0}else C=this.clone(),C.__dir__*=-1;return C}function hle(){var C=this.__wrapped__.value(),S=this.__dir__,z=Qn(C),X=S<0,re=z?C.length:0,ge=wue(0,re,this.__views__),we=ge.start,Pe=ge.end,Ue=Pe-we,ot=X?Pe:we-1,rt=this.__iteratees__,pt=rt.length,Ft=0,on=ya(Ue,this.__takeCount__);if(!z||!X&&re==Ue&&on==Ue)return EV(C,this.__actions__);var Pn=[];e:for(;Ue--&&Ft<on;){ot+=S;for(var ui=-1,On=C[ot];++ui<pt;){var Ei=rt[ui],Oi=Ei.iteratee,jc=Ei.type,oc=Oi(On);if(jc==R)On=oc;else if(!oc){if(jc==P)continue e;break e}}Pn[Ft++]=On}return Pn}vi.prototype=s0(ww.prototype),vi.prototype.constructor=vi;function N_(C){var S=-1,z=C==null?0:C.length;for(this.clear();++S<z;){var X=C[S];this.set(X[0],X[1])}}function ple(){this.__data__=QT?QT(null):{},this.size=0}function mle(C){var S=this.has(C)&&delete this.__data__[C];return this.size-=S?1:0,S}function _le(C){var S=this.__data__;if(QT){var z=S[C];return z===c?n:z}return bo.call(S,C)?S[C]:n}function gle(C){var S=this.__data__;return QT?S[C]!==n:bo.call(S,C)}function yle(C,S){var z=this.__data__;return this.size+=this.has(C)?0:1,z[C]=QT&&S===n?c:S,this}N_.prototype.clear=ple,N_.prototype.delete=mle,N_.prototype.get=_le,N_.prototype.has=gle,N_.prototype.set=yle;function Qd(C){var S=-1,z=C==null?0:C.length;for(this.clear();++S<z;){var X=C[S];this.set(X[0],X[1])}}function Ale(){this.__data__=[],this.size=0}function Tle(C){var S=this.__data__,z=Sw(S,C);if(z<0)return!1;var X=S.length-1;return z==X?S.pop():Aw.call(S,z,1),--this.size,!0}function Cle(C){var S=this.__data__,z=Sw(S,C);return z<0?n:S[z][1]}function ble(C){return Sw(this.__data__,C)>-1}function Ele(C,S){var z=this.__data__,X=Sw(z,C);return X<0?(++this.size,z.push([C,S])):z[X][1]=S,this}Qd.prototype.clear=Ale,Qd.prototype.delete=Tle,Qd.prototype.get=Cle,Qd.prototype.has=ble,Qd.prototype.set=Ele;function Zd(C){var S=-1,z=C==null?0:C.length;for(this.clear();++S<z;){var X=C[S];this.set(X[0],X[1])}}function xle(){this.size=0,this.__data__={hash:new N_,map:new(KT||Qd),string:new N_}}function wle(C){var S=zw(this,C).delete(C);return this.size-=S?1:0,S}function Sle(C){return zw(this,C).get(C)}function vle(C){return zw(this,C).has(C)}function Dle(C,S){var z=zw(this,C),X=z.size;return z.set(C,S),this.size+=z.size==X?0:1,this}Zd.prototype.clear=xle,Zd.prototype.delete=wle,Zd.prototype.get=Sle,Zd.prototype.has=vle,Zd.prototype.set=Dle;function M_(C){var S=-1,z=C==null?0:C.length;for(this.__data__=new Zd;++S<z;)this.add(C[S])}function Ile(C){return this.__data__.set(C,c),this}function Ple(C){return this.__data__.has(C)}M_.prototype.add=M_.prototype.push=Ile,M_.prototype.has=Ple;function Lu(C){var S=this.__data__=new Qd(C);this.size=S.size}function Ole(){this.__data__=new Qd,this.size=0}function Lle(C){var S=this.__data__,z=S.delete(C);return this.size=S.size,z}function Ble(C){return this.__data__.get(C)}function Rle(C){return this.__data__.has(C)}function Nle(C,S){var z=this.__data__;if(z instanceof Qd){var X=z.__data__;if(!KT||X.length<o-1)return X.push([C,S]),this.size=++z.size,this;z=this.__data__=new Zd(X)}return z.set(C,S),this.size=z.size,this}Lu.prototype.clear=Ole,Lu.prototype.delete=Lle,Lu.prototype.get=Ble,Lu.prototype.has=Rle,Lu.prototype.set=Nle;function eV(C,S){var z=Qn(C),X=!z&&V_(C),re=!z&&!X&&zp(C),ge=!z&&!X&&!re&&u0(C),we=z||X||re||ge,Pe=we?gO(C.length,qce):[],Ue=Pe.length;for(var ot in C)(S||bo.call(C,ot))&&!(we&&(ot=="length"||re&&(ot=="offset"||ot=="parent")||ge&&(ot=="buffer"||ot=="byteLength"||ot=="byteOffset")||ih(ot,Ue)))&&Pe.push(ot);return Pe}function tV(C){var S=C.length;return S?C[RO(0,S-1)]:n}function Mle(C,S){return Uw(xc(C),F_(S,0,C.length))}function Fle(C){return Uw(xc(C))}function xO(C,S,z){(z!==n&&!Bu(C[S],z)||z===n&&!(S in C))&&eh(C,S,z)}function eC(C,S,z){var X=C[S];(!(bo.call(C,S)&&Bu(X,z))||z===n&&!(S in C))&&eh(C,S,z)}function Sw(C,S){for(var z=C.length;z--;)if(Bu(C[z][0],S))return z;return-1}function zle(C,S,z,X){return Rp(C,function(re,ge,we){S(X,re,z(re),we)}),X}function nV(C,S){return C&&Gf(S,Bs(S),C)}function Ule(C,S){return C&&Gf(S,Sc(S),C)}function eh(C,S,z){S=="__proto__"&&Tw?Tw(C,S,{configurable:!0,enumerable:!0,value:z,writable:!0}):C[S]=z}function wO(C,S){for(var z=-1,X=S.length,re=Ke(X),ge=C==null;++z<X;)re[z]=ge?n:rL(C,S[z]);return re}function F_(C,S,z){return C===C&&(z!==n&&(C=C<=z?C:z),S!==n&&(C=C>=S?C:S)),C}function Ll(C,S,z,X,re,ge){var we,Pe=S&h,Ue=S&_,ot=S&g;if(z&&(we=re?z(C,X,re,ge):z(C)),we!==n)return we;if(!Er(C))return C;var rt=Qn(C);if(rt){if(we=vue(C),!Pe)return xc(C,we)}else{var pt=Aa(C),Ft=pt==ne||pt==ae;if(zp(C))return SV(C,Pe);if(pt==Le||pt==Z||Ft&&!re){if(we=Ue||Ft?{}:qV(C),!Pe)return Ue?_ue(C,Ule(we,C)):mue(C,nV(we,C))}else{if(!Vo[pt])return re?C:{};we=Due(C,pt,Pe)}}ge||(ge=new Lu);var on=ge.get(C);if(on)return on;ge.set(C,we),T4(C)?C.forEach(function(On){we.add(Ll(On,S,z,On,C,ge))}):y4(C)&&C.forEach(function(On,Ei){we.set(Ei,Ll(On,S,z,Ei,C,ge))});var Pn=ot?Ue?qO:WO:Ue?Sc:Bs,ui=rt?n:Pn(C);return Il(ui||C,function(On,Ei){ui&&(Ei=On,On=C[Ei]),eC(we,Ei,Ll(On,S,z,Ei,C,ge))}),we}function Hle(C){var S=Bs(C);return function(z){return iV(z,C,S)}}function iV(C,S,z){var X=z.length;if(C==null)return!X;for(C=Io(C);X--;){var re=z[X],ge=S[re],we=C[re];if(we===n&&!(re in C)||!ge(we))return!1}return!0}function oV(C,S,z){if(typeof C!="function")throw new Pl(s);return aC(function(){C.apply(n,z)},S)}function tC(C,S,z,X){var re=-1,ge=lw,we=!0,Pe=C.length,Ue=[],ot=S.length;if(!Pe)return Ue;z&&(S=cr(S,Gc(z))),X?(ge=fO,we=!1):S.length>=o&&(ge=$T,we=!1,S=new M_(S));e:for(;++re<Pe;){var rt=C[re],pt=z==null?rt:z(rt);if(rt=X||rt!==0?rt:0,we&&pt===pt){for(var Ft=ot;Ft--;)if(S[Ft]===pt)continue e;Ue.push(rt)}else ge(S,pt,X)||Ue.push(rt)}return Ue}var Rp=OV(kf),rV=OV(vO,!0);function Vle(C,S){var z=!0;return Rp(C,function(X,re,ge){return z=!!S(X,re,ge),z}),z}function vw(C,S,z){for(var X=-1,re=C.length;++X<re;){var ge=C[X],we=S(ge);if(we!=null&&(Pe===n?we===we&&!qc(we):z(we,Pe)))var Pe=we,Ue=ge}return Ue}function kle(C,S,z,X){var re=C.length;for(z=ri(z),z<0&&(z=-z>re?0:re+z),X=X===n||X>re?re:ri(X),X<0&&(X+=re),X=z>X?0:b4(X);z<X;)C[z++]=S;return C}function sV(C,S){var z=[];return Rp(C,function(X,re,ge){S(X,re,ge)&&z.push(X)}),z}function ta(C,S,z,X,re){var ge=-1,we=C.length;for(z||(z=Pue),re||(re=[]);++ge<we;){var Pe=C[ge];S>0&&z(Pe)?S>1?ta(Pe,S-1,z,X,re):Op(re,Pe):X||(re[re.length]=Pe)}return re}var SO=LV(),aV=LV(!0);function kf(C,S){return C&&SO(C,S,Bs)}function vO(C,S){return C&&aV(C,S,Bs)}function Dw(C,S){return Pp(S,function(z){return oh(C[z])})}function z_(C,S){S=Mp(S,C);for(var z=0,X=S.length;C!=null&&z<X;)C=C[Wf(S[z++])];return z&&z==X?C:n}function cV(C,S,z){var X=S(C);return Qn(C)?X:Op(X,z(C))}function nc(C){return C==null?C===n?ke:Be:R_&&R_ in Io(C)?xue(C):Fue(C)}function DO(C,S){return C>S}function Gle(C,S){return C!=null&&bo.call(C,S)}function Wle(C,S){return C!=null&&S in Io(C)}function qle(C,S,z){return C>=ya(S,z)&&C<As(S,z)}function IO(C,S,z){for(var X=z?fO:lw,re=C[0].length,ge=C.length,we=ge,Pe=Ke(ge),Ue=1/0,ot=[];we--;){var rt=C[we];we&&S&&(rt=cr(rt,Gc(S))),Ue=ya(rt.length,Ue),Pe[we]=!z&&(S||re>=120&&rt.length>=120)?new M_(we&&rt):n}rt=C[0];var pt=-1,Ft=Pe[0];e:for(;++pt<re&&ot.length<Ue;){var on=rt[pt],Pn=S?S(on):on;if(on=z||on!==0?on:0,!(Ft?$T(Ft,Pn):X(ot,Pn,z))){for(we=ge;--we;){var ui=Pe[we];if(!(ui?$T(ui,Pn):X(C[we],Pn,z)))continue e}Ft&&Ft.push(Pn),ot.push(on)}}return ot}function jle(C,S,z,X){return kf(C,function(re,ge,we){S(X,z(re),ge,we)}),X}function nC(C,S,z){S=Mp(S,C),C=XV(C,S);var X=C==null?C:C[Wf(Rl(S))];return X==null?n:kc(X,C,z)}function lV(C){return Mr(C)&&nc(C)==Z}function Yle(C){return Mr(C)&&nc(C)==Pt}function $le(C){return Mr(C)&&nc(C)==le}function iC(C,S,z,X,re){return C===S?!0:C==null||S==null||!Mr(C)&&!Mr(S)?C!==C&&S!==S:Xle(C,S,z,X,iC,re)}function Xle(C,S,z,X,re,ge){var we=Qn(C),Pe=Qn(S),Ue=we?J:Aa(C),ot=Pe?J:Aa(S);Ue=Ue==Z?Le:Ue,ot=ot==Z?Le:ot;var rt=Ue==Le,pt=ot==Le,Ft=Ue==ot;if(Ft&&zp(C)){if(!zp(S))return!1;we=!0,rt=!1}if(Ft&&!rt)return ge||(ge=new Lu),we||u0(C)?kV(C,S,z,X,re,ge):bue(C,S,Ue,z,X,re,ge);if(!(z&p)){var on=rt&&bo.call(C,"__wrapped__"),Pn=pt&&bo.call(S,"__wrapped__");if(on||Pn){var ui=on?C.value():C,On=Pn?S.value():S;return ge||(ge=new Lu),re(ui,On,z,X,ge)}}return Ft?(ge||(ge=new Lu),Eue(C,S,z,X,re,ge)):!1}function Kle(C){return Mr(C)&&Aa(C)==ye}function PO(C,S,z,X){var re=z.length,ge=re,we=!X;if(C==null)return!ge;for(C=Io(C);re--;){var Pe=z[re];if(we&&Pe[2]?Pe[1]!==C[Pe[0]]:!(Pe[0]in C))return!1}for(;++re<ge;){Pe=z[re];var Ue=Pe[0],ot=C[Ue],rt=Pe[1];if(we&&Pe[2]){if(ot===n&&!(Ue in C))return!1}else{var pt=new Lu;if(X)var Ft=X(ot,rt,Ue,C,S,pt);if(!(Ft===n?iC(rt,ot,p|y,X,pt):Ft))return!1}}return!0}function uV(C){if(!Er(C)||Lue(C))return!1;var S=oh(C)?Kce:Oe;return S.test(H_(C))}function Jle(C){return Mr(C)&&nc(C)==He}function Qle(C){return Mr(C)&&Aa(C)==Me}function Zle(C){return Mr(C)&&qw(C.length)&&!!Yo[nc(C)]}function fV(C){return typeof C=="function"?C:C==null?vc:typeof C=="object"?Qn(C)?pV(C[0],C[1]):hV(C):B4(C)}function OO(C){if(!sC(C))return nle(C);var S=[];for(var z in Io(C))bo.call(C,z)&&z!="constructor"&&S.push(z);return S}function eue(C){if(!Er(C))return Mue(C);var S=sC(C),z=[];for(var X in C)X=="constructor"&&(S||!bo.call(C,X))||z.push(X);return z}function LO(C,S){return C<S}function dV(C,S){var z=-1,X=wc(C)?Ke(C.length):[];return Rp(C,function(re,ge,we){X[++z]=S(re,ge,we)}),X}function hV(C){var S=YO(C);return S.length==1&&S[0][2]?YV(S[0][0],S[0][1]):function(z){return z===C||PO(z,C,S)}}function pV(C,S){return XO(C)&&jV(S)?YV(Wf(C),S):function(z){var X=rL(z,C);return X===n&&X===S?sL(z,C):iC(S,X,p|y)}}function Iw(C,S,z,X,re){C!==S&&SO(S,function(ge,we){if(re||(re=new Lu),Er(ge))tue(C,S,we,z,Iw,X,re);else{var Pe=X?X(JO(C,we),ge,we+"",C,S,re):n;Pe===n&&(Pe=ge),xO(C,we,Pe)}},Sc)}function tue(C,S,z,X,re,ge,we){var Pe=JO(C,z),Ue=JO(S,z),ot=we.get(Ue);if(ot){xO(C,z,ot);return}var rt=ge?ge(Pe,Ue,z+"",C,S,we):n,pt=rt===n;if(pt){var Ft=Qn(Ue),on=!Ft&&zp(Ue),Pn=!Ft&&!on&&u0(Ue);rt=Ue,Ft||on||Pn?Qn(Pe)?rt=Pe:$r(Pe)?rt=xc(Pe):on?(pt=!1,rt=SV(Ue,!0)):Pn?(pt=!1,rt=vV(Ue,!0)):rt=[]:cC(Ue)||V_(Ue)?(rt=Pe,V_(Pe)?rt=E4(Pe):(!Er(Pe)||oh(Pe))&&(rt=qV(Ue))):pt=!1}pt&&(we.set(Ue,rt),re(rt,Ue,X,ge,we),we.delete(Ue)),xO(C,z,rt)}function mV(C,S){var z=C.length;if(z)return S+=S<0?z:0,ih(S,z)?C[S]:n}function _V(C,S,z){S.length?S=cr(S,function(ge){return Qn(ge)?function(we){return z_(we,ge.length===1?ge[0]:ge)}:ge}):S=[vc];var X=-1;S=cr(S,Gc(vn()));var re=dV(C,function(ge,we,Pe){var Ue=cr(S,function(ot){return ot(ge)});return{criteria:Ue,index:++X,value:ge}});return Dce(re,function(ge,we){return pue(ge,we,z)})}function nue(C,S){return gV(C,S,function(z,X){return sL(C,X)})}function gV(C,S,z){for(var X=-1,re=S.length,ge={};++X<re;){var we=S[X],Pe=z_(C,we);z(Pe,we)&&oC(ge,Mp(we,C),Pe)}return ge}function iue(C){return function(S){return z_(S,C)}}function BO(C,S,z,X){var re=X?vce:Zy,ge=-1,we=S.length,Pe=C;for(C===S&&(S=xc(S)),z&&(Pe=cr(C,Gc(z)));++ge<we;)for(var Ue=0,ot=S[ge],rt=z?z(ot):ot;(Ue=re(Pe,rt,Ue,X))>-1;)Pe!==C&&Aw.call(Pe,Ue,1),Aw.call(C,Ue,1);return C}function yV(C,S){for(var z=C?S.length:0,X=z-1;z--;){var re=S[z];if(z==X||re!==ge){var ge=re;ih(re)?Aw.call(C,re,1):FO(C,re)}}return C}function RO(C,S){return C+bw(QH()*(S-C+1))}function oue(C,S,z,X){for(var re=-1,ge=As(Cw((S-C)/(z||1)),0),we=Ke(ge);ge--;)we[X?ge:++re]=C,C+=z;return we}function NO(C,S){var z="";if(!C||S<1||S>q)return z;do S%2&&(z+=C),S=bw(S/2),S&&(C+=C);while(S);return z}function mi(C,S){return QO($V(C,S,vc),C+"")}function rue(C){return tV(f0(C))}function sue(C,S){var z=f0(C);return Uw(z,F_(S,0,z.length))}function oC(C,S,z,X){if(!Er(C))return C;S=Mp(S,C);for(var re=-1,ge=S.length,we=ge-1,Pe=C;Pe!=null&&++re<ge;){var Ue=Wf(S[re]),ot=z;if(Ue==="__proto__"||Ue==="constructor"||Ue==="prototype")return C;if(re!=we){var rt=Pe[Ue];ot=X?X(rt,Ue,Pe):n,ot===n&&(ot=Er(rt)?rt:ih(S[re+1])?[]:{})}eC(Pe,Ue,ot),Pe=Pe[Ue]}return C}var AV=Ew?function(C,S){return Ew.set(C,S),C}:vc,aue=Tw?function(C,S){return Tw(C,"toString",{configurable:!0,enumerable:!1,value:cL(S),writable:!0})}:vc;function cue(C){return Uw(f0(C))}function Bl(C,S,z){var X=-1,re=C.length;S<0&&(S=-S>re?0:re+S),z=z>re?re:z,z<0&&(z+=re),re=S>z?0:z-S>>>0,S>>>=0;for(var ge=Ke(re);++X<re;)ge[X]=C[X+S];return ge}function lue(C,S){var z;return Rp(C,function(X,re,ge){return z=S(X,re,ge),!z}),!!z}function Pw(C,S,z){var X=0,re=C==null?X:C.length;if(typeof S=="number"&&S===S&&re<=se){for(;X<re;){var ge=X+re>>>1,we=C[ge];we!==null&&!qc(we)&&(z?we<=S:we<S)?X=ge+1:re=ge}return re}return MO(C,S,vc,z)}function MO(C,S,z,X){var re=0,ge=C==null?0:C.length;if(ge===0)return 0;S=z(S);for(var we=S!==S,Pe=S===null,Ue=qc(S),ot=S===n;re<ge;){var rt=bw((re+ge)/2),pt=z(C[rt]),Ft=pt!==n,on=pt===null,Pn=pt===pt,ui=qc(pt);if(we)var On=X||Pn;else ot?On=Pn&&(X||Ft):Pe?On=Pn&&Ft&&(X||!on):Ue?On=Pn&&Ft&&!on&&(X||!ui):on||ui?On=!1:On=X?pt<=S:pt<S;On?re=rt+1:ge=rt}return ya(ge,K)}function TV(C,S){for(var z=-1,X=C.length,re=0,ge=[];++z<X;){var we=C[z],Pe=S?S(we):we;if(!z||!Bu(Pe,Ue)){var Ue=Pe;ge[re++]=we===0?0:we}}return ge}function CV(C){return typeof C=="number"?C:qc(C)?j:+C}function Wc(C){if(typeof C=="string")return C;if(Qn(C))return cr(C,Wc)+"";if(qc(C))return ZH?ZH.call(C):"";var S=C+"";return S=="0"&&1/C==-W?"-0":S}function Np(C,S,z){var X=-1,re=lw,ge=C.length,we=!0,Pe=[],Ue=Pe;if(z)we=!1,re=fO;else if(ge>=o){var ot=S?null:Tue(C);if(ot)return fw(ot);we=!1,re=$T,Ue=new M_}else Ue=S?[]:Pe;e:for(;++X<ge;){var rt=C[X],pt=S?S(rt):rt;if(rt=z||rt!==0?rt:0,we&&pt===pt){for(var Ft=Ue.length;Ft--;)if(Ue[Ft]===pt)continue e;S&&Ue.push(pt),Pe.push(rt)}else re(Ue,pt,z)||(Ue!==Pe&&Ue.push(pt),Pe.push(rt))}return Pe}function FO(C,S){return S=Mp(S,C),C=XV(C,S),C==null||delete C[Wf(Rl(S))]}function bV(C,S,z,X){return oC(C,S,z(z_(C,S)),X)}function Ow(C,S,z,X){for(var re=C.length,ge=X?re:-1;(X?ge--:++ge<re)&&S(C[ge],ge,C););return z?Bl(C,X?0:ge,X?ge+1:re):Bl(C,X?ge+1:0,X?re:ge)}function EV(C,S){var z=C;return z instanceof vi&&(z=z.value()),dO(S,function(X,re){return re.func.apply(re.thisArg,Op([X],re.args))},z)}function zO(C,S,z){var X=C.length;if(X<2)return X?Np(C[0]):[];for(var re=-1,ge=Ke(X);++re<X;)for(var we=C[re],Pe=-1;++Pe<X;)Pe!=re&&(ge[re]=tC(ge[re]||we,C[Pe],S,z));return Np(ta(ge,1),S,z)}function xV(C,S,z){for(var X=-1,re=C.length,ge=S.length,we={};++X<re;){var Pe=X<ge?S[X]:n;z(we,C[X],Pe)}return we}function UO(C){return $r(C)?C:[]}function HO(C){return typeof C=="function"?C:vc}function Mp(C,S){return Qn(C)?C:XO(C,S)?[C]:ZV(ho(C))}var uue=mi;function Fp(C,S,z){var X=C.length;return z=z===n?X:z,!S&&z>=X?C:Bl(C,S,z)}var wV=Jce||function(C){return ea.clearTimeout(C)};function SV(C,S){if(S)return C.slice();var z=C.length,X=YH?YH(z):new C.constructor(z);return C.copy(X),X}function VO(C){var S=new C.constructor(C.byteLength);return new gw(S).set(new gw(C)),S}function fue(C,S){var z=S?VO(C.buffer):C.buffer;return new C.constructor(z,C.byteOffset,C.byteLength)}function due(C){var S=new C.constructor(C.source,Rr.exec(C));return S.lastIndex=C.lastIndex,S}function hue(C){return ZT?Io(ZT.call(C)):{}}function vV(C,S){var z=S?VO(C.buffer):C.buffer;return new C.constructor(z,C.byteOffset,C.length)}function DV(C,S){if(C!==S){var z=C!==n,X=C===null,re=C===C,ge=qc(C),we=S!==n,Pe=S===null,Ue=S===S,ot=qc(S);if(!Pe&&!ot&&!ge&&C>S||ge&&we&&Ue&&!Pe&&!ot||X&&we&&Ue||!z&&Ue||!re)return 1;if(!X&&!ge&&!ot&&C<S||ot&&z&&re&&!X&&!ge||Pe&&z&&re||!we&&re||!Ue)return-1}return 0}function pue(C,S,z){for(var X=-1,re=C.criteria,ge=S.criteria,we=re.length,Pe=z.length;++X<we;){var Ue=DV(re[X],ge[X]);if(Ue){if(X>=Pe)return Ue;var ot=z[X];return Ue*(ot=="desc"?-1:1)}}return C.index-S.index}function IV(C,S,z,X){for(var re=-1,ge=C.length,we=z.length,Pe=-1,Ue=S.length,ot=As(ge-we,0),rt=Ke(Ue+ot),pt=!X;++Pe<Ue;)rt[Pe]=S[Pe];for(;++re<we;)(pt||re<ge)&&(rt[z[re]]=C[re]);for(;ot--;)rt[Pe++]=C[re++];return rt}function PV(C,S,z,X){for(var re=-1,ge=C.length,we=-1,Pe=z.length,Ue=-1,ot=S.length,rt=As(ge-Pe,0),pt=Ke(rt+ot),Ft=!X;++re<rt;)pt[re]=C[re];for(var on=re;++Ue<ot;)pt[on+Ue]=S[Ue];for(;++we<Pe;)(Ft||re<ge)&&(pt[on+z[we]]=C[re++]);return pt}function xc(C,S){var z=-1,X=C.length;for(S||(S=Ke(X));++z<X;)S[z]=C[z];return S}function Gf(C,S,z,X){var re=!z;z||(z={});for(var ge=-1,we=S.length;++ge<we;){var Pe=S[ge],Ue=X?X(z[Pe],C[Pe],Pe,z,C):n;Ue===n&&(Ue=C[Pe]),re?eh(z,Pe,Ue):eC(z,Pe,Ue)}return z}function mue(C,S){return Gf(C,$O(C),S)}function _ue(C,S){return Gf(C,GV(C),S)}function Lw(C,S){return function(z,X){var re=Qn(z)?Cce:zle,ge=S?S():{};return re(z,C,vn(X,2),ge)}}function a0(C){return mi(function(S,z){var X=-1,re=z.length,ge=re>1?z[re-1]:n,we=re>2?z[2]:n;for(ge=C.length>3&&typeof ge=="function"?(re--,ge):n,we&&ic(z[0],z[1],we)&&(ge=re<3?n:ge,re=1),S=Io(S);++X<re;){var Pe=z[X];Pe&&C(S,Pe,X,ge)}return S})}function OV(C,S){return function(z,X){if(z==null)return z;if(!wc(z))return C(z,X);for(var re=z.length,ge=S?re:-1,we=Io(z);(S?ge--:++ge<re)&&X(we[ge],ge,we)!==!1;);return z}}function LV(C){return function(S,z,X){for(var re=-1,ge=Io(S),we=X(S),Pe=we.length;Pe--;){var Ue=we[C?Pe:++re];if(z(ge[Ue],Ue,ge)===!1)break}return S}}function gue(C,S,z){var X=S&T,re=rC(C);function ge(){var we=this&&this!==ea&&this instanceof ge?re:C;return we.apply(X?z:this,arguments)}return ge}function BV(C){return function(S){S=ho(S);var z=e0(S)?Ou(S):n,X=z?z[0]:S.charAt(0),re=z?Fp(z,1).join(""):S.slice(1);return X[C]()+re}}function c0(C){return function(S){return dO(O4(P4(S).replace(ace,"")),C,"")}}function rC(C){return function(){var S=arguments;switch(S.length){case 0:return new C;case 1:return new C(S[0]);case 2:return new C(S[0],S[1]);case 3:return new C(S[0],S[1],S[2]);case 4:return new C(S[0],S[1],S[2],S[3]);case 5:return new C(S[0],S[1],S[2],S[3],S[4]);case 6:return new C(S[0],S[1],S[2],S[3],S[4],S[5]);case 7:return new C(S[0],S[1],S[2],S[3],S[4],S[5],S[6])}var z=s0(C.prototype),X=C.apply(z,S);return Er(X)?X:z}}function yue(C,S,z){var X=rC(C);function re(){for(var ge=arguments.length,we=Ke(ge),Pe=ge,Ue=l0(re);Pe--;)we[Pe]=arguments[Pe];var ot=ge<3&&we[0]!==Ue&&we[ge-1]!==Ue?[]:Lp(we,Ue);if(ge-=ot.length,ge<z)return zV(C,S,Bw,re.placeholder,n,we,ot,n,n,z-ge);var rt=this&&this!==ea&&this instanceof re?X:C;return kc(rt,this,we)}return re}function RV(C){return function(S,z,X){var re=Io(S);if(!wc(S)){var ge=vn(z,3);S=Bs(S),z=function(Pe){return ge(re[Pe],Pe,re)}}var we=C(S,z,X);return we>-1?re[ge?S[we]:we]:n}}function NV(C){return nh(function(S){var z=S.length,X=z,re=Ol.prototype.thru;for(C&&S.reverse();X--;){var ge=S[X];if(typeof ge!="function")throw new Pl(s);if(re&&!we&&Fw(ge)=="wrapper")var we=new Ol([],!0)}for(X=we?X:z;++X<z;){ge=S[X];var Pe=Fw(ge),Ue=Pe=="wrapper"?jO(ge):n;Ue&&KO(Ue[0])&&Ue[1]==(V|v|L|M)&&!Ue[4].length&&Ue[9]==1?we=we[Fw(Ue[0])].apply(we,Ue[3]):we=ge.length==1&&KO(ge)?we[Pe]():we.thru(ge)}return function(){var ot=arguments,rt=ot[0];if(we&&ot.length==1&&Qn(rt))return we.plant(rt).value();for(var pt=0,Ft=z?S[pt].apply(this,ot):rt;++pt<z;)Ft=S[pt].call(this,Ft);return Ft}})}function Bw(C,S,z,X,re,ge,we,Pe,Ue,ot){var rt=S&V,pt=S&T,Ft=S&b,on=S&(v|D),Pn=S&H,ui=Ft?n:rC(C);function On(){for(var Ei=arguments.length,Oi=Ke(Ei),jc=Ei;jc--;)Oi[jc]=arguments[jc];if(on)var oc=l0(On),Yc=Pce(Oi,oc);if(X&&(Oi=IV(Oi,X,re,on)),ge&&(Oi=PV(Oi,ge,we,on)),Ei-=Yc,on&&Ei<ot){var Xr=Lp(Oi,oc);return zV(C,S,Bw,On.placeholder,z,Oi,Xr,Pe,Ue,ot-Ei)}var Ru=pt?z:this,sh=Ft?Ru[C]:C;return Ei=Oi.length,Pe?Oi=zue(Oi,Pe):Pn&&Ei>1&&Oi.reverse(),rt&&Ue<Ei&&(Oi.length=Ue),this&&this!==ea&&this instanceof On&&(sh=ui||rC(sh)),sh.apply(Ru,Oi)}return On}function MV(C,S){return function(z,X){return jle(z,C,S(X),{})}}function Rw(C,S){return function(z,X){var re;if(z===n&&X===n)return S;if(z!==n&&(re=z),X!==n){if(re===n)return X;typeof z=="string"||typeof X=="string"?(z=Wc(z),X=Wc(X)):(z=CV(z),X=CV(X)),re=C(z,X)}return re}}function kO(C){return nh(function(S){return S=cr(S,Gc(vn())),mi(function(z){var X=this;return C(S,function(re){return kc(re,X,z)})})})}function Nw(C,S){S=S===n?" ":Wc(S);var z=S.length;if(z<2)return z?NO(S,C):S;var X=NO(S,Cw(C/t0(S)));return e0(S)?Fp(Ou(X),0,C).join(""):X.slice(0,C)}function Aue(C,S,z,X){var re=S&T,ge=rC(C);function we(){for(var Pe=-1,Ue=arguments.length,ot=-1,rt=X.length,pt=Ke(rt+Ue),Ft=this&&this!==ea&&this instanceof we?ge:C;++ot<rt;)pt[ot]=X[ot];for(;Ue--;)pt[ot++]=arguments[++Pe];return kc(Ft,re?z:this,pt)}return we}function FV(C){return function(S,z,X){return X&&typeof X!="number"&&ic(S,z,X)&&(z=X=n),S=rh(S),z===n?(z=S,S=0):z=rh(z),X=X===n?S<z?1:-1:rh(X),oue(S,z,X,C)}}function Mw(C){return function(S,z){return typeof S=="string"&&typeof z=="string"||(S=Nl(S),z=Nl(z)),C(S,z)}}function zV(C,S,z,X,re,ge,we,Pe,Ue,ot){var rt=S&v,pt=rt?we:n,Ft=rt?n:we,on=rt?ge:n,Pn=rt?n:ge;S|=rt?L:B,S&=~(rt?B:L),S&x||(S&=~(T|b));var ui=[C,S,re,on,pt,Pn,Ft,Pe,Ue,ot],On=z.apply(n,ui);return KO(C)&&KV(On,ui),On.placeholder=X,JV(On,C,S)}function GO(C){var S=ys[C];return function(z,X){if(z=Nl(z),X=X==null?0:ya(ri(X),292),X&&JH(z)){var re=(ho(z)+"e").split("e"),ge=S(re[0]+"e"+(+re[1]+X));return re=(ho(ge)+"e").split("e"),+(re[0]+"e"+(+re[1]-X))}return S(z)}}var Tue=o0&&1/fw(new o0([,-0]))[1]==W?function(C){return new o0(C)}:fL;function UV(C){return function(S){var z=Aa(S);return z==ye?AO(S):z==Me?Fce(S):Ice(S,C(S))}}function th(C,S,z,X,re,ge,we,Pe){var Ue=S&b;if(!Ue&&typeof C!="function")throw new Pl(s);var ot=X?X.length:0;if(ot||(S&=~(L|B),X=re=n),we=we===n?we:As(ri(we),0),Pe=Pe===n?Pe:ri(Pe),ot-=re?re.length:0,S&B){var rt=X,pt=re;X=re=n}var Ft=Ue?n:jO(C),on=[C,S,z,X,re,rt,pt,ge,we,Pe];if(Ft&&Nue(on,Ft),C=on[0],S=on[1],z=on[2],X=on[3],re=on[4],Pe=on[9]=on[9]===n?Ue?0:C.length:As(on[9]-ot,0),!Pe&&S&(v|D)&&(S&=~(v|D)),!S||S==T)var Pn=gue(C,S,z);else S==v||S==D?Pn=yue(C,S,Pe):(S==L||S==(T|L))&&!re.length?Pn=Aue(C,S,z,X):Pn=Bw.apply(n,on);var ui=Ft?AV:KV;return JV(ui(Pn,on),C,S)}function HV(C,S,z,X){return C===n||Bu(C,i0[z])&&!bo.call(X,z)?S:C}function VV(C,S,z,X,re,ge){return Er(C)&&Er(S)&&(ge.set(S,C),Iw(C,S,n,VV,ge),ge.delete(S)),C}function Cue(C){return cC(C)?n:C}function kV(C,S,z,X,re,ge){var we=z&p,Pe=C.length,Ue=S.length;if(Pe!=Ue&&!(we&&Ue>Pe))return!1;var ot=ge.get(C),rt=ge.get(S);if(ot&&rt)return ot==S&&rt==C;var pt=-1,Ft=!0,on=z&y?new M_:n;for(ge.set(C,S),ge.set(S,C);++pt<Pe;){var Pn=C[pt],ui=S[pt];if(X)var On=we?X(ui,Pn,pt,S,C,ge):X(Pn,ui,pt,C,S,ge);if(On!==n){if(On)continue;Ft=!1;break}if(on){if(!hO(S,function(Ei,Oi){if(!$T(on,Oi)&&(Pn===Ei||re(Pn,Ei,z,X,ge)))return on.push(Oi)})){Ft=!1;break}}else if(!(Pn===ui||re(Pn,ui,z,X,ge))){Ft=!1;break}}return ge.delete(C),ge.delete(S),Ft}function bue(C,S,z,X,re,ge,we){switch(z){case Lt:if(C.byteLength!=S.byteLength||C.byteOffset!=S.byteOffset)return!1;C=C.buffer,S=S.buffer;case Pt:return!(C.byteLength!=S.byteLength||!ge(new gw(C),new gw(S)));case _e:case le:case Ce:return Bu(+C,+S);case pe:return C.name==S.name&&C.message==S.message;case He:case qe:return C==S+"";case ye:var Pe=AO;case Me:var Ue=X&p;if(Pe||(Pe=fw),C.size!=S.size&&!Ue)return!1;var ot=we.get(C);if(ot)return ot==S;X|=y,we.set(C,S);var rt=kV(Pe(C),Pe(S),X,re,ge,we);return we.delete(C),rt;case Ne:if(ZT)return ZT.call(C)==ZT.call(S)}return!1}function Eue(C,S,z,X,re,ge){var we=z&p,Pe=WO(C),Ue=Pe.length,ot=WO(S),rt=ot.length;if(Ue!=rt&&!we)return!1;for(var pt=Ue;pt--;){var Ft=Pe[pt];if(!(we?Ft in S:bo.call(S,Ft)))return!1}var on=ge.get(C),Pn=ge.get(S);if(on&&Pn)return on==S&&Pn==C;var ui=!0;ge.set(C,S),ge.set(S,C);for(var On=we;++pt<Ue;){Ft=Pe[pt];var Ei=C[Ft],Oi=S[Ft];if(X)var jc=we?X(Oi,Ei,Ft,S,C,ge):X(Ei,Oi,Ft,C,S,ge);if(!(jc===n?Ei===Oi||re(Ei,Oi,z,X,ge):jc)){ui=!1;break}On||(On=Ft=="constructor")}if(ui&&!On){var oc=C.constructor,Yc=S.constructor;oc!=Yc&&"constructor"in C&&"constructor"in S&&!(typeof oc=="function"&&oc instanceof oc&&typeof Yc=="function"&&Yc instanceof Yc)&&(ui=!1)}return ge.delete(C),ge.delete(S),ui}function nh(C){return QO($V(C,n,i4),C+"")}function WO(C){return cV(C,Bs,$O)}function qO(C){return cV(C,Sc,GV)}var jO=Ew?function(C){return Ew.get(C)}:fL;function Fw(C){for(var S=C.name+"",z=r0[S],X=bo.call(r0,S)?z.length:0;X--;){var re=z[X],ge=re.func;if(ge==null||ge==C)return re.name}return S}function l0(C){var S=bo.call(he,"placeholder")?he:C;return S.placeholder}function vn(){var C=he.iteratee||lL;return C=C===lL?fV:C,arguments.length?C(arguments[0],arguments[1]):C}function zw(C,S){var z=C.__data__;return Oue(S)?z[typeof S=="string"?"string":"hash"]:z.map}function YO(C){for(var S=Bs(C),z=S.length;z--;){var X=S[z],re=C[X];S[z]=[X,re,jV(re)]}return S}function U_(C,S){var z=Rce(C,S);return uV(z)?z:n}function xue(C){var S=bo.call(C,R_),z=C[R_];try{C[R_]=n;var X=!0}catch{}var re=mw.call(C);return X&&(S?C[R_]=z:delete C[R_]),re}var $O=CO?function(C){return C==null?[]:(C=Io(C),Pp(CO(C),function(S){return XH.call(C,S)}))}:dL,GV=CO?function(C){for(var S=[];C;)Op(S,$O(C)),C=yw(C);return S}:dL,Aa=nc;(bO&&Aa(new bO(new ArrayBuffer(1)))!=Lt||KT&&Aa(new KT)!=ye||EO&&Aa(EO.resolve())!=Ve||o0&&Aa(new o0)!=Me||JT&&Aa(new JT)!=Qe)&&(Aa=function(C){var S=nc(C),z=S==Le?C.constructor:n,X=z?H_(z):"";if(X)switch(X){case sle:return Lt;case ale:return ye;case cle:return Ve;case lle:return Me;case ule:return Qe}return S});function wue(C,S,z){for(var X=-1,re=z.length;++X<re;){var ge=z[X],we=ge.size;switch(ge.type){case"drop":C+=we;break;case"dropRight":S-=we;break;case"take":S=ya(S,C+we);break;case"takeRight":C=As(C,S-we);break}}return{start:C,end:S}}function Sue(C){var S=C.match(Ki);return S?S[1].split(zo):[]}function WV(C,S,z){S=Mp(S,C);for(var X=-1,re=S.length,ge=!1;++X<re;){var we=Wf(S[X]);if(!(ge=C!=null&&z(C,we)))break;C=C[we]}return ge||++X!=re?ge:(re=C==null?0:C.length,!!re&&qw(re)&&ih(we,re)&&(Qn(C)||V_(C)))}function vue(C){var S=C.length,z=new C.constructor(S);return S&&typeof C[0]=="string"&&bo.call(C,"index")&&(z.index=C.index,z.input=C.input),z}function qV(C){return typeof C.constructor=="function"&&!sC(C)?s0(yw(C)):{}}function Due(C,S,z){var X=C.constructor;switch(S){case Pt:return VO(C);case _e:case le:return new X(+C);case Lt:return fue(C,z);case qt:case zn:case Gn:case Dn:case hn:case jt:case In:case Rn:case Jt:return vV(C,z);case ye:return new X;case Ce:case qe:return new X(C);case He:return due(C);case Me:return new X;case Ne:return hue(C)}}function Iue(C,S){var z=S.length;if(!z)return C;var X=z-1;return S[X]=(z>1?"& ":"")+S[X],S=S.join(z>2?", ":" "),C.replace(jn,`{
|
||
/* [wrapped with `+S+`] */
|
||
`)}function Pue(C){return Qn(C)||V_(C)||!!(KH&&C&&C[KH])}function ih(C,S){var z=typeof C;return S=S??q,!!S&&(z=="number"||z!="symbol"&>.test(C))&&C>-1&&C%1==0&&C<S}function ic(C,S,z){if(!Er(z))return!1;var X=typeof S;return(X=="number"?wc(z)&&ih(S,z.length):X=="string"&&S in z)?Bu(z[S],C):!1}function XO(C,S){if(Qn(C))return!1;var z=typeof C;return z=="number"||z=="symbol"||z=="boolean"||C==null||qc(C)?!0:Tn.test(C)||!Jn.test(C)||S!=null&&C in Io(S)}function Oue(C){var S=typeof C;return S=="string"||S=="number"||S=="symbol"||S=="boolean"?C!=="__proto__":C===null}function KO(C){var S=Fw(C),z=he[S];if(typeof z!="function"||!(S in vi.prototype))return!1;if(C===z)return!0;var X=jO(z);return!!X&&C===X[0]}function Lue(C){return!!jH&&jH in C}var Bue=hw?oh:hL;function sC(C){var S=C&&C.constructor,z=typeof S=="function"&&S.prototype||i0;return C===z}function jV(C){return C===C&&!Er(C)}function YV(C,S){return function(z){return z==null?!1:z[C]===S&&(S!==n||C in Io(z))}}function Rue(C){var S=Gw(C,function(X){return z.size===u&&z.clear(),X}),z=S.cache;return S}function Nue(C,S){var z=C[1],X=S[1],re=z|X,ge=re<(T|b|V),we=X==V&&z==v||X==V&&z==M&&C[7].length<=S[8]||X==(V|M)&&S[7].length<=S[8]&&z==v;if(!(ge||we))return C;X&T&&(C[2]=S[2],re|=z&T?0:x);var Pe=S[3];if(Pe){var Ue=C[3];C[3]=Ue?IV(Ue,Pe,S[4]):Pe,C[4]=Ue?Lp(C[3],f):S[4]}return Pe=S[5],Pe&&(Ue=C[5],C[5]=Ue?PV(Ue,Pe,S[6]):Pe,C[6]=Ue?Lp(C[5],f):S[6]),Pe=S[7],Pe&&(C[7]=Pe),X&V&&(C[8]=C[8]==null?S[8]:ya(C[8],S[8])),C[9]==null&&(C[9]=S[9]),C[0]=S[0],C[1]=re,C}function Mue(C){var S=[];if(C!=null)for(var z in Io(C))S.push(z);return S}function Fue(C){return mw.call(C)}function $V(C,S,z){return S=As(S===n?C.length-1:S,0),function(){for(var X=arguments,re=-1,ge=As(X.length-S,0),we=Ke(ge);++re<ge;)we[re]=X[S+re];re=-1;for(var Pe=Ke(S+1);++re<S;)Pe[re]=X[re];return Pe[S]=z(we),kc(C,this,Pe)}}function XV(C,S){return S.length<2?C:z_(C,Bl(S,0,-1))}function zue(C,S){for(var z=C.length,X=ya(S.length,z),re=xc(C);X--;){var ge=S[X];C[X]=ih(ge,z)?re[ge]:n}return C}function JO(C,S){if(!(S==="constructor"&&typeof C[S]=="function")&&S!="__proto__")return C[S]}var KV=QV(AV),aC=Zce||function(C,S){return ea.setTimeout(C,S)},QO=QV(aue);function JV(C,S,z){var X=S+"";return QO(C,Iue(X,Uue(Sue(X),z)))}function QV(C){var S=0,z=0;return function(){var X=ile(),re=m-(X-z);if(z=X,re>0){if(++S>=O)return arguments[0]}else S=0;return C.apply(n,arguments)}}function Uw(C,S){var z=-1,X=C.length,re=X-1;for(S=S===n?X:S;++z<S;){var ge=RO(z,re),we=C[ge];C[ge]=C[z],C[z]=we}return C.length=S,C}var ZV=Rue(function(C){var S=[];return C.charCodeAt(0)===46&&S.push(""),C.replace(Rt,function(z,X,re,ge){S.push(re?ge.replace(ro,"$1"):X||z)}),S});function Wf(C){if(typeof C=="string"||qc(C))return C;var S=C+"";return S=="0"&&1/C==-W?"-0":S}function H_(C){if(C!=null){try{return pw.call(C)}catch{}try{return C+""}catch{}}return""}function Uue(C,S){return Il(Q,function(z){var X="_."+z[0];S&z[1]&&!lw(C,X)&&C.push(X)}),C.sort()}function e4(C){if(C instanceof vi)return C.clone();var S=new Ol(C.__wrapped__,C.__chain__);return S.__actions__=xc(C.__actions__),S.__index__=C.__index__,S.__values__=C.__values__,S}function Hue(C,S,z){(z?ic(C,S,z):S===n)?S=1:S=As(ri(S),0);var X=C==null?0:C.length;if(!X||S<1)return[];for(var re=0,ge=0,we=Ke(Cw(X/S));re<X;)we[ge++]=Bl(C,re,re+=S);return we}function Vue(C){for(var S=-1,z=C==null?0:C.length,X=0,re=[];++S<z;){var ge=C[S];ge&&(re[X++]=ge)}return re}function kue(){var C=arguments.length;if(!C)return[];for(var S=Ke(C-1),z=arguments[0],X=C;X--;)S[X-1]=arguments[X];return Op(Qn(z)?xc(z):[z],ta(S,1))}var Gue=mi(function(C,S){return $r(C)?tC(C,ta(S,1,$r,!0)):[]}),Wue=mi(function(C,S){var z=Rl(S);return $r(z)&&(z=n),$r(C)?tC(C,ta(S,1,$r,!0),vn(z,2)):[]}),que=mi(function(C,S){var z=Rl(S);return $r(z)&&(z=n),$r(C)?tC(C,ta(S,1,$r,!0),n,z):[]});function jue(C,S,z){var X=C==null?0:C.length;return X?(S=z||S===n?1:ri(S),Bl(C,S<0?0:S,X)):[]}function Yue(C,S,z){var X=C==null?0:C.length;return X?(S=z||S===n?1:ri(S),S=X-S,Bl(C,0,S<0?0:S)):[]}function $ue(C,S){return C&&C.length?Ow(C,vn(S,3),!0,!0):[]}function Xue(C,S){return C&&C.length?Ow(C,vn(S,3),!0):[]}function Kue(C,S,z,X){var re=C==null?0:C.length;return re?(z&&typeof z!="number"&&ic(C,S,z)&&(z=0,X=re),kle(C,S,z,X)):[]}function t4(C,S,z){var X=C==null?0:C.length;if(!X)return-1;var re=z==null?0:ri(z);return re<0&&(re=As(X+re,0)),uw(C,vn(S,3),re)}function n4(C,S,z){var X=C==null?0:C.length;if(!X)return-1;var re=X-1;return z!==n&&(re=ri(z),re=z<0?As(X+re,0):ya(re,X-1)),uw(C,vn(S,3),re,!0)}function i4(C){var S=C==null?0:C.length;return S?ta(C,1):[]}function Jue(C){var S=C==null?0:C.length;return S?ta(C,W):[]}function Que(C,S){var z=C==null?0:C.length;return z?(S=S===n?1:ri(S),ta(C,S)):[]}function Zue(C){for(var S=-1,z=C==null?0:C.length,X={};++S<z;){var re=C[S];X[re[0]]=re[1]}return X}function o4(C){return C&&C.length?C[0]:n}function efe(C,S,z){var X=C==null?0:C.length;if(!X)return-1;var re=z==null?0:ri(z);return re<0&&(re=As(X+re,0)),Zy(C,S,re)}function tfe(C){var S=C==null?0:C.length;return S?Bl(C,0,-1):[]}var nfe=mi(function(C){var S=cr(C,UO);return S.length&&S[0]===C[0]?IO(S):[]}),ife=mi(function(C){var S=Rl(C),z=cr(C,UO);return S===Rl(z)?S=n:z.pop(),z.length&&z[0]===C[0]?IO(z,vn(S,2)):[]}),ofe=mi(function(C){var S=Rl(C),z=cr(C,UO);return S=typeof S=="function"?S:n,S&&z.pop(),z.length&&z[0]===C[0]?IO(z,n,S):[]});function rfe(C,S){return C==null?"":tle.call(C,S)}function Rl(C){var S=C==null?0:C.length;return S?C[S-1]:n}function sfe(C,S,z){var X=C==null?0:C.length;if(!X)return-1;var re=X;return z!==n&&(re=ri(z),re=re<0?As(X+re,0):ya(re,X-1)),S===S?Uce(C,S,re):uw(C,zH,re,!0)}function afe(C,S){return C&&C.length?mV(C,ri(S)):n}var cfe=mi(r4);function r4(C,S){return C&&C.length&&S&&S.length?BO(C,S):C}function lfe(C,S,z){return C&&C.length&&S&&S.length?BO(C,S,vn(z,2)):C}function ufe(C,S,z){return C&&C.length&&S&&S.length?BO(C,S,n,z):C}var ffe=nh(function(C,S){var z=C==null?0:C.length,X=wO(C,S);return yV(C,cr(S,function(re){return ih(re,z)?+re:re}).sort(DV)),X});function dfe(C,S){var z=[];if(!(C&&C.length))return z;var X=-1,re=[],ge=C.length;for(S=vn(S,3);++X<ge;){var we=C[X];S(we,X,C)&&(z.push(we),re.push(X))}return yV(C,re),z}function ZO(C){return C==null?C:rle.call(C)}function hfe(C,S,z){var X=C==null?0:C.length;return X?(z&&typeof z!="number"&&ic(C,S,z)?(S=0,z=X):(S=S==null?0:ri(S),z=z===n?X:ri(z)),Bl(C,S,z)):[]}function pfe(C,S){return Pw(C,S)}function mfe(C,S,z){return MO(C,S,vn(z,2))}function _fe(C,S){var z=C==null?0:C.length;if(z){var X=Pw(C,S);if(X<z&&Bu(C[X],S))return X}return-1}function gfe(C,S){return Pw(C,S,!0)}function yfe(C,S,z){return MO(C,S,vn(z,2),!0)}function Afe(C,S){var z=C==null?0:C.length;if(z){var X=Pw(C,S,!0)-1;if(Bu(C[X],S))return X}return-1}function Tfe(C){return C&&C.length?TV(C):[]}function Cfe(C,S){return C&&C.length?TV(C,vn(S,2)):[]}function bfe(C){var S=C==null?0:C.length;return S?Bl(C,1,S):[]}function Efe(C,S,z){return C&&C.length?(S=z||S===n?1:ri(S),Bl(C,0,S<0?0:S)):[]}function xfe(C,S,z){var X=C==null?0:C.length;return X?(S=z||S===n?1:ri(S),S=X-S,Bl(C,S<0?0:S,X)):[]}function wfe(C,S){return C&&C.length?Ow(C,vn(S,3),!1,!0):[]}function Sfe(C,S){return C&&C.length?Ow(C,vn(S,3)):[]}var vfe=mi(function(C){return Np(ta(C,1,$r,!0))}),Dfe=mi(function(C){var S=Rl(C);return $r(S)&&(S=n),Np(ta(C,1,$r,!0),vn(S,2))}),Ife=mi(function(C){var S=Rl(C);return S=typeof S=="function"?S:n,Np(ta(C,1,$r,!0),n,S)});function Pfe(C){return C&&C.length?Np(C):[]}function Ofe(C,S){return C&&C.length?Np(C,vn(S,2)):[]}function Lfe(C,S){return S=typeof S=="function"?S:n,C&&C.length?Np(C,n,S):[]}function eL(C){if(!(C&&C.length))return[];var S=0;return C=Pp(C,function(z){if($r(z))return S=As(z.length,S),!0}),gO(S,function(z){return cr(C,pO(z))})}function s4(C,S){if(!(C&&C.length))return[];var z=eL(C);return S==null?z:cr(z,function(X){return kc(S,n,X)})}var Bfe=mi(function(C,S){return $r(C)?tC(C,S):[]}),Rfe=mi(function(C){return zO(Pp(C,$r))}),Nfe=mi(function(C){var S=Rl(C);return $r(S)&&(S=n),zO(Pp(C,$r),vn(S,2))}),Mfe=mi(function(C){var S=Rl(C);return S=typeof S=="function"?S:n,zO(Pp(C,$r),n,S)}),Ffe=mi(eL);function zfe(C,S){return xV(C||[],S||[],eC)}function Ufe(C,S){return xV(C||[],S||[],oC)}var Hfe=mi(function(C){var S=C.length,z=S>1?C[S-1]:n;return z=typeof z=="function"?(C.pop(),z):n,s4(C,z)});function a4(C){var S=he(C);return S.__chain__=!0,S}function Vfe(C,S){return S(C),C}function Hw(C,S){return S(C)}var kfe=nh(function(C){var S=C.length,z=S?C[0]:0,X=this.__wrapped__,re=function(ge){return wO(ge,C)};return S>1||this.__actions__.length||!(X instanceof vi)||!ih(z)?this.thru(re):(X=X.slice(z,+z+(S?1:0)),X.__actions__.push({func:Hw,args:[re],thisArg:n}),new Ol(X,this.__chain__).thru(function(ge){return S&&!ge.length&&ge.push(n),ge}))});function Gfe(){return a4(this)}function Wfe(){return new Ol(this.value(),this.__chain__)}function qfe(){this.__values__===n&&(this.__values__=C4(this.value()));var C=this.__index__>=this.__values__.length,S=C?n:this.__values__[this.__index__++];return{done:C,value:S}}function jfe(){return this}function Yfe(C){for(var S,z=this;z instanceof ww;){var X=e4(z);X.__index__=0,X.__values__=n,S?re.__wrapped__=X:S=X;var re=X;z=z.__wrapped__}return re.__wrapped__=C,S}function $fe(){var C=this.__wrapped__;if(C instanceof vi){var S=C;return this.__actions__.length&&(S=new vi(this)),S=S.reverse(),S.__actions__.push({func:Hw,args:[ZO],thisArg:n}),new Ol(S,this.__chain__)}return this.thru(ZO)}function Xfe(){return EV(this.__wrapped__,this.__actions__)}var Kfe=Lw(function(C,S,z){bo.call(C,z)?++C[z]:eh(C,z,1)});function Jfe(C,S,z){var X=Qn(C)?MH:Vle;return z&&ic(C,S,z)&&(S=n),X(C,vn(S,3))}function Qfe(C,S){var z=Qn(C)?Pp:sV;return z(C,vn(S,3))}var Zfe=RV(t4),ede=RV(n4);function tde(C,S){return ta(Vw(C,S),1)}function nde(C,S){return ta(Vw(C,S),W)}function ide(C,S,z){return z=z===n?1:ri(z),ta(Vw(C,S),z)}function c4(C,S){var z=Qn(C)?Il:Rp;return z(C,vn(S,3))}function l4(C,S){var z=Qn(C)?bce:rV;return z(C,vn(S,3))}var ode=Lw(function(C,S,z){bo.call(C,z)?C[z].push(S):eh(C,z,[S])});function rde(C,S,z,X){C=wc(C)?C:f0(C),z=z&&!X?ri(z):0;var re=C.length;return z<0&&(z=As(re+z,0)),jw(C)?z<=re&&C.indexOf(S,z)>-1:!!re&&Zy(C,S,z)>-1}var sde=mi(function(C,S,z){var X=-1,re=typeof S=="function",ge=wc(C)?Ke(C.length):[];return Rp(C,function(we){ge[++X]=re?kc(S,we,z):nC(we,S,z)}),ge}),ade=Lw(function(C,S,z){eh(C,z,S)});function Vw(C,S){var z=Qn(C)?cr:dV;return z(C,vn(S,3))}function cde(C,S,z,X){return C==null?[]:(Qn(S)||(S=S==null?[]:[S]),z=X?n:z,Qn(z)||(z=z==null?[]:[z]),_V(C,S,z))}var lde=Lw(function(C,S,z){C[z?0:1].push(S)},function(){return[[],[]]});function ude(C,S,z){var X=Qn(C)?dO:HH,re=arguments.length<3;return X(C,vn(S,4),z,re,Rp)}function fde(C,S,z){var X=Qn(C)?Ece:HH,re=arguments.length<3;return X(C,vn(S,4),z,re,rV)}function dde(C,S){var z=Qn(C)?Pp:sV;return z(C,Ww(vn(S,3)))}function hde(C){var S=Qn(C)?tV:rue;return S(C)}function pde(C,S,z){(z?ic(C,S,z):S===n)?S=1:S=ri(S);var X=Qn(C)?Mle:sue;return X(C,S)}function mde(C){var S=Qn(C)?Fle:cue;return S(C)}function _de(C){if(C==null)return 0;if(wc(C))return jw(C)?t0(C):C.length;var S=Aa(C);return S==ye||S==Me?C.size:OO(C).length}function gde(C,S,z){var X=Qn(C)?hO:lue;return z&&ic(C,S,z)&&(S=n),X(C,vn(S,3))}var yde=mi(function(C,S){if(C==null)return[];var z=S.length;return z>1&&ic(C,S[0],S[1])?S=[]:z>2&&ic(S[0],S[1],S[2])&&(S=[S[0]]),_V(C,ta(S,1),[])}),kw=Qce||function(){return ea.Date.now()};function Ade(C,S){if(typeof S!="function")throw new Pl(s);return C=ri(C),function(){if(--C<1)return S.apply(this,arguments)}}function u4(C,S,z){return S=z?n:S,S=C&&S==null?C.length:S,th(C,V,n,n,n,n,S)}function f4(C,S){var z;if(typeof S!="function")throw new Pl(s);return C=ri(C),function(){return--C>0&&(z=S.apply(this,arguments)),C<=1&&(S=n),z}}var tL=mi(function(C,S,z){var X=T;if(z.length){var re=Lp(z,l0(tL));X|=L}return th(C,X,S,z,re)}),d4=mi(function(C,S,z){var X=T|b;if(z.length){var re=Lp(z,l0(d4));X|=L}return th(S,X,C,z,re)});function h4(C,S,z){S=z?n:S;var X=th(C,v,n,n,n,n,n,S);return X.placeholder=h4.placeholder,X}function p4(C,S,z){S=z?n:S;var X=th(C,D,n,n,n,n,n,S);return X.placeholder=p4.placeholder,X}function m4(C,S,z){var X,re,ge,we,Pe,Ue,ot=0,rt=!1,pt=!1,Ft=!0;if(typeof C!="function")throw new Pl(s);S=Nl(S)||0,Er(z)&&(rt=!!z.leading,pt="maxWait"in z,ge=pt?As(Nl(z.maxWait)||0,S):ge,Ft="trailing"in z?!!z.trailing:Ft);function on(Xr){var Ru=X,sh=re;return X=re=n,ot=Xr,we=C.apply(sh,Ru),we}function Pn(Xr){return ot=Xr,Pe=aC(Ei,S),rt?on(Xr):we}function ui(Xr){var Ru=Xr-Ue,sh=Xr-ot,R4=S-Ru;return pt?ya(R4,ge-sh):R4}function On(Xr){var Ru=Xr-Ue,sh=Xr-ot;return Ue===n||Ru>=S||Ru<0||pt&&sh>=ge}function Ei(){var Xr=kw();if(On(Xr))return Oi(Xr);Pe=aC(Ei,ui(Xr))}function Oi(Xr){return Pe=n,Ft&&X?on(Xr):(X=re=n,we)}function jc(){Pe!==n&&wV(Pe),ot=0,X=Ue=re=Pe=n}function oc(){return Pe===n?we:Oi(kw())}function Yc(){var Xr=kw(),Ru=On(Xr);if(X=arguments,re=this,Ue=Xr,Ru){if(Pe===n)return Pn(Ue);if(pt)return wV(Pe),Pe=aC(Ei,S),on(Ue)}return Pe===n&&(Pe=aC(Ei,S)),we}return Yc.cancel=jc,Yc.flush=oc,Yc}var Tde=mi(function(C,S){return oV(C,1,S)}),Cde=mi(function(C,S,z){return oV(C,Nl(S)||0,z)});function bde(C){return th(C,H)}function Gw(C,S){if(typeof C!="function"||S!=null&&typeof S!="function")throw new Pl(s);var z=function(){var X=arguments,re=S?S.apply(this,X):X[0],ge=z.cache;if(ge.has(re))return ge.get(re);var we=C.apply(this,X);return z.cache=ge.set(re,we)||ge,we};return z.cache=new(Gw.Cache||Zd),z}Gw.Cache=Zd;function Ww(C){if(typeof C!="function")throw new Pl(s);return function(){var S=arguments;switch(S.length){case 0:return!C.call(this);case 1:return!C.call(this,S[0]);case 2:return!C.call(this,S[0],S[1]);case 3:return!C.call(this,S[0],S[1],S[2])}return!C.apply(this,S)}}function Ede(C){return f4(2,C)}var xde=uue(function(C,S){S=S.length==1&&Qn(S[0])?cr(S[0],Gc(vn())):cr(ta(S,1),Gc(vn()));var z=S.length;return mi(function(X){for(var re=-1,ge=ya(X.length,z);++re<ge;)X[re]=S[re].call(this,X[re]);return kc(C,this,X)})}),nL=mi(function(C,S){var z=Lp(S,l0(nL));return th(C,L,n,S,z)}),_4=mi(function(C,S){var z=Lp(S,l0(_4));return th(C,B,n,S,z)}),wde=nh(function(C,S){return th(C,M,n,n,n,S)});function Sde(C,S){if(typeof C!="function")throw new Pl(s);return S=S===n?S:ri(S),mi(C,S)}function vde(C,S){if(typeof C!="function")throw new Pl(s);return S=S==null?0:As(ri(S),0),mi(function(z){var X=z[S],re=Fp(z,0,S);return X&&Op(re,X),kc(C,this,re)})}function Dde(C,S,z){var X=!0,re=!0;if(typeof C!="function")throw new Pl(s);return Er(z)&&(X="leading"in z?!!z.leading:X,re="trailing"in z?!!z.trailing:re),m4(C,S,{leading:X,maxWait:S,trailing:re})}function Ide(C){return u4(C,1)}function Pde(C,S){return nL(HO(S),C)}function Ode(){if(!arguments.length)return[];var C=arguments[0];return Qn(C)?C:[C]}function Lde(C){return Ll(C,g)}function Bde(C,S){return S=typeof S=="function"?S:n,Ll(C,g,S)}function Rde(C){return Ll(C,h|g)}function Nde(C,S){return S=typeof S=="function"?S:n,Ll(C,h|g,S)}function Mde(C,S){return S==null||iV(C,S,Bs(S))}function Bu(C,S){return C===S||C!==C&&S!==S}var Fde=Mw(DO),zde=Mw(function(C,S){return C>=S}),V_=lV(function(){return arguments}())?lV:function(C){return Mr(C)&&bo.call(C,"callee")&&!XH.call(C,"callee")},Qn=Ke.isArray,Ude=PH?Gc(PH):Yle;function wc(C){return C!=null&&qw(C.length)&&!oh(C)}function $r(C){return Mr(C)&&wc(C)}function Hde(C){return C===!0||C===!1||Mr(C)&&nc(C)==_e}var zp=ele||hL,Vde=OH?Gc(OH):$le;function kde(C){return Mr(C)&&C.nodeType===1&&!cC(C)}function Gde(C){if(C==null)return!0;if(wc(C)&&(Qn(C)||typeof C=="string"||typeof C.splice=="function"||zp(C)||u0(C)||V_(C)))return!C.length;var S=Aa(C);if(S==ye||S==Me)return!C.size;if(sC(C))return!OO(C).length;for(var z in C)if(bo.call(C,z))return!1;return!0}function Wde(C,S){return iC(C,S)}function qde(C,S,z){z=typeof z=="function"?z:n;var X=z?z(C,S):n;return X===n?iC(C,S,n,z):!!X}function iL(C){if(!Mr(C))return!1;var S=nc(C);return S==pe||S==Te||typeof C.message=="string"&&typeof C.name=="string"&&!cC(C)}function jde(C){return typeof C=="number"&&JH(C)}function oh(C){if(!Er(C))return!1;var S=nc(C);return S==ne||S==ae||S==de||S==Ie}function g4(C){return typeof C=="number"&&C==ri(C)}function qw(C){return typeof C=="number"&&C>-1&&C%1==0&&C<=q}function Er(C){var S=typeof C;return C!=null&&(S=="object"||S=="function")}function Mr(C){return C!=null&&typeof C=="object"}var y4=LH?Gc(LH):Kle;function Yde(C,S){return C===S||PO(C,S,YO(S))}function $de(C,S,z){return z=typeof z=="function"?z:n,PO(C,S,YO(S),z)}function Xde(C){return A4(C)&&C!=+C}function Kde(C){if(Bue(C))throw new Yn(r);return uV(C)}function Jde(C){return C===null}function Qde(C){return C==null}function A4(C){return typeof C=="number"||Mr(C)&&nc(C)==Ce}function cC(C){if(!Mr(C)||nc(C)!=Le)return!1;var S=yw(C);if(S===null)return!0;var z=bo.call(S,"constructor")&&S.constructor;return typeof z=="function"&&z instanceof z&&pw.call(z)==$ce}var oL=BH?Gc(BH):Jle;function Zde(C){return g4(C)&&C>=-q&&C<=q}var T4=RH?Gc(RH):Qle;function jw(C){return typeof C=="string"||!Qn(C)&&Mr(C)&&nc(C)==qe}function qc(C){return typeof C=="symbol"||Mr(C)&&nc(C)==Ne}var u0=NH?Gc(NH):Zle;function ehe(C){return C===n}function the(C){return Mr(C)&&Aa(C)==Qe}function nhe(C){return Mr(C)&&nc(C)==Ge}var ihe=Mw(LO),ohe=Mw(function(C,S){return C<=S});function C4(C){if(!C)return[];if(wc(C))return jw(C)?Ou(C):xc(C);if(XT&&C[XT])return Mce(C[XT]());var S=Aa(C),z=S==ye?AO:S==Me?fw:f0;return z(C)}function rh(C){if(!C)return C===0?C:0;if(C=Nl(C),C===W||C===-W){var S=C<0?-1:1;return S*Y}return C===C?C:0}function ri(C){var S=rh(C),z=S%1;return S===S?z?S-z:S:0}function b4(C){return C?F_(ri(C),0,ee):0}function Nl(C){if(typeof C=="number")return C;if(qc(C))return j;if(Er(C)){var S=typeof C.valueOf=="function"?C.valueOf():C;C=Er(S)?S+"":S}if(typeof C!="string")return C===0?C:+C;C=VH(C);var z=Nt.test(C);return z||st.test(C)?Ace(C.slice(2),z?2:8):Zs.test(C)?j:+C}function E4(C){return Gf(C,Sc(C))}function rhe(C){return C?F_(ri(C),-q,q):C===0?C:0}function ho(C){return C==null?"":Wc(C)}var she=a0(function(C,S){if(sC(S)||wc(S)){Gf(S,Bs(S),C);return}for(var z in S)bo.call(S,z)&&eC(C,z,S[z])}),x4=a0(function(C,S){Gf(S,Sc(S),C)}),Yw=a0(function(C,S,z,X){Gf(S,Sc(S),C,X)}),ahe=a0(function(C,S,z,X){Gf(S,Bs(S),C,X)}),che=nh(wO);function lhe(C,S){var z=s0(C);return S==null?z:nV(z,S)}var uhe=mi(function(C,S){C=Io(C);var z=-1,X=S.length,re=X>2?S[2]:n;for(re&&ic(S[0],S[1],re)&&(X=1);++z<X;)for(var ge=S[z],we=Sc(ge),Pe=-1,Ue=we.length;++Pe<Ue;){var ot=we[Pe],rt=C[ot];(rt===n||Bu(rt,i0[ot])&&!bo.call(C,ot))&&(C[ot]=ge[ot])}return C}),fhe=mi(function(C){return C.push(n,VV),kc(w4,n,C)});function dhe(C,S){return FH(C,vn(S,3),kf)}function hhe(C,S){return FH(C,vn(S,3),vO)}function phe(C,S){return C==null?C:SO(C,vn(S,3),Sc)}function mhe(C,S){return C==null?C:aV(C,vn(S,3),Sc)}function _he(C,S){return C&&kf(C,vn(S,3))}function ghe(C,S){return C&&vO(C,vn(S,3))}function yhe(C){return C==null?[]:Dw(C,Bs(C))}function Ahe(C){return C==null?[]:Dw(C,Sc(C))}function rL(C,S,z){var X=C==null?n:z_(C,S);return X===n?z:X}function The(C,S){return C!=null&&WV(C,S,Gle)}function sL(C,S){return C!=null&&WV(C,S,Wle)}var Che=MV(function(C,S,z){S!=null&&typeof S.toString!="function"&&(S=mw.call(S)),C[S]=z},cL(vc)),bhe=MV(function(C,S,z){S!=null&&typeof S.toString!="function"&&(S=mw.call(S)),bo.call(C,S)?C[S].push(z):C[S]=[z]},vn),Ehe=mi(nC);function Bs(C){return wc(C)?eV(C):OO(C)}function Sc(C){return wc(C)?eV(C,!0):eue(C)}function xhe(C,S){var z={};return S=vn(S,3),kf(C,function(X,re,ge){eh(z,S(X,re,ge),X)}),z}function whe(C,S){var z={};return S=vn(S,3),kf(C,function(X,re,ge){eh(z,re,S(X,re,ge))}),z}var She=a0(function(C,S,z){Iw(C,S,z)}),w4=a0(function(C,S,z,X){Iw(C,S,z,X)}),vhe=nh(function(C,S){var z={};if(C==null)return z;var X=!1;S=cr(S,function(ge){return ge=Mp(ge,C),X||(X=ge.length>1),ge}),Gf(C,qO(C),z),X&&(z=Ll(z,h|_|g,Cue));for(var re=S.length;re--;)FO(z,S[re]);return z});function Dhe(C,S){return S4(C,Ww(vn(S)))}var Ihe=nh(function(C,S){return C==null?{}:nue(C,S)});function S4(C,S){if(C==null)return{};var z=cr(qO(C),function(X){return[X]});return S=vn(S),gV(C,z,function(X,re){return S(X,re[0])})}function Phe(C,S,z){S=Mp(S,C);var X=-1,re=S.length;for(re||(re=1,C=n);++X<re;){var ge=C==null?n:C[Wf(S[X])];ge===n&&(X=re,ge=z),C=oh(ge)?ge.call(C):ge}return C}function Ohe(C,S,z){return C==null?C:oC(C,S,z)}function Lhe(C,S,z,X){return X=typeof X=="function"?X:n,C==null?C:oC(C,S,z,X)}var v4=UV(Bs),D4=UV(Sc);function Bhe(C,S,z){var X=Qn(C),re=X||zp(C)||u0(C);if(S=vn(S,4),z==null){var ge=C&&C.constructor;re?z=X?new ge:[]:Er(C)?z=oh(ge)?s0(yw(C)):{}:z={}}return(re?Il:kf)(C,function(we,Pe,Ue){return S(z,we,Pe,Ue)}),z}function Rhe(C,S){return C==null?!0:FO(C,S)}function Nhe(C,S,z){return C==null?C:bV(C,S,HO(z))}function Mhe(C,S,z,X){return X=typeof X=="function"?X:n,C==null?C:bV(C,S,HO(z),X)}function f0(C){return C==null?[]:yO(C,Bs(C))}function Fhe(C){return C==null?[]:yO(C,Sc(C))}function zhe(C,S,z){return z===n&&(z=S,S=n),z!==n&&(z=Nl(z),z=z===z?z:0),S!==n&&(S=Nl(S),S=S===S?S:0),F_(Nl(C),S,z)}function Uhe(C,S,z){return S=rh(S),z===n?(z=S,S=0):z=rh(z),C=Nl(C),qle(C,S,z)}function Hhe(C,S,z){if(z&&typeof z!="boolean"&&ic(C,S,z)&&(S=z=n),z===n&&(typeof S=="boolean"?(z=S,S=n):typeof C=="boolean"&&(z=C,C=n)),C===n&&S===n?(C=0,S=1):(C=rh(C),S===n?(S=C,C=0):S=rh(S)),C>S){var X=C;C=S,S=X}if(z||C%1||S%1){var re=QH();return ya(C+re*(S-C+yce("1e-"+((re+"").length-1))),S)}return RO(C,S)}var Vhe=c0(function(C,S,z){return S=S.toLowerCase(),C+(z?I4(S):S)});function I4(C){return aL(ho(C).toLowerCase())}function P4(C){return C=ho(C),C&&C.replace(oi,Oce).replace(cce,"")}function khe(C,S,z){C=ho(C),S=Wc(S);var X=C.length;z=z===n?X:F_(ri(z),0,X);var re=z;return z-=S.length,z>=0&&C.slice(z,re)==S}function Ghe(C){return C=ho(C),C&&Xi.test(C)?C.replace(Fi,Lce):C}function Whe(C){return C=ho(C),C&&qn.test(C)?C.replace(et,"\\$&"):C}var qhe=c0(function(C,S,z){return C+(z?"-":"")+S.toLowerCase()}),jhe=c0(function(C,S,z){return C+(z?" ":"")+S.toLowerCase()}),Yhe=BV("toLowerCase");function $he(C,S,z){C=ho(C),S=ri(S);var X=S?t0(C):0;if(!S||X>=S)return C;var re=(S-X)/2;return Nw(bw(re),z)+C+Nw(Cw(re),z)}function Xhe(C,S,z){C=ho(C),S=ri(S);var X=S?t0(C):0;return S&&X<S?C+Nw(S-X,z):C}function Khe(C,S,z){C=ho(C),S=ri(S);var X=S?t0(C):0;return S&&X<S?Nw(S-X,z)+C:C}function Jhe(C,S,z){return z||S==null?S=0:S&&(S=+S),ole(ho(C).replace(Sn,""),S||0)}function Qhe(C,S,z){return(z?ic(C,S,z):S===n)?S=1:S=ri(S),NO(ho(C),S)}function Zhe(){var C=arguments,S=ho(C[0]);return C.length<3?S:S.replace(C[1],C[2])}var epe=c0(function(C,S,z){return C+(z?"_":"")+S.toLowerCase()});function tpe(C,S,z){return z&&typeof z!="number"&&ic(C,S,z)&&(S=z=n),z=z===n?ee:z>>>0,z?(C=ho(C),C&&(typeof S=="string"||S!=null&&!oL(S))&&(S=Wc(S),!S&&e0(C))?Fp(Ou(C),0,z):C.split(S,z)):[]}var npe=c0(function(C,S,z){return C+(z?" ":"")+aL(S)});function ipe(C,S,z){return C=ho(C),z=z==null?0:F_(ri(z),0,C.length),S=Wc(S),C.slice(z,z+S.length)==S}function ope(C,S,z){var X=he.templateSettings;z&&ic(C,S,z)&&(S=n),C=ho(C),S=Yw({},S,X,HV);var re=Yw({},S.imports,X.imports,HV),ge=Bs(re),we=yO(re,ge),Pe,Ue,ot=0,rt=S.interpolate||br,pt="__p += '",Ft=TO((S.escape||br).source+"|"+rt.source+"|"+(rt===ti?Ji:br).source+"|"+(S.evaluate||br).source+"|$","g"),on="//# sourceURL="+(bo.call(S,"sourceURL")?(S.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++hce+"]")+`
|
||
`;C.replace(Ft,function(On,Ei,Oi,jc,oc,Yc){return Oi||(Oi=jc),pt+=C.slice(ot,Yc).replace(Nr,Bce),Ei&&(Pe=!0,pt+=`' +
|
||
__e(`+Ei+`) +
|
||
'`),oc&&(Ue=!0,pt+=`';
|
||
`+oc+`;
|
||
__p += '`),Oi&&(pt+=`' +
|
||
((__t = (`+Oi+`)) == null ? '' : __t) +
|
||
'`),ot=Yc+On.length,On}),pt+=`';
|
||
`;var Pn=bo.call(S,"variable")&&S.variable;if(!Pn)pt=`with (obj) {
|
||
`+pt+`
|
||
}
|
||
`;else if(Yr.test(Pn))throw new Yn(a);pt=(Ue?pt.replace(ln,""):pt).replace(ei,"$1").replace(bi,"$1;"),pt="function("+(Pn||"obj")+`) {
|
||
`+(Pn?"":`obj || (obj = {});
|
||
`)+"var __t, __p = ''"+(Pe?", __e = _.escape":"")+(Ue?`, __j = Array.prototype.join;
|
||
function print() { __p += __j.call(arguments, '') }
|
||
`:`;
|
||
`)+pt+`return __p
|
||
}`;var ui=L4(function(){return so(ge,on+"return "+pt).apply(n,we)});if(ui.source=pt,iL(ui))throw ui;return ui}function rpe(C){return ho(C).toLowerCase()}function spe(C){return ho(C).toUpperCase()}function ape(C,S,z){if(C=ho(C),C&&(z||S===n))return VH(C);if(!C||!(S=Wc(S)))return C;var X=Ou(C),re=Ou(S),ge=kH(X,re),we=GH(X,re)+1;return Fp(X,ge,we).join("")}function cpe(C,S,z){if(C=ho(C),C&&(z||S===n))return C.slice(0,qH(C)+1);if(!C||!(S=Wc(S)))return C;var X=Ou(C),re=GH(X,Ou(S))+1;return Fp(X,0,re).join("")}function lpe(C,S,z){if(C=ho(C),C&&(z||S===n))return C.replace(Sn,"");if(!C||!(S=Wc(S)))return C;var X=Ou(C),re=kH(X,Ou(S));return Fp(X,re).join("")}function upe(C,S){var z=G,X=I;if(Er(S)){var re="separator"in S?S.separator:re;z="length"in S?ri(S.length):z,X="omission"in S?Wc(S.omission):X}C=ho(C);var ge=C.length;if(e0(C)){var we=Ou(C);ge=we.length}if(z>=ge)return C;var Pe=z-t0(X);if(Pe<1)return X;var Ue=we?Fp(we,0,Pe).join(""):C.slice(0,Pe);if(re===n)return Ue+X;if(we&&(Pe+=Ue.length-Pe),oL(re)){if(C.slice(Pe).search(re)){var ot,rt=Ue;for(re.global||(re=TO(re.source,ho(Rr.exec(re))+"g")),re.lastIndex=0;ot=re.exec(rt);)var pt=ot.index;Ue=Ue.slice(0,pt===n?Pe:pt)}}else if(C.indexOf(Wc(re),Pe)!=Pe){var Ft=Ue.lastIndexOf(re);Ft>-1&&(Ue=Ue.slice(0,Ft))}return Ue+X}function fpe(C){return C=ho(C),C&&Co.test(C)?C.replace(pn,Hce):C}var dpe=c0(function(C,S,z){return C+(z?" ":"")+S.toUpperCase()}),aL=BV("toUpperCase");function O4(C,S,z){return C=ho(C),S=z?n:S,S===n?Nce(C)?Gce(C):Sce(C):C.match(S)||[]}var L4=mi(function(C,S){try{return kc(C,n,S)}catch(z){return iL(z)?z:new Yn(z)}}),hpe=nh(function(C,S){return Il(S,function(z){z=Wf(z),eh(C,z,tL(C[z],C))}),C});function ppe(C){var S=C==null?0:C.length,z=vn();return C=S?cr(C,function(X){if(typeof X[1]!="function")throw new Pl(s);return[z(X[0]),X[1]]}):[],mi(function(X){for(var re=-1;++re<S;){var ge=C[re];if(kc(ge[0],this,X))return kc(ge[1],this,X)}})}function mpe(C){return Hle(Ll(C,h))}function cL(C){return function(){return C}}function _pe(C,S){return C==null||C!==C?S:C}var gpe=NV(),ype=NV(!0);function vc(C){return C}function lL(C){return fV(typeof C=="function"?C:Ll(C,h))}function Ape(C){return hV(Ll(C,h))}function Tpe(C,S){return pV(C,Ll(S,h))}var Cpe=mi(function(C,S){return function(z){return nC(z,C,S)}}),bpe=mi(function(C,S){return function(z){return nC(C,z,S)}});function uL(C,S,z){var X=Bs(S),re=Dw(S,X);z==null&&!(Er(S)&&(re.length||!X.length))&&(z=S,S=C,C=this,re=Dw(S,Bs(S)));var ge=!(Er(z)&&"chain"in z)||!!z.chain,we=oh(C);return Il(re,function(Pe){var Ue=S[Pe];C[Pe]=Ue,we&&(C.prototype[Pe]=function(){var ot=this.__chain__;if(ge||ot){var rt=C(this.__wrapped__),pt=rt.__actions__=xc(this.__actions__);return pt.push({func:Ue,args:arguments,thisArg:C}),rt.__chain__=ot,rt}return Ue.apply(C,Op([this.value()],arguments))})}),C}function Epe(){return ea._===this&&(ea._=Xce),this}function fL(){}function xpe(C){return C=ri(C),mi(function(S){return mV(S,C)})}var wpe=kO(cr),Spe=kO(MH),vpe=kO(hO);function B4(C){return XO(C)?pO(Wf(C)):iue(C)}function Dpe(C){return function(S){return C==null?n:z_(C,S)}}var Ipe=FV(),Ppe=FV(!0);function dL(){return[]}function hL(){return!1}function Ope(){return{}}function Lpe(){return""}function Bpe(){return!0}function Rpe(C,S){if(C=ri(C),C<1||C>q)return[];var z=ee,X=ya(C,ee);S=vn(S),C-=ee;for(var re=gO(X,S);++z<C;)S(z);return re}function Npe(C){return Qn(C)?cr(C,Wf):qc(C)?[C]:xc(ZV(ho(C)))}function Mpe(C){var S=++Yce;return ho(C)+S}var Fpe=Rw(function(C,S){return C+S},0),zpe=GO("ceil"),Upe=Rw(function(C,S){return C/S},1),Hpe=GO("floor");function Vpe(C){return C&&C.length?vw(C,vc,DO):n}function kpe(C,S){return C&&C.length?vw(C,vn(S,2),DO):n}function Gpe(C){return UH(C,vc)}function Wpe(C,S){return UH(C,vn(S,2))}function qpe(C){return C&&C.length?vw(C,vc,LO):n}function jpe(C,S){return C&&C.length?vw(C,vn(S,2),LO):n}var Ype=Rw(function(C,S){return C*S},1),$pe=GO("round"),Xpe=Rw(function(C,S){return C-S},0);function Kpe(C){return C&&C.length?_O(C,vc):0}function Jpe(C,S){return C&&C.length?_O(C,vn(S,2)):0}return he.after=Ade,he.ary=u4,he.assign=she,he.assignIn=x4,he.assignInWith=Yw,he.assignWith=ahe,he.at=che,he.before=f4,he.bind=tL,he.bindAll=hpe,he.bindKey=d4,he.castArray=Ode,he.chain=a4,he.chunk=Hue,he.compact=Vue,he.concat=kue,he.cond=ppe,he.conforms=mpe,he.constant=cL,he.countBy=Kfe,he.create=lhe,he.curry=h4,he.curryRight=p4,he.debounce=m4,he.defaults=uhe,he.defaultsDeep=fhe,he.defer=Tde,he.delay=Cde,he.difference=Gue,he.differenceBy=Wue,he.differenceWith=que,he.drop=jue,he.dropRight=Yue,he.dropRightWhile=$ue,he.dropWhile=Xue,he.fill=Kue,he.filter=Qfe,he.flatMap=tde,he.flatMapDeep=nde,he.flatMapDepth=ide,he.flatten=i4,he.flattenDeep=Jue,he.flattenDepth=Que,he.flip=bde,he.flow=gpe,he.flowRight=ype,he.fromPairs=Zue,he.functions=yhe,he.functionsIn=Ahe,he.groupBy=ode,he.initial=tfe,he.intersection=nfe,he.intersectionBy=ife,he.intersectionWith=ofe,he.invert=Che,he.invertBy=bhe,he.invokeMap=sde,he.iteratee=lL,he.keyBy=ade,he.keys=Bs,he.keysIn=Sc,he.map=Vw,he.mapKeys=xhe,he.mapValues=whe,he.matches=Ape,he.matchesProperty=Tpe,he.memoize=Gw,he.merge=She,he.mergeWith=w4,he.method=Cpe,he.methodOf=bpe,he.mixin=uL,he.negate=Ww,he.nthArg=xpe,he.omit=vhe,he.omitBy=Dhe,he.once=Ede,he.orderBy=cde,he.over=wpe,he.overArgs=xde,he.overEvery=Spe,he.overSome=vpe,he.partial=nL,he.partialRight=_4,he.partition=lde,he.pick=Ihe,he.pickBy=S4,he.property=B4,he.propertyOf=Dpe,he.pull=cfe,he.pullAll=r4,he.pullAllBy=lfe,he.pullAllWith=ufe,he.pullAt=ffe,he.range=Ipe,he.rangeRight=Ppe,he.rearg=wde,he.reject=dde,he.remove=dfe,he.rest=Sde,he.reverse=ZO,he.sampleSize=pde,he.set=Ohe,he.setWith=Lhe,he.shuffle=mde,he.slice=hfe,he.sortBy=yde,he.sortedUniq=Tfe,he.sortedUniqBy=Cfe,he.split=tpe,he.spread=vde,he.tail=bfe,he.take=Efe,he.takeRight=xfe,he.takeRightWhile=wfe,he.takeWhile=Sfe,he.tap=Vfe,he.throttle=Dde,he.thru=Hw,he.toArray=C4,he.toPairs=v4,he.toPairsIn=D4,he.toPath=Npe,he.toPlainObject=E4,he.transform=Bhe,he.unary=Ide,he.union=vfe,he.unionBy=Dfe,he.unionWith=Ife,he.uniq=Pfe,he.uniqBy=Ofe,he.uniqWith=Lfe,he.unset=Rhe,he.unzip=eL,he.unzipWith=s4,he.update=Nhe,he.updateWith=Mhe,he.values=f0,he.valuesIn=Fhe,he.without=Bfe,he.words=O4,he.wrap=Pde,he.xor=Rfe,he.xorBy=Nfe,he.xorWith=Mfe,he.zip=Ffe,he.zipObject=zfe,he.zipObjectDeep=Ufe,he.zipWith=Hfe,he.entries=v4,he.entriesIn=D4,he.extend=x4,he.extendWith=Yw,uL(he,he),he.add=Fpe,he.attempt=L4,he.camelCase=Vhe,he.capitalize=I4,he.ceil=zpe,he.clamp=zhe,he.clone=Lde,he.cloneDeep=Rde,he.cloneDeepWith=Nde,he.cloneWith=Bde,he.conformsTo=Mde,he.deburr=P4,he.defaultTo=_pe,he.divide=Upe,he.endsWith=khe,he.eq=Bu,he.escape=Ghe,he.escapeRegExp=Whe,he.every=Jfe,he.find=Zfe,he.findIndex=t4,he.findKey=dhe,he.findLast=ede,he.findLastIndex=n4,he.findLastKey=hhe,he.floor=Hpe,he.forEach=c4,he.forEachRight=l4,he.forIn=phe,he.forInRight=mhe,he.forOwn=_he,he.forOwnRight=ghe,he.get=rL,he.gt=Fde,he.gte=zde,he.has=The,he.hasIn=sL,he.head=o4,he.identity=vc,he.includes=rde,he.indexOf=efe,he.inRange=Uhe,he.invoke=Ehe,he.isArguments=V_,he.isArray=Qn,he.isArrayBuffer=Ude,he.isArrayLike=wc,he.isArrayLikeObject=$r,he.isBoolean=Hde,he.isBuffer=zp,he.isDate=Vde,he.isElement=kde,he.isEmpty=Gde,he.isEqual=Wde,he.isEqualWith=qde,he.isError=iL,he.isFinite=jde,he.isFunction=oh,he.isInteger=g4,he.isLength=qw,he.isMap=y4,he.isMatch=Yde,he.isMatchWith=$de,he.isNaN=Xde,he.isNative=Kde,he.isNil=Qde,he.isNull=Jde,he.isNumber=A4,he.isObject=Er,he.isObjectLike=Mr,he.isPlainObject=cC,he.isRegExp=oL,he.isSafeInteger=Zde,he.isSet=T4,he.isString=jw,he.isSymbol=qc,he.isTypedArray=u0,he.isUndefined=ehe,he.isWeakMap=the,he.isWeakSet=nhe,he.join=rfe,he.kebabCase=qhe,he.last=Rl,he.lastIndexOf=sfe,he.lowerCase=jhe,he.lowerFirst=Yhe,he.lt=ihe,he.lte=ohe,he.max=Vpe,he.maxBy=kpe,he.mean=Gpe,he.meanBy=Wpe,he.min=qpe,he.minBy=jpe,he.stubArray=dL,he.stubFalse=hL,he.stubObject=Ope,he.stubString=Lpe,he.stubTrue=Bpe,he.multiply=Ype,he.nth=afe,he.noConflict=Epe,he.noop=fL,he.now=kw,he.pad=$he,he.padEnd=Xhe,he.padStart=Khe,he.parseInt=Jhe,he.random=Hhe,he.reduce=ude,he.reduceRight=fde,he.repeat=Qhe,he.replace=Zhe,he.result=Phe,he.round=$pe,he.runInContext=ze,he.sample=hde,he.size=_de,he.snakeCase=epe,he.some=gde,he.sortedIndex=pfe,he.sortedIndexBy=mfe,he.sortedIndexOf=_fe,he.sortedLastIndex=gfe,he.sortedLastIndexBy=yfe,he.sortedLastIndexOf=Afe,he.startCase=npe,he.startsWith=ipe,he.subtract=Xpe,he.sum=Kpe,he.sumBy=Jpe,he.template=ope,he.times=Rpe,he.toFinite=rh,he.toInteger=ri,he.toLength=b4,he.toLower=rpe,he.toNumber=Nl,he.toSafeInteger=rhe,he.toString=ho,he.toUpper=spe,he.trim=ape,he.trimEnd=cpe,he.trimStart=lpe,he.truncate=upe,he.unescape=fpe,he.uniqueId=Mpe,he.upperCase=dpe,he.upperFirst=aL,he.each=c4,he.eachRight=l4,he.first=o4,uL(he,function(){var C={};return kf(he,function(S,z){bo.call(he.prototype,z)||(C[z]=S)}),C}(),{chain:!1}),he.VERSION=i,Il(["bind","bindKey","curry","curryRight","partial","partialRight"],function(C){he[C].placeholder=he}),Il(["drop","take"],function(C,S){vi.prototype[C]=function(z){z=z===n?1:As(ri(z),0);var X=this.__filtered__&&!S?new vi(this):this.clone();return X.__filtered__?X.__takeCount__=ya(z,X.__takeCount__):X.__views__.push({size:ya(z,ee),type:C+(X.__dir__<0?"Right":"")}),X},vi.prototype[C+"Right"]=function(z){return this.reverse()[C](z).reverse()}}),Il(["filter","map","takeWhile"],function(C,S){var z=S+1,X=z==P||z==U;vi.prototype[C]=function(re){var ge=this.clone();return ge.__iteratees__.push({iteratee:vn(re,3),type:z}),ge.__filtered__=ge.__filtered__||X,ge}}),Il(["head","last"],function(C,S){var z="take"+(S?"Right":"");vi.prototype[C]=function(){return this[z](1).value()[0]}}),Il(["initial","tail"],function(C,S){var z="drop"+(S?"":"Right");vi.prototype[C]=function(){return this.__filtered__?new vi(this):this[z](1)}}),vi.prototype.compact=function(){return this.filter(vc)},vi.prototype.find=function(C){return this.filter(C).head()},vi.prototype.findLast=function(C){return this.reverse().find(C)},vi.prototype.invokeMap=mi(function(C,S){return typeof C=="function"?new vi(this):this.map(function(z){return nC(z,C,S)})}),vi.prototype.reject=function(C){return this.filter(Ww(vn(C)))},vi.prototype.slice=function(C,S){C=ri(C);var z=this;return z.__filtered__&&(C>0||S<0)?new vi(z):(C<0?z=z.takeRight(-C):C&&(z=z.drop(C)),S!==n&&(S=ri(S),z=S<0?z.dropRight(-S):z.take(S-C)),z)},vi.prototype.takeRightWhile=function(C){return this.reverse().takeWhile(C).reverse()},vi.prototype.toArray=function(){return this.take(ee)},kf(vi.prototype,function(C,S){var z=/^(?:filter|find|map|reject)|While$/.test(S),X=/^(?:head|last)$/.test(S),re=he[X?"take"+(S=="last"?"Right":""):S],ge=X||/^find/.test(S);re&&(he.prototype[S]=function(){var we=this.__wrapped__,Pe=X?[1]:arguments,Ue=we instanceof vi,ot=Pe[0],rt=Ue||Qn(we),pt=function(Ei){var Oi=re.apply(he,Op([Ei],Pe));return X&&Ft?Oi[0]:Oi};rt&&z&&typeof ot=="function"&&ot.length!=1&&(Ue=rt=!1);var Ft=this.__chain__,on=!!this.__actions__.length,Pn=ge&&!Ft,ui=Ue&&!on;if(!ge&&rt){we=ui?we:new vi(this);var On=C.apply(we,Pe);return On.__actions__.push({func:Hw,args:[pt],thisArg:n}),new Ol(On,Ft)}return Pn&&ui?C.apply(this,Pe):(On=this.thru(pt),Pn?X?On.value()[0]:On.value():On)})}),Il(["pop","push","shift","sort","splice","unshift"],function(C){var S=dw[C],z=/^(?:push|sort|unshift)$/.test(C)?"tap":"thru",X=/^(?:pop|shift)$/.test(C);he.prototype[C]=function(){var re=arguments;if(X&&!this.__chain__){var ge=this.value();return S.apply(Qn(ge)?ge:[],re)}return this[z](function(we){return S.apply(Qn(we)?we:[],re)})}}),kf(vi.prototype,function(C,S){var z=he[S];if(z){var X=z.name+"";bo.call(r0,X)||(r0[X]=[]),r0[X].push({name:S,func:z})}}),r0[Bw(n,b).name]=[{name:"wrapper",func:n}],vi.prototype.clone=fle,vi.prototype.reverse=dle,vi.prototype.value=hle,he.prototype.at=kfe,he.prototype.chain=Gfe,he.prototype.commit=Wfe,he.prototype.next=qfe,he.prototype.plant=Yfe,he.prototype.reverse=$fe,he.prototype.toJSON=he.prototype.valueOf=he.prototype.value=Xfe,he.prototype.first=he.prototype.head,XT&&(he.prototype[XT]=jfe),he},n0=Wce();B_?((B_.exports=n0)._=n0,lO._=n0):ea._=n0}).call(Ku)})(oCt,H2);const rCt=Xs("div",{id:"cesiumContainer"},null,-1),sCt={class:"operate_container"},aCt=Xs("img",{src:Txe,width:"28",height:"28",alt:""},null,-1),cCt=[aCt],lCt={__name:"SatelliteTrack",setup(e){let t=[...QTt,...ZTt,...eCt,...tCt,...nCt,...iCt];window.CESIUM_BASE_URL="/satellite-track/cesium";let n;const i=86400,o=new Map,r=xo(!1),s=xo([]),a=[];kg.defaultAccessToken="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJiYjZmMWM4Ny01YzQ4LTQ3MzUtYTI5Mi1hNTgyNjdhMmFiMmMiLCJpZCI6NjIwMjgsImlhdCI6MTYyNjY3MTMxNX0.5SelYUyzXWRoMyjjFvmFIAoPtWlJPQMjsVl2e_jQe-c";function c(){tc.prototype.makeLabel=function(x){let v=0-new Date().getTimezoneOffset(),D=ce.addMinutes(x,v,new ce);return ce.toIso8601(D).slice(0,19)};let T=new Iy({mapId:"mapbox.satellite",accessToken:"pk.eyJ1Ijoiamlhbmd0ZW5nIiwiYSI6ImNqbGhhcDhzMjAxdncza294c2ZqcHFxNGIifQ.rjSmtZ5QzE2sJ-qDANh3WQ"});n=new xi("cesiumContainer",{imageryProvider:T,baseLayerPicker:!1,geocoder:!1,navigationHelpButton:!1,infoBox:!1});let b=0-new Date().getTimezoneOffset();n.animation.viewModel.timeFormatter=function(x,v){let D=ce.addMinutes(x,b,new ce);return ce.toIso8601(D).slice(11,19)},n.animation.viewModel.dateFormatter=function(x,v){let D=ce.addMinutes(x,b,new ce);return ce.toIso8601(D).slice(0,10)},Tt.DEFAULT_VIEW_RECTANGLE=Ee.fromDegrees(75,10,140,60)}function u(){const T=ce.fromIso8601(new Date().toISOString()),b=ce.addSeconds(T,i,new ce);n.clock.startTime=T.clone(),n.clock.stopTime=b.clone(),n.clock.currentTime=T.clone(),n.timeline.zoomTo(T,b),n.clock.multiplier=1,n.clock.shouldAnimate=!0,n.clock.clockRange=Mm.LOOP_STOP}function f(T=""){if(T.length===0)return;let b=T.split(`\r
|
||
`),x=[],v=0,D=[];return b.forEach(L=>{v++,D.push(L),v===3&&(x.push(D.join(`\r
|
||
`)),D=[],v=0)}),x}function h(){let T=n.screenSpaceEventHandler.getInputAction(ai.LEFT_CLICK);n.screenSpaceEventHandler.setInputAction(function(x){T(x);const v=n.scene.pick(x.position);if(console.log(v),!l(v)){a.forEach(D=>{D.id.path.show=!1});return}v&&(v.id.path.show=new Cr(!0),v.id.label.distanceDisplayCondition=void 0,a.push(v))},ai.LEFT_CLICK)}function _(T){}async function g(T){let b=localStorage.getItem(T);return b?(console.log(`%c 命中缓存,key值为${T}`,"color:#0f0;"),b):(console.warn("未命中缓存,开始下载TLE数据"),await OTt(T))}async function p(T){if(o.has(T))o.get(T).forEach(x=>n.entities.add(x));else{let b=await g(T),x=f(b),v=new Set;x.forEach(D=>{let B=new JTt(D).createSatelliteEntity(),V=n.entities.add(B);v.add(V)}),o.set(T,v)}}function y(T){o.has(T)&&o.get(T).forEach(x=>n.entities.remove(x))}return ws(s,(T,b)=>{let x=T.concat(b).filter((D,L,B)=>B.indexOf(D)===B.lastIndexOf(D)),v=t.find(D=>D.value===x[0]);T.length>b.length?p(v.group):y(v.group)}),Dd(async()=>{c(),u(),h()}),(T,b)=>{const x=sxe,v=BEe,D=REe,L=ZEe;return _i(),tr(aa,null,[rCt,Xs("div",sCt,[Xs("div",{class:"menu_button",onClick:b[0]||(b[0]=B=>r.value=!r.value)},cCt)]),nr(L,{modelValue:r.value,"onUpdate:modelValue":b[2]||(b[2]=B=>r.value=B),title:"卫星选择",direction:"ltr"},{default:za(()=>[nr(D,{modelValue:s.value,"onUpdate:modelValue":b[1]||(b[1]=B=>s.value=B),onChange:_,max:5},{default:za(()=>[(_i(!0),tr(aa,null,A_e(xt(t),(B,V)=>(_i(),tr(aa,{key:V},[B.type==="title"?(_i(),Fc(x,{key:0,class:"satellite_type"},{default:za(()=>[pE(Kg(B.label),1)]),_:2},1024)):lc("",!0),B.type?lc("",!0):(_i(),Fc(v,{key:1,label:B.value},{default:za(()=>[pE(Kg(B.label),1)]),_:2},1032,["label"]))],64))),128))]),_:1},8,["modelValue"])]),_:1},8,["modelValue"])],64)}}},uCt=Oye({history:$ge("/satellite-track/"),routes:[{path:"/",name:"home",component:lCt}]}),CH=Sge(Nye);CH.use(Pge());CH.use(uCt);CH.mount("#app")});export default fCt();
|