/*! vue-amap v1.1.20 */import{defineComponent as oe,openBlock as Bt,createElementBlock as $t,renderSlot as ti,createElementVNode as Go,withDirectives as Mg,createCommentVNode as Sg,vShow as wg,Fragment as Cg,renderList as Ag}from"vue";const dc=(n=[])=>{const e=[];return{install:i=>{e.includes(i)||(e.push(i),n.forEach(s=>i.use(s)))}}},ce=(n,e)=>{if(n.install=t=>{for(const i of[n,...Object.values(e??{})])t.component(i.name,i)},e)for(const[t,i]of Object.entries(e))n[t]=i;return n};function pc(){let n=[],e="0123456789abcdef";for(var t=0;t<36;t++)n[t]=e.substr(Math.floor(Math.random()*16),1);n[14]="4",n[19]=e.substr(n[19]&3|8,1),n[8]=n[13]=n[18]=n[23]="-";var i=n.join("");return i}var Tg=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{},Eg=function(){var n=[].map.call(arguments,function(e){return e.trim()}).filter(function(e){return e.length}).join("-");return n.length?n.length===1||!/[_.\- ]+/.test(n)?n[0]===n[0].toLowerCase()&&n.slice(1)!==n.slice(1).toLowerCase()?n:n.toLowerCase():n.replace(/^[_.\- ]+/,"").toLowerCase().replace(/[_.\- ]+(\w|$)/g,function(e,t){return t.toUpperCase()}):""},fc=Eg,Lg=function(){var n=fc.apply(fc,arguments);return n.charAt(0).toUpperCase()+n.slice(1)},Rg=Lg;let Vo;class Pg{constructor(){this._listener=new Map}addListener(e,t,i,s){if(!AMap)throw new Error("please wait for Map API load");if(!e.on)return;e.on(t,i,s),this._listener.get(e)||this._listener.set(e,{});const r=this._listener.get(e);r[t]||(r[t]=[]),r[t].push(i)}removeListener(e,t,i){if(!AMap)throw new Error("please wait for Map API load");if(!e.off||!this._listener.get(e)||!this._listener.get(e)[t])return;const s=this._listener.get(e)[t];if(i){const r=s.indexOf(i);e.off(t,s[r]),s.splice(r,1)}else s.forEach(r=>{e.off(t,r)}),this._listener.get(e)[t]=[]}addListenerOnce(e,t,i,s){return e.on(t,i,s,!0)}trigger(e,t,i){return e.emit(t,i)}clearListeners(e){const t=this._listener.get(e);!t||Object.keys(t).map(i=>{e.clearEvents(i)})}}Vo=Vo||new Pg;var Ho=Vo;function Rt(n){return n?n instanceof AMap.Map:!1}function Pt(n){return n?n instanceof AMap.OverlayGroup:!1}function Ig(n){return n?n instanceof AMap.IndoorMap:!1}function Ut(n){return n?n instanceof AMap.VectorLayer:!1}function mc(n){if(!n||n.length<4)return n;const e=n.substring(3,n.length);return n[2].toLowerCase()+e}const gc=/^on[A-Z]+/;function _c(n,e){if(!n)throw new Error("\u8BF7\u4F20\u5165url");const t=document.createElement("script");t.type="text/javascript",t.async=!0,t.defer=!0,t.src=n,document.body.appendChild(t),e&&t.addEventListener("load",()=>{e()})}function Wo(n){return Array.isArray(n)?n.map(Wo):n.toArray()}var ae=oe({inject:{parentInstance:{default:null}},inheritAttrs:!1,props:{visible:{type:Boolean,default:!0},zIndex:{type:Number},reEventWhenUpdate:{type:Boolean,default:!1}},emits:["init"],data(){return{needInitComponents:[],unwatchFns:[],propsRedirect:{},converters:{},isDestroy:!1,cacheEvents:{},isMounted:!1}},created(){this.$amapComponent=null,this.$parentComponent=null},mounted(){this.parentInstance&&(this.parentInstance.$amapComponent?this.register():this.parentInstance.addChildComponent(this))},beforeUnmount(){!this.$amapComponent||(this.unregisterEvents(),this.unwatchFns.forEach(n=>n()),this.unwatchFns=[],this.destroyComponent(),this.isDestroy=!0)},beforeUpdate(){this.reEventWhenUpdate&&this.isMounted&&this.$amapComponent&&this.unregisterEvents()},updated(){this.reEventWhenUpdate&&this.isMounted&&this.$amapComponent&&this.registerEvents()},methods:{getHandlerFun(n){return this[`__${n}`]?this[`__${n}`]:this.$amapComponent?this.$amapComponent[`set${Rg(n)}`]:null},convertProps(){const n={},{$props:e,propsRedirect:t}=this;return Object.keys(e).reduce((i,s)=>{let r=s;const o=this.convertSignalProp(r,e[r]);return o===void 0||(t&&t[s]&&(r=t[r]),n[r]=o),i},n)},convertSignalProp(n,e){return this.converters&&this.converters[n]?this.converters[n].call(this,e):e},registerEvents(){const n=this.$attrs;Object.keys(n).forEach(e=>{if(gc.test(e)){const t=mc(e);Ho.addListener(this.$amapComponent,t,n[e]),this.cacheEvents[t]=n[e]}})},unregisterEvents(){Object.keys(this.cacheEvents).forEach(n=>{Ho.removeListener(this.$amapComponent,n,this.cacheEvents[n]),delete this.cacheEvents[n]})},setPropWatchers(){const{propsRedirect:n,$props:e}=this;Object.keys(e).forEach(t=>{let i=t;n&&n[t]&&(i=n[t]);const s=this.getHandlerFun(i);if(!s)return;const r={deep:!1},o=Object.prototype.toString.call(e[t]);(o==="[object Object]"||o==="[object Array]")&&(r.deep=!0);const a=this.$watch(t,l=>{s.call(this.$amapComponent,this.convertSignalProp(t,l))},r);this.unwatchFns.push(a)})},initProps(){["editable","visible","zooms"].forEach(e=>{if(this[e]!==void 0){const t=this.getHandlerFun(e);t&&t.call(this.$amapComponent,this.convertSignalProp(e,this[e]))}})},lazyRegister(){const n=this.parentInstance;n&&n.addChildComponent&&n.addChildComponent(this)},addChildComponent(n){this.needInitComponents.push(n)},createChildren(){for(;this.needInitComponents.length>0;)this.needInitComponents[0].register(),this.needInitComponents.splice(0,1)},register(){this.parentInstance&&!this.$parentComponent&&(this.$parentComponent=this.parentInstance.$amapComponent);const n=this.__initComponent&&this.__initComponent(this.convertProps());n&&n.then?n.then(e=>this.registerRest(e)):this.registerRest(n)},registerRest(n){!this.$amapComponent&&n&&(this.$amapComponent=n),this.registerEvents(),this.initProps(),this.setPropWatchers(),this.$emit("init",this.$amapComponent,this),this.$nextTick(()=>{this.createChildren()}),this.isMounted=!0},$$getInstance(){return this.$amapComponent},destroyComponent(){this.$amapComponent.setMap&&this.$amapComponent.setMap(null),this.$amapComponent.close&&this.$amapComponent.close(),this.$amapComponent.editor&&this.$amapComponent.editor.close()},__visible(n){!!this.$amapComponent&&!!this.$amapComponent.show&&!!this.$amapComponent.hide&&(n===!1?this.$amapComponent.hide():this.$amapComponent.show())},__zIndex(n){this.$amapComponent&&this.$amapComponent.setzIndex&&this.$amapComponent.setzIndex(n)}}}),yc={exports:{}};(function(n,e){(function(t,i){n.exports=i()})(Tg,function(){function t(h){var d=[];return h.AMapUI&&d.push(i(h.AMapUI)),h.Loca&&d.push(s(h.Loca)),Promise.all(d)}function i(h){return new Promise(function(d,p){var g=[];if(h.plugins)for(var m=0;m0){if(++e>=H_)return arguments[0]}else e=0;return n.apply(void 0,arguments)}}var q_=Dc(Tc),Fc=q_,X_=/\{\n\/\* \[wrapped with (.+)\] \*/,Y_=/,? & /;function J_(n){var e=n.match(X_);return e?e[1].split(Y_):[]}var Z_=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/;function K_(n,e){var t=e.length;if(!t)return n;var i=t-1;return e[i]=(t>1?"& ":"")+e[i],e=e.join(t>2?", ":" "),n.replace(Z_,`{ /* [wrapped with `+e+`] */ `)}function Q_(n){return function(){return n}}var e0=function(){try{var n=Cr(Object,"defineProperty");return n({},"",{}),n}catch{}}(),Lr=e0,t0=Lr?function(n,e){return Lr(n,"toString",{configurable:!0,enumerable:!1,value:Q_(e),writable:!0})}:jo,n0=t0,i0=Dc(n0),Oc=i0;function s0(n,e){for(var t=-1,i=n==null?0:n.length;++t-1}var h0=1,u0=2,d0=8,p0=16,f0=32,m0=64,g0=128,_0=256,y0=512,v0=[["ary",g0],["bind",h0],["bindKey",u0],["curry",d0],["curryRight",p0],["flip",y0],["partial",f0],["partialRight",m0],["rearg",_0]];function x0(n,e){return s0(v0,function(t){var i="_."+t[0];e&t[1]&&!c0(n,i)&&n.push(i)}),n.sort()}function Nc(n,e,t){var i=e+"";return Oc(n,K_(i,x0(J_(i),t)))}var b0=1,M0=2,S0=4,w0=8,kc=32,Bc=64;function $c(n,e,t,i,s,r,o,a,l,c){var u=e&w0,h=u?o:void 0,d=u?void 0:o,p=u?r:void 0,g=u?void 0:r;e|=u?kc:Bc,e&=~(u?Bc:kc),e&S0||(e&=~(b0|M0));var m=[n,e,s,p,h,g,d,a,l,c],f=t.apply(void 0,m);return V_(n)&&Fc(f,m),f.placeholder=i,Nc(f,n,e)}function Ko(n){var e=n;return e.placeholder}var C0=9007199254740991,A0=/^(?:0|[1-9]\d*)$/;function Qo(n,e){var t=typeof n;return e=e??C0,!!e&&(t=="number"||t!="symbol"&&A0.test(n))&&n>-1&&n%1==0&&n1&&v.reverse(),u&&l<_&&(v.length=l),this&&this!==Xt&&this instanceof f&&(y=m||Is(y)),y.apply(L,v)}return f}function O0(n,e,t){var i=Is(n);function s(){for(var r=arguments.length,o=Array(r),a=r,l=Ko(s);a--;)o[a]=arguments[a];var c=r<3&&o[0]!==l&&o[r-1]!==l?[]:Ds(o,l);if(r-=c.length,r-1&&n%1==0&&n<=J0}function oa(n){return n!=null&&Yc(n.length)&&!qo(n)}function Z0(n,e,t){if(!cn(t))return!1;var i=typeof e;return(i=="number"?oa(t)&&Qo(e,t.length):i=="string"&&e in t)?Rr(t[e],n):!1}function K0(n){return Xc(function(e,t){var i=-1,s=t.length,r=s>1?t[s-1]:void 0,o=s>2?t[2]:void 0;for(r=n.length>3&&typeof r=="function"?(s--,r):void 0,o&&Z0(t[0],t[1],o)&&(r=s<3?void 0:r,s=1),e=Object(e);++i-1}function hv(n,e){var t=this.__data__,i=Pr(t,n);return i<0?(++this.size,t.push([n,e])):t[i][1]=e,this}function _n(n){var e=-1,t=n==null?0:n.length;for(this.clear();++e{si||(si||(n.offline?si=new Promise(e=>{console.log("@vuemap/vue-amap\u79BB\u7EBF\u90E8\u7F72"),e(window.AMap)}):si=qv(n)),si.then())};var da=oe({name:"ElAmap",mixins:[ae],provide(){return{parentInstance:this}},props:{vid:{type:String},center:{type:Array},zoom:{type:Number},rotation:{type:Number},pitch:{type:Number},viewMode:{type:String},features:{type:Array},layers:{type:Array},zooms:{type:Array},resizeEnable:{type:Boolean,default:!0},dragEnable:{type:Boolean,default:!0},zoomEnable:{type:Boolean,default:!0},jogEnable:{type:Boolean,default:!0},pitchEnable:{type:Boolean,default:!0},rotateEnable:{type:Boolean,default:!0},animateEnable:{type:Boolean,default:!0},keyboardEnable:{type:Boolean,default:!0},doubleClickZoom:{type:Boolean,default:!0},scrollWheel:{type:Boolean,default:!0},touchZoom:{type:Boolean,default:!0},touchZoomCenter:{type:Number},showLabel:{type:Boolean,default:!0},defaultCursor:{type:String},isHotspot:{type:Boolean},mapStyle:{type:String},wallColor:{type:[String,Array]},roofColor:{type:[String,Array]},showBuildingBlock:{type:Boolean,default:!0},showIndoorMap:{type:Boolean,default:!1},skyColor:{type:[String,Array]},labelRejectMask:{type:Boolean,default:!1},mask:{type:Array},WebGLParams:{type:Object},terrain:{type:Boolean,default:!1}},emits:["update:zoom","update:center","update:rotation","update:pitch"],data(){return{}},computed:{},mounted(){this.createMap()},beforeUnmount(){this.$amapComponent&&(this.$amapComponent.destroy(),this.$amapComponent=null,this.$parentComponent=null)},methods:{createMap(){si.then(()=>{const n=this.$el.querySelector(".el-vue-amap"),e=this.vid||pc();n.id=e,this.$nextTick(()=>{this.$amapComponent=new AMap.Map(e,this.convertProps()),this.register(),this.bindModelEvents()})}).catch(n=>{console.warn("init map error: ",n)})},bindModelEvents(){this.$amapComponent.on("zoomchange",()=>{this.$emit("update:zoom",this.$amapComponent.getZoom())}),this.$amapComponent.on("rotatechange",()=>{this.$emit("update:rotation",this.$amapComponent.getRotation()),this.$emit("update:pitch",this.$amapComponent.getPitch())}),this.$amapComponent.on("dragging",()=>{this.$emit("update:center",this.getCenter()),this.$emit("update:pitch",this.$amapComponent.getPitch())}),this.$amapComponent.on("touchmove",()=>{this.$emit("update:center",this.getCenter())})},getCenter(){const n=this.$amapComponent.getCenter();return[n.lng,n.lat]},__dragEnable(n){this.$amapComponent&&this.$amapComponent.setStatus({dragEnable:n})},__zoomEnable(n){this.$amapComponent&&this.$amapComponent.setStatus({zoomEnable:n})},__jogEnable(n){this.$amapComponent&&this.$amapComponent.setStatus({jogEnable:n})},__keyboardEnable(n){this.$amapComponent&&this.$amapComponent.setStatus({keyboardEnable:n})},__doubleClickZoom(n){this.$amapComponent&&this.$amapComponent.setStatus({doubleClickZoom:n})},__scrollWheel(n){this.$amapComponent&&this.$amapComponent.setStatus({scrollWheel:n})},__rotateEnable(n){this.$amapComponent&&this.$amapComponent.setStatus({rotateEnable:n})},__resizeEnable(n){this.$amapComponent&&this.$amapComponent.setStatus({resizeEnable:n})},__showIndoorMap(n){this.$amapComponent&&this.$amapComponent.setStatus({showIndoorMap:n})}}});const Yv={class:"el-vue-amap-container"},Jv=Go("div",{class:"el-vue-amap"},null,-1);function Zv(n,e,t,i,s,r){return Bt(),$t("div",Yv,[Jv,ti(n.$slots,"default")])}da.render=Zv,da.__file="src/packages/amap/amap.vue";const _h=ce(da);var yh=oe({name:"ElAmapControlControlBar",mixins:[ae],props:{position:{type:[String,Object]},offset:{type:Array},showControlButton:{type:Boolean,default:!0}},data(){return{}},methods:{__initComponent(n){return new Promise(e=>{this.$parentComponent.plugin(["AMap.ControlBar"],()=>{this.$amapComponent=new AMap.ControlBar(n),this.$parentComponent.addControl(this.$amapComponent),e()})})},destroyComponent(){this.$amapComponent&&this.$parentComponent&&(this.parentInstance.isDestroy||this.$parentComponent.removeControl(this.$amapComponent),this.$amapComponent=null,this.$parentComponent=null)}},render(){return null}});yh.__file="src/packages/control/ControlBar/ControlBar.vue";const vh=ce(yh);var xh=oe({name:"ElAmapControlHawkEye",mixins:[ae],props:{autoMove:{type:Boolean,default:!0},showRectangle:{type:Boolean,default:!0},showButton:{type:Boolean,default:!0},isOpen:{type:Boolean,default:!0},mapStyle:{type:String},layers:{type:Array},width:{type:String},height:{type:String},offset:{type:Array},borderStyle:{type:String},borderColor:{type:String},borderRadius:{type:String},borderWidth:{type:String},buttonSize:{type:String}},data(){return{}},methods:{__initComponent(n){return new Promise(e=>{this.$parentComponent.plugin(["AMap.HawkEye"],()=>{this.$amapComponent=new AMap.HawkEye(n),this.$parentComponent.addControl(this.$amapComponent),e()})})},destroyComponent(){this.$amapComponent&&this.$parentComponent&&(this.parentInstance.isDestroy||this.$parentComponent.removeControl(this.$amapComponent),this.$amapComponent=null,this.$parentComponent=null)},__isOpen(n){n===!1?this.$amapComponent.close():this.$amapComponent.open()}},render(){return null}});xh.__file="src/packages/control/HawkEye/HawkEye.vue";const bh=ce(xh);var Mh=oe({name:"ElAmapControlMapType",mixins:[ae],props:{defaultType:{type:Number},showTraffic:{type:Boolean,default:!1},showRoad:{type:Boolean,default:!1}},data(){return{}},methods:{__initComponent(n){return new Promise(e=>{this.$parentComponent.plugin(["AMap.MapType"],()=>{this.$amapComponent=new AMap.MapType(n),this.$parentComponent.addControl(this.$amapComponent),e()})})},destroyComponent(){this.$amapComponent&&this.$parentComponent&&(this.parentInstance.isDestroy||this.$parentComponent.removeControl(this.$amapComponent),this.$amapComponent=null,this.$parentComponent=null)}},render(){return null}});Mh.__file="src/packages/control/MapType/MapType.vue";const Sh=ce(Mh);var wh=oe({name:"ElAmapControlScale",mixins:[ae],props:{position:{type:[String,Object]},offset:{type:Array}},data(){return{}},methods:{__initComponent(n){return new Promise(e=>{this.$parentComponent.plugin(["AMap.Scale"],()=>{this.$amapComponent=new AMap.Scale(n),this.$parentComponent.addControl(this.$amapComponent),e()})})},destroyComponent(){this.$amapComponent&&this.$parentComponent&&(this.parentInstance.isDestroy||this.$parentComponent.removeControl(this.$amapComponent),this.$amapComponent=null,this.$parentComponent=null)}},render(){return null}});wh.__file="src/packages/control/Scale/Scale.vue";const Ch=ce(wh);var Ah=oe({name:"ElAmapControlToolBar",mixins:[ae],props:{position:{type:[String,Object]},offset:{type:Array}},data(){return{}},methods:{__initComponent(n){return new Promise(e=>{this.$parentComponent.plugin(["AMap.ToolBar"],()=>{this.$amapComponent=new AMap.ToolBar(n),this.$parentComponent.addControl(this.$amapComponent),e()})})},destroyComponent(){this.$amapComponent&&this.$parentComponent&&(this.parentInstance.isDestroy||this.$parentComponent.removeControl(this.$amapComponent),this.$amapComponent=null,this.$parentComponent=null)}},render(){return null}});Ah.__file="src/packages/control/ToolBar/ToolBar.vue";const Th=ce(Ah);var pa=oe({name:"ElAmapSearchBox",mixins:[ae],props:{type:{type:String},city:{type:String},datatype:{type:String},citylimit:{type:Boolean,default:!1},inputId:{type:String},inputCustom:{type:Boolean,default:!1},outputId:{type:String},outPutDirAuto:{type:Boolean,default:!0},closeResultOnScroll:{type:Boolean,default:!0},lang:{type:String},placeholder:{type:String}},data(){return{saveInputId:"",saveVisible:!0}},created(){this.saveInputId=pc()},methods:{__initComponent(n){return n.inputId&&(this.saveInputId=n.inputId,delete n.inputId),n.visible&&(this.saveVisible=n.visible),n.input=this.saveInputId,n.outputId&&(n.output=n.outputId,delete n.outputId),new Promise(e=>{this.$parentComponent.plugin(["AMap.AutoComplete"],()=>{this.$amapComponent=new AMap.AutoComplete(n),e()})})},__visible(n){this.saveVisible=n},__citylimit(n){this.$amapComponent.setCityLimit(n)}}});const Kv={class:"el-vue-search-box-container"},Qv=["id","placeholder"];function ex(n,e,t,i,s,r){return Mg((Bt(),$t("div",Kv,[n.inputCustom?Sg("v-if",!0):(Bt(),$t("input",{key:0,id:n.saveInputId,type:"text",placeholder:n.placeholder},null,8,Qv))],512)),[[wg,n.visible&&!n.inputCustom]])}pa.render=ex,pa.__file="src/packages/control/SearchBox/SearchBox.vue";const Eh=ce(pa);var fa=oe({name:"ElAmapInfoWindow",mixins:[ae],props:{isCustom:{type:Boolean,default:!1},autoMove:{type:Boolean,default:!0},avoid:{type:Array},closeWhenClickMap:{type:Boolean,default:!1},content:{type:[String,Object]},size:{type:Array},anchor:{type:String},offset:{type:Array},position:{type:Array}},emits:["update:visible"],data(){return{converters:{}}},unmounted(){this.$amapComponent&&this.$amapComponent.close()},updated(){!this.content&&this.$amapComponent&&this.$amapComponent.setContent(this.$refs.info)},methods:{__initComponent(n){if(n.content||(n.content=this.getSlotContent()),this.$amapComponent=new AMap.InfoWindow(n),this.$amapComponent.on("close",()=>{this.$emit("update:visible",!1)}),this.visible!==!1&&this.$amapComponent.open(this.$parentComponent,this.position),!this.content&&this.$amapComponent){const e={attributes:!0,childList:!0,subtree:!0},t=new MutationObserver(()=>{this.$amapComponent.setContent(this.getSlotContent())});t.observe(this.$refs.info,e),this.observer=t}},getSlotContent(){return this.$refs.info},destroyComponent(){this.observer&&(this.observer.disconnect(),this.observer=null),this.$amapComponent&&(this.$amapComponent.getIsOpen()&&this.$amapComponent.close(),this.$amapComponent=null,this.$parentComponent=null)},__position(n){this.visible?this.$amapComponent.open(this.$parentComponent,n):this.$amapComponent.setPosition(n)},__visible(n){const e=this.$amapComponent.getPosition();e&&(n===!1?this.$amapComponent.close():this.$amapComponent.open(this.$parentComponent,[e.lng,e.lat]))}}});const tx={style:{display:"none"}},nx={ref:"info"};function ix(n,e,t,i,s,r){return Bt(),$t("div",tx,[Go("div",nx,[ti(n.$slots,"default")],512)])}fa.render=ix,fa.__file="src/packages/infoWindow/InfoWindow/InfoWindow.vue";const Lh=ce(fa);var Rh=oe({name:"ElAmapLayerCanvas",mixins:[ae],props:{canvas:{required:!0,type:Object},zooms:{type:Array},bounds:{type:[Array,Object]},opacity:{type:Number}},data(){return{handlers:{}}},methods:{__initComponent(n){this.$amapComponent=new AMap.CanvasLayer(n),this.$parentComponent.addLayer(this.$amapComponent)},destroyComponent(){this.parentInstance.isDestroy||this.$parentComponent.removeLayer(this.$amapComponent),this.$amapComponent=null,this.$parentComponent=null}},render(){return null}});Rh.__file="src/packages/layer/data/Canvas/Canvas.vue";const Ph=ce(Rh);var Ih=oe({name:"ElAmapLayerCustom",mixins:[ae],props:{canvas:{required:!0,type:Object},render:{type:Function},zooms:{type:Array},opacity:{type:Number},alwaysRender:{type:Boolean,default:!1}},data(){return{}},methods:{__initComponent(n){const e=n.canvas;delete n.canvas,this.$amapComponent=new AMap.CustomLayer(e,n),this.$amapComponent.setMap(this.$parentComponent)},destroyComponent(){this.$amapComponent.setMap(null),this.$amapComponent=null,this.$parentComponent=null}},render(){return null}});Ih.__file="src/packages/layer/data/Custom/Custom.vue";const Dh=ce(Ih);var Fh=oe({name:"ElAmapLayerFlexible",mixins:[ae],props:{cacheSize:{type:Number},createTile:{type:Function},zooms:{type:Array},opacity:{type:Array},tileSize:{type:Number}},data(){return{}},methods:{__initComponent(n){this.$amapComponent=new AMap.TileLayer.Flexible(n),this.$amapComponent.setMap(this.$parentComponent)},destroyComponent(){this.$amapComponent.destroy(),this.$amapComponent.setMap(null),this.$amapComponent=null,this.$parentComponent=null}},render(){return null}});Fh.__file="src/packages/layer/data/Flexible/Flexible.vue";const Oh=ce(Fh);var Nh=oe({name:"ElAmapLayerGlCustom",mixins:[ae],props:{init:{type:Function},render:{type:Function},zooms:{type:Array},opacity:{type:Number}},data(){return{}},methods:{__initComponent(n){this.$amapComponent=new AMap.GLCustomLayer(n),this.$amapComponent.setMap(this.$parentComponent)},destroyComponent(){this.$amapComponent.setMap(null),this.$amapComponent=null,this.$parentComponent=null}},render(){return null}});Nh.__file="src/packages/layer/data/GLCustom/GLCustom.vue";const kh=ce(Nh);var Bh=oe({name:"ElAmapLayerHeatMap",mixins:[ae],props:{radius:{type:Number},gradient:{type:Object},zooms:{type:Array},opacity:{type:Array},config:{type:Object},dataSet:{type:Object}},data(){return{propsRedirect:{config:"3d"}}},methods:{__initComponent(n){return new Promise(e=>{AMap.plugin(["AMap.HeatMap"],()=>{delete n.dataSet,this.$amapComponent=new AMap.HeatMap(this.$parentComponent,n),this.dataSet&&this.$amapComponent.setDataSet(this.dataSet),e()})})},destroyComponent(){this.$amapComponent.setDataSet({data:[]}),this.$amapComponent.setMap(null),this.$amapComponent=null,this.$parentComponent=null}},render(){return null}});Bh.__file="src/packages/layer/data/HeatMap/HeatMap.vue";const $h=ce(Bh);var Uh=oe({name:"ElAmapLayerImage",mixins:[ae],props:{url:{type:String,required:!0},zoom:{type:Array},bounds:{type:[Array,Object]},opacity:{type:Number}},data(){return{}},methods:{__initComponent(n){this.$amapComponent=new AMap.ImageLayer(n),this.$parentComponent.addLayer(this.$amapComponent)},destroyComponent(){this.parentInstance.isDestroy||this.$parentComponent.removeLayer(this.$amapComponent),this.$amapComponent=null,this.$parentComponent=null},__url(n){this.$amapComponent.setImageUrl(n)}},render(){return null}});Uh.__file="src/packages/layer/data/Image/Image.vue";const zh=ce(Uh);var ma=oe({name:"ElAmapLayerLabels",mixins:[ae],provide(){return{parentInstance:this}},props:{zooms:{type:Array},opacity:{type:Number},collision:{type:Boolean,default:!0},allowCollision:{type:Boolean,default:!1}},data(){return{}},methods:{__initComponent(n){this.$amapComponent=new AMap.LabelsLayer(n),this.$parentComponent.add(this.$amapComponent)},$$add(n){this.$amapComponent.add(n)},destroyComponent(){this.parentInstance.isDestroy||this.$parentComponent.removeLayer(this.$amapComponent),this.$amapComponent=null,this.$parentComponent=null}}});function sx(n,e,t,i,s,r){return Bt(),$t("div",null,[ti(n.$slots,"default")])}ma.render=sx,ma.__file="src/packages/layer/data/Labels/Labels.vue";const Gh=ce(ma);var ga=oe({name:"ElAmapLayerVector",mixins:[ae],provide(){return{parentInstance:this}},props:{},data(){return{}},methods:{__initComponent(n){this.$amapComponent=new AMap.VectorLayer(n),this.$parentComponent.add(this.$amapComponent)},destroyComponent(){this.parentInstance.isDestroy||this.$parentComponent.removeLayer(this.$amapComponent),this.$amapComponent=null,this.$parentComponent=null}}});function rx(n,e,t,i,s,r){return Bt(),$t("div",null,[ti(n.$slots,"default")])}ga.render=rx,ga.__file="src/packages/layer/data/Vector/Vector.vue";const Vh=ce(ga);var Hh=oe({name:"ElAmapLayerBuildings",mixins:[ae],props:{wallColor:{type:[String,Array]},roofColor:{type:[String,Array]},heightFactor:{type:Number},styleOpts:{type:Object},zooms:{type:Array},opacity:{type:Number}},data(){return{}},methods:{__initComponent(n){this.$amapComponent=new AMap.Buildings(n),this.$parentComponent.add(this.$amapComponent),this.styleOpts&&this.__styleOpts(this.styleOpts)},destroyComponent(){this.$amapComponent.destroy(),this.parentInstance.isDestroy||this.$parentComponent.remove(this.$amapComponent),this.$amapComponent=null,this.$parentComponent=null},__styleOpts(n){this.$amapComponent.setStyle(n)}},render(){return null}});Hh.__file="src/packages/layer/official/Buildings/Buildings.vue";const Wh=ce(Hh);var jh=oe({name:"ElAmapLayerDefault",mixins:[ae],props:{zoom:{type:Array},opacity:{type:Number}},data(){return{}},methods:{__initComponent(n){this.$amapComponent=AMap.createDefaultLayer(n),this.$parentComponent.add(this.$amapComponent)}},render(){return null}});jh.__file="src/packages/layer/official/DefaultLayer/DefaultLayer.vue";const qh=ce(jh);var Xh=oe({name:"ElAmapLayerDistrict",mixins:[ae],props:{type:{type:String,default:"Country",validator(n){return["World","Country","Province"].indexOf(n)!==-1}},adcode:{type:String},SOC:{type:String},depth:{type:Number},zooms:{type:Array},opacity:{type:Number},styles:{type:Object}},data(){return{}},methods:{__initComponent(n){this.type==="World"?this.$amapComponent=new AMap.DistrictLayer.World(n):this.type==="Country"?this.$amapComponent=new AMap.DistrictLayer.Country(n):this.type==="Province"&&(this.$amapComponent=new AMap.DistrictLayer.Province(n)),this.$parentComponent.add(this.$amapComponent)},destroyComponent(){this.parentInstance.isDestroy||this.$parentComponent.remove(this.$amapComponent),this.$amapComponent=null,this.$parentComponent=null},__SOC(n){this.$amapComponent.setSOC(n)}},render(){return null}});Xh.__file="src/packages/layer/official/DistrictLayer/DistrictLayer.vue";const Yh=ce(Xh);var Jh=oe({name:"ElAmapLayerIndoorMap",mixins:[ae],props:{opacity:{type:Number},cursor:{type:String},hideFloorBar:{type:Boolean,default:!1}},data(){return{}},methods:{__initComponent(n){return new Promise(e=>{AMap.plugin(["AMap.IndoorMap"],()=>{this.$amapComponent=new AMap.IndoorMap(n);const t=this.$parentComponent.getLayers();t.push(this.$amapComponent),this.$parentComponent.setLayers(t),e()})})},destroyComponent(){const n=this.$parentComponent.getLayers();let e=-1;for(let t=0;t-1&&(n.splice(e,1),this.$parentComponent.setLayers(n)),this.$amapComponent=null,this.$parentComponent=null},__hideFloorBar(n){n===!1?this.$amapComponent.hideFloorBar():this.$amapComponent.showFloorBar()}},render(){return null}});Jh.__file="src/packages/layer/official/IndoorMap/IndoorMap.vue";const Zh=ce(Jh);var Kh=oe({name:"ElAmapLayerRoadNet",mixins:[ae],props:{zooms:{type:Array},opacity:{type:Number},tileSize:{type:Number}},data(){return{}},methods:{__initComponent(n){this.$amapComponent=new AMap.TileLayer.RoadNet(n),this.$parentComponent.add(this.$amapComponent)},destroyComponent(){this.$amapComponent.destroy(),this.parentInstance.isDestroy||this.$parentComponent.remove(this.$amapComponent),this.$amapComponent=null,this.$parentComponent=null}},render(){return null}});Kh.__file="src/packages/layer/official/RoadNet/RoadNet.vue";const Qh=ce(Kh);var eu=oe({name:"ElAmapLayerSatellite",mixins:[ae],props:{zooms:{type:Array},opacity:{type:Number},tileSize:{type:Number}},data(){return{}},methods:{__initComponent(n){this.$amapComponent=new AMap.TileLayer.Satellite(n),this.$parentComponent.add(this.$amapComponent)},destroyComponent(){this.$amapComponent.destroy(),this.parentInstance.isDestroy||this.$parentComponent.remove(this.$amapComponent),this.$amapComponent=null,this.$parentComponent=null}},render(){return null}});eu.__file="src/packages/layer/official/Satellite/Satellite.vue";const tu=ce(eu);var nu=oe({name:"ElAmapLayerTile",mixins:[ae],props:{tileUrl:{type:String,required:!0},zoom:{type:Array},dataZooms:{type:Array},opacity:{type:Number},tileSize:{type:Number}},data(){return{}},methods:{__initComponent(n){this.$amapComponent=new AMap.TileLayer(n),this.$parentComponent.add(this.$amapComponent)},destroyComponent(){this.parentInstance.isDestroy||this.$parentComponent.remove(this.$amapComponent),this.$amapComponent=null,this.$parentComponent=null}},render(){return null}});nu.__file="src/packages/layer/official/TileLayer/TileLayer.vue";const iu=ce(nu);var su=oe({name:"ElAmapLayerTraffic",mixins:[ae],props:{autoRefresh:{type:Boolean,defult:!0},interval:{type:Number},zooms:{type:Array},opacity:{type:Number},tileSize:{type:Number}},data(){return{}},methods:{__initComponent(n){this.$amapComponent=new AMap.TileLayer.Traffic(n),this.$parentComponent.add(this.$amapComponent)},stopFresh(){this.$amapComponent&&this.$amapComponent.stopFresh()},destroyComponent(){this.parentInstance.isDestroy||this.$parentComponent.remove(this.$amapComponent),this.$amapComponent=null,this.$parentComponent=null}},render(){return null}});su.__file="src/packages/layer/official/Traffic/Traffic.vue";const ru=ce(su);var ou=oe({name:"ElAmapLayerMapboxVectorTile",mixins:[ae],props:{url:{type:String},zooms:{type:Array},dataZooms:{type:Array},opacity:{type:Number},styles:{type:Object}},data(){return{}},methods:{__initComponent(n){return new Promise(e=>{AMap.plugin(["AMap.MapboxVectorTileLayer"],()=>{this.$amapComponent=new AMap.MapboxVectorTileLayer(n),this.$parentComponent.addLayer(this.$amapComponent),e()})})},destroyComponent(){this.parentInstance.isDestroy||this.$parentComponent.removeLayer(this.$amapComponent),this.$amapComponent=null,this.$parentComponent=null}},render(){return null}});ou.__file="src/packages/layer/standard/MapboxVectorTileLayer/MapboxVectorTileLayer.vue";const au=ce(ou);var lu=oe({name:"ElAmapLayerWms",mixins:[ae],props:{url:{type:String},blend:{type:Boolean,default:!1},params:{type:Object},zooms:{type:Array},opacity:{type:Number}},data(){return{}},methods:{__initComponent(n){this.$amapComponent=new AMap.TileLayer.WMS(n),this.$parentComponent.add(this.$amapComponent)},destroyComponent(){this.parentInstance.isDestroy||this.$parentComponent.remove(this.$amapComponent),this.$amapComponent=null,this.$parentComponent=null}},render(){return null}});lu.__file="src/packages/layer/standard/WMS/WMS.vue";const cu=ce(lu);var hu=oe({name:"ElAmapLayerWmts",mixins:[ae],props:{url:{type:String},blend:{type:Boolean,default:!1},params:{type:Object},zooms:{type:Array},opacity:{type:Number}},data(){return{}},methods:{__initComponent(n){this.$amapComponent=new AMap.TileLayer.WMS(n),this.$parentComponent.add(this.$amapComponent)},destroyComponent(){this.parentInstance.isDestroy||this.$parentComponent.remove(this.$amapComponent),this.$amapComponent=null,this.$parentComponent=null}},render(){return null}});hu.__file="src/packages/layer/standard/WMTS/WMTS.vue";const uu=ce(hu);var Tt=oe({props:{sourceUrl:{type:String},sourceData:{type:Object},geoBufferSource:{type:[ArrayBuffer,String],default(){return null}},layerStyle:{type:Object},defaultStyleValue:{type:Object,default(){return{}}},zooms:{type:Array},opacity:{type:Number},initEvents:{type:Boolean,default:!0},visibleDuration:{type:Number,default:0},onClick:{type:Function,default:null},onMousemove:{type:Function,default:null},onRightclick:{type:Function,default:null}},emits:["mousemove","click","rightclick"],data(){return{isDragging:!1,isRotating:!1}},methods:{setSource(){this.source&&(this.source.destroy(),this.source=null),this.geoBufferSource?typeof this.geoBufferSource=="string"?this.source=new Loca.GeoBufferSource({url:this.geoBufferSource}):this.source=new Loca.GeoBufferSource({data:this.geoBufferSource}):this.sourceUrl?this.source=new Loca.GeoJSONSource({url:this.sourceUrl}):this.sourceData?this.source=new Loca.GeoJSONSource({data:this.sourceData}):this.source=new Loca.GeoJSONSource({}),this.$amapComponent.setSource(this.source)},initComplete(){this.initEvents&&this.bindEvents()},destroyComponent(){this.unBindEvents(),this.parentInstance.isDestroy||(this.$parentComponent.remove(this.$amapComponent),this.$amapComponent.destroy()),this.source&&(this.source.destroy(),this.source=null),this.$amapComponent=null,this.$parentComponent=null},bindEvents(){if(this.parentInstance){const n=this.parentInstance.getMap(),e=this.$props;e.onClick!==null&&n.on("click",this.clickMap),e.onMousemove!==null&&(n.on("mousemove",this.mouseMoveMap),n.on("dragstart",this.dragStart),n.on("dragend",this.dragEnd),n.on("rotatestart",this.rotateStart),n.on("rotateend",this.rotateEnd),n.on("mouseout",this.mouseoutMap)),e.onRightclick!==null&&n.on("rightclick",this.rightclickMap)}},clickMap(n){const e=this._getFeature(n);this.$emit("click",e,n)},rightclickMap(n){const e=this._getFeature(n);this.$emit("rightclick",e,n)},mouseMoveMap(n){if(this.isDragging||this.isRotating)return;const e=this._getFeature(n);this.$emit("mousemove",e,n)},_getFeature(n){return this.$amapComponent.queryFeature(n.pixel.toArray())},dragStart(){this.isDragging=!0},dragEnd(){this.isDragging=!1},mouseoutMap(){this.isDragging=!1,this.isRotating=!1},rotateStart(){this.isRotating=!0},rotateEnd(){this.isRotating=!1},unBindEvents(){if(this.parentInstance){const n=this.parentInstance.getMap();n.off("click",this.clickMap),n.off("rightclick",this.rightclickMap),n.off("mousemove",this.mouseMoveMap),n.off("dragstart",this.dragStart),n.off("dragend",this.dragEnd),n.off("rotatestart",this.rotateStart),n.off("rotateend",this.rotateEnd),n.off("mouseout",this.mouseoutMap)}},__layerStyle(n){this.$nextTick(()=>{this.$amapComponent.setStyle&&this.$amapComponent.setStyle(n)})},__sourceUrl(){this.$nextTick(()=>{this.setSource()})},__sourceData(){this.$nextTick(()=>{this.setSource()})},__geoBufferSource(){this.$nextTick(()=>{this.setSource()})},__visible(n){this.$amapComponent.show&&this.$amapComponent.hide&&(n===!1?this.$amapComponent.hide(this.visibleDuration):this.$amapComponent.show(this.visibleDuration))}}}),du=oe({name:"ElAmapLocaGrid",mixins:[ae,Tt],props:{cullface:{type:String},acceptLight:{type:Boolean,default:!0},shininess:{type:Number},hasSide:{type:Boolean,default:!0},depth:{type:Boolean,default:!0}},data(){return{converters:{},handlers:{}}},methods:{__initComponent(n){this.$amapComponent=new Loca.GridLayer(n),this.setSource(),this.setStyle(),this.$parentComponent.add(this.$amapComponent),this.initComplete()},setStyle(){const e=Object.assign({},{topColor:"#fff",sideTopColor:"#fff",sideBottomColor:"#fff",altitude:0,height:0,radius:1e3,gap:0,unit:"meter"},this.defaultStyleValue),t={topColor:(s,r)=>(r.properties=r.properties||{},r.properties.topColor===void 0?e.topColor:r.properties.topColor),sideTopColor:(s,r)=>(r.properties=r.properties||{},r.properties.sideTopColor===void 0?e.sideTopColor:r.properties.sideTopColor),sideBottomColor:(s,r)=>(r.properties=r.properties||{},r.properties.sideBottomColor===void 0?e.sideBottomColor:r.properties.sideBottomColor),altitude:(s,r)=>(r.properties=r.properties||{},r.properties.altitude===void 0?e.altitude:r.properties.altitude),height:(s,r)=>(r.properties=r.properties||{},r.properties.height===void 0?e.height:r.properties.height),radius:e.radius,gap:e.gap,unit:e.unit},i=Object.assign({},t,this.layerStyle);this.$amapComponent.setStyle(i)}},render(){return null}});du.__file="src/packages/loca/GridLayer/GridLayer.vue";const pu=ce(du);var fu=oe({name:"ElAmapLocaHeatmap",mixins:[ae,Tt],props:{depth:{type:Boolean,default:!0}},data(){return{converters:{}}},methods:{__initComponent(n){this.$amapComponent=new Loca.HeatMapLayer(n),this.setSource(),this.setStyle(),this.$parentComponent.add(this.$amapComponent),this.initComplete()},setStyle(){const e=Object.assign({},{radius:20,value:10,gradient:{.5:"blue",.65:"rgb(117,211,248)",.7:"rgb(0, 255, 0)",.9:"#ffea00",1:"red"},opacity:[0,1],height:100,heightBezier:[.4,.2,.4,.8],max:null,min:null,unit:"px",difference:!1},this.defaultStyleValue),t={radius:(s,r)=>(r.properties=r.properties||{},r.properties.radius===void 0?e.radius:r.properties.radius),value:(s,r)=>(r.properties=r.properties||{},r.properties.value===void 0?e.value:r.properties.value),gradient:e.gradient,opacity:e.opacity,height:e.height,heightBezier:e.heightBezier,max:e.max,min:e.min,unit:e.unit,difference:e.difference},i=Object.assign({},t,this.layerStyle);this.$amapComponent.setStyle(i)}},render(){return null}});fu.__file="src/packages/loca/HeatMapLayer/HeatMapLayer.vue";const mu=ce(fu);var gu=oe({name:"ElAmapLocaHexagon",mixins:[ae,Tt],props:{cullface:{type:String},acceptLight:{type:Boolean,default:!0},shininess:{type:Number},hasSide:{type:Boolean,default:!0},depth:{type:Boolean,default:!0}},data(){return{}},methods:{__initComponent(n){this.$amapComponent=new Loca.HexagonLayer(n),this.setSource(),this.setStyle(),this.$parentComponent.add(this.$amapComponent),this.initComplete()},setStyle(){const e=Object.assign({},{topColor:"#fff",sideTopColor:"#fff",sideBottomColor:"#fff",altitude:0,height:0,radius:1e3,gap:0,unit:"meter"},this.defaultStyleValue),t={topColor:(s,r)=>(r.properties=r.properties||{},r.properties.topColor===void 0?e.topColor:r.properties.topColor),sideTopColor:(s,r)=>(r.properties=r.properties||{},r.properties.sideTopColor===void 0?e.sideTopColor:r.properties.sideTopColor),sideBottomColor:(s,r)=>(r.properties=r.properties||{},r.properties.sideBottomColor===void 0?e.sideBottomColor:r.properties.sideBottomColor),altitude:(s,r)=>(r.properties=r.properties||{},r.properties.altitude===void 0?e.altitude:r.properties.altitude),height:(s,r)=>(r.properties=r.properties||{},r.properties.height===void 0?e.height:r.properties.height),radius:e.radius,gap:e.gap,unit:e.unit},i=Object.assign({},t,this.layerStyle);this.$amapComponent.setStyle(i)}},render(){return null}});gu.__file="src/packages/loca/HexagonLayer/HexagonLayer.vue";const _u=ce(gu);var yu=oe({name:"ElAmapLocaIcon",mixins:[ae,Tt],props:{},data(){return{converters:{}}},methods:{__initComponent(n){this.$amapComponent=new Loca.IconLayer(n),this.setSource(),this.setStyle(),this.$parentComponent.add(this.$amapComponent),this.initComplete()},setStyle(){const e=Object.assign({},{unit:"px",icon:"",iconSize:[20,20],rotation:0,opacity:1,offset:[0,0]},this.defaultStyleValue),t={unit:e.unit,icon:(s,r)=>(r.properties=r.properties||{},r.properties.icon===void 0?e.icon:r.properties.icon),iconSize:(s,r)=>(r.properties=r.properties||{},r.properties.iconSize===void 0?e.iconSize:r.properties.iconSize),rotation:(s,r)=>(r.properties=r.properties||{},r.properties.rotation===void 0?e.rotation:r.properties.rotation),opacity:(s,r)=>(r.properties=r.properties||{},r.properties.opacity===void 0?e.opacity:r.properties.opacity),offset:(s,r)=>(r.properties=r.properties||{},r.properties.offset===void 0?e.offset:r.properties.offset)},i=Object.assign({},t,this.layerStyle);this.$amapComponent.setStyle(i)}},render(){return null}});yu.__file="src/packages/loca/IconLayer/IconLayer.vue";const vu=ce(yu);var xu=oe({name:"ElAmapLocaLine",mixins:[ae,Tt],props:{},data(){return{converters:{}}},methods:{__initComponent(n){this.$amapComponent=new Loca.LineLayer(n),this.setSource(),this.setStyle(),this.$parentComponent.add(this.$amapComponent),this.initComplete()},setStyle(){const e=Object.assign({},{color:"#fff",lineWidth:2,altitude:0,borderWidth:0,borderColor:"#fff",dashArray:[10,0,10,0]},this.defaultStyleValue),i=Object.assign({},{color:(s,r)=>(r.properties=r.properties||{},r.properties.color===void 0?e.color:r.properties.color),lineWidth:(s,r)=>(r.properties=r.properties||{},r.properties.lineWidth===void 0?e.lineWidth:r.properties.lineWidth),altitude:(s,r)=>(r.properties=r.properties||{},r.properties.altitude===void 0?e.altitude:r.properties.altitude),borderWidth:(s,r)=>(r.properties=r.properties||{},r.properties.borderWidth===void 0?e.borderWidth:r.properties.borderWidth),borderColor:(s,r)=>(r.properties=r.properties||{},r.properties.borderColor===void 0?e.borderColor:r.properties.borderColor),dashArray:(s,r)=>(r.properties=r.properties||{},r.properties.dashArray===void 0?e.dashArray:r.properties.dashArray)},this.layerStyle);this.$amapComponent.setStyle(i)}},render(){return null}});xu.__file="src/packages/loca/LineLayer/LineLayer.vue";const bu=ce(xu);var Mu=oe({name:"ElAmapLocaLink",mixins:[ae,Tt],props:{},data(){return{converters:{}}},methods:{__initComponent(n){this.$amapComponent=new Loca.LinkLayer(n),this.setSource(),this.setStyle(),this.$parentComponent.add(this.$amapComponent),this.initComplete()},setStyle(){const e=Object.assign({},{lineColors:["rgba(255,255,255,1)","rgba(255,255,255,0)"],height:100,smoothSteps:100},this.defaultStyleValue),i=Object.assign({},{lineColors:(s,r)=>(r.properties=r.properties||{},r.properties.lineColors===void 0?e.lineColors:r.properties.lineColors),height:(s,r)=>(r.properties=r.properties||{},r.properties.height===void 0?e.height:r.properties.height),smoothSteps:(s,r)=>(r.properties=r.properties||{},r.properties.smoothSteps===void 0?e.smoothSteps:r.properties.smoothSteps)},this.layerStyle);this.$amapComponent.setStyle(i)}},render(){return null}});Mu.__file="src/packages/loca/LinkLayer/LinkLayer.vue";const Su=ce(Mu);var _a=oe({name:"ElAmapLoca",mixins:[ae],provide(){return{parentInstance:this}},props:{ambLight:{type:Object},dirLight:{type:Object},pointLight:{type:Object},onClick:{type:Function,default:null},onMousemove:{type:Function,default:null},onRightclick:{type:Function,default:null},eventOptions:{type:Object,default:()=>({hitFirst:!0})}},emits:["mousemove","click","rightclick"],data(){return{isDragging:!1,isRotating:!1,hitFirst:!0}},unmounted(){this.$amapComponent=null,this.$parentComponent=null},methods:{__initComponent(n){this.$amapComponent=new Loca.Container({map:this.$parentComponent}),n.ambLight&&(this.$amapComponent.ambLight=n.ambLight),n.dirLight&&(this.$amapComponent.dirLight=n.dirLight),n.pointLight&&(this.$amapComponent.pointLight=n.pointLight),this.hitFirst=n.eventOptions.hitFirst,this.bindEvents()},bindEvents(){if(this.parentInstance){const n=this.getMap(),e=this.$props;e.onClick!==null&&n.on("click",this.clickMap),e.onMousemove!==null&&(n.on("mousemove",this.mouseMoveMap),n.on("dragstart",this.dragStart),n.on("dragend",this.dragEnd),n.on("rotatestart",this.rotateStart),n.on("rotateend",this.rotateEnd),n.on("mouseout",this.mouseoutMap)),e.onRightclick!==null&&n.on("rightclick",this.rightclickMap)}},clickMap(n){const e=this._getFeature(n);this.$emit("click",e,n)},rightclickMap(n){const e=this._getFeature(n);this.$emit("rightclick",e,n)},mouseMoveMap(n){if(this.isDragging||this.isRotating)return;const e=this._getFeature(n);this.$emit("mousemove",e,n)},_getFeature(n){const e=[];if(this.$amapComponent.layers){const t=[];this.$amapComponent.layers.forEach(s=>{t.push(s)}),t.sort((s,r)=>r.zIndex-s.zIndex);const i=t.length;for(let s=0;s(r.properties=r.properties||{},r.properties.radius===void 0?e.radius:r.properties.radius),color:(s,r)=>(r.properties=r.properties||{},r.properties.color===void 0?e.color:r.properties.color),unit:e.unit,borderWidth:(s,r)=>(r.properties=r.properties||{},r.properties.borderWidth===void 0?e.borderWidth:r.properties.borderWidth),borderColor:(s,r)=>(r.properties=r.properties||{},r.properties.borderColor===void 0?e.borderColor:r.properties.borderColor),blurWidth:(s,r)=>(r.properties=r.properties||{},r.properties.blurWidth===void 0?e.blurWidth:r.properties.blurWidth)},i=Object.assign({},t,this.layerStyle);this.$amapComponent.setStyle(i)}},render(){return null}});Cu.__file="src/packages/loca/PointLayer/PointLayer.vue";const Au=ce(Cu);var Tu=oe({name:"ElAmapLocaPolygon",mixins:[ae,Tt],props:{cullface:{type:String},acceptLight:{type:Boolean,default:!0},shininess:{type:Number},hasSide:{type:Boolean,default:!0},hasBottom:{type:Boolean,default:!1},blockHide:{type:Boolean,default:!0},depth:{type:Boolean,default:!0}},data(){return{converters:{}}},methods:{__initComponent(n){this.$amapComponent=new Loca.PolygonLayer(n),this.setSource(),this.setStyle(),this.$parentComponent.add(this.$amapComponent),this.initComplete()},setStyle(){const e=Object.assign({},{topColor:"#fff",sideTopColor:"#fff",sideBottomColor:"#fff",altitude:0,height:0,texture:null,textureSize:[20,3],label:void 0,labelAltitude:0},this.defaultStyleValue),t={topColor:(s,r)=>(r.properties=r.properties||{},r.properties.topColor===void 0?e.topColor:r.properties.topColor),sideTopColor:(s,r)=>(r.properties=r.properties||{},r.properties.sideTopColor===void 0?e.sideTopColor:r.properties.sideTopColor),sideBottomColor:(s,r)=>(r.properties=r.properties||{},r.properties.sideBottomColor===void 0?e.sideBottomColor:r.properties.sideBottomColor),altitude:(s,r)=>(r.properties=r.properties||{},r.properties.altitude===void 0?e.altitude:r.properties.altitude),height:(s,r)=>(r.properties=r.properties||{},r.properties.height===void 0?e.height:r.properties.height),texture:e.texture,textureSize:(s,r)=>(r.properties=r.properties||{},r.properties.textureSize===void 0?e.textureSize:r.properties.textureSize),label:(s,r)=>(r.properties=r.properties||{},r.properties.label===void 0?e.label:r.properties.label),labelAltitude:(s,r)=>(r.properties=r.properties||{},r.properties.labelAltitude===void 0?e.labelAltitude:r.properties.labelAltitude)},i=Object.assign({},t,this.layerStyle);this.$amapComponent.setStyle(i)}},render(){return null}});Tu.__file="src/packages/loca/PolygonLayer/PolygonLayer.vue";const Eu=ce(Tu);var Lu=oe({name:"ElAmapLocaPrism",mixins:[ae,Tt],props:{cullface:{type:String},acceptLight:{type:Boolean,default:!0},shininess:{type:Number},hasSide:{type:Boolean,default:!0},depth:{type:Boolean,default:!0}},data(){return{}},methods:{__initComponent(n){this.$amapComponent=new Loca.PrismLayer(n),this.setSource(),this.setStyle(),this.$parentComponent.add(this.$amapComponent),this.initComplete()},setStyle(){const e=Object.assign({},{radius:20,unit:"px",sideNumber:3,rotation:0,altitude:0,height:100,topColor:"#fff",sideTopColor:"#fff",sideBottomColor:"#fff"},this.defaultStyleValue),t={radius:e.radius,unit:e.unit,sideNumber:e.sideNumber,rotation:(s,r)=>(r.properties=r.properties||{},r.properties.rotation===void 0?e.rotation:r.properties.rotation),altitude:e.altitude,height:(s,r)=>(r.properties=r.properties||{},r.properties.height===void 0?e.height:r.properties.height),topColor:(s,r)=>(r.properties=r.properties||{},r.properties.topColor===void 0?e.topColor:r.properties.topColor),sideTopColor:(s,r)=>(r.properties=r.properties||{},r.properties.sideTopColor===void 0?e.sideTopColor:r.properties.sideTopColor),sideBottomColor:(s,r)=>(r.properties=r.properties||{},r.properties.sideBottomColor===void 0?e.sideBottomColor:r.properties.sideBottomColor)},i=Object.assign({},t,this.layerStyle);this.$amapComponent.setStyle(i)}},render(){return null}});Lu.__file="src/packages/loca/PrismLayer/PrismLayer.vue";const Ru=ce(Lu);var Pu=oe({name:"ElAmapLocaPulseLine",mixins:[ae,Tt],props:{depth:{type:Boolean,default:!0}},data(){return{converters:{}}},methods:{__initComponent(n){this.$amapComponent=new Loca.PulseLineLayer(n),this.setSource(),this.setStyle(),this.$parentComponent.add(this.$amapComponent),this.initComplete()},setStyle(){const e=Object.assign({},{lineWidth:1,headColor:"rgba(0, 0, 0, 0.75)",trailColor:"rgba(0, 0, 0, 0.25)",altitude:0,interval:1,duration:2e3},this.defaultStyleValue),t={lineWidth:(s,r)=>(r.properties=r.properties||{},r.properties.lineWidth===void 0?e.lineWidth:r.properties.lineWidth),headColor:(s,r)=>(r.properties=r.properties||{},r.properties.headColor===void 0?e.headColor:r.properties.headColor),trailColor:(s,r)=>(r.properties=r.properties||{},r.properties.trailColor===void 0?e.trailColor:r.properties.trailColor),altitude:e.altitude,interval:e.interval,duration:e.duration},i=Object.assign({},t,this.layerStyle);this.$amapComponent.setStyle(i)}},render(){return null}});Pu.__file="src/packages/loca/PulseLineLayer/PulseLineLayer.vue";const Iu=ce(Pu);var Du=oe({name:"ElAmapLocaPulseLink",mixins:[ae,Tt],props:{depth:{type:Boolean,default:!0}},data(){return{converters:{}}},methods:{__initComponent(n){this.$amapComponent=new Loca.PulseLinkLayer(n),this.setSource(),this.setStyle(),this.$parentComponent.add(this.$amapComponent),this.initComplete()},setStyle(){const e=Object.assign({},{lineColors:["#fff"],height:100,maxHeightScale:0,smoothSteps:50,lineWidth:[1,1],unit:"px",dash:[4e3,0,4e3,0],speed:100,headColor:"rgba(0, 0, 0, 0.75)",trailColor:"rgba(0, 0, 0, 0.25)",flowLength:100},this.defaultStyleValue),t={lineColors:(s,r)=>(r.properties=r.properties||{},r.properties.lineColors===void 0?e.lineColors:r.properties.lineColors),height:(s,r)=>(r.properties=r.properties||{},r.properties.height===void 0?e.height:r.properties.height),maxHeightScale:(s,r)=>(r.properties=r.properties||{},r.properties.maxHeightScale===void 0?e.maxHeightScale:r.properties.maxHeightScale),smoothSteps:(s,r)=>(r.properties=r.properties||{},r.properties.smoothSteps===void 0?e.smoothSteps:r.properties.smoothSteps),lineWidth:(s,r)=>(r.properties=r.properties||{},r.properties.lineWidth===void 0?e.lineWidth:r.properties.lineWidth),unit:e.unit,dash:(s,r)=>(r.properties=r.properties||{},r.properties.dash===void 0?e.dash:r.properties.dash),speed:(s,r)=>(r.properties=r.properties||{},r.properties.speed===void 0?e.speed:r.properties.speed),headColor:(s,r)=>(r.properties=r.properties||{},r.properties.headColor===void 0?e.headColor:r.properties.headColor),trailColor:(s,r)=>(r.properties=r.properties||{},r.properties.trailColor===void 0?e.trailColor:r.properties.trailColor),flowLength:e.flowLength},i=Object.assign({},t,this.layerStyle);this.$amapComponent.setStyle(i)}},render(){return null}});Du.__file="src/packages/loca/PulseLinkLayer/PulseLinkLayer.vue";const Fu=ce(Du);var Ou=oe({name:"ElAmapLocaScatter",mixins:[ae,Tt],props:{},data(){return{converters:{}}},methods:{__initComponent(n){this.$amapComponent=new Loca.ScatterLayer(n),this.setSource(),this.setStyle(),this.$parentComponent.add(this.$amapComponent),this.initComplete()},setStyle(){const e=Object.assign({},{size:[20,20],rotation:0,color:"rgba(200,200,200,1)",altitude:0,borderWidth:0,borderColor:"rgba(250,250,250,1)",texture:null,unit:"px",animate:!1,duration:0},this.defaultStyleValue),t={size:(s,r)=>(r.properties=r.properties||{},r.properties.size===void 0?e.size:r.properties.size),rotation:(s,r)=>(r.properties=r.properties||{},r.properties.rotation===void 0?e.rotation:r.properties.rotation),color:(s,r)=>(r.properties=r.properties||{},r.properties.color===void 0?e.color:r.properties.color),altitude:(s,r)=>(r.properties=r.properties||{},r.properties.altitude===void 0?e.altitude:r.properties.altitude),borderWidth:(s,r)=>(r.properties=r.properties||{},r.properties.borderWidth===void 0?e.borderWidth:r.properties.borderWidth),borderColor:(s,r)=>(r.properties=r.properties||{},r.properties.borderColor===void 0?e.borderColor:r.properties.borderColor),texture:e.texture,unit:e.unit,animate:e.animate,duration:e.duration},i=Object.assign({},t,this.layerStyle);this.$amapComponent.setStyle(i)}},render(){return null}});Ou.__file="src/packages/loca/ScatterLayer/ScatterLayer.vue";const Nu=ce(Ou);var ku=oe({name:"ElAmapLocaZMarker",mixins:[ae,Tt],props:{},data(){return{converters:{}}},methods:{__initComponent(n){this.$amapComponent=new Loca.ZMarkerLayer(n),this.setSource(),this.setStyle(),this.$parentComponent.add(this.$amapComponent),this.initComplete()},setStyle(){const e=Object.assign({},{unit:"px",content:"",size:[20,20],rotation:0,alwaysFront:!1,altitude:0},this.defaultStyleValue),t={unit:e.unit,content:(s,r)=>(r.properties=r.properties||{},r.properties.content===void 0?e.content:r.properties.content),size:(s,r)=>(r.properties=r.properties||{},r.properties.size===void 0?e.size:r.properties.size),rotation:(s,r)=>(r.properties=r.properties||{},r.properties.rotation===void 0?e.rotation:r.properties.rotation),alwaysFront:e.alwaysFront,altitude:(s,r)=>(r.properties=r.properties||{},r.properties.altitude===void 0?e.altitude:r.properties.altitude)},i=Object.assign({},t,this.layerStyle);this.$amapComponent.setStyle(i)}},render(){return null}});ku.__file="src/packages/loca/ZMarkerLayer/ZMarkerLayer.vue";const Bu=ce(ku);var $u=oe({name:"ElAmapElasticMarker",mixins:[ae],props:{position:{type:[Array,Object],required:!0},title:{type:String},offset:{type:[Array,Object]},clickable:{type:Boolean,default:!0},draggable:{type:Boolean,default:!1},bubble:{type:Boolean,default:!1},zooms:{type:Array},cursor:{type:String},topWhenClick:{type:Boolean,default:!1},zoomStyleMapping:{type:Object},styles:{type:Array},extData:{type:Object,default:()=>null}},emits:["update:position"],data(){return{converters:{}}},methods:{__initComponent(n){return new Promise(e=>{AMap.plugin(["AMap.ElasticMarker"],()=>{this.$amapComponent=new AMap.ElasticMarker(n),this.$parentComponent.add(this.$amapComponent),this.bindModelEvents(),e()})})},bindModelEvents(){this.$amapComponent.on("dragend",()=>{this.emitPosition()}),this.$amapComponent.on("touchend",()=>{this.emitPosition()})},emitPosition(){const n=this.$amapComponent.getPosition();this.$emit("update:position",n.toArray())},destroyComponent(){this.parentInstance.isDestroy||this.$parentComponent.remove(this.$amapComponent),this.$amapComponent=null,this.$parentComponent=null}},render(){return null}});$u.__file="src/packages/marker/ElasticMarker/ElasticMarker.vue";const Uu=ce($u);var zu=oe({name:"ElAmapLabelMarker",mixins:[ae],props:{name:{type:String},position:{type:[Array,Object],required:!0},zooms:{type:Array},opacity:{type:Number},rank:{type:Number},icon:{type:Object},text:{type:Object},extData:null},data(){return{converters:{}}},methods:{__initComponent(n){this.$amapComponent=new AMap.LabelMarker(n),this.$parentComponent.add(this.$amapComponent)},destroyComponent(){this.parentInstance.isDestroy||this.$parentComponent.remove(this.$amapComponent),this.$amapComponent=null,this.$parentComponent=null}},render(){return null}});zu.__file="src/packages/marker/LabelMarker/LabelMarker.vue";const Gu=ce(zu);var ya=oe({name:"ElAmapMarker",mixins:[ae],props:{position:{type:[Array,Object],required:!0},icon:{type:[String,Object]},content:{type:[String,HTMLElement]},title:{type:String},offset:{type:[Array,Object]},anchor:{type:[String,Array]},angle:{type:Number},clickable:{type:Boolean,default:!0},draggable:{type:Boolean,default:!1},bubble:{type:Boolean,default:!1},zooms:{type:Array},cursor:{type:String},topWhenClick:{type:Boolean,default:!1},label:{type:Object},extData:null},emits:["update:position"],data(){return{withSlot:!1,converters:{}}},methods:{__initComponent(n){if(this.$slots.default&&this.$slots.default().length>0&&(this.withSlot=!0,n.content=this.getSlotContent()),this.$amapComponent=new AMap.Marker(n),Rt(this.$parentComponent)?this.$parentComponent.add(this.$amapComponent):Pt(this.$parentComponent)&&this.$parentComponent.addOverlay(this.$amapComponent),this.withSlot){const e={attributes:!0,childList:!0,subtree:!0},t=new MutationObserver(()=>{this.$amapComponent.setContent(this.getSlotContent())});t.observe(this.$refs.content,e),this.observer=t}this.bindModelEvents()},getSlotContent(){return this.$refs.content},bindModelEvents(){this.$amapComponent.on("dragend",()=>{this.emitPosition()}),this.$amapComponent.on("touchend",()=>{this.emitPosition()})},emitPosition(){const n=this.$amapComponent.getPosition();this.$emit("update:position",n.toArray())},destroyComponent(){this.observer&&(this.observer.disconnect(),this.observer=null),this.$amapComponent.setMap(null),this.$amapComponent=null,this.$parentComponent=null}}});const ax={style:{display:"none"}},lx={ref:"content"};function cx(n,e,t,i,s,r){return Bt(),$t("div",ax,[Go("div",lx,[ti(n.$slots,"default")],512)])}ya.render=cx,ya.__file="src/packages/marker/Marker/Marker.vue";const Vu=ce(ya);var Hu=oe({name:"ElAmapMarkerCluster",mixins:[ae],props:{points:{type:Array,required:!0},gridSize:{type:Number},maxZoom:{type:Number},averageCenter:{type:Boolean,default:!0},clusterByZoomChange:{type:Boolean,default:!1},styles:{type:Array},renderClusterMarker:{type:Function},renderMarker:{type:Function}},data(){return{converters:{}}},methods:{__initComponent(n){return new Promise(e=>{AMap.plugin(["AMap.MarkerCluster"],()=>{const t=n.points;delete n.points,this.$amapComponent=new AMap.MarkerCluster(this.$parentComponent,t,n),e()})})},destroyComponent(){this.$amapComponent.setMap(null),this.$amapComponent=null,this.$parentComponent=null},__points(n){this.$amapComponent&&this.$amapComponent.setData(n)}},render(){return null}});Hu.__file="src/packages/marker/MarkerCluster/MarkerCluster.vue";const Wu=ce(Hu);var ju=oe({name:"ElAmapMassMarks",mixins:[ae],props:{data:{type:Array,required:!0},zooms:{type:Array},cursor:{type:String},styles:{type:[Array,Object]}},data(){return{propsRedirect:{styles:"style"},converters:{}}},methods:{__initComponent(n){const e=n.data;delete n.data,this.$amapComponent=new AMap.MassMarks(e,n),this.$amapComponent.setMap(this.$parentComponent)},destroyComponent(){this.$amapComponent.clear(),this.$amapComponent.setMap(null),this.$amapComponent=null,this.$parentComponent=null}},render(){return null}});ju.__file="src/packages/marker/MassMarks/MassMarks.vue";const qu=ce(ju);var Xu=oe({name:"ElAmapText",mixins:[ae],props:{position:{type:[Array,Object],required:!0},text:{type:String},title:{type:String},offset:{type:[Array,Object]},anchor:{type:[String,Array]},angle:{type:Number},clickable:{type:Boolean,default:!0},draggable:{type:Boolean,default:!1},bubble:{type:Boolean,default:!1},zooms:{type:Array},cursor:{type:String},topWhenClick:{type:Boolean,default:!1},textStyle:{type:Object},extData:null},emits:["update:position"],data(){return{propsRedirect:{textStyle:"style"},converters:{}}},methods:{__initComponent(n){this.$amapComponent=new AMap.Text(n),this.$parentComponent.add(this.$amapComponent),this.bindModelEvents()},bindModelEvents(){this.$amapComponent.on("dragend",()=>{this.emitPosition()}),this.$amapComponent.on("touchend",()=>{this.emitPosition()})},emitPosition(){const n=this.$amapComponent.getPosition();this.$emit("update:position",n.toArray())},destroyComponent(){this.$amapComponent.setMap(null),this.$amapComponent=null,this.$parentComponent=null}},render(){return null}});Xu.__file="src/packages/marker/Text/Text.vue";const Yu=ce(Xu);var Ni=oe({props:{editable:{type:Boolean,default:void 0},editOptions:{type:Object}},data(){return{}},methods:{setEditorEvents(){if(!this.$amapComponent.editor)return;const n=["addnode","adjust","removenode","end","move","add"],e={};Object.keys(this.$attrs).forEach(t=>{if(gc.test(t)){const i=mc(t);n.indexOf(i)!==-1&&(e[i]=this.$attrs[t])}}),Object.keys(e).forEach(t=>{Ho.addListener(this.$amapComponent.editor,t,e[t])})}}}),Ju=oe({name:"ElAmapBezierCurve",mixins:[ae,Ni],props:{path:{type:Array,required:!0},bubble:{type:Boolean,default:!1},cursor:{type:String},strokeColor:{type:String},strokeOpacity:{type:Number},strokeWeight:{type:Number},borderWeight:{type:Number},isOutline:{type:Boolean,default:!1},outlineColor:{type:String},draggable:{type:Boolean,default:!1},extData:{type:Object,default:()=>null},strokeStyle:{type:String,validator(n){return["solid","dashed"].indexOf(n)!==-1}},strokeDasharray:{type:Array},lineJoin:{type:String,validator(n){return["miter","round","bevel"].indexOf(n)!==-1}},lineCap:{type:String,validator(n){return["butt","round","square"].indexOf(n)!==-1}},geodesic:{type:Boolean,default:!1},showDir:{type:Boolean,default:!1}},emits:["update:path"],data(){return{converters:{}}},methods:{__initComponent(n){this.$amapComponent=new AMap.BezierCurve(n),Rt(this.$parentComponent)?this.$parentComponent.add(this.$amapComponent):Pt(this.$parentComponent)?this.$parentComponent.addOverlay(this.$amapComponent):Ut(this.$parentComponent)&&this.$parentComponent.add(this.$amapComponent),this.bindModelEvents()},bindModelEvents(){this.$amapComponent.on("dragend",()=>{this.emitModel(this.$amapComponent)}),this.$amapComponent.on("touchend",()=>{this.emitModel(this.$amapComponent)})},createEditor(){return new Promise(n=>{this.$amapComponent.editor?n():AMap.plugin(["AMap.BezierCurveEditor"],()=>{this.$amapComponent.editor=new AMap.BezierCurveEditor(this.$parentComponent,this.$amapComponent,this.editOptions),this.setEditorEvents(),this.bindEditorModelEvents(),n()})})},bindEditorModelEvents(){this.$amapComponent.editor.on("addnode",n=>{this.emitModel(n.target)}),this.$amapComponent.editor.on("adjust",n=>{this.emitModel(n.target)}),this.$amapComponent.editor.on("removenode",n=>{this.emitModel(n.target)}),this.$amapComponent.editor.on("add",n=>{this.emitModel(n.target)}),this.$amapComponent.editor.on("end",n=>{this.emitModel(n.target)})},emitModel(n){this.$emit("update:path",n.getPath())},destroyComponent(){this.$amapComponent.editor&&(this.parentInstance.isDestroy||this.$amapComponent.editor.close(),this.$amapComponent.editor=null),this.parentInstance.isDestroy||(Rt(this.$parentComponent)?this.$parentComponent.remove(this.$amapComponent):Pt(this.$parentComponent)?this.$parentComponent.removeOverlay(this.$amapComponent):Ut(this.$parentComponent)&&this.$parentComponent.remove(this.$amapComponent)),this.$amapComponent.destroy&&this.$amapComponent.destroy(),this.$amapComponent=null,this.$parentComponent=null},__zIndex(n){this.$amapComponent&&this.$amapComponent.setOptions({zIndex:n})},__strokeColor(n){this.$amapComponent&&this.$amapComponent.setOptions({strokeColor:n})},__strokeOpacity(n){this.$amapComponent&&this.$amapComponent.setOptions({strokeOpacity:n})},__strokeWeight(n){this.$amapComponent&&this.$amapComponent.setOptions({strokeWeight:n})},__borderWeight(n){this.$amapComponent&&this.$amapComponent.setOptions({borderWeight:n})},__isOutline(n){this.$amapComponent&&this.$amapComponent.setOptions({isOutline:n})},__outlineColor(n){this.$amapComponent&&this.$amapComponent.setOptions({outlineColor:n})},__strokeStyle(n){this.$amapComponent&&this.$amapComponent.setOptions({strokeStyle:n})},__strokeDasharray(n){this.$amapComponent&&this.$amapComponent.setOptions({strokeDasharray:n})},__lineJoin(n){this.$amapComponent&&this.$amapComponent.setOptions({lineJoin:n})},__lineCap(n){this.$amapComponent&&this.$amapComponent.setOptions({lineCap:n})},__geodesic(n){this.$amapComponent&&this.$amapComponent.setOptions({geodesic:n})},__showDir(n){this.$amapComponent&&this.$amapComponent.setOptions({showDir:n})},__editable(n){this.createEditor().then(()=>{n===!0?this.$amapComponent.editor.open():this.$amapComponent.editor.close()})}},render(){return null}});Ju.__file="src/packages/vector/BezierCurve/BezierCurve.vue";const Zu=ce(Ju);var Ku=oe({name:"ElAmapCircle",mixins:[ae,Ni],props:{center:{type:Array,required:!0},radius:{type:Number,required:!0},bubble:{type:Boolean,default:!1},cursor:{type:String},strokeColor:{type:String},strokeOpacity:{type:Number},strokeWeight:{type:Number},fillColor:{type:String},fillOpacity:{type:Number},draggable:{type:Boolean,default:!1},extData:{type:Object,default:()=>null},strokeStyle:{type:String,validator(n){return["solid","dashed"].indexOf(n)!==-1}},strokeDasharray:{type:Array}},emits:["update:center","update:radius"],data(){return{converters:{}}},methods:{__initComponent(n){this.$amapComponent=new AMap.Circle(n),Rt(this.$parentComponent)?this.$parentComponent.add(this.$amapComponent):Pt(this.$parentComponent)?this.$parentComponent.addOverlay(this.$amapComponent):Ut(this.$parentComponent)&&this.$parentComponent.add(this.$amapComponent),this.bindModelEvents()},bindModelEvents(){this.$amapComponent.on("dragend",()=>{this.emitModel(this.$amapComponent)}),this.$amapComponent.on("touchend",()=>{this.emitModel(this.$amapComponent)})},createEditor(){return new Promise(n=>{this.$amapComponent.editor?n():AMap.plugin(["AMap.CircleEditor"],()=>{this.$amapComponent.editor=new AMap.CircleEditor(this.$parentComponent,this.$amapComponent,this.editOptions),this.setEditorEvents(),this.bindEditorModelEvents(),n()})})},bindEditorModelEvents(){this.$amapComponent.editor.on("addnode",n=>{this.emitModel(n.target)}),this.$amapComponent.editor.on("adjust",n=>{this.emitModel(n.target)}),this.$amapComponent.editor.on("move",n=>{this.emitModel(n.target)}),this.$amapComponent.editor.on("add",n=>{this.emitModel(n.target)}),this.$amapComponent.editor.on("end",n=>{this.emitModel(n.target)})},emitModel(n){this.$emit("update:center",n.getCenter().toArray()),this.$emit("update:radius",n.getRadius())},destroyComponent(){this.$amapComponent.editor&&(this.parentInstance.isDestroy||this.$amapComponent.editor.close(),this.$amapComponent.editor=null),this.parentInstance.isDestroy||(Rt(this.$parentComponent)?this.$parentComponent.remove(this.$amapComponent):Pt(this.$parentComponent)?this.$parentComponent.removeOverlay(this.$amapComponent):Ut(this.$parentComponent)&&this.$parentComponent.remove(this.$amapComponent)),this.$amapComponent.destroy&&this.$amapComponent.destroy(),this.$amapComponent=null,this.$parentComponent=null},__zIndex(n){this.$amapComponent&&this.$amapComponent.setOptions({zIndex:n})},__strokeColor(n){this.$amapComponent&&this.$amapComponent.setOptions({strokeColor:n})},__strokeOpacity(n){this.$amapComponent&&this.$amapComponent.setOptions({strokeOpacity:n})},__strokeWeight(n){this.$amapComponent&&this.$amapComponent.setOptions({strokeWeight:n})},__fillColor(n){this.$amapComponent&&this.$amapComponent.setOptions({fillColor:n})},__fillOpacity(n){this.$amapComponent&&this.$amapComponent.setOptions({fillOpacity:n})},__strokeStyle(n){this.$amapComponent&&this.$amapComponent.setOptions({strokeStyle:n})},__strokeDasharray(n){this.$amapComponent&&this.$amapComponent.setOptions({strokeDasharray:n})},__editable(n){this.createEditor().then(()=>{n===!0?this.$amapComponent.editor.open():this.$amapComponent.editor.close()})}},render(){return null}});Ku.__file="src/packages/vector/Circle/Circle.vue";const Qu=ce(Ku);var ed=oe({name:"ElAmapEllipse",mixins:[ae,Ni],props:{center:{type:Array,required:!0},radius:{type:Array,required:!0},bubble:{type:Boolean,default:!1},cursor:{type:String},strokeColor:{type:String},strokeOpacity:{type:Number},strokeWeight:{type:Number},fillColor:{type:String},fillOpacity:{type:Number},draggable:{type:Boolean,default:!1},extData:{type:Object,default:()=>null},strokeStyle:{type:String,validator(n){return["solid","dashed"].indexOf(n)!==-1}},strokeDasharray:{type:Array}},emits:["update:center","update:radius"],data(){return{converters:{}}},methods:{__initComponent(n){this.$amapComponent=new AMap.Ellipse(n),Rt(this.$parentComponent)?this.$parentComponent.add(this.$amapComponent):Pt(this.$parentComponent)?this.$parentComponent.addOverlay(this.$amapComponent):Ut(this.$parentComponent)&&this.$parentComponent.add(this.$amapComponent),this.bindModelEvents()},bindModelEvents(){this.$amapComponent.on("dragend",()=>{this.emitModel(this.$amapComponent)}),this.$amapComponent.on("touchend",()=>{this.emitModel(this.$amapComponent)})},createEditor(){return new Promise(n=>{this.$amapComponent.editor?n():AMap.plugin(["AMap.EllipseEditor"],()=>{this.$amapComponent.editor=new AMap.EllipseEditor(this.$parentComponent,this.$amapComponent,this.editOptions),this.setEditorEvents(),this.bindEditorModelEvents(),n()})})},bindEditorModelEvents(){this.$amapComponent.editor.on("addnode",n=>{this.emitModel(n.target)}),this.$amapComponent.editor.on("adjust",n=>{this.emitModel(n.target)}),this.$amapComponent.editor.on("move",n=>{this.emitModel(n.target)}),this.$amapComponent.editor.on("add",n=>{this.emitModel(n.target)}),this.$amapComponent.editor.on("end",n=>{this.emitModel(n.target)})},emitModel(n){this.$emit("update:center",n.getCenter().toArray()),this.$emit("update:radius",n.getRadius())},destroyComponent(){this.$amapComponent.editor&&(this.parentInstance.isDestroy||this.$amapComponent.editor.close(),this.$amapComponent.editor=null),this.parentInstance.isDestroy||(Rt(this.$parentComponent)?this.$parentComponent.remove(this.$amapComponent):Pt(this.$parentComponent)?this.$parentComponent.removeOverlay(this.$amapComponent):Ut(this.$parentComponent)&&this.$parentComponent.remove(this.$amapComponent)),this.$amapComponent.destroy&&this.$amapComponent.destroy(),this.$amapComponent=null,this.$parentComponent=null},__zIndex(n){this.$amapComponent&&this.$amapComponent.setOptions({zIndex:n})},__strokeColor(n){this.$amapComponent&&this.$amapComponent.setOptions({strokeColor:n})},__strokeOpacity(n){this.$amapComponent&&this.$amapComponent.setOptions({strokeOpacity:n})},__strokeWeight(n){this.$amapComponent&&this.$amapComponent.setOptions({strokeWeight:n})},__fillColor(n){this.$amapComponent&&this.$amapComponent.setOptions({fillColor:n})},__fillOpacity(n){this.$amapComponent&&this.$amapComponent.setOptions({fillOpacity:n})},__strokeStyle(n){this.$amapComponent&&this.$amapComponent.setOptions({strokeStyle:n})},__strokeDasharray(n){this.$amapComponent&&this.$amapComponent.setOptions({strokeDasharray:n})},__editable(n){this.createEditor().then(()=>{n===!0?this.$amapComponent.editor.open():this.$amapComponent.editor.close()})}},render(){return null}});ed.__file="src/packages/vector/Ellipse/Ellipse.vue";const td=ce(ed);var nd=oe({name:"ElAmapGeojson",mixins:[ae],props:{geo:{type:Object,required:!0},markerOptions:{type:Object},getMarker:{type:Function},polylineOptions:{type:Object},getPolyline:{type:Function},polygonOptions:{type:Object},getPolygon:{type:Function}},data(){return{propsRedirect:{geo:"geoJSON"},converters:{}}},methods:{__initComponent(n){return new Promise(e=>{AMap.plugin(["AMap.GeoJSON"],()=>{n.getMarker||(n.getMarker=this.createMarker),n.getPolyline||(n.getPolyline=this.createPolyline),n.getPolygon||(n.getPolygon=this.createPolygon),this.$amapComponent=new AMap.GeoJSON(n),this.$parentComponent.add(this.$amapComponent),e()})})},createMarker(n,e){let t=this.markerOptions||{};return t=Oi({},t,n.properties),t.position=e,new AMap.Marker(t)},createPolyline(n,e){let t=this.polylineOptions||{};return t=Oi({},t,n.properties),t.path=e,new AMap.Polyline(t)},createPolygon(n,e){let t=this.polygonOptions||{};return t=Oi({},t,n.properties),t.path=e,new AMap.Polygon(t)},destroyComponent(){this.parentInstance.isDestroy||this.$parentComponent.remove(this.$amapComponent),this.$amapComponent=null,this.$parentComponent=null},__geoJSON(n){this.$amapComponent&&this.$amapComponent.importData(n)}},render(){return null}});nd.__file="src/packages/vector/GeoJSON/GeoJSON.vue";const id=ce(nd);var sd=oe({name:"ElAmapPolygon",mixins:[ae,Ni],props:{path:{type:Array,required:!0},bubble:{type:Boolean,default:!1},cursor:{type:String},strokeColor:{type:String},strokeOpacity:{type:Number},strokeWeight:{type:Number},fillColor:{type:String},fillOpacity:{type:Number},draggable:{type:Boolean,default:!1},extData:{type:Object,default:()=>null},strokeStyle:{type:String,validator(n){return["solid","dashed"].indexOf(n)!==-1}},strokeDasharray:{type:Array}},emits:["update:path"],data(){return{converters:{}}},methods:{__initComponent(n){this.$amapComponent=new AMap.Polygon(n),Rt(this.$parentComponent)?this.$parentComponent.add(this.$amapComponent):Pt(this.$parentComponent)?this.$parentComponent.addOverlay(this.$amapComponent):Ut(this.$parentComponent)&&this.$parentComponent.add(this.$amapComponent),this.bindModelEvents()},bindModelEvents(){this.$amapComponent.on("dragend",()=>{this.emitModel(this.$amapComponent)}),this.$amapComponent.on("touchend",()=>{this.emitModel(this.$amapComponent)})},createEditor(){return new Promise(n=>{this.$amapComponent.editor?n():AMap.plugin(["AMap.PolygonEditor"],()=>{this.$amapComponent.editor=new AMap.PolygonEditor(this.$parentComponent,this.$amapComponent,this.editOptions),this.setEditorEvents(),this.bindEditorModelEvents(),n()})})},bindEditorModelEvents(){this.$amapComponent.editor.on("addnode",n=>{this.emitModel(n.target)}),this.$amapComponent.editor.on("adjust",n=>{this.emitModel(n.target)}),this.$amapComponent.editor.on("removenode",n=>{this.emitModel(n.target)}),this.$amapComponent.editor.on("add",n=>{this.emitModel(n.target)}),this.$amapComponent.editor.on("end",n=>{this.emitModel(n.target)})},emitModel(n){const t=n.getPath().map(Wo);this.$emit("update:path",t)},destroyComponent(){this.$amapComponent.editor&&(this.parentInstance.isDestroy||this.$amapComponent.editor.close(),this.$amapComponent.editor=null),this.parentInstance.isDestroy||(Rt(this.$parentComponent)?this.$parentComponent.remove(this.$amapComponent):Pt(this.$parentComponent)?this.$parentComponent.removeOverlay(this.$amapComponent):Ut(this.$parentComponent)&&this.$parentComponent.remove(this.$amapComponent)),this.$amapComponent.destroy&&this.$amapComponent.destroy(),this.$amapComponent=null,this.$parentComponent=null},__zIndex(n){this.$amapComponent&&this.$amapComponent.setOptions({zIndex:n})},__strokeColor(n){this.$amapComponent&&this.$amapComponent.setOptions({strokeColor:n})},__strokeOpacity(n){this.$amapComponent&&this.$amapComponent.setOptions({strokeOpacity:n})},__strokeWeight(n){this.$amapComponent&&this.$amapComponent.setOptions({strokeWeight:n})},__fillColor(n){this.$amapComponent&&this.$amapComponent.setOptions({fillColor:n})},__fillOpacity(n){this.$amapComponent&&this.$amapComponent.setOptions({fillOpacity:n})},__strokeStyle(n){this.$amapComponent&&this.$amapComponent.setOptions({strokeStyle:n})},__strokeDasharray(n){this.$amapComponent&&this.$amapComponent.setOptions({strokeDasharray:n})},__editable(n){this.createEditor().then(()=>{n===!0?this.$amapComponent.editor.open():this.$amapComponent.editor.close()})}},render(){return null}});sd.__file="src/packages/vector/Polygon/Polygon.vue";const rd=ce(sd);var od=oe({name:"ElAmapPolyline",mixins:[ae,Ni],props:{path:{type:Array,required:!0},bubble:{type:Boolean,default:!1},cursor:{type:String},strokeColor:{type:String},strokeOpacity:{type:Number},strokeWeight:{type:Number},borderWeight:{type:Number},isOutline:{type:Boolean,default:!1},outlineColor:{type:String},draggable:{type:Boolean,default:!1},extData:{type:Object,default:()=>null},strokeStyle:{type:String,validator(n){return["solid","dashed"].indexOf(n)!==-1}},strokeDasharray:{type:Array},lineJoin:{type:String,validator(n){return["miter","round","bevel"].indexOf(n)!==-1}},lineCap:{type:String,validator(n){return["butt","round","square"].indexOf(n)!==-1}},geodesic:{type:Boolean,default:!1},showDir:{type:Boolean,default:!1}},emits:["update:path"],data(){return{converters:{}}},methods:{__initComponent(n){this.$amapComponent=new AMap.Polyline(n),Rt(this.$parentComponent)?this.$parentComponent.add(this.$amapComponent):Pt(this.$parentComponent)?this.$parentComponent.addOverlay(this.$amapComponent):Ut(this.$parentComponent)&&this.$parentComponent.add(this.$amapComponent),this.bindModelEvents()},bindModelEvents(){this.$amapComponent.on("dragend",()=>{this.emitModel(this.$amapComponent)}),this.$amapComponent.on("touchend",()=>{this.emitModel(this.$amapComponent)})},createEditor(){return new Promise(n=>{this.$amapComponent.editor?n():AMap.plugin(["AMap.PolylineEditor"],()=>{this.$amapComponent.editor=new AMap.PolylineEditor(this.$parentComponent,this.$amapComponent,this.editOptions),this.setEditorEvents(),this.bindEditorModelEvents(),n()})})},bindEditorModelEvents(){this.$amapComponent.editor.on("addnode",n=>{this.emitModel(n.target)}),this.$amapComponent.editor.on("adjust",n=>{this.emitModel(n.target)}),this.$amapComponent.editor.on("removenode",n=>{this.emitModel(n.target)}),this.$amapComponent.editor.on("add",n=>{this.emitModel(n.target)}),this.$amapComponent.editor.on("end",n=>{this.emitModel(n.target)})},emitModel(n){const t=n.getPath().map(Wo);this.$emit("update:path",t)},destroyComponent(){this.$amapComponent.editor&&(this.parentInstance.isDestroy||this.$amapComponent.editor.close(),this.$amapComponent.editor=null),this.parentInstance.isDestroy||(Rt(this.$parentComponent)?this.$parentComponent.remove(this.$amapComponent):Pt(this.$parentComponent)?this.$parentComponent.removeOverlay(this.$amapComponent):Ut(this.$parentComponent)&&this.$parentComponent.remove(this.$amapComponent)),this.$amapComponent.destroy&&this.$amapComponent.destroy(),this.$amapComponent=null,this.$parentComponent=null},__zIndex(n){this.$amapComponent&&this.$amapComponent.setOptions({zIndex:n})},__strokeColor(n){this.$amapComponent&&this.$amapComponent.setOptions({strokeColor:n})},__strokeOpacity(n){this.$amapComponent&&this.$amapComponent.setOptions({strokeOpacity:n})},__strokeWeight(n){this.$amapComponent&&this.$amapComponent.setOptions({strokeWeight:n})},__borderWeight(n){this.$amapComponent&&this.$amapComponent.setOptions({borderWeight:n})},__isOutline(n){this.$amapComponent&&this.$amapComponent.setOptions({isOutline:n})},__outlineColor(n){this.$amapComponent&&this.$amapComponent.setOptions({outlineColor:n})},__strokeStyle(n){this.$amapComponent&&this.$amapComponent.setOptions({strokeStyle:n})},__strokeDasharray(n){this.$amapComponent&&this.$amapComponent.setOptions({strokeDasharray:n})},__lineJoin(n){this.$amapComponent&&this.$amapComponent.setOptions({lineJoin:n})},__lineCap(n){this.$amapComponent&&this.$amapComponent.setOptions({lineCap:n})},__geodesic(n){this.$amapComponent&&this.$amapComponent.setOptions({geodesic:n})},__showDir(n){this.$amapComponent&&this.$amapComponent.setOptions({showDir:n})},__editable(n){this.createEditor().then(()=>{n===!0?this.$amapComponent.editor.open():this.$amapComponent.editor.close()})}},render(){return null}});od.__file="src/packages/vector/Polyline/Polyline.vue";const ad=ce(od);function ld(n){return new AMap.LngLat(n[0],n[1])}var cd=oe({name:"ElAmapRectangle",mixins:[ae,Ni],props:{bounds:{type:Array,required:!0},bubble:{type:Boolean,default:!1},cursor:{type:String},strokeColor:{type:String},strokeOpacity:{type:Number},strokeWeight:{type:Number},fillColor:{type:String},fillOpacity:{type:Number},draggable:{type:Boolean,default:!1},extData:{type:Object,default:()=>null},strokeStyle:{type:String,validator(n){return["solid","dashed"].indexOf(n)!==-1}},strokeDasharray:{type:Array}},emits:["update:bounds"],data(){return{converters:{bounds(n){return new AMap.Bounds(ld(n[0]),ld(n[1]))}}}},methods:{__initComponent(n){this.$amapComponent=new AMap.Rectangle(n),Rt(this.$parentComponent)?this.$parentComponent.add(this.$amapComponent):Pt(this.$parentComponent)?this.$parentComponent.addOverlay(this.$amapComponent):Ut(this.$parentComponent)&&this.$parentComponent.add(this.$amapComponent),this.bindModelEvents()},bindModelEvents(){this.$amapComponent.on("dragend",()=>{this.emitModel(this.$amapComponent)}),this.$amapComponent.on("touchend",()=>{this.emitModel(this.$amapComponent)})},createEditor(){return new Promise(n=>{this.$amapComponent.editor?n():AMap.plugin(["AMap.RectangleEditor"],()=>{this.$amapComponent.editor=new AMap.RectangleEditor(this.$parentComponent,this.$amapComponent,this.editOptions),this.setEditorEvents(),this.bindEditorModelEvents(),n()})})},bindEditorModelEvents(){this.$amapComponent.editor.on("addnode",n=>{this.emitModel(n.target)}),this.$amapComponent.editor.on("adjust",n=>{this.emitModel(n.target)}),this.$amapComponent.editor.on("move",n=>{this.emitModel(n.target)}),this.$amapComponent.editor.on("add",n=>{this.emitModel(n.target)}),this.$amapComponent.editor.on("end",n=>{this.emitModel(n.target)})},emitModel(n){const e=n.getBounds(),t=e.getSouthWest(),i=e.getNorthEast(),s=[t.toArray(),i.toArray()];this.$emit("update:bounds",s)},destroyComponent(){this.$amapComponent.editor&&(this.parentInstance.isDestroy||this.$amapComponent.editor.close(),this.$amapComponent.editor=null),this.parentInstance.isDestroy||(Rt(this.$parentComponent)?this.$parentComponent.remove(this.$amapComponent):Pt(this.$parentComponent)?this.$parentComponent.removeOverlay(this.$amapComponent):Ut(this.$parentComponent)&&this.$parentComponent.remove(this.$amapComponent)),this.$amapComponent.destroy&&this.$amapComponent.destroy(),this.$amapComponent=null,this.$parentComponent=null},__zIndex(n){this.$amapComponent&&this.$amapComponent.setOptions({zIndex:n})},__strokeColor(n){this.$amapComponent&&this.$amapComponent.setOptions({strokeColor:n})},__strokeOpacity(n){this.$amapComponent&&this.$amapComponent.setOptions({strokeOpacity:n})},__strokeWeight(n){this.$amapComponent&&this.$amapComponent.setOptions({strokeWeight:n})},__fillColor(n){this.$amapComponent&&this.$amapComponent.setOptions({fillColor:n})},__fillOpacity(n){this.$amapComponent&&this.$amapComponent.setOptions({fillOpacity:n})},__strokeStyle(n){this.$amapComponent&&this.$amapComponent.setOptions({strokeStyle:n})},__strokeDasharray(n){this.$amapComponent&&this.$amapComponent.setOptions({strokeDasharray:n})},__editable(n){this.createEditor().then(()=>{n===!0?this.$amapComponent.editor.open():this.$amapComponent.editor.close()})}},render(){return null}});cd.__file="src/packages/vector/Rectangle/Rectangle.vue";const hd=ce(cd);var ud=oe({name:"ElAmapLayerTiles3d",mixins:[ae],props:{url:{type:String,required:!0},threeScriptUrl:{type:String,default:"//a.amap.com/jsapi_demos/static/data3d/lib/three.117.js"},threeGltfLoader:{type:String,default:"//a.amap.com/jsapi_demos/static/data3d/lib/GLTFLoader.117.min.js"},layerStyle:{type:Object}},data(){return{}},methods:{__initComponent(n){return new Promise(e=>{this.$parentComponent.plugin(["AMap.3DTilesLayer"],()=>{window.THREE?(this.createLayer(n),e()):_c(n.threeScriptUrl,()=>{_c(n.threeGltfLoader,()=>{this.createLayer(n),e()})})})})},destroyComponent(){this.$amapComponent=null,this.$parentComponent=null},createLayer(n){let e={};n.layerStyle&&(e=JSON.parse(JSON.stringify(n.layerStyle))),this.$amapComponent=new AMap["3DTilesLayer"]({map:this.$parentComponent,url:n.url,style:e}),console.log(this.$amapComponent)}},render(){return null}});ud.__file="src/packages/layer/data/Tiles3D/Tiles3D.vue";const dd=ce(ud);/** * @license * Copyright 2010-2022 Three.js Authors * SPDX-License-Identifier: MIT */const va="143",hx=0,pd=1,ux=2,fd=1,dx=2,ks=3,ki=0,Yt=1,Jt=2,px=1,$n=0,Bi=1,md=2,gd=3,_d=4,fx=5,$i=100,mx=101,gx=102,yd=103,vd=104,_x=200,yx=201,vx=202,xx=203,xd=204,bd=205,bx=206,Mx=207,Sx=208,wx=209,Cx=210,Ax=0,Tx=1,Ex=2,xa=3,Lx=4,Rx=5,Px=6,Ix=7,Dr=0,Dx=1,Fx=2,yn=0,Ox=1,Nx=2,kx=3,Bx=4,$x=5,Md=300,Ui=301,zi=302,ba=303,Ma=304,Fr=306,ri=1e3,Et=1001,Or=1002,gt=1003,Sa=1004,wa=1005,Je=1006,Sd=1007,oi=1008,ai=1009,Ux=1010,zx=1011,wd=1012,Gx=1013,li=1014,zt=1015,Zt=1016,Vx=1017,Hx=1018,Gi=1020,Wx=1021,jx=1022,Kt=1023,qx=1024,Xx=1025,ci=1026,Vi=1027,Yx=1028,Jx=1029,Zx=1030,Kx=1031,Qx=1033,Ca=33776,Aa=33777,Ta=33778,Ea=33779,Cd=35840,Ad=35841,Td=35842,Ed=35843,eb=36196,Ld=37492,Rd=37496,Pd=37808,Id=37809,Dd=37810,Fd=37811,Od=37812,Nd=37813,kd=37814,Bd=37815,$d=37816,Ud=37817,zd=37818,Gd=37819,Vd=37820,Hd=37821,Wd=36492,tb=2200,nb=2201,ib=2202,Bs=2300,Hi=2301,La=2302,Wi=2400,ji=2401,Nr=2402,Ra=2500,sb=2501,rb=1,jd=2,hn=3e3,We=3001,ob=3200,ab=3201,kr=0,lb=1,vn="srgb",hi="srgb-linear",Pa=7680,cb=519,Ia=35044,qd="300 es",Da=1035;class ui{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(t)===-1&&i[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const i=this._listeners;return i[e]!==void 0&&i[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const s=this._listeners[e];if(s!==void 0){const r=s.indexOf(t);r!==-1&&s.splice(r,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const i=this._listeners[e.type];if(i!==void 0){e.target=this;const s=i.slice(0);for(let r=0,o=s.length;r>8&255]+vt[n>>16&255]+vt[n>>24&255]+"-"+vt[e&255]+vt[e>>8&255]+"-"+vt[e>>16&15|64]+vt[e>>24&255]+"-"+vt[t&63|128]+vt[t>>8&255]+"-"+vt[t>>16&255]+vt[t>>24&255]+vt[i&255]+vt[i>>8&255]+vt[i>>16&255]+vt[i>>24&255]).toLowerCase()}function lt(n,e,t){return Math.max(e,Math.min(t,n))}function Fa(n,e){return(n%e+e)%e}function hb(n,e,t,i,s){return i+(n-e)*(s-i)/(t-e)}function ub(n,e,t){return n!==e?(t-n)/(e-n):0}function zs(n,e,t){return(1-t)*n+t*e}function db(n,e,t,i){return zs(n,e,1-Math.exp(-t*i))}function pb(n,e=1){return e-Math.abs(Fa(n,e*2)-e)}function fb(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*(3-2*n))}function mb(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*n*(n*(n*6-15)+10))}function gb(n,e){return n+Math.floor(Math.random()*(e-n+1))}function _b(n,e){return n+Math.random()*(e-n)}function yb(n){return n*(.5-Math.random())}function vb(n){n!==void 0&&(Xd=n);let e=Xd+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function xb(n){return n*$s}function bb(n){return n*Us}function Oa(n){return(n&n-1)==0&&n!==0}function Yd(n){return Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))}function Br(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function Mb(n,e,t,i,s){const r=Math.cos,o=Math.sin,a=r(t/2),l=o(t/2),c=r((e+i)/2),u=o((e+i)/2),h=r((e-i)/2),d=o((e-i)/2),p=r((i-e)/2),g=o((i-e)/2);switch(s){case"XYX":n.set(a*u,l*h,l*d,a*c);break;case"YZY":n.set(l*d,a*u,l*h,a*c);break;case"ZXZ":n.set(l*h,l*d,a*u,a*c);break;case"XZX":n.set(a*u,l*g,l*p,a*c);break;case"YXY":n.set(l*p,a*u,l*g,a*c);break;case"ZYZ":n.set(l*g,l*p,a*u,a*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+s)}}function Sb(n,e){switch(e.constructor){case Float32Array:return n;case Uint16Array:return n/65535;case Uint8Array:return n/255;case Int16Array:return Math.max(n/32767,-1);case Int8Array:return Math.max(n/127,-1);default:throw new Error("Invalid component type.")}}function wb(n,e){switch(e.constructor){case Float32Array:return n;case Uint16Array:return Math.round(n*65535);case Uint8Array:return Math.round(n*255);case Int16Array:return Math.round(n*32767);case Int8Array:return Math.round(n*127);default:throw new Error("Invalid component type.")}}var qi=Object.freeze({__proto__:null,DEG2RAD:$s,RAD2DEG:Us,generateUUID:Gt,clamp:lt,euclideanModulo:Fa,mapLinear:hb,inverseLerp:ub,lerp:zs,damp:db,pingpong:pb,smoothstep:fb,smootherstep:mb,randInt:gb,randFloat:_b,randFloatSpread:yb,seededRandom:vb,degToRad:xb,radToDeg:bb,isPowerOfTwo:Oa,ceilPowerOfTwo:Yd,floorPowerOfTwo:Br,setQuaternionFromProperEuler:Mb,normalize:wb,denormalize:Sb});class te{constructor(e=0,t=0){te.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,i=this.y,s=e.elements;return this.x=s[0]*t+s[3]*i+s[6],this.y=s[1]*t+s[4]*i+s[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y;return t*t+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const i=Math.cos(t),s=Math.sin(t),r=this.x-e.x,o=this.y-e.y;return this.x=r*i-o*s+e.x,this.y=r*s+o*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Vt{constructor(){Vt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1]}set(e,t,i,s,r,o,a,l,c){const u=this.elements;return u[0]=e,u[1]=s,u[2]=a,u[3]=t,u[4]=r,u[5]=l,u[6]=i,u[7]=o,u[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],this}extractBasis(e,t,i){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,s=t.elements,r=this.elements,o=i[0],a=i[3],l=i[6],c=i[1],u=i[4],h=i[7],d=i[2],p=i[5],g=i[8],m=s[0],f=s[3],_=s[6],v=s[1],b=s[4],x=s[7],w=s[2],C=s[5],L=s[8];return r[0]=o*m+a*v+l*w,r[3]=o*f+a*b+l*C,r[6]=o*_+a*x+l*L,r[1]=c*m+u*v+h*w,r[4]=c*f+u*b+h*C,r[7]=c*_+u*x+h*L,r[2]=d*m+p*v+g*w,r[5]=d*f+p*b+g*C,r[8]=d*_+p*x+g*L,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],i=e[1],s=e[2],r=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8];return t*o*u-t*a*c-i*r*u+i*a*l+s*r*c-s*o*l}invert(){const e=this.elements,t=e[0],i=e[1],s=e[2],r=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],h=u*o-a*c,d=a*l-u*r,p=c*r-o*l,g=t*h+i*d+s*p;if(g===0)return this.set(0,0,0,0,0,0,0,0,0);const m=1/g;return e[0]=h*m,e[1]=(s*c-u*i)*m,e[2]=(a*i-s*o)*m,e[3]=d*m,e[4]=(u*t-s*l)*m,e[5]=(s*r-a*t)*m,e[6]=p*m,e[7]=(i*l-c*t)*m,e[8]=(o*t-i*r)*m,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,i,s,r,o,a){const l=Math.cos(r),c=Math.sin(r);return this.set(i*l,i*c,-i*(l*o+c*a)+o+e,-s*c,s*l,-s*(-c*o+l*a)+a+t,0,0,1),this}scale(e,t){const i=this.elements;return i[0]*=e,i[3]*=e,i[6]*=e,i[1]*=t,i[4]*=t,i[7]*=t,this}rotate(e){const t=Math.cos(e),i=Math.sin(e),s=this.elements,r=s[0],o=s[3],a=s[6],l=s[1],c=s[4],u=s[7];return s[0]=t*r+i*l,s[3]=t*o+i*c,s[6]=t*a+i*u,s[1]=-i*r+t*l,s[4]=-i*o+t*c,s[7]=-i*a+t*u,this}translate(e,t){const i=this.elements;return i[0]+=e*i[2],i[3]+=e*i[5],i[6]+=e*i[8],i[1]+=t*i[2],i[4]+=t*i[5],i[7]+=t*i[8],this}equals(e){const t=this.elements,i=e.elements;for(let s=0;s<9;s++)if(t[s]!==i[s])return!1;return!0}fromArray(e,t=0){for(let i=0;i<9;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e}clone(){return new this.constructor().fromArray(this.elements)}}function Jd(n){for(let e=n.length-1;e>=0;--e)if(n[e]>65535)return!0;return!1}function Gs(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}function di(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function $r(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}const Na={[vn]:{[hi]:di},[hi]:{[vn]:$r}},Qt={legacyMode:!0,get workingColorSpace(){return hi},set workingColorSpace(n){console.warn("THREE.ColorManagement: .workingColorSpace is readonly.")},convert:function(n,e,t){if(this.legacyMode||e===t||!e||!t)return n;if(Na[e]&&Na[e][t]!==void 0){const i=Na[e][t];return n.r=i(n.r),n.g=i(n.g),n.b=i(n.b),n}throw new Error("Unsupported color space conversion.")},fromWorkingColorSpace:function(n,e){return this.convert(n,this.workingColorSpace,e)},toWorkingColorSpace:function(n,e){return this.convert(n,e,this.workingColorSpace)}},Zd={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},ct={r:0,g:0,b:0},en={h:0,s:0,l:0},Ur={h:0,s:0,l:0};function ka(n,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?n+(e-n)*6*t:t<1/2?e:t<2/3?n+(e-n)*6*(2/3-t):n}function zr(n,e){return e.r=n.r,e.g=n.g,e.b=n.b,e}class ge{constructor(e,t,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,t===void 0&&i===void 0?this.set(e):this.setRGB(e,t,i)}set(e){return e&&e.isColor?this.copy(e):typeof e=="number"?this.setHex(e):typeof e=="string"&&this.setStyle(e),this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=vn){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Qt.toWorkingColorSpace(this,t),this}setRGB(e,t,i,s=hi){return this.r=e,this.g=t,this.b=i,Qt.toWorkingColorSpace(this,s),this}setHSL(e,t,i,s=hi){if(e=Fa(e,1),t=lt(t,0,1),i=lt(i,0,1),t===0)this.r=this.g=this.b=i;else{const r=i<=.5?i*(1+t):i+t-i*t,o=2*i-r;this.r=ka(o,r,e+1/3),this.g=ka(o,r,e),this.b=ka(o,r,e-1/3)}return Qt.toWorkingColorSpace(this,s),this}setStyle(e,t=vn){function i(r){r!==void 0&&parseFloat(r)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let s;if(s=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(e)){let r;const o=s[1],a=s[2];switch(o){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return this.r=Math.min(255,parseInt(r[1],10))/255,this.g=Math.min(255,parseInt(r[2],10))/255,this.b=Math.min(255,parseInt(r[3],10))/255,Qt.toWorkingColorSpace(this,t),i(r[4]),this;if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return this.r=Math.min(100,parseInt(r[1],10))/100,this.g=Math.min(100,parseInt(r[2],10))/100,this.b=Math.min(100,parseInt(r[3],10))/100,Qt.toWorkingColorSpace(this,t),i(r[4]),this;break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a)){const l=parseFloat(r[1])/360,c=parseInt(r[2],10)/100,u=parseInt(r[3],10)/100;return i(r[4]),this.setHSL(l,c,u,t)}break}}else if(s=/^\#([A-Fa-f\d]+)$/.exec(e)){const r=s[1],o=r.length;if(o===3)return this.r=parseInt(r.charAt(0)+r.charAt(0),16)/255,this.g=parseInt(r.charAt(1)+r.charAt(1),16)/255,this.b=parseInt(r.charAt(2)+r.charAt(2),16)/255,Qt.toWorkingColorSpace(this,t),this;if(o===6)return this.r=parseInt(r.charAt(0)+r.charAt(1),16)/255,this.g=parseInt(r.charAt(2)+r.charAt(3),16)/255,this.b=parseInt(r.charAt(4)+r.charAt(5),16)/255,Qt.toWorkingColorSpace(this,t),this}return e&&e.length>0?this.setColorName(e,t):this}setColorName(e,t=vn){const i=Zd[e.toLowerCase()];return i!==void 0?this.setHex(i,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=di(e.r),this.g=di(e.g),this.b=di(e.b),this}copyLinearToSRGB(e){return this.r=$r(e.r),this.g=$r(e.g),this.b=$r(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=vn){return Qt.fromWorkingColorSpace(zr(this,ct),e),lt(ct.r*255,0,255)<<16^lt(ct.g*255,0,255)<<8^lt(ct.b*255,0,255)<<0}getHexString(e=vn){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=hi){Qt.fromWorkingColorSpace(zr(this,ct),t);const i=ct.r,s=ct.g,r=ct.b,o=Math.max(i,s,r),a=Math.min(i,s,r);let l,c;const u=(a+o)/2;if(a===o)l=0,c=0;else{const h=o-a;switch(c=u<=.5?h/(o+a):h/(2-o-a),o){case i:l=(s-r)/h+(s2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement!="undefined"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&e instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&e instanceof ImageBitmap){const t=Gs("canvas");t.width=e.width,t.height=e.height;const i=t.getContext("2d");i.drawImage(e,0,0,e.width,e.height);const s=i.getImageData(0,0,e.width,e.height),r=s.data;for(let o=0;o1)switch(this.wrapS){case ri:e.x=e.x-Math.floor(e.x);break;case Et:e.x=e.x<0?0:1;break;case Or:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case ri:e.y=e.y-Math.floor(e.y);break;case Et:e.y=e.y<0?0:1;break;case Or:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}}_t.DEFAULT_IMAGE=null,_t.DEFAULT_MAPPING=Md;class je{constructor(e=0,t=0,i=0,s=1){je.prototype.isVector4=!0,this.x=e,this.y=t,this.z=i,this.w=s}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,i,s){return this.x=e,this.y=t,this.z=i,this.w=s,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,i=this.y,s=this.z,r=this.w,o=e.elements;return this.x=o[0]*t+o[4]*i+o[8]*s+o[12]*r,this.y=o[1]*t+o[5]*i+o[9]*s+o[13]*r,this.z=o[2]*t+o[6]*i+o[10]*s+o[14]*r,this.w=o[3]*t+o[7]*i+o[11]*s+o[15]*r,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,i,s,r;const o=.01,a=.1,l=e.elements,c=l[0],u=l[4],h=l[8],d=l[1],p=l[5],g=l[9],m=l[2],f=l[6],_=l[10];if(Math.abs(u-d)x&&b>w?bw?x=0?1:-1,b=1-_*_;if(b>Number.EPSILON){const w=Math.sqrt(b),C=Math.atan2(w,_*v);f=Math.sin(f*C)/w,a=Math.sin(a*C)/w}const x=a*v;if(l=l*f+d*x,c=c*f+p*x,u=u*f+g*x,h=h*f+m*x,f===1-a){const w=1/Math.sqrt(l*l+c*c+u*u+h*h);l*=w,c*=w,u*=w,h*=w}}e[t]=l,e[t+1]=c,e[t+2]=u,e[t+3]=h}static multiplyQuaternionsFlat(e,t,i,s,r,o){const a=i[s],l=i[s+1],c=i[s+2],u=i[s+3],h=r[o],d=r[o+1],p=r[o+2],g=r[o+3];return e[t]=a*g+u*h+l*p-c*d,e[t+1]=l*g+u*d+c*h-a*p,e[t+2]=c*g+u*p+a*d-l*h,e[t+3]=u*g-a*h-l*d-c*p,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,i,s){return this._x=e,this._y=t,this._z=i,this._w=s,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t){if(!(e&&e.isEuler))throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");const i=e._x,s=e._y,r=e._z,o=e._order,a=Math.cos,l=Math.sin,c=a(i/2),u=a(s/2),h=a(r/2),d=l(i/2),p=l(s/2),g=l(r/2);switch(o){case"XYZ":this._x=d*u*h+c*p*g,this._y=c*p*h-d*u*g,this._z=c*u*g+d*p*h,this._w=c*u*h-d*p*g;break;case"YXZ":this._x=d*u*h+c*p*g,this._y=c*p*h-d*u*g,this._z=c*u*g-d*p*h,this._w=c*u*h+d*p*g;break;case"ZXY":this._x=d*u*h-c*p*g,this._y=c*p*h+d*u*g,this._z=c*u*g+d*p*h,this._w=c*u*h-d*p*g;break;case"ZYX":this._x=d*u*h-c*p*g,this._y=c*p*h+d*u*g,this._z=c*u*g-d*p*h,this._w=c*u*h+d*p*g;break;case"YZX":this._x=d*u*h+c*p*g,this._y=c*p*h+d*u*g,this._z=c*u*g-d*p*h,this._w=c*u*h-d*p*g;break;case"XZY":this._x=d*u*h-c*p*g,this._y=c*p*h-d*u*g,this._z=c*u*g+d*p*h,this._w=c*u*h+d*p*g;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t!==!1&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const i=t/2,s=Math.sin(i);return this._x=e.x*s,this._y=e.y*s,this._z=e.z*s,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,i=t[0],s=t[4],r=t[8],o=t[1],a=t[5],l=t[9],c=t[2],u=t[6],h=t[10],d=i+a+h;if(d>0){const p=.5/Math.sqrt(d+1);this._w=.25/p,this._x=(u-l)*p,this._y=(r-c)*p,this._z=(o-s)*p}else if(i>a&&i>h){const p=2*Math.sqrt(1+i-a-h);this._w=(u-l)/p,this._x=.25*p,this._y=(s+o)/p,this._z=(r+c)/p}else if(a>h){const p=2*Math.sqrt(1+a-i-h);this._w=(r-c)/p,this._x=(s+o)/p,this._y=.25*p,this._z=(l+u)/p}else{const p=2*Math.sqrt(1+h-i-a);this._w=(o-s)/p,this._x=(r+c)/p,this._y=(l+u)/p,this._z=.25*p}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return iMath.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=i):(this._x=0,this._y=-e.z,this._z=e.y,this._w=i)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=i),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(lt(this.dot(e),-1,1)))}rotateTowards(e,t){const i=this.angleTo(e);if(i===0)return this;const s=Math.min(1,t/i);return this.slerp(e,s),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const i=e._x,s=e._y,r=e._z,o=e._w,a=t._x,l=t._y,c=t._z,u=t._w;return this._x=i*u+o*a+s*c-r*l,this._y=s*u+o*l+r*a-i*c,this._z=r*u+o*c+i*l-s*a,this._w=o*u-i*a-s*l-r*c,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const i=this._x,s=this._y,r=this._z,o=this._w;let a=o*e._w+i*e._x+s*e._y+r*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=o,this._x=i,this._y=s,this._z=r,this;const l=1-a*a;if(l<=Number.EPSILON){const p=1-t;return this._w=p*o+t*this._w,this._x=p*i+t*this._x,this._y=p*s+t*this._y,this._z=p*r+t*this._z,this.normalize(),this._onChangeCallback(),this}const c=Math.sqrt(l),u=Math.atan2(c,a),h=Math.sin((1-t)*u)/c,d=Math.sin(t*u)/c;return this._w=o*h+this._w*d,this._x=i*h+this._x*d,this._y=s*h+this._y*d,this._z=r*h+this._z*d,this._onChangeCallback(),this}slerpQuaternions(e,t,i){return this.copy(e).slerp(t,i)}random(){const e=Math.random(),t=Math.sqrt(1-e),i=Math.sqrt(e),s=2*Math.PI*Math.random(),r=2*Math.PI*Math.random();return this.set(t*Math.cos(s),i*Math.sin(r),i*Math.cos(r),t*Math.sin(s))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class E{constructor(e=0,t=0,i=0){E.prototype.isVector3=!0,this.x=e,this.y=t,this.z=i}set(e,t,i){return i===void 0&&(i=this.z),this.x=e,this.y=t,this.z=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(tp.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(tp.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,i=this.y,s=this.z,r=e.elements;return this.x=r[0]*t+r[3]*i+r[6]*s,this.y=r[1]*t+r[4]*i+r[7]*s,this.z=r[2]*t+r[5]*i+r[8]*s,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,i=this.y,s=this.z,r=e.elements,o=1/(r[3]*t+r[7]*i+r[11]*s+r[15]);return this.x=(r[0]*t+r[4]*i+r[8]*s+r[12])*o,this.y=(r[1]*t+r[5]*i+r[9]*s+r[13])*o,this.z=(r[2]*t+r[6]*i+r[10]*s+r[14])*o,this}applyQuaternion(e){const t=this.x,i=this.y,s=this.z,r=e.x,o=e.y,a=e.z,l=e.w,c=l*t+o*s-a*i,u=l*i+a*t-r*s,h=l*s+r*i-o*t,d=-r*t-o*i-a*s;return this.x=c*l+d*-r+u*-a-h*-o,this.y=u*l+d*-o+h*-r-c*-a,this.z=h*l+d*-a+c*-o-u*-r,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,i=this.y,s=this.z,r=e.elements;return this.x=r[0]*t+r[4]*i+r[8]*s,this.y=r[1]*t+r[5]*i+r[9]*s,this.z=r[2]*t+r[6]*i+r[10]*s,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const i=e.x,s=e.y,r=e.z,o=t.x,a=t.y,l=t.z;return this.x=s*l-r*a,this.y=r*o-i*l,this.z=i*a-s*o,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const i=e.dot(this)/t;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return $a.copy(this).projectOnVector(e),this.sub($a)}reflect(e){return this.sub($a.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(lt(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y,s=this.z-e.z;return t*t+i*i+s*s}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,i){const s=Math.sin(t)*e;return this.x=s*Math.sin(i),this.y=Math.cos(t)*e,this.z=s*Math.cos(i),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,i){return this.x=e*Math.sin(t),this.y=i,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),s=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,this.z=s,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=(Math.random()-.5)*2,t=Math.random()*Math.PI*2,i=Math.sqrt(1-e**2);return this.x=i*Math.cos(t),this.y=i*Math.sin(t),this.z=e,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const $a=new E,tp=new tn;class xn{constructor(e=new E(1/0,1/0,1/0),t=new E(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){let t=1/0,i=1/0,s=1/0,r=-1/0,o=-1/0,a=-1/0;for(let l=0,c=e.length;lr&&(r=u),h>o&&(o=h),d>a&&(a=d)}return this.min.set(t,i,s),this.max.set(r,o,a),this}setFromBufferAttribute(e){let t=1/0,i=1/0,s=1/0,r=-1/0,o=-1/0,a=-1/0;for(let l=0,c=e.count;lr&&(r=u),h>o&&(o=h),d>a&&(a=d)}return this.min.set(t,i,s),this.max.set(r,o,a),this}setFromPoints(e){this.makeEmpty();for(let t=0,i=e.length;tthis.max.x||e.ythis.max.y||e.zthis.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return!(e.max.xthis.max.x||e.max.ythis.max.y||e.max.zthis.max.z)}intersectsSphere(e){return this.clampPoint(e.center,pi),pi.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,i;return e.normal.x>0?(t=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),t<=-e.constant&&i>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Vs),Gr.subVectors(this.max,Vs),Yi.subVectors(e.a,Vs),Ji.subVectors(e.b,Vs),Zi.subVectors(e.c,Vs),zn.subVectors(Ji,Yi),Gn.subVectors(Zi,Ji),fi.subVectors(Yi,Zi);let t=[0,-zn.z,zn.y,0,-Gn.z,Gn.y,0,-fi.z,fi.y,zn.z,0,-zn.x,Gn.z,0,-Gn.x,fi.z,0,-fi.x,-zn.y,zn.x,0,-Gn.y,Gn.x,0,-fi.y,fi.x,0];return!za(t,Yi,Ji,Zi,Gr)||(t=[1,0,0,0,1,0,0,0,1],!za(t,Yi,Ji,Zi,Gr))?!1:(Vr.crossVectors(zn,Gn),t=[Vr.x,Vr.y,Vr.z],za(t,Yi,Ji,Zi,Gr))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return pi.copy(e).clamp(this.min,this.max).sub(e).length()}getBoundingSphere(e){return this.getCenter(e.center),e.radius=this.getSize(pi).length()*.5,e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(bn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),bn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),bn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),bn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),bn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),bn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),bn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),bn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(bn),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const bn=[new E,new E,new E,new E,new E,new E,new E,new E],pi=new E,Ua=new xn,Yi=new E,Ji=new E,Zi=new E,zn=new E,Gn=new E,fi=new E,Vs=new E,Gr=new E,Vr=new E,mi=new E;function za(n,e,t,i,s){for(let r=0,o=n.length-3;r<=o;r+=3){mi.fromArray(n,r);const a=s.x*Math.abs(mi.x)+s.y*Math.abs(mi.y)+s.z*Math.abs(mi.z),l=e.dot(mi),c=t.dot(mi),u=i.dot(mi);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>a)return!1}return!0}const Tb=new xn,np=new E,Hr=new E,Ga=new E;class Ht{constructor(e=new E,t=-1){this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const i=this.center;t!==void 0?i.copy(t):Tb.setFromPoints(e).getCenter(i);let s=0;for(let r=0,o=e.length;rthis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){Ga.subVectors(e,this.center);const t=Ga.lengthSq();if(t>this.radius*this.radius){const i=Math.sqrt(t),s=(i-this.radius)*.5;this.center.add(Ga.multiplyScalar(s/i)),this.radius+=s}return this}union(e){return this.center.equals(e.center)===!0?Hr.set(0,0,1).multiplyScalar(e.radius):Hr.subVectors(e.center,this.center).normalize().multiplyScalar(e.radius),this.expandByPoint(np.copy(e.center).add(Hr)),this.expandByPoint(np.copy(e.center).sub(Hr)),this}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const Mn=new E,Va=new E,Wr=new E,Vn=new E,Ha=new E,jr=new E,Wa=new E;class Hs{constructor(e=new E,t=new E(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.direction).multiplyScalar(e).add(this.origin)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Mn)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const i=t.dot(this.direction);return i<0?t.copy(this.origin):t.copy(this.direction).multiplyScalar(i).add(this.origin)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=Mn.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Mn.copy(this.direction).multiplyScalar(t).add(this.origin),Mn.distanceToSquared(e))}distanceSqToSegment(e,t,i,s){Va.copy(e).add(t).multiplyScalar(.5),Wr.copy(t).sub(e).normalize(),Vn.copy(this.origin).sub(Va);const r=e.distanceTo(t)*.5,o=-this.direction.dot(Wr),a=Vn.dot(this.direction),l=-Vn.dot(Wr),c=Vn.lengthSq(),u=Math.abs(1-o*o);let h,d,p,g;if(u>0)if(h=o*l-a,d=o*a-l,g=r*u,h>=0)if(d>=-g)if(d<=g){const m=1/u;h*=m,d*=m,p=h*(h+o*d+2*a)+d*(o*h+d+2*l)+c}else d=r,h=Math.max(0,-(o*d+a)),p=-h*h+d*(d+2*l)+c;else d=-r,h=Math.max(0,-(o*d+a)),p=-h*h+d*(d+2*l)+c;else d<=-g?(h=Math.max(0,-(-o*r+a)),d=h>0?-r:Math.min(Math.max(-r,-l),r),p=-h*h+d*(d+2*l)+c):d<=g?(h=0,d=Math.min(Math.max(-r,-l),r),p=d*(d+2*l)+c):(h=Math.max(0,-(o*r+a)),d=h>0?r:Math.min(Math.max(-r,-l),r),p=-h*h+d*(d+2*l)+c);else d=o>0?-r:r,h=Math.max(0,-(o*d+a)),p=-h*h+d*(d+2*l)+c;return i&&i.copy(this.direction).multiplyScalar(h).add(this.origin),s&&s.copy(Wr).multiplyScalar(d).add(Va),p}intersectSphere(e,t){Mn.subVectors(e.center,this.origin);const i=Mn.dot(this.direction),s=Mn.dot(Mn)-i*i,r=e.radius*e.radius;if(s>r)return null;const o=Math.sqrt(r-s),a=i-o,l=i+o;return a<0&&l<0?null:a<0?this.at(l,t):this.at(a,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const i=-(this.origin.dot(e.normal)+e.constant)/t;return i>=0?i:null}intersectPlane(e,t){const i=this.distanceToPlane(e);return i===null?null:this.at(i,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let i,s,r,o,a,l;const c=1/this.direction.x,u=1/this.direction.y,h=1/this.direction.z,d=this.origin;return c>=0?(i=(e.min.x-d.x)*c,s=(e.max.x-d.x)*c):(i=(e.max.x-d.x)*c,s=(e.min.x-d.x)*c),u>=0?(r=(e.min.y-d.y)*u,o=(e.max.y-d.y)*u):(r=(e.max.y-d.y)*u,o=(e.min.y-d.y)*u),i>o||r>s||((r>i||i!==i)&&(i=r),(o=0?(a=(e.min.z-d.z)*h,l=(e.max.z-d.z)*h):(a=(e.max.z-d.z)*h,l=(e.min.z-d.z)*h),i>l||a>s)||((a>i||i!==i)&&(i=a),(l=0?i:s,t)}intersectsBox(e){return this.intersectBox(e,Mn)!==null}intersectTriangle(e,t,i,s,r){Ha.subVectors(t,e),jr.subVectors(i,e),Wa.crossVectors(Ha,jr);let o=this.direction.dot(Wa),a;if(o>0){if(s)return null;a=1}else if(o<0)a=-1,o=-o;else return null;Vn.subVectors(this.origin,e);const l=a*this.direction.dot(jr.crossVectors(Vn,jr));if(l<0)return null;const c=a*this.direction.dot(Ha.cross(Vn));if(c<0||l+c>o)return null;const u=-a*Vn.dot(Wa);return u<0?null:this.at(u/o,r)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class Me{constructor(){Me.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}set(e,t,i,s,r,o,a,l,c,u,h,d,p,g,m,f){const _=this.elements;return _[0]=e,_[4]=t,_[8]=i,_[12]=s,_[1]=r,_[5]=o,_[9]=a,_[13]=l,_[2]=c,_[6]=u,_[10]=h,_[14]=d,_[3]=p,_[7]=g,_[11]=m,_[15]=f,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new Me().fromArray(this.elements)}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],this}copyPosition(e){const t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,i){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(e,t,i){return this.set(e.x,t.x,i.x,0,e.y,t.y,i.y,0,e.z,t.z,i.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,i=e.elements,s=1/Ki.setFromMatrixColumn(e,0).length(),r=1/Ki.setFromMatrixColumn(e,1).length(),o=1/Ki.setFromMatrixColumn(e,2).length();return t[0]=i[0]*s,t[1]=i[1]*s,t[2]=i[2]*s,t[3]=0,t[4]=i[4]*r,t[5]=i[5]*r,t[6]=i[6]*r,t[7]=0,t[8]=i[8]*o,t[9]=i[9]*o,t[10]=i[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,i=e.x,s=e.y,r=e.z,o=Math.cos(i),a=Math.sin(i),l=Math.cos(s),c=Math.sin(s),u=Math.cos(r),h=Math.sin(r);if(e.order==="XYZ"){const d=o*u,p=o*h,g=a*u,m=a*h;t[0]=l*u,t[4]=-l*h,t[8]=c,t[1]=p+g*c,t[5]=d-m*c,t[9]=-a*l,t[2]=m-d*c,t[6]=g+p*c,t[10]=o*l}else if(e.order==="YXZ"){const d=l*u,p=l*h,g=c*u,m=c*h;t[0]=d+m*a,t[4]=g*a-p,t[8]=o*c,t[1]=o*h,t[5]=o*u,t[9]=-a,t[2]=p*a-g,t[6]=m+d*a,t[10]=o*l}else if(e.order==="ZXY"){const d=l*u,p=l*h,g=c*u,m=c*h;t[0]=d-m*a,t[4]=-o*h,t[8]=g+p*a,t[1]=p+g*a,t[5]=o*u,t[9]=m-d*a,t[2]=-o*c,t[6]=a,t[10]=o*l}else if(e.order==="ZYX"){const d=o*u,p=o*h,g=a*u,m=a*h;t[0]=l*u,t[4]=g*c-p,t[8]=d*c+m,t[1]=l*h,t[5]=m*c+d,t[9]=p*c-g,t[2]=-c,t[6]=a*l,t[10]=o*l}else if(e.order==="YZX"){const d=o*l,p=o*c,g=a*l,m=a*c;t[0]=l*u,t[4]=m-d*h,t[8]=g*h+p,t[1]=h,t[5]=o*u,t[9]=-a*u,t[2]=-c*u,t[6]=p*h+g,t[10]=d-m*h}else if(e.order==="XZY"){const d=o*l,p=o*c,g=a*l,m=a*c;t[0]=l*u,t[4]=-h,t[8]=c*u,t[1]=d*h+m,t[5]=o*u,t[9]=p*h-g,t[2]=g*h-p,t[6]=a*u,t[10]=m*h+d}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(Eb,e,Lb)}lookAt(e,t,i){const s=this.elements;return It.subVectors(e,t),It.lengthSq()===0&&(It.z=1),It.normalize(),Hn.crossVectors(i,It),Hn.lengthSq()===0&&(Math.abs(i.z)===1?It.x+=1e-4:It.z+=1e-4,It.normalize(),Hn.crossVectors(i,It)),Hn.normalize(),qr.crossVectors(It,Hn),s[0]=Hn.x,s[4]=qr.x,s[8]=It.x,s[1]=Hn.y,s[5]=qr.y,s[9]=It.y,s[2]=Hn.z,s[6]=qr.z,s[10]=It.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,s=t.elements,r=this.elements,o=i[0],a=i[4],l=i[8],c=i[12],u=i[1],h=i[5],d=i[9],p=i[13],g=i[2],m=i[6],f=i[10],_=i[14],v=i[3],b=i[7],x=i[11],w=i[15],C=s[0],L=s[4],y=s[8],A=s[12],I=s[1],R=s[5],Z=s[9],K=s[13],D=s[2],z=s[6],k=s[10],W=s[14],H=s[3],N=s[7],G=s[11],ee=s[15];return r[0]=o*C+a*I+l*D+c*H,r[4]=o*L+a*R+l*z+c*N,r[8]=o*y+a*Z+l*k+c*G,r[12]=o*A+a*K+l*W+c*ee,r[1]=u*C+h*I+d*D+p*H,r[5]=u*L+h*R+d*z+p*N,r[9]=u*y+h*Z+d*k+p*G,r[13]=u*A+h*K+d*W+p*ee,r[2]=g*C+m*I+f*D+_*H,r[6]=g*L+m*R+f*z+_*N,r[10]=g*y+m*Z+f*k+_*G,r[14]=g*A+m*K+f*W+_*ee,r[3]=v*C+b*I+x*D+w*H,r[7]=v*L+b*R+x*z+w*N,r[11]=v*y+b*Z+x*k+w*G,r[15]=v*A+b*K+x*W+w*ee,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],i=e[4],s=e[8],r=e[12],o=e[1],a=e[5],l=e[9],c=e[13],u=e[2],h=e[6],d=e[10],p=e[14],g=e[3],m=e[7],f=e[11],_=e[15];return g*(+r*l*h-s*c*h-r*a*d+i*c*d+s*a*p-i*l*p)+m*(+t*l*p-t*c*d+r*o*d-s*o*p+s*c*u-r*l*u)+f*(+t*c*h-t*a*p-r*o*h+i*o*p+r*a*u-i*c*u)+_*(-s*a*u-t*l*h+t*a*d+s*o*h-i*o*d+i*l*u)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,i){const s=this.elements;return e.isVector3?(s[12]=e.x,s[13]=e.y,s[14]=e.z):(s[12]=e,s[13]=t,s[14]=i),this}invert(){const e=this.elements,t=e[0],i=e[1],s=e[2],r=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],h=e[9],d=e[10],p=e[11],g=e[12],m=e[13],f=e[14],_=e[15],v=h*f*c-m*d*c+m*l*p-a*f*p-h*l*_+a*d*_,b=g*d*c-u*f*c-g*l*p+o*f*p+u*l*_-o*d*_,x=u*m*c-g*h*c+g*a*p-o*m*p-u*a*_+o*h*_,w=g*h*l-u*m*l-g*a*d+o*m*d+u*a*f-o*h*f,C=t*v+i*b+s*x+r*w;if(C===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const L=1/C;return e[0]=v*L,e[1]=(m*d*r-h*f*r-m*s*p+i*f*p+h*s*_-i*d*_)*L,e[2]=(a*f*r-m*l*r+m*s*c-i*f*c-a*s*_+i*l*_)*L,e[3]=(h*l*r-a*d*r-h*s*c+i*d*c+a*s*p-i*l*p)*L,e[4]=b*L,e[5]=(u*f*r-g*d*r+g*s*p-t*f*p-u*s*_+t*d*_)*L,e[6]=(g*l*r-o*f*r-g*s*c+t*f*c+o*s*_-t*l*_)*L,e[7]=(o*d*r-u*l*r+u*s*c-t*d*c-o*s*p+t*l*p)*L,e[8]=x*L,e[9]=(g*h*r-u*m*r-g*i*p+t*m*p+u*i*_-t*h*_)*L,e[10]=(o*m*r-g*a*r+g*i*c-t*m*c-o*i*_+t*a*_)*L,e[11]=(u*a*r-o*h*r-u*i*c+t*h*c+o*i*p-t*a*p)*L,e[12]=w*L,e[13]=(u*m*s-g*h*s+g*i*d-t*m*d-u*i*f+t*h*f)*L,e[14]=(g*a*s-o*m*s-g*i*l+t*m*l+o*i*f-t*a*f)*L,e[15]=(o*h*s-u*a*s+u*i*l-t*h*l-o*i*d+t*a*d)*L,this}scale(e){const t=this.elements,i=e.x,s=e.y,r=e.z;return t[0]*=i,t[4]*=s,t[8]*=r,t[1]*=i,t[5]*=s,t[9]*=r,t[2]*=i,t[6]*=s,t[10]*=r,t[3]*=i,t[7]*=s,t[11]*=r,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],s=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,i,s))}makeTranslation(e,t,i){return this.set(1,0,0,e,0,1,0,t,0,0,1,i,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,t,-i,0,0,i,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,0,i,0,0,1,0,0,-i,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,0,i,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const i=Math.cos(t),s=Math.sin(t),r=1-i,o=e.x,a=e.y,l=e.z,c=r*o,u=r*a;return this.set(c*o+i,c*a-s*l,c*l+s*a,0,c*a+s*l,u*a+i,u*l-s*o,0,c*l-s*a,u*l+s*o,r*l*l+i,0,0,0,0,1),this}makeScale(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,t,i,s,r,o){return this.set(1,i,r,0,e,1,o,0,t,s,1,0,0,0,0,1),this}compose(e,t,i){const s=this.elements,r=t._x,o=t._y,a=t._z,l=t._w,c=r+r,u=o+o,h=a+a,d=r*c,p=r*u,g=r*h,m=o*u,f=o*h,_=a*h,v=l*c,b=l*u,x=l*h,w=i.x,C=i.y,L=i.z;return s[0]=(1-(m+_))*w,s[1]=(p+x)*w,s[2]=(g-b)*w,s[3]=0,s[4]=(p-x)*C,s[5]=(1-(d+_))*C,s[6]=(f+v)*C,s[7]=0,s[8]=(g+b)*L,s[9]=(f-v)*L,s[10]=(1-(d+m))*L,s[11]=0,s[12]=e.x,s[13]=e.y,s[14]=e.z,s[15]=1,this}decompose(e,t,i){const s=this.elements;let r=Ki.set(s[0],s[1],s[2]).length();const o=Ki.set(s[4],s[5],s[6]).length(),a=Ki.set(s[8],s[9],s[10]).length();this.determinant()<0&&(r=-r),e.x=s[12],e.y=s[13],e.z=s[14],nn.copy(this);const c=1/r,u=1/o,h=1/a;return nn.elements[0]*=c,nn.elements[1]*=c,nn.elements[2]*=c,nn.elements[4]*=u,nn.elements[5]*=u,nn.elements[6]*=u,nn.elements[8]*=h,nn.elements[9]*=h,nn.elements[10]*=h,t.setFromRotationMatrix(nn),i.x=r,i.y=o,i.z=a,this}makePerspective(e,t,i,s,r,o){const a=this.elements,l=2*r/(t-e),c=2*r/(i-s),u=(t+e)/(t-e),h=(i+s)/(i-s),d=-(o+r)/(o-r),p=-2*o*r/(o-r);return a[0]=l,a[4]=0,a[8]=u,a[12]=0,a[1]=0,a[5]=c,a[9]=h,a[13]=0,a[2]=0,a[6]=0,a[10]=d,a[14]=p,a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this}makeOrthographic(e,t,i,s,r,o){const a=this.elements,l=1/(t-e),c=1/(i-s),u=1/(o-r),h=(t+e)*l,d=(i+s)*c,p=(o+r)*u;return a[0]=2*l,a[4]=0,a[8]=0,a[12]=-h,a[1]=0,a[5]=2*c,a[9]=0,a[13]=-d,a[2]=0,a[6]=0,a[10]=-2*u,a[14]=-p,a[3]=0,a[7]=0,a[11]=0,a[15]=1,this}equals(e){const t=this.elements,i=e.elements;for(let s=0;s<16;s++)if(t[s]!==i[s])return!1;return!0}fromArray(e,t=0){for(let i=0;i<16;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],e}}const Ki=new E,nn=new Me,Eb=new E(0,0,0),Lb=new E(1,1,1),Hn=new E,qr=new E,It=new E,ip=new Me,sp=new tn;class Ws{constructor(e=0,t=0,i=0,s=Ws.DefaultOrder){this.isEuler=!0,this._x=e,this._y=t,this._z=i,this._order=s}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,i,s=this._order){return this._x=e,this._y=t,this._z=i,this._order=s,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,i=!0){const s=e.elements,r=s[0],o=s[4],a=s[8],l=s[1],c=s[5],u=s[9],h=s[2],d=s[6],p=s[10];switch(t){case"XYZ":this._y=Math.asin(lt(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-u,p),this._z=Math.atan2(-o,r)):(this._x=Math.atan2(d,c),this._z=0);break;case"YXZ":this._x=Math.asin(-lt(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(a,p),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-h,r),this._z=0);break;case"ZXY":this._x=Math.asin(lt(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-h,p),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,r));break;case"ZYX":this._y=Math.asin(-lt(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(d,p),this._z=Math.atan2(l,r)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(lt(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-h,r)):(this._x=0,this._y=Math.atan2(a,p));break;case"XZY":this._z=Math.asin(-lt(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(d,c),this._y=Math.atan2(a,r)):(this._x=Math.atan2(-u,p),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,i===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,i){return ip.makeRotationFromQuaternion(e),this.setFromRotationMatrix(ip,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return sp.setFromEuler(this),this.setFromQuaternion(sp,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}toVector3(){console.error("THREE.Euler: .toVector3() has been removed. Use Vector3.setFromEuler() instead")}}Ws.DefaultOrder="XYZ",Ws.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];class ja{constructor(){this.mask=1|0}set(e){this.mask=(1<>>0}enable(e){this.mask|=1<1){for(let t=0;t1){for(let i=0;i0){s.children=[];for(let a=0;a0){s.animations=[];for(let a=0;a0&&(i.geometries=a),l.length>0&&(i.materials=l),c.length>0&&(i.textures=c),u.length>0&&(i.images=u),h.length>0&&(i.shapes=h),d.length>0&&(i.skeletons=d),p.length>0&&(i.animations=p),g.length>0&&(i.nodes=g)}return i.object=s,i;function o(a){const l=[];for(const c in a){const u=a[c];delete u.metadata,l.push(u)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let i=0;i0?s.multiplyScalar(1/Math.sqrt(r)):s.set(0,0,0)}static getBarycoord(e,t,i,s,r){sn.subVectors(s,t),wn.subVectors(i,t),qa.subVectors(e,t);const o=sn.dot(sn),a=sn.dot(wn),l=sn.dot(qa),c=wn.dot(wn),u=wn.dot(qa),h=o*c-a*a;if(h===0)return r.set(-2,-1,-1);const d=1/h,p=(c*l-a*u)*d,g=(o*u-a*l)*d;return r.set(1-p-g,g,p)}static containsPoint(e,t,i,s){return this.getBarycoord(e,t,i,s,Cn),Cn.x>=0&&Cn.y>=0&&Cn.x+Cn.y<=1}static getUV(e,t,i,s,r,o,a,l){return this.getBarycoord(e,t,i,s,Cn),l.set(0,0),l.addScaledVector(r,Cn.x),l.addScaledVector(o,Cn.y),l.addScaledVector(a,Cn.z),l}static isFrontFacing(e,t,i,s){return sn.subVectors(i,t),wn.subVectors(e,t),sn.cross(wn).dot(s)<0}set(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this}setFromPointsAndIndices(e,t,i,s){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[s]),this}setFromAttributeAndIndices(e,t,i,s){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,i),this.c.fromBufferAttribute(e,s),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return sn.subVectors(this.c,this.b),wn.subVectors(this.a,this.b),sn.cross(wn).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return An.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return An.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,i,s,r){return An.getUV(e,this.a,this.b,this.c,t,i,s,r)}containsPoint(e){return An.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return An.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const i=this.a,s=this.b,r=this.c;let o,a;es.subVectors(s,i),ts.subVectors(r,i),Xa.subVectors(e,i);const l=es.dot(Xa),c=ts.dot(Xa);if(l<=0&&c<=0)return t.copy(i);Ya.subVectors(e,s);const u=es.dot(Ya),h=ts.dot(Ya);if(u>=0&&h<=u)return t.copy(s);const d=l*h-u*c;if(d<=0&&l>=0&&u<=0)return o=l/(l-u),t.copy(i).addScaledVector(es,o);Ja.subVectors(e,r);const p=es.dot(Ja),g=ts.dot(Ja);if(g>=0&&p<=g)return t.copy(r);const m=p*c-l*g;if(m<=0&&c>=0&&g<=0)return a=c/(c-g),t.copy(i).addScaledVector(ts,a);const f=u*g-p*h;if(f<=0&&h-u>=0&&p-g>=0)return hp.subVectors(r,s),a=(h-u)/(h-u+(p-g)),t.copy(s).addScaledVector(hp,a);const _=1/(f+m+d);return o=m*_,a=d*_,t.copy(i).addScaledVector(es,o).addScaledVector(ts,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}let Fb=0;class Wt extends ui{constructor(){super();this.isMaterial=!0,Object.defineProperty(this,"id",{value:Fb++}),this.uuid=Gt(),this.name="",this.type="Material",this.blending=Bi,this.side=ki,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=xd,this.blendDst=bd,this.blendEquation=$i,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=xa,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=cb,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Pa,this.stencilZFail=Pa,this.stencilZPass=Pa,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const i=e[t];if(i===void 0){console.warn("THREE.Material: '"+t+"' parameter is undefined.");continue}if(t==="shading"){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=i===px;continue}const s=this[t];if(s===void 0){console.warn("THREE."+this.type+": '"+t+"' is not a property of this material.");continue}s&&s.isColor?s.set(i):s&&s.isVector3&&i&&i.isVector3?s.copy(i):this[t]=i}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const i={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),this.roughness!==void 0&&(i.roughness=this.roughness),this.metalness!==void 0&&(i.metalness=this.metalness),this.sheen!==void 0&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity&&this.emissiveIntensity!==1&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(i.shininess=this.shininess),this.clearcoat!==void 0&&(i.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.iridescence!==void 0&&(i.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(i.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(e).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(i.combine=this.combine)),this.envMapIntensity!==void 0&&(i.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(i.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&(i.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(i.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(i.size=this.size),this.shadowSide!==null&&(i.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==Bi&&(i.blending=this.blending),this.side!==ki&&(i.side=this.side),this.vertexColors&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),this.transparent===!0&&(i.transparent=this.transparent),i.depthFunc=this.depthFunc,i.depthTest=this.depthTest,i.depthWrite=this.depthWrite,i.colorWrite=this.colorWrite,i.stencilWrite=this.stencilWrite,i.stencilWriteMask=this.stencilWriteMask,i.stencilFunc=this.stencilFunc,i.stencilRef=this.stencilRef,i.stencilFuncMask=this.stencilFuncMask,i.stencilFail=this.stencilFail,i.stencilZFail=this.stencilZFail,i.stencilZPass=this.stencilZPass,this.rotation!==void 0&&this.rotation!==0&&(i.rotation=this.rotation),this.polygonOffset===!0&&(i.polygonOffset=!0),this.polygonOffsetFactor!==0&&(i.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(i.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(i.linewidth=this.linewidth),this.dashSize!==void 0&&(i.dashSize=this.dashSize),this.gapSize!==void 0&&(i.gapSize=this.gapSize),this.scale!==void 0&&(i.scale=this.scale),this.dithering===!0&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),this.alphaToCoverage===!0&&(i.alphaToCoverage=this.alphaToCoverage),this.premultipliedAlpha===!0&&(i.premultipliedAlpha=this.premultipliedAlpha),this.wireframe===!0&&(i.wireframe=this.wireframe),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(i.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(i.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(i.flatShading=this.flatShading),this.visible===!1&&(i.visible=!1),this.toneMapped===!1&&(i.toneMapped=!1),this.fog===!1&&(i.fog=!1),JSON.stringify(this.userData)!=="{}"&&(i.userData=this.userData);function s(r){const o=[];for(const a in r){const l=r[a];delete l.metadata,o.push(l)}return o}if(t){const r=s(e.textures),o=s(e.images);r.length>0&&(i.textures=r),o.length>0&&(i.images=o)}return i}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let i=null;if(t!==null){const s=t.length;i=new Array(s);for(let r=0;r!==s;++r)i[r]=t[r].clone()}return this.clippingPlanes=i,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}class gi extends Wt{constructor(e){super();this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new ge(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Dr,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const at=new E,Yr=new te;class dt{constructor(e,t,i){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=i===!0,this.usage=Ia,this.updateRange={offset:0,count:-1},this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this}copyAt(e,t,i){e*=this.itemSize,i*=t.itemSize;for(let s=0,r=this.itemSize;s0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const i=this.attributes;for(const l in i){const c=i[l];e.data.attributes[l]=c.toJSON(e.data)}const s={};let r=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],u=[];for(let h=0,d=c.length;h0&&(s[l]=u,r=!0)}r&&(e.data.morphAttributes=s,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const a=this.boundingSphere;return a!==null&&(e.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const i=e.index;i!==null&&this.setIndex(i.clone(t));const s=e.attributes;for(const c in s){const u=s[c];this.setAttribute(c,u.clone(t))}const r=e.morphAttributes;for(const c in r){const u=[],h=r[c];for(let d=0,p=h.length;d0){const s=t[i[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,o=s.length;rt.far?null:{distance:c,point:no.clone(),object:n}}function io(n,e,t,i,s,r,o,a,l,c,u,h){Wn.fromBufferAttribute(s,c),jn.fromBufferAttribute(s,u),qn.fromBufferAttribute(s,h);const d=n.morphTargetInfluences;if(r&&d){Jr.set(0,0,0),Zr.set(0,0,0),Kr.set(0,0,0);for(let g=0,m=r.length;g0?1:-1,u.push(N.x,N.y,N.z),h.push(J/L),h.push(1-G/y),W+=1}}for(let G=0;G0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;const i={};for(const s in this.extensions)this.extensions[s]===!0&&(i[s]=!0);return Object.keys(i).length>0&&(t.extensions=i),t}}class fp extends rt{constructor(){super();this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Me,this.projectionMatrix=new Me,this.projectionMatrixInverse=new Me}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}class St extends fp{constructor(e=50,t=1,i=.1,s=2e3){super();this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=i,this.far=s,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=Us*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan($s*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Us*2*Math.atan(Math.tan($s*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(e,t,i,s,r,o){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=s,this.view.width=r,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan($s*.5*this.fov)/this.zoom,i=2*t,s=this.aspect*i,r=-.5*s;const o=this.view;if(this.view!==null&&this.view.enabled){const l=o.fullWidth,c=o.fullHeight;r+=o.offsetX*s/l,t-=o.offsetY*i/c,s*=o.width/l,i*=o.height/c}const a=this.filmOffset;a!==0&&(r+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+s,t,t-i,e,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const rs=90,os=1;class Ub extends rt{constructor(e,t,i){super();if(this.type="CubeCamera",i.isWebGLCubeRenderTarget!==!0){console.error("THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter.");return}this.renderTarget=i;const s=new St(rs,os,e,t);s.layers=this.layers,s.up.set(0,-1,0),s.lookAt(new E(1,0,0)),this.add(s);const r=new St(rs,os,e,t);r.layers=this.layers,r.up.set(0,-1,0),r.lookAt(new E(-1,0,0)),this.add(r);const o=new St(rs,os,e,t);o.layers=this.layers,o.up.set(0,0,1),o.lookAt(new E(0,1,0)),this.add(o);const a=new St(rs,os,e,t);a.layers=this.layers,a.up.set(0,0,-1),a.lookAt(new E(0,-1,0)),this.add(a);const l=new St(rs,os,e,t);l.layers=this.layers,l.up.set(0,-1,0),l.lookAt(new E(0,0,1)),this.add(l);const c=new St(rs,os,e,t);c.layers=this.layers,c.up.set(0,-1,0),c.lookAt(new E(0,0,-1)),this.add(c)}update(e,t){this.parent===null&&this.updateMatrixWorld();const i=this.renderTarget,[s,r,o,a,l,c]=this.children,u=e.getRenderTarget(),h=e.toneMapping,d=e.xr.enabled;e.toneMapping=yn,e.xr.enabled=!1;const p=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,e.setRenderTarget(i,0),e.render(t,s),e.setRenderTarget(i,1),e.render(t,r),e.setRenderTarget(i,2),e.render(t,o),e.setRenderTarget(i,3),e.render(t,a),e.setRenderTarget(i,4),e.render(t,l),i.texture.generateMipmaps=p,e.setRenderTarget(i,5),e.render(t,c),e.setRenderTarget(u),e.toneMapping=h,e.xr.enabled=d,i.texture.needsPMREMUpdate=!0}}class sl extends _t{constructor(e,t,i,s,r,o,a,l,c,u){e=e!==void 0?e:[],t=t!==void 0?t:Ui;super(e,t,i,s,r,o,a,l,c,u);this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class zb extends Un{constructor(e,t={}){super(e,e,t);this.isWebGLCubeRenderTarget=!0;const i={width:e,height:e,depth:1},s=[i,i,i,i,i,i];this.texture=new sl(s,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.encoding),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:Je}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.encoding=t.encoding,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const i={uniforms:{tEquirect:{value:null}},vertexShader:` varying vec3 vWorldDirection; vec3 transformDirection( in vec3 dir, in mat4 matrix ) { return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); } void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include } `,fragmentShader:` uniform sampler2D tEquirect; varying vec3 vWorldDirection; #include void main() { vec3 direction = normalize( vWorldDirection ); vec2 sampleUV = equirectUv( direction ); gl_FragColor = texture2D( tEquirect, sampleUV ); } `},s=new Xs(5,5,5),r=new un({name:"CubemapFromEquirect",uniforms:ss(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:Yt,blending:$n});r.uniforms.tEquirect.value=t;const o=new ft(s,r),a=t.minFilter;return t.minFilter===oi&&(t.minFilter=Je),new Ub(1,10,this).update(e,o),t.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(e,t,i,s){const r=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,i,s);e.setRenderTarget(r)}}const rl=new E,Gb=new E,Vb=new Vt;class _i{constructor(e=new E(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,i,s){return this.normal.set(e,t,i),this.constant=s,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,i){const s=rl.subVectors(i,t).cross(Gb.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(s,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e)}intersectLine(e,t){const i=e.delta(rl),s=this.normal.dot(i);if(s===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const r=-(e.start.dot(this.normal)+this.constant)/s;return r<0||r>1?null:t.copy(i).multiplyScalar(r).add(e.start)}intersectsLine(e){const t=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return t<0&&i>0||i<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const i=t||Vb.getNormalMatrix(e),s=this.coplanarPoint(rl).applyMatrix4(e),r=this.normal.applyMatrix3(i).normalize();return this.constant=-s.dot(r),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const as=new Ht,so=new E;class ro{constructor(e=new _i,t=new _i,i=new _i,s=new _i,r=new _i,o=new _i){this.planes=[e,t,i,s,r,o]}set(e,t,i,s,r,o){const a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(i),a[3].copy(s),a[4].copy(r),a[5].copy(o),this}copy(e){const t=this.planes;for(let i=0;i<6;i++)t[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e){const t=this.planes,i=e.elements,s=i[0],r=i[1],o=i[2],a=i[3],l=i[4],c=i[5],u=i[6],h=i[7],d=i[8],p=i[9],g=i[10],m=i[11],f=i[12],_=i[13],v=i[14],b=i[15];return t[0].setComponents(a-s,h-l,m-d,b-f).normalize(),t[1].setComponents(a+s,h+l,m+d,b+f).normalize(),t[2].setComponents(a+r,h+c,m+p,b+_).normalize(),t[3].setComponents(a-r,h-c,m-p,b-_).normalize(),t[4].setComponents(a-o,h-u,m-g,b-v).normalize(),t[5].setComponents(a+o,h+u,m+g,b+v).normalize(),this}intersectsObject(e){const t=e.geometry;return t.boundingSphere===null&&t.computeBoundingSphere(),as.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(as)}intersectsSprite(e){return as.center.set(0,0,0),as.radius=.7071067811865476,as.applyMatrix4(e.matrixWorld),this.intersectsSphere(as)}intersectsSphere(e){const t=this.planes,i=e.center,s=-e.radius;for(let r=0;r<6;r++)if(t[r].distanceToPoint(i)0?e.max.x:e.min.x,so.y=s.normal.y>0?e.max.y:e.min.y,so.z=s.normal.z>0?e.max.z:e.min.z,s.distanceToPoint(so)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let i=0;i<6;i++)if(t[i].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function mp(){let n=null,e=!1,t=null,i=null;function s(r,o){t(r,o),i=n.requestAnimationFrame(s)}return{start:function(){e!==!0&&t!==null&&(i=n.requestAnimationFrame(s),e=!0)},stop:function(){n.cancelAnimationFrame(i),e=!1},setAnimationLoop:function(r){t=r},setContext:function(r){n=r}}}function Hb(n,e){const t=e.isWebGL2,i=new WeakMap;function s(c,u){const h=c.array,d=c.usage,p=n.createBuffer();n.bindBuffer(u,p),n.bufferData(u,h,d),c.onUploadCallback();let g;if(h instanceof Float32Array)g=5126;else if(h instanceof Uint16Array)if(c.isFloat16BufferAttribute)if(t)g=5131;else throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");else g=5123;else if(h instanceof Int16Array)g=5122;else if(h instanceof Uint32Array)g=5125;else if(h instanceof Int32Array)g=5124;else if(h instanceof Int8Array)g=5120;else if(h instanceof Uint8Array)g=5121;else if(h instanceof Uint8ClampedArray)g=5121;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+h);return{buffer:p,type:g,bytesPerElement:h.BYTES_PER_ELEMENT,version:c.version}}function r(c,u,h){const d=u.array,p=u.updateRange;n.bindBuffer(h,c),p.count===-1?n.bufferSubData(h,0,d):(t?n.bufferSubData(h,p.offset*d.BYTES_PER_ELEMENT,d,p.offset,p.count):n.bufferSubData(h,p.offset*d.BYTES_PER_ELEMENT,d.subarray(p.offset,p.offset+p.count)),p.count=-1)}function o(c){return c.isInterleavedBufferAttribute&&(c=c.data),i.get(c)}function a(c){c.isInterleavedBufferAttribute&&(c=c.data);const u=i.get(c);u&&(n.deleteBuffer(u.buffer),i.delete(c))}function l(c,u){if(c.isGLBufferAttribute){const d=i.get(c);(!d||d.version 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v; return cross( v1, v2 ) * theta_sintheta; } vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) { vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ]; vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ]; vec3 lightNormal = cross( v1, v2 ); if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 ); vec3 T1, T2; T1 = normalize( V - N * dot( V, N ) ); T2 = - cross( N, T1 ); mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) ); vec3 coords[ 4 ]; coords[ 0 ] = mat * ( rectCoords[ 0 ] - P ); coords[ 1 ] = mat * ( rectCoords[ 1 ] - P ); coords[ 2 ] = mat * ( rectCoords[ 2 ] - P ); coords[ 3 ] = mat * ( rectCoords[ 3 ] - P ); coords[ 0 ] = normalize( coords[ 0 ] ); coords[ 1 ] = normalize( coords[ 1 ] ); coords[ 2 ] = normalize( coords[ 2 ] ); coords[ 3 ] = normalize( coords[ 3 ] ); vec3 vectorFormFactor = vec3( 0.0 ); vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] ); vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] ); vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] ); vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] ); float result = LTC_ClippedSphereFormFactor( vectorFormFactor ); return vec3( result ); } float G_BlinnPhong_Implicit( ) { return 0.25; } float D_BlinnPhong( const in float shininess, const in float dotNH ) { return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess ); } vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) { vec3 halfDir = normalize( lightDir + viewDir ); float dotNH = saturate( dot( normal, halfDir ) ); float dotVH = saturate( dot( viewDir, halfDir ) ); vec3 F = F_Schlick( specularColor, 1.0, dotVH ); float G = G_BlinnPhong_Implicit( ); float D = D_BlinnPhong( shininess, dotNH ); return F * ( G * D ); } #if defined( USE_SHEEN ) float D_Charlie( float roughness, float dotNH ) { float alpha = pow2( roughness ); float invAlpha = 1.0 / alpha; float cos2h = dotNH * dotNH; float sin2h = max( 1.0 - cos2h, 0.0078125 ); return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI ); } float V_Neubelt( float dotNV, float dotNL ) { return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) ); } vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) { vec3 halfDir = normalize( lightDir + viewDir ); float dotNL = saturate( dot( normal, lightDir ) ); float dotNV = saturate( dot( normal, viewDir ) ); float dotNH = saturate( dot( normal, halfDir ) ); float D = D_Charlie( sheenRoughness, dotNH ); float V = V_Neubelt( dotNV, dotNL ); return sheenColor * ( D * V ); } #endif`,eM=`#ifdef USE_IRIDESCENCE const mat3 XYZ_TO_REC709 = mat3( 3.2404542, -0.9692660, 0.0556434, -1.5371385, 1.8760108, -0.2040259, -0.4985314, 0.0415560, 1.0572252 ); vec3 Fresnel0ToIor( vec3 fresnel0 ) { vec3 sqrtF0 = sqrt( fresnel0 ); return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 ); } vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) { return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) ); } float IorToFresnel0( float transmittedIor, float incidentIor ) { return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor )); } vec3 evalSensitivity( float OPD, vec3 shift ) { float phase = 2.0 * PI * OPD * 1.0e-9; vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 ); vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 ); vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 ); vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var ); xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) ); xyz /= 1.0685e-7; vec3 rgb = XYZ_TO_REC709 * xyz; return rgb; } vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) { vec3 I; float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) ); float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) ); float cosTheta2Sq = 1.0 - sinTheta2Sq; if ( cosTheta2Sq < 0.0 ) { return vec3( 1.0 ); } float cosTheta2 = sqrt( cosTheta2Sq ); float R0 = IorToFresnel0( iridescenceIOR, outsideIOR ); float R12 = F_Schlick( R0, 1.0, cosTheta1 ); float R21 = R12; float T121 = 1.0 - R12; float phi12 = 0.0; if ( iridescenceIOR < outsideIOR ) phi12 = PI; float phi21 = PI - phi12; vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR ); vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 ); vec3 phi23 = vec3( 0.0 ); if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI; if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI; if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI; float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2; vec3 phi = vec3( phi21 ) + phi23; vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 ); vec3 r123 = sqrt( R123 ); vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 ); vec3 C0 = R12 + Rs; I = C0; vec3 Cm = Rs - T121; for ( int m = 1; m <= 2; ++ m ) { Cm *= r123; vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi ); I += Cm * Sm; } return max( I, vec3( 0.0 ) ); } #endif`,tM=`#ifdef USE_BUMPMAP uniform sampler2D bumpMap; uniform float bumpScale; vec2 dHdxy_fwd() { vec2 dSTdx = dFdx( vUv ); vec2 dSTdy = dFdy( vUv ); float Hll = bumpScale * texture2D( bumpMap, vUv ).x; float dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll; float dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll; return vec2( dBx, dBy ); } vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) { vec3 vSigmaX = dFdx( surf_pos.xyz ); vec3 vSigmaY = dFdy( surf_pos.xyz ); vec3 vN = surf_norm; vec3 R1 = cross( vSigmaY, vN ); vec3 R2 = cross( vN, vSigmaX ); float fDet = dot( vSigmaX, R1 ) * faceDirection; vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 ); return normalize( abs( fDet ) * surf_norm - vGrad ); } #endif`,nM=`#if NUM_CLIPPING_PLANES > 0 vec4 plane; #pragma unroll_loop_start for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { plane = clippingPlanes[ i ]; if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard; } #pragma unroll_loop_end #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES bool clipped = true; #pragma unroll_loop_start for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { plane = clippingPlanes[ i ]; clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped; } #pragma unroll_loop_end if ( clipped ) discard; #endif #endif`,iM=`#if NUM_CLIPPING_PLANES > 0 varying vec3 vClipPosition; uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; #endif`,sM=`#if NUM_CLIPPING_PLANES > 0 varying vec3 vClipPosition; #endif`,rM=`#if NUM_CLIPPING_PLANES > 0 vClipPosition = - mvPosition.xyz; #endif`,oM=`#if defined( USE_COLOR_ALPHA ) diffuseColor *= vColor; #elif defined( USE_COLOR ) diffuseColor.rgb *= vColor; #endif`,aM=`#if defined( USE_COLOR_ALPHA ) varying vec4 vColor; #elif defined( USE_COLOR ) varying vec3 vColor; #endif`,lM=`#if defined( USE_COLOR_ALPHA ) varying vec4 vColor; #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) varying vec3 vColor; #endif`,cM=`#if defined( USE_COLOR_ALPHA ) vColor = vec4( 1.0 ); #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) vColor = vec3( 1.0 ); #endif #ifdef USE_COLOR vColor *= color; #endif #ifdef USE_INSTANCING_COLOR vColor.xyz *= instanceColor.xyz; #endif`,hM=`#define PI 3.141592653589793 #define PI2 6.283185307179586 #define PI_HALF 1.5707963267948966 #define RECIPROCAL_PI 0.3183098861837907 #define RECIPROCAL_PI2 0.15915494309189535 #define EPSILON 1e-6 #ifndef saturate #define saturate( a ) clamp( a, 0.0, 1.0 ) #endif #define whiteComplement( a ) ( 1.0 - saturate( a ) ) float pow2( const in float x ) { return x*x; } vec3 pow2( const in vec3 x ) { return x*x; } float pow3( const in float x ) { return x*x*x; } float pow4( const in float x ) { float x2 = x*x; return x2*x2; } float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } highp float rand( const in vec2 uv ) { const highp float a = 12.9898, b = 78.233, c = 43758.5453; highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); return fract( sin( sn ) * c ); } #ifdef HIGH_PRECISION float precisionSafeLength( vec3 v ) { return length( v ); } #else float precisionSafeLength( vec3 v ) { float maxComponent = max3( abs( v ) ); return length( v / maxComponent ) * maxComponent; } #endif struct IncidentLight { vec3 color; vec3 direction; bool visible; }; struct ReflectedLight { vec3 directDiffuse; vec3 directSpecular; vec3 indirectDiffuse; vec3 indirectSpecular; }; struct GeometricContext { vec3 position; vec3 normal; vec3 viewDir; #ifdef USE_CLEARCOAT vec3 clearcoatNormal; #endif }; vec3 transformDirection( in vec3 dir, in mat4 matrix ) { return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); } vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); } mat3 transposeMat3( const in mat3 m ) { mat3 tmp; tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x ); tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y ); tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z ); return tmp; } float luminance( const in vec3 rgb ) { const vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 ); return dot( weights, rgb ); } bool isPerspectiveMatrix( mat4 m ) { return m[ 2 ][ 3 ] == - 1.0; } vec2 equirectUv( in vec3 dir ) { float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; return vec2( u, v ); }`,uM=`#ifdef ENVMAP_TYPE_CUBE_UV #define cubeUV_minMipLevel 4.0 #define cubeUV_minTileSize 16.0 float getFace( vec3 direction ) { vec3 absDirection = abs( direction ); float face = - 1.0; if ( absDirection.x > absDirection.z ) { if ( absDirection.x > absDirection.y ) face = direction.x > 0.0 ? 0.0 : 3.0; else face = direction.y > 0.0 ? 1.0 : 4.0; } else { if ( absDirection.z > absDirection.y ) face = direction.z > 0.0 ? 2.0 : 5.0; else face = direction.y > 0.0 ? 1.0 : 4.0; } return face; } vec2 getUV( vec3 direction, float face ) { vec2 uv; if ( face == 0.0 ) { uv = vec2( direction.z, direction.y ) / abs( direction.x ); } else if ( face == 1.0 ) { uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); } else if ( face == 2.0 ) { uv = vec2( - direction.x, direction.y ) / abs( direction.z ); } else if ( face == 3.0 ) { uv = vec2( - direction.z, direction.y ) / abs( direction.x ); } else if ( face == 4.0 ) { uv = vec2( - direction.x, direction.z ) / abs( direction.y ); } else { uv = vec2( direction.x, direction.y ) / abs( direction.z ); } return 0.5 * ( uv + 1.0 ); } vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) { float face = getFace( direction ); float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 ); mipInt = max( mipInt, cubeUV_minMipLevel ); float faceSize = exp2( mipInt ); vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; if ( face > 2.0 ) { uv.y += faceSize; face -= 3.0; } uv.x += face * faceSize; uv.x += filterInt * 3.0 * cubeUV_minTileSize; uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize ); uv.x *= CUBEUV_TEXEL_WIDTH; uv.y *= CUBEUV_TEXEL_HEIGHT; #ifdef texture2DGradEXT return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; #else return texture2D( envMap, uv ).rgb; #endif } #define r0 1.0 #define v0 0.339 #define m0 - 2.0 #define r1 0.8 #define v1 0.276 #define m1 - 1.0 #define r4 0.4 #define v4 0.046 #define m4 2.0 #define r5 0.305 #define v5 0.016 #define m5 3.0 #define r6 0.21 #define v6 0.0038 #define m6 4.0 float roughnessToMip( float roughness ) { float mip = 0.0; if ( roughness >= r1 ) { mip = ( r0 - roughness ) * ( m1 - m0 ) / ( r0 - r1 ) + m0; } else if ( roughness >= r4 ) { mip = ( r1 - roughness ) * ( m4 - m1 ) / ( r1 - r4 ) + m1; } else if ( roughness >= r5 ) { mip = ( r4 - roughness ) * ( m5 - m4 ) / ( r4 - r5 ) + m4; } else if ( roughness >= r6 ) { mip = ( r5 - roughness ) * ( m6 - m5 ) / ( r5 - r6 ) + m5; } else { mip = - 2.0 * log2( 1.16 * roughness ); } return mip; } vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) { float mip = clamp( roughnessToMip( roughness ), m0, CUBEUV_MAX_MIP ); float mipF = fract( mip ); float mipInt = floor( mip ); vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt ); if ( mipF == 0.0 ) { return vec4( color0, 1.0 ); } else { vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 ); return vec4( mix( color0, color1, mipF ), 1.0 ); } } #endif`,dM=`vec3 transformedNormal = objectNormal; #ifdef USE_INSTANCING mat3 m = mat3( instanceMatrix ); transformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) ); transformedNormal = m * transformedNormal; #endif transformedNormal = normalMatrix * transformedNormal; #ifdef FLIP_SIDED transformedNormal = - transformedNormal; #endif #ifdef USE_TANGENT vec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz; #ifdef FLIP_SIDED transformedTangent = - transformedTangent; #endif #endif`,pM=`#ifdef USE_DISPLACEMENTMAP uniform sampler2D displacementMap; uniform float displacementScale; uniform float displacementBias; #endif`,fM=`#ifdef USE_DISPLACEMENTMAP transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias ); #endif`,mM=`#ifdef USE_EMISSIVEMAP vec4 emissiveColor = texture2D( emissiveMap, vUv ); totalEmissiveRadiance *= emissiveColor.rgb; #endif`,gM=`#ifdef USE_EMISSIVEMAP uniform sampler2D emissiveMap; #endif`,_M="gl_FragColor = linearToOutputTexel( gl_FragColor );",yM=`vec4 LinearToLinear( in vec4 value ) { return value; } vec4 LinearTosRGB( in vec4 value ) { return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a ); }`,vM=`#ifdef USE_ENVMAP #ifdef ENV_WORLDPOS vec3 cameraToFrag; if ( isOrthographic ) { cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); } else { cameraToFrag = normalize( vWorldPosition - cameraPosition ); } vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); #ifdef ENVMAP_MODE_REFLECTION vec3 reflectVec = reflect( cameraToFrag, worldNormal ); #else vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio ); #endif #else vec3 reflectVec = vReflect; #endif #ifdef ENVMAP_TYPE_CUBE vec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) ); #elif defined( ENVMAP_TYPE_CUBE_UV ) vec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 ); #else vec4 envColor = vec4( 0.0 ); #endif #ifdef ENVMAP_BLENDING_MULTIPLY outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity ); #elif defined( ENVMAP_BLENDING_MIX ) outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity ); #elif defined( ENVMAP_BLENDING_ADD ) outgoingLight += envColor.xyz * specularStrength * reflectivity; #endif #endif`,xM=`#ifdef USE_ENVMAP uniform float envMapIntensity; uniform float flipEnvMap; #ifdef ENVMAP_TYPE_CUBE uniform samplerCube envMap; #else uniform sampler2D envMap; #endif #endif`,bM=`#ifdef USE_ENVMAP uniform float reflectivity; #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) #define ENV_WORLDPOS #endif #ifdef ENV_WORLDPOS varying vec3 vWorldPosition; uniform float refractionRatio; #else varying vec3 vReflect; #endif #endif`,MM=`#ifdef USE_ENVMAP #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG ) #define ENV_WORLDPOS #endif #ifdef ENV_WORLDPOS varying vec3 vWorldPosition; #else varying vec3 vReflect; uniform float refractionRatio; #endif #endif`,SM=`#ifdef USE_ENVMAP #ifdef ENV_WORLDPOS vWorldPosition = worldPosition.xyz; #else vec3 cameraToVertex; if ( isOrthographic ) { cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); } else { cameraToVertex = normalize( worldPosition.xyz - cameraPosition ); } vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); #ifdef ENVMAP_MODE_REFLECTION vReflect = reflect( cameraToVertex, worldNormal ); #else vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); #endif #endif #endif`,wM=`#ifdef USE_FOG vFogDepth = - mvPosition.z; #endif`,CM=`#ifdef USE_FOG varying float vFogDepth; #endif`,AM=`#ifdef USE_FOG #ifdef FOG_EXP2 float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); #else float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); #endif gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); #endif`,TM=`#ifdef USE_FOG uniform vec3 fogColor; varying float vFogDepth; #ifdef FOG_EXP2 uniform float fogDensity; #else uniform float fogNear; uniform float fogFar; #endif #endif`,EM=`#ifdef USE_GRADIENTMAP uniform sampler2D gradientMap; #endif vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { float dotNL = dot( normal, lightDirection ); vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 ); #ifdef USE_GRADIENTMAP return vec3( texture2D( gradientMap, coord ).r ); #else return ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 ); #endif }`,LM=`#ifdef USE_LIGHTMAP vec4 lightMapTexel = texture2D( lightMap, vUv2 ); vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; reflectedLight.indirectDiffuse += lightMapIrradiance; #endif`,RM=`#ifdef USE_LIGHTMAP uniform sampler2D lightMap; uniform float lightMapIntensity; #endif`,PM=`vec3 diffuse = vec3( 1.0 ); GeometricContext geometry; geometry.position = mvPosition.xyz; geometry.normal = normalize( transformedNormal ); geometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz ); GeometricContext backGeometry; backGeometry.position = geometry.position; backGeometry.normal = -geometry.normal; backGeometry.viewDir = geometry.viewDir; vLightFront = vec3( 0.0 ); vIndirectFront = vec3( 0.0 ); #ifdef DOUBLE_SIDED vLightBack = vec3( 0.0 ); vIndirectBack = vec3( 0.0 ); #endif IncidentLight directLight; float dotNL; vec3 directLightColor_Diffuse; vIndirectFront += getAmbientLightIrradiance( ambientLightColor ); vIndirectFront += getLightProbeIrradiance( lightProbe, geometry.normal ); #ifdef DOUBLE_SIDED vIndirectBack += getAmbientLightIrradiance( ambientLightColor ); vIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry.normal ); #endif #if NUM_POINT_LIGHTS > 0 #pragma unroll_loop_start for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { getPointLightInfo( pointLights[ i ], geometry, directLight ); dotNL = dot( geometry.normal, directLight.direction ); directLightColor_Diffuse = directLight.color; vLightFront += saturate( dotNL ) * directLightColor_Diffuse; #ifdef DOUBLE_SIDED vLightBack += saturate( - dotNL ) * directLightColor_Diffuse; #endif } #pragma unroll_loop_end #endif #if NUM_SPOT_LIGHTS > 0 #pragma unroll_loop_start for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { getSpotLightInfo( spotLights[ i ], geometry, directLight ); dotNL = dot( geometry.normal, directLight.direction ); directLightColor_Diffuse = directLight.color; vLightFront += saturate( dotNL ) * directLightColor_Diffuse; #ifdef DOUBLE_SIDED vLightBack += saturate( - dotNL ) * directLightColor_Diffuse; #endif } #pragma unroll_loop_end #endif #if NUM_DIR_LIGHTS > 0 #pragma unroll_loop_start for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { getDirectionalLightInfo( directionalLights[ i ], geometry, directLight ); dotNL = dot( geometry.normal, directLight.direction ); directLightColor_Diffuse = directLight.color; vLightFront += saturate( dotNL ) * directLightColor_Diffuse; #ifdef DOUBLE_SIDED vLightBack += saturate( - dotNL ) * directLightColor_Diffuse; #endif } #pragma unroll_loop_end #endif #if NUM_HEMI_LIGHTS > 0 #pragma unroll_loop_start for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { vIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal ); #ifdef DOUBLE_SIDED vIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry.normal ); #endif } #pragma unroll_loop_end #endif`,IM=`uniform bool receiveShadow; uniform vec3 ambientLightColor; uniform vec3 lightProbe[ 9 ]; vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { float x = normal.x, y = normal.y, z = normal.z; vec3 result = shCoefficients[ 0 ] * 0.886227; result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y; result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z; result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 ); result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z; result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y ); return result; } vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) { vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); return irradiance; } vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { vec3 irradiance = ambientLightColor; return irradiance; } float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) { #if defined ( PHYSICALLY_CORRECT_LIGHTS ) float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); if ( cutoffDistance > 0.0 ) { distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); } return distanceFalloff; #else if ( cutoffDistance > 0.0 && decayExponent > 0.0 ) { return pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent ); } return 1.0; #endif } float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) { return smoothstep( coneCosine, penumbraCosine, angleCosine ); } #if NUM_DIR_LIGHTS > 0 struct DirectionalLight { vec3 direction; vec3 color; }; uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; void getDirectionalLightInfo( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight light ) { light.color = directionalLight.color; light.direction = directionalLight.direction; light.visible = true; } #endif #if NUM_POINT_LIGHTS > 0 struct PointLight { vec3 position; vec3 color; float distance; float decay; }; uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; void getPointLightInfo( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight light ) { vec3 lVector = pointLight.position - geometry.position; light.direction = normalize( lVector ); float lightDistance = length( lVector ); light.color = pointLight.color; light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay ); light.visible = ( light.color != vec3( 0.0 ) ); } #endif #if NUM_SPOT_LIGHTS > 0 struct SpotLight { vec3 position; vec3 direction; vec3 color; float distance; float decay; float coneCos; float penumbraCos; }; uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; void getSpotLightInfo( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight light ) { vec3 lVector = spotLight.position - geometry.position; light.direction = normalize( lVector ); float angleCos = dot( light.direction, spotLight.direction ); float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos ); if ( spotAttenuation > 0.0 ) { float lightDistance = length( lVector ); light.color = spotLight.color * spotAttenuation; light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay ); light.visible = ( light.color != vec3( 0.0 ) ); } else { light.color = vec3( 0.0 ); light.visible = false; } } #endif #if NUM_RECT_AREA_LIGHTS > 0 struct RectAreaLight { vec3 color; vec3 position; vec3 halfWidth; vec3 halfHeight; }; uniform sampler2D ltc_1; uniform sampler2D ltc_2; uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; #endif #if NUM_HEMI_LIGHTS > 0 struct HemisphereLight { vec3 direction; vec3 skyColor; vec3 groundColor; }; uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) { float dotNL = dot( normal, hemiLight.direction ); float hemiDiffuseWeight = 0.5 * dotNL + 0.5; vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); return irradiance; } #endif`,DM=`#if defined( USE_ENVMAP ) vec3 getIBLIrradiance( const in vec3 normal ) { #if defined( ENVMAP_TYPE_CUBE_UV ) vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); vec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 ); return PI * envMapColor.rgb * envMapIntensity; #else return vec3( 0.0 ); #endif } vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) { #if defined( ENVMAP_TYPE_CUBE_UV ) vec3 reflectVec = reflect( - viewDir, normal ); reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) ); reflectVec = inverseTransformDirection( reflectVec, viewMatrix ); vec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness ); return envMapColor.rgb * envMapIntensity; #else return vec3( 0.0 ); #endif } #endif`,FM=`ToonMaterial material; material.diffuseColor = diffuseColor.rgb;`,OM=`varying vec3 vViewPosition; struct ToonMaterial { vec3 diffuseColor; }; void RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { vec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color; reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } #define RE_Direct RE_Direct_Toon #define RE_IndirectDiffuse RE_IndirectDiffuse_Toon #define Material_LightProbeLOD( material ) (0)`,NM=`BlinnPhongMaterial material; material.diffuseColor = diffuseColor.rgb; material.specularColor = specular; material.specularShininess = shininess; material.specularStrength = specularStrength;`,kM=`varying vec3 vViewPosition; struct BlinnPhongMaterial { vec3 diffuseColor; vec3 specularColor; float specularShininess; float specularStrength; }; void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { float dotNL = saturate( dot( geometry.normal, directLight.direction ) ); vec3 irradiance = dotNL * directLight.color; reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength; } void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } #define RE_Direct RE_Direct_BlinnPhong #define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong #define Material_LightProbeLOD( material ) (0)`,BM=`PhysicalMaterial material; material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor ); vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) ); float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness; material.roughness = min( material.roughness, 1.0 ); #ifdef IOR #ifdef SPECULAR float specularIntensityFactor = specularIntensity; vec3 specularColorFactor = specularColor; #ifdef USE_SPECULARINTENSITYMAP specularIntensityFactor *= texture2D( specularIntensityMap, vUv ).a; #endif #ifdef USE_SPECULARCOLORMAP specularColorFactor *= texture2D( specularColorMap, vUv ).rgb; #endif material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor ); #else float specularIntensityFactor = 1.0; vec3 specularColorFactor = vec3( 1.0 ); material.specularF90 = 1.0; #endif material.specularColor = mix( min( pow2( ( ior - 1.0 ) / ( ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor ); #else material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor ); material.specularF90 = 1.0; #endif #ifdef USE_CLEARCOAT material.clearcoat = clearcoat; material.clearcoatRoughness = clearcoatRoughness; material.clearcoatF0 = vec3( 0.04 ); material.clearcoatF90 = 1.0; #ifdef USE_CLEARCOATMAP material.clearcoat *= texture2D( clearcoatMap, vUv ).x; #endif #ifdef USE_CLEARCOAT_ROUGHNESSMAP material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y; #endif material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 ); material.clearcoatRoughness += geometryRoughness; material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); #endif #ifdef USE_IRIDESCENCE material.iridescence = iridescence; material.iridescenceIOR = iridescenceIOR; #ifdef USE_IRIDESCENCEMAP material.iridescence *= texture2D( iridescenceMap, vUv ).r; #endif #ifdef USE_IRIDESCENCE_THICKNESSMAP material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vUv ).g + iridescenceThicknessMinimum; #else material.iridescenceThickness = iridescenceThicknessMaximum; #endif #endif #ifdef USE_SHEEN material.sheenColor = sheenColor; #ifdef USE_SHEENCOLORMAP material.sheenColor *= texture2D( sheenColorMap, vUv ).rgb; #endif material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 ); #ifdef USE_SHEENROUGHNESSMAP material.sheenRoughness *= texture2D( sheenRoughnessMap, vUv ).a; #endif #endif`,$M=`struct PhysicalMaterial { vec3 diffuseColor; float roughness; vec3 specularColor; float specularF90; #ifdef USE_CLEARCOAT float clearcoat; float clearcoatRoughness; vec3 clearcoatF0; float clearcoatF90; #endif #ifdef USE_IRIDESCENCE float iridescence; float iridescenceIOR; float iridescenceThickness; vec3 iridescenceFresnel; vec3 iridescenceF0; #endif #ifdef USE_SHEEN vec3 sheenColor; float sheenRoughness; #endif }; vec3 clearcoatSpecular = vec3( 0.0 ); vec3 sheenSpecular = vec3( 0.0 ); float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness) { float dotNV = saturate( dot( normal, viewDir ) ); float r2 = roughness * roughness; float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95; float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72; float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) ); return saturate( DG * RECIPROCAL_PI ); } vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { float dotNV = saturate( dot( normal, viewDir ) ); const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 ); const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 ); vec4 r = roughness * c0 + c1; float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y; vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw; return fab; } vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) { vec2 fab = DFGApprox( normal, viewDir, roughness ); return specularColor * fab.x + specularF90 * fab.y; } #ifdef USE_IRIDESCENCE void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { #else void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { #endif vec2 fab = DFGApprox( normal, viewDir, roughness ); #ifdef USE_IRIDESCENCE vec3 Fr = mix( specularColor, iridescenceF0, iridescence ); #else vec3 Fr = specularColor; #endif vec3 FssEss = Fr * fab.x + specularF90 * fab.y; float Ess = fab.x + fab.y; float Ems = 1.0 - Ess; vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg ); singleScatter += FssEss; multiScatter += Fms * Ems; } #if NUM_RECT_AREA_LIGHTS > 0 void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { vec3 normal = geometry.normal; vec3 viewDir = geometry.viewDir; vec3 position = geometry.position; vec3 lightPos = rectAreaLight.position; vec3 halfWidth = rectAreaLight.halfWidth; vec3 halfHeight = rectAreaLight.halfHeight; vec3 lightColor = rectAreaLight.color; float roughness = material.roughness; vec3 rectCoords[ 4 ]; rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight; rectCoords[ 2 ] = lightPos - halfWidth + halfHeight; rectCoords[ 3 ] = lightPos + halfWidth + halfHeight; vec2 uv = LTC_Uv( normal, viewDir, roughness ); vec4 t1 = texture2D( ltc_1, uv ); vec4 t2 = texture2D( ltc_2, uv ); mat3 mInv = mat3( vec3( t1.x, 0, t1.y ), vec3( 0, 1, 0 ), vec3( t1.z, 0, t1.w ) ); vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y ); reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords ); reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords ); } #endif void RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { float dotNL = saturate( dot( geometry.normal, directLight.direction ) ); vec3 irradiance = dotNL * directLight.color; #ifdef USE_CLEARCOAT float dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) ); vec3 ccIrradiance = dotNLcc * directLight.color; clearcoatSpecular += ccIrradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); #endif #ifdef USE_SHEEN sheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness ); #endif #ifdef USE_IRIDESCENCE reflectedLight.directSpecular += irradiance * BRDF_GGX_Iridescence( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness ); #else reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.roughness ); #endif reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) { #ifdef USE_CLEARCOAT clearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); #endif #ifdef USE_SHEEN sheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness ); #endif vec3 singleScattering = vec3( 0.0 ); vec3 multiScattering = vec3( 0.0 ); vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; #ifdef USE_IRIDESCENCE computeMultiscatteringIridescence( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering ); #else computeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering ); #endif vec3 totalScattering = singleScattering + multiScattering; vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) ); reflectedLight.indirectSpecular += radiance * singleScattering; reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance; reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance; } #define RE_Direct RE_Direct_Physical #define RE_Direct_RectArea RE_Direct_RectArea_Physical #define RE_IndirectDiffuse RE_IndirectDiffuse_Physical #define RE_IndirectSpecular RE_IndirectSpecular_Physical float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); }`,UM=` GeometricContext geometry; geometry.position = - vViewPosition; geometry.normal = normal; geometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); #ifdef USE_CLEARCOAT geometry.clearcoatNormal = clearcoatNormal; #endif #ifdef USE_IRIDESCENCE float dotNVi = saturate( dot( normal, geometry.viewDir ) ); if ( material.iridescenceThickness == 0.0 ) { material.iridescence = 0.0; } else { material.iridescence = saturate( material.iridescence ); } if ( material.iridescence > 0.0 ) { material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor ); material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi ); } #endif IncidentLight directLight; #if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) PointLight pointLight; #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 PointLightShadow pointLightShadow; #endif #pragma unroll_loop_start for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { pointLight = pointLights[ i ]; getPointLightInfo( pointLight, geometry, directLight ); #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) pointLightShadow = pointLightShadows[ i ]; directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; #endif RE_Direct( directLight, geometry, material, reflectedLight ); } #pragma unroll_loop_end #endif #if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) SpotLight spotLight; #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 SpotLightShadow spotLightShadow; #endif #pragma unroll_loop_start for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { spotLight = spotLights[ i ]; getSpotLightInfo( spotLight, geometry, directLight ); #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) spotLightShadow = spotLightShadows[ i ]; directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0; #endif RE_Direct( directLight, geometry, material, reflectedLight ); } #pragma unroll_loop_end #endif #if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) DirectionalLight directionalLight; #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 DirectionalLightShadow directionalLightShadow; #endif #pragma unroll_loop_start for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { directionalLight = directionalLights[ i ]; getDirectionalLightInfo( directionalLight, geometry, directLight ); #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) directionalLightShadow = directionalLightShadows[ i ]; directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; #endif RE_Direct( directLight, geometry, material, reflectedLight ); } #pragma unroll_loop_end #endif #if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) RectAreaLight rectAreaLight; #pragma unroll_loop_start for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { rectAreaLight = rectAreaLights[ i ]; RE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight ); } #pragma unroll_loop_end #endif #if defined( RE_IndirectDiffuse ) vec3 iblIrradiance = vec3( 0.0 ); vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); irradiance += getLightProbeIrradiance( lightProbe, geometry.normal ); #if ( NUM_HEMI_LIGHTS > 0 ) #pragma unroll_loop_start for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal ); } #pragma unroll_loop_end #endif #endif #if defined( RE_IndirectSpecular ) vec3 radiance = vec3( 0.0 ); vec3 clearcoatRadiance = vec3( 0.0 ); #endif`,zM=`#if defined( RE_IndirectDiffuse ) #ifdef USE_LIGHTMAP vec4 lightMapTexel = texture2D( lightMap, vUv2 ); vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; irradiance += lightMapIrradiance; #endif #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV ) iblIrradiance += getIBLIrradiance( geometry.normal ); #endif #endif #if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) radiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness ); #ifdef USE_CLEARCOAT clearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness ); #endif #endif`,GM=`#if defined( RE_IndirectDiffuse ) RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight ); #endif #if defined( RE_IndirectSpecular ) RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight ); #endif`,VM=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; #endif`,HM=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) uniform float logDepthBufFC; varying float vFragDepth; varying float vIsPerspective; #endif`,WM=`#ifdef USE_LOGDEPTHBUF #ifdef USE_LOGDEPTHBUF_EXT varying float vFragDepth; varying float vIsPerspective; #else uniform float logDepthBufFC; #endif #endif`,jM=`#ifdef USE_LOGDEPTHBUF #ifdef USE_LOGDEPTHBUF_EXT vFragDepth = 1.0 + gl_Position.w; vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); #else if ( isPerspectiveMatrix( projectionMatrix ) ) { gl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0; gl_Position.z *= gl_Position.w; } #endif #endif`,qM=`#ifdef USE_MAP vec4 sampledDiffuseColor = texture2D( map, vUv ); #ifdef DECODE_VIDEO_TEXTURE sampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w ); #endif diffuseColor *= sampledDiffuseColor; #endif`,XM=`#ifdef USE_MAP uniform sampler2D map; #endif`,YM=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy; #endif #ifdef USE_MAP diffuseColor *= texture2D( map, uv ); #endif #ifdef USE_ALPHAMAP diffuseColor.a *= texture2D( alphaMap, uv ).g; #endif`,JM=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) uniform mat3 uvTransform; #endif #ifdef USE_MAP uniform sampler2D map; #endif #ifdef USE_ALPHAMAP uniform sampler2D alphaMap; #endif`,ZM=`float metalnessFactor = metalness; #ifdef USE_METALNESSMAP vec4 texelMetalness = texture2D( metalnessMap, vUv ); metalnessFactor *= texelMetalness.b; #endif`,KM=`#ifdef USE_METALNESSMAP uniform sampler2D metalnessMap; #endif`,QM=`#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE ) vColor *= morphTargetBaseInfluence; for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { #if defined( USE_COLOR_ALPHA ) if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ]; #elif defined( USE_COLOR ) if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; #endif } #endif`,eS=`#ifdef USE_MORPHNORMALS objectNormal *= morphTargetBaseInfluence; #ifdef MORPHTARGETS_TEXTURE for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; } #else objectNormal += morphNormal0 * morphTargetInfluences[ 0 ]; objectNormal += morphNormal1 * morphTargetInfluences[ 1 ]; objectNormal += morphNormal2 * morphTargetInfluences[ 2 ]; objectNormal += morphNormal3 * morphTargetInfluences[ 3 ]; #endif #endif`,tS=`#ifdef USE_MORPHTARGETS uniform float morphTargetBaseInfluence; #ifdef MORPHTARGETS_TEXTURE uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; uniform sampler2DArray morphTargetsTexture; uniform ivec2 morphTargetsTextureSize; vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) { int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset; int y = texelIndex / morphTargetsTextureSize.x; int x = texelIndex - y * morphTargetsTextureSize.x; ivec3 morphUV = ivec3( x, y, morphTargetIndex ); return texelFetch( morphTargetsTexture, morphUV, 0 ); } #else #ifndef USE_MORPHNORMALS uniform float morphTargetInfluences[ 8 ]; #else uniform float morphTargetInfluences[ 4 ]; #endif #endif #endif`,nS=`#ifdef USE_MORPHTARGETS transformed *= morphTargetBaseInfluence; #ifdef MORPHTARGETS_TEXTURE for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; } #else transformed += morphTarget0 * morphTargetInfluences[ 0 ]; transformed += morphTarget1 * morphTargetInfluences[ 1 ]; transformed += morphTarget2 * morphTargetInfluences[ 2 ]; transformed += morphTarget3 * morphTargetInfluences[ 3 ]; #ifndef USE_MORPHNORMALS transformed += morphTarget4 * morphTargetInfluences[ 4 ]; transformed += morphTarget5 * morphTargetInfluences[ 5 ]; transformed += morphTarget6 * morphTargetInfluences[ 6 ]; transformed += morphTarget7 * morphTargetInfluences[ 7 ]; #endif #endif #endif`,iS=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; #ifdef FLAT_SHADED vec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) ); vec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) ); vec3 normal = normalize( cross( fdx, fdy ) ); #else vec3 normal = normalize( vNormal ); #ifdef DOUBLE_SIDED normal = normal * faceDirection; #endif #ifdef USE_TANGENT vec3 tangent = normalize( vTangent ); vec3 bitangent = normalize( vBitangent ); #ifdef DOUBLE_SIDED tangent = tangent * faceDirection; bitangent = bitangent * faceDirection; #endif #if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP ) mat3 vTBN = mat3( tangent, bitangent, normal ); #endif #endif #endif vec3 geometryNormal = normal;`,sS=`#ifdef OBJECTSPACE_NORMALMAP normal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0; #ifdef FLIP_SIDED normal = - normal; #endif #ifdef DOUBLE_SIDED normal = normal * faceDirection; #endif normal = normalize( normalMatrix * normal ); #elif defined( TANGENTSPACE_NORMALMAP ) vec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0; mapN.xy *= normalScale; #ifdef USE_TANGENT normal = normalize( vTBN * mapN ); #else normal = perturbNormal2Arb( - vViewPosition, normal, mapN, faceDirection ); #endif #elif defined( USE_BUMPMAP ) normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); #endif`,rS=`#ifndef FLAT_SHADED varying vec3 vNormal; #ifdef USE_TANGENT varying vec3 vTangent; varying vec3 vBitangent; #endif #endif`,oS=`#ifndef FLAT_SHADED varying vec3 vNormal; #ifdef USE_TANGENT varying vec3 vTangent; varying vec3 vBitangent; #endif #endif`,aS=`#ifndef FLAT_SHADED vNormal = normalize( transformedNormal ); #ifdef USE_TANGENT vTangent = normalize( transformedTangent ); vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); #endif #endif`,lS=`#ifdef USE_NORMALMAP uniform sampler2D normalMap; uniform vec2 normalScale; #endif #ifdef OBJECTSPACE_NORMALMAP uniform mat3 normalMatrix; #endif #if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) ) vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) { vec3 q0 = dFdx( eye_pos.xyz ); vec3 q1 = dFdy( eye_pos.xyz ); vec2 st0 = dFdx( vUv.st ); vec2 st1 = dFdy( vUv.st ); vec3 N = surf_norm; vec3 q1perp = cross( q1, N ); vec3 q0perp = cross( N, q0 ); vec3 T = q1perp * st0.x + q0perp * st1.x; vec3 B = q1perp * st0.y + q0perp * st1.y; float det = max( dot( T, T ), dot( B, B ) ); float scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt( det ); return normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z ); } #endif`,cS=`#ifdef USE_CLEARCOAT vec3 clearcoatNormal = geometryNormal; #endif`,hS=`#ifdef USE_CLEARCOAT_NORMALMAP vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0; clearcoatMapN.xy *= clearcoatNormalScale; #ifdef USE_TANGENT clearcoatNormal = normalize( vTBN * clearcoatMapN ); #else clearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN, faceDirection ); #endif #endif`,uS=`#ifdef USE_CLEARCOATMAP uniform sampler2D clearcoatMap; #endif #ifdef USE_CLEARCOAT_ROUGHNESSMAP uniform sampler2D clearcoatRoughnessMap; #endif #ifdef USE_CLEARCOAT_NORMALMAP uniform sampler2D clearcoatNormalMap; uniform vec2 clearcoatNormalScale; #endif`,dS=`#ifdef USE_IRIDESCENCEMAP uniform sampler2D iridescenceMap; #endif #ifdef USE_IRIDESCENCE_THICKNESSMAP uniform sampler2D iridescenceThicknessMap; #endif`,pS=`#ifdef OPAQUE diffuseColor.a = 1.0; #endif #ifdef USE_TRANSMISSION diffuseColor.a *= transmissionAlpha + 0.1; #endif gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,fS=`vec3 packNormalToRGB( const in vec3 normal ) { return normalize( normal ) * 0.5 + 0.5; } vec3 unpackRGBToNormal( const in vec3 rgb ) { return 2.0 * rgb.xyz - 1.0; } const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.; const vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. ); const vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. ); const float ShiftRight8 = 1. / 256.; vec4 packDepthToRGBA( const in float v ) { vec4 r = vec4( fract( v * PackFactors ), v ); r.yzw -= r.xyz * ShiftRight8; return r * PackUpscale; } float unpackRGBAToDepth( const in vec4 v ) { return dot( v, UnpackFactors ); } vec4 pack2HalfToRGBA( vec2 v ) { vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) ); return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w ); } vec2 unpackRGBATo2Half( vec4 v ) { return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) ); } float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) { return ( viewZ + near ) / ( near - far ); } float orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) { return linearClipZ * ( near - far ) - near; } float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) { return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ ); } float perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) { return ( near * far ) / ( ( far - near ) * invClipZ - far ); }`,mS=`#ifdef PREMULTIPLIED_ALPHA gl_FragColor.rgb *= gl_FragColor.a; #endif`,gS=`vec4 mvPosition = vec4( transformed, 1.0 ); #ifdef USE_INSTANCING mvPosition = instanceMatrix * mvPosition; #endif mvPosition = modelViewMatrix * mvPosition; gl_Position = projectionMatrix * mvPosition;`,_S=`#ifdef DITHERING gl_FragColor.rgb = dithering( gl_FragColor.rgb ); #endif`,yS=`#ifdef DITHERING vec3 dithering( vec3 color ) { float grid_position = rand( gl_FragCoord.xy ); vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); return color + dither_shift_RGB; } #endif`,vS=`float roughnessFactor = roughness; #ifdef USE_ROUGHNESSMAP vec4 texelRoughness = texture2D( roughnessMap, vUv ); roughnessFactor *= texelRoughness.g; #endif`,xS=`#ifdef USE_ROUGHNESSMAP uniform sampler2D roughnessMap; #endif`,bS=`#ifdef USE_SHADOWMAP #if NUM_DIR_LIGHT_SHADOWS > 0 uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; struct DirectionalLightShadow { float shadowBias; float shadowNormalBias; float shadowRadius; vec2 shadowMapSize; }; uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; #endif #if NUM_SPOT_LIGHT_SHADOWS > 0 uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; varying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ]; struct SpotLightShadow { float shadowBias; float shadowNormalBias; float shadowRadius; vec2 shadowMapSize; }; uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; #endif #if NUM_POINT_LIGHT_SHADOWS > 0 uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; struct PointLightShadow { float shadowBias; float shadowNormalBias; float shadowRadius; vec2 shadowMapSize; float shadowCameraNear; float shadowCameraFar; }; uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; #endif float texture2DCompare( sampler2D depths, vec2 uv, float compare ) { return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) ); } vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) { return unpackRGBATo2Half( texture2D( shadow, uv ) ); } float VSMShadow (sampler2D shadow, vec2 uv, float compare ){ float occlusion = 1.0; vec2 distribution = texture2DDistribution( shadow, uv ); float hard_shadow = step( compare , distribution.x ); if (hard_shadow != 1.0 ) { float distance = compare - distribution.x ; float variance = max( 0.00000, distribution.y * distribution.y ); float softness_probability = variance / (variance + distance * distance ); softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 ); } return occlusion; } float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) { float shadow = 1.0; shadowCoord.xyz /= shadowCoord.w; shadowCoord.z += shadowBias; bvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 ); bool inFrustum = all( inFrustumVec ); bvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 ); bool frustumTest = all( frustumTestVec ); if ( frustumTest ) { #if defined( SHADOWMAP_TYPE_PCF ) vec2 texelSize = vec2( 1.0 ) / shadowMapSize; float dx0 = - texelSize.x * shadowRadius; float dy0 = - texelSize.y * shadowRadius; float dx1 = + texelSize.x * shadowRadius; float dy1 = + texelSize.y * shadowRadius; float dx2 = dx0 / 2.0; float dy2 = dy0 / 2.0; float dx3 = dx1 / 2.0; float dy3 = dy1 / 2.0; shadow = ( texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z ) ) * ( 1.0 / 17.0 ); #elif defined( SHADOWMAP_TYPE_PCF_SOFT ) vec2 texelSize = vec2( 1.0 ) / shadowMapSize; float dx = texelSize.x; float dy = texelSize.y; vec2 uv = shadowCoord.xy; vec2 f = fract( uv * shadowMapSize + 0.5 ); uv -= f * texelSize; shadow = ( texture2DCompare( shadowMap, uv, shadowCoord.z ) + texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) + texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) + texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) + mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ), f.x ) + mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ), f.x ) + mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ), f.y ) + mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ), f.y ) + mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ), f.x ), mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ), f.x ), f.y ) ) * ( 1.0 / 9.0 ); #elif defined( SHADOWMAP_TYPE_VSM ) shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z ); #else shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ); #endif } return shadow; } vec2 cubeToUV( vec3 v, float texelSizeY ) { vec3 absV = abs( v ); float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) ); absV *= scaleToCube; v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY ); vec2 planar = v.xy; float almostATexel = 1.5 * texelSizeY; float almostOne = 1.0 - almostATexel; if ( absV.z >= almostOne ) { if ( v.z > 0.0 ) planar.x = 4.0 - v.x; } else if ( absV.x >= almostOne ) { float signX = sign( v.x ); planar.x = v.z * signX + 2.0 * signX; } else if ( absV.y >= almostOne ) { float signY = sign( v.y ); planar.x = v.x + 2.0 * signY + 2.0; planar.y = v.z * signY - 2.0; } return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 ); } float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) ); vec3 lightToPosition = shadowCoord.xyz; float dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias; vec3 bd3D = normalize( lightToPosition ); #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM ) vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y; return ( texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp ) ) * ( 1.0 / 9.0 ); #else return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ); #endif } #endif`,MS=`#ifdef USE_SHADOWMAP #if NUM_DIR_LIGHT_SHADOWS > 0 uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ]; varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; struct DirectionalLightShadow { float shadowBias; float shadowNormalBias; float shadowRadius; vec2 shadowMapSize; }; uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; #endif #if NUM_SPOT_LIGHT_SHADOWS > 0 uniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ]; varying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ]; struct SpotLightShadow { float shadowBias; float shadowNormalBias; float shadowRadius; vec2 shadowMapSize; }; uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; #endif #if NUM_POINT_LIGHT_SHADOWS > 0 uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ]; varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; struct PointLightShadow { float shadowBias; float shadowNormalBias; float shadowRadius; vec2 shadowMapSize; float shadowCameraNear; float shadowCameraFar; }; uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; #endif #endif`,SS=`#ifdef USE_SHADOWMAP #if NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SPOT_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); vec4 shadowWorldPosition; #endif #if NUM_DIR_LIGHT_SHADOWS > 0 #pragma unroll_loop_start for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 ); vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition; } #pragma unroll_loop_end #endif #if NUM_SPOT_LIGHT_SHADOWS > 0 #pragma unroll_loop_start for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias, 0 ); vSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * shadowWorldPosition; } #pragma unroll_loop_end #endif #if NUM_POINT_LIGHT_SHADOWS > 0 #pragma unroll_loop_start for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 ); vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition; } #pragma unroll_loop_end #endif #endif`,wS=`float getShadowMask() { float shadow = 1.0; #ifdef USE_SHADOWMAP #if NUM_DIR_LIGHT_SHADOWS > 0 DirectionalLightShadow directionalLight; #pragma unroll_loop_start for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { directionalLight = directionalLightShadows[ i ]; shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; } #pragma unroll_loop_end #endif #if NUM_SPOT_LIGHT_SHADOWS > 0 SpotLightShadow spotLight; #pragma unroll_loop_start for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { spotLight = spotLightShadows[ i ]; shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0; } #pragma unroll_loop_end #endif #if NUM_POINT_LIGHT_SHADOWS > 0 PointLightShadow pointLight; #pragma unroll_loop_start for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { pointLight = pointLightShadows[ i ]; shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; } #pragma unroll_loop_end #endif #endif return shadow; }`,CS=`#ifdef USE_SKINNING mat4 boneMatX = getBoneMatrix( skinIndex.x ); mat4 boneMatY = getBoneMatrix( skinIndex.y ); mat4 boneMatZ = getBoneMatrix( skinIndex.z ); mat4 boneMatW = getBoneMatrix( skinIndex.w ); #endif`,AS=`#ifdef USE_SKINNING uniform mat4 bindMatrix; uniform mat4 bindMatrixInverse; uniform highp sampler2D boneTexture; uniform int boneTextureSize; mat4 getBoneMatrix( const in float i ) { float j = i * 4.0; float x = mod( j, float( boneTextureSize ) ); float y = floor( j / float( boneTextureSize ) ); float dx = 1.0 / float( boneTextureSize ); float dy = 1.0 / float( boneTextureSize ); y = dy * ( y + 0.5 ); vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) ); vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) ); vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) ); vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) ); mat4 bone = mat4( v1, v2, v3, v4 ); return bone; } #endif`,TS=`#ifdef USE_SKINNING vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); vec4 skinned = vec4( 0.0 ); skinned += boneMatX * skinVertex * skinWeight.x; skinned += boneMatY * skinVertex * skinWeight.y; skinned += boneMatZ * skinVertex * skinWeight.z; skinned += boneMatW * skinVertex * skinWeight.w; transformed = ( bindMatrixInverse * skinned ).xyz; #endif`,ES=`#ifdef USE_SKINNING mat4 skinMatrix = mat4( 0.0 ); skinMatrix += skinWeight.x * boneMatX; skinMatrix += skinWeight.y * boneMatY; skinMatrix += skinWeight.z * boneMatZ; skinMatrix += skinWeight.w * boneMatW; skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix; objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz; #ifdef USE_TANGENT objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; #endif #endif`,LS=`float specularStrength; #ifdef USE_SPECULARMAP vec4 texelSpecular = texture2D( specularMap, vUv ); specularStrength = texelSpecular.r; #else specularStrength = 1.0; #endif`,RS=`#ifdef USE_SPECULARMAP uniform sampler2D specularMap; #endif`,PS=`#if defined( TONE_MAPPING ) gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); #endif`,IS=`#ifndef saturate #define saturate( a ) clamp( a, 0.0, 1.0 ) #endif uniform float toneMappingExposure; vec3 LinearToneMapping( vec3 color ) { return toneMappingExposure * color; } vec3 ReinhardToneMapping( vec3 color ) { color *= toneMappingExposure; return saturate( color / ( vec3( 1.0 ) + color ) ); } vec3 OptimizedCineonToneMapping( vec3 color ) { color *= toneMappingExposure; color = max( vec3( 0.0 ), color - 0.004 ); return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) ); } vec3 RRTAndODTFit( vec3 v ) { vec3 a = v * ( v + 0.0245786 ) - 0.000090537; vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081; return a / b; } vec3 ACESFilmicToneMapping( vec3 color ) { const mat3 ACESInputMat = mat3( vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ), vec3( 0.04823, 0.01566, 0.83777 ) ); const mat3 ACESOutputMat = mat3( vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ), vec3( -0.07367, -0.00605, 1.07602 ) ); color *= toneMappingExposure / 0.6; color = ACESInputMat * color; color = RRTAndODTFit( color ); color = ACESOutputMat * color; return saturate( color ); } vec3 CustomToneMapping( vec3 color ) { return color; }`,DS=`#ifdef USE_TRANSMISSION float transmissionAlpha = 1.0; float transmissionFactor = transmission; float thicknessFactor = thickness; #ifdef USE_TRANSMISSIONMAP transmissionFactor *= texture2D( transmissionMap, vUv ).r; #endif #ifdef USE_THICKNESSMAP thicknessFactor *= texture2D( thicknessMap, vUv ).g; #endif vec3 pos = vWorldPosition; vec3 v = normalize( cameraPosition - pos ); vec3 n = inverseTransformDirection( normal, viewMatrix ); vec4 transmission = getIBLVolumeRefraction( n, v, roughnessFactor, material.diffuseColor, material.specularColor, material.specularF90, pos, modelMatrix, viewMatrix, projectionMatrix, ior, thicknessFactor, attenuationColor, attenuationDistance ); totalDiffuse = mix( totalDiffuse, transmission.rgb, transmissionFactor ); transmissionAlpha = mix( transmissionAlpha, transmission.a, transmissionFactor ); #endif`,FS=`#ifdef USE_TRANSMISSION uniform float transmission; uniform float thickness; uniform float attenuationDistance; uniform vec3 attenuationColor; #ifdef USE_TRANSMISSIONMAP uniform sampler2D transmissionMap; #endif #ifdef USE_THICKNESSMAP uniform sampler2D thicknessMap; #endif uniform vec2 transmissionSamplerSize; uniform sampler2D transmissionSamplerMap; uniform mat4 modelMatrix; uniform mat4 projectionMatrix; varying vec3 vWorldPosition; vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) { vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); vec3 modelScale; modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); return normalize( refractionVector ) * thickness * modelScale; } float applyIorToRoughness( const in float roughness, const in float ior ) { return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); } vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) { float framebufferLod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); #ifdef texture2DLodEXT return texture2DLodEXT( transmissionSamplerMap, fragCoord.xy, framebufferLod ); #else return texture2D( transmissionSamplerMap, fragCoord.xy, framebufferLod ); #endif } vec3 applyVolumeAttenuation( const in vec3 radiance, const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { if ( attenuationDistance == 0.0 ) { return radiance; } else { vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance * radiance; } } vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor, const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix, const in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness, const in vec3 attenuationColor, const in float attenuationDistance ) { vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); vec3 refractedRayExit = position + transmissionRay; vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); vec2 refractionCoords = ndcPos.xy / ndcPos.w; refractionCoords += 1.0; refractionCoords /= 2.0; vec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); vec3 attenuatedColor = applyVolumeAttenuation( transmittedLight.rgb, length( transmissionRay ), attenuationColor, attenuationDistance ); vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); return vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a ); } #endif`,OS=`#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) ) varying vec2 vUv; #endif`,NS=`#ifdef USE_UV #ifdef UVS_VERTEX_ONLY vec2 vUv; #else varying vec2 vUv; #endif uniform mat3 uvTransform; #endif`,kS=`#ifdef USE_UV vUv = ( uvTransform * vec3( uv, 1 ) ).xy; #endif`,BS=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP ) varying vec2 vUv2; #endif`,$S=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP ) attribute vec2 uv2; varying vec2 vUv2; uniform mat3 uv2Transform; #endif`,US=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP ) vUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy; #endif`,zS=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) vec4 worldPosition = vec4( transformed, 1.0 ); #ifdef USE_INSTANCING worldPosition = instanceMatrix * worldPosition; #endif worldPosition = modelMatrix * worldPosition; #endif`;const GS=`varying vec2 vUv; uniform mat3 uvTransform; void main() { vUv = ( uvTransform * vec3( uv, 1 ) ).xy; gl_Position = vec4( position.xy, 1.0, 1.0 ); }`,VS=`uniform sampler2D t2D; varying vec2 vUv; void main() { gl_FragColor = texture2D( t2D, vUv ); #ifdef DECODE_VIDEO_TEXTURE gl_FragColor = vec4( mix( pow( gl_FragColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), gl_FragColor.rgb * 0.0773993808, vec3( lessThanEqual( gl_FragColor.rgb, vec3( 0.04045 ) ) ) ), gl_FragColor.w ); #endif #include #include }`,HS=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include gl_Position.z = gl_Position.w; }`,WS=`#include uniform float opacity; varying vec3 vWorldDirection; #include void main() { vec3 vReflect = vWorldDirection; #include gl_FragColor = envColor; gl_FragColor.a *= opacity; #include #include }`,jS=`#include #include #include #include #include #include #include varying vec2 vHighPrecisionZW; void main() { #include #include #ifdef USE_DISPLACEMENTMAP #include #include #include #endif #include #include #include #include #include #include #include vHighPrecisionZW = gl_Position.zw; }`,qS=`#if DEPTH_PACKING == 3200 uniform float opacity; #endif #include #include #include #include #include #include #include #include varying vec2 vHighPrecisionZW; void main() { #include vec4 diffuseColor = vec4( 1.0 ); #if DEPTH_PACKING == 3200 diffuseColor.a = opacity; #endif #include #include #include #include float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5; #if DEPTH_PACKING == 3200 gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity ); #elif DEPTH_PACKING == 3201 gl_FragColor = packDepthToRGBA( fragCoordZ ); #endif }`,XS=`#define DISTANCE varying vec3 vWorldPosition; #include #include #include #include #include #include void main() { #include #include #ifdef USE_DISPLACEMENTMAP #include #include #include #endif #include #include #include #include #include #include #include vWorldPosition = worldPosition.xyz; }`,YS=`#define DISTANCE uniform vec3 referencePosition; uniform float nearDistance; uniform float farDistance; varying vec3 vWorldPosition; #include #include #include #include #include #include #include void main () { #include vec4 diffuseColor = vec4( 1.0 ); #include #include #include float dist = length( vWorldPosition - referencePosition ); dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); dist = saturate( dist ); gl_FragColor = packDepthToRGBA( dist ); }`,JS=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include }`,ZS=`uniform sampler2D tEquirect; varying vec3 vWorldDirection; #include void main() { vec3 direction = normalize( vWorldDirection ); vec2 sampleUV = equirectUv( direction ); gl_FragColor = texture2D( tEquirect, sampleUV ); #include #include }`,KS=`uniform float scale; attribute float lineDistance; varying float vLineDistance; #include #include #include #include #include #include void main() { vLineDistance = scale * lineDistance; #include #include #include #include #include #include #include #include }`,QS=`uniform vec3 diffuse; uniform float opacity; uniform float dashSize; uniform float totalSize; varying float vLineDistance; #include #include #include #include #include void main() { #include if ( mod( vLineDistance, totalSize ) > dashSize ) { discard; } vec3 outgoingLight = vec3( 0.0 ); vec4 diffuseColor = vec4( diffuse, opacity ); #include #include outgoingLight = diffuseColor.rgb; #include #include #include #include #include }`,ew=`#include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING ) #include #include #include #include #include #endif #include #include #include #include #include #include #include #include #include }`,tw=`uniform vec3 diffuse; uniform float opacity; #ifndef FLAT_SHADED varying vec3 vNormal; #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include vec4 diffuseColor = vec4( diffuse, opacity ); #include #include #include #include #include #include ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); #ifdef USE_LIGHTMAP vec4 lightMapTexel = texture2D( lightMap, vUv2 ); reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI; #else reflectedLight.indirectDiffuse += vec3( 1.0 ); #endif #include reflectedLight.indirectDiffuse *= diffuseColor.rgb; vec3 outgoingLight = reflectedLight.indirectDiffuse; #include #include #include #include #include #include #include }`,nw=`#define LAMBERT varying vec3 vLightFront; varying vec3 vIndirectFront; #ifdef DOUBLE_SIDED varying vec3 vLightBack; varying vec3 vIndirectBack; #endif #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include }`,iw=`uniform vec3 diffuse; uniform vec3 emissive; uniform float opacity; varying vec3 vLightFront; varying vec3 vIndirectFront; #ifdef DOUBLE_SIDED varying vec3 vLightBack; varying vec3 vIndirectBack; #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include vec4 diffuseColor = vec4( diffuse, opacity ); ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); vec3 totalEmissiveRadiance = emissive; #include #include #include #include #include #include #include #ifdef DOUBLE_SIDED reflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack; #else reflectedLight.indirectDiffuse += vIndirectFront; #endif #include reflectedLight.indirectDiffuse *= BRDF_Lambert( diffuseColor.rgb ); #ifdef DOUBLE_SIDED reflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack; #else reflectedLight.directDiffuse = vLightFront; #endif reflectedLight.directDiffuse *= BRDF_Lambert( diffuseColor.rgb ) * getShadowMask(); #include vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; #include #include #include #include #include #include #include }`,sw=`#define MATCAP varying vec3 vViewPosition; #include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vViewPosition = - mvPosition.xyz; }`,rw=`#define MATCAP uniform vec3 diffuse; uniform float opacity; uniform sampler2D matcap; varying vec3 vViewPosition; #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include vec4 diffuseColor = vec4( diffuse, opacity ); #include #include #include #include #include #include #include vec3 viewDir = normalize( vViewPosition ); vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); vec3 y = cross( viewDir, x ); vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; #ifdef USE_MATCAP vec4 matcapColor = texture2D( matcap, uv ); #else vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); #endif vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; #include #include #include #include #include #include }`,ow=`#define NORMAL #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP ) varying vec3 vViewPosition; #endif #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include #include #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP ) vViewPosition = - mvPosition.xyz; #endif }`,aw=`#define NORMAL uniform float opacity; #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP ) varying vec3 vViewPosition; #endif #include #include #include #include #include #include #include void main() { #include #include #include #include gl_FragColor = vec4( packNormalToRGB( normal ), opacity ); #ifdef OPAQUE gl_FragColor.a = 1.0; #endif }`,lw=`#define PHONG varying vec3 vViewPosition; #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vViewPosition = - mvPosition.xyz; #include #include #include #include }`,cw=`#define PHONG uniform vec3 diffuse; uniform vec3 emissive; uniform vec3 specular; uniform float shininess; uniform float opacity; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include vec4 diffuseColor = vec4( diffuse, opacity ); ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); vec3 totalEmissiveRadiance = emissive; #include #include #include #include #include #include #include #include #include #include #include #include #include #include vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; #include #include #include #include #include #include #include }`,hw=`#define STANDARD varying vec3 vViewPosition; #ifdef USE_TRANSMISSION varying vec3 vWorldPosition; #endif #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vViewPosition = - mvPosition.xyz; #include #include #include #ifdef USE_TRANSMISSION vWorldPosition = worldPosition.xyz; #endif }`,uw=`#define STANDARD #ifdef PHYSICAL #define IOR #define SPECULAR #endif uniform vec3 diffuse; uniform vec3 emissive; uniform float roughness; uniform float metalness; uniform float opacity; #ifdef IOR uniform float ior; #endif #ifdef SPECULAR uniform float specularIntensity; uniform vec3 specularColor; #ifdef USE_SPECULARINTENSITYMAP uniform sampler2D specularIntensityMap; #endif #ifdef USE_SPECULARCOLORMAP uniform sampler2D specularColorMap; #endif #endif #ifdef USE_CLEARCOAT uniform float clearcoat; uniform float clearcoatRoughness; #endif #ifdef USE_IRIDESCENCE uniform float iridescence; uniform float iridescenceIOR; uniform float iridescenceThicknessMinimum; uniform float iridescenceThicknessMaximum; #endif #ifdef USE_SHEEN uniform vec3 sheenColor; uniform float sheenRoughness; #ifdef USE_SHEENCOLORMAP uniform sampler2D sheenColorMap; #endif #ifdef USE_SHEENROUGHNESSMAP uniform sampler2D sheenRoughnessMap; #endif #endif varying vec3 vViewPosition; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include vec4 diffuseColor = vec4( diffuse, opacity ); ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); vec3 totalEmissiveRadiance = emissive; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; #include vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; #ifdef USE_SHEEN float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor ); outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular; #endif #ifdef USE_CLEARCOAT float dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) ); vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat; #endif #include #include #include #include #include #include }`,dw=`#define TOON varying vec3 vViewPosition; #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vViewPosition = - mvPosition.xyz; #include #include #include }`,pw=`#define TOON uniform vec3 diffuse; uniform vec3 emissive; uniform float opacity; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include vec4 diffuseColor = vec4( diffuse, opacity ); ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); vec3 totalEmissiveRadiance = emissive; #include #include #include #include #include #include #include #include #include #include #include #include #include vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; #include #include #include #include #include #include }`,fw=`uniform float size; uniform float scale; #include #include #include #include #include #include void main() { #include #include #include #include #include gl_PointSize = size; #ifdef USE_SIZEATTENUATION bool isPerspective = isPerspectiveMatrix( projectionMatrix ); if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); #endif #include #include #include #include }`,mw=`uniform vec3 diffuse; uniform float opacity; #include #include #include #include #include #include #include void main() { #include vec3 outgoingLight = vec3( 0.0 ); vec4 diffuseColor = vec4( diffuse, opacity ); #include #include #include #include outgoingLight = diffuseColor.rgb; #include #include #include #include #include }`,gw=`#include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include }`,_w=`uniform vec3 color; uniform float opacity; #include #include #include #include #include #include #include void main() { gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); #include #include #include }`,yw=`uniform float rotation; uniform vec2 center; #include #include #include #include #include void main() { #include vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 ); vec2 scale; scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) ); scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) ); #ifndef USE_SIZEATTENUATION bool isPerspective = isPerspectiveMatrix( projectionMatrix ); if ( isPerspective ) scale *= - mvPosition.z; #endif vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale; vec2 rotatedPosition; rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; mvPosition.xy += rotatedPosition; gl_Position = projectionMatrix * mvPosition; #include #include #include }`,vw=`uniform vec3 diffuse; uniform float opacity; #include #include #include #include #include #include #include #include void main() { #include vec3 outgoingLight = vec3( 0.0 ); vec4 diffuseColor = vec4( diffuse, opacity ); #include #include #include #include outgoingLight = diffuseColor.rgb; #include #include #include #include }`,ke={alphamap_fragment:Wb,alphamap_pars_fragment:jb,alphatest_fragment:qb,alphatest_pars_fragment:Xb,aomap_fragment:Yb,aomap_pars_fragment:Jb,begin_vertex:Zb,beginnormal_vertex:Kb,bsdfs:Qb,iridescence_fragment:eM,bumpmap_pars_fragment:tM,clipping_planes_fragment:nM,clipping_planes_pars_fragment:iM,clipping_planes_pars_vertex:sM,clipping_planes_vertex:rM,color_fragment:oM,color_pars_fragment:aM,color_pars_vertex:lM,color_vertex:cM,common:hM,cube_uv_reflection_fragment:uM,defaultnormal_vertex:dM,displacementmap_pars_vertex:pM,displacementmap_vertex:fM,emissivemap_fragment:mM,emissivemap_pars_fragment:gM,encodings_fragment:_M,encodings_pars_fragment:yM,envmap_fragment:vM,envmap_common_pars_fragment:xM,envmap_pars_fragment:bM,envmap_pars_vertex:MM,envmap_physical_pars_fragment:DM,envmap_vertex:SM,fog_vertex:wM,fog_pars_vertex:CM,fog_fragment:AM,fog_pars_fragment:TM,gradientmap_pars_fragment:EM,lightmap_fragment:LM,lightmap_pars_fragment:RM,lights_lambert_vertex:PM,lights_pars_begin:IM,lights_toon_fragment:FM,lights_toon_pars_fragment:OM,lights_phong_fragment:NM,lights_phong_pars_fragment:kM,lights_physical_fragment:BM,lights_physical_pars_fragment:$M,lights_fragment_begin:UM,lights_fragment_maps:zM,lights_fragment_end:GM,logdepthbuf_fragment:VM,logdepthbuf_pars_fragment:HM,logdepthbuf_pars_vertex:WM,logdepthbuf_vertex:jM,map_fragment:qM,map_pars_fragment:XM,map_particle_fragment:YM,map_particle_pars_fragment:JM,metalnessmap_fragment:ZM,metalnessmap_pars_fragment:KM,morphcolor_vertex:QM,morphnormal_vertex:eS,morphtarget_pars_vertex:tS,morphtarget_vertex:nS,normal_fragment_begin:iS,normal_fragment_maps:sS,normal_pars_fragment:rS,normal_pars_vertex:oS,normal_vertex:aS,normalmap_pars_fragment:lS,clearcoat_normal_fragment_begin:cS,clearcoat_normal_fragment_maps:hS,clearcoat_pars_fragment:uS,iridescence_pars_fragment:dS,output_fragment:pS,packing:fS,premultiplied_alpha_fragment:mS,project_vertex:gS,dithering_fragment:_S,dithering_pars_fragment:yS,roughnessmap_fragment:vS,roughnessmap_pars_fragment:xS,shadowmap_pars_fragment:bS,shadowmap_pars_vertex:MS,shadowmap_vertex:SS,shadowmask_pars_fragment:wS,skinbase_vertex:CS,skinning_pars_vertex:AS,skinning_vertex:TS,skinnormal_vertex:ES,specularmap_fragment:LS,specularmap_pars_fragment:RS,tonemapping_fragment:PS,tonemapping_pars_fragment:IS,transmission_fragment:DS,transmission_pars_fragment:FS,uv_pars_fragment:OS,uv_pars_vertex:NS,uv_vertex:kS,uv2_pars_fragment:BS,uv2_pars_vertex:$S,uv2_vertex:US,worldpos_vertex:zS,background_vert:GS,background_frag:VS,cube_vert:HS,cube_frag:WS,depth_vert:jS,depth_frag:qS,distanceRGBA_vert:XS,distanceRGBA_frag:YS,equirect_vert:JS,equirect_frag:ZS,linedashed_vert:KS,linedashed_frag:QS,meshbasic_vert:ew,meshbasic_frag:tw,meshlambert_vert:nw,meshlambert_frag:iw,meshmatcap_vert:sw,meshmatcap_frag:rw,meshnormal_vert:ow,meshnormal_frag:aw,meshphong_vert:lw,meshphong_frag:cw,meshphysical_vert:hw,meshphysical_frag:uw,meshtoon_vert:dw,meshtoon_frag:pw,points_vert:fw,points_frag:mw,shadow_vert:gw,shadow_frag:_w,sprite_vert:yw,sprite_frag:vw},ne={common:{diffuse:{value:new ge(16777215)},opacity:{value:1},map:{value:null},uvTransform:{value:new Vt},uv2Transform:{value:new Vt},alphaMap:{value:null},alphaTest:{value:0}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new te(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new ge(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new ge(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new Vt}},sprite:{diffuse:{value:new ge(16777215)},opacity:{value:1},center:{value:new te(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new Vt}}},dn={basic:{uniforms:bt([ne.common,ne.specularmap,ne.envmap,ne.aomap,ne.lightmap,ne.fog]),vertexShader:ke.meshbasic_vert,fragmentShader:ke.meshbasic_frag},lambert:{uniforms:bt([ne.common,ne.specularmap,ne.envmap,ne.aomap,ne.lightmap,ne.emissivemap,ne.fog,ne.lights,{emissive:{value:new ge(0)}}]),vertexShader:ke.meshlambert_vert,fragmentShader:ke.meshlambert_frag},phong:{uniforms:bt([ne.common,ne.specularmap,ne.envmap,ne.aomap,ne.lightmap,ne.emissivemap,ne.bumpmap,ne.normalmap,ne.displacementmap,ne.fog,ne.lights,{emissive:{value:new ge(0)},specular:{value:new ge(1118481)},shininess:{value:30}}]),vertexShader:ke.meshphong_vert,fragmentShader:ke.meshphong_frag},standard:{uniforms:bt([ne.common,ne.envmap,ne.aomap,ne.lightmap,ne.emissivemap,ne.bumpmap,ne.normalmap,ne.displacementmap,ne.roughnessmap,ne.metalnessmap,ne.fog,ne.lights,{emissive:{value:new ge(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:ke.meshphysical_vert,fragmentShader:ke.meshphysical_frag},toon:{uniforms:bt([ne.common,ne.aomap,ne.lightmap,ne.emissivemap,ne.bumpmap,ne.normalmap,ne.displacementmap,ne.gradientmap,ne.fog,ne.lights,{emissive:{value:new ge(0)}}]),vertexShader:ke.meshtoon_vert,fragmentShader:ke.meshtoon_frag},matcap:{uniforms:bt([ne.common,ne.bumpmap,ne.normalmap,ne.displacementmap,ne.fog,{matcap:{value:null}}]),vertexShader:ke.meshmatcap_vert,fragmentShader:ke.meshmatcap_frag},points:{uniforms:bt([ne.points,ne.fog]),vertexShader:ke.points_vert,fragmentShader:ke.points_frag},dashed:{uniforms:bt([ne.common,ne.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:ke.linedashed_vert,fragmentShader:ke.linedashed_frag},depth:{uniforms:bt([ne.common,ne.displacementmap]),vertexShader:ke.depth_vert,fragmentShader:ke.depth_frag},normal:{uniforms:bt([ne.common,ne.bumpmap,ne.normalmap,ne.displacementmap,{opacity:{value:1}}]),vertexShader:ke.meshnormal_vert,fragmentShader:ke.meshnormal_frag},sprite:{uniforms:bt([ne.sprite,ne.fog]),vertexShader:ke.sprite_vert,fragmentShader:ke.sprite_frag},background:{uniforms:{uvTransform:{value:new Vt},t2D:{value:null}},vertexShader:ke.background_vert,fragmentShader:ke.background_frag},cube:{uniforms:bt([ne.envmap,{opacity:{value:1}}]),vertexShader:ke.cube_vert,fragmentShader:ke.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:ke.equirect_vert,fragmentShader:ke.equirect_frag},distanceRGBA:{uniforms:bt([ne.common,ne.displacementmap,{referencePosition:{value:new E},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:ke.distanceRGBA_vert,fragmentShader:ke.distanceRGBA_frag},shadow:{uniforms:bt([ne.lights,ne.fog,{color:{value:new ge(0)},opacity:{value:1}}]),vertexShader:ke.shadow_vert,fragmentShader:ke.shadow_frag}};dn.physical={uniforms:bt([dn.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new te(1,1)},clearcoatNormalMap:{value:null},iridescence:{value:0},iridescenceMap:{value:null},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},sheen:{value:0},sheenColor:{value:new ge(0)},sheenColorMap:{value:null},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},transmission:{value:0},transmissionMap:{value:null},transmissionSamplerSize:{value:new te},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:0},attenuationColor:{value:new ge(0)},specularIntensity:{value:1},specularIntensityMap:{value:null},specularColor:{value:new ge(1,1,1)},specularColorMap:{value:null}}]),vertexShader:ke.meshphysical_vert,fragmentShader:ke.meshphysical_frag};function xw(n,e,t,i,s,r){const o=new ge(0);let a=s===!0?0:1,l,c,u=null,h=0,d=null;function p(m,f){let _=!1,v=f.isScene===!0?f.background:null;v&&v.isTexture&&(v=e.get(v));const b=n.xr,x=b.getSession&&b.getSession();x&&x.environmentBlendMode==="additive"&&(v=null),v===null?g(o,a):v&&v.isColor&&(g(v,1),_=!0),(n.autoClear||_)&&n.clear(n.autoClearColor,n.autoClearDepth,n.autoClearStencil),v&&(v.isCubeTexture||v.mapping===Fr)?(c===void 0&&(c=new ft(new Xs(1,1,1),new un({name:"BackgroundCubeMaterial",uniforms:ss(dn.cube.uniforms),vertexShader:dn.cube.vertexShader,fragmentShader:dn.cube.fragmentShader,side:Yt,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(w,C,L){this.matrixWorld.copyPosition(L.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(c)),c.material.uniforms.envMap.value=v,c.material.uniforms.flipEnvMap.value=v.isCubeTexture&&v.isRenderTargetTexture===!1?-1:1,(u!==v||h!==v.version||d!==n.toneMapping)&&(c.material.needsUpdate=!0,u=v,h=v.version,d=n.toneMapping),c.layers.enableAll(),m.unshift(c,c.geometry,c.material,0,0,null)):v&&v.isTexture&&(l===void 0&&(l=new ft(new Ys(2,2),new un({name:"BackgroundMaterial",uniforms:ss(dn.background.uniforms),vertexShader:dn.background.vertexShader,fragmentShader:dn.background.fragmentShader,side:ki,depthTest:!1,depthWrite:!1,fog:!1})),l.geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(l)),l.material.uniforms.t2D.value=v,v.matrixAutoUpdate===!0&&v.updateMatrix(),l.material.uniforms.uvTransform.value.copy(v.matrix),(u!==v||h!==v.version||d!==n.toneMapping)&&(l.material.needsUpdate=!0,u=v,h=v.version,d=n.toneMapping),l.layers.enableAll(),m.unshift(l,l.geometry,l.material,0,0,null))}function g(m,f){t.buffers.color.setClear(m.r,m.g,m.b,f,r)}return{getClearColor:function(){return o},setClearColor:function(m,f=1){o.set(m),a=f,g(o,a)},getClearAlpha:function(){return a},setClearAlpha:function(m){a=m,g(o,a)},render:p}}function bw(n,e,t,i){const s=n.getParameter(34921),r=i.isWebGL2?null:e.get("OES_vertex_array_object"),o=i.isWebGL2||r!==null,a={},l=f(null);let c=l,u=!1;function h(D,z,k,W,H){let N=!1;if(o){const G=m(W,k,z);c!==G&&(c=G,p(c.object)),N=_(D,W,k,H),N&&v(D,W,k,H)}else{const G=z.wireframe===!0;(c.geometry!==W.id||c.program!==k.id||c.wireframe!==G)&&(c.geometry=W.id,c.program=k.id,c.wireframe=G,N=!0)}H!==null&&t.update(H,34963),(N||u)&&(u=!1,y(D,z,k,W),H!==null&&n.bindBuffer(34963,t.get(H).buffer))}function d(){return i.isWebGL2?n.createVertexArray():r.createVertexArrayOES()}function p(D){return i.isWebGL2?n.bindVertexArray(D):r.bindVertexArrayOES(D)}function g(D){return i.isWebGL2?n.deleteVertexArray(D):r.deleteVertexArrayOES(D)}function m(D,z,k){const W=k.wireframe===!0;let H=a[D.id];H===void 0&&(H={},a[D.id]=H);let N=H[z.id];N===void 0&&(N={},H[z.id]=N);let G=N[W];return G===void 0&&(G=f(d()),N[W]=G),G}function f(D){const z=[],k=[],W=[];for(let H=0;H=0){const ve=H[J];let Ee=N[J];if(Ee===void 0&&(J==="instanceMatrix"&&D.instanceMatrix&&(Ee=D.instanceMatrix),J==="instanceColor"&&D.instanceColor&&(Ee=D.instanceColor)),ve===void 0||ve.attribute!==Ee||Ee&&ve.data!==Ee.data)return!0;G++}return c.attributesNum!==G||c.index!==W}function v(D,z,k,W){const H={},N=z.attributes;let G=0;const ee=k.getAttributes();for(const J in ee)if(ee[J].location>=0){let ve=N[J];ve===void 0&&(J==="instanceMatrix"&&D.instanceMatrix&&(ve=D.instanceMatrix),J==="instanceColor"&&D.instanceColor&&(ve=D.instanceColor));const Ee={};Ee.attribute=ve,ve&&ve.data&&(Ee.data=ve.data),H[J]=Ee,G++}c.attributes=H,c.attributesNum=G,c.index=W}function b(){const D=c.newAttributes;for(let z=0,k=D.length;z=0){let re=H[ee];if(re===void 0&&(ee==="instanceMatrix"&&D.instanceMatrix&&(re=D.instanceMatrix),ee==="instanceColor"&&D.instanceColor&&(re=D.instanceColor)),re!==void 0){const ve=re.normalized,Ee=re.itemSize,q=t.get(re);if(q===void 0)continue;const Oe=q.buffer,Ce=q.type,Le=q.bytesPerElement;if(re.isInterleavedBufferAttribute){const he=re.data,$e=he.stride,X=re.offset;if(he.isInstancedInterleavedBuffer){for(let j=0;j0&&n.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";L="mediump"}return L==="mediump"&&n.getShaderPrecisionFormat(35633,36337).precision>0&&n.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}const o=typeof WebGL2RenderingContext!="undefined"&&n instanceof WebGL2RenderingContext||typeof WebGL2ComputeRenderingContext!="undefined"&&n instanceof WebGL2ComputeRenderingContext;let a=t.precision!==void 0?t.precision:"highp";const l=r(a);l!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",l,"instead."),a=l);const c=o||e.has("WEBGL_draw_buffers"),u=t.logarithmicDepthBuffer===!0,h=n.getParameter(34930),d=n.getParameter(35660),p=n.getParameter(3379),g=n.getParameter(34076),m=n.getParameter(34921),f=n.getParameter(36347),_=n.getParameter(36348),v=n.getParameter(36349),b=d>0,x=o||e.has("OES_texture_float"),w=b&&x,C=o?n.getParameter(36183):0;return{isWebGL2:o,drawBuffers:c,getMaxAnisotropy:s,getMaxPrecision:r,precision:a,logarithmicDepthBuffer:u,maxTextures:h,maxVertexTextures:d,maxTextureSize:p,maxCubemapSize:g,maxAttributes:m,maxVertexUniforms:f,maxVaryings:_,maxFragmentUniforms:v,vertexTextures:b,floatFragmentTextures:x,floatVertexTextures:w,maxSamples:C}}function ww(n){const e=this;let t=null,i=0,s=!1,r=!1;const o=new _i,a=new Vt,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(h,d,p){const g=h.length!==0||d||i!==0||s;return s=d,t=u(h,p,0),i=h.length,g},this.beginShadows=function(){r=!0,u(null)},this.endShadows=function(){r=!1,c()},this.setState=function(h,d,p){const g=h.clippingPlanes,m=h.clipIntersection,f=h.clipShadows,_=n.get(h);if(!s||g===null||g.length===0||r&&!f)r?u(null):c();else{const v=r?0:i,b=v*4;let x=_.clippingState||null;l.value=x,x=u(g,d,b,p);for(let w=0;w!==b;++w)x[w]=t[w];_.clippingState=x,this.numIntersection=m?this.numPlanes:0,this.numPlanes+=v}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function u(h,d,p,g){const m=h!==null?h.length:0;let f=null;if(m!==0){if(f=l.value,g!==!0||f===null){const _=p+m*4,v=d.matrixWorldInverse;a.getNormalMatrix(v),(f===null||f.length<_)&&(f=new Float32Array(_));for(let b=0,x=p;b!==m;++b,x+=4)o.copy(h[b]).applyMatrix4(v,a),o.normal.toArray(f,x),f[x+3]=o.constant}l.value=f,l.needsUpdate=!0}return e.numPlanes=m,e.numIntersection=0,f}}function Cw(n){let e=new WeakMap;function t(o,a){return a===ba?o.mapping=Ui:a===Ma&&(o.mapping=zi),o}function i(o){if(o&&o.isTexture&&o.isRenderTargetTexture===!1){const a=o.mapping;if(a===ba||a===Ma)if(e.has(o)){const l=e.get(o).texture;return t(l,o.mapping)}else{const l=o.image;if(l&&l.height>0){const c=new zb(l.height/2);return c.fromEquirectangularTexture(n,o),e.set(o,c),o.addEventListener("dispose",s),t(c.texture,o.mapping)}else return null}}return o}function s(o){const a=o.target;a.removeEventListener("dispose",s);const l=e.get(a);l!==void 0&&(e.delete(a),l.dispose())}function r(){e=new WeakMap}return{get:i,dispose:r}}class ls extends fp{constructor(e=-1,t=1,i=1,s=-1,r=.1,o=2e3){super();this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=i,this.bottom=s,this.near=r,this.far=o,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,i,s,r,o){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=s,this.view.width=r,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,s=(this.top+this.bottom)/2;let r=i-e,o=i+e,a=s+t,l=s-t;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=c*this.view.offsetX,o=r+c*this.view.width,a-=u*this.view.offsetY,l=a-u*this.view.height}this.projectionMatrix.makeOrthographic(r,o,a,l,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}const cs=4,gp=[.125,.215,.35,.446,.526,.582],yi=20,ol=new ls,_p=new ge;let al=null;const vi=(1+Math.sqrt(5))/2,hs=1/vi,yp=[new E(1,1,1),new E(-1,1,1),new E(1,1,-1),new E(-1,1,-1),new E(0,vi,hs),new E(0,vi,-hs),new E(hs,0,vi),new E(-hs,0,vi),new E(vi,hs,0),new E(-vi,hs,0)];class ll{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,i=.1,s=100){al=this._renderer.getRenderTarget(),this._setSize(256);const r=this._allocateTargets();return r.depthBuffer=!0,this._sceneToCubeUV(e,i,s,r),t>0&&this._blur(r,0,0,t),this._applyPMREM(r),this._cleanup(r),r}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=bp(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=xp(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e2?b:0,b,b),u.setRenderTarget(s),m&&u.render(g,a),u.render(e,a)}g.geometry.dispose(),g.material.dispose(),u.toneMapping=d,u.autoClear=h,e.background=f}_textureToCubeUV(e,t){const i=this._renderer,s=e.mapping===Ui||e.mapping===zi;s?(this._cubemapMaterial===null&&(this._cubemapMaterial=bp()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=xp());const r=s?this._cubemapMaterial:this._equirectMaterial,o=new ft(this._lodPlanes[0],r),a=r.uniforms;a.envMap.value=e;const l=this._cubeSize;oo(t,0,0,3*l,2*l),i.setRenderTarget(t),i.render(o,ol)}_applyPMREM(e){const t=this._renderer,i=t.autoClear;t.autoClear=!1;for(let s=1;syi&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${f} samples when the maximum is set to ${yi}`);const _=[];let v=0;for(let L=0;Lb-cs?s-b+cs:0),C=4*(this._cubeSize-x);oo(t,w,C,3*x,2*x),l.setRenderTarget(t),l.render(h,ol)}}function Aw(n){const e=[],t=[],i=[];let s=n;const r=n-cs+1+gp.length;for(let o=0;on-cs?l=gp[o-n+cs-1]:o===0&&(l=0),i.push(l);const c=1/(a-2),u=-c,h=1+c,d=[u,u,h,u,h,h,u,u,h,h,u,h],p=6,g=6,m=3,f=2,_=1,v=new Float32Array(m*g*p),b=new Float32Array(f*g*p),x=new Float32Array(_*g*p);for(let C=0;C2?0:-1,A=[L,y,0,L+2/3,y,0,L+2/3,y+1,0,L,y,0,L+2/3,y+1,0,L,y+1,0];v.set(A,m*g*C),b.set(d,f*g*C);const I=[C,C,C,C,C,C];x.set(I,_*g*C)}const w=new xt;w.setAttribute("position",new dt(v,m)),w.setAttribute("uv",new dt(b,f)),w.setAttribute("faceIndex",new dt(x,_)),e.push(w),s>cs&&s--}return{lodPlanes:e,sizeLods:t,sigmas:i}}function vp(n,e,t){const i=new Un(n,e,t);return i.texture.mapping=Fr,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function oo(n,e,t,i,s){n.viewport.set(e,t,i,s),n.scissor.set(e,t,i,s)}function Tw(n,e,t){const i=new Float32Array(yi),s=new E(0,1,0);return new un({name:"SphericalGaussianBlur",defines:{n:yi,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${n}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:s}},vertexShader:cl(),fragmentShader:` precision mediump float; precision mediump int; varying vec3 vOutputDirection; uniform sampler2D envMap; uniform int samples; uniform float weights[ n ]; uniform bool latitudinal; uniform float dTheta; uniform float mipInt; uniform vec3 poleAxis; #define ENVMAP_TYPE_CUBE_UV #include vec3 getSample( float theta, vec3 axis ) { float cosTheta = cos( theta ); // Rodrigues' axis-angle rotation vec3 sampleDirection = vOutputDirection * cosTheta + cross( axis, vOutputDirection ) * sin( theta ) + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); return bilinearCubeUV( envMap, sampleDirection, mipInt ); } void main() { vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); if ( all( equal( axis, vec3( 0.0 ) ) ) ) { axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); } axis = normalize( axis ); gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); for ( int i = 1; i < n; i++ ) { if ( i >= samples ) { break; } float theta = dTheta * float( i ); gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); } } `,blending:$n,depthTest:!1,depthWrite:!1})}function xp(){return new un({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:cl(),fragmentShader:` precision mediump float; precision mediump int; varying vec3 vOutputDirection; uniform sampler2D envMap; #include void main() { vec3 outputDirection = normalize( vOutputDirection ); vec2 uv = equirectUv( outputDirection ); gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); } `,blending:$n,depthTest:!1,depthWrite:!1})}function bp(){return new un({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:cl(),fragmentShader:` precision mediump float; precision mediump int; uniform float flipEnvMap; varying vec3 vOutputDirection; uniform samplerCube envMap; void main() { gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); } `,blending:$n,depthTest:!1,depthWrite:!1})}function cl(){return` precision mediump float; precision mediump int; attribute float faceIndex; varying vec3 vOutputDirection; // RH coordinate system; PMREM face-indexing convention vec3 getDirection( vec2 uv, float face ) { uv = 2.0 * uv - 1.0; vec3 direction = vec3( uv, 1.0 ); if ( face == 0.0 ) { direction = direction.zyx; // ( 1, v, u ) pos x } else if ( face == 1.0 ) { direction = direction.xzy; direction.xz *= -1.0; // ( -u, 1, -v ) pos y } else if ( face == 2.0 ) { direction.x *= -1.0; // ( -u, v, 1 ) pos z } else if ( face == 3.0 ) { direction = direction.zyx; direction.xz *= -1.0; // ( -1, v, -u ) neg x } else if ( face == 4.0 ) { direction = direction.xzy; direction.xy *= -1.0; // ( -u, -1, v ) neg y } else if ( face == 5.0 ) { direction.z *= -1.0; // ( u, v, -1 ) neg z } return direction; } void main() { vOutputDirection = getDirection( uv, faceIndex ); gl_Position = vec4( position, 1.0 ); } `}function Ew(n){let e=new WeakMap,t=null;function i(a){if(a&&a.isTexture){const l=a.mapping,c=l===ba||l===Ma,u=l===Ui||l===zi;if(c||u)if(a.isRenderTargetTexture&&a.needsPMREMUpdate===!0){a.needsPMREMUpdate=!1;let h=e.get(a);return t===null&&(t=new ll(n)),h=c?t.fromEquirectangular(a,h):t.fromCubemap(a,h),e.set(a,h),h.texture}else{if(e.has(a))return e.get(a).texture;{const h=a.image;if(c&&h&&h.height>0||u&&h&&s(h)){t===null&&(t=new ll(n));const d=c?t.fromEquirectangular(a):t.fromCubemap(a);return e.set(a,d),a.addEventListener("dispose",r),d.texture}else return null}}}return a}function s(a){let l=0;const c=6;for(let u=0;ue.maxTextureSize&&(R=Math.ceil(I/e.maxTextureSize),I=e.maxTextureSize);const Z=new Float32Array(I*R*4*m),K=new ep(Z,I,R,m);K.type=zt,K.needsUpdate=!0;const D=A*4;for(let k=0;k0)return n;const s=e*t;let r=Ap[s];if(r===void 0&&(r=new Float32Array(s),Ap[s]=r),e!==0){i.toArray(r,0);for(let o=1,a=0;o!==e;++o)a+=t,n[o].toArray(r,a)}return r}function wt(n,e){if(n.length!==e.length)return!1;for(let t=0,i=n.length;t":" "} ${a}: ${t[o]}`)}return i.join(` `)}function LC(n){switch(n){case hn:return["Linear","( value )"];case We:return["sRGB","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported encoding:",n),["Linear","( value )"]}}function Dp(n,e,t){const i=n.getShaderParameter(e,35713),s=n.getShaderInfoLog(e).trim();if(i&&s==="")return"";const r=/ERROR: 0:(\d+)/.exec(s);if(r){const o=parseInt(r[1]);return t.toUpperCase()+` `+s+` `+EC(n.getShaderSource(e),o)}else return s}function RC(n,e){const t=LC(e);return"vec4 "+n+"( vec4 value ) { return LinearTo"+t[0]+t[1]+"; }"}function PC(n,e){let t;switch(e){case Ox:t="Linear";break;case Nx:t="Reinhard";break;case kx:t="OptimizedCineon";break;case Bx:t="ACESFilmic";break;case $x:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+n+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}function IC(n){return[n.extensionDerivatives||!!n.envMapCubeUVHeight||n.bumpMap||n.tangentSpaceNormalMap||n.clearcoatNormalMap||n.flatShading||n.shaderID==="physical"?"#extension GL_OES_standard_derivatives : enable":"",(n.extensionFragDepth||n.logarithmicDepthBuffer)&&n.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",n.extensionDrawBuffers&&n.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(n.extensionShaderTextureLOD||n.envMap||n.transmission)&&n.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(Js).join(` `)}function DC(n){const e=[];for(const t in n){const i=n[t];i!==!1&&e.push("#define "+t+" "+i)}return e.join(` `)}function FC(n,e){const t={},i=n.getProgramParameter(e,35721);for(let s=0;s/gm;function dl(n){return n.replace(OC,NC)}function NC(n,e){const t=ke[e];if(t===void 0)throw new Error("Can not resolve #include <"+e+">");return dl(t)}const kC=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,BC=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function Np(n){return n.replace(BC,kp).replace(kC,$C)}function $C(n,e,t,i){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),kp(n,e,t,i)}function kp(n,e,t,i){let s="";for(let r=parseInt(e);r0&&(f+=` `),_=[p,g].filter(Js).join(` `),_.length>0&&(_+=` `)):(f=[Bp(t),"#define SHADER_NAME "+t.shaderName,g,t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.supportsVertexTextures?"#define VERTEX_TEXTURES":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+u:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMap&&t.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",t.normalMap&&t.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.displacementMap&&t.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",t.specularColorMap?"#define USE_SPECULARCOLORMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEENCOLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",t.vertexTangents?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUvs?"#define USE_UV":"",t.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors&&t.isWebGL2?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )"," attribute vec3 morphTarget0;"," attribute vec3 morphTarget1;"," attribute vec3 morphTarget2;"," attribute vec3 morphTarget3;"," #ifdef USE_MORPHNORMALS"," attribute vec3 morphNormal0;"," attribute vec3 morphNormal1;"," attribute vec3 morphNormal2;"," attribute vec3 morphNormal3;"," #else"," attribute vec3 morphTarget4;"," attribute vec3 morphTarget5;"," attribute vec3 morphTarget6;"," attribute vec3 morphTarget7;"," #endif","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",` `].filter(Js).join(` `),_=[p,Bp(t),"#define SHADER_NAME "+t.shaderName,g,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+c:"",t.envMap?"#define "+u:"",t.envMap?"#define "+h:"",d?"#define CUBEUV_TEXEL_WIDTH "+d.texelWidth:"",d?"#define CUBEUV_TEXEL_HEIGHT "+d.texelHeight:"",d?"#define CUBEUV_MAX_MIP "+d.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMap&&t.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",t.normalMap&&t.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",t.specularColorMap?"#define USE_SPECULARCOLORMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEENCOLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.vertexTangents?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUvs?"#define USE_UV":"",t.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==yn?"#define TONE_MAPPING":"",t.toneMapping!==yn?ke.tonemapping_pars_fragment:"",t.toneMapping!==yn?PC("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",ke.encodings_pars_fragment,RC("linearToOutputTexel",t.outputEncoding),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` `].filter(Js).join(` `)),o=dl(o),o=Fp(o,t),o=Op(o,t),a=dl(a),a=Fp(a,t),a=Op(a,t),o=Np(o),a=Np(a),t.isWebGL2&&t.isRawShaderMaterial!==!0&&(v=`#version 300 es `,f=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join(` `)+` `+f,_=["#define varying in",t.glslVersion===qd?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===qd?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(` `)+` `+_);const b=v+f+o,x=v+_+a,w=Ip(s,35633,b),C=Ip(s,35632,x);if(s.attachShader(m,w),s.attachShader(m,C),t.index0AttributeName!==void 0?s.bindAttribLocation(m,0,t.index0AttributeName):t.morphTargets===!0&&s.bindAttribLocation(m,0,"position"),s.linkProgram(m),n.debug.checkShaderErrors){const A=s.getProgramInfoLog(m).trim(),I=s.getShaderInfoLog(w).trim(),R=s.getShaderInfoLog(C).trim();let Z=!0,K=!0;if(s.getProgramParameter(m,35714)===!1){Z=!1;const D=Dp(s,w,"vertex"),z=Dp(s,C,"fragment");console.error("THREE.WebGLProgram: Shader Error "+s.getError()+" - VALIDATE_STATUS "+s.getProgramParameter(m,35715)+` Program Info Log: `+A+` `+D+` `+z)}else A!==""?console.warn("THREE.WebGLProgram: Program Info Log:",A):(I===""||R==="")&&(K=!1);K&&(this.diagnostics={runnable:Z,programLog:A,vertexShader:{log:I,prefix:f},fragmentShader:{log:R,prefix:_}})}s.deleteShader(w),s.deleteShader(C);let L;this.getUniforms=function(){return L===void 0&&(L=new lo(s,m)),L};let y;return this.getAttributes=function(){return y===void 0&&(y=FC(s,m)),y},this.destroy=function(){i.releaseStatesOfProgram(this),s.deleteProgram(m),this.program=void 0},this.name=t.shaderName,this.id=TC++,this.cacheKey=e,this.usedTimes=1,this.program=m,this.vertexShader=w,this.fragmentShader=C,this}let jC=0;class qC{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,i=e.fragmentShader,s=this._getShaderStage(t),r=this._getShaderStage(i),o=this._getShaderCacheForMaterial(e);return o.has(s)===!1&&(o.add(s),s.usedTimes++),o.has(r)===!1&&(o.add(r),r.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const i of t)i.usedTimes--,i.usedTimes===0&&this.shaderCache.delete(i.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;return t.has(e)===!1&&t.set(e,new Set),t.get(e)}_getShaderStage(e){const t=this.shaderCache;if(t.has(e)===!1){const i=new XC(e);t.set(e,i)}return t.get(e)}}class XC{constructor(e){this.id=jC++,this.code=e,this.usedTimes=0}}function YC(n,e,t,i,s,r,o){const a=new ja,l=new qC,c=[],u=s.isWebGL2,h=s.logarithmicDepthBuffer,d=s.vertexTextures;let p=s.precision;const g={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function m(y,A,I,R,Z){const K=R.fog,D=Z.geometry,z=y.isMeshStandardMaterial?R.environment:null,k=(y.isMeshStandardMaterial?t:e).get(y.envMap||z),W=!!k&&k.mapping===Fr?k.image.height:null,H=g[y.type];y.precision!==null&&(p=s.getMaxPrecision(y.precision),p!==y.precision&&console.warn("THREE.WebGLProgram.getParameters:",y.precision,"not supported, using",p,"instead."));const N=D.morphAttributes.position||D.morphAttributes.normal||D.morphAttributes.color,G=N!==void 0?N.length:0;let ee=0;D.morphAttributes.position!==void 0&&(ee=1),D.morphAttributes.normal!==void 0&&(ee=2),D.morphAttributes.color!==void 0&&(ee=3);let J,re,ve,Ee;if(H){const $e=dn[H];J=$e.vertexShader,re=$e.fragmentShader}else J=y.vertexShader,re=y.fragmentShader,l.update(y),ve=l.getVertexShaderID(y),Ee=l.getFragmentShaderID(y);const q=n.getRenderTarget(),Oe=y.alphaTest>0,Ce=y.clearcoat>0,Le=y.iridescence>0;return{isWebGL2:u,shaderID:H,shaderName:y.type,vertexShader:J,fragmentShader:re,defines:y.defines,customVertexShaderID:ve,customFragmentShaderID:Ee,isRawShaderMaterial:y.isRawShaderMaterial===!0,glslVersion:y.glslVersion,precision:p,instancing:Z.isInstancedMesh===!0,instancingColor:Z.isInstancedMesh===!0&&Z.instanceColor!==null,supportsVertexTextures:d,outputEncoding:q===null?n.outputEncoding:q.isXRRenderTarget===!0?q.texture.encoding:hn,map:!!y.map,matcap:!!y.matcap,envMap:!!k,envMapMode:k&&k.mapping,envMapCubeUVHeight:W,lightMap:!!y.lightMap,aoMap:!!y.aoMap,emissiveMap:!!y.emissiveMap,bumpMap:!!y.bumpMap,normalMap:!!y.normalMap,objectSpaceNormalMap:y.normalMapType===lb,tangentSpaceNormalMap:y.normalMapType===kr,decodeVideoTexture:!!y.map&&y.map.isVideoTexture===!0&&y.map.encoding===We,clearcoat:Ce,clearcoatMap:Ce&&!!y.clearcoatMap,clearcoatRoughnessMap:Ce&&!!y.clearcoatRoughnessMap,clearcoatNormalMap:Ce&&!!y.clearcoatNormalMap,iridescence:Le,iridescenceMap:Le&&!!y.iridescenceMap,iridescenceThicknessMap:Le&&!!y.iridescenceThicknessMap,displacementMap:!!y.displacementMap,roughnessMap:!!y.roughnessMap,metalnessMap:!!y.metalnessMap,specularMap:!!y.specularMap,specularIntensityMap:!!y.specularIntensityMap,specularColorMap:!!y.specularColorMap,opaque:y.transparent===!1&&y.blending===Bi,alphaMap:!!y.alphaMap,alphaTest:Oe,gradientMap:!!y.gradientMap,sheen:y.sheen>0,sheenColorMap:!!y.sheenColorMap,sheenRoughnessMap:!!y.sheenRoughnessMap,transmission:y.transmission>0,transmissionMap:!!y.transmissionMap,thicknessMap:!!y.thicknessMap,combine:y.combine,vertexTangents:!!y.normalMap&&!!D.attributes.tangent,vertexColors:y.vertexColors,vertexAlphas:y.vertexColors===!0&&!!D.attributes.color&&D.attributes.color.itemSize===4,vertexUvs:!!y.map||!!y.bumpMap||!!y.normalMap||!!y.specularMap||!!y.alphaMap||!!y.emissiveMap||!!y.roughnessMap||!!y.metalnessMap||!!y.clearcoatMap||!!y.clearcoatRoughnessMap||!!y.clearcoatNormalMap||!!y.iridescenceMap||!!y.iridescenceThicknessMap||!!y.displacementMap||!!y.transmissionMap||!!y.thicknessMap||!!y.specularIntensityMap||!!y.specularColorMap||!!y.sheenColorMap||!!y.sheenRoughnessMap,uvsVertexOnly:!(!!y.map||!!y.bumpMap||!!y.normalMap||!!y.specularMap||!!y.alphaMap||!!y.emissiveMap||!!y.roughnessMap||!!y.metalnessMap||!!y.clearcoatNormalMap||!!y.iridescenceMap||!!y.iridescenceThicknessMap||y.transmission>0||!!y.transmissionMap||!!y.thicknessMap||!!y.specularIntensityMap||!!y.specularColorMap||y.sheen>0||!!y.sheenColorMap||!!y.sheenRoughnessMap)&&!!y.displacementMap,fog:!!K,useFog:y.fog===!0,fogExp2:K&&K.isFogExp2,flatShading:!!y.flatShading,sizeAttenuation:y.sizeAttenuation,logarithmicDepthBuffer:h,skinning:Z.isSkinnedMesh===!0,morphTargets:D.morphAttributes.position!==void 0,morphNormals:D.morphAttributes.normal!==void 0,morphColors:D.morphAttributes.color!==void 0,morphTargetsCount:G,morphTextureStride:ee,numDirLights:A.directional.length,numPointLights:A.point.length,numSpotLights:A.spot.length,numRectAreaLights:A.rectArea.length,numHemiLights:A.hemi.length,numDirLightShadows:A.directionalShadowMap.length,numPointLightShadows:A.pointShadowMap.length,numSpotLightShadows:A.spotShadowMap.length,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:y.dithering,shadowMapEnabled:n.shadowMap.enabled&&I.length>0,shadowMapType:n.shadowMap.type,toneMapping:y.toneMapped?n.toneMapping:yn,physicallyCorrectLights:n.physicallyCorrectLights,premultipliedAlpha:y.premultipliedAlpha,doubleSided:y.side===Jt,flipSided:y.side===Yt,useDepthPacking:!!y.depthPacking,depthPacking:y.depthPacking||0,index0AttributeName:y.index0AttributeName,extensionDerivatives:y.extensions&&y.extensions.derivatives,extensionFragDepth:y.extensions&&y.extensions.fragDepth,extensionDrawBuffers:y.extensions&&y.extensions.drawBuffers,extensionShaderTextureLOD:y.extensions&&y.extensions.shaderTextureLOD,rendererExtensionFragDepth:u||i.has("EXT_frag_depth"),rendererExtensionDrawBuffers:u||i.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:u||i.has("EXT_shader_texture_lod"),customProgramCacheKey:y.customProgramCacheKey()}}function f(y){const A=[];if(y.shaderID?A.push(y.shaderID):(A.push(y.customVertexShaderID),A.push(y.customFragmentShaderID)),y.defines!==void 0)for(const I in y.defines)A.push(I),A.push(y.defines[I]);return y.isRawShaderMaterial===!1&&(_(A,y),v(A,y),A.push(n.outputEncoding)),A.push(y.customProgramCacheKey),A.join()}function _(y,A){y.push(A.precision),y.push(A.outputEncoding),y.push(A.envMapMode),y.push(A.envMapCubeUVHeight),y.push(A.combine),y.push(A.vertexUvs),y.push(A.fogExp2),y.push(A.sizeAttenuation),y.push(A.morphTargetsCount),y.push(A.morphAttributeCount),y.push(A.numDirLights),y.push(A.numPointLights),y.push(A.numSpotLights),y.push(A.numHemiLights),y.push(A.numRectAreaLights),y.push(A.numDirLightShadows),y.push(A.numPointLightShadows),y.push(A.numSpotLightShadows),y.push(A.shadowMapType),y.push(A.toneMapping),y.push(A.numClippingPlanes),y.push(A.numClipIntersection),y.push(A.depthPacking)}function v(y,A){a.disableAll(),A.isWebGL2&&a.enable(0),A.supportsVertexTextures&&a.enable(1),A.instancing&&a.enable(2),A.instancingColor&&a.enable(3),A.map&&a.enable(4),A.matcap&&a.enable(5),A.envMap&&a.enable(6),A.lightMap&&a.enable(7),A.aoMap&&a.enable(8),A.emissiveMap&&a.enable(9),A.bumpMap&&a.enable(10),A.normalMap&&a.enable(11),A.objectSpaceNormalMap&&a.enable(12),A.tangentSpaceNormalMap&&a.enable(13),A.clearcoat&&a.enable(14),A.clearcoatMap&&a.enable(15),A.clearcoatRoughnessMap&&a.enable(16),A.clearcoatNormalMap&&a.enable(17),A.iridescence&&a.enable(18),A.iridescenceMap&&a.enable(19),A.iridescenceThicknessMap&&a.enable(20),A.displacementMap&&a.enable(21),A.specularMap&&a.enable(22),A.roughnessMap&&a.enable(23),A.metalnessMap&&a.enable(24),A.gradientMap&&a.enable(25),A.alphaMap&&a.enable(26),A.alphaTest&&a.enable(27),A.vertexColors&&a.enable(28),A.vertexAlphas&&a.enable(29),A.vertexUvs&&a.enable(30),A.vertexTangents&&a.enable(31),A.uvsVertexOnly&&a.enable(32),A.fog&&a.enable(33),y.push(a.mask),a.disableAll(),A.useFog&&a.enable(0),A.flatShading&&a.enable(1),A.logarithmicDepthBuffer&&a.enable(2),A.skinning&&a.enable(3),A.morphTargets&&a.enable(4),A.morphNormals&&a.enable(5),A.morphColors&&a.enable(6),A.premultipliedAlpha&&a.enable(7),A.shadowMapEnabled&&a.enable(8),A.physicallyCorrectLights&&a.enable(9),A.doubleSided&&a.enable(10),A.flipSided&&a.enable(11),A.useDepthPacking&&a.enable(12),A.dithering&&a.enable(13),A.specularIntensityMap&&a.enable(14),A.specularColorMap&&a.enable(15),A.transmission&&a.enable(16),A.transmissionMap&&a.enable(17),A.thicknessMap&&a.enable(18),A.sheen&&a.enable(19),A.sheenColorMap&&a.enable(20),A.sheenRoughnessMap&&a.enable(21),A.decodeVideoTexture&&a.enable(22),A.opaque&&a.enable(23),y.push(a.mask)}function b(y){const A=g[y.type];let I;if(A){const R=dn[A];I=il.clone(R.uniforms)}else I=y.uniforms;return I}function x(y,A){let I;for(let R=0,Z=c.length;R0?i.push(_):p.transparent===!0?s.push(_):t.push(_)}function l(h,d,p,g,m,f){const _=o(h,d,p,g,m,f);p.transmission>0?i.unshift(_):p.transparent===!0?s.unshift(_):t.unshift(_)}function c(h,d){t.length>1&&t.sort(h||ZC),i.length>1&&i.sort(d||$p),s.length>1&&s.sort(d||$p)}function u(){for(let h=e,d=n.length;h=n.get(i).length?(r=new Up,n.get(i).push(r)):r=n.get(i)[s],r}function t(){n=new WeakMap}return{get:e,dispose:t}}function QC(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new E,color:new ge};break;case"SpotLight":t={position:new E,direction:new E,color:new ge,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new E,color:new ge,distance:0,decay:0};break;case"HemisphereLight":t={direction:new E,skyColor:new ge,groundColor:new ge};break;case"RectAreaLight":t={color:new ge,position:new E,halfWidth:new E,halfHeight:new E};break}return n[e.id]=t,t}}}function e1(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new te};break;case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new te};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new te,shadowCameraNear:1,shadowCameraFar:1e3};break}return n[e.id]=t,t}}}let t1=0;function n1(n,e){return(e.castShadow?1:0)-(n.castShadow?1:0)}function i1(n,e){const t=new QC,i=e1(),s={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadow:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]};for(let u=0;u<9;u++)s.probe.push(new E);const r=new E,o=new Me,a=new Me;function l(u,h){let d=0,p=0,g=0;for(let A=0;A<9;A++)s.probe[A].set(0,0,0);let m=0,f=0,_=0,v=0,b=0,x=0,w=0,C=0;u.sort(n1);const L=h!==!0?Math.PI:1;for(let A=0,I=u.length;A0&&(e.isWebGL2||n.has("OES_texture_float_linear")===!0?(s.rectAreaLTC1=ne.LTC_FLOAT_1,s.rectAreaLTC2=ne.LTC_FLOAT_2):n.has("OES_texture_half_float_linear")===!0?(s.rectAreaLTC1=ne.LTC_HALF_1,s.rectAreaLTC2=ne.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),s.ambient[0]=d,s.ambient[1]=p,s.ambient[2]=g;const y=s.hash;(y.directionalLength!==m||y.pointLength!==f||y.spotLength!==_||y.rectAreaLength!==v||y.hemiLength!==b||y.numDirectionalShadows!==x||y.numPointShadows!==w||y.numSpotShadows!==C)&&(s.directional.length=m,s.spot.length=_,s.rectArea.length=v,s.point.length=f,s.hemi.length=b,s.directionalShadow.length=x,s.directionalShadowMap.length=x,s.pointShadow.length=w,s.pointShadowMap.length=w,s.spotShadow.length=C,s.spotShadowMap.length=C,s.directionalShadowMatrix.length=x,s.pointShadowMatrix.length=w,s.spotShadowMatrix.length=C,y.directionalLength=m,y.pointLength=f,y.spotLength=_,y.rectAreaLength=v,y.hemiLength=b,y.numDirectionalShadows=x,y.numPointShadows=w,y.numSpotShadows=C,s.version=t1++)}function c(u,h){let d=0,p=0,g=0,m=0,f=0;const _=h.matrixWorldInverse;for(let v=0,b=u.length;v=t.get(r).length?(a=new zp(n,e),t.get(r).push(a)):a=t.get(r)[o],a}function s(){t=new WeakMap}return{get:i,dispose:s}}class r1 extends Wt{constructor(e){super();this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=ob,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class o1 extends Wt{constructor(e){super();this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.referencePosition=new E,this.nearDistance=1,this.farDistance=1e3,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.referencePosition.copy(e.referencePosition),this.nearDistance=e.nearDistance,this.farDistance=e.farDistance,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const a1=`void main() { gl_Position = vec4( position, 1.0 ); }`,l1=`uniform sampler2D shadow_pass; uniform vec2 resolution; uniform float radius; #include void main() { const float samples = float( VSM_SAMPLES ); float mean = 0.0; float squared_mean = 0.0; float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 ); float uvStart = samples <= 1.0 ? 0.0 : - 1.0; for ( float i = 0.0; i < samples; i ++ ) { float uvOffset = uvStart + i * uvStride; #ifdef HORIZONTAL_PASS vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) ); mean += distribution.x; squared_mean += distribution.y * distribution.y + distribution.x * distribution.x; #else float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) ); mean += depth; squared_mean += depth * depth; #endif } mean = mean / samples; squared_mean = squared_mean / samples; float std_dev = sqrt( squared_mean - mean * mean ); gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); }`;function c1(n,e,t){let i=new ro;const s=new te,r=new te,o=new je,a=new r1({depthPacking:ab}),l=new o1,c={},u=t.maxTextureSize,h={0:Yt,1:ki,2:Jt},d=new un({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new te},radius:{value:4}},vertexShader:a1,fragmentShader:l1}),p=d.clone();p.defines.HORIZONTAL_PASS=1;const g=new xt;g.setAttribute("position",new dt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const m=new ft(g,d),f=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=fd,this.render=function(x,w,C){if(f.enabled===!1||f.autoUpdate===!1&&f.needsUpdate===!1||x.length===0)return;const L=n.getRenderTarget(),y=n.getActiveCubeFace(),A=n.getActiveMipmapLevel(),I=n.state;I.setBlending($n),I.buffers.color.setClear(1,1,1,1),I.buffers.depth.setTest(!0),I.setScissorTest(!1);for(let R=0,Z=x.length;Ru||s.y>u)&&(s.x>u&&(r.x=Math.floor(u/z.x),s.x=r.x*z.x,D.mapSize.x=r.x),s.y>u&&(r.y=Math.floor(u/z.y),s.y=r.y*z.y,D.mapSize.y=r.y)),D.map===null){const W=this.type!==ks?{minFilter:gt,magFilter:gt}:{};D.map=new Un(s.x,s.y,W),D.map.texture.name=K.name+".shadowMap",D.camera.updateProjectionMatrix()}n.setRenderTarget(D.map),n.clear();const k=D.getViewportCount();for(let W=0;W0){const Z=I.uuid,K=w.uuid;let D=c[Z];D===void 0&&(D={},c[Z]=D);let z=D[K];z===void 0&&(z=I.clone(),D[K]=z),I=z}return I.visible=w.visible,I.wireframe=w.wireframe,A===ks?I.side=w.shadowSide!==null?w.shadowSide:w.side:I.side=w.shadowSide!==null?w.shadowSide:h[w.side],I.alphaMap=w.alphaMap,I.alphaTest=w.alphaTest,I.clipShadows=w.clipShadows,I.clippingPlanes=w.clippingPlanes,I.clipIntersection=w.clipIntersection,I.displacementMap=w.displacementMap,I.displacementScale=w.displacementScale,I.displacementBias=w.displacementBias,I.wireframeLinewidth=w.wireframeLinewidth,I.linewidth=w.linewidth,C.isPointLight===!0&&I.isMeshDistanceMaterial===!0&&(I.referencePosition.setFromMatrixPosition(C.matrixWorld),I.nearDistance=L,I.farDistance=y),I}function b(x,w,C,L,y){if(x.visible===!1)return;if(x.layers.test(w.layers)&&(x.isMesh||x.isLine||x.isPoints)&&(x.castShadow||x.receiveShadow&&y===ks)&&(!x.frustumCulled||i.intersectsObject(x))){x.modelViewMatrix.multiplyMatrices(C.matrixWorldInverse,x.matrixWorld);const R=e.update(x),Z=x.material;if(Array.isArray(Z)){const K=R.groups;for(let D=0,z=K.length;D=1):H.indexOf("OpenGL ES")!==-1&&(W=parseFloat(/^OpenGL ES (\d)/.exec(H)[1]),k=W>=2);let N=null,G={};const ee=n.getParameter(3088),J=n.getParameter(2978),re=new je().fromArray(ee),ve=new je().fromArray(J);function Ee(P,fe,V){const pe=new Uint8Array(4),de=n.createTexture();n.bindTexture(P,de),n.texParameteri(P,10241,9728),n.texParameteri(P,10240,9728);for(let ze=0;zeQ||T.height>Q)&&(se=Q/Math.max(T.width,T.height)),se<1||M===!0)if(typeof HTMLImageElement!="undefined"&&T instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&T instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&T instanceof ImageBitmap){const ue=M?Br:Math.floor,Re=ue(se*T.width),$=ue(se*T.height);m===void 0&&(m=v(Re,$));const be=B?v(Re,$):m;return be.width=Re,be.height=$,be.getContext("2d").drawImage(T,0,0,Re,$),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+T.width+"x"+T.height+") to ("+Re+"x"+$+")."),be}else return"data"in T&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+T.width+"x"+T.height+")."),T;return T}function x(T){return Oa(T.width)&&Oa(T.height)}function w(T){return a?!1:T.wrapS!==Et||T.wrapT!==Et||T.minFilter!==gt&&T.minFilter!==Je}function C(T,M){return T.generateMipmaps&&M&&T.minFilter!==gt&&T.minFilter!==Je}function L(T){n.generateMipmap(T)}function y(T,M,B,Q,se=!1){if(a===!1)return M;if(T!==null){if(n[T]!==void 0)return n[T];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+T+"'")}let ue=M;return M===6403&&(B===5126&&(ue=33326),B===5131&&(ue=33325),B===5121&&(ue=33321)),M===33319&&(B===5126&&(ue=33328),B===5131&&(ue=33327),B===5121&&(ue=33323)),M===6408&&(B===5126&&(ue=34836),B===5131&&(ue=34842),B===5121&&(ue=Q===We&&se===!1?35907:32856),B===32819&&(ue=32854),B===32820&&(ue=32855)),(ue===33325||ue===33326||ue===33327||ue===33328||ue===34842||ue===34836)&&e.get("EXT_color_buffer_float"),ue}function A(T,M,B){return C(T,B)===!0||T.isFramebufferTexture&&T.minFilter!==gt&&T.minFilter!==Je?Math.log2(Math.max(M.width,M.height))+1:T.mipmaps!==void 0&&T.mipmaps.length>0?T.mipmaps.length:T.isCompressedTexture&&Array.isArray(T.image)?M.mipmaps.length:1}function I(T){return T===gt||T===Sa||T===wa?9728:9729}function R(T){const M=T.target;M.removeEventListener("dispose",R),K(M),M.isVideoTexture&&g.delete(M)}function Z(T){const M=T.target;M.removeEventListener("dispose",Z),z(M)}function K(T){const M=i.get(T);if(M.__webglInit===void 0)return;const B=T.source,Q=f.get(B);if(Q){const se=Q[M.__cacheKey];se.usedTimes--,se.usedTimes===0&&D(T),Object.keys(Q).length===0&&f.delete(B)}i.remove(T)}function D(T){const M=i.get(T);n.deleteTexture(M.__webglTexture);const B=T.source,Q=f.get(B);delete Q[M.__cacheKey],o.memory.textures--}function z(T){const M=T.texture,B=i.get(T),Q=i.get(M);if(Q.__webglTexture!==void 0&&(n.deleteTexture(Q.__webglTexture),o.memory.textures--),T.depthTexture&&T.depthTexture.dispose(),T.isWebGLCubeRenderTarget)for(let se=0;se<6;se++)n.deleteFramebuffer(B.__webglFramebuffer[se]),B.__webglDepthbuffer&&n.deleteRenderbuffer(B.__webglDepthbuffer[se]);else{if(n.deleteFramebuffer(B.__webglFramebuffer),B.__webglDepthbuffer&&n.deleteRenderbuffer(B.__webglDepthbuffer),B.__webglMultisampledFramebuffer&&n.deleteFramebuffer(B.__webglMultisampledFramebuffer),B.__webglColorRenderbuffer)for(let se=0;se=l&&console.warn("THREE.WebGLTextures: Trying to use "+T+" texture units while this GPU supports only "+l),k+=1,T}function N(T){const M=[];return M.push(T.wrapS),M.push(T.wrapT),M.push(T.magFilter),M.push(T.minFilter),M.push(T.anisotropy),M.push(T.internalFormat),M.push(T.format),M.push(T.type),M.push(T.generateMipmaps),M.push(T.premultiplyAlpha),M.push(T.flipY),M.push(T.unpackAlignment),M.push(T.encoding),M.join()}function G(T,M){const B=i.get(T);if(T.isVideoTexture&&Ze(T),T.isRenderTargetTexture===!1&&T.version>0&&B.__version!==T.version){const Q=T.image;if(Q===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(Q.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{Ce(B,T,M);return}}t.activeTexture(33984+M),t.bindTexture(3553,B.__webglTexture)}function ee(T,M){const B=i.get(T);if(T.version>0&&B.__version!==T.version){Ce(B,T,M);return}t.activeTexture(33984+M),t.bindTexture(35866,B.__webglTexture)}function J(T,M){const B=i.get(T);if(T.version>0&&B.__version!==T.version){Ce(B,T,M);return}t.activeTexture(33984+M),t.bindTexture(32879,B.__webglTexture)}function re(T,M){const B=i.get(T);if(T.version>0&&B.__version!==T.version){Le(B,T,M);return}t.activeTexture(33984+M),t.bindTexture(34067,B.__webglTexture)}const ve={[ri]:10497,[Et]:33071,[Or]:33648},Ee={[gt]:9728,[Sa]:9984,[wa]:9986,[Je]:9729,[Sd]:9985,[oi]:9987};function q(T,M,B){if(B?(n.texParameteri(T,10242,ve[M.wrapS]),n.texParameteri(T,10243,ve[M.wrapT]),(T===32879||T===35866)&&n.texParameteri(T,32882,ve[M.wrapR]),n.texParameteri(T,10240,Ee[M.magFilter]),n.texParameteri(T,10241,Ee[M.minFilter])):(n.texParameteri(T,10242,33071),n.texParameteri(T,10243,33071),(T===32879||T===35866)&&n.texParameteri(T,32882,33071),(M.wrapS!==Et||M.wrapT!==Et)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),n.texParameteri(T,10240,I(M.magFilter)),n.texParameteri(T,10241,I(M.minFilter)),M.minFilter!==gt&&M.minFilter!==Je&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),e.has("EXT_texture_filter_anisotropic")===!0){const Q=e.get("EXT_texture_filter_anisotropic");if(M.type===zt&&e.has("OES_texture_float_linear")===!1||a===!1&&M.type===Zt&&e.has("OES_texture_half_float_linear")===!1)return;(M.anisotropy>1||i.get(M).__currentAnisotropy)&&(n.texParameterf(T,Q.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(M.anisotropy,s.getMaxAnisotropy())),i.get(M).__currentAnisotropy=M.anisotropy)}}function Oe(T,M){let B=!1;T.__webglInit===void 0&&(T.__webglInit=!0,M.addEventListener("dispose",R));const Q=M.source;let se=f.get(Q);se===void 0&&(se={},f.set(Q,se));const ue=N(M);if(ue!==T.__cacheKey){se[ue]===void 0&&(se[ue]={texture:n.createTexture(),usedTimes:0},o.memory.textures++,B=!0),se[ue].usedTimes++;const Re=se[T.__cacheKey];Re!==void 0&&(se[T.__cacheKey].usedTimes--,Re.usedTimes===0&&D(M)),T.__cacheKey=ue,T.__webglTexture=se[ue].texture}return B}function Ce(T,M,B){let Q=3553;M.isDataArrayTexture&&(Q=35866),M.isData3DTexture&&(Q=32879);const se=Oe(T,M),ue=M.source;if(t.activeTexture(33984+B),t.bindTexture(Q,T.__webglTexture),ue.version!==ue.__currentVersion||se===!0){n.pixelStorei(37440,M.flipY),n.pixelStorei(37441,M.premultiplyAlpha),n.pixelStorei(3317,M.unpackAlignment),n.pixelStorei(37443,0);const Re=w(M)&&x(M.image)===!1;let $=b(M.image,Re,!1,u);$=Ye(M,$);const be=x($)||a,me=r.convert(M.format,M.encoding);let Se=r.convert(M.type),_e=y(M.internalFormat,me,Se,M.encoding,M.isVideoTexture);q(Q,M,be);let De;const Ve=M.mipmaps,it=a&&M.isVideoTexture!==!0,P=ue.__currentVersion===void 0||se===!0,fe=A(M,$,be);if(M.isDepthTexture)_e=6402,a?M.type===zt?_e=36012:M.type===li?_e=33190:M.type===Gi?_e=35056:_e=33189:M.type===zt&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),M.format===ci&&_e===6402&&M.type!==wd&&M.type!==li&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),M.type=li,Se=r.convert(M.type)),M.format===Vi&&_e===6402&&(_e=34041,M.type!==Gi&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),M.type=Gi,Se=r.convert(M.type))),P&&(it?t.texStorage2D(3553,1,_e,$.width,$.height):t.texImage2D(3553,0,_e,$.width,$.height,0,me,Se,null));else if(M.isDataTexture)if(Ve.length>0&&be){it&&P&&t.texStorage2D(3553,fe,_e,Ve[0].width,Ve[0].height);for(let V=0,pe=Ve.length;V>=1,pe>>=1}}else if(Ve.length>0&&be){it&&P&&t.texStorage2D(3553,fe,_e,Ve[0].width,Ve[0].height);for(let V=0,pe=Ve.length;V0&&P++,t.texStorage2D(34067,P,De,$[0].width,$[0].height));for(let V=0;V<6;V++)if(Re){Ve?t.texSubImage2D(34069+V,0,0,0,$[V].width,$[V].height,Se,_e,$[V].data):t.texImage2D(34069+V,0,De,$[V].width,$[V].height,0,Se,_e,$[V].data);for(let pe=0;pe0&&we(T)===!1){const $=ue?M:[M];B.__webglMultisampledFramebuffer=n.createFramebuffer(),B.__webglColorRenderbuffer=[],t.bindFramebuffer(36160,B.__webglMultisampledFramebuffer);for(let be=0;be<$.length;be++){const me=$[be];B.__webglColorRenderbuffer[be]=n.createRenderbuffer(),n.bindRenderbuffer(36161,B.__webglColorRenderbuffer[be]);const Se=r.convert(me.format,me.encoding),_e=r.convert(me.type),De=y(me.internalFormat,Se,_e,me.encoding),Ve=Ae(T);n.renderbufferStorageMultisample(36161,Ve,De,T.width,T.height),n.framebufferRenderbuffer(36160,36064+be,36161,B.__webglColorRenderbuffer[be])}n.bindRenderbuffer(36161,null),T.depthBuffer&&(B.__webglDepthRenderbuffer=n.createRenderbuffer(),$e(B.__webglDepthRenderbuffer,T,!0)),t.bindFramebuffer(36160,null)}}if(se){t.bindTexture(34067,Q.__webglTexture),q(34067,M,Re);for(let $=0;$<6;$++)he(B.__webglFramebuffer[$],T,M,36064,34069+$);C(M,Re)&&L(34067),t.unbindTexture()}else if(ue){const $=T.texture;for(let be=0,me=$.length;be0&&we(T)===!1){const M=T.isWebGLMultipleRenderTargets?T.texture:[T.texture],B=T.width,Q=T.height;let se=16384;const ue=[],Re=T.stencilBuffer?33306:36096,$=i.get(T),be=T.isWebGLMultipleRenderTargets===!0;if(be)for(let me=0;me0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&M.__useRenderToTexture!==!1}function Ze(T){const M=o.render.frame;g.get(T)!==M&&(g.set(T,M),T.update())}function Ye(T,M){const B=T.encoding,Q=T.format,se=T.type;return T.isCompressedTexture===!0||T.isVideoTexture===!0||T.format===Da||B!==hn&&(B===We?a===!1?e.has("EXT_sRGB")===!0&&Q===Kt?(T.format=Da,T.minFilter=Je,T.generateMipmaps=!1):M=Kd.sRGBToLinear(M):(Q!==Kt||se!==ai)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture encoding:",B)),M}this.allocateTextureUnit=H,this.resetTextureUnits=W,this.setTexture2D=G,this.setTexture2DArray=ee,this.setTexture3D=J,this.setTextureCube=re,this.rebindTextures=ie,this.setupRenderTarget=xe,this.updateRenderTargetMipmap=le,this.updateMultisampleRenderTarget=Pe,this.setupDepthRenderbuffer=j,this.setupFrameBufferTexture=he,this.useMultisampledRTT=we}function d1(n,e,t){const i=t.isWebGL2;function s(r,o=null){let a;if(r===ai)return 5121;if(r===Vx)return 32819;if(r===Hx)return 32820;if(r===Ux)return 5120;if(r===zx)return 5122;if(r===wd)return 5123;if(r===Gx)return 5124;if(r===li)return 5125;if(r===zt)return 5126;if(r===Zt)return i?5131:(a=e.get("OES_texture_half_float"),a!==null?a.HALF_FLOAT_OES:null);if(r===Wx)return 6406;if(r===Kt)return 6408;if(r===qx)return 6409;if(r===Xx)return 6410;if(r===ci)return 6402;if(r===Vi)return 34041;if(r===Yx)return 6403;if(r===jx)return console.warn("THREE.WebGLRenderer: THREE.RGBFormat has been removed. Use THREE.RGBAFormat instead. https://github.com/mrdoob/three.js/pull/23228"),6408;if(r===Da)return a=e.get("EXT_sRGB"),a!==null?a.SRGB_ALPHA_EXT:null;if(r===Jx)return 36244;if(r===Zx)return 33319;if(r===Kx)return 33320;if(r===Qx)return 36249;if(r===Ca||r===Aa||r===Ta||r===Ea)if(o===We)if(a=e.get("WEBGL_compressed_texture_s3tc_srgb"),a!==null){if(r===Ca)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(r===Aa)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(r===Ta)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(r===Ea)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(a=e.get("WEBGL_compressed_texture_s3tc"),a!==null){if(r===Ca)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(r===Aa)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(r===Ta)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(r===Ea)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(r===Cd||r===Ad||r===Td||r===Ed)if(a=e.get("WEBGL_compressed_texture_pvrtc"),a!==null){if(r===Cd)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(r===Ad)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(r===Td)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(r===Ed)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(r===eb)return a=e.get("WEBGL_compressed_texture_etc1"),a!==null?a.COMPRESSED_RGB_ETC1_WEBGL:null;if(r===Ld||r===Rd)if(a=e.get("WEBGL_compressed_texture_etc"),a!==null){if(r===Ld)return o===We?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(r===Rd)return o===We?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(r===Pd||r===Id||r===Dd||r===Fd||r===Od||r===Nd||r===kd||r===Bd||r===$d||r===Ud||r===zd||r===Gd||r===Vd||r===Hd)if(a=e.get("WEBGL_compressed_texture_astc"),a!==null){if(r===Pd)return o===We?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(r===Id)return o===We?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(r===Dd)return o===We?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(r===Fd)return o===We?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(r===Od)return o===We?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(r===Nd)return o===We?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(r===kd)return o===We?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(r===Bd)return o===We?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(r===$d)return o===We?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(r===Ud)return o===We?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(r===zd)return o===We?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(r===Gd)return o===We?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(r===Vd)return o===We?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(r===Hd)return o===We?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(r===Wd)if(a=e.get("EXT_texture_compression_bptc"),a!==null){if(r===Wd)return o===We?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT}else return null;return r===Gi?i?34042:(a=e.get("WEBGL_depth_texture"),a!==null?a.UNSIGNED_INT_24_8_WEBGL:null):n[r]!==void 0?n[r]:null}return{convert:s}}class p1 extends St{constructor(e=[]){super();this.isArrayCamera=!0,this.cameras=e}}class rn extends rt{constructor(){super();this.isGroup=!0,this.type="Group"}}const f1={type:"move"};class pl{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new rn,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new rn,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new E,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new E),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new rn,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new E,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new E),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,i){let s=null,r=null,o=null;const a=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){o=!0;for(const m of e.hand.values()){const f=t.getJointPose(m,i);if(c.joints[m.jointName]===void 0){const v=new rn;v.matrixAutoUpdate=!1,v.visible=!1,c.joints[m.jointName]=v,c.add(v)}const _=c.joints[m.jointName];f!==null&&(_.matrix.fromArray(f.transform.matrix),_.matrix.decompose(_.position,_.rotation,_.scale),_.jointRadius=f.radius),_.visible=f!==null}const u=c.joints["index-finger-tip"],h=c.joints["thumb-tip"],d=u.position.distanceTo(h.position),p=.02,g=.005;c.inputState.pinching&&d>p+g?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&d<=p-g&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(r=t.getPose(e.gripSpace,i),r!==null&&(l.matrix.fromArray(r.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),r.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(r.linearVelocity)):l.hasLinearVelocity=!1,r.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(r.angularVelocity)):l.hasAngularVelocity=!1));a!==null&&(s=t.getPose(e.targetRaySpace,i),s===null&&r!==null&&(s=r),s!==null&&(a.matrix.fromArray(s.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),s.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(s.linearVelocity)):a.hasLinearVelocity=!1,s.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(s.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(f1)))}return a!==null&&(a.visible=s!==null),l!==null&&(l.visible=r!==null),c!==null&&(c.visible=o!==null),this}}class m1 extends _t{constructor(e,t,i,s,r,o,a,l,c,u){if(u=u!==void 0?u:ci,u!==ci&&u!==Vi)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");i===void 0&&u===ci&&(i=li),i===void 0&&u===Vi&&(i=Gi);super(null,s,r,o,a,l,u,i,c);this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=a!==void 0?a:gt,this.minFilter=l!==void 0?l:gt,this.flipY=!1,this.generateMipmaps=!1}}class g1 extends ui{constructor(e,t){super();const i=this;let s=null,r=1,o=null,a="local-floor",l=null,c=null,u=null,h=null,d=null,p=null;const g=t.getContextAttributes();let m=null,f=null;const _=[],v=[],b=new St;b.layers.enable(1),b.viewport=new je;const x=new St;x.layers.enable(2),x.viewport=new je;const w=[b,x],C=new p1;C.layers.enable(1),C.layers.enable(2);let L=null,y=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(N){let G=_[N];return G===void 0&&(G=new pl,_[N]=G),G.getTargetRaySpace()},this.getControllerGrip=function(N){let G=_[N];return G===void 0&&(G=new pl,_[N]=G),G.getGripSpace()},this.getHand=function(N){let G=_[N];return G===void 0&&(G=new pl,_[N]=G),G.getHandSpace()};function A(N){const G=v.indexOf(N.inputSource);if(G===-1)return;const ee=_[G];ee!==void 0&&ee.dispatchEvent({type:N.type,data:N.inputSource})}function I(){s.removeEventListener("select",A),s.removeEventListener("selectstart",A),s.removeEventListener("selectend",A),s.removeEventListener("squeeze",A),s.removeEventListener("squeezestart",A),s.removeEventListener("squeezeend",A),s.removeEventListener("end",I),s.removeEventListener("inputsourceschange",R);for(let N=0;N<_.length;N++){const G=v[N];G!==null&&(v[N]=null,_[N].disconnect(G))}L=null,y=null,e.setRenderTarget(m),d=null,h=null,u=null,s=null,f=null,H.stop(),i.isPresenting=!1,i.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(N){r=N,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(N){a=N,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||o},this.setReferenceSpace=function(N){l=N},this.getBaseLayer=function(){return h!==null?h:d},this.getBinding=function(){return u},this.getFrame=function(){return p},this.getSession=function(){return s},this.setSession=async function(N){if(s=N,s!==null){if(m=e.getRenderTarget(),s.addEventListener("select",A),s.addEventListener("selectstart",A),s.addEventListener("selectend",A),s.addEventListener("squeeze",A),s.addEventListener("squeezestart",A),s.addEventListener("squeezeend",A),s.addEventListener("end",I),s.addEventListener("inputsourceschange",R),g.xrCompatible!==!0&&await t.makeXRCompatible(),s.renderState.layers===void 0||e.capabilities.isWebGL2===!1){const G={antialias:s.renderState.layers===void 0?g.antialias:!0,alpha:g.alpha,depth:g.depth,stencil:g.stencil,framebufferScaleFactor:r};d=new XRWebGLLayer(s,t,G),s.updateRenderState({baseLayer:d}),f=new Un(d.framebufferWidth,d.framebufferHeight,{format:Kt,type:ai,encoding:e.outputEncoding})}else{let G=null,ee=null,J=null;g.depth&&(J=g.stencil?35056:33190,G=g.stencil?Vi:ci,ee=g.stencil?Gi:li);const re={colorFormat:32856,depthFormat:J,scaleFactor:r};u=new XRWebGLBinding(s,t),h=u.createProjectionLayer(re),s.updateRenderState({layers:[h]}),f=new Un(h.textureWidth,h.textureHeight,{format:Kt,type:ai,depthTexture:new m1(h.textureWidth,h.textureHeight,ee,void 0,void 0,void 0,void 0,void 0,void 0,G),stencilBuffer:g.stencil,encoding:e.outputEncoding,samples:g.antialias?4:0});const ve=e.properties.get(f);ve.__ignoreDepthValues=h.ignoreDepthValues}f.isXRRenderTarget=!0,this.setFoveation(1),l=null,o=await s.requestReferenceSpace(a),H.setContext(s),H.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}};function R(N){for(let G=0;G=0&&(v[J]=null,_[J].dispatchEvent({type:"disconnected",data:ee}))}for(let G=0;G=v.length){v.push(ee),J=ve;break}else if(v[ve]===null){v[ve]=ee,J=ve;break}if(J===-1)break}const re=_[J];re&&re.dispatchEvent({type:"connected",data:ee})}}const Z=new E,K=new E;function D(N,G,ee){Z.setFromMatrixPosition(G.matrixWorld),K.setFromMatrixPosition(ee.matrixWorld);const J=Z.distanceTo(K),re=G.projectionMatrix.elements,ve=ee.projectionMatrix.elements,Ee=re[14]/(re[10]-1),q=re[14]/(re[10]+1),Oe=(re[9]+1)/re[5],Ce=(re[9]-1)/re[5],Le=(re[8]-1)/re[0],he=(ve[8]+1)/ve[0],$e=Ee*Le,X=Ee*he,j=J/(-Le+he),ie=j*-Le;G.matrixWorld.decompose(N.position,N.quaternion,N.scale),N.translateX(ie),N.translateZ(j),N.matrixWorld.compose(N.position,N.quaternion,N.scale),N.matrixWorldInverse.copy(N.matrixWorld).invert();const xe=Ee+j,le=q+j,Pe=$e-ie,Ae=X+(J-ie),we=Oe*q/le*xe,Ze=Ce*q/le*xe;N.projectionMatrix.makePerspective(Pe,Ae,we,Ze,xe,le)}function z(N,G){G===null?N.matrixWorld.copy(N.matrix):N.matrixWorld.multiplyMatrices(G.matrixWorld,N.matrix),N.matrixWorldInverse.copy(N.matrixWorld).invert()}this.updateCamera=function(N){if(s===null)return;C.near=x.near=b.near=N.near,C.far=x.far=b.far=N.far,(L!==C.near||y!==C.far)&&(s.updateRenderState({depthNear:C.near,depthFar:C.far}),L=C.near,y=C.far);const G=N.parent,ee=C.cameras;z(C,G);for(let re=0;re0&&(m.alphaTest.value=f.alphaTest);const _=e.get(f).envMap;if(_&&(m.envMap.value=_,m.flipEnvMap.value=_.isCubeTexture&&_.isRenderTargetTexture===!1?-1:1,m.reflectivity.value=f.reflectivity,m.ior.value=f.ior,m.refractionRatio.value=f.refractionRatio),f.lightMap){m.lightMap.value=f.lightMap;const x=n.physicallyCorrectLights!==!0?Math.PI:1;m.lightMapIntensity.value=f.lightMapIntensity*x}f.aoMap&&(m.aoMap.value=f.aoMap,m.aoMapIntensity.value=f.aoMapIntensity);let v;f.map?v=f.map:f.specularMap?v=f.specularMap:f.displacementMap?v=f.displacementMap:f.normalMap?v=f.normalMap:f.bumpMap?v=f.bumpMap:f.roughnessMap?v=f.roughnessMap:f.metalnessMap?v=f.metalnessMap:f.alphaMap?v=f.alphaMap:f.emissiveMap?v=f.emissiveMap:f.clearcoatMap?v=f.clearcoatMap:f.clearcoatNormalMap?v=f.clearcoatNormalMap:f.clearcoatRoughnessMap?v=f.clearcoatRoughnessMap:f.iridescenceMap?v=f.iridescenceMap:f.iridescenceThicknessMap?v=f.iridescenceThicknessMap:f.specularIntensityMap?v=f.specularIntensityMap:f.specularColorMap?v=f.specularColorMap:f.transmissionMap?v=f.transmissionMap:f.thicknessMap?v=f.thicknessMap:f.sheenColorMap?v=f.sheenColorMap:f.sheenRoughnessMap&&(v=f.sheenRoughnessMap),v!==void 0&&(v.isWebGLRenderTarget&&(v=v.texture),v.matrixAutoUpdate===!0&&v.updateMatrix(),m.uvTransform.value.copy(v.matrix));let b;f.aoMap?b=f.aoMap:f.lightMap&&(b=f.lightMap),b!==void 0&&(b.isWebGLRenderTarget&&(b=b.texture),b.matrixAutoUpdate===!0&&b.updateMatrix(),m.uv2Transform.value.copy(b.matrix))}function r(m,f){m.diffuse.value.copy(f.color),m.opacity.value=f.opacity}function o(m,f){m.dashSize.value=f.dashSize,m.totalSize.value=f.dashSize+f.gapSize,m.scale.value=f.scale}function a(m,f,_,v){m.diffuse.value.copy(f.color),m.opacity.value=f.opacity,m.size.value=f.size*_,m.scale.value=v*.5,f.map&&(m.map.value=f.map),f.alphaMap&&(m.alphaMap.value=f.alphaMap),f.alphaTest>0&&(m.alphaTest.value=f.alphaTest);let b;f.map?b=f.map:f.alphaMap&&(b=f.alphaMap),b!==void 0&&(b.matrixAutoUpdate===!0&&b.updateMatrix(),m.uvTransform.value.copy(b.matrix))}function l(m,f){m.diffuse.value.copy(f.color),m.opacity.value=f.opacity,m.rotation.value=f.rotation,f.map&&(m.map.value=f.map),f.alphaMap&&(m.alphaMap.value=f.alphaMap),f.alphaTest>0&&(m.alphaTest.value=f.alphaTest);let _;f.map?_=f.map:f.alphaMap&&(_=f.alphaMap),_!==void 0&&(_.matrixAutoUpdate===!0&&_.updateMatrix(),m.uvTransform.value.copy(_.matrix))}function c(m,f){m.specular.value.copy(f.specular),m.shininess.value=Math.max(f.shininess,1e-4)}function u(m,f){f.gradientMap&&(m.gradientMap.value=f.gradientMap)}function h(m,f){m.roughness.value=f.roughness,m.metalness.value=f.metalness,f.roughnessMap&&(m.roughnessMap.value=f.roughnessMap),f.metalnessMap&&(m.metalnessMap.value=f.metalnessMap),e.get(f).envMap&&(m.envMapIntensity.value=f.envMapIntensity)}function d(m,f,_){m.ior.value=f.ior,f.sheen>0&&(m.sheenColor.value.copy(f.sheenColor).multiplyScalar(f.sheen),m.sheenRoughness.value=f.sheenRoughness,f.sheenColorMap&&(m.sheenColorMap.value=f.sheenColorMap),f.sheenRoughnessMap&&(m.sheenRoughnessMap.value=f.sheenRoughnessMap)),f.clearcoat>0&&(m.clearcoat.value=f.clearcoat,m.clearcoatRoughness.value=f.clearcoatRoughness,f.clearcoatMap&&(m.clearcoatMap.value=f.clearcoatMap),f.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=f.clearcoatRoughnessMap),f.clearcoatNormalMap&&(m.clearcoatNormalScale.value.copy(f.clearcoatNormalScale),m.clearcoatNormalMap.value=f.clearcoatNormalMap,f.side===Yt&&m.clearcoatNormalScale.value.negate())),f.iridescence>0&&(m.iridescence.value=f.iridescence,m.iridescenceIOR.value=f.iridescenceIOR,m.iridescenceThicknessMinimum.value=f.iridescenceThicknessRange[0],m.iridescenceThicknessMaximum.value=f.iridescenceThicknessRange[1],f.iridescenceMap&&(m.iridescenceMap.value=f.iridescenceMap),f.iridescenceThicknessMap&&(m.iridescenceThicknessMap.value=f.iridescenceThicknessMap)),f.transmission>0&&(m.transmission.value=f.transmission,m.transmissionSamplerMap.value=_.texture,m.transmissionSamplerSize.value.set(_.width,_.height),f.transmissionMap&&(m.transmissionMap.value=f.transmissionMap),m.thickness.value=f.thickness,f.thicknessMap&&(m.thicknessMap.value=f.thicknessMap),m.attenuationDistance.value=f.attenuationDistance,m.attenuationColor.value.copy(f.attenuationColor)),m.specularIntensity.value=f.specularIntensity,m.specularColor.value.copy(f.specularColor),f.specularIntensityMap&&(m.specularIntensityMap.value=f.specularIntensityMap),f.specularColorMap&&(m.specularColorMap.value=f.specularColorMap)}function p(m,f){f.matcap&&(m.matcap.value=f.matcap)}function g(m,f){m.referencePosition.value.copy(f.referencePosition),m.nearDistance.value=f.nearDistance,m.farDistance.value=f.farDistance}return{refreshFogUniforms:t,refreshMaterialUniforms:i}}function y1(n,e,t,i){let s={},r={},o=[];const a=t.isWebGL2?n.getParameter(35375):0;function l(v,b){const x=b.program;i.uniformBlockBinding(v,x)}function c(v,b){let x=s[v.id];x===void 0&&(g(v),x=u(v),s[v.id]=x,v.addEventListener("dispose",f));const w=b.program;i.updateUBOMapping(v,w);const C=e.render.frame;r[v.id]!==C&&(d(v),r[v.id]=C)}function u(v){const b=h();v.__bindingPointIndex=b;const x=n.createBuffer(),w=v.__size,C=v.usage;return n.bindBuffer(35345,x),n.bufferData(35345,w,C),n.bindBuffer(35345,null),n.bindBufferBase(35345,b,x),x}function h(){for(let v=0;v0){C=x%w;const R=w-C;C!==0&&R-I.boundary<0&&(x+=w-C,A.__offset=x)}x+=I.storage}return C=x%w,C>0&&(x+=w-C),v.__size=x,v.__cache={},this}function m(v){const b=v.value,x={boundary:0,storage:0};return typeof b=="number"?(x.boundary=4,x.storage=4):b.isVector2?(x.boundary=8,x.storage=8):b.isVector3||b.isColor?(x.boundary=16,x.storage=12):b.isVector4?(x.boundary=16,x.storage=16):b.isMatrix3?(x.boundary=48,x.storage=48):b.isMatrix4?(x.boundary=64,x.storage=64):b.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",b),x}function f(v){const b=v.target;b.removeEventListener("dispose",f);const x=o.indexOf(b.__bindingPointIndex);o.splice(x,1),n.deleteBuffer(s[b.id]),delete s[b.id],delete r[b.id]}function _(){for(const v in s)n.deleteBuffer(s[v]);o=[],s={},r={}}return{bind:l,update:c,dispose:_}}function v1(){const n=Gs("canvas");return n.style.display="block",n}function Gp(n={}){this.isWebGLRenderer=!0;const e=n.canvas!==void 0?n.canvas:v1(),t=n.context!==void 0?n.context:null,i=n.depth!==void 0?n.depth:!0,s=n.stencil!==void 0?n.stencil:!0,r=n.antialias!==void 0?n.antialias:!1,o=n.premultipliedAlpha!==void 0?n.premultipliedAlpha:!0,a=n.preserveDrawingBuffer!==void 0?n.preserveDrawingBuffer:!1,l=n.powerPreference!==void 0?n.powerPreference:"default",c=n.failIfMajorPerformanceCaveat!==void 0?n.failIfMajorPerformanceCaveat:!1;let u;t!==null?u=t.getContextAttributes().alpha:u=n.alpha!==void 0?n.alpha:!1;let h=null,d=null;const p=[],g=[];this.domElement=e,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.outputEncoding=hn,this.physicallyCorrectLights=!1,this.toneMapping=yn,this.toneMappingExposure=1,Object.defineProperties(this,{gammaFactor:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaFactor has been removed."),2},set:function(){console.warn("THREE.WebGLRenderer: .gammaFactor has been removed.")}}});const m=this;let f=!1,_=0,v=0,b=null,x=-1,w=null;const C=new je,L=new je;let y=null,A=e.width,I=e.height,R=1,Z=null,K=null;const D=new je(0,0,A,I),z=new je(0,0,A,I);let k=!1;const W=new ro;let H=!1,N=!1,G=null;const ee=new Me,J=new te,re=new E,ve={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function Ee(){return b===null?R:1}let q=t;function Oe(S,F){for(let U=0;U0?d=g[g.length-1]:d=null,p.pop(),p.length>0?h=p[p.length-1]:h=null};function kn(S,F,U,O){if(S.visible===!1)return;if(S.layers.test(F.layers)){if(S.isGroup)U=S.renderOrder;else if(S.isLOD)S.autoUpdate===!0&&S.update(F);else if(S.isLight)d.pushLight(S),S.castShadow&&d.pushShadow(S);else if(S.isSprite){if(!S.frustumCulled||W.intersectsSprite(S)){O&&re.setFromMatrixPosition(S.matrixWorld).applyMatrix4(ee);const Ie=Ae.update(S),Ne=S.material;Ne.visible&&h.push(S,Ie,Ne,U,re.z,null)}}else if((S.isMesh||S.isLine||S.isPoints)&&(S.isSkinnedMesh&&S.skeleton.frame!==$e.render.frame&&(S.skeleton.update(),S.skeleton.frame=$e.render.frame),!S.frustumCulled||W.intersectsObject(S))){O&&re.setFromMatrixPosition(S.matrixWorld).applyMatrix4(ee);const Ie=Ae.update(S),Ne=S.material;if(Array.isArray(Ne)){const Fe=Ie.groups;for(let Xe=0,Ue=Fe.length;Xe0&&gn(Y,F,U),O&&he.viewport(C.copy(O)),Y.length>0&&Nt(Y,F,U),Te.length>0&&Nt(Te,F,U),Ie.length>0&&Nt(Ie,F,U),he.buffers.depth.setTest(!0),he.buffers.depth.setMask(!0),he.buffers.color.setMask(!0),he.setPolygonOffset(!1)}function gn(S,F,U){const O=Le.isWebGL2;G===null&&(G=new Un(1,1,{generateMipmaps:!0,type:Ce.has("EXT_color_buffer_half_float")?Zt:ai,minFilter:oi,samples:O&&r===!0?4:0})),m.getDrawingBufferSize(J),O?G.setSize(J.x,J.y):G.setSize(Br(J.x),Br(J.y));const Y=m.getRenderTarget();m.setRenderTarget(G),m.clear();const Te=m.toneMapping;m.toneMapping=yn,Nt(S,F,U),m.toneMapping=Te,j.updateMultisampleRenderTarget(G),j.updateRenderTargetMipmap(G),m.setRenderTarget(Y)}function Nt(S,F,U){const O=F.isScene===!0?F.overrideMaterial:null;for(let Y=0,Te=S.length;Y0&&j.useMultisampledRTT(S)===!1?Y=X.get(S).__webglMultisampledFramebuffer:Y=Xe,C.copy(S.viewport),L.copy(S.scissor),y=S.scissorTest}else C.copy(D).multiplyScalar(R).floor(),L.copy(z).multiplyScalar(R).floor(),y=k;if(he.bindFramebuffer(36160,Y)&&Le.drawBuffers&&O&&he.drawBuffers(S,Y),he.viewport(C),he.scissor(L),he.setScissorTest(y),Te){const Fe=X.get(S.texture);q.framebufferTexture2D(36160,36064,34069+F,Fe.__webglTexture,U)}else if(Ie){const Fe=X.get(S.texture),Xe=F||0;q.framebufferTextureLayer(36160,36064,Fe.__webglTexture,U||0,Xe)}x=-1},this.readRenderTargetPixels=function(S,F,U,O,Y,Te,Ie){if(!(S&&S.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Ne=X.get(S).__webglFramebuffer;if(S.isWebGLCubeRenderTarget&&Ie!==void 0&&(Ne=Ne[Ie]),Ne){he.bindFramebuffer(36160,Ne);try{const Fe=S.texture,Xe=Fe.format,Ue=Fe.type;if(Xe!==Kt&&$.convert(Xe)!==q.getParameter(35739)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const Ge=Ue===Zt&&(Ce.has("EXT_color_buffer_half_float")||Le.isWebGL2&&Ce.has("EXT_color_buffer_float"));if(Ue!==ai&&$.convert(Ue)!==q.getParameter(35738)&&!(Ue===zt&&(Le.isWebGL2||Ce.has("OES_texture_float")||Ce.has("WEBGL_color_buffer_float")))&&!Ge){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}F>=0&&F<=S.width-O&&U>=0&&U<=S.height-Y&&q.readPixels(F,U,O,Y,$.convert(Xe),$.convert(Ue),Te)}finally{const Fe=b!==null?X.get(b).__webglFramebuffer:null;he.bindFramebuffer(36160,Fe)}}},this.copyFramebufferToTexture=function(S,F,U=0){const O=Math.pow(2,-U),Y=Math.floor(F.image.width*O),Te=Math.floor(F.image.height*O);j.setTexture2D(F,0),q.copyTexSubImage2D(3553,U,0,0,S.x,S.y,Y,Te),he.unbindTexture()},this.copyTextureToTexture=function(S,F,U,O=0){const Y=F.image.width,Te=F.image.height,Ie=$.convert(U.format),Ne=$.convert(U.type);j.setTexture2D(U,0),q.pixelStorei(37440,U.flipY),q.pixelStorei(37441,U.premultiplyAlpha),q.pixelStorei(3317,U.unpackAlignment),F.isDataTexture?q.texSubImage2D(3553,O,S.x,S.y,Y,Te,Ie,Ne,F.image.data):F.isCompressedTexture?q.compressedTexSubImage2D(3553,O,S.x,S.y,F.mipmaps[0].width,F.mipmaps[0].height,Ie,F.mipmaps[0].data):q.texSubImage2D(3553,O,S.x,S.y,Ie,Ne,F.image),O===0&&U.generateMipmaps&&q.generateMipmap(3553),he.unbindTexture()},this.copyTextureToTexture3D=function(S,F,U,O,Y=0){if(m.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const Te=S.max.x-S.min.x+1,Ie=S.max.y-S.min.y+1,Ne=S.max.z-S.min.z+1,Fe=$.convert(O.format),Xe=$.convert(O.type);let Ue;if(O.isData3DTexture)j.setTexture3D(O,0),Ue=32879;else if(O.isDataArrayTexture)j.setTexture2DArray(O,0),Ue=35866;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}q.pixelStorei(37440,O.flipY),q.pixelStorei(37441,O.premultiplyAlpha),q.pixelStorei(3317,O.unpackAlignment);const Ge=q.getParameter(3314),tt=q.getParameter(32878),ei=q.getParameter(3316),Ti=q.getParameter(3315),Ei=q.getParameter(32877),ln=U.isCompressedTexture?U.mipmaps[0]:U.image;q.pixelStorei(3314,ln.width),q.pixelStorei(32878,ln.height),q.pixelStorei(3316,S.min.x),q.pixelStorei(3315,S.min.y),q.pixelStorei(32877,S.min.z),U.isDataTexture||U.isData3DTexture?q.texSubImage3D(Ue,Y,F.x,F.y,F.z,Te,Ie,Ne,Fe,Xe,ln.data):U.isCompressedTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),q.compressedTexSubImage3D(Ue,Y,F.x,F.y,F.z,Te,Ie,Ne,Fe,ln.data)):q.texSubImage3D(Ue,Y,F.x,F.y,F.z,Te,Ie,Ne,Fe,Xe,ln),q.pixelStorei(3314,Ge),q.pixelStorei(32878,tt),q.pixelStorei(3316,ei),q.pixelStorei(3315,Ti),q.pixelStorei(32877,Ei),Y===0&&O.generateMipmaps&&q.generateMipmap(Ue),he.unbindTexture()},this.initTexture=function(S){S.isCubeTexture?j.setTextureCube(S,0):S.isData3DTexture?j.setTexture3D(S,0):S.isDataArrayTexture?j.setTexture2DArray(S,0):j.setTexture2D(S,0),he.unbindTexture()},this.resetState=function(){_=0,v=0,b=null,he.reset(),be.reset()},typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}class x1 extends Gp{}x1.prototype.isWebGL1Renderer=!0;class b1 extends rt{constructor(){super();this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.autoUpdate=e.autoUpdate,this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),t}}class M1{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=Ia,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=Gt()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,i){e*=this.stride,i*=t.stride;for(let s=0,r=this.stride;sl)continue;d.applyMatrix4(this.matrixWorld);const y=e.ray.origin.distanceTo(d);ye.far||t.push({distance:y,point:h.clone().applyMatrix4(this.matrixWorld),index:b,face:null,faceIndex:null,object:this})}}else{const _=Math.max(0,o.start),v=Math.min(f.count,o.start+o.count);for(let b=_,x=v-1;bl)continue;d.applyMatrix4(this.matrixWorld);const C=e.ray.origin.distanceTo(d);Ce.far||t.push({distance:C,point:h.clone().applyMatrix4(this.matrixWorld),index:b,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){const t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){const s=t[i[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,o=s.length;r0){const s=t[i[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,o=s.length;rs.far)return;r.push({distance:c,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,object:o})}}class E1 extends _t{constructor(e,t,i,s,r,o,a,l,c){super(e,t,i,s,r,o,a,l,c);this.isVideoTexture=!0,this.minFilter=o!==void 0?o:Je,this.magFilter=r!==void 0?r:Je,this.generateMipmaps=!1;const u=this;function h(){u.needsUpdate=!0,e.requestVideoFrameCallback(h)}"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(h)}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}class L1 extends _t{constructor(e,t,i,s,r,o,a,l,c){super(e,t,i,s,r,o,a,l,c);this.isCanvasTexture=!0,this.needsUpdate=!0}}class pn{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){const i=this.getUtoTmapping(e);return this.getPoint(i,t)}getPoints(e=5){const t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return t}getSpacedPoints(e=5){const t=[];for(let i=0;i<=e;i++)t.push(this.getPointAt(i/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let i,s=this.getPoint(0),r=0;t.push(0);for(let o=1;o<=e;o++)i=this.getPoint(o/e),r+=i.distanceTo(s),t.push(r),s=i;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){const i=this.getLengths();let s=0;const r=i.length;let o;t?o=t:o=e*i[r-1];let a=0,l=r-1,c;for(;a<=l;)if(s=Math.floor(a+(l-a)/2),c=i[s]-o,c<0)a=s+1;else if(c>0)l=s-1;else{l=s;break}if(s=l,i[s]===o)return s/(r-1);const u=i[s],d=i[s+1]-u,p=(o-u)/d;return(s+p)/(r-1)}getTangent(e,t){const i=1e-4;let s=e-i,r=e+i;s<0&&(s=0),r>1&&(r=1);const o=this.getPoint(s),a=this.getPoint(r),l=t||(o.isVector2?new te:new E);return l.copy(a).sub(o).normalize(),l}getTangentAt(e,t){const i=this.getUtoTmapping(e);return this.getTangent(i,t)}computeFrenetFrames(e,t){const i=new E,s=[],r=[],o=[],a=new E,l=new Me;for(let p=0;p<=e;p++){const g=p/e;s[p]=this.getTangentAt(g,new E)}r[0]=new E,o[0]=new E;let c=Number.MAX_VALUE;const u=Math.abs(s[0].x),h=Math.abs(s[0].y),d=Math.abs(s[0].z);u<=c&&(c=u,i.set(1,0,0)),h<=c&&(c=h,i.set(0,1,0)),d<=c&&i.set(0,0,1),a.crossVectors(s[0],i).normalize(),r[0].crossVectors(s[0],a),o[0].crossVectors(s[0],r[0]);for(let p=1;p<=e;p++){if(r[p]=r[p-1].clone(),o[p]=o[p-1].clone(),a.crossVectors(s[p-1],s[p]),a.length()>Number.EPSILON){a.normalize();const g=Math.acos(lt(s[p-1].dot(s[p]),-1,1));r[p].applyMatrix4(l.makeRotationAxis(a,g))}o[p].crossVectors(s[p],r[p])}if(t===!0){let p=Math.acos(lt(r[0].dot(r[e]),-1,1));p/=e,s[0].dot(a.crossVectors(r[0],r[e]))>0&&(p=-p);for(let g=1;g<=e;g++)r[g].applyMatrix4(l.makeRotationAxis(s[g],p*g)),o[g].crossVectors(s[g],r[g])}return{tangents:s,normals:r,binormals:o}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class Ml extends pn{constructor(e=0,t=0,i=1,s=1,r=0,o=Math.PI*2,a=!1,l=0){super();this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=i,this.yRadius=s,this.aStartAngle=r,this.aEndAngle=o,this.aClockwise=a,this.aRotation=l}getPoint(e,t){const i=t||new te,s=Math.PI*2;let r=this.aEndAngle-this.aStartAngle;const o=Math.abs(r)s;)r-=s;r0?0:(Math.floor(Math.abs(a)/r)+1)*r:l===0&&a===r-1&&(a=r-2,l=1);let c,u;this.closed||a>0?c=s[(a-1)%r]:(fo.subVectors(s[0],s[1]).add(s[0]),c=fo);const h=s[a%r],d=s[(a+1)%r];if(this.closed||a+2s.length-2?s.length-1:o+1],h=s[o>s.length-3?s.length-1:o+2];return i.set(lf(a,l.x,c.x,u.x,h.x),lf(a,l.y,c.y,u.y,h.y)),i}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t=i){const o=s[r]-i,a=this.curves[r],l=a.getLength(),c=l===0?0:1-o/l;return a.getPointAt(c,t)}r++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let i=0,s=this.curves.length;i1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,i=e.curves.length;t0){const h=c.getPoint(0);h.equals(this.currentPoint)||this.lineTo(h.x,h.y)}this.curves.push(c);const u=c.getPoint(1);return this.currentPoint.copy(u),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class pf extends El{constructor(e){super(e);this.uuid=Gt(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let i=0,s=this.holes.length;i80*t){a=c=n[0],l=u=n[1];for(let g=t;gc&&(c=h),d>u&&(u=d);p=Math.max(c-a,u-l),p=p!==0?1/p:0}return er(r,o,t,a,l,p),o}};function ff(n,e,t,i,s){let r,o;if(s===rA(n,e,t,i)>0)for(r=e;r=e;r-=i)o=_f(r,n[r],n[r+1],o);return o&&mo(o,o.next)&&(nr(o),o=o.next),o}function Xn(n,e){if(!n)return n;e||(e=n);let t=n,i;do if(i=!1,!t.steiner&&(mo(t,t.next)||Qe(t.prev,t,t.next)===0)){if(nr(t),t=e=t.prev,t===t.next)break;i=!0}else t=t.next;while(i||t!==e);return e}function er(n,e,t,i,s,r,o){if(!n)return;!o&&r&&Q1(n,i,s,r);let a=n,l,c;for(;n.prev!==n.next;){if(l=n.prev,c=n.next,r?W1(n,i,s,r):H1(n)){e.push(l.i/t),e.push(n.i/t),e.push(c.i/t),nr(n),n=c.next,a=c.next;continue}if(n=c,n===a){o?o===1?(n=j1(Xn(n),e,t),er(n,e,t,i,s,r,2)):o===2&&q1(n,e,t,i,s,r):er(Xn(n),e,t,i,s,r,1);break}}}function H1(n){const e=n.prev,t=n,i=n.next;if(Qe(e,t,i)>=0)return!1;let s=n.next.next;for(;s!==n.prev;){if(ds(e.x,e.y,t.x,t.y,i.x,i.y,s.x,s.y)&&Qe(s.prev,s,s.next)>=0)return!1;s=s.next}return!0}function W1(n,e,t,i){const s=n.prev,r=n,o=n.next;if(Qe(s,r,o)>=0)return!1;const a=s.xr.x?s.x>o.x?s.x:o.x:r.x>o.x?r.x:o.x,u=s.y>r.y?s.y>o.y?s.y:o.y:r.y>o.y?r.y:o.y,h=Ll(a,l,e,t,i),d=Ll(c,u,e,t,i);let p=n.prevZ,g=n.nextZ;for(;p&&p.z>=h&&g&&g.z<=d;){if(p!==n.prev&&p!==n.next&&ds(s.x,s.y,r.x,r.y,o.x,o.y,p.x,p.y)&&Qe(p.prev,p,p.next)>=0||(p=p.prevZ,g!==n.prev&&g!==n.next&&ds(s.x,s.y,r.x,r.y,o.x,o.y,g.x,g.y)&&Qe(g.prev,g,g.next)>=0))return!1;g=g.nextZ}for(;p&&p.z>=h;){if(p!==n.prev&&p!==n.next&&ds(s.x,s.y,r.x,r.y,o.x,o.y,p.x,p.y)&&Qe(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;g&&g.z<=d;){if(g!==n.prev&&g!==n.next&&ds(s.x,s.y,r.x,r.y,o.x,o.y,g.x,g.y)&&Qe(g.prev,g,g.next)>=0)return!1;g=g.nextZ}return!0}function j1(n,e,t){let i=n;do{const s=i.prev,r=i.next.next;!mo(s,r)&&mf(s,i,i.next,r)&&tr(s,r)&&tr(r,s)&&(e.push(s.i/t),e.push(i.i/t),e.push(r.i/t),nr(i),nr(i.next),i=n=r),i=i.next}while(i!==n);return Xn(i)}function q1(n,e,t,i,s,r){let o=n;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&nA(o,a)){let l=gf(o,a);o=Xn(o,o.next),l=Xn(l,l.next),er(o,e,t,i,s,r),er(l,e,t,i,s,r);return}a=a.next}o=o.next}while(o!==n)}function X1(n,e,t,i){const s=[];let r,o,a,l,c;for(r=0,o=e.length;r=t.next.y&&t.next.y!==t.y){const d=t.x+(s-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(d<=i&&d>r){if(r=d,d===i){if(s===t.y)return t;if(s===t.next.y)return t.next}o=t.x=t.x&&t.x>=l&&i!==t.x&&ds(so.x||t.x===o.x&&K1(o,t)))&&(o=t,u=h)),t=t.next;while(t!==a);return o}function K1(n,e){return Qe(n.prev,n,e.prev)<0&&Qe(e.next,n,n.next)<0}function Q1(n,e,t,i){let s=n;do s.z===null&&(s.z=Ll(s.x,s.y,e,t,i)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==n);s.prevZ.nextZ=null,s.prevZ=null,eA(s)}function eA(n){let e,t,i,s,r,o,a,l,c=1;do{for(t=n,n=null,r=null,o=0;t;){for(o++,i=t,a=0,e=0;e0||l>0&&i;)a!==0&&(l===0||!i||t.z<=i.z)?(s=t,t=t.nextZ,a--):(s=i,i=i.nextZ,l--),r?r.nextZ=s:n=s,s.prevZ=r,r=s;t=i}r.nextZ=null,c*=2}while(o>1);return n}function Ll(n,e,t,i,s){return n=32767*(n-t)*s,e=32767*(e-i)*s,n=(n|n<<8)&16711935,n=(n|n<<4)&252645135,n=(n|n<<2)&858993459,n=(n|n<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,n|e<<1}function tA(n){let e=n,t=n;do(e.x=0&&(n-o)*(i-a)-(t-o)*(e-a)>=0&&(t-o)*(r-a)-(s-o)*(i-a)>=0}function nA(n,e){return n.next.i!==e.i&&n.prev.i!==e.i&&!iA(n,e)&&(tr(n,e)&&tr(e,n)&&sA(n,e)&&(Qe(n.prev,n,e.prev)||Qe(n,e.prev,e))||mo(n,e)&&Qe(n.prev,n,n.next)>0&&Qe(e.prev,e,e.next)>0)}function Qe(n,e,t){return(e.y-n.y)*(t.x-e.x)-(e.x-n.x)*(t.y-e.y)}function mo(n,e){return n.x===e.x&&n.y===e.y}function mf(n,e,t,i){const s=_o(Qe(n,e,t)),r=_o(Qe(n,e,i)),o=_o(Qe(t,i,n)),a=_o(Qe(t,i,e));return!!(s!==r&&o!==a||s===0&&go(n,t,e)||r===0&&go(n,i,e)||o===0&&go(t,n,i)||a===0&&go(t,e,i))}function go(n,e,t){return e.x<=Math.max(n.x,t.x)&&e.x>=Math.min(n.x,t.x)&&e.y<=Math.max(n.y,t.y)&&e.y>=Math.min(n.y,t.y)}function _o(n){return n>0?1:n<0?-1:0}function iA(n,e){let t=n;do{if(t.i!==n.i&&t.next.i!==n.i&&t.i!==e.i&&t.next.i!==e.i&&mf(t,t.next,n,e))return!0;t=t.next}while(t!==n);return!1}function tr(n,e){return Qe(n.prev,n,n.next)<0?Qe(n,e,n.next)>=0&&Qe(n,n.prev,e)>=0:Qe(n,e,n.prev)<0||Qe(n,n.next,e)<0}function sA(n,e){let t=n,i=!1;const s=(n.x+e.x)/2,r=(n.y+e.y)/2;do t.y>r!=t.next.y>r&&t.next.y!==t.y&&s<(t.next.x-t.x)*(r-t.y)/(t.next.y-t.y)+t.x&&(i=!i),t=t.next;while(t!==n);return i}function gf(n,e){const t=new Rl(n.i,n.x,n.y),i=new Rl(e.i,e.x,e.y),s=n.next,r=e.prev;return n.next=e,e.prev=n,t.next=s,s.prev=t,i.next=t,t.prev=i,r.next=i,i.prev=r,i}function _f(n,e,t,i){const s=new Rl(n,e,t);return i?(s.next=i.next,s.prev=i,i.next.prev=s,i.next=s):(s.prev=s,s.next=s),s}function nr(n){n.next.prev=n.prev,n.prev.next=n.next,n.prevZ&&(n.prevZ.nextZ=n.nextZ),n.nextZ&&(n.nextZ.prevZ=n.prevZ)}function Rl(n,e,t){this.i=n,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function rA(n,e,t,i){let s=0;for(let r=e,o=t-i;r2&&n[e-1].equals(n[0])&&n.pop()}function vf(n,e){for(let t=0;tNumber.EPSILON){const B=Math.sqrt(T),Q=Math.sqrt(Ze*Ze+Ye*Ye),se=j.x-we/B,ue=j.y+Ae/B,Re=ie.x-Ye/Q,$=ie.y+Ze/Q,be=((Re-se)*Ye-($-ue)*Ze)/(Ae*Ye-we*Ze);xe=se+Ae*be-X.x,le=ue+we*be-X.y;const me=xe*xe+le*le;if(me<=2)return new te(xe,le);Pe=Math.sqrt(me/2)}else{let B=!1;Ae>Number.EPSILON?Ze>Number.EPSILON&&(B=!0):Ae<-Number.EPSILON?Ze<-Number.EPSILON&&(B=!0):Math.sign(we)===Math.sign(Ye)&&(B=!0),B?(xe=-we,le=Ae,Pe=Math.sqrt(T)):(xe=Ae,le=we,Pe=Math.sqrt(T/2))}return new te(xe/Pe,le/Pe)}const N=[];for(let X=0,j=D.length,ie=j-1,xe=X+1;X=0;X--){const j=X/f,ie=p*Math.cos(j*Math.PI/2),xe=g*Math.sin(j*Math.PI/2)+m;for(let le=0,Pe=D.length;le=0;){const xe=ie;let le=ie-1;le<0&&(le=X.length-1);for(let Pe=0,Ae=u+f*2;Pe0!=e>0&&this.version++,this._sheen=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class xf extends Wt{constructor(e){super();this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new ge(16777215),this.specular=new ge(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ge(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=kr,this.normalScale=new te(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Dr,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class vo extends Wt{constructor(e){super();this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new ge(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ge(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Dr,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}function Yn(n,e,t){return bf(n)?new n.constructor(n.subarray(e,t!==void 0?t:n.length)):n.slice(e,t)}function xo(n,e,t){return!n||!t&&n.constructor===e?n:typeof e.BYTES_PER_ELEMENT=="number"?new e(n):Array.prototype.slice.call(n)}function bf(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}function lA(n){function e(s,r){return n[s]-n[r]}const t=n.length,i=new Array(t);for(let s=0;s!==t;++s)i[s]=s;return i.sort(e),i}function Mf(n,e,t){const i=n.length,s=new n.constructor(i);for(let r=0,o=0;o!==i;++r){const a=t[r]*e;for(let l=0;l!==e;++l)s[o++]=n[a+l]}return s}function Sf(n,e,t,i){let s=1,r=n[0];for(;r!==void 0&&r[i]===void 0;)r=n[s++];if(r===void 0)return;let o=r[i];if(o!==void 0)if(Array.isArray(o))do o=r[i],o!==void 0&&(e.push(r.time),t.push.apply(t,o)),r=n[s++];while(r!==void 0);else if(o.toArray!==void 0)do o=r[i],o!==void 0&&(e.push(r.time),o.toArray(t,t.length)),r=n[s++];while(r!==void 0);else do o=r[i],o!==void 0&&(e.push(r.time),t.push(o)),r=n[s++];while(r!==void 0)}class rr{constructor(e,t,i,s){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=s!==void 0?s:new t.constructor(i),this.sampleValues=t,this.valueSize=i,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let i=this._cachedIndex,s=t[i],r=t[i-1];e:{t:{let o;n:{i:if(!(e=r)){const a=t[1];e=r)break t}o=i,i=0;break n}break e}for(;i>>1;et;)--o;if(++o,r!==0||o!==s){r>=o&&(o=Math.max(o,1),r=o-1);const a=this.getValueSize();this.times=Yn(i,r,o),this.values=Yn(this.values,r*a,o*a)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const i=this.times,s=this.values,r=i.length;r===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let a=0;a!==r;a++){const l=i[a];if(typeof l=="number"&&isNaN(l)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,l),e=!1;break}if(o!==null&&o>l){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,l,o),e=!1;break}o=l}if(s!==void 0&&bf(s))for(let a=0,l=s.length;a!==l;++a){const c=s[a];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,c),e=!1;break}}return e}optimize(){const e=Yn(this.times),t=Yn(this.values),i=this.getValueSize(),s=this.getInterpolation()===La,r=e.length-1;let o=1;for(let a=1;a0){e[o]=e[r];for(let a=r*i,l=o*i,c=0;c!==i;++c)t[l+c]=t[a+c];++o}return o!==e.length?(this.times=Yn(e,0,o),this.values=Yn(t,0,o*i)):(this.times=e,this.values=t),this}clone(){const e=Yn(this.times,0),t=Yn(this.values,0),i=this.constructor,s=new i(this.name,e,t);return s.createInterpolant=this.createInterpolant,s}}fn.prototype.TimeBufferType=Float32Array,fn.prototype.ValueBufferType=Float32Array,fn.prototype.DefaultInterpolation=Hi;class ps extends fn{}ps.prototype.ValueTypeName="bool",ps.prototype.ValueBufferType=Array,ps.prototype.DefaultInterpolation=Bs,ps.prototype.InterpolantFactoryMethodLinear=void 0,ps.prototype.InterpolantFactoryMethodSmooth=void 0;class Cf extends fn{}Cf.prototype.ValueTypeName="color";class or extends fn{}or.prototype.ValueTypeName="number";class uA extends rr{constructor(e,t,i,s){super(e,t,i,s)}interpolate_(e,t,i,s){const r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=(i-t)/(s-t);let c=e*a;for(let u=c+a;c!==u;c+=4)tn.slerpFlat(r,0,o,c-a,o,c,l);return r}}class bi extends fn{InterpolantFactoryMethodLinear(e){return new uA(this.times,this.values,this.getValueSize(),e)}}bi.prototype.ValueTypeName="quaternion",bi.prototype.DefaultInterpolation=Hi,bi.prototype.InterpolantFactoryMethodSmooth=void 0;class fs extends fn{}fs.prototype.ValueTypeName="string",fs.prototype.ValueBufferType=Array,fs.prototype.DefaultInterpolation=Bs,fs.prototype.InterpolantFactoryMethodLinear=void 0,fs.prototype.InterpolantFactoryMethodSmooth=void 0;class ar extends fn{}ar.prototype.ValueTypeName="vector";class Pl{constructor(e,t=-1,i,s=Ra){this.name=e,this.tracks=i,this.duration=t,this.blendMode=s,this.uuid=Gt(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],i=e.tracks,s=1/(e.fps||1);for(let o=0,a=i.length;o!==a;++o)t.push(pA(i[o]).scale(s));const r=new this(e.name,e.duration,t,e.blendMode);return r.uuid=e.uuid,r}static toJSON(e){const t=[],i=e.tracks,s={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let r=0,o=i.length;r!==o;++r)t.push(fn.toJSON(i[r]));return s}static CreateFromMorphTargetSequence(e,t,i,s){const r=t.length,o=[];for(let a=0;a1){const h=u[1];let d=s[h];d||(s[h]=d=[]),d.push(c)}}const o=[];for(const a in s)o.push(this.CreateFromMorphTargetSequence(a,s[a],t,i));return o}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const i=function(h,d,p,g,m){if(p.length!==0){const f=[],_=[];Sf(p,f,_,g),f.length!==0&&m.push(new h(d,f,_))}},s=[],r=e.name||"default",o=e.fps||30,a=e.blendMode;let l=e.length||-1;const c=e.hierarchy||[];for(let h=0;h{t&&t(r),this.manager.itemEnd(e)},0),r;if(Tn[e]!==void 0){Tn[e].push({onLoad:t,onProgress:i,onError:s});return}Tn[e]=[],Tn[e].push({onLoad:t,onProgress:i,onError:s});const o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,l=this.responseType;fetch(o).then(c=>{if(c.status===200||c.status===0){if(c.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream=="undefined"||c.body===void 0||c.body.getReader===void 0)return c;const u=Tn[e],h=c.body.getReader(),d=c.headers.get("Content-Length"),p=d?parseInt(d):0,g=p!==0;let m=0;const f=new ReadableStream({start(_){v();function v(){h.read().then(({done:b,value:x})=>{if(b)_.close();else{m+=x.byteLength;const w=new ProgressEvent("progress",{lengthComputable:g,loaded:m,total:p});for(let C=0,L=u.length;C{switch(l){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then(u=>new DOMParser().parseFromString(u,a));case"json":return c.json();default:if(a===void 0)return c.text();{const h=/charset="?([^;"\s]*)"?/i.exec(a),d=h&&h[1]?h[1].toLowerCase():void 0,p=new TextDecoder(d);return c.arrayBuffer().then(g=>p.decode(g))}}}).then(c=>{Mi.add(e,c);const u=Tn[e];delete Tn[e];for(let h=0,d=u.length;h{const u=Tn[e];if(u===void 0)throw this.manager.itemError(e),c;delete Tn[e];for(let h=0,d=u.length;h{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class mA extends Jn{constructor(e){super(e)}load(e,t,i,s){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const r=this,o=Mi.get(e);if(o!==void 0)return r.manager.itemStart(e),setTimeout(function(){t&&t(o),r.manager.itemEnd(e)},0),o;const a=Gs("img");function l(){u(),Mi.add(e,this),t&&t(this),r.manager.itemEnd(e)}function c(h){u(),s&&s(h),r.manager.itemError(e),r.manager.itemEnd(e)}function u(){a.removeEventListener("load",l,!1),a.removeEventListener("error",c,!1)}return a.addEventListener("load",l,!1),a.addEventListener("error",c,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(a.crossOrigin=this.crossOrigin),r.manager.itemStart(e),a.src=e,a}}class gA extends Jn{constructor(e){super(e)}load(e,t,i,s){const r=this,o=new ml,a=new gs(this.manager);return a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setPath(this.path),a.setWithCredentials(r.withCredentials),a.load(e,function(l){const c=r.parse(l);!c||(c.image!==void 0?o.image=c.image:c.data!==void 0&&(o.image.width=c.width,o.image.height=c.height,o.image.data=c.data),o.wrapS=c.wrapS!==void 0?c.wrapS:Et,o.wrapT=c.wrapT!==void 0?c.wrapT:Et,o.magFilter=c.magFilter!==void 0?c.magFilter:Je,o.minFilter=c.minFilter!==void 0?c.minFilter:Je,o.anisotropy=c.anisotropy!==void 0?c.anisotropy:1,c.encoding!==void 0&&(o.encoding=c.encoding),c.flipY!==void 0&&(o.flipY=c.flipY),c.format!==void 0&&(o.format=c.format),c.type!==void 0&&(o.type=c.type),c.mipmaps!==void 0&&(o.mipmaps=c.mipmaps,o.minFilter=oi),c.mipmapCount===1&&(o.minFilter=Je),c.generateMipmaps!==void 0&&(o.generateMipmaps=c.generateMipmaps),o.needsUpdate=!0,t&&t(o,c))},i,s),o}}class Tf extends Jn{constructor(e){super(e)}load(e,t,i,s){const r=new _t,o=new mA(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,function(a){r.image=a,r.needsUpdate=!0,t!==void 0&&t(r)},i,s),r}}class _s extends rt{constructor(e,t=1){super();this.isLight=!0,this.type="Light",this.color=new ge(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),t}}class Ef extends _s{constructor(e,t,i){super(e,i);this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(rt.DefaultUp),this.updateMatrix(),this.groundColor=new ge(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}}const Lf=new Me,Rf=new E,Pf=new E;class Il{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new te(512,512),this.map=null,this.mapPass=null,this.matrix=new Me,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new ro,this._frameExtents=new te(1,1),this._viewportCount=1,this._viewports=[new je(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,i=this.matrix;Rf.setFromMatrixPosition(e.matrixWorld),t.position.copy(Rf),Pf.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(Pf),t.updateMatrixWorld(),Lf.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Lf),i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(t.projectionMatrix),i.multiply(t.matrixWorldInverse)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class _A extends Il{constructor(){super(new St(50,1,.5,500));this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,i=Us*2*e.angle*this.focus,s=this.mapSize.width/this.mapSize.height,r=e.distance||t.far;(i!==t.fov||s!==t.aspect||r!==t.far)&&(t.fov=i,t.aspect=s,t.far=r,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class Dl extends _s{constructor(e,t,i=0,s=Math.PI/3,r=0,o=1){super(e,t);this.isSpotLight=!0,this.type="SpotLight",this.position.copy(rt.DefaultUp),this.updateMatrix(),this.target=new rt,this.distance=i,this.angle=s,this.penumbra=r,this.decay=o,this.shadow=new _A}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}const If=new Me,lr=new E,Fl=new E;class yA extends Il{constructor(){super(new St(90,1,.5,500));this.isPointLightShadow=!0,this._frameExtents=new te(4,2),this._viewportCount=6,this._viewports=[new je(2,1,1,1),new je(0,1,1,1),new je(3,1,1,1),new je(1,1,1,1),new je(3,0,1,1),new je(1,0,1,1)],this._cubeDirections=[new E(1,0,0),new E(-1,0,0),new E(0,0,1),new E(0,0,-1),new E(0,1,0),new E(0,-1,0)],this._cubeUps=[new E(0,1,0),new E(0,1,0),new E(0,1,0),new E(0,1,0),new E(0,0,1),new E(0,0,-1)]}updateMatrices(e,t=0){const i=this.camera,s=this.matrix,r=e.distance||i.far;r!==i.far&&(i.far=r,i.updateProjectionMatrix()),lr.setFromMatrixPosition(e.matrixWorld),i.position.copy(lr),Fl.copy(i.position),Fl.add(this._cubeDirections[t]),i.up.copy(this._cubeUps[t]),i.lookAt(Fl),i.updateMatrixWorld(),s.makeTranslation(-lr.x,-lr.y,-lr.z),If.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),this._frustum.setFromProjectionMatrix(If)}}class Ol extends _s{constructor(e,t,i=0,s=1){super(e,t);this.isPointLight=!0,this.type="PointLight",this.distance=i,this.decay=s,this.shadow=new yA}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}class vA extends Il{constructor(){super(new ls(-5,5,5,-5,.5,500));this.isDirectionalLightShadow=!0}}class Nl extends _s{constructor(e,t){super(e,t);this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(rt.DefaultUp),this.updateMatrix(),this.target=new rt,this.shadow=new vA}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class Df extends _s{constructor(e,t){super(e,t);this.isAmbientLight=!0,this.type="AmbientLight"}}class xA extends _s{constructor(e,t,i=10,s=10){super(e,t);this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=i,this.height=s}get power(){return this.intensity*this.width*this.height*Math.PI}set power(e){this.intensity=e/(this.width*this.height*Math.PI)}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){const t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}}class Si{static decodeText(e){if(typeof TextDecoder!="undefined")return new TextDecoder().decode(e);let t="";for(let i=0,s=e.length;i0&&this._mixBufferRegionAdditive(i,s,this._addIndex*t,1,t);for(let l=t,c=t+t;l!==c;++l)if(i[l]!==i[l+t]){a.setValue(i,s);break}}saveOriginalState(){const e=this.binding,t=this.buffer,i=this.valueSize,s=i*this._origIndex;e.getValue(t,s);for(let r=i,o=s;r!==o;++r)t[r]=t[s+r%i];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let i=e;i=.5)for(let o=0;o!==r;++o)e[t+o]=e[i+o]}_slerp(e,t,i,s){tn.slerpFlat(e,t,e,t,e,i,s)}_slerpAdditive(e,t,i,s,r){const o=this._workIndex*r;tn.multiplyQuaternionsFlat(e,o,e,t,e,i),tn.slerpFlat(e,t,e,t,e,o,s)}_lerp(e,t,i,s,r){const o=1-s;for(let a=0;a!==r;++a){const l=t+a;e[l]=e[l]*o+e[i+a]*s}}_lerpAdditive(e,t,i,s,r){for(let o=0;o!==r;++o){const a=t+o;e[a]=e[a]+e[i+o]*s}}}const kl="\\[\\]\\.:\\/",SA=new RegExp("["+kl+"]","g"),Bl="[^"+kl+"]",wA="[^"+kl.replace("\\.","")+"]",CA=/((?:WC+[\/:])*)/.source.replace("WC",Bl),AA=/(WCOD+)?/.source.replace("WCOD",wA),TA=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Bl),EA=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Bl),LA=new RegExp("^"+CA+AA+TA+EA+"$"),RA=["material","materials","bones"];class PA{constructor(e,t,i){const s=i||qe.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,s)}getValue(e,t){this.bind();const i=this._targetGroup.nCachedObjects_,s=this._bindings[i];s!==void 0&&s.getValue(e,t)}setValue(e,t){const i=this._bindings;for(let s=this._targetGroup.nCachedObjects_,r=i.length;s!==r;++s)i[s].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].unbind()}}class qe{constructor(e,t,i){this.path=t,this.parsedPath=i||qe.parseTrackName(t),this.node=qe.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,i){return e&&e.isAnimationObjectGroup?new qe.Composite(e,t,i):new qe(e,t,i)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(SA,"")}static parseTrackName(e){const t=LA.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const i={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},s=i.nodeName&&i.nodeName.lastIndexOf(".");if(s!==void 0&&s!==-1){const r=i.nodeName.substring(s+1);RA.indexOf(r)!==-1&&(i.nodeName=i.nodeName.substring(0,s),i.objectName=r)}if(i.propertyName===null||i.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return i}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const i=e.skeleton.getBoneByName(t);if(i!==void 0)return i}if(e.children){const i=function(r){for(let o=0;o0){const l=this._interpolants,c=this._propertyBindings;switch(this.blendMode){case sb:for(let u=0,h=l.length;u!==h;++u)l[u].evaluate(o),c[u].accumulateAdditive(a);break;case Ra:default:for(let u=0,h=l.length;u!==h;++u)l[u].evaluate(o),c[u].accumulate(s,a)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const i=this._weightInterpolant;if(i!==null){const s=i.evaluate(e)[0];t*=s,e>i.parameterPositions[1]&&(this.stopFading(),s===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const i=this._timeScaleInterpolant;i!==null&&(t*=i.evaluate(e)[0],e>i.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t))}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,i=this.loop;let s=this.time+e,r=this._loopCount;const o=i===ib;if(e===0)return r===-1?s:o&&(r&1)==1?t-s:s;if(i===tb){r===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(s>=t)s=t;else if(s<0)s=0;else{this.time=s;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=s,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(r===-1&&(e>=0?(r=0,this._setEndings(!0,this.repetitions===0,o)):this._setEndings(this.repetitions===0,!0,o)),s>=t||s<0){const a=Math.floor(s/t);s-=t*a,r+=Math.abs(a);const l=this.repetitions-r;if(l<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,s=e>0?t:0,this.time=s,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(l===1){const c=e<0;this._setEndings(c,!c,o)}else this._setEndings(!1,!1,o);this._loopCount=r,this.time=s,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}else this.time=s;if(o&&(r&1)==1)return t-s}return s}_setEndings(e,t,i){const s=this._interpolantSettings;i?(s.endingStart=ji,s.endingEnd=ji):(e?s.endingStart=this.zeroSlopeAtStart?ji:Wi:s.endingStart=Nr,t?s.endingEnd=this.zeroSlopeAtEnd?ji:Wi:s.endingEnd=Nr)}_scheduleFading(e,t,i){const s=this._mixer,r=s.time;let o=this._weightInterpolant;o===null&&(o=s._lendControlInterpolant(),this._weightInterpolant=o);const a=o.parameterPositions,l=o.sampleValues;return a[0]=r,l[0]=t,a[1]=r+e,l[1]=i,this}}const DA=new Float32Array(1);class FA extends ui{constructor(e){super();this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const i=e._localRoot||this._root,s=e._clip.tracks,r=s.length,o=e._propertyBindings,a=e._interpolants,l=i.uuid,c=this._bindingsByRootAndName;let u=c[l];u===void 0&&(u={},c[l]=u);for(let h=0;h!==r;++h){const d=s[h],p=d.name;let g=u[p];if(g!==void 0)++g.referenceCount,o[h]=g;else{if(g=o[h],g!==void 0){g._cacheIndex===null&&(++g.referenceCount,this._addInactiveBinding(g,l,p));continue}const m=t&&t._propertyBindings[h].binding.parsedPath;g=new MA(qe.create(i,p,m),d.ValueTypeName,d.getValueSize()),++g.referenceCount,this._addInactiveBinding(g,l,p),o[h]=g}a[h].resultBuffer=g.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const i=(e._localRoot||this._root).uuid,s=e._clip.uuid,r=this._actionsByClip[s];this._bindAction(e,r&&r.knownActions[0]),this._addInactiveAction(e,s,i)}const t=e._propertyBindings;for(let i=0,s=t.length;i!==s;++i){const r=t[i];r.useCount++==0&&(this._lendBinding(r),r.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let i=0,s=t.length;i!==s;++i){const r=t[i];--r.useCount==0&&(r.restoreOriginalState(),this._takeBackBinding(r))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return t!==null&&t=0;--i)e[i].stop();return this}update(e){e*=this.timeScale;const t=this._actions,i=this._nActiveActions,s=this.time+=e,r=Math.sign(e),o=this._accuIndex^=1;for(let c=0;c!==i;++c)t[c]._update(s,e,r,o);const a=this._bindings,l=this._nActiveBindings;for(let c=0;c!==l;++c)a[c].apply(o);return this}setTime(e){this.time=0;for(let t=0;t>-c-14,i[l|256]=1024>>-c-14|32768,s[l]=-c-1,s[l|256]=-c-1):c<=15?(i[l]=c+15<<10,i[l|256]=c+15<<10|32768,s[l]=13,s[l|256]=13):c<128?(i[l]=31744,i[l|256]=64512,s[l]=24,s[l|256]=24):(i[l]=31744,i[l|256]=64512,s[l]=13,s[l|256]=13)}const r=new Uint32Array(2048),o=new Uint32Array(64),a=new Uint32Array(64);for(let l=1;l<1024;++l){let c=l<<13,u=0;for(;(c&8388608)==0;)c<<=1,u-=8388608;c&=~8388608,u+=947912704,r[l]=c|u}for(let l=1024;l<2048;++l)r[l]=939524096+(l-1024<<13);for(let l=1;l<31;++l)o[l]=l<<23;o[31]=1199570944,o[32]=2147483648;for(let l=33;l<63;++l)o[l]=2147483648+(l-32<<23);o[63]=3347054592;for(let l=1;l<64;++l)l!==32&&(a[l]=1024);return{floatView:e,uint32View:t,baseTable:i,shiftTable:s,mantissaTable:r,exponentTable:o,offsetTable:a}}function BA(n){Math.abs(n)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),n=lt(n,-65504,65504),En.floatView[0]=n;const e=En.uint32View[0],t=e>>23&511;return En.baseTable[t]+((e&8388607)>>En.shiftTable[t])}function $A(n){const e=n>>10;return En.uint32View[0]=En.mantissaTable[En.offsetTable[e]+(n&1023)]+En.exponentTable[e],En.floatView[0]}var bo=Object.freeze({__proto__:null,toHalfFloat:BA,fromHalfFloat:$A});typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:va}})),typeof window!="undefined"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=va);class UA extends gA{constructor(e){super(e);this.type=Zt}parse(e){const t=-1,i=1,s=2,r=3,o=4,a=function(b,x){switch(b){case i:console.error("THREE.RGBELoader Read Error: "+(x||""));break;case s:console.error("THREE.RGBELoader Write Error: "+(x||""));break;case r:console.error("THREE.RGBELoader Bad File Format: "+(x||""));break;default:case o:console.error("THREE.RGBELoader: Error: "+(x||""))}return t},l=1,c=2,u=4,h=` `,d=function(b,x,w){const C=128;x=x||1024;let L=b.pos,y=-1,A=0,I="",R=String.fromCharCode.apply(null,new Uint16Array(b.subarray(L,L+C)));for(;0>(y=R.indexOf(h))&&A=b.byteLength||!(I=d(b)))return a(i,"no header found");if(!(R=I.match(x)))return a(r,"bad initial token");for(A.valid|=l,A.programtype=R[1],A.string+=I+` `;I=d(b),I!==!1;){if(A.string+=I+` `,I.charAt(0)==="#"){A.comments+=I+` `;continue}if((R=I.match(w))&&(A.gamma=parseFloat(R[1])),(R=I.match(C))&&(A.exposure=parseFloat(R[1])),(R=I.match(L))&&(A.valid|=c,A.format=R[1]),(R=I.match(y))&&(A.valid|=u,A.height=parseInt(R[1],10),A.width=parseInt(R[2],10)),A.valid&c&&A.valid&u)break}return A.valid&c?A.valid&u?A:a(r,"missing image size specifier"):a(r,"missing format specifier")},g=function(b,x,w){const C=x;if(C<8||C>32767||b[0]!==2||b[1]!==2||b[2]&128)return new Uint8Array(b);if(C!==(b[2]<<8|b[3]))return a(r,"wrong scanline width");const L=new Uint8Array(4*x*w);if(!L.length)return a(o,"unable to allocate buffer space");let y=0,A=0;const I=4*C,R=new Uint8Array(4),Z=new Uint8Array(I);let K=w;for(;K>0&&Ab.byteLength)return a(i);if(R[0]=b[A++],R[1]=b[A++],R[2]=b[A++],R[3]=b[A++],R[0]!=2||R[1]!=2||(R[2]<<8|R[3])!=C)return a(r,"bad rgbe scanline format");let D=0,z;for(;D128;if(W&&(z-=128),z===0||D+z>I)return a(r,"bad scanline data");if(W){const H=b[A++];for(let N=0;N=2.0 are supported."));return}const c=new vT(l,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let u=0;u=0&&a[h]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+h+'".')}}c.setExtensions(o),c.setPlugins(a),c.parse(i,s)}parseAsync(e,t){const i=this;return new Promise(function(s,r){i.parse(e,t,s,r)})}}function jA(){let n={};return{get:function(e){return n[e]},add:function(e,t){n[e]=t},remove:function(e){delete n[e]},removeAll:function(){n={}}}}const Be={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:"KHR_materials_pbrSpecularGlossiness",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression"};class qA{constructor(e){this.parser=e,this.name=Be.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let i=0,s=t.length;i=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,r.source,o)}}class sT{constructor(e){this.parser=e,this.name=Be.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,i=this.parser,s=i.json,r=s.textures[e];if(!r.extensions||!r.extensions[t])return null;const o=r.extensions[t],a=s.images[o.source];let l=i.textureLoader;if(a.uri){const c=i.options.manager.getHandler(a.uri);c!==null&&(l=c)}return this.detectSupport().then(function(c){if(c)return i.loadTextureImage(e,o.source,l);if(s.extensionsRequired&&s.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return i.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class rT{constructor(e){this.name=Be.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,i=t.bufferViews[e];if(i.extensions&&i.extensions[this.name]){const s=i.extensions[this.name],r=this.parser.getDependency("buffer",s.buffer),o=this.parser.options.meshoptDecoder;if(!o||!o.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return Promise.all([r,o.ready]).then(function(a){const l=s.byteOffset||0,c=s.byteLength||0,u=s.count,h=s.byteStride,d=new ArrayBuffer(u*h),p=new Uint8Array(a[0],l,c);return o.decodeGltfBuffer(new Uint8Array(d),u,h,p,s.mode,s.filter),d})}else return null}}const Gf="glTF",hr=12,Vf={JSON:1313821514,BIN:5130562};class oT{constructor(e){this.name=Be.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,hr);if(this.header={magic:Si.decodeText(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==Gf)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const i=this.header.length-hr,s=new DataView(e,hr);let r=0;for(;r",t).replace("#include ",i).replace("#include ",s).replace("#include ",r).replace("#include ",o)},Object.defineProperties(this,{specular:{get:function(){return a.specular.value},set:function(l){a.specular.value=l}},specularMap:{get:function(){return a.specularMap.value},set:function(l){a.specularMap.value=l,l?this.defines.USE_SPECULARMAP="":delete this.defines.USE_SPECULARMAP}},glossiness:{get:function(){return a.glossiness.value},set:function(l){a.glossiness.value=l}},glossinessMap:{get:function(){return a.glossinessMap.value},set:function(l){a.glossinessMap.value=l,l?(this.defines.USE_GLOSSINESSMAP="",this.defines.USE_UV=""):(delete this.defines.USE_GLOSSINESSMAP,delete this.defines.USE_UV)}}}),delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this.setValues(e)}copy(e){return super.copy(e),this.specularMap=e.specularMap,this.specular.copy(e.specular),this.glossinessMap=e.glossinessMap,this.glossiness=e.glossiness,delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this}}class cT{constructor(){this.name=Be.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS,this.specularGlossinessParams=["color","map","lightMap","lightMapIntensity","aoMap","aoMapIntensity","emissive","emissiveIntensity","emissiveMap","bumpMap","bumpScale","normalMap","normalMapType","displacementMap","displacementScale","displacementBias","specularMap","specular","glossinessMap","glossiness","alphaMap","envMap","envMapIntensity"]}getMaterialType(){return zl}extendParams(e,t,i){const s=t.extensions[this.name];e.color=new ge(1,1,1),e.opacity=1;const r=[];if(Array.isArray(s.diffuseFactor)){const o=s.diffuseFactor;e.color.fromArray(o),e.opacity=o[3]}if(s.diffuseTexture!==void 0&&r.push(i.assignTexture(e,"map",s.diffuseTexture,We)),e.emissive=new ge(0,0,0),e.glossiness=s.glossinessFactor!==void 0?s.glossinessFactor:1,e.specular=new ge(1,1,1),Array.isArray(s.specularFactor)&&e.specular.fromArray(s.specularFactor),s.specularGlossinessTexture!==void 0){const o=s.specularGlossinessTexture;r.push(i.assignTexture(e,"glossinessMap",o)),r.push(i.assignTexture(e,"specularMap",o,We))}return Promise.all(r)}createMaterial(e){const t=new zl(e);return t.fog=!0,t.color=e.color,t.map=e.map===void 0?null:e.map,t.lightMap=null,t.lightMapIntensity=1,t.aoMap=e.aoMap===void 0?null:e.aoMap,t.aoMapIntensity=1,t.emissive=e.emissive,t.emissiveIntensity=e.emissiveIntensity===void 0?1:e.emissiveIntensity,t.emissiveMap=e.emissiveMap===void 0?null:e.emissiveMap,t.bumpMap=e.bumpMap===void 0?null:e.bumpMap,t.bumpScale=1,t.normalMap=e.normalMap===void 0?null:e.normalMap,t.normalMapType=kr,e.normalScale&&(t.normalScale=e.normalScale),t.displacementMap=null,t.displacementScale=1,t.displacementBias=0,t.specularMap=e.specularMap===void 0?null:e.specularMap,t.specular=e.specular,t.glossinessMap=e.glossinessMap===void 0?null:e.glossinessMap,t.glossiness=e.glossiness,t.alphaMap=null,t.envMap=e.envMap===void 0?null:e.envMap,t.envMapIntensity=1,t}}class hT{constructor(){this.name=Be.KHR_MESH_QUANTIZATION}}class Hf extends rr{constructor(e,t,i,s){super(e,t,i,s)}copySampleValue_(e){const t=this.resultBuffer,i=this.sampleValues,s=this.valueSize,r=e*s*3+s;for(let o=0;o!==s;o++)t[o]=i[r+o];return t}interpolate_(e,t,i,s){const r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=a*2,c=a*3,u=s-t,h=(i-t)/u,d=h*h,p=d*h,g=e*c,m=g-c,f=-2*p+3*d,_=p-d,v=1-f,b=_-d+h;for(let x=0;x!==a;x++){const w=o[m+x+a],C=o[m+x+l]*u,L=o[g+x+a],y=o[g+x]*u;r[x]=v*w+b*C+f*L+_*y}return r}}const uT=new tn;class dT extends Hf{interpolate_(e,t,i,s){const r=super.interpolate_(e,t,i,s);return uT.fromArray(r).normalize().toArray(r),r}}const Ln={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},ur={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},Wf={9728:gt,9729:Je,9984:Sa,9985:Sd,9986:wa,9987:oi},jf={33071:Et,33648:Or,10497:ri},qf={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Gl={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},Zn={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},pT={CUBICSPLINE:void 0,LINEAR:Hi,STEP:Bs},Vl={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function fT(n){return n.DefaultMaterial===void 0&&(n.DefaultMaterial=new yo({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:ki})),n.DefaultMaterial}function dr(n,e,t){for(const i in t.extensions)n[i]===void 0&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[i]=t.extensions[i])}function wi(n,e){e.extras!==void 0&&(typeof e.extras=="object"?Object.assign(n.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function mT(n,e,t){let i=!1,s=!1,r=!1;for(let c=0,u=e.length;c0||n.search(/^data\:image\/jpeg/)===0?"image/jpeg":n.search(/\.webp($|\?)/i)>0||n.search(/^data\:image\/webp/)===0?"image/webp":"image/png"}class vT{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new jA,this.associations=new Map,this.primitiveCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};const i=/^((?!chrome|android).)*safari/i.test(navigator.userAgent)===!0,s=navigator.userAgent.indexOf("Firefox")>-1,r=s?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1;typeof createImageBitmap=="undefined"||i||s&&r<98?this.textureLoader=new Tf(this.options.manager):this.textureLoader=new bA(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new gs(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const i=this,s=this.json,r=this.extensions;this.cache.removeAll(),this._invokeAll(function(o){return o._markDefs&&o._markDefs()}),Promise.all(this._invokeAll(function(o){return o.beforeRoot&&o.beforeRoot()})).then(function(){return Promise.all([i.getDependencies("scene"),i.getDependencies("animation"),i.getDependencies("camera")])}).then(function(o){const a={scene:o[0][s.scene||0],scenes:o[0],animations:o[1],cameras:o[2],asset:s.asset,parser:i,userData:{}};dr(r,a,s),wi(a,s),Promise.all(i._invokeAll(function(l){return l.afterRoot&&l.afterRoot(a)})).then(function(){e(a)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],i=this.json.meshes||[];for(let s=0,r=t.length;s{const l=this.associations.get(o);l!=null&&this.associations.set(a,l);for(const[c,u]of o.children.entries())r(u,a.children[c])};return r(i,s),s.name+="_instance_"+e.uses[t]++,s}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let i=0;i=2&&f.setY(A,C[L*l+1]),l>=3&&f.setZ(A,C[L*l+2]),l>=4&&f.setW(A,C[L*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return f})}loadTexture(e){const t=this.json,i=this.options,r=t.textures[e].source,o=t.images[r];let a=this.textureLoader;if(o.uri){const l=i.manager.getHandler(o.uri);l!==null&&(a=l)}return this.loadTextureImage(e,r,a)}loadTextureImage(e,t,i){const s=this,r=this.json,o=r.textures[e],a=r.images[t],l=(a.uri||a.bufferView)+":"+o.sampler;if(this.textureCache[l])return this.textureCache[l];const c=this.loadImageSource(t,i).then(function(u){u.flipY=!1,o.name&&(u.name=o.name);const d=(r.samplers||{})[o.sampler]||{};return u.magFilter=Wf[d.magFilter]||Je,u.minFilter=Wf[d.minFilter]||oi,u.wrapS=jf[d.wrapS]||ri,u.wrapT=jf[d.wrapT]||ri,s.associations.set(u,{textures:e}),u}).catch(function(){return null});return this.textureCache[l]=c,c}loadImageSource(e,t){const i=this,s=this.json,r=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(h=>h.clone());const o=s.images[e],a=self.URL||self.webkitURL;let l=o.uri||"",c=!1;if(o.bufferView!==void 0)l=i.getDependency("bufferView",o.bufferView).then(function(h){c=!0;const d=new Blob([h],{type:o.mimeType});return l=a.createObjectURL(d),l});else if(o.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const u=Promise.resolve(l).then(function(h){return new Promise(function(d,p){let g=d;t.isImageBitmapLoader===!0&&(g=function(m){const f=new _t(m);f.needsUpdate=!0,d(f)}),t.load(Si.resolveURL(h,r.path),g,void 0,p)})}).then(function(h){return c===!0&&a.revokeObjectURL(l),h.userData.mimeType=o.mimeType||yT(o.uri),h}).catch(function(h){throw console.error("THREE.GLTFLoader: Couldn't load texture",l),h});return this.sourceCache[e]=u,u}assignTexture(e,t,i,s){const r=this;return this.getDependency("texture",i.index).then(function(o){if(i.texCoord!==void 0&&i.texCoord!=0&&!(t==="aoMap"&&i.texCoord==1)&&console.warn("THREE.GLTFLoader: Custom UV set "+i.texCoord+" for texture "+t+" not yet supported."),r.extensions[Be.KHR_TEXTURE_TRANSFORM]){const a=i.extensions!==void 0?i.extensions[Be.KHR_TEXTURE_TRANSFORM]:void 0;if(a){const l=r.associations.get(o);o=r.extensions[Be.KHR_TEXTURE_TRANSFORM].extendTexture(o,a),r.associations.set(o,l)}}return s!==void 0&&(o.encoding=s),e[t]=o,o})}assignFinalMaterial(e){const t=e.geometry;let i=e.material;const s=t.attributes.tangent===void 0,r=t.attributes.color!==void 0,o=t.attributes.normal===void 0;if(e.isPoints){const a="PointsMaterial:"+i.uuid;let l=this.cache.get(a);l||(l=new xl,Wt.prototype.copy.call(l,i),l.color.copy(i.color),l.map=i.map,l.sizeAttenuation=!1,this.cache.add(a,l)),i=l}else if(e.isLine){const a="LineBasicMaterial:"+i.uuid;let l=this.cache.get(a);l||(l=new _l,Wt.prototype.copy.call(l,i),l.color.copy(i.color),this.cache.add(a,l)),i=l}if(s||r||o){let a="ClonedMaterial:"+i.uuid+":";i.isGLTFSpecularGlossinessMaterial&&(a+="specular-glossiness:"),s&&(a+="derivative-tangents:"),r&&(a+="vertex-colors:"),o&&(a+="flat-shading:");let l=this.cache.get(a);l||(l=i.clone(),r&&(l.vertexColors=!0),o&&(l.flatShading=!0),s&&(l.normalScale&&(l.normalScale.y*=-1),l.clearcoatNormalScale&&(l.clearcoatNormalScale.y*=-1)),this.cache.add(a,l),this.associations.set(l,this.associations.get(i))),i=l}i.aoMap&&t.attributes.uv2===void 0&&t.attributes.uv!==void 0&&t.setAttribute("uv2",t.attributes.uv),e.material=i}getMaterialType(){return yo}loadMaterial(e){const t=this,i=this.json,s=this.extensions,r=i.materials[e];let o;const a={},l=r.extensions||{},c=[];if(l[Be.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]){const h=s[Be.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS];o=h.getMaterialType(),c.push(h.extendParams(a,r,t))}else if(l[Be.KHR_MATERIALS_UNLIT]){const h=s[Be.KHR_MATERIALS_UNLIT];o=h.getMaterialType(),c.push(h.extendParams(a,r,t))}else{const h=r.pbrMetallicRoughness||{};if(a.color=new ge(1,1,1),a.opacity=1,Array.isArray(h.baseColorFactor)){const d=h.baseColorFactor;a.color.fromArray(d),a.opacity=d[3]}h.baseColorTexture!==void 0&&c.push(t.assignTexture(a,"map",h.baseColorTexture,We)),a.metalness=h.metallicFactor!==void 0?h.metallicFactor:1,a.roughness=h.roughnessFactor!==void 0?h.roughnessFactor:1,h.metallicRoughnessTexture!==void 0&&(c.push(t.assignTexture(a,"metalnessMap",h.metallicRoughnessTexture)),c.push(t.assignTexture(a,"roughnessMap",h.metallicRoughnessTexture))),o=this._invokeOne(function(d){return d.getMaterialType&&d.getMaterialType(e)}),c.push(Promise.all(this._invokeAll(function(d){return d.extendMaterialParams&&d.extendMaterialParams(e,a)})))}r.doubleSided===!0&&(a.side=Jt);const u=r.alphaMode||Vl.OPAQUE;if(u===Vl.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,u===Vl.MASK&&(a.alphaTest=r.alphaCutoff!==void 0?r.alphaCutoff:.5)),r.normalTexture!==void 0&&o!==gi&&(c.push(t.assignTexture(a,"normalMap",r.normalTexture)),a.normalScale=new te(1,1),r.normalTexture.scale!==void 0)){const h=r.normalTexture.scale;a.normalScale.set(h,h)}return r.occlusionTexture!==void 0&&o!==gi&&(c.push(t.assignTexture(a,"aoMap",r.occlusionTexture)),r.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=r.occlusionTexture.strength)),r.emissiveFactor!==void 0&&o!==gi&&(a.emissive=new ge().fromArray(r.emissiveFactor)),r.emissiveTexture!==void 0&&o!==gi&&c.push(t.assignTexture(a,"emissiveMap",r.emissiveTexture,We)),Promise.all(c).then(function(){let h;return o===zl?h=s[Be.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(a):h=new o(a),r.name&&(h.name=r.name),wi(h,r),t.associations.set(h,{materials:e}),r.extensions&&dr(s,h,r),h})}createUniqueName(e){const t=qe.sanitizeNodeName(e||"");let i=t;for(let s=1;this.nodeNamesUsed[i];++s)i=t+"_"+s;return this.nodeNamesUsed[i]=!0,i}loadGeometries(e){const t=this,i=this.extensions,s=this.primitiveCache;function r(a){return i[Be.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,t).then(function(l){return Jf(l,a,t)})}const o=[];for(let a=0,l=e.length;a0&&gT(_,r),_.name=t.createUniqueName(r.name||"mesh_"+e),wi(_,r),f.extensions&&dr(s,_,f),t.assignFinalMaterial(_),h.push(_)}for(let p=0,g=h.length;p1?l=new rn:a.length===1?l=a[0]:l=new rt,l!==a[0])for(let c=0,u=a.length;c{const h=new Map;for(const[d,p]of r.associations)(d instanceof Wt||d instanceof _t)&&h.set(d,p);return u.traverse(d=>{const p=r.associations.get(d);p!=null&&h.set(d,p)}),h};return r.associations=c(o),o})}}function Yf(n,e,t,i){const s=t.nodes[n];return i.getDependency("node",n).then(function(r){if(s.skin===void 0)return r;let o;return i.getDependency("skin",s.skin).then(function(a){o=a;const l=[];for(let c=0,u=o.joints.length;c0){for(let s=0;s0)for(let s=0;s{Qf(e)})}function Qf(n){const e=i=>{i.geometry&&i.geometry.dispose(),i.material&&i.material.dispose&&i.material.dispose(),i.material.texture&&i.material.texture.dispose&&i.material.texture.dispose()},t=i=>{let s=i.children.filter(r=>r);s.forEach(r=>{r.children.length?t(r):r.isMesh&&e(r)}),s=null};t(n)}class MT extends Kf{constructor(e,t){super(),this.frameTimer=-1,this.needsUpdate=!1,t=t||{},this.customCoords=e.customCoords,this.center=t.customCoordsCenter||e.getCenter().toArray(),this.customCoords.lngLatsToCoords([this.center]);const i={zooms:[2,20],opacity:1,alpha:!1,antialias:!1,visible:!0,zIndex:120};this.options=Object.assign({},i,t),this.map=e,this.init()}init(){const e=this.map,t=this.options,i={zooms:t.zooms,opacity:t.opacity,visible:t.visible,zIndex:t.zIndex,init:s=>{const r=e.getContainer(),o=r.offsetWidth,a=r.offsetHeight;let l;e.getView().type==="3D"?l=new St(60,o/a,100,1<<30):l=new ls(o/-2,o/2,a/2,a/-2,1,1e3);const c=new Gp({context:s,alpha:t.alpha,antialias:t.antialias});c.setSize(o,a),c.autoClear=!1;const u=new b1;this.camera=l,this.renderer=c,this.scene=u,t.onInit&&t.onInit(c,u,l),this.animate(),this.emit("complete")},render:()=>{var s,r,o;(s=this.renderer)===null||s===void 0||s.resetState(),this.customCoords.setCenter(this.center);const a=this.camera;if(e.getView().type==="3D"){const{near:l,far:c,fov:u,up:h,lookAt:d,position:p}=this.customCoords.getCameraParams();a.near=l,a.far=c,a.fov=u,a.position.set(...p),a.up.set(...h),a.lookAt(...d),a.updateProjectionMatrix()}else{const{top:l,bottom:c,left:u,right:h,position:d}=this.customCoords.getCameraParams();a.top=l,a.bottom=c,a.left=u,a.right=h,a.position.set(...d),a.updateProjectionMatrix()}this.camera=a,t.onRender?t.onRender(this.renderer,this.scene,this.camera):(r=this.renderer)===null||r===void 0||r.render(this.scene,a),(o=this.renderer)===null||o===void 0||o.resetState()}};this.layer=new AMap.GLCustomLayer(i),this.layer.setMap(e)}update(){this.needsUpdate=!0}animate(){this.needsUpdate&&(this.refreshMap(),this.needsUpdate=!1),this.frameTimer=requestAnimationFrame(()=>{this.animate()})}refreshMap(){this.map&&this.map.render()}convertLngLat(e){return this.customCoords.lngLatsToCoords([e])[0]}add(e){var t;(t=this.scene)===null||t===void 0||t.add(e),this.refreshMap()}remove(e){var t;(t=this.scene)===null||t===void 0||t.remove(e),this.refreshMap()}getScene(){return this.scene}getCamera(){return this.camera}getRender(){return this.renderer}destroy(){var e;cancelAnimationFrame(this.frameTimer),this.layer.setMap(null),this.customCoords=null,bT(this.scene),this.scene=void 0,this.camera=void 0,(e=this.renderer)===null||e===void 0||e.dispose(),this.renderer=void 0,this.layer=null,this.map=null,Mi.clear(),this.options=null}getMap(){return this.map?this.map:null}getOpacity(){return this.layer.getOpacity()}setOpacity(e){this.layer.setOpacity(e)}getZooms(){return this.layer.getZooms()}setZooms(e){this.layer.setZooms(e)}getzIndex(){return this.layer.getzIndex()}setzIndex(e){this.layer.setzIndex(e)}show(){this.layer.show()}hide(){this.layer.hide()}}class ST extends Kf{constructor(e,t){super(),this.linerAnimationFrame=-1,this.layer=e,t=Object.assign({},{url:"",position:[0,0],height:0,rotation:{x:0,y:0,z:0},scale:1,angle:0},t),this.init(t)}init(e){new cr().load(e.url,t=>{const i=t.scene,s=t.animations;this.layer.add(i),this.object=i,this.animations=s,this.setScale(e.scale),this.setRotation(e.rotation),this.setAngle(e.angle),this.setPosition(e.position),this.setHeight(e.height),e.onLoaded&&e.onLoaded(i,s),this.emit("complete",{target:i,animations:s})})}setScale(e){let t;typeof e=="number"?t={x:e,y:e,z:e}:t=e,this.object.scale.set(t.x,t.y,t.z),this.refresh()}setPosition(e){const t=this.layer.convertLngLat(e);this.object.position.setX(t[0]),this.object.position.setY(t[1]),this.refresh()}setRotation(e){if(e){const t=Math.PI/180*(e.x||0),i=Math.PI/180*(e.y||0),s=Math.PI/180*(e.z||0);this.object.rotation.set(t,i,s),this.refresh()}}setAngle(e){const t=this.object.rotation.x,i=this.object.rotation.z,s=Math.PI/180*e;this.object.rotation.set(t,s,i),this.refresh()}setHeight(e){e!==void 0&&(this.object.position.setZ(e),this.refresh())}getAnimations(){return this.animations}getObject(){return this.object}refresh(){this.layer.update()}show(){this.object.visible=!0,this.refresh()}hide(){this.object.visible=!1,this.refresh()}animate(e){this.linerAnimationFrame=requestAnimationFrame(()=>{this.animate(e)}),e()}startAnimations(){if(this.animations){const e=this.animations,t=new FA(this.object),i={};for(let r=0;r{const r=s.getDelta();t&&t.update(r),this.refresh()})}}stopAnimations(){cancelAnimationFrame(this.linerAnimationFrame)}remove(){this.object&&this.layer.remove(this.object)}destroy(){this.stopAnimations(),this.object&&(Qf(this.object),this.object=null,this.layer=null)}}class wT extends Mo{constructor(e,t,i,s,r){super();this.scene=e,this.camera=t,this.overrideMaterial=i,this.clearColor=s,this.clearAlpha=r!==void 0?r:0,this.clear=!0,this.clearDepth=!1,this.needsSwap=!1,this._oldClearColor=new ge}render(e,t,i){const s=e.autoClear;e.autoClear=!1;let r,o;this.overrideMaterial!==void 0&&(o=this.scene.overrideMaterial,this.scene.overrideMaterial=this.overrideMaterial),this.clearColor&&(e.getClearColor(this._oldClearColor),r=e.getClearAlpha(),e.setClearColor(this.clearColor,this.clearAlpha)),this.clearDepth&&e.clearDepth(),e.setRenderTarget(this.renderToScreen?null:i),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),e.render(this.scene,this.camera),this.clearColor&&e.setClearColor(this._oldClearColor,r),this.overrideMaterial!==void 0&&(this.scene.overrideMaterial=o),e.autoClear=s}}class CT extends wT{constructor(e,t,i,s,r){super(e,t,i,s,r);this.clear=!1}setCamera(e){this.camera=e}}class AT extends MT{constructor(e,t,i){t.onInit=(s,r)=>{if(this.raycaster=new Nf,t.axesHelper){const o=new NA(1e4);r.add(o)}this.createEffect(),this.createLights(t.lights||[]),this.createHDR(t.hdr),this.bindEvents(),i&&i()};super(e,t);this.lightTypes={AmbientLight:Df,DirectionalLight:Nl,HemisphereLight:Ef,PointLight:Ol,RectAreaLight:xA,SpotLight:Dl},this.passNum=0,this.passList=[],this.mouse=new te}createEffect(){var e;const t=(e=this.renderer)==null?void 0:e.getSize(new te);this.effectComposer=new WA(this.renderer),this.effectComposer.setSize(t==null?void 0:t.x,t==null?void 0:t.y);const i=new CT(this.scene,this.camera);this.renderPass=i,this.effectComposer.addPass(i)}addPass(e){this.effectComposer.addPass(e),this.passNum++,this.passList.push(e)}removePass(e){const t=this.passList.indexOf(e);t!==-1&&this.passList.splice(t,1),this.effectComposer.removePass(e),this.passNum--}createLights(e){const t={type:"DirectionalLight",args:[]};e&&e.length>0&&e.forEach(i=>{if(i=Oi({},t,i),this.lightTypes[i.type]){const s=new this.lightTypes[i.type](...i.args),r=i.position,o=i.lookAt;r&&s.position.set(r.x,r.y,r.z),o&&s.lookAt(o.x,o.y,o.z),this.add(s)}else console.warn("\u5F53\u524D\u8BBE\u7F6E\u7684\u706F\u5149\u7C7B\u578B\u4E0D\u5B58\u5728")})}createHDR(e){if(!e)return;const t=Oi({},{urls:[],path:"/",exposure:1},e),i=this.renderer;i.physicallyCorrectLights=!0,i.outputEncoding=We,i.toneMappingExposure=t.exposure;const s=t.urls;let r=new ll(i);r.compileCubemapShader();const o=new zA().setPath(t.path).load(s,()=>{const a=r.fromCubemap(o);o.magFilter=Je,o.needsUpdate=!0,this.envMap=a?a.texture:null,this.addEnvMap(this.scene),r.dispose(),r=null,this.refreshMap()})}addEnvMap(e){this.scene.environment=this.envMap}bindEvents(){this.clickFun=Di(this._clickEvent,this),this.hoverFun=Di(this._hoverEvent,this),this.map.on("click",this.clickFun),this.map.on("mousemove",this.hoverFun)}ubBindEvents(){this.map.off("click",this.clickFun),this.map.off("mousemove",this.hoverFun)}_clickEvent(e){const t=this._intersectGltf(e);t&&t.$vue.$emit("click",t)}_hoverEvent(e){var t;const i=this._intersectGltf(e);if(i)i.isHover||(i.isHover=!0,i.$vue.$emit("mouseover",i));else{const s=(t=this.scene)==null?void 0:t.children;s==null||s.forEach(r=>{r.isCustomGroup&&r.isHover===!0&&(r.isHover=!1,r.$vue.$emit("mouseout",r))})}}_intersectGltf(e){var t,i;const s=this.map.getContainer(),r=s.getBoundingClientRect(),o=r.top+window.pageYOffset-s.clientTop,a=r.left+window.pageXOffset-s.clientLeft;this.mouse.x=(e.originEvent.x+window.pageXOffset-a)/r.width*2-1,this.mouse.y=-((e.originEvent.y+window.pageYOffset-o)/r.height)*2+1;const l=this.camera;(t=this.raycaster)==null||t.setFromCamera(this.mouse,l);const c=(i=this.raycaster)==null?void 0:i.intersectObjects([this.scene],!0),u=c==null?void 0:c.length;if(u&&u>0){let h=null;for(let d=0;d{this.$amapComponent=new TT(this.$parentComponent,n,()=>{e()})})},destroyComponent(){this.$amapComponent.destroy(),this.$amapComponent=null,this.$parentComponent=null},convertLngLat(n){return this.$amapComponent.convertLngLat(n)},addObject(n){this.$amapComponent.addObject(n)},removeObject(n){this.$amapComponent.removeObject(n)},addEnvMap(n){this.$amapComponent.addEnvMap(n)},$$getScene(){return this.$amapComponent.getScene()},$$getRender(){return this.$amapComponent.getRender()},$$refresh(){this.$amapComponent.refreshMap()}}});function ET(n,e,t,i,s,r){return ti(n.$slots,"default")}Wl.render=ET,Wl.__file="src/packages/three/ThreeLayer/ThreeLayer.vue";const em=ce(Wl);var ys={Linear:{None:function(n){return n}},Quadratic:{In:function(n){return n*n},Out:function(n){return n*(2-n)},InOut:function(n){return(n*=2)<1?.5*n*n:-.5*(--n*(n-2)-1)}},Cubic:{In:function(n){return n*n*n},Out:function(n){return--n*n*n+1},InOut:function(n){return(n*=2)<1?.5*n*n*n:.5*((n-=2)*n*n+2)}},Quartic:{In:function(n){return n*n*n*n},Out:function(n){return 1- --n*n*n*n},InOut:function(n){return(n*=2)<1?.5*n*n*n*n:-.5*((n-=2)*n*n*n-2)}},Quintic:{In:function(n){return n*n*n*n*n},Out:function(n){return--n*n*n*n*n+1},InOut:function(n){return(n*=2)<1?.5*n*n*n*n*n:.5*((n-=2)*n*n*n*n+2)}},Sinusoidal:{In:function(n){return 1-Math.cos(n*Math.PI/2)},Out:function(n){return Math.sin(n*Math.PI/2)},InOut:function(n){return .5*(1-Math.cos(Math.PI*n))}},Exponential:{In:function(n){return n===0?0:Math.pow(1024,n-1)},Out:function(n){return n===1?1:1-Math.pow(2,-10*n)},InOut:function(n){return n===0?0:n===1?1:(n*=2)<1?.5*Math.pow(1024,n-1):.5*(-Math.pow(2,-10*(n-1))+2)}},Circular:{In:function(n){return 1-Math.sqrt(1-n*n)},Out:function(n){return Math.sqrt(1- --n*n)},InOut:function(n){return(n*=2)<1?-.5*(Math.sqrt(1-n*n)-1):.5*(Math.sqrt(1-(n-=2)*n)+1)}},Elastic:{In:function(n){return n===0?0:n===1?1:-Math.pow(2,10*(n-1))*Math.sin((n-1.1)*5*Math.PI)},Out:function(n){return n===0?0:n===1?1:Math.pow(2,-10*n)*Math.sin((n-.1)*5*Math.PI)+1},InOut:function(n){return n===0?0:n===1?1:(n*=2,n<1?-.5*Math.pow(2,10*(n-1))*Math.sin((n-1.1)*5*Math.PI):.5*Math.pow(2,-10*(n-1))*Math.sin((n-1.1)*5*Math.PI)+1)}},Back:{In:function(n){var e=1.70158;return n*n*((e+1)*n-e)},Out:function(n){var e=1.70158;return--n*n*((e+1)*n+e)+1},InOut:function(n){var e=1.70158*1.525;return(n*=2)<1?.5*(n*n*((e+1)*n-e)):.5*((n-=2)*n*((e+1)*n+e)+2)}},Bounce:{In:function(n){return 1-ys.Bounce.Out(1-n)},Out:function(n){return n<1/2.75?7.5625*n*n:n<2/2.75?7.5625*(n-=1.5/2.75)*n+.75:n<2.5/2.75?7.5625*(n-=2.25/2.75)*n+.9375:7.5625*(n-=2.625/2.75)*n+.984375},InOut:function(n){return n<.5?ys.Bounce.In(n*2)*.5:ys.Bounce.Out(n*2-1)*.5+.5}}},pr;typeof self=="undefined"&&typeof process!="undefined"&&process.hrtime?pr=function(){var n=process.hrtime();return n[0]*1e3+n[1]/1e6}:typeof self!="undefined"&&self.performance!==void 0&&self.performance.now!==void 0?pr=self.performance.now.bind(self.performance):Date.now!==void 0?pr=Date.now:pr=function(){return new Date().getTime()};var vs=pr,LT=function(){function n(){this._tweens={},this._tweensAddedDuringUpdate={}}return n.prototype.getAll=function(){var e=this;return Object.keys(this._tweens).map(function(t){return e._tweens[t]})},n.prototype.removeAll=function(){this._tweens={}},n.prototype.add=function(e){this._tweens[e.getId()]=e,this._tweensAddedDuringUpdate[e.getId()]=e},n.prototype.remove=function(e){delete this._tweens[e.getId()],delete this._tweensAddedDuringUpdate[e.getId()]},n.prototype.update=function(e,t){e===void 0&&(e=vs()),t===void 0&&(t=!1);var i=Object.keys(this._tweens);if(i.length===0)return!1;for(;i.length>0;){this._tweensAddedDuringUpdate={};for(var s=0;s1?r(n[t],n[t-1],t-i):r(n[s],n[s+1>t?t:s+1],i-s)},Bezier:function(n,e){for(var t=0,i=n.length-1,s=Math.pow,r=fr.Utils.Bernstein,o=0;o<=i;o++)t+=s(1-e,i-o)*s(e,o)*n[o]*r(i,o);return t},CatmullRom:function(n,e){var t=n.length-1,i=t*e,s=Math.floor(i),r=fr.Utils.CatmullRom;return n[0]===n[t]?(e<0&&(s=Math.floor(i=t*(1+e))),r(n[(s-1+t)%t],n[s],n[(s+1)%t],n[(s+2)%t],i-s)):e<0?n[0]-(r(n[0],n[0],n[1],n[1],-i)-n[0]):e>1?n[t]-(r(n[t],n[t],n[t-1],n[t-1],i-t)-n[t]):r(n[s?s-1:0],n[s],n[t1;i--)t*=i;return n[e]=t,t}}(),CatmullRom:function(n,e,t,i,s){var r=(t-n)*.5,o=(i-e)*.5,a=s*s,l=s*a;return(2*e-2*t+r+o)*l+(-3*e+3*t-2*r-o)*a+r*s+e}}},RT=function(){function n(){}return n.nextId=function(){return n._nextId++},n._nextId=0,n}(),tm=new LT,nm=function(){function n(e,t){t===void 0&&(t=tm),this._object=e,this._group=t,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=ys.Linear.None,this._interpolationFunction=fr.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._id=RT.nextId(),this._isChainStopped=!1,this._goToEnd=!1}return n.prototype.getId=function(){return this._id},n.prototype.isPlaying=function(){return this._isPlaying},n.prototype.isPaused=function(){return this._isPaused},n.prototype.to=function(e,t){return this._valuesEnd=Object.create(e),t!==void 0&&(this._duration=t),this},n.prototype.duration=function(e){return this._duration=e,this},n.prototype.start=function(e){if(this._isPlaying)return this;if(this._group&&this._group.add(this),this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var t in this._valuesStartRepeat)this._swapEndStartRepeatValues(t),this._valuesStart[t]=this._valuesStartRepeat[t]}return this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=e!==void 0?typeof e=="string"?vs()+parseFloat(e):e:vs(),this._startTime+=this._delayTime,this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat),this},n.prototype._setupProperties=function(e,t,i,s){for(var r in i){var o=e[r],a=Array.isArray(o),l=a?"array":typeof o,c=!a&&Array.isArray(i[r]);if(!(l==="undefined"||l==="function")){if(c){var u=i[r];if(u.length===0)continue;u=u.map(this._handleRelativeValue.bind(this,o)),i[r]=[o].concat(u)}if((l==="object"||a)&&o&&!c){t[r]=a?[]:{};for(var h in o)t[r][h]=o[h];s[r]=a?[]:{},this._setupProperties(o,t[r],i[r],s[r])}else typeof t[r]=="undefined"&&(t[r]=o),a||(t[r]*=1),c?s[r]=i[r].slice().reverse():s[r]=t[r]||0}}},n.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},n.prototype.end=function(){return this._goToEnd=!0,this.update(1/0),this},n.prototype.pause=function(e){return e===void 0&&(e=vs()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=e,this._group&&this._group.remove(this),this)},n.prototype.resume=function(e){return e===void 0&&(e=vs()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=e-this._pauseStart,this._pauseStart=0,this._group&&this._group.add(this),this)},n.prototype.stopChainedTweens=function(){for(var e=0,t=this._chainedTweens.length;er)return!1;t&&this.start(e)}if(this._goToEnd=!1,e1?1:s;var o=this._easingFunction(s);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,o),this._onUpdateCallback&&this._onUpdateCallback(this._object,s),s===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=e+this._repeatDelayTime:this._startTime=e+this._delayTime,this._onRepeatCallback&&this._onRepeatCallback(this._object),!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var a=0,l=this._chainedTweens.length;a{r.isCustomGroup=!0,r.$vue=i,this.moveAnimation=t.moveAnimation,s&&s()};super(e,t);this.moveFrame=-1,this.angleFrame=-1}setScale(e){let t;typeof e=="number"?t=[e,e,e]:t=e,this.object.scale.set(...t)}setPosition(e){const t=this.layer.convertLngLat(e);!this.moveAnimation||!this.moveAnimation.smooth?(this._updatePosition(t),this.prePosition=t):this.prePosition?this._updatePositionTween(t):(this._updatePosition(t),this.prePosition=t)}_updatePositionTween(e){var t;if(!this.prePosition)return;this.prePositionTween&&this.prePositionTween.end();const i={x:this.prePosition[0],y:this.prePosition[1]};this._stopMoveAnimation();const s=((t=this.moveAnimation)==null?void 0:t.duration)||1e3;this.prePositionTween=new nm(i).to({x:e[0],y:e[1]}).duration(s).easing(ys.Linear.None).onUpdate(()=>{this._updatePosition([i.x,i.y])}).start(),this._moveAnimate(),this.prePosition=e}_moveAnimate(){var e;(e=this.prePositionTween)==null||e.update(),this.moveFrame=requestAnimationFrame(()=>{this._moveAnimate()})}_stopMoveAnimation(){cancelAnimationFrame(this.moveFrame)}_updatePosition(e){this.object.position.setX(e[0]),this.object.position.setY(e[1]),this.refresh()}setAngle(e){!this.moveAnimation||!this.moveAnimation.smooth?(this._updateAngle(e),this.preAngle=e):this.preAngle===void 0?(this._updateAngle(e),this.preAngle=e):this._updateAngleTween(e)}_updateAngle(e){const t=this.object.rotation.x,i=this.object.rotation.z,s=Math.PI/180*e;this.object.rotation.set(t,s,i),this.refresh()}_updateAngleTween(e){var t;if(this.preAngle===void 0)return;this.preAngleTween&&this.preAngleTween.end();const i={angle:this.preAngle};this._stopAngleAnimation();const s=((t=this.moveAnimation)==null?void 0:t.duration)||1e3;this.preAngleTween=new nm(i).to({angle:e}).duration(s).easing(ys.Linear.None).onUpdate(()=>{this._updateAngle(i.angle)}).onComplete(()=>{this._stopAngleAnimation()}).start(),this._angleAnimate(),this.preAngle=e}_angleAnimate(){var e;(e=this.preAngleTween)==null||e.update(),this.angleFrame=requestAnimationFrame(()=>{this._angleAnimate()})}_stopAngleAnimation(){cancelAnimationFrame(this.angleFrame)}setMoveAnimation(e){this.moveAnimation=e}remove(){this.object&&this.layer.removeObject(this.object)}destroy(){this._stopAngleAnimation(),this._stopMoveAnimation(),this.prePosition=void 0,this.preAngle=void 0,this.prePositionTween=void 0,this.preAngleTween=void 0,this.object&&(this.object.$vue=null),super.destroy()}}var IT=PT,im=oe({name:"ElAmapThreeGltf",mixins:[ae],props:{url:{type:String},position:{type:Array},height:{type:Number,default:0},rotation:{type:Object},scale:{type:[Number,Array],default:1},angle:{type:Number,default:0},moveAnimation:{type:Object}},emits:["click","mousemove","mouseover","mouseout"],data(){return{}},methods:{__initComponent(n){return new Promise(e=>{this.$amapComponent=new IT(this.$parentComponent,n,this,()=>{e()})})},destroyComponent(){this.parentInstance.isDestroy||this.$amapComponent.remove(),this.$amapComponent.destroy()},$$startAnimations(){this.$amapComponent.startAnimations()},$$stopAnimations(){this.$amapComponent.stopAnimations()}},render(){return null}});im.__file="src/packages/three/ThreeGltf/ThreeGltf.vue";const sm=ce(im);var rm=oe({name:"ElAmapControlGeolocation",mixins:[ae],props:{position:{type:String},offset:{type:Array},borderColor:{type:String},borderRadius:{type:String},buttonSize:{type:String},convert:{type:Boolean,default:!0},enableHighAccuracy:{type:Boolean,default:!1},timeout:{type:Number},maximumAge:{type:Number},showButton:{type:Boolean,default:!0},showCircle:{type:Boolean,default:!0},showMarker:{type:Boolean,default:!0},markerOptions:{type:Object},circleOptions:{type:Object},panToLocation:{type:Boolean,default:!0},zoomToAccuracy:{type:Boolean,default:!0},GeoLocationFirst:{type:Boolean,default:!0},noIpLocate:{type:Number},noGeoLocation:{type:Number},useNative:{type:Boolean,default:!1},getCityWhenFail:{type:Boolean,default:!1},needAddress:{type:Boolean,default:!1},extensions:{type:String,validator(n){return["base","all"].indexOf(n)!==-1}}},emits:["complete"],data(){return{}},methods:{__initComponent(n){return new Promise(e=>{this.$parentComponent.plugin(["AMap.Geolocation"],()=>{this.$amapComponent=new AMap.Geolocation(n),this.$parentComponent.addControl(this.$amapComponent),this.$amapComponent.on("complete",t=>{this.$emit("complete",t)}),e()})})},destroyComponent(){this.$amapComponent&&this.$parentComponent&&(this.parentInstance.isDestroy||this.$parentComponent.removeControl(this.$amapComponent),this.$amapComponent=null,this.$parentComponent=null)}},render(){return null}});rm.__file="src/packages/control/Geolocation/Geolocation.vue";const om=ce(rm);var am=oe({name:"ElAmapCircleMarker",mixins:[ae],props:{zIndex:{type:Number},center:{type:Array,required:!0},bubble:{type:Boolean,default:!1},cursor:{type:String},radius:{type:Number},strokeColor:{type:String},strokeOpacity:{type:Number},strokeWeight:{type:Number},fillColor:{type:String},fillOpacity:{type:Number},draggable:{type:Boolean,default:!1},extData:{type:Object}},emits:["update:center"],data(){return{converters:{},handlers:{}}},methods:{__initComponent(n){this.$parentComponent=this.parentInstance.$amapComponent,this.$amapComponent=new AMap.CircleMarker(n),this.$parentComponent.add(this.$amapComponent),this.bindModelEvents()},bindModelEvents(){this.$amapComponent.on("dragend",()=>{this.emitPosition()}),this.$amapComponent.on("touchend",()=>{this.emitPosition()})},emitPosition(){const n=this.$amapComponent.getCenter();this.$emit("update:center",n.toArray())},destroyComponent(){this.parentInstance.isDestroy||this.$parentComponent.remove(this.$amapComponent),this.$amapComponent=null},__strokeColor(n){this.$amapComponent.setOptions({strokeColor:n})},__strokeOpacity(n){this.$amapComponent.setOptions({strokeOpacity:n})},__strokeWeight(n){this.$amapComponent.setOptions({strokeWeight:n})},__fillColor(n){this.$amapComponent.setOptions({fillColor:n})},__fillOpacity(n){this.$amapComponent.setOptions({fillOpacity:n})}},render(){return null}});am.__file="src/packages/marker/CircleMarker/CircleMarker.vue";const lm=ce(am);var cm=oe({name:"ElAmapLocaAmbientLight",mixins:[ae],props:{color:{type:String},intensity:{type:Number}},data(){return{converters:{},handlers:{}}},methods:{__initComponent(n){this.$amapComponent=new Loca.AmbientLight(n),this.$parentComponent.addLight(this.$amapComponent)},destroyComponent(){this.parentInstance.isDestroy||this.$parentComponent.removeLight(this.$amapComponent),this.$amapComponent=null,this.$parentComponent=null}},render(){return null}});cm.__file="src/packages/loca/AmbientLight/AmbientLight.vue";const hm=ce(cm);var um=oe({name:"ElAmapLocaDirectionalLight",mixins:[ae],props:{color:{type:String},intensity:{type:Number},position:{type:Array,required:!0},target:{type:Array}},data(){return{converters:{},handlers:{}}},methods:{__initComponent(n){this.$amapComponent=new Loca.DirectionalLight(n),this.$parentComponent.addLight(this.$amapComponent)},destroyComponent(){this.parentInstance.isDestroy||this.$parentComponent.removeLight(this.$amapComponent),this.$amapComponent=null,this.$parentComponent=null}},render(){return null}});um.__file="src/packages/loca/DirectionalLight/DirectionalLight.vue";const dm=ce(um);var pm=oe({name:"ElAmapLocaPointLight",mixins:[ae],props:{color:{type:String},intensity:{type:Number},position:{type:Array,required:!0},distance:{type:Number}},data(){return{converters:{},handlers:{}}},methods:{__initComponent(n){this.$amapComponent=new Loca.PointLight(n),this.$parentComponent.addLight(this.$amapComponent)},destroyComponent(){this.parentInstance.isDestroy||this.$parentComponent.removeLight(this.$amapComponent),this.$amapComponent=null,this.$parentComponent=null}},render(){return null}});pm.__file="src/packages/loca/PointLight/PointLight.vue";const fm=ce(pm);class DT{constructor(e,t){this.canPlay=!1,this.frame=-1;const i=document.createElement("canvas");this.video=t,t.src=e.url,t.autoplay=!0,t.loop=e.loop;const s={...e,canvas:i};this.canvas=i,this.context=i.getContext("2d"),this.layer=new AMap.CanvasLayer(s),this.initVideoEvents(),this.load()}getLayer(){return this.layer}initVideoEvents(){var e;(e=this.video)==null||e.addEventListener("canplaythrough",()=>{var t,i;this.canvas&&(this.canvas.width=(t=this.video)==null?void 0:t.videoWidth,this.canvas.height=(i=this.video)==null?void 0:i.videoHeight),this.canPlay=!0,this.play()})}load(){var e;(e=this.video)==null||e.load()}play(){var e;this.canPlay&&((e=this.video)==null||e.play(),this.stopRender(),this.render())}pause(){var e;this.stopRender(),(e=this.video)==null||e.pause()}stopRender(){this.frame&&cancelAnimationFrame(this.frame)}render(){var e,t,i,s,r,o,a,l;this.frame=window.requestAnimationFrame(()=>{this.render()}),((e=this.video)==null?void 0:e.paused)?(t=this.video)==null||t.play():((r=this.context)==null||r.clearRect(0,0,(i=this.canvas)==null?void 0:i.width,(s=this.canvas)==null?void 0:s.height),(l=this.context)==null||l.drawImage(this.video,0,0,(o=this.canvas)==null?void 0:o.width,(a=this.canvas)==null?void 0:a.height),this.layer.reFresh())}destroy(){this.stopRender(),this.video&&this.video.pause(),this.video=null}setUrl(e){this.stopRender(),this.canPlay=!1,this.video&&(this.video.src=e,this.load())}setZooms(e){this.getLayer().setZoom(e)}setOpacity(e){this.getLayer().setOpacity(e)}setBounds(e){this.getLayer().setBounds(e)}setzIndex(e){this.getLayer().setzIndex(e)}show(){this.getLayer().show()}hide(){this.getLayer().hide()}}var FT=DT,jl=oe({name:"ElAmapLayerVideo",mixins:[ae],props:{url:{required:!0,type:String},zooms:{type:Array},bounds:{type:[Array,Object]},opacity:{type:Number}},data(){return{handlers:{}}},methods:{__initComponent(n){this.$amapComponent=new FT(n,this.$refs.video),this.$parentComponent.addLayer(this.$amapComponent.getLayer())},destroyComponent(){this.$amapComponent.destroy(),this.parentInstance.isDestroy||this.$parentComponent.removeLayer(this.$amapComponent),this.$amapComponent=null,this.$parentComponent=null},$$play(){this.$amapComponent.play()},$$pause(){this.$amapComponent.pause()}},render(){return null}});const OT={ref:"video",style:{display:"none"},muted:""};function NT(n,e,t,i,s,r){return Bt(),$t("video",OT,null,512)}jl.render=NT,jl.__file="src/packages/layer/data/Video/Video.vue";const mm=ce(jl);var gm=oe({name:"ElAmapLocaLaser",mixins:[ae,Tt],props:{depth:{type:Boolean,default:!0}},data(){return{converters:{}}},methods:{__initComponent(n){this.$amapComponent=new Loca.LaserLayer(n),this.setSource(),this.setStyle(),this.$parentComponent.add(this.$amapComponent),this.initComplete()},setStyle(){const e=Object.assign({},{unit:"px",height:200,color:"rgba(255,255,0,0.5)",angle:0,lineWidth:2,trailLength:30,duration:2e3,interval:0,delay:0,repeat:void 0},this.defaultStyleValue),t={unit:e.unit,height:(s,r)=>(r.properties=r.properties||{},r.properties.height===void 0?e.height:r.properties.height),color:(s,r)=>(r.properties=r.properties||{},r.properties.color===void 0?e.color:r.properties.color),angle:e.angle,lineWidth:e.lineWidth,trailLength:e.trailLength,duration:(s,r)=>(r.properties=r.properties||{},r.properties.duration===void 0?e.duration:r.properties.duration),interval:(s,r)=>(r.properties=r.properties||{},r.properties.interval===void 0?e.interval:r.properties.interval),delay:(s,r)=>(r.properties=r.properties||{},r.properties.delay===void 0?e.delay:r.properties.delay),repeat:e.repeat},i=Object.assign({},t,this.layerStyle);this.$amapComponent.setStyle(i)}},render(){return null}});gm.__file="src/packages/loca/LaserLayer/LaserLayer.vue";const _m=ce(gm);function ym(n){const e=i=>{i.geometry&&i.geometry.dispose(),i.material&&i.material.dispose&&i.material.dispose(),i.material.texture&&i.material.texture.dispose&&i.material.texture.dispose()},t=i=>{let s=i.children.filter(r=>r);s.forEach(r=>{r.children.length?t(r):r.isMesh&&e(r)}),s=null};t(n)}class kT{constructor(e){this.videoFrame=-1,this.layer=e}init(e,t){return this.video=e.video,this.object=new rn,this.object.isCustomGroup=!0,this.object.$vue=t,new Promise(i=>{var s,r,o,a,l;(s=this.video)==null||s.load(),(r=this.video)==null||r.play();const c=new E1(this.video),u=new Ys(e.videoWidth||((o=this.video)==null?void 0:o.videoWidth),e.videoHeight||((a=this.video)==null?void 0:a.videoHeight)),h=new xf({map:c,side:Jt,transparent:!0,depthTest:!1}),d=new ft(u,h);d.renderOrder=3,d.rotation.y=Math.PI,d.name="video",this.videoMesh=d,this.object.add(d),this.setVideoTranslate(e.videoTranslate),this.setPosition(e.position),this.setRotation(e.rotation),this.setScale(e.scale),this.setAltitude(e.altitude),(l=this.layer)==null||l.add(this.object),this.videoAnimate(),this.addBgCanvas(e.canvas),this.setAngle(e.angle),this.setOpacity(e.opacity),this.setzIndex(e.zIndex||0),this.bindAlwaysFront(e.alwaysFront),i()})}bindAlwaysFront(e){var t;if(e){const i=(t=this.layer)==null?void 0:t.getMap();this.rotateFun=Di(this._changeMapRotate,this),i.on("rotatechange",this.rotateFun)}}unBindAlwaysFront(){var e;if(this.rotateFun){const t=(e=this.layer)==null?void 0:e.getMap();t&&t.off("rotatechange",this.rotateFun)}}_changeMapRotate(){var e;const i=((e=this.layer)==null?void 0:e.getMap()).getRotation();this.setAngle(i)}addBgCanvas(e){if(!e)return;const t=new L1(e),i=new Ys(e.width,e.height),s=new xf({map:t,side:Jt,transparent:!0,depthTest:!1}),r=new ft(i,s);r.name="bg",r.renderOrder=1,this.object.add(r),this.canvasTexture=t,this.bgMesh=r}videoAnimate(){this.videoFrame=requestAnimationFrame(()=>{this.videoAnimate()}),this.canvasTexture&&(this.canvasTexture.needsUpdate=!0),this.refresh()}cancelCanvasTextureAnimate(){this.videoFrame>0&&cancelAnimationFrame(this.videoFrame)}setScale(e){let t;typeof e=="number"?t=[e,e,e]:t=e,this.object.scale.set(...t)}setPosition(e){var t;const i=(t=this.layer)==null?void 0:t.convertLngLat(e);this.object.position.setX(i[0]),this.object.position.setY(i[1]),this.refresh()}setRotation(e){if(e){const t=Math.PI/180*(e.x||0),i=Math.PI/180*(e.y||0),s=Math.PI/180*(e.z||0);this.object.rotation.set(t,i,s),this.refresh()}}setVideoTranslate(e){e&&(this.videoMesh.translateX(e.x),this.videoMesh.translateY(e.y),this.videoMesh.translateZ(e.z),this.refresh())}setAltitude(e){e!==void 0&&(this.object.position.setZ(e),this.refresh())}setAngle(e){if(e!==void 0){const t=this.object.rotation.x,i=this.object.rotation.z,s=Math.PI/180*e;this.object.rotation.set(t,s,i),this.refresh()}}setOpacity(e){this.videoMesh.material.opacity=e,this.bgMesh&&(this.bgMesh.material.opacity=e),this.refresh()}setzIndex(e){this.object.renderOrder=e}refresh(){var e;(e=this.layer)==null||e.update()}show(){this.object.visible=!0,this.refresh()}hide(){this.object.visible=!1,this.refresh()}start(){var e;(e=this.video)==null||e.play()}pause(){var e;(e=this.video)==null||e.pause()}remove(){var e;this.object&&((e=this.layer)==null||e.remove(this.object),this.unBindAlwaysFront())}destroy(){this.cancelCanvasTextureAnimate(),this.unBindAlwaysFront(),this.object&&(this.object.$vue=null,ym(this.object),this.video=void 0,this.videoMesh=void 0,this.bgMesh=void 0,this.canvasTexture=void 0,this.rotateFun=void 0,this.object=null,this.layer=void 0)}}var BT=kT,ql=oe({name:"ElAmapThreeVideo",mixins:[ae],props:{video:{type:[String,Array,HTMLVideoElement],required:!0},videoTranslate:{type:Object,default(){return{x:0,y:0,z:0}}},videoWidth:{type:Number},videoHeight:{type:Number},canvas:{type:Object},position:{type:Array,required:!0},altitude:{type:Number,default:0},rotation:{type:Object},scale:{type:[Number,Array],default:1},angle:{type:Number,default:0},opacity:{type:Number,default:1},alwaysFront:{type:Boolean,default:!1}},emits:["click","mousemove","mouseover","mouseout"],data(){return{videoUrlList:[]}},methods:{__initComponent(n){const e=Object.prototype.toString.call(n.video);return e==="[object String]"?this.videoUrlList=[n.video]:e==="[object Array]"&&(this.videoUrlList=n.video),this.videoUrlList.length>0&&(n.video=this.$refs.video),this.$amapComponent=new BT(this.$parentComponent),new Promise(t=>{this.$nextTick(()=>{this.$amapComponent.init(n,this).then(()=>{t()})})})},destroyComponent(){this.parentInstance.isDestroy||this.$amapComponent.remove(),this.$amapComponent.destroy()},$$start(){this.$amapComponent.start()},$$pause(){this.$amapComponent.pause()}}});const $T={ref:"video",style:{display:"none"},muted:"",loop:"",autoplay:"",crossOrigin:"anonymous"},UT=["src"];function zT(n,e,t,i,s,r){return Bt(),$t("video",$T,[(Bt(!0),$t(Cg,null,Ag(n.videoUrlList,o=>(Bt(),$t("source",{key:o,src:o,type:"video/mp4"},null,8,UT))),128))],512)}ql.render=zT,ql.__file="src/packages/three/ThreeVideo/ThreeVideo.vue";const vm=ce(ql);class GT{constructor(e,t){this.layer=e;const i=new Df(this.getColorHex(t.color),t.intensity);this.object=i,e.add(i)}setColor(e){this.object.color=new ge(e),this.refresh()}getColorHex(e){return new ge(e).getHex()}setIntensity(e){this.object.intensity=e,this.refresh()}refresh(){var e;(e=this.layer)==null||e.update()}remove(){var e;this.object&&((e=this.layer)==null||e.remove(this.object))}destroy(){this.object&&(this.object=null,this.layer=null)}}var VT=GT,xm=oe({name:"ElAmapThreeLightAmbient",mixins:[ae],props:{color:{type:String,default:"#ffffff"},intensity:{type:Number,default:1}},data(){return{}},methods:{__initComponent(n){this.$amapComponent=new VT(this.$parentComponent,n)},destroyComponent(){this.parentInstance.isDestroy||this.$amapComponent.remove(),this.$amapComponent.destroy()}},render(){return null}});xm.__file="src/packages/three/ThreeLightAmbient/ThreeLightAmbient.vue";const bm=ce(xm);class HT{constructor(e,t){this.layer=e;const i=new Nl(this.getColorHex(t.color),t.intensity);this.object=i,this.setPosition(t.position),e.add(i)}setColor(e){this.object.color=new ge(e),this.refresh()}getColorHex(e){return new ge(e).getHex()}setIntensity(e){this.object.intensity=e,this.refresh()}setPosition(e){this.object.position.set(e.x,e.y,e.z),this.refresh()}setTarget(e){e&&(this.object.target=e,this.refresh())}refresh(){var e;(e=this.layer)==null||e.update()}remove(){var e;this.object&&((e=this.layer)==null||e.remove(this.object))}destroy(){this.object&&(this.object=null,this.layer=null)}}var WT=HT,Mm=oe({name:"ElAmapThreeLightDirectional",mixins:[ae],props:{color:{type:String,default:"#ffffff"},intensity:{type:Number,default:1},position:{type:Object,default:()=>({x:0,y:0,z:1})},target:{type:Object}},data(){return{}},methods:{__initComponent(n){this.$amapComponent=new WT(this.$parentComponent,n)},destroyComponent(){this.parentInstance.isDestroy||this.$amapComponent.remove(),this.$amapComponent.destroy()}},render(){return null}});Mm.__file="src/packages/three/ThreeLightDirectional/ThreeLightDirectional.vue";const Sm=ce(Mm);class jT{constructor(e,t){this.layer=e;const i=new Ef(this.getColorHex(t.color),this.getColorHex(t.groundColor),t.intensity);this.object=i,this.setPosition(t.position),e.add(i)}setColor(e){this.object.color=new ge(e),this.refresh()}setGroundColor(e){this.object.groundColor=new ge(e),this.refresh()}getColorHex(e){return new ge(e).getHex()}setIntensity(e){this.object.intensity=e,this.refresh()}setPosition(e){this.object.position.set(e.x,e.y,e.z),this.refresh()}refresh(){var e;(e=this.layer)==null||e.update()}remove(){var e;this.object&&((e=this.layer)==null||e.remove(this.object))}destroy(){this.object&&(this.object=null,this.layer=null)}}var qT=jT,wm=oe({name:"ElAmapThreeLightHemisphere",mixins:[ae],props:{color:{type:String,default:"#ffffff"},groundColor:{type:String,default:"#ffffff"},intensity:{type:Number,default:1},position:{type:Object,required:!0}},data(){return{}},methods:{__initComponent(n){this.$amapComponent=new qT(this.$parentComponent,n)},destroyComponent(){this.parentInstance.isDestroy||this.$amapComponent.remove(),this.$amapComponent.destroy()}},render(){return null}});wm.__file="src/packages/three/ThreeLightHemisphere/ThreeLightHemisphere.vue";const Cm=ce(wm);class XT{constructor(e,t){this.layer=e;const i=new Ol(this.getColorHex(t.color),t.intensity,t.distance,t.decay);this.object=i,this.setPosition(t.position),e.add(i)}setColor(e){this.object.color=new ge(e),this.refresh()}getColorHex(e){return new ge(e).getHex()}setIntensity(e){this.object.intensity=e,this.refresh()}setPosition(e){var t;const i=(t=this.layer)==null?void 0:t.convertLngLat([e.x,e.y]);this.object.position.set(i[0],i[1],e.z),this.refresh()}refresh(){var e;(e=this.layer)==null||e.update()}remove(){var e;this.object&&((e=this.layer)==null||e.remove(this.object))}destroy(){this.object&&(this.object=null,this.layer=null)}}var YT=XT,Am=oe({name:"ElAmapThreeLightPoint",mixins:[ae],props:{color:{type:String,default:"#ffffff"},intensity:{type:Number,default:1},distance:{type:Number,default:0},decay:{type:Number,default:1},position:{type:Object,required:!0}},data(){return{}},methods:{__initComponent(n){this.$amapComponent=new YT(this.$parentComponent,n)},destroyComponent(){this.parentInstance.isDestroy||this.$amapComponent.remove(),this.$amapComponent.destroy()}},render(){return null}});Am.__file="src/packages/three/ThreeLightPoint/ThreeLightPoint.vue";const Tm=ce(Am);class JT{constructor(e,t){this.layer=e;const i=new Dl(this.getColorHex(t.color),t.intensity,t.distance,t.angle,t.penumbra,t.decay);this.object=i,this.setPosition(t.position),this.setTarget(t.target),e.add(i)}setColor(e){this.object.color=new ge(e),this.refresh()}getColorHex(e){return new ge(e).getHex()}setIntensity(e){this.object.intensity=e,this.refresh()}setPosition(e){var t;const i=(t=this.layer)==null?void 0:t.convertLngLat([e.x,e.y]);this.object.position.set(i[0],i[1],e.z),this.refresh()}setTarget(e){e&&(this.object.target=e,this.refresh())}refresh(){var e;(e=this.layer)==null||e.update()}remove(){var e;this.object&&((e=this.layer)==null||e.remove(this.object))}destroy(){this.object&&(this.object=null,this.layer=null)}}var ZT=JT,Em=oe({name:"ElAmapThreeLightSpot",mixins:[ae],props:{color:{type:String,default:"#ffffff"},intensity:{type:Number,default:1},distance:{type:Number,default:0},angle:{type:Number,default:0},penumbra:{type:Number,default:0},decay:{type:Number,default:1},position:{type:Object,required:!0},target:{type:Object}},data(){return{}},methods:{__initComponent(n){this.$amapComponent=new ZT(this.$parentComponent,n)},destroyComponent(){this.parentInstance.isDestroy||this.$amapComponent.remove(),this.$amapComponent.destroy()}},render(){return null}});Em.__file="src/packages/three/ThreeLightSpot/ThreeLightSpot.vue";const Lm=ce(Em);var Rm={exports:{}},Pm={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},Im={exports:{}},KT=function(e){return!e||typeof e=="string"?!1:e instanceof Array||Array.isArray(e)||e.length>=0&&(e.splice instanceof Function||Object.getOwnPropertyDescriptor(e,e.length-1)&&e.constructor.name!=="String")},QT=KT,eE=Array.prototype.concat,tE=Array.prototype.slice,Dm=Im.exports=function(e){for(var t=[],i=0,s=e.length;i=4&&n[3]!==1&&(e=", "+n[3]),"hwb("+n[0]+", "+n[1]+"%, "+n[2]+"%"+e+")"},Ft.to.keyword=function(n){return Om[n.slice(0,3)]};function Kn(n,e,t){return Math.min(Math.max(e,n),t)}function So(n){var e=Math.round(n).toString(16).toUpperCase();return e.length<2?"0"+e:e}const _r=Pm,Nm={};for(const n of Object.keys(_r))Nm[_r[n]]=n;const ye={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};var km=ye;for(const n of Object.keys(ye)){if(!("channels"in ye[n]))throw new Error("missing channels property: "+n);if(!("labels"in ye[n]))throw new Error("missing channel labels property: "+n);if(ye[n].labels.length!==ye[n].channels)throw new Error("channel and label counts mismatch: "+n);const{channels:e,labels:t}=ye[n];delete ye[n].channels,delete ye[n].labels,Object.defineProperty(ye[n],"channels",{value:e}),Object.defineProperty(ye[n],"labels",{value:t})}ye.rgb.hsl=function(n){const e=n[0]/255,t=n[1]/255,i=n[2]/255,s=Math.min(e,t,i),r=Math.max(e,t,i),o=r-s;let a,l;r===s?a=0:e===r?a=(t-i)/o:t===r?a=2+(i-e)/o:i===r&&(a=4+(e-t)/o),a=Math.min(a*60,360),a<0&&(a+=360);const c=(s+r)/2;return r===s?l=0:c<=.5?l=o/(r+s):l=o/(2-r-s),[a,l*100,c*100]},ye.rgb.hsv=function(n){let e,t,i,s,r;const o=n[0]/255,a=n[1]/255,l=n[2]/255,c=Math.max(o,a,l),u=c-Math.min(o,a,l),h=function(d){return(c-d)/6/u+1/2};return u===0?(s=0,r=0):(r=u/c,e=h(o),t=h(a),i=h(l),o===c?s=i-t:a===c?s=1/3+e-i:l===c&&(s=2/3+t-e),s<0?s+=1:s>1&&(s-=1)),[s*360,r*100,c*100]},ye.rgb.hwb=function(n){const e=n[0],t=n[1];let i=n[2];const s=ye.rgb.hsl(n)[0],r=1/255*Math.min(e,Math.min(t,i));return i=1-1/255*Math.max(e,Math.max(t,i)),[s,r*100,i*100]},ye.rgb.cmyk=function(n){const e=n[0]/255,t=n[1]/255,i=n[2]/255,s=Math.min(1-e,1-t,1-i),r=(1-e-s)/(1-s)||0,o=(1-t-s)/(1-s)||0,a=(1-i-s)/(1-s)||0;return[r*100,o*100,a*100,s*100]};function nE(n,e){return(n[0]-e[0])**2+(n[1]-e[1])**2+(n[2]-e[2])**2}ye.rgb.keyword=function(n){const e=Nm[n];if(e)return e;let t=1/0,i;for(const s of Object.keys(_r)){const r=_r[s],o=nE(n,r);o.04045?((e+.055)/1.055)**2.4:e/12.92,t=t>.04045?((t+.055)/1.055)**2.4:t/12.92,i=i>.04045?((i+.055)/1.055)**2.4:i/12.92;const s=e*.4124+t*.3576+i*.1805,r=e*.2126+t*.7152+i*.0722,o=e*.0193+t*.1192+i*.9505;return[s*100,r*100,o*100]},ye.rgb.lab=function(n){const e=ye.rgb.xyz(n);let t=e[0],i=e[1],s=e[2];t/=95.047,i/=100,s/=108.883,t=t>.008856?t**(1/3):7.787*t+16/116,i=i>.008856?i**(1/3):7.787*i+16/116,s=s>.008856?s**(1/3):7.787*s+16/116;const r=116*i-16,o=500*(t-i),a=200*(i-s);return[r,o,a]},ye.hsl.rgb=function(n){const e=n[0]/360,t=n[1]/100,i=n[2]/100;let s,r,o;if(t===0)return o=i*255,[o,o,o];i<.5?s=i*(1+t):s=i+t-i*t;const a=2*i-s,l=[0,0,0];for(let c=0;c<3;c++)r=e+1/3*-(c-1),r<0&&r++,r>1&&r--,6*r<1?o=a+(s-a)*6*r:2*r<1?o=s:3*r<2?o=a+(s-a)*(2/3-r)*6:o=a,l[c]=o*255;return l},ye.hsl.hsv=function(n){const e=n[0];let t=n[1]/100,i=n[2]/100,s=t;const r=Math.max(i,.01);i*=2,t*=i<=1?i:2-i,s*=r<=1?r:2-r;const o=(i+t)/2,a=i===0?2*s/(r+s):2*t/(i+t);return[e,a*100,o*100]},ye.hsv.rgb=function(n){const e=n[0]/60,t=n[1]/100;let i=n[2]/100;const s=Math.floor(e)%6,r=e-Math.floor(e),o=255*i*(1-t),a=255*i*(1-t*r),l=255*i*(1-t*(1-r));switch(i*=255,s){case 0:return[i,l,o];case 1:return[a,i,o];case 2:return[o,i,l];case 3:return[o,a,i];case 4:return[l,o,i];case 5:return[i,o,a]}},ye.hsv.hsl=function(n){const e=n[0],t=n[1]/100,i=n[2]/100,s=Math.max(i,.01);let r,o;o=(2-t)*i;const a=(2-t)*s;return r=t*s,r/=a<=1?a:2-a,r=r||0,o/=2,[e,r*100,o*100]},ye.hwb.rgb=function(n){const e=n[0]/360;let t=n[1]/100,i=n[2]/100;const s=t+i;let r;s>1&&(t/=s,i/=s);const o=Math.floor(6*e),a=1-i;r=6*e-o,(o&1)!=0&&(r=1-r);const l=t+r*(a-t);let c,u,h;switch(o){default:case 6:case 0:c=a,u=l,h=t;break;case 1:c=l,u=a,h=t;break;case 2:c=t,u=a,h=l;break;case 3:c=t,u=l,h=a;break;case 4:c=l,u=t,h=a;break;case 5:c=a,u=t,h=l;break}return[c*255,u*255,h*255]},ye.cmyk.rgb=function(n){const e=n[0]/100,t=n[1]/100,i=n[2]/100,s=n[3]/100,r=1-Math.min(1,e*(1-s)+s),o=1-Math.min(1,t*(1-s)+s),a=1-Math.min(1,i*(1-s)+s);return[r*255,o*255,a*255]},ye.xyz.rgb=function(n){const e=n[0]/100,t=n[1]/100,i=n[2]/100;let s,r,o;return s=e*3.2406+t*-1.5372+i*-.4986,r=e*-.9689+t*1.8758+i*.0415,o=e*.0557+t*-.204+i*1.057,s=s>.0031308?1.055*s**(1/2.4)-.055:s*12.92,r=r>.0031308?1.055*r**(1/2.4)-.055:r*12.92,o=o>.0031308?1.055*o**(1/2.4)-.055:o*12.92,s=Math.min(Math.max(0,s),1),r=Math.min(Math.max(0,r),1),o=Math.min(Math.max(0,o),1),[s*255,r*255,o*255]},ye.xyz.lab=function(n){let e=n[0],t=n[1],i=n[2];e/=95.047,t/=100,i/=108.883,e=e>.008856?e**(1/3):7.787*e+16/116,t=t>.008856?t**(1/3):7.787*t+16/116,i=i>.008856?i**(1/3):7.787*i+16/116;const s=116*t-16,r=500*(e-t),o=200*(t-i);return[s,r,o]},ye.lab.xyz=function(n){const e=n[0],t=n[1],i=n[2];let s,r,o;r=(e+16)/116,s=t/500+r,o=r-i/200;const a=r**3,l=s**3,c=o**3;return r=a>.008856?a:(r-16/116)/7.787,s=l>.008856?l:(s-16/116)/7.787,o=c>.008856?c:(o-16/116)/7.787,s*=95.047,r*=100,o*=108.883,[s,r,o]},ye.lab.lch=function(n){const e=n[0],t=n[1],i=n[2];let s;s=Math.atan2(i,t)*360/2/Math.PI,s<0&&(s+=360);const o=Math.sqrt(t*t+i*i);return[e,o,s]},ye.lch.lab=function(n){const e=n[0],t=n[1],s=n[2]/360*2*Math.PI,r=t*Math.cos(s),o=t*Math.sin(s);return[e,r,o]},ye.rgb.ansi16=function(n,e=null){const[t,i,s]=n;let r=e===null?ye.rgb.hsv(n)[2]:e;if(r=Math.round(r/50),r===0)return 30;let o=30+(Math.round(s/255)<<2|Math.round(i/255)<<1|Math.round(t/255));return r===2&&(o+=60),o},ye.hsv.ansi16=function(n){return ye.rgb.ansi16(ye.hsv.rgb(n),n[2])},ye.rgb.ansi256=function(n){const e=n[0],t=n[1],i=n[2];return e===t&&t===i?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(t/255*5)+Math.round(i/255*5)},ye.ansi16.rgb=function(n){let e=n%10;if(e===0||e===7)return n>50&&(e+=3.5),e=e/10.5*255,[e,e,e];const t=(~~(n>50)+1)*.5,i=(e&1)*t*255,s=(e>>1&1)*t*255,r=(e>>2&1)*t*255;return[i,s,r]},ye.ansi256.rgb=function(n){if(n>=232){const r=(n-232)*10+8;return[r,r,r]}n-=16;let e;const t=Math.floor(n/36)/5*255,i=Math.floor((e=n%36)/6)/5*255,s=e%6/5*255;return[t,i,s]},ye.rgb.hex=function(n){const t=(((Math.round(n[0])&255)<<16)+((Math.round(n[1])&255)<<8)+(Math.round(n[2])&255)).toString(16).toUpperCase();return"000000".substring(t.length)+t},ye.hex.rgb=function(n){const e=n.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!e)return[0,0,0];let t=e[0];e[0].length===3&&(t=t.split("").map(a=>a+a).join(""));const i=parseInt(t,16),s=i>>16&255,r=i>>8&255,o=i&255;return[s,r,o]},ye.rgb.hcg=function(n){const e=n[0]/255,t=n[1]/255,i=n[2]/255,s=Math.max(Math.max(e,t),i),r=Math.min(Math.min(e,t),i),o=s-r;let a,l;return o<1?a=r/(1-o):a=0,o<=0?l=0:s===e?l=(t-i)/o%6:s===t?l=2+(i-e)/o:l=4+(e-t)/o,l/=6,l%=1,[l*360,o*100,a*100]},ye.hsl.hcg=function(n){const e=n[1]/100,t=n[2]/100,i=t<.5?2*e*t:2*e*(1-t);let s=0;return i<1&&(s=(t-.5*i)/(1-i)),[n[0],i*100,s*100]},ye.hsv.hcg=function(n){const e=n[1]/100,t=n[2]/100,i=e*t;let s=0;return i<1&&(s=(t-i)/(1-i)),[n[0],i*100,s*100]},ye.hcg.rgb=function(n){const e=n[0]/360,t=n[1]/100,i=n[2]/100;if(t===0)return[i*255,i*255,i*255];const s=[0,0,0],r=e%1*6,o=r%1,a=1-o;let l=0;switch(Math.floor(r)){case 0:s[0]=1,s[1]=o,s[2]=0;break;case 1:s[0]=a,s[1]=1,s[2]=0;break;case 2:s[0]=0,s[1]=1,s[2]=o;break;case 3:s[0]=0,s[1]=a,s[2]=1;break;case 4:s[0]=o,s[1]=0,s[2]=1;break;default:s[0]=1,s[1]=0,s[2]=a}return l=(1-t)*i,[(t*s[0]+l)*255,(t*s[1]+l)*255,(t*s[2]+l)*255]},ye.hcg.hsv=function(n){const e=n[1]/100,t=n[2]/100,i=e+t*(1-e);let s=0;return i>0&&(s=e/i),[n[0],s*100,i*100]},ye.hcg.hsl=function(n){const e=n[1]/100,i=n[2]/100*(1-e)+.5*e;let s=0;return i>0&&i<.5?s=e/(2*i):i>=.5&&i<1&&(s=e/(2*(1-i))),[n[0],s*100,i*100]},ye.hcg.hwb=function(n){const e=n[1]/100,t=n[2]/100,i=e+t*(1-e);return[n[0],(i-e)*100,(1-i)*100]},ye.hwb.hcg=function(n){const e=n[1]/100,t=n[2]/100,i=1-t,s=i-e;let r=0;return s<1&&(r=(i-s)/(1-s)),[n[0],s*100,r*100]},ye.apple.rgb=function(n){return[n[0]/65535*255,n[1]/65535*255,n[2]/65535*255]},ye.rgb.apple=function(n){return[n[0]/255*65535,n[1]/255*65535,n[2]/255*65535]},ye.gray.rgb=function(n){return[n[0]/100*255,n[0]/100*255,n[0]/100*255]},ye.gray.hsl=function(n){return[0,0,n[0]]},ye.gray.hsv=ye.gray.hsl,ye.gray.hwb=function(n){return[0,100,n[0]]},ye.gray.cmyk=function(n){return[0,0,0,n[0]]},ye.gray.lab=function(n){return[n[0],0,0]},ye.gray.hex=function(n){const e=Math.round(n[0]/100*255)&255,i=((e<<16)+(e<<8)+e).toString(16).toUpperCase();return"000000".substring(i.length)+i},ye.rgb.gray=function(n){return[(n[0]+n[1]+n[2])/3/255*100]};const wo=km;function iE(){const n={},e=Object.keys(wo);for(let t=e.length,i=0;i1&&(t=i),n(t))};return"conversion"in n&&(e.conversion=n.conversion),e}function uE(n){const e=function(...t){const i=t[0];if(i==null)return i;i.length>1&&(t=i);const s=n(t);if(typeof s=="object")for(let r=s.length,o=0;o{xs[n]={},Object.defineProperty(xs[n],"channels",{value:Yl[n].channels}),Object.defineProperty(xs[n],"labels",{value:Yl[n].labels});const e=lE(n);Object.keys(e).forEach(i=>{const s=e[i];xs[n][i]=uE(s),xs[n][i].raw=hE(s)})});var dE=xs;const bs=Rm.exports,Ot=dE,Bm=["keyword","gray","hex"],Jl={};for(const n of Object.keys(Ot))Jl[[...Ot[n].labels].sort().join("")]=n;const Co={};function mt(n,e){if(!(this instanceof mt))return new mt(n,e);if(e&&e in Bm&&(e=null),e&&!(e in Ot))throw new Error("Unknown model: "+e);let t,i;if(n==null)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if(n instanceof mt)this.model=n.model,this.color=[...n.color],this.valpha=n.valpha;else if(typeof n=="string"){const s=bs.get(n);if(s===null)throw new Error("Unable to parse color from string: "+n);this.model=s.model,i=Ot[this.model].channels,this.color=s.value.slice(0,i),this.valpha=typeof s.value[i]=="number"?s.value[i]:1}else if(n.length>0){this.model=e||"rgb",i=Ot[this.model].channels;const s=Array.prototype.slice.call(n,0,i);this.color=Zl(s,i),this.valpha=typeof n[i]=="number"?n[i]:1}else if(typeof n=="number")this.model="rgb",this.color=[n>>16&255,n>>8&255,n&255],this.valpha=1;else{this.valpha=1;const s=Object.keys(n);"alpha"in n&&(s.splice(s.indexOf("alpha"),1),this.valpha=typeof n.alpha=="number"?n.alpha:0);const r=s.sort().join("");if(!(r in Jl))throw new Error("Unable to parse color from object: "+JSON.stringify(n));this.model=Jl[r];const{labels:o}=Ot[this.model],a=[];for(t=0;t(n%360+360)%360),saturationl:nt("hsl",1,ht(100)),lightness:nt("hsl",2,ht(100)),saturationv:nt("hsv",1,ht(100)),value:nt("hsv",2,ht(100)),chroma:nt("hcg",1,ht(100)),gray:nt("hcg",2,ht(100)),white:nt("hwb",1,ht(100)),wblack:nt("hwb",2,ht(100)),cyan:nt("cmyk",0,ht(100)),magenta:nt("cmyk",1,ht(100)),yellow:nt("cmyk",2,ht(100)),black:nt("cmyk",3,ht(100)),x:nt("xyz",0,ht(95.047)),y:nt("xyz",1,ht(100)),z:nt("xyz",2,ht(108.833)),l:nt("lab",0,ht(100)),a:nt("lab",1),b:nt("lab",2),keyword(n){return n!==void 0?new mt(n):Ot[this.model].keyword(this.color)},hex(n){return n!==void 0?new mt(n):bs.to.hex(this.rgb().round().color)},hexa(n){if(n!==void 0)return new mt(n);const e=this.rgb().round().color;let t=Math.round(this.valpha*255).toString(16).toUpperCase();return t.length===1&&(t="0"+t),bs.to.hex(e)+t},rgbNumber(){const n=this.rgb().color;return(n[0]&255)<<16|(n[1]&255)<<8|n[2]&255},luminosity(){const n=this.rgb().color,e=[];for(const[t,i]of n.entries()){const s=i/255;e[t]=s<=.04045?s/12.92:((s+.055)/1.055)**2.4}return .2126*e[0]+.7152*e[1]+.0722*e[2]},contrast(n){const e=this.luminosity(),t=n.luminosity();return e>t?(e+.05)/(t+.05):(t+.05)/(e+.05)},level(n){const e=this.contrast(n);return e>=7?"AAA":e>=4.5?"AA":""},isDark(){const n=this.rgb().color;return(n[0]*2126+n[1]*7152+n[2]*722)/1e4<128},isLight(){return!this.isDark()},negate(){const n=this.rgb();for(let e=0;e<3;e++)n.color[e]=255-n.color[e];return n},lighten(n){const e=this.hsl();return e.color[2]+=e.color[2]*n,e},darken(n){const e=this.hsl();return e.color[2]-=e.color[2]*n,e},saturate(n){const e=this.hsl();return e.color[1]+=e.color[1]*n,e},desaturate(n){const e=this.hsl();return e.color[1]-=e.color[1]*n,e},whiten(n){const e=this.hwb();return e.color[1]+=e.color[1]*n,e},blacken(n){const e=this.hwb();return e.color[2]+=e.color[2]*n,e},grayscale(){const n=this.rgb().color,e=n[0]*.3+n[1]*.59+n[2]*.11;return mt.rgb(e,e,e)},fade(n){return this.alpha(this.valpha-this.valpha*n)},opaquer(n){return this.alpha(this.valpha+this.valpha*n)},rotate(n){const e=this.hsl();let t=e.color[0];return t=(t+n)%360,t=t<0?360+t:t,e.color[0]=t,e},mix(n,e){if(!n||!n.rgb)throw new Error('Argument to "mix" was not a Color instance, but rather an instance of '+typeof n);const t=n.rgb(),i=this.rgb(),s=e===void 0?.5:e,r=2*s-1,o=t.alpha()-i.alpha(),a=((r*o==-1?r:(r+o)/(1+r*o))+1)/2,l=1-a;return mt.rgb(a*t.red()+l*i.red(),a*t.green()+l*i.green(),a*t.blue()+l*i.blue(),t.alpha()*s+i.alpha()*(1-s))}};for(const n of Object.keys(Ot)){if(Bm.includes(n))continue;const{channels:e}=Ot[n];mt.prototype[n]=function(...t){return this.model===n?new mt(this):t.length>0?new mt(t,n):new mt([...mE(Ot[this.model][n].raw(this.color)),this.valpha],n)},mt[n]=function(...t){let i=t[0];return typeof i=="number"&&(i=Zl(t,e)),new mt(i,n)}}function pE(n,e){return Number(n.toFixed(e))}function fE(n){return function(e){return pE(e,n)}}function nt(n,e,t){n=Array.isArray(n)?n:[n];for(const i of n)(Co[i]||(Co[i]=[]))[e]=t;return n=n[0],function(i){let s;return i!==void 0?(t&&(i=t(i)),s=this[n](),s.color[e]=i,s):(s=this[n]().color[e],t&&(s=t(s)),s)}}function ht(n){return function(e){return Math.max(0,Math.min(n,e))}}function mE(n){return Array.isArray(n)?n:[n]}function Zl(n,e){for(let t=0;t #include #include #include #include #include #include #include #include #include #include #include #include void main() { v_position = position; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include } `,yE=` uniform vec3 emissive; uniform float height; uniform vec4 topColorVector4; uniform vec4 bottomColorVector4; varying vec3 v_position; varying vec3 vLightFront; varying vec3 vIndirectFront; #ifdef DOUBLE_SIDED varying vec3 vLightBack; varying vec3 vIndirectBack; #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include vec4 diff = bottomColorVector4 - topColorVector4; vec4 percent = diff/height; float x = topColorVector4.x + percent.x*v_position.z; float y = topColorVector4.y + percent.y*v_position.z; float z = topColorVector4.z + percent.z*v_position.z; float r = topColorVector4.w + percent.w*v_position.z; vec4 diffuseColor = vec4(x,y,z,r); ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); vec3 totalEmissiveRadiance = emissive; #include #include #include #include #include #include #include // accumulation #ifdef DOUBLE_SIDED reflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack; #else reflectedLight.indirectDiffuse += vIndirectFront; #endif #include reflectedLight.indirectDiffuse *= BRDF_Lambert( diffuseColor.rgb ); #ifdef DOUBLE_SIDED reflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack; #else reflectedLight.directDiffuse = vLightFront; #endif reflectedLight.directDiffuse *= BRDF_Lambert( diffuseColor.rgb ) * getShadowMask(); // modulation #include vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; #include #include #include #include #include #include #include } `;class vE{constructor(e,t){this.layer=e,this.object=new rn,this.createGlobalMaterial(t),this.layer.add(this.object),this.init(t)}createGlobalMaterial(e){if(e.sideTexture){const t=new Tf().load(e.sideTexture);t.wrapS=t.wrapT=ri,t.offset.set(0,.5),t.repeat.set(.1,.1),this.sideImgMaterial=new vo({depthTest:e.depthTest,map:t,side:Jt})}this.bottomMaterial=new vo({depthTest:e.depthTest,transparent:!0,color:Ao(e.bottomColor),opacity:To(e.bottomColor)}),this.topMaterial=new vo({depthTest:e.depthTest,transparent:!0,color:Ao(e.topColor),opacity:To(e.topColor)})}init(e){e.source.features.forEach(t=>{t.geometry.type==="Polygon"?this.createMesh(t.geometry.coordinates,t.properties,e):t.geometry.type==="MultiPolygon"&&t.geometry.coordinates.forEach(i=>{this.createMesh(i,t.properties,e)})}),this.refresh()}createMesh(e,t,i){if(e.length===0)return;t=t||{};const s=t.height!==void 0?t.height:i.height,r=e[0],o=[],a=[];for(let h=0;h0){const h=new sr(l,{depth:s,bevelEnabled:!1,steps:1}),p=[new vo({visible:!1})];let g;if(i.sideTexture)g=this.sideImgMaterial;else{const v=new ge;v.setHex(Ao(i.sideTopColor));const b=new je(v.r,v.g,v.b,To(i.sideTopColor)),x=new ge;x.setHex(Ao(i.sideBottomColor));const w=new je(x.r,x.g,x.b,To(i.sideBottomColor)),C=il.merge([ne.common,ne.specularmap,ne.envmap,ne.aomap,ne.lightmap,ne.emissivemap,ne.fog,ne.lights,{emissive:{value:new ge("#000")},topColorVector4:{value:w},bottomColorVector4:{value:b},height:{value:s}}]);g=new un({depthTest:i.depthTest,side:Jt,transparent:!0,lights:!0,uniforms:C,vertexShader:_E,fragmentShader:yE})}p.push(g);const m=new sr(l,{depth:0}),f=new ft(m,this.bottomMaterial);this.object.add(f);const _=new ft(h,p);this.object.add(_)}const c=new sr(l,{depth:0}),u=new ft(c,this.topMaterial);u.translateZ(s),this.object.add(u)}convertLngLat(e){var t;return(t=this.layer)==null?void 0:t.convertLngLat(e)}refresh(){var e;(e=this.layer)==null||e.update()}show(){this.object.visible=!0,this.refresh()}hide(){this.object.visible=!1,this.refresh()}remove(){var e;this.object&&((e=this.layer)==null||e.remove(this.object))}destroy(){this.object&&(ym(this.object),this.bottomMaterial&&(this.bottomMaterial.dispose(),this.bottomMaterial=void 0),this.topMaterial&&(this.topMaterial.dispose(),this.topMaterial=void 0),this.sideImgMaterial&&(this.sideImgMaterial.dispose(),this.sideImgMaterial=void 0),this.object=null,this.layer=void 0)}}var xE=vE,Um=oe({name:"ElAmapThreePolygon",mixins:[ae],props:{sideTopColor:{type:String,default:"#ffffff"},sideBottomColor:{type:String,default:"#ffffff"},sideTexture:{type:String},topColor:{type:String,default:"#ffffff"},bottomColor:{type:String,default:"#ffffff"},height:{type:Number,default:30},depthTest:{type:Boolean,default:!0},source:{type:Object,required:!0}},data(){return{}},methods:{__initComponent(n){this.$amapComponent=new xE(this.$parentComponent,n)},destroyComponent(){this.parentInstance.isDestroy||this.$amapComponent.remove(),this.$amapComponent.destroy()}},render(){return null}});Um.__file="src/packages/three/ThreePolygon/ThreePolygon.vue";const zm=ce(Um);var Gm=oe({name:"ElAmapMouseTool",mixins:[ae],props:{type:{type:String,required:!0,default:"marker",validator(n){return["marker","circle","rectangle","polyline","polygon","measureArea","rule","rectZoomIn","rectZoomOut"].includes(n)}},drawOptions:{type:Object,default:()=>null},autoClear:{type:Boolean,default:!0},showTooltip:{type:Boolean,default:!0},tooltipTextMap:{type:Object,default:()=>null},textOptions:{type:Object,default:()=>null}},emits:["draw"],data(){return{preMapCursor:"",tipTexts:{marker:"\u5355\u51FB\u5730\u56FE\u9009\u62E9\u70B9\u4F4D",circle:"\u6309\u4F4F\u9F20\u6807\u5DE6\u952E\u62D6\u62FD\u7ED8\u5236\u5706",rectangle:"\u6309\u4F4F\u9F20\u6807\u5DE6\u952E\u62D6\u62FD\u7ED8\u5236\u77E9\u5F62",polyline:"\u5355\u51FB\u5730\u56FE\u9009\u62E9\u62D0\u70B9\uFF0C\u53CC\u51FB\u5730\u56FE\u5B8C\u6210\u6298\u7EBF\u7ED8\u5236",polygon:"\u5355\u51FB\u5730\u56FE\u9009\u62E9\u62D0\u70B9\uFF0C\u53CC\u51FB\u5730\u56FE\u5B8C\u6210\u591A\u8FB9\u5F62\u7ED8\u5236",measureArea:"\u5355\u51FB\u5730\u56FE\u9009\u62E9\u62D0\u70B9\uFF0C\u53CC\u51FB\u5730\u56FE\u5B8C\u6210\u7ED8\u5236\u5E76\u8BA1\u7B97\u9762\u79EF",rule:"\u5355\u51FB\u5730\u56FE\u9009\u62E9\u62D0\u70B9\uFF0C\u53F3\u51FB\u5730\u56FE\u5B8C\u6210\u7ED8\u5236\u5E76\u8BA1\u7B97\u8DDD\u79BB",rectZoomIn:"\u6309\u4F4F\u9F20\u6807\u5DE6\u952E\u62D6\u62FD\u7ED8\u5236\u77E9\u5F62\uFF0C\u677E\u5F00\u5DE6\u952E\u653E\u5927\u5730\u56FE",rectZoomOut:"\u6309\u4F4F\u9F20\u6807\u5DE6\u952E\u62D6\u62FD\u7ED8\u5236\u77E9\u5F62\uFF0C\u677E\u5F00\u5DE6\u952E\u653E\u5927\u5730\u56FE"}}},methods:{__initComponent(){return new Promise(n=>{AMap.plugin(["AMap.MouseTool"],()=>{this.tooltipTextMap&&Object.assign(this.tipTexts,this.tooltipTextMap),this.$amapComponent=new AMap.MouseTool(this.$parentComponent),this.createTooltip(),this.__type(),this.bindEvent(),this.preMapCursor=this.$parentComponent.getDefaultCursor(),this.$parentComponent.setDefaultCursor("crosshair"),n()})})},__type(){const n=this.type;if(this.$amapComponent[n]){const e=this.drawOptions||{};this.$amapComponent[n](e),this.setText(this.tipTexts[n])}},createTooltip(){if(this.showTooltip){const n=this.textOptions||{};n.anchor="top-left",n.clickable=!1,n.bubble=!0,n.offset=[10,10],this.$text=new AMap.Text(n),this.$parentComponent.add(this.$text),this.$parentComponent.on("mousemove",this.getMousePosition)}},getMousePosition(n){const e=n.lnglat;this.$text.setPosition([e.lng,e.lat])},setText(n){this.$text&&this.$text.setText(n)},bindEvent(){this.$amapComponent.on("draw",n=>{const e=this.type;let t;if(e==="marker")t=n.obj.getPosition().toArray();else if(e==="circle")t={center:n.obj.getCenter().toArray(),radius:n.obj.getRadius()};else if(e==="rectangle"){const i=n.obj.getBounds(),s=i.getSouthWest(),r=i.getNorthEast();t=[s.toArray(),r.toArray()]}else if(e==="polyline")t=n.obj.getPath().map(s=>s.toArray());else if(e==="polygon")t=n.obj.getPath().map(s=>s.toArray());else if(e==="measureArea"){const i=n.obj.getPath().map(s=>s.toArray());t=AMap.GeometryUtil.ringArea(i)}else if(e==="rule"){const i=n.obj.getPath().map(s=>s.toArray());t=AMap.GeometryUtil.distanceOfLine(i)}else(e==="rectZoomIn"||e==="rectZoomOut")&&(t=!0);this.$emit("draw",t,n.obj),this.autoClear&&(this.$$clear(),this.__type())})},$$close(n=!0){this.$amapComponent&&this.$amapComponent.close(n)},$$open(){this.__type()},$$clear(){this.$$close(!0)},destroyComponent(){this.parentInstance.isDestroy||(this.$amapComponent.close(!0),this.$parentComponent.setDefaultCursor(this.preMapCursor),this.$text&&(this.$parentComponent.off("mousemove",this.getMousePosition),this.$parentComponent.remove(this.$text),this.$text=null)),this.$amapComponent=null,this.$parentComponent=null}},render(){return null}});Gm.__file="src/packages/util/MouseTool/MouseTool.vue";const Vm=ce(Gm),Kl=new WeakMap;class bE extends Jn{constructor(e){super(e);this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}setDecoderPath(e){return this.decoderPath=e,this}setDecoderConfig(e){return this.decoderConfig=e,this}setWorkerLimit(e){return this.workerLimit=e,this}load(e,t,i,s){const r=new gs(this.manager);r.setPath(this.path),r.setResponseType("arraybuffer"),r.setRequestHeader(this.requestHeader),r.setWithCredentials(this.withCredentials),r.load(e,o=>{const a={attributeIDs:this.defaultAttributeIDs,attributeTypes:this.defaultAttributeTypes,useUniqueIDs:!1};this.decodeGeometry(o,a).then(t).catch(s)},i,s)}decodeDracoFile(e,t,i,s){const r={attributeIDs:i||this.defaultAttributeIDs,attributeTypes:s||this.defaultAttributeTypes,useUniqueIDs:!!i};this.decodeGeometry(e,r).then(t)}decodeGeometry(e,t){for(const l in t.attributeTypes){const c=t.attributeTypes[l];c.BYTES_PER_ELEMENT!==void 0&&(t.attributeTypes[l]=c.name)}const i=JSON.stringify(t);if(Kl.has(e)){const l=Kl.get(e);if(l.key===i)return l.promise;if(e.byteLength===0)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let s;const r=this.workerNextTaskID++,o=e.byteLength,a=this._getWorker(r,o).then(l=>(s=l,new Promise((c,u)=>{s._callbacks[r]={resolve:c,reject:u},s.postMessage({type:"decode",id:r,taskConfig:t,buffer:e},[e])}))).then(l=>this._createGeometry(l.geometry));return a.catch(()=>!0).then(()=>{s&&r&&this._releaseTask(s,r)}),Kl.set(e,{key:i,promise:a}),a}_createGeometry(e){const t=new xt;e.index&&t.setIndex(new dt(e.index.array,1));for(let i=0;i{i.load(e,s,void 0,r)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const e=typeof WebAssembly!="object"||this.decoderConfig.type==="js",t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then(i=>{const s=i[0];e||(this.decoderConfig.wasmBinary=i[1]);const r=ME.toString(),o=["/* draco decoder */",s,"","/* worker */",r.substring(r.indexOf("{")+1,r.lastIndexOf("}"))].join(` `);this.workerSourceURL=URL.createObjectURL(new Blob([o]))}),this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>{if(this.workerPool.lengthr._taskLoad?-1:1});const i=this.workerPool[this.workerPool.length-1];return i._taskCosts[e]=t,i._taskLoad+=t,i})}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){console.log("Task load: ",this.workerPool.map(e=>e._taskLoad))}dispose(){for(let e=0;e{const h=u.draco,d=new h.Decoder,p=new h.DecoderBuffer;p.Init(new Int8Array(l),l.byteLength);try{const g=t(h,d,p,c),m=g.attributes.map(f=>f.array.buffer);g.index&&m.push(g.index.array.buffer),self.postMessage({type:"decode",id:a.id,geometry:g},m)}catch(g){console.error(g),self.postMessage({type:"error",id:a.id,error:g.message})}finally{h.destroy(p),h.destroy(d)}});break}};function t(o,a,l,c){const u=c.attributeIDs,h=c.attributeTypes;let d,p;const g=a.GetEncodedGeometryType(l);if(g===o.TRIANGULAR_MESH)d=new o.Mesh,p=a.DecodeBufferToMesh(l,d);else if(g===o.POINT_CLOUD)d=new o.PointCloud,p=a.DecodeBufferToPointCloud(l,d);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!p.ok()||d.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+p.error_msg());const m={index:null,attributes:[]};for(const f in u){const _=self[h[f]];let v,b;if(c.useUniqueIDs)b=u[f],v=a.GetAttributeByUniqueId(d,b);else{if(b=a.GetAttributeId(d,o[u[f]]),b===-1)continue;v=a.GetAttribute(d,b)}m.attributes.push(s(o,a,d,f,_,v))}return g===o.TRIANGULAR_MESH&&(m.index=i(o,a,d)),o.destroy(d),m}function i(o,a,l){const u=l.num_faces()*3,h=u*4,d=o._malloc(h);a.GetTrianglesUInt32Array(l,h,d);const p=new Uint32Array(o.HEAPF32.buffer,d,u).slice();return o._free(d),{array:p,itemSize:1}}function s(o,a,l,c,u,h){const d=h.num_components(),g=l.num_points()*d,m=g*u.BYTES_PER_ELEMENT,f=r(o,u),_=o._malloc(m);a.GetAttributeDataArrayForAllPoints(l,h,f,m,_);const v=new u(o.HEAPF32.buffer,_,g).slice();return o._free(_),{name:c,array:v,itemSize:d}}function r(o,a){switch(a){case Float32Array:return o.DT_FLOAT32;case Int8Array:return o.DT_INT8;case Int16Array:return o.DT_INT16;case Int32Array:return o.DT_INT32;case Uint8Array:return o.DT_UINT8;case Uint16Array:return o.DT_UINT16;case Uint32Array:return o.DT_UINT32}}}function Hm(n){let e;try{e=new URL(n,"http://fakehost.com/")}catch{return null}const t=e.pathname.split("/").pop(),i=t.lastIndexOf(".");return i===-1||i===t.length-1?null:t.substring(i+1)}function SE(n){Promise.resolve().then(n)}class wE{constructor(){this.maxSize=800,this.minSize=600,this.unloadPercent=.05,this.itemSet=new Map,this.itemList=[],this.usedSet=new Set,this.callbacks=new Map,this.unloadPriorityCallback=null;const e=this.itemSet;this.defaultPriorityCallback=t=>e.get(t)}isFull(){return this.itemSet.size>=this.maxSize}add(e,t){const i=this.itemSet;if(i.has(e)||this.isFull())return!1;const s=this.usedSet,r=this.itemList,o=this.callbacks;return r.push(e),s.add(e),i.set(e,Date.now()),o.set(e,t),!0}remove(e){const t=this.usedSet,i=this.itemSet,s=this.itemList,r=this.callbacks;if(i.has(e)){r.get(e)(e);const o=s.indexOf(e);return s.splice(o,1),t.delete(e),i.delete(e),r.delete(e),!0}return!1}markUsed(e){const t=this.itemSet,i=this.usedSet;t.has(e)&&!i.has(e)&&(t.set(e,Date.now()),i.add(e))}markAllUnused(){this.usedSet.clear()}unloadUnusedContent(){const e=this.unloadPercent,t=this.minSize,i=this.itemList,s=this.itemSet,r=this.usedSet,o=this.callbacks,a=i.length-r.size,l=i.length-t,c=this.unloadPriorityCallback||this.defaultPriorityCallback;if(l>0&&a>0){i.sort((g,m)=>{const f=r.has(g),_=r.has(m);return f&&_?0:!f&&!_?c(m)-c(g):f?1:-1});const u=Math.min(l,a),h=Math.max(t*e,u*e);let d=Math.min(h,a);d=Math.ceil(d);const p=i.splice(0,d);for(let g=0,m=p.length;g{this.scheduled=!1,this.unloadUnusedContent(),e&&this.markAllUnused()}))}}class Wm{constructor(){this.maxJobs=6,this.items=[],this.callbacks=new Map,this.currJobs=0,this.scheduled=!1,this.autoUpdate=!0,this.priorityCallback=()=>{throw new Error("PriorityQueue: PriorityCallback function not defined.")},this.schedulingCallback=e=>{requestAnimationFrame(e)},this._runjobs=()=>{this.tryRunJobs(),this.scheduled=!1}}sort(){const e=this.priorityCallback;this.items.sort(e)}add(e,t){return new Promise((i,s)=>{const r=(...l)=>t(...l).then(i).catch(s),o=this.items,a=this.callbacks;o.push(e),a.set(e,r),this.autoUpdate&&this.scheduleJobRun()})}remove(e){const t=this.items,i=this.callbacks,s=t.indexOf(e);s!==-1&&(t.splice(s,1),i.delete(e))}tryRunJobs(){this.sort();const e=this.items,t=this.callbacks,i=this.maxJobs;let s=this.currJobs;for(;i>s&&e.length>0;){s++;const r=e.pop(),o=t.get(r);t.delete(r),o(r).then(()=>{this.currJobs--,this.autoUpdate&&this.scheduleJobRun()}).catch(()=>{this.currJobs--,this.autoUpdate&&this.scheduleJobRun()})}this.currJobs=s}scheduleJobRun(){this.scheduled||(this.schedulingCallback(this._runjobs),this.scheduled=!0)}}const Eo=0,Lo=1,Ql=2,yr=3,Ro=4,Po=6378137,CE=1/298.257223563,AE=-(CE*Po-Po);function ec(n){return n===yr||n===Ro}function Ci(n,e){return n.__lastFrameVisited===e&&n.__used}function jm(n,e){n.__lastFrameVisited!==e&&(n.__lastFrameVisited=e,n.__used=!1,n.__inFrustum=!1,n.__isLeaf=!1,n.__visible=!1,n.__active=!1,n.__error=1/0,n.__distanceFromCamera=1/0,n.__childrenWereVisible=!1,n.__allChildrenLoaded=!1)}function qm(n,e,t){if(jm(n,e),n.__used=!0,t.markUsed(n),n.__contentEmpty){const i=n.children;for(let s=0,r=i.length;s0&&n.__depth+1>=r))return!0;let u=!1;const h=n.children;for(let d=0,p=h.length;dn.__depth!==e.__depth?n.__depth>e.__depth?-1:1:n.__inFrustum!==e.__inFrustum?n.__inFrustum?1:-1:n.__used!==e.__used?n.__used?1:-1:n.__error!==e.__error?n.__error>e.__error?1:-1:n.__distanceFromCamera!==e.__distanceFromCamera?n.__distanceFromCamera>e.__distanceFromCamera?-1:1:0,TE=n=>1/(n.__depthFromRenderedParent+1);class EE{get rootTileSet(){const e=this.tileSets[this.rootURL];return!e||e instanceof Promise?null:e}get root(){const e=this.rootTileSet;return e?e.root:null}constructor(e){this.tileSets={},this.rootURL=e,this.fetchOptions={},this.preprocessURL=null;const t=new wE;t.unloadPriorityCallback=TE;const i=new Wm;i.maxJobs=4,i.priorityCallback=Qm;const s=new Wm;s.maxJobs=1,s.priorityCallback=Qm,this.lruCache=t,this.downloadQueue=i,this.parseQueue=s,this.stats={parsing:0,downloading:0,failed:0,inFrustum:0,used:0,active:0,visible:0},this.frameCount=0,this.errorTarget=6,this.errorThreshold=1/0,this.loadSiblings=!0,this.displayActiveTiles=!1,this.maxDepth=1/0,this.stopAtEmptyTiles=!0}traverse(e,t){const s=this.tileSets[this.rootURL];!s||!s.root||tc(s.root,e,t)}update(){const e=this.stats,t=this.lruCache,i=this.tileSets,s=i[this.rootURL];if(this.rootURL in i){if(!s||!s.root)return}else{this.loadRootTileSet(this.rootURL);return}const r=s.root;e.inFrustum=0,e.used=0,e.active=0,e.visible=0,this.frameCount++,Ym(r,this),Jm(r,this),Zm(r,this),Km(r,this),t.scheduleUnload()}parseTile(e,t,i){return null}disposeTile(e){}preprocessNode(e,t,i){if(e.content&&(!("uri"in e.content)&&"url"in e.content&&(e.content.uri=e.content.url,delete e.content.url),e.content.uri&&(e.content.uri=new URL(e.content.uri,i+"/").toString()),e.content.boundingVolume&&!("box"in e.content.boundingVolume||"sphere"in e.content.boundingVolume||"region"in e.content.boundingVolume)&&delete e.content.boundingVolume),e.parent=t,e.children=e.children||[],e.content&&e.content.uri){const r=Hm(e.content.uri),o=Boolean(r&&r.toLowerCase()==="json");e.__externalTileSet=o,e.__contentEmpty=o}else e.__externalTileSet=!1,e.__contentEmpty=!0;e.__distanceFromCamera=1/0,e.__error=1/0,e.__inFrustum=!1,e.__isLeaf=!1,e.__usedLastFrame=!1,e.__used=!1,e.__wasSetVisible=!1,e.__visible=!1,e.__childrenWereVisible=!1,e.__allChildrenLoaded=!1,e.__wasSetActive=!1,e.__active=!1,e.__loadingState=Eo,e.__loadIndex=0,e.__loadAbort=null,e.__depthFromRenderedParent=-1,t===null?(e.__depth=0,e.refine=e.refine||"REPLACE"):(e.__depth=t.__depth+1,e.refine=e.refine||t.refine)}setTileActive(e,t){}setTileVisible(e,t){}calculateError(e){return 0}tileInView(e){return!0}resetFailedTiles(){const e=this.stats;e.failed!==0&&(this.traverse(t=>{t.__loadingState===Ro&&(t.__loadingState=Eo)}),e.failed=0)}fetchTileSet(e,t,i=null){return fetch(e,t).then(s=>{if(s.ok)return s.json();throw new Error(`TilesRenderer: Failed to load tileset "${e}" with status ${s.status} : ${s.statusText}`)}).then(s=>{const r=s.asset.version;console.assert(r==="1.0"||r==="0.0",'asset.version is expected to be a string of "1.0" or "0.0"');let o=e.replace(/\/[^\/]*\/?$/,"");return o=new URL(o,window.location.href).toString(),tc(s.root,(a,l)=>this.preprocessNode(a,l,o),null,i,i?i.__depth:0),s})}loadRootTileSet(e){const t=this.tileSets;if(e in t)return t[e]instanceof Error?Promise.reject(t[e]):Promise.resolve(t[e]);{const i=this.fetchTileSet(this.preprocessURL?this.preprocessURL(e):e,this.fetchOptions).then(s=>{t[e]=s});return i.catch(s=>{console.error(s),t[e]=s}),t[e]=i,i}}requestTileContents(e){if(e.__loadingState!==Eo)return;const t=this.stats,i=this.lruCache,s=this.downloadQueue,r=this.parseQueue,o=e.__externalTileSet;i.add(e,h=>{h.__loadingState===Lo?(h.__loadAbort.abort(),h.__loadAbort=null):o?h.children.length=0:this.disposeTile(h),h.__loadingState===Lo?t.downloading--:h.__loadingState===Ql&&t.parsing--,h.__loadingState=Eo,h.__loadIndex++,r.remove(h),s.remove(h)}),e.__loadIndex++;const a=e.__loadIndex,l=new AbortController,c=l.signal;t.downloading++,e.__loadAbort=l,e.__loadingState=Lo;const u=h=>{e.__loadIndex===a&&(h.name!=="AbortError"?(r.remove(e),s.remove(e),e.__loadingState===Ql?t.parsing--:e.__loadingState===Lo&&t.downloading--,t.failed++,console.error(`TilesRenderer : Failed to load tile at url "${e.content.uri}".`),console.error(h),e.__loadingState=Ro):i.remove(e))};o?s.add(e,h=>{if(h.__loadIndex!==a)return Promise.resolve();const d=this.preprocessURL?this.preprocessURL(h.content.uri):h.content.uri;return this.fetchTileSet(d,Object.assign({signal:c},this.fetchOptions),h)}).then(h=>{e.__loadIndex===a&&(t.downloading--,e.__loadAbort=null,e.__loadingState=yr,e.children.push(h.root))}).catch(u):s.add(e,h=>{if(h.__loadIndex!==a)return Promise.resolve();const d=this.preprocessURL?this.preprocessURL(h.content.uri):h.content.uri;return fetch(d,Object.assign({signal:c},this.fetchOptions))}).then(h=>{if(e.__loadIndex===a){if(h.ok)return h.arrayBuffer();throw new Error(`Failed to load model with error code ${h.status}`)}}).then(h=>{if(e.__loadIndex===a)return t.downloading--,t.parsing++,e.__loadAbort=null,e.__loadingState=Ql,r.add(e,d=>{if(d.__loadIndex!==a)return Promise.resolve();const p=d.content.uri,g=Hm(p);return this.parseTile(h,d,g)})}).then(()=>{e.__loadIndex===a&&(t.parsing--,e.__loadingState=yr,e.__wasSetVisible&&this.setTileVisible(e,!0),e.__wasSetActive&&this.setTileActive(e,!0))}).catch(u)}dispose(){const e=this.lruCache;this.traverse(t=>{e.remove(t)}),this.stats={parsing:0,downloading:0,failed:0,inFrustum:0,used:0,active:0,visible:0},this.frameCount=0}}function eg(n){return new TextDecoder().decode(n)}class Io{constructor(e,t,i,s){this.buffer=e,this.binOffset=t+i,this.binLength=s;let r=null;if(i!==0){const o=new Uint8Array(e,t,i);r=JSON.parse(eg(o))}else r={};this.header=r}getKeys(){return Object.keys(this.header)}getData(e,t,i=null,s=null){const r=this.header;if(!(e in r))return null;const o=r[e];if(o instanceof Object){if(Array.isArray(o))return o;{const{buffer:a,binOffset:l,binLength:c}=this,u=o.byteOffset||0,h=o.type||s,d=o.componentType||i;if("type"in o&&s&&o.type!==s)throw new Error("FeatureTable: Specified type does not match expected type.");let p;switch(h){case"SCALAR":p=1;break;case"VEC2":p=2;break;case"VEC3":p=3;break;case"VEC4":p=4;break;default:throw new Error(`FeatureTable : Feature type not provided for "${e}".`)}let g;const m=l+u,f=t*p;switch(d){case"BYTE":g=new Int8Array(a,m,f);break;case"UNSIGNED_BYTE":g=new Uint8Array(a,m,f);break;case"SHORT":g=new Int16Array(a,m,f);break;case"UNSIGNED_SHORT":g=new Uint16Array(a,m,f);break;case"INT":g=new Int32Array(a,m,f);break;case"UNSIGNED_INT":g=new Uint32Array(a,m,f);break;case"FLOAT":g=new Float32Array(a,m,f);break;case"DOUBLE":g=new Float64Array(a,m,f);break;default:throw new Error(`FeatureTable : Feature component type not provided for "${e}".`)}if(m+f*g.BYTES_PER_ELEMENT>l+c)throw new Error("FeatureTable: Feature data read outside binary body length.");return g}}else return o}}class nc extends Io{constructor(e,t,i,s,r){super(e,i,s,r);this.batchSize=t}getData(e,t=null,i=null){return super.getData(e,this.batchSize,t,i)}}class vr{constructor(){this.fetchOptions={},this.workingPath=""}load(e){return fetch(e,this.fetchOptions).then(t=>{if(!t.ok)throw new Error(`Failed to load file "${e}" with status ${t.status} : ${t.statusText}`);return t.arrayBuffer()}).then(t=>(this.workingPath===""&&(this.workingPath=this.workingPathForURL(e)),this.parse(t)))}resolveExternalURL(e){return/^[^\\/]/.test(e)?this.workingPath+"/"+e:e}workingPathForURL(e){const t=e.split(/[\\/]/g);return t.pop(),t.join("/")+"/"}parse(e){throw new Error("LoaderBase: Parse not implemented.")}}function Ms(n){let e;if(n instanceof DataView?e=n:e=new DataView(n),String.fromCharCode(e.getUint8(0))==="{")return null;let t="";for(let i=0;i<4;i++)t+=String.fromCharCode(e.getUint8(i));return t}class LE extends vr{parse(e){const t=new DataView(e),i=Ms(t);console.assert(i==="b3dm");const s=t.getUint32(4,!0);console.assert(s===1);const r=t.getUint32(8,!0);console.assert(r===e.byteLength);const o=t.getUint32(12,!0),a=t.getUint32(16,!0),l=t.getUint32(20,!0),c=t.getUint32(24,!0),u=28,h=e.slice(u,u+o+a),d=new Io(h,0,o,a),p=u+o+a,g=e.slice(p,p+l+c),m=new nc(g,d.getData("BATCH_LENGTH"),0,l,c),f=p+l+c,_=new Uint8Array(e,f,r-f);return{version:s,featureTable:d,batchTable:m,glbBytes:_}}}class tg extends LE{constructor(e=ms){super();this.manager=e,this.adjustmentTransform=new Me}parse(e){const t=super.parse(e),i=t.glbBytes.slice().buffer;return new Promise((s,r)=>{const o=this.manager,a=this.fetchOptions,l=o.getHandler("path.gltf")||new cr(o);a.credentials==="include"&&a.mode==="cors"&&l.setCrossOrigin("use-credentials"),"credentials"in a&&l.setWithCredentials(a.credentials==="include"),a.headers&&l.setRequestHeader(a.headers);let c=this.workingPath;!/[\\/]$/.test(c)&&c.length&&(c+="/");const u=this.adjustmentTransform;l.parse(i,c,h=>{const{batchTable:d,featureTable:p}=t,{scene:g}=h,m=p.getData("RTC_CENTER");m&&(g.position.x+=m[0],g.position.y+=m[1],g.position.z+=m[2]),h.scene.updateMatrix(),h.scene.matrix.multiply(u),h.scene.matrix.decompose(h.scene.position,h.scene.quaternion,h.scene.scale),h.batchTable=d,h.featureTable=p,g.batchTable=d,g.featureTable=p,s(h)},r)})}}class RE extends vr{parse(e){const t=new DataView(e),i=Ms(t);console.assert(i==="pnts");const s=t.getUint32(4,!0);console.assert(s===1);const r=t.getUint32(8,!0);console.assert(r===e.byteLength);const o=t.getUint32(12,!0),a=t.getUint32(16,!0),l=t.getUint32(20,!0),c=t.getUint32(24,!0),u=28,h=e.slice(u,u+o+a),d=new Io(h,0,o,a),p=u+o+a,g=e.slice(p,p+l+c),m=new nc(g,d.getData("BATCH_LENGTH")||d.getData("POINTS_LENGTH"),0,l,c);return Promise.resolve({version:s,featureTable:d,batchTable:m})}}class ng extends RE{constructor(e=ms){super();this.manager=e}parse(e){return super.parse(e).then(t=>{const{featureTable:i}=t,s=i.getData("POINTS_LENGTH"),r=i.getData("POSITION",s,"FLOAT","VEC3"),o=i.getData("RGB",s,"UNSIGNED_BYTE","VEC3");["QUANTIZED_VOLUME_OFFSET","QUANTIZED_VOLUME_SCALE","CONSTANT_RGBA","BATCH_LENGTH","POSITION_QUANTIZED","RGBA","RGB565","NORMAL","NORMAL_OCT16P"].forEach(h=>{h in i.header&&console.warn(`PNTSLoader: Unsupported FeatureTable feature "${h}" detected.`)});const a=new xt;a.setAttribute("position",new dt(r,3,!1));const l=new xl;l.size=2,l.sizeAttenuation=!1,o!==null&&(a.setAttribute("color",new dt(o,3,!0)),l.vertexColors=!0);const c=new of(a,l);t.scene=c,t.scene.featureTable=i;const u=i.getData("RTC_CENTER");return u&&(t.scene.position.x+=u[0],t.scene.position.y+=u[1],t.scene.position.z+=u[2]),t})}}class PE extends vr{parse(e){const t=new DataView(e),i=Ms(t);console.assert(i==="i3dm");const s=t.getUint32(4,!0);console.assert(s===1);const r=t.getUint32(8,!0);console.assert(r===e.byteLength);const o=t.getUint32(12,!0),a=t.getUint32(16,!0),l=t.getUint32(20,!0),c=t.getUint32(24,!0),u=t.getUint32(28,!0),h=32,d=e.slice(h,h+o+a),p=new Io(d,0,o,a),g=h+o+a,m=e.slice(g,g+l+c),f=new nc(m,p.getData("INSTANCES_LENGTH"),0,l,c),_=g+l+c,v=new Uint8Array(e,_,r-_);let b=null,x=null;if(u)b=v,x=Promise.resolve();else{const w=this.resolveExternalURL(eg(v));x=fetch(w,this.fetchOptions).then(C=>{if(!C.ok)throw new Error(`I3DMLoaderBase : Failed to load file "${w}" with status ${C.status} : ${C.statusText}`);return C.arrayBuffer()}).then(C=>{b=new Uint8Array(C)})}return x.then(()=>({version:s,featureTable:p,batchTable:f,glbBytes:b}))}}const ig=new E,ic=new E,sc=new E,sg=new E,rc=new tn,Do=new E,Fo=new Me;class rg extends PE{constructor(e=ms){super();this.manager=e,this.adjustmentTransform=new Me}resolveExternalURL(e){return this.manager.resolveURL(super.resolveExternalURL(e))}parse(e){return super.parse(e).then(t=>{const{featureTable:i,batchTable:s}=t,r=t.glbBytes.slice().buffer;return new Promise((o,a)=>{const l=this.fetchOptions,c=this.manager,u=c.getHandler("path.gltf")||new cr(c);l.credentials==="include"&&l.mode==="cors"&&u.setCrossOrigin("use-credentials"),"credentials"in l&&u.setWithCredentials(l.credentials==="include"),l.headers&&u.setRequestHeader(l.headers);let h=this.workingPath;/[\\/]$/.test(h)||(h+="/");const d=this.adjustmentTransform;u.parse(r,h,p=>{const g=i.getData("INSTANCES_LENGTH"),m=i.getData("POSITION",g,"FLOAT","VEC3"),f=i.getData("NORMAL_UP",g,"FLOAT","VEC3"),_=i.getData("NORMAL_RIGHT",g,"FLOAT","VEC3"),v=i.getData("SCALE_NON_UNIFORM",g,"FLOAT","VEC3"),b=i.getData("SCALE",g,"FLOAT","SCALAR");["RTC_CENTER","QUANTIZED_VOLUME_OFFSET","QUANTIZED_VOLUME_SCALE","EAST_NORTH_UP","POSITION_QUANTIZED","NORMAL_UP_OCT32P","NORMAL_RIGHT_OCT32P"].forEach(L=>{L in i.header&&console.warn(`I3DMLoader: Unsupported FeatureTable feature "${L}" detected.`)});const x=new Map,w=[];p.scene.traverse(L=>{if(L.isMesh){const{geometry:y,material:A}=L,I=new A1(y,A,g);I.position.copy(L.position),I.rotation.copy(L.rotation),I.scale.copy(L.scale),w.push(I),x.set(L,I)}});const C=new E;for(let L=0;L{const A=y.parent;A&&(A.remove(y),A.add(L),L.updateMatrixWorld(),L.position.copy(C).applyMatrix4(L.matrixWorld))});for(let L=0;L{const a=new rn;return o.forEach(l=>{a.add(l.scene)}),{tiles:o,scene:a}})}}class FE{constructor(){this.name="CESIUM_RTC"}afterRoot(e){const{center:t}=e.parser.json.extensions.CESIUM_RTC;e.scene.position.x+=t[0],e.scene.position.y+=t[1],e.scene.position.z+=t[2]}}class OE extends vr{constructor(e=ms){super();this.manager=e}parse(e){return new Promise((t,i)=>{const s=this.manager,r=this.fetchOptions;let o=s.getHandler("path.gltf")||s.getHandler("path.glb");o||(o=new cr(s),o.register(()=>new FE),r.credentials==="include"&&r.mode==="cors"&&o.setCrossOrigin("use-credentials"),"credentials"in r&&o.setWithCredentials(r.credentials==="include"),r.headers&&o.setRequestHeader(r.headers));let a=o.resourcePath||o.path||this.workingPath;!/[\\/]$/.test(a)&&a.length&&(a+="/"),o.parse(e,a,l=>{t(l)},i)})}}const Oo=new Me;class NE extends rn{constructor(e){super();this.name="TilesRenderer.TilesGroup",this.tilesRenderer=e}raycast(e,t){this.tilesRenderer.optimizeRaycast&&this.tilesRenderer.raycast(e,t)}updateMatrixWorld(e){if(this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldNeedsUpdate||e){this.parent===null?Oo.copy(this.matrix):Oo.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1;const t=Oo.elements,i=this.matrixWorld.elements;let s=!1;for(let r=0;r<16;r++){const o=t[r],a=i[r];if(Math.abs(o-a)>Number.EPSILON){s=!0;break}}if(s){this.matrixWorld.copy(Oo);const r=this.children;for(let o=0,a=r.length;o=t&&v<=i&&b>=s&&b<=r){const x=$E(e);d.push(x),this.getCartographicToPosition(v,b,m,x)}}}return d}getBoundingBox(e,t){lg();const{latStart:i,latEnd:s,lonStart:r,lonEnd:o}=this;if(s-i{Object.getPrototypeOf(i).raycast.call(i,e,t)})}function hg(n,e,t,i){if(t.has(n))if(lc(n.cached.scene,i,qt),qt.length>0){qt.length>1&&qt.sort(ac);const l=qt[0];return qt.length=0,l}else return null;const s=[],r=n.children;for(let l=0,c=r.length;l1e-6&&console.warn("ThreeTilesRenderer : Non uniform scale used for tile which may cause issues when raycasting.");const _={distance:1/0,tile:null};s.push(_),_.distance=cg.distanceToSquared(Ts.origin)*f*f,_.tile=u}else continue}s.sort(ac);let o=1/0,a=null;for(let l=0,c=s.length;lo)break;{const d=u.tile,p=d.cached.scene;let g=null;if(t.has(d)?(lc(p,i,qt),qt.length>0&&(qt.length>1&&qt.sort(ac),g=qt[0])):g=hg(d,e,t,i),g){const m=g.distance*g.distance;m{t.frustumCulled=t[dg]&&e})}class VE extends EE{get autoDisableRendererCulling(){return this._autoDisableRendererCulling}set autoDisableRendererCulling(e){this._autoDisableRendererCulling!==e&&(super._autoDisableRendererCulling=e,this.forEachLoadedModel(t=>{pg(t,!e)}))}constructor(...e){super(...e);this.group=new NE(this),this.cameras=[],this.cameraMap=new Map,this.cameraInfo=[],this.activeTiles=new Set,this.visibleTiles=new Set,this._autoDisableRendererCulling=!0,this.optimizeRaycast=!0,this.onLoadTileSet=null,this.onLoadModel=null,this.onDisposeModel=null,this.onTileVisibilityChange=null;const t=new Af;t.setURLModifier(s=>this.preprocessURL?this.preprocessURL(s):s),this.manager=t;const i=this;this._overridenRaycast=function(s,r){i.optimizeRaycast||Object.getPrototypeOf(this).raycast.call(this,s,r)}}getBounds(e){if(!this.root)return!1;const t=this.root.cached,i=t.box,s=t.boxTransform;return i?(e.copy(i),e.applyMatrix4(s),!0):!1}getOrientedBounds(e,t){if(!this.root)return!1;const i=this.root.cached,s=i.box,r=i.boxTransform;return s?(e.copy(s),t.copy(r),!0):!1}getBoundingSphere(e){if(!this.root)return!1;const t=this.root.cached.sphere;return t?(e.copy(t),!0):!1}forEachLoadedModel(e){this.traverse(t=>{const i=t.cached.scene;i&&e(i,t)})}raycast(e,t){if(!!this.root)if(e.firstHitOnly){const i=hg(this.root,this.group,this.activeTiles,e);i&&t.push(i)}else ug(this.root,this.group,this.activeTiles,e,t)}hasCamera(e){return this.cameraMap.has(e)}setCamera(e){const t=this.cameras,i=this.cameraMap;return i.has(e)?!1:(i.set(e,new te),t.push(e),!0)}setResolution(e,t,i){const s=this.cameraMap;return s.has(e)?(t instanceof te?s.get(e).copy(t):s.get(e).set(t,i),!0):!1}setResolutionFromRenderer(e,t){const i=this.cameraMap;if(!i.has(e))return!1;const s=i.get(e);return t.getSize(s),s.multiplyScalar(t.getPixelRatio()),!0}deleteCamera(e){const t=this.cameras,i=this.cameraMap;if(i.has(e)){const s=t.indexOf(e);return t.splice(s,1),i.delete(e),!0}return!1}fetchTileSet(e,...t){const i=super.fetchTileSet(e,...t);return i.then(s=>{this.onLoadTileSet&&Promise.resolve().then(()=>{this.onLoadTileSet(s,e)})}),i}update(){const e=this.group,t=this.cameras,i=this.cameraMap,s=this.cameraInfo;if(t.length===0){console.warn("TilesRenderer: no cameras defined. Cannot update 3d tiles.");return}for(;s.length>t.length;)s.pop();for(;s.length1e-6&&console.warn("ThreeTilesRenderer : Non uniform scale used for tile which may cause issues when calculating screen space error.");for(let o=0,a=s.length;o_.scene);break}case"pnts":{const f=new ng(l);f.workingPath=o,f.fetchOptions=a,u=f.parse(e).then(_=>_.scene);break}case"i3dm":{const f=new rg(l);f.workingPath=o,f.fetchOptions=a,f.adjustmentTransform.copy(on),u=f.parse(e).then(_=>_.scene);break}case"cmpt":{const f=new DE(l);f.workingPath=o,f.fetchOptions=a,f.adjustmentTransform.copy(on),u=f.parse(e).then(_=>_.scene);break}case"gltf":case"glb":const m=new OE(l);m.workingPath=o,m.fetchOptions=a,u=m.parse(e).then(f=>f.scene);break;default:console.warn(`TilesRenderer: Content type "${g}" not supported.`),u=Promise.resolve(null);break}return u.then(m=>{if(t._loadIndex!==c)return;m.updateMatrix(),(g==="glb"||g==="gltf")&&m.matrix.multiply(on),m.matrix.premultiply(p),m.matrix.decompose(m.position,m.quaternion,m.scale),m.traverse(b=>{b[dg]=b.frustumCulled}),pg(m,!this.autoDisableRendererCulling),d.scene=m,m.traverse(b=>{b.raycast=this._overridenRaycast});const f=[],_=[],v=[];m.traverse(b=>{if(b.geometry&&_.push(b.geometry),b.material){const x=b.material;f.push(b.material);for(const w in x){const C=x[w];C&&C.isTexture&&v.push(C)}}}),d.materials=f,d.geometry=_,d.textures=v,this.onLoadModel&&this.onLoadModel(m,t)})}disposeTile(e){const t=e.cached;if(t.scene){const i=t.materials,s=t.geometry,r=t.textures,o=t.scene.parent;for(let a=0,l=s.length;a0){for(let s=0;s0)for(let s=0;s{e.disposeTile(t)}),e.lruCache.itemSet.clear(),e.lruCache.itemList=[],e.lruCache.callbacks.clear(),e.lruCache=null,e.visibleTiles.clear(),e.activeTiles.clear(),e.downloadQueue.callbacks.clear(),e.downloadQueue.items=[],e.downloadQueue=null,e.parseQueue.callbacks.clear(),e.parseQueue.items=[],e.parseQueue=null,this.clearGroup(this.group),e.tileSets={},e.cameraMap.clear(),e.cameras=[],e.cameraInfo=[],e.group=null}clearGroup(e){e.traverse(t=>{t.isMesh&&(t.geometry.dispose(),t.material.dispose(),t.material.texture&&t.material.texture.dispose&&t.material.texture.dispose()),delete t.featureTable,delete t.batchTable}),delete e.tilesRenderer,e.remove(...e.children)}}class jE extends HE{constructor(e,t){super(),this.animationFrame=-1,this.mouse=new te,this.layer=e;const i=new WE(t.url);i.setCamera(this.layer.getCamera()),i.setResolutionFromRenderer(this.layer.getCamera(),this.layer.getRender());const s=t.fetchOptions||{},r=new cr(i.manager);s.credentials==="include"&&s.mode==="cors"&&r.setCrossOrigin("use-credentials"),"credentials"in s&&r.setWithCredentials(s.credentials==="include"),s.headers&&r.setRequestHeader(s.headers);const o=new bE,a=t.dracoDecoderPath||"https://cdn.jsdelivr.net/npm/three@0.143/examples/js/libs/draco/";if(o.setDecoderPath(a),r.setDRACOLoader(o),i.manager.addHandler(/\.gltf$/i,r),i.onLoadTileSet=l=>{this.emit("loadTileSet",l)},i.onLoadModel=(l,c)=>{this.emit("loadModel",{scene:l,tile:c})},i.onDisposeModel=(l,c)=>{this.emit("disposeModel",{scene:l,tile:c})},i.downloadQueue.maxJobs=6,i.parseQueue.maxJobs=6,this.group=i.group,this.layer.add(this.group),this.tilesRenderer=i,t.position&&this.setPosition(t.position),t.rotation&&this.setRotation(t.rotation),t.translate&&this.setTranslate(t.translate),t.scale&&this.setScale(t.scale),this.animate(),t.debug){const l=document.createElement("div");l.style.position="absolute",l.style.top="0px",l.style.left="0px",l.style.color="white",l.style.width="100%",l.style.textAlign="center",l.style.padding="5px",l.style.pointerEvents="none",l.style.lineHeight="1.5em",document.body.appendChild(l),this.statsContainer=l}this.bindEvents(t.mouseEvent)}bindEvents(e){if(e){this.raycaster=new Nf,this.raycaster.firstHitOnly=!0;const t=this.layer.getMap();this.clickMapFn=Di(this.clickMap,this),t.on("click",this.clickMapFn),this.mousemoveMapFn=Di(this.mousemoveMap,this),t.on("mousemove",this.mousemoveMapFn),this.rightClickMapFn=Di(this.rightClickMap,this),t.on("rightclick",this.rightClickMapFn)}}unbindEvents(){const e=this.layer.getMap();this.clickMapFn&&(e.off("click",this.clickMapFn),this.clickMapFn=null),this.mousemoveMapFn&&(e.off("mousemove",this.mousemoveMapFn),this.mousemoveMapFn=null),this.rightClickMapFn&&(e.off("rightclick",this.rightClickMapFn),this.rightClickMapFn=null),this.tilesRenderer&&(this.tilesRenderer.onLoadTileSet=null,this.tilesRenderer.onLoadModel=null,this.tilesRenderer.onDisposeModel=null)}clickMap(e){const t=this._intersectGltf(e);this.emit("click",t)}mousemoveMap(e){const t=this._intersectGltf(e);this.emit("mousemove",t)}rightClickMap(e){const t=this._intersectGltf(e);this.emit("rightClick",t)}_intersectGltf(e){var t,i;const s=this.layer.getMap().getContainer().getBoundingClientRect(),r=this.mouse;r.x=e.originEvent.clientX-s.x,r.y=e.originEvent.clientY-s.y,r.x=r.x/s.width*2-1,r.y=-(r.y/s.height)*2+1;const o=this.layer.getCamera();(t=this.raycaster)===null||t===void 0||t.setFromCamera(r,o);const a=(i=this.raycaster)===null||i===void 0?void 0:i.intersectObject(this.group,!0);if(a!=null&&a.length){const l=a[0].object,c={},u=this.getBatchTable(l);return u&&u.getKeys().forEach(h=>{c[h]=u.getData(h)}),{object:l,batchData:c}}return null}getBatchTable(e){return e?e.batchTable?e.batchTable:this.getBatchTable(e.parent):null}setPosition(e){const t=this.layer.convertLngLat(e);this.group.position.setX(t[0]),this.group.position.setY(t[1]),this.refresh()}setRotation(e){if(e){const t=Math.PI/180*(e.x||0),i=Math.PI/180*(e.y||0),s=Math.PI/180*(e.z||0);this.group.rotation.set(t,i,s),this.refresh()}}setTranslate(e){e&&(this.group.translateX(e.x),this.group.translateY(e.y),this.group.translateZ(e.z),this.refresh())}setScale(e){let t;typeof e=="number"?t={x:e,y:e,z:e}:t=e,this.group.scale.set(t.x,t.y,t.z),this.refresh()}refresh(){this.layer.update()}show(){this.group.visible=!0,this.refresh()}hide(){this.group.visible=!1,this.refresh()}animate(){this.animationFrame=requestAnimationFrame(()=>{this.update(),this.animate()})}update(){var e;if(this.layer.getCamera().updateMatrixWorld(),(e=this.tilesRenderer)===null||e===void 0||e.update(),this.layer.update(),this.statsContainer){const t=this.tilesRenderer;this.statsContainer.innerHTML=`\u6B63\u5728\u4E0B\u8F7D: ${t.stats.downloading} \u6B63\u5728\u7F16\u8BD1: ${t.stats.parsing} \u5DF2\u663E\u793A: ${t.group.children.length-2}`}}getGroup(){return this.group}getTilesRenderer(){return this.tilesRenderer}destroy(){var e;cancelAnimationFrame(this.animationFrame),this.unbindEvents(),this.layer.remove(this.group),(e=this.tilesRenderer)===null||e===void 0||e.dispose(),this.group=null,this.layer=null,this.statsContainer&&(this.statsContainer.remove(),this.statsContainer=void 0)}}var fg=oe({name:"ElAmapThreeTiles3d",mixins:[ae],props:{url:{type:String,required:!0},position:{type:Object,required:!0},scale:{type:Object},rotation:{type:Object},translate:{type:Object},dracoDecoderPath:{type:String},fetchOptions:{type:Object},mouseEvent:{type:Boolean,default:!1},debug:{type:Boolean,default:!1}},data(){return{}},methods:{__initComponent(n){this.$amapComponent=new jE(this.$parentComponent,n)},destroyComponent(){this.$amapComponent.destroy(),this.$amapComponent=null,this.$parentComponent=null}},render(){return null}});fg.__file="src/packages/three/Three3Dtiles/ThreeTiles3d.vue";const mg=ce(fg);var qE=[_h,vh,bh,Sh,Ch,Th,Eh,Lh,Ph,Dh,Oh,kh,$h,zh,Gh,Vh,Wh,qh,Yh,Zh,Qh,tu,iu,ru,au,cu,uu,pu,mu,_u,vu,bu,Su,wu,Au,Eu,Ru,Iu,Fu,Nu,Bu,Uu,Gu,Vu,Wu,qu,Yu,Zu,Qu,td,id,rd,ad,hd,dd,em,sm,om,lm,hm,dm,fm,mm,_m,vm,bm,Sm,Cm,Tm,Lm,zm,Vm,mg],gg=dc([...qE]);const XE=gg.install;export{_h as ElAmap,Zu as ElAmapBezierCurve,Qu as ElAmapCircle,lm as ElAmapCircleMarker,vh as ElAmapControlControlBar,om as ElAmapControlGeolocation,bh as ElAmapControlHawkEye,Sh as ElAmapControlMapType,Ch as ElAmapControlScale,Th as ElAmapControlToolBar,Uu as ElAmapElasticMarker,td as ElAmapEllipse,id as ElAmapGeojson,Lh as ElAmapInfoWindow,Gu as ElAmapLabelMarker,Wh as ElAmapLayerBuildings,Ph as ElAmapLayerCanvas,Dh as ElAmapLayerCustom,qh as ElAmapLayerDefault,Yh as ElAmapLayerDistrict,Oh as ElAmapLayerFlexible,kh as ElAmapLayerGlCustom,$h as ElAmapLayerHeatMap,zh as ElAmapLayerImage,Zh as ElAmapLayerIndoorMap,Gh as ElAmapLayerLabels,au as ElAmapLayerMapboxVectorTile,Qh as ElAmapLayerRoadNet,tu as ElAmapLayerSatellite,em as ElAmapLayerThree,iu as ElAmapLayerTile,dd as ElAmapLayerTiles3d,ru as ElAmapLayerTraffic,Vh as ElAmapLayerVector,mm as ElAmapLayerVideo,cu as ElAmapLayerWms,uu as ElAmapLayerWmts,wu as ElAmapLoca,hm as ElAmapLocaAmbientLight,dm as ElAmapLocaDirectionalLight,pu as ElAmapLocaGrid,mu as ElAmapLocaHeatmap,_u as ElAmapLocaHexagon,vu as ElAmapLocaIcon,_m as ElAmapLocaLaser,bu as ElAmapLocaLine,Su as ElAmapLocaLink,Au as ElAmapLocaPoint,fm as ElAmapLocaPointLight,Eu as ElAmapLocaPolygon,Ru as ElAmapLocaPrism,Iu as ElAmapLocaPulseLine,Fu as ElAmapLocaPulseLink,Nu as ElAmapLocaScatter,Bu as ElAmapLocaZMarker,Vu as ElAmapMarker,Wu as ElAmapMarkerCluster,qu as ElAmapMassMarks,Vm as ElAmapMouseTool,rd as ElAmapPolygon,ad as ElAmapPolyline,hd as ElAmapRectangle,Eh as ElAmapSearchBox,Yu as ElAmapText,sm as ElAmapThreeGltf,bm as ElAmapThreeLightAmbient,Sm as ElAmapThreeLightDirectional,Cm as ElAmapThreeLightHemisphere,Tm as ElAmapThreeLightPoint,Lm as ElAmapThreeLightSpot,zm as ElAmapThreePolygon,mg as ElAmapThreeTiles3d,vm as ElAmapThreeVideo,gg as default,Xv as initAMapApiLoader,XE as install,si as lazyAMapApiLoaderInstance,dc as makeInstaller,ae as registerMixin}; //# sourceMappingURL=index.es.min.js.map