ss-component-new 1.1.366 → 1.1.368
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{array-EGWOD_Yi.js → array-DXRXxc5V.js} +2 -2
- package/dist/{array-B4OYH6uL.cjs → array-p4U660c6.cjs} +1 -1
- package/dist/{cloneDeep-D3jWUY57.js → cloneDeep-CXyhaNiz.js} +1 -1
- package/dist/{cloneDeep-BPCav0OY.cjs → cloneDeep-DSrEtC3V.cjs} +1 -1
- package/dist/{index-B6D0Zmro.js → index-0OFxCEb4.js} +4 -4
- package/dist/{index-BQQE4RO9.js → index-5RC8h9AM.js} +4 -4
- package/dist/{index-CN73stto.cjs → index-5RR-uv25.cjs} +1 -1
- package/dist/{index-B7rnt0a7.js → index-6kRv3SaH.js} +3 -3
- package/dist/{index-CEVLI-tF.cjs → index-AADEPW1m.cjs} +1 -1
- package/dist/{index-h3vgrWAC.cjs → index-B-GE1ADP.cjs} +1 -1
- package/dist/{index-Bxt_jC-e.js → index-B1LMqzHp.js} +3 -3
- package/dist/{index-B1KIGMDS.cjs → index-B3riNZW2.cjs} +1 -1
- package/dist/{index-Cnigg-Vb.cjs → index-B4AKDa76.cjs} +1 -1
- package/dist/{index-9Kq2L6hA.cjs → index-B6eopOge.cjs} +1 -1
- package/dist/{index-Dy0Bjmrr.js → index-BDfz3KpW.js} +894 -917
- package/dist/{index-DPoMcIHZ.js → index-BKd7OSBi.js} +7 -7
- package/dist/{index-Cal7dRFc.js → index-BTJpQg0y.js} +1 -1
- package/dist/{index-DQewAWSX.js → index-BYMXpbdQ.js} +5 -5
- package/dist/{index-DsSqH7Ku.js → index-BaMIs_Xw.js} +5 -5
- package/dist/{index-DQXp-tQk.js → index-BoQBLh4s.js} +1 -1
- package/dist/{index-DxeIJqcl.js → index-BrZd3miB.js} +1 -1
- package/dist/{index-C_zK0qeZ.js → index-Bw1IeheF.js} +3 -3
- package/dist/{index-1mb-R5LL.js → index-BwjaHuRt.js} +9 -9
- package/dist/{index-BBvGttI3.cjs → index-Bx4DquWJ.cjs} +1 -1
- package/dist/{index-Cks4xBFc.js → index-C0J1dJP0.js} +7 -7
- package/dist/{index-r4-byc3l.cjs → index-C1KexSFx.cjs} +1 -1
- package/dist/{index-CdrtM6Jl.cjs → index-C76AHG4f.cjs} +1 -1
- package/dist/{index-DgdlwjkF.js → index-C8WBjRju.js} +5 -5
- package/dist/{index-CMza6E0Y.js → index-CCry0tAM.js} +65 -63
- package/dist/{index-CAfIBffc.cjs → index-CL8EokGp.cjs} +1 -1
- package/dist/{index-EgiRVqNe.cjs → index-CM1KG4hZ.cjs} +1 -1
- package/dist/{index-BPLD6fuH.js → index-CMcke6or.js} +8 -8
- package/dist/{index-1LyKu48J.cjs → index-C_x3pc-5.cjs} +1 -1
- package/dist/{index-D0Xtu3c5.js → index-CdYuSKeI.js} +4 -4
- package/dist/{index-BK34ZIUl.cjs → index-Crft9XAJ.cjs} +1 -1
- package/dist/{index-Cd0GOTJL.cjs → index-Cyyvnoy5.cjs} +1 -1
- package/dist/{index-Dq0BnanX.js → index-Czqs-JUN.js} +6 -6
- package/dist/{index-BSd6lCCf.js → index-D2aMfmep.js} +3 -3
- package/dist/{index-CTASWvkf.js → index-D4gBB4Xq.js} +9 -9
- package/dist/{index-DjI83upr.js → index-DK3YYMqm.js} +6 -6
- package/dist/{index-BWoxDyyu.js → index-DOQKFJaF.js} +1 -1
- package/dist/{index-CkgqQw5c.js → index-DVW05d1i.js} +4 -4
- package/dist/{index-qWPIXtmB.cjs → index-DjYG1iMR.cjs} +1 -1
- package/dist/{index-CylVtJFa.cjs → index-Dkhqb-cY.cjs} +1 -1
- package/dist/{index-Dj7KpYhE.cjs → index-DogyvuWq.cjs} +166 -166
- package/dist/{index-DXu2C7E2.js → index-DpwvWrwM.js} +1 -1
- package/dist/{index-BovJtyyV.cjs → index-Ds9PKdQt.cjs} +1 -1
- package/dist/{index-D_80-VnL.cjs → index-F-8JUdjA.cjs} +1 -1
- package/dist/{index-FnUvbwkl.cjs → index-GHlejw5s.cjs} +1 -1
- package/dist/{index-C67VR66n.cjs → index-H6L4a7FD.cjs} +1 -1
- package/dist/{index-Cj9Wq_7v.cjs → index-JB9JUdhC.cjs} +1 -1
- package/dist/{index-Bo8sDOPU.js → index-Jg50Cins.js} +4 -4
- package/dist/{index-FipljzbJ.cjs → index-Ltq2aZEY.cjs} +1 -1
- package/dist/{index-B8PQq8Z4.cjs → index-SnS2j8VB.cjs} +1 -1
- package/dist/{index-KKYTpn-0.js → index-atmXvfEM.js} +4 -4
- package/dist/index-c_iT7yiL.cjs +1 -0
- package/dist/{index-BXO1mk6t.cjs → index-g7S_DTj_.cjs} +1 -1
- package/dist/{index-Xd0gl2O5.cjs → index-kamk_cc2.cjs} +1 -1
- package/dist/{index.vue_vue_type_script_setup_true_lang-CE6ciJHv.js → index.vue_vue_type_script_setup_true_lang-BWj64RRw.js} +1 -1
- package/dist/{index.vue_vue_type_script_setup_true_lang-CEx7p4se.cjs → index.vue_vue_type_script_setup_true_lang-CqFAbdmu.cjs} +1 -1
- package/dist/{index.vue_vue_type_style_index_0_scoped_23015cb0_lang-_1kiYpwh.cjs → index.vue_vue_type_style_index_0_scoped_23015cb0_lang-CKf9GB8F.cjs} +1 -1
- package/dist/{index.vue_vue_type_style_index_0_scoped_23015cb0_lang-BfO2BZm9.js → index.vue_vue_type_style_index_0_scoped_23015cb0_lang-atPRKw8g.js} +13 -13
- package/dist/index.vue_vue_type_style_index_0_scoped_3a02a8a3_lang-CXo3L8X-.cjs +1 -0
- package/dist/{index.vue_vue_type_style_index_0_scoped_3a02a8a3_lang-CpZkvXyX.js → index.vue_vue_type_style_index_0_scoped_3a02a8a3_lang-LJVg3Lt-.js} +72 -56
- package/dist/{login-cDG_pssN.cjs → login-B-eAhMEz.cjs} +1 -1
- package/dist/{login-DKf6sQrA.js → login-BlwwLIDJ.js} +2 -2
- package/dist/{main-DnQRFkkz.js → main-BBM5wrkJ.js} +7 -7
- package/dist/{main-BY1dJ_uK.cjs → main-qobuJ_uH.cjs} +1 -1
- package/dist/{menu-eau-OVSc.js → menu-B0pyBhYY.js} +1 -1
- package/dist/{menu-Bi2msF1Z.cjs → menu-C9NMDJ1-.cjs} +1 -1
- package/dist/ss-component.cjs +1 -1
- package/dist/ss-component.css +1 -1
- package/dist/ss-component.js +7 -7
- package/dist/ss-component3.cjs +1 -1
- package/dist/ss-component3.js +1 -1
- package/package.json +1 -1
- package/dist/index-Dp7ftR-s.cjs +0 -1
- package/dist/index.vue_vue_type_style_index_0_scoped_3a02a8a3_lang-BX_0yNEO.cjs +0 -1
- package/dist/obj/model.mtl +0 -42
- package/dist/obj/model.obj +0 -26110
- package/public/obj/model.mtl +0 -42
- package/public/obj/model.obj +0 -26110
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const ie=require("vue"),Tr=require("./index-Ds9PKdQt.cjs"),bt=require("./menu-C9NMDJ1-.cjs"),mi=require("./index-kamk_cc2.cjs"),xn=require("./index-CL8EokGp.cjs"),vl=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),Le=require("./cloneDeep-DSrEtC3V.cjs"),Yh=require("./index-C1KexSFx.cjs");var Kh="__lodash_hash_undefined__";function $h(r){return this.__data__.set(r,Kh),this}function Jh(r){return this.__data__.has(r)}function da(r){var e=-1,t=r==null?0:r.length;for(this.__data__=new mi.MapCache;++e<t;)this.add(r[e])}da.prototype.add=da.prototype.push=$h;da.prototype.has=Jh;function Zh(r,e){for(var t=-1,n=r==null?0:r.length;++t<n;)if(e(r[t],t,r))return!0;return!1}function Qh(r,e){return r.has(e)}var ed=1,td=2;function ju(r,e,t,n,i,s){var a=t&ed,o=r.length,l=e.length;if(o!=l&&!(a&&l>o))return!1;var c=s.get(r),u=s.get(e);if(c&&u)return c==e&&u==r;var h=-1,d=!0,f=t&td?new da:void 0;for(s.set(r,e),s.set(e,r);++h<o;){var m=r[h],_=e[h];if(n)var g=a?n(_,m,h,e,r,s):n(m,_,h,r,e,s);if(g!==void 0){if(g)continue;d=!1;break}if(f){if(!Zh(e,function(p,M){if(!Qh(f,M)&&(m===p||i(m,p,t,n,s)))return f.push(M)})){d=!1;break}}else if(!(m===_||i(m,_,t,n,s))){d=!1;break}}return s.delete(r),s.delete(e),d}function nd(r){var e=-1,t=Array(r.size);return r.forEach(function(n,i){t[++e]=[i,n]}),t}function id(r){var e=-1,t=Array(r.size);return r.forEach(function(n){t[++e]=n}),t}var rd=1,sd=2,ad="[object Boolean]",od="[object Date]",ld="[object Error]",cd="[object Map]",ud="[object Number]",hd="[object RegExp]",dd="[object Set]",fd="[object String]",pd="[object Symbol]",md="[object ArrayBuffer]",gd="[object DataView]",Yl=mi.Symbol?mi.Symbol.prototype:void 0,Ra=Yl?Yl.valueOf:void 0;function _d(r,e,t,n,i,s,a){switch(t){case gd:if(r.byteLength!=e.byteLength||r.byteOffset!=e.byteOffset)return!1;r=r.buffer,e=e.buffer;case md:return!(r.byteLength!=e.byteLength||!s(new Le.Uint8Array(r),new Le.Uint8Array(e)));case ad:case od:case ud:return mi.eq(+r,+e);case ld:return r.name==e.name&&r.message==e.message;case hd:case fd:return r==e+"";case cd:var o=nd;case dd:var l=n&rd;if(o||(o=id),r.size!=e.size&&!l)return!1;var c=a.get(r);if(c)return c==e;n|=sd,a.set(r,e);var u=ju(o(r),o(e),n,i,s,a);return a.delete(r),u;case pd:if(Ra)return Ra.call(r)==Ra.call(e)}return!1}var vd=1,yd=Object.prototype,xd=yd.hasOwnProperty;function Sd(r,e,t,n,i,s){var a=t&vd,o=Le.getAllKeys(r),l=o.length,c=Le.getAllKeys(e),u=c.length;if(l!=u&&!a)return!1;for(var h=l;h--;){var d=o[h];if(!(a?d in e:xd.call(e,d)))return!1}var f=s.get(r),m=s.get(e);if(f&&m)return f==e&&m==r;var _=!0;s.set(r,e),s.set(e,r);for(var g=a;++h<l;){d=o[h];var p=r[d],M=e[d];if(n)var E=a?n(M,p,d,e,r,s):n(p,M,d,r,e,s);if(!(E===void 0?p===M||i(p,M,t,n,s):E)){_=!1;break}g||(g=d=="constructor")}if(_&&!g){var y=r.constructor,I=e.constructor;y!=I&&"constructor"in r&&"constructor"in e&&!(typeof y=="function"&&y instanceof y&&typeof I=="function"&&I instanceof I)&&(_=!1)}return s.delete(r),s.delete(e),_}var Md=1,Kl="[object Arguments]",$l="[object Array]",gs="[object Object]",bd=Object.prototype,Jl=bd.hasOwnProperty;function Ed(r,e,t,n,i,s){var a=mi.isArray(r),o=mi.isArray(e),l=a?$l:Le.getTag(r),c=o?$l:Le.getTag(e);l=l==Kl?gs:l,c=c==Kl?gs:c;var u=l==gs,h=c==gs,d=l==c;if(d&&Le.isBuffer(r)){if(!Le.isBuffer(e))return!1;a=!0,u=!1}if(d&&!u)return s||(s=new Le.Stack),a||Le.isTypedArray(r)?ju(r,e,t,n,i,s):_d(r,e,l,t,n,i,s);if(!(t&Md)){var f=u&&Jl.call(r,"__wrapped__"),m=h&&Jl.call(e,"__wrapped__");if(f||m){var _=f?r.value():r,g=m?e.value():e;return s||(s=new Le.Stack),i(_,g,t,n,s)}}return d?(s||(s=new Le.Stack),Sd(r,e,t,n,i,s)):!1}function Yu(r,e,t,n,i){return r===e?!0:r==null||e==null||!mi.isObjectLike(r)&&!mi.isObjectLike(e)?r!==r&&e!==e:Ed(r,e,t,n,Yu,i)}function Td(r,e){return Yu(r,e)}const yl=bt.defineStore("modelComp",{state:()=>({itemData:[],originalData:[],extraContents:[],nodeDev:"",isEdit:"view",isRefreshCurStructure:!1,isSubmitCurStructure:!1,curStructureCompIds:[],systemPath:""}),actions:{setItemData(r){this.itemData=r},setSubmitCurStructure(r){this.isSubmitCurStructure=r},setCurStructureCompIds(r){this.curStructureCompIds=r},setRefreshCurStructure(r){this.isRefreshCurStructure=r},setOriginalData(r){this.originalData=r},setExtraContents(r){this.extraContents=r},setNodeDev(r){this.nodeDev=r},setIsEdit(r){this.isEdit=r},setSystemPath(r){this.systemPath=r}}}),wd={__name:"index",props:{isVisible:{type:Boolean,default:!1},title:{type:String,default:""},width:{type:Number,default:200}},setup(r){const e=r,t=ie.ref(null),n=ie.ref(!1),i=ie.ref(null);return ie.watch(()=>e==null?void 0:e.isVisible,()=>{n.value=e==null?void 0:e.isVisible},{deep:!0,immediate:!0}),ie.watch(()=>i.value,()=>{ie.nextTick(()=>{var s,a;(a=(s=t.value)==null?void 0:s.updatePopper)==null||a.call(s)})},{deep:!0,immediate:!0}),(s,a)=>{const o=ie.resolveComponent("el-popover");return ie.openBlock(),ie.createBlock(o,{visible:n.value,placement:"bottom",title:e==null?void 0:e.title,width:e==null?void 0:e.width,ref_key:"popOverRef",ref:t},{reference:ie.withCtx(()=>[ie.createElementVNode("div",null,[ie.renderSlot(s.$slots,"reference",{ref_key:"referenceRef",ref:i})])]),default:ie.withCtx(()=>[ie.createElementVNode("div",null,[ie.renderSlot(s.$slots,"content")])]),_:3},8,["visible","title","width"])}}},Ad={class:"extra-button-content"},Rd={class:"table-operator-wrap"},Cd={key:0,class:"extra-header"},Pd=["onClick"],Dd={class:"extra-button-filter"},Ld={class:"form-content-value"},Ud={__name:"header",props:{compName:{type:String,default:"表格名称",required:!1},buttons:{type:Array,default:()=>[]},columns:{type:Array,default:()=>[]}},emits:["buttonClick","filter"],setup(r,{emit:e}){const t=e,n=r,i=ie.ref(!1),s=ie.ref([]),a=ie.ref([{label:"取消"},{label:"确认"}]),o=u=>{t("buttonClick",u)},l=u=>{var h,d;s.value=(d=(h=xn.getColumnChild(Le.cloneDeep(u)))==null?void 0:h.filter(f=>(f==null?void 0:f.label)!==""&&(f==null?void 0:f.label)!=="操作"))==null?void 0:d.map(f=>({label:(f==null?void 0:f.label)??"",value:"",name:(f==null?void 0:f.label)??"",isFormColHidden:f==null?void 0:f.isTableColHidden}))},c=u=>{(u==null?void 0:u.buttonName)==="确认"&&t("filter",u==null?void 0:u.content),i.value=!1};return ie.onMounted(()=>{l(n.columns)}),ie.watch(()=>n.columns,()=>{l(n.columns)},{deep:!0,immediate:!0}),(u,h)=>{var f;const d=ie.resolveComponent("el-tooltip");return ie.openBlock(),ie.createElementBlock("div",Ad,[ie.createElementVNode("div",{class:ie.normalizeClass(r.compName?"table-name-wrap":"")},ie.toDisplayString(r.compName),3),ie.createElementVNode("div",Rd,[n!=null&&n.buttons&&((f=n==null?void 0:n.buttons)==null?void 0:f.length)>0?(ie.openBlock(),ie.createElementBlock("div",Cd,[(ie.openBlock(!0),ie.createElementBlock(ie.Fragment,null,ie.renderList(n==null?void 0:n.buttons,(m,_)=>(ie.openBlock(),ie.createElementBlock("div",{class:"extra-contents",key:_},[ie.createElementVNode("div",{class:"extra-content",style:ie.normalizeStyle({background:(m==null?void 0:m.background)??"var(--ssbutton-theme-bg)",color:"var(--ssbutton-theme-color)"}),onClick:g=>o(m==null?void 0:m.label)},ie.toDisplayString(m==null?void 0:m.label),13,Pd)]))),128))])):ie.createCommentVNode("",!0),ie.createElementVNode("div",Dd,[ie.createVNode(wd,{title:"筛选数据",width:500,isVisible:i.value},{reference:ie.withCtx(()=>[ie.createVNode(d,{content:"筛选",placement:"top-start"},{default:ie.withCtx(()=>[ie.createElementVNode("div",{class:"button-style",onClick:h[0]||(h[0]=m=>i.value=!i.value)},[ie.createVNode(ie.unref(mi.filter_default),{color:"var(--ssComponent-black)"})])]),_:1})]),content:ie.withCtx(()=>[ie.createElementVNode("div",Ld,[(ie.openBlock(),ie.createBlock(xn.ssForm,{rowContents:s.value,buttonValue:a.value,isRowFlex:!0,isEnableWrap:!1,isButtonRow:!1,key:a.value,isStartJustify:!1,onOnButtonClick:c},null,8,["rowContents","buttonValue"]))])]),_:1},8,["isVisible"])])])])}}},Id=vl._export_sfc(Ud,[["__scopeId","data-v-fddc081c"]]);/**
|
|
2
2
|
* @license
|
|
3
3
|
* Copyright 2010-2025 Three.js Authors
|
|
4
4
|
* SPDX-License-Identifier: MIT
|
|
5
|
-
*/const xl="177",Fd={ROTATE:0,DOLLY:1,PAN:2},Od={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},Bd=0,Zl=1,kd=2,Ku=1,$u=2,ui=3,$n=0,_n=1,hn=2,Ai=0,Ar=1,Ql=2,ec=3,tc=4,zd=5,Gi=100,Vd=101,Hd=102,Gd=103,Wd=104,Xd=200,qd=201,jd=202,Yd=203,So=204,Mo=205,Kd=206,$d=207,Jd=208,Zd=209,Qd=210,ef=211,tf=212,nf=213,rf=214,bo=0,Eo=1,To=2,Pr=3,wo=4,Ao=5,Ro=6,Co=7,xa=0,sf=1,af=2,Ri=0,of=1,lf=2,cf=3,Ju=4,uf=5,hf=6,df=7,nc="attached",ff="detached",Zu=300,Dr=301,Lr=302,Po=303,Do=304,Sa=306,jn=1e3,kn=1001,Lo=1002,Rn=1003,pf=1004,_s=1005,An=1006,Ca=1007,hi=1008,Jn=1009,Qu=1010,eh=1011,ss=1012,Sl=1013,$i=1014,Yn=1015,hs=1016,Ml=1017,bl=1018,as=1020,th=35902,nh=1021,ih=1022,In=1023,os=1026,ls=1027,rh=1028,El=1029,sh=1030,Tl=1031,wl=1033,na=33776,ia=33777,ra=33778,sa=33779,Uo=35840,Io=35841,No=35842,Fo=35843,Oo=36196,Bo=37492,ko=37496,zo=37808,Vo=37809,Ho=37810,Go=37811,Wo=37812,Xo=37813,qo=37814,jo=37815,Yo=37816,Ko=37817,$o=37818,Jo=37819,Zo=37820,Qo=37821,aa=36492,el=36494,tl=36495,ah=36283,nl=36284,il=36285,rl=36286,fa=2300,sl=2301,Pa=2302,ic=2400,rc=2401,sc=2402,mf=2500,gf=3200,_f=3201,Al=0,vf=1,wi="",At="srgb",Ur="srgb-linear",pa="linear",It="srgb",rr=7680,ac=519,yf=512,xf=513,Sf=514,oh=515,Mf=516,bf=517,Ef=518,Tf=519,al=35044,oc="300 es",di=2e3,ma=2001;class Zi{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){const n=this._listeners;return n===void 0?!1:n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){const n=this._listeners;if(n===void 0)return;const i=n[e];if(i!==void 0){const s=i.indexOf(t);s!==-1&&i.splice(s,1)}}dispatchEvent(e){const t=this._listeners;if(t===void 0)return;const n=t[e.type];if(n!==void 0){e.target=this;const i=n.slice(0);for(let s=0,a=i.length;s<a;s++)i[s].call(this,e);e.target=null}}}const ln=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let lc=1234567;const ts=Math.PI/180,Ir=180/Math.PI;function zn(){const r=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(ln[r&255]+ln[r>>8&255]+ln[r>>16&255]+ln[r>>24&255]+"-"+ln[e&255]+ln[e>>8&255]+"-"+ln[e>>16&15|64]+ln[e>>24&255]+"-"+ln[t&63|128]+ln[t>>8&255]+"-"+ln[t>>16&255]+ln[t>>24&255]+ln[n&255]+ln[n>>8&255]+ln[n>>16&255]+ln[n>>24&255]).toLowerCase()}function yt(r,e,t){return Math.max(e,Math.min(t,r))}function Rl(r,e){return(r%e+e)%e}function wf(r,e,t,n,i){return n+(r-e)*(i-n)/(t-e)}function Af(r,e,t){return r!==e?(t-r)/(e-r):0}function ns(r,e,t){return(1-t)*r+t*e}function Rf(r,e,t,n){return ns(r,e,1-Math.exp(-t*n))}function Cf(r,e=1){return e-Math.abs(Rl(r,e*2)-e)}function Pf(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*(3-2*r))}function Df(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*r*(r*(r*6-15)+10))}function Lf(r,e){return r+Math.floor(Math.random()*(e-r+1))}function Uf(r,e){return r+Math.random()*(e-r)}function If(r){return r*(.5-Math.random())}function Nf(r){r!==void 0&&(lc=r);let e=lc+=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 Ff(r){return r*ts}function Of(r){return r*Ir}function Bf(r){return(r&r-1)===0&&r!==0}function kf(r){return Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))}function zf(r){return Math.pow(2,Math.floor(Math.log(r)/Math.LN2))}function Vf(r,e,t,n,i){const s=Math.cos,a=Math.sin,o=s(t/2),l=a(t/2),c=s((e+n)/2),u=a((e+n)/2),h=s((e-n)/2),d=a((e-n)/2),f=s((n-e)/2),m=a((n-e)/2);switch(i){case"XYX":r.set(o*u,l*h,l*d,o*c);break;case"YZY":r.set(l*d,o*u,l*h,o*c);break;case"ZXZ":r.set(l*h,l*d,o*u,o*c);break;case"XZX":r.set(o*u,l*m,l*f,o*c);break;case"YXY":r.set(l*f,o*u,l*m,o*c);break;case"ZYZ":r.set(l*m,l*f,o*u,o*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function Bn(r,e){switch(e.constructor){case Float32Array:return r;case Uint32Array:return r/4294967295;case Uint16Array:return r/65535;case Uint8Array:return r/255;case Int32Array:return Math.max(r/2147483647,-1);case Int16Array:return Math.max(r/32767,-1);case Int8Array:return Math.max(r/127,-1);default:throw new Error("Invalid component type.")}}function Lt(r,e){switch(e.constructor){case Float32Array:return r;case Uint32Array:return Math.round(r*4294967295);case Uint16Array:return Math.round(r*65535);case Uint8Array:return Math.round(r*255);case Int32Array:return Math.round(r*2147483647);case Int16Array:return Math.round(r*32767);case Int8Array:return Math.round(r*127);default:throw new Error("Invalid component type.")}}const Wi={DEG2RAD:ts,RAD2DEG:Ir,generateUUID:zn,clamp:yt,euclideanModulo:Rl,mapLinear:wf,inverseLerp:Af,lerp:ns,damp:Rf,pingpong:Cf,smoothstep:Pf,smootherstep:Df,randInt:Lf,randFloat:Uf,randFloatSpread:If,seededRandom:Nf,degToRad:Ff,radToDeg:Of,isPowerOfTwo:Bf,ceilPowerOfTwo:kf,floorPowerOfTwo:zf,setQuaternionFromProperEuler:Vf,normalize:Lt,denormalize:Bn};class dt{constructor(e=0,t=0){dt.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,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[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=yt(this.x,e.x,t.x),this.y=yt(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=yt(this.x,e,t),this.y=yt(this.y,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(yt(n,e,t))}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=Math.trunc(this.x),this.y=Math.trunc(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}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(yt(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}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,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,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 n=Math.cos(t),i=Math.sin(t),s=this.x-e.x,a=this.y-e.y;return this.x=s*n-a*i+e.x,this.y=s*i+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Cn{constructor(e=0,t=0,n=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=i}static slerpFlat(e,t,n,i,s,a,o){let l=n[i+0],c=n[i+1],u=n[i+2],h=n[i+3];const d=s[a+0],f=s[a+1],m=s[a+2],_=s[a+3];if(o===0){e[t+0]=l,e[t+1]=c,e[t+2]=u,e[t+3]=h;return}if(o===1){e[t+0]=d,e[t+1]=f,e[t+2]=m,e[t+3]=_;return}if(h!==_||l!==d||c!==f||u!==m){let g=1-o;const p=l*d+c*f+u*m+h*_,M=p>=0?1:-1,E=1-p*p;if(E>Number.EPSILON){const I=Math.sqrt(E),R=Math.atan2(I,p*M);g=Math.sin(g*R)/I,o=Math.sin(o*R)/I}const y=o*M;if(l=l*g+d*y,c=c*g+f*y,u=u*g+m*y,h=h*g+_*y,g===1-o){const I=1/Math.sqrt(l*l+c*c+u*u+h*h);l*=I,c*=I,u*=I,h*=I}}e[t]=l,e[t+1]=c,e[t+2]=u,e[t+3]=h}static multiplyQuaternionsFlat(e,t,n,i,s,a){const o=n[i],l=n[i+1],c=n[i+2],u=n[i+3],h=s[a],d=s[a+1],f=s[a+2],m=s[a+3];return e[t]=o*m+u*h+l*f-c*d,e[t+1]=l*m+u*d+c*h-o*f,e[t+2]=c*m+u*f+o*d-l*h,e[t+3]=u*m-o*h-l*d-c*f,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,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,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=!0){const n=e._x,i=e._y,s=e._z,a=e._order,o=Math.cos,l=Math.sin,c=o(n/2),u=o(i/2),h=o(s/2),d=l(n/2),f=l(i/2),m=l(s/2);switch(a){case"XYZ":this._x=d*u*h+c*f*m,this._y=c*f*h-d*u*m,this._z=c*u*m+d*f*h,this._w=c*u*h-d*f*m;break;case"YXZ":this._x=d*u*h+c*f*m,this._y=c*f*h-d*u*m,this._z=c*u*m-d*f*h,this._w=c*u*h+d*f*m;break;case"ZXY":this._x=d*u*h-c*f*m,this._y=c*f*h+d*u*m,this._z=c*u*m+d*f*h,this._w=c*u*h-d*f*m;break;case"ZYX":this._x=d*u*h-c*f*m,this._y=c*f*h+d*u*m,this._z=c*u*m-d*f*h,this._w=c*u*h+d*f*m;break;case"YZX":this._x=d*u*h+c*f*m,this._y=c*f*h+d*u*m,this._z=c*u*m-d*f*h,this._w=c*u*h-d*f*m;break;case"XZY":this._x=d*u*h-c*f*m,this._y=c*f*h-d*u*m,this._z=c*u*m+d*f*h,this._w=c*u*h+d*f*m;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],i=t[4],s=t[8],a=t[1],o=t[5],l=t[9],c=t[2],u=t[6],h=t[10],d=n+o+h;if(d>0){const f=.5/Math.sqrt(d+1);this._w=.25/f,this._x=(u-l)*f,this._y=(s-c)*f,this._z=(a-i)*f}else if(n>o&&n>h){const f=2*Math.sqrt(1+n-o-h);this._w=(u-l)/f,this._x=.25*f,this._y=(i+a)/f,this._z=(s+c)/f}else if(o>h){const f=2*Math.sqrt(1+o-n-h);this._w=(s-c)/f,this._x=(i+a)/f,this._y=.25*f,this._z=(l+u)/f}else{const f=2*Math.sqrt(1+h-n-o);this._w=(a-i)/f,this._x=(s+c)/f,this._y=(l+u)/f,this._z=.25*f}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<Number.EPSILON?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(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=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(yt(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const i=Math.min(1,t/n);return this.slerp(e,i),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 n=e._x,i=e._y,s=e._z,a=e._w,o=t._x,l=t._y,c=t._z,u=t._w;return this._x=n*u+a*o+i*c-s*l,this._y=i*u+a*l+s*o-n*c,this._z=s*u+a*c+n*l-i*o,this._w=a*u-n*o-i*l-s*c,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const n=this._x,i=this._y,s=this._z,a=this._w;let o=a*e._w+n*e._x+i*e._y+s*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=n,this._y=i,this._z=s,this;const l=1-o*o;if(l<=Number.EPSILON){const f=1-t;return this._w=f*a+t*this._w,this._x=f*n+t*this._x,this._y=f*i+t*this._y,this._z=f*s+t*this._z,this.normalize(),this}const c=Math.sqrt(l),u=Math.atan2(c,o),h=Math.sin((1-t)*u)/c,d=Math.sin(t*u)/c;return this._w=a*h+this._w*d,this._x=n*h+this._x*d,this._y=i*h+this._y*d,this._z=s*h+this._z*d,this._onChangeCallback(),this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),i=Math.sqrt(1-n),s=Math.sqrt(n);return this.set(i*Math.sin(e),i*Math.cos(e),s*Math.sin(t),s*Math.cos(t))}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._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class k{constructor(e=0,t=0,n=0){k.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,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(cc.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(cc.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6]*i,this.y=s[1]*t+s[4]*n+s[7]*i,this.z=s[2]*t+s[5]*n+s[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,s=e.elements,a=1/(s[3]*t+s[7]*n+s[11]*i+s[15]);return this.x=(s[0]*t+s[4]*n+s[8]*i+s[12])*a,this.y=(s[1]*t+s[5]*n+s[9]*i+s[13])*a,this.z=(s[2]*t+s[6]*n+s[10]*i+s[14])*a,this}applyQuaternion(e){const t=this.x,n=this.y,i=this.z,s=e.x,a=e.y,o=e.z,l=e.w,c=2*(a*i-o*n),u=2*(o*t-s*i),h=2*(s*n-a*t);return this.x=t+l*c+a*h-o*u,this.y=n+l*u+o*c-s*h,this.z=i+l*h+s*u-a*c,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,n=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*i,this.y=s[1]*t+s[5]*n+s[9]*i,this.z=s[2]*t+s[6]*n+s[10]*i,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=yt(this.x,e.x,t.x),this.y=yt(this.y,e.y,t.y),this.z=yt(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=yt(this.x,e,t),this.y=yt(this.y,e,t),this.z=yt(this.z,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(yt(n,e,t))}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=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(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,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,i=e.y,s=e.z,a=t.x,o=t.y,l=t.z;return this.x=i*l-s*o,this.y=s*a-n*l,this.z=n*o-i*a,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return Da.copy(this).projectOnVector(e),this.sub(Da)}reflect(e){return this.sub(Da.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 n=this.dot(e)/t;return Math.acos(yt(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}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,n){const i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,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(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,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}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,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()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const Da=new k,cc=new Cn;class gt{constructor(e,t,n,i,s,a,o,l,c){gt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,i,s,a,o,l,c)}set(e,t,n,i,s,a,o,l,c){const u=this.elements;return u[0]=e,u[1]=i,u[2]=o,u[3]=t,u[4]=s,u[5]=l,u[6]=n,u[7]=a,u[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.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 n=e.elements,i=t.elements,s=this.elements,a=n[0],o=n[3],l=n[6],c=n[1],u=n[4],h=n[7],d=n[2],f=n[5],m=n[8],_=i[0],g=i[3],p=i[6],M=i[1],E=i[4],y=i[7],I=i[2],R=i[5],C=i[8];return s[0]=a*_+o*M+l*I,s[3]=a*g+o*E+l*R,s[6]=a*p+o*y+l*C,s[1]=c*_+u*M+h*I,s[4]=c*g+u*E+h*R,s[7]=c*p+u*y+h*C,s[2]=d*_+f*M+m*I,s[5]=d*g+f*E+m*R,s[8]=d*p+f*y+m*C,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],n=e[1],i=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],u=e[8];return t*a*u-t*o*c-n*s*u+n*o*l+i*s*c-i*a*l}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],u=e[8],h=u*a-o*c,d=o*l-u*s,f=c*s-a*l,m=t*h+n*d+i*f;if(m===0)return this.set(0,0,0,0,0,0,0,0,0);const _=1/m;return e[0]=h*_,e[1]=(i*c-u*n)*_,e[2]=(o*n-i*a)*_,e[3]=d*_,e[4]=(u*t-i*l)*_,e[5]=(i*s-o*t)*_,e[6]=f*_,e[7]=(n*l-c*t)*_,e[8]=(a*t-n*s)*_,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,n,i,s,a,o){const l=Math.cos(s),c=Math.sin(s);return this.set(n*l,n*c,-n*(l*a+c*o)+a+e,-i*c,i*l,-i*(-c*a+l*o)+o+t,0,0,1),this}scale(e,t){return this.premultiply(La.makeScale(e,t)),this}rotate(e){return this.premultiply(La.makeRotation(-e)),this}translate(e,t){return this.premultiply(La.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,n=e.elements;for(let i=0;i<9;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const La=new gt;function lh(r){for(let e=r.length-1;e>=0;--e)if(r[e]>=65535)return!0;return!1}function cs(r){return document.createElementNS("http://www.w3.org/1999/xhtml",r)}function Hf(){const r=cs("canvas");return r.style.display="block",r}const uc={};function Rr(r){r in uc||(uc[r]=!0,console.warn(r))}function Gf(r,e,t){return new Promise(function(n,i){function s(){switch(r.clientWaitSync(e,r.SYNC_FLUSH_COMMANDS_BIT,0)){case r.WAIT_FAILED:i();break;case r.TIMEOUT_EXPIRED:setTimeout(s,t);break;default:n()}}setTimeout(s,t)})}function Wf(r){const e=r.elements;e[2]=.5*e[2]+.5*e[3],e[6]=.5*e[6]+.5*e[7],e[10]=.5*e[10]+.5*e[11],e[14]=.5*e[14]+.5*e[15]}function Xf(r){const e=r.elements;e[11]===-1?(e[10]=-e[10]-1,e[14]=-e[14]):(e[10]=-e[10],e[14]=-e[14]+1)}const hc=new gt().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),dc=new gt().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function qf(){const r={enabled:!0,workingColorSpace:Ur,spaces:{},convert:function(i,s,a){return this.enabled===!1||s===a||!s||!a||(this.spaces[s].transfer===It&&(i.r=pi(i.r),i.g=pi(i.g),i.b=pi(i.b)),this.spaces[s].primaries!==this.spaces[a].primaries&&(i.applyMatrix3(this.spaces[s].toXYZ),i.applyMatrix3(this.spaces[a].fromXYZ)),this.spaces[a].transfer===It&&(i.r=Cr(i.r),i.g=Cr(i.g),i.b=Cr(i.b))),i},workingToColorSpace:function(i,s){return this.convert(i,this.workingColorSpace,s)},colorSpaceToWorking:function(i,s){return this.convert(i,s,this.workingColorSpace)},getPrimaries:function(i){return this.spaces[i].primaries},getTransfer:function(i){return i===wi?pa:this.spaces[i].transfer},getLuminanceCoefficients:function(i,s=this.workingColorSpace){return i.fromArray(this.spaces[s].luminanceCoefficients)},define:function(i){Object.assign(this.spaces,i)},_getMatrix:function(i,s,a){return i.copy(this.spaces[s].toXYZ).multiply(this.spaces[a].fromXYZ)},_getDrawingBufferColorSpace:function(i){return this.spaces[i].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(i=this.workingColorSpace){return this.spaces[i].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(i,s){return Rr("THREE.ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),r.workingToColorSpace(i,s)},toWorkingColorSpace:function(i,s){return Rr("THREE.ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),r.colorSpaceToWorking(i,s)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],n=[.3127,.329];return r.define({[Ur]:{primaries:e,whitePoint:n,transfer:pa,toXYZ:hc,fromXYZ:dc,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:At},outputColorSpaceConfig:{drawingBufferColorSpace:At}},[At]:{primaries:e,whitePoint:n,transfer:It,toXYZ:hc,fromXYZ:dc,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:At}}}),r}const vt=qf();function pi(r){return r<.04045?r*.0773993808:Math.pow(r*.9478672986+.0521327014,2.4)}function Cr(r){return r<.0031308?r*12.92:1.055*Math.pow(r,.41666)-.055}let sr;class jf{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{sr===void 0&&(sr=cs("canvas")),sr.width=e.width,sr.height=e.height;const i=sr.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),n=sr}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=cs("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const i=n.getImageData(0,0,e.width,e.height),s=i.data;for(let a=0;a<s.length;a++)s[a]=pi(s[a]/255)*255;return n.putImageData(i,0,0),t}else if(e.data){const t=e.data.slice(0);for(let n=0;n<t.length;n++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[n]=Math.floor(pi(t[n]/255)*255):t[n]=pi(t[n]);return{data:t,width:e.width,height:e.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let Yf=0;class Cl{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Yf++}),this.uuid=zn(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){const t=this.data;return t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight):t!==null?e.set(t.width,t.height,t.depth||0):e.set(0,0,0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const n={uuid:this.uuid,url:""},i=this.data;if(i!==null){let s;if(Array.isArray(i)){s=[];for(let a=0,o=i.length;a<o;a++)i[a].isDataTexture?s.push(Ua(i[a].image)):s.push(Ua(i[a]))}else s=Ua(i);n.url=s}return t||(e.images[this.uuid]=n),n}}function Ua(r){return typeof HTMLImageElement<"u"&&r instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&r instanceof ImageBitmap?jf.getDataURL(r):r.data?{data:Array.from(r.data),width:r.width,height:r.height,type:r.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let Kf=0;const Ia=new k;class an extends Zi{constructor(e=an.DEFAULT_IMAGE,t=an.DEFAULT_MAPPING,n=kn,i=kn,s=An,a=hi,o=In,l=Jn,c=an.DEFAULT_ANISOTROPY,u=wi){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Kf++}),this.uuid=zn(),this.name="",this.source=new Cl(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=i,this.magFilter=s,this.minFilter=a,this.anisotropy=c,this.format=o,this.internalFormat=null,this.type=l,this.offset=new dt(0,0),this.repeat=new dt(1,1),this.center=new dt(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new gt,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=u,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(e&&e.depth&&e.depth>1),this.pmremVersion=0}get width(){return this.source.getSize(Ia).x}get height(){return this.source.getSize(Ia).y}get depth(){return this.source.getSize(Ia).z}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(const t in e){const n=e[t];if(n===void 0){console.warn(`THREE.Texture.setValues(): parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){console.warn(`THREE.Texture.setValues(): property '${t}' does not exist.`);continue}i&&n&&i.isVector2&&n.isVector2||i&&n&&i.isVector3&&n.isVector3||i&&n&&i.isMatrix3&&n.isMatrix3?i.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Zu)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case jn:e.x=e.x-Math.floor(e.x);break;case kn:e.x=e.x<0?0:1;break;case Lo: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 jn:e.y=e.y-Math.floor(e.y);break;case kn:e.y=e.y<0?0:1;break;case Lo: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)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}an.DEFAULT_IMAGE=null;an.DEFAULT_MAPPING=Zu;an.DEFAULT_ANISOTROPY=1;class St{constructor(e=0,t=0,n=0,i=1){St.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=i}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,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,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,n=this.y,i=this.z,s=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*i+a[12]*s,this.y=a[1]*t+a[5]*n+a[9]*i+a[13]*s,this.z=a[2]*t+a[6]*n+a[10]*i+a[14]*s,this.w=a[3]*t+a[7]*n+a[11]*i+a[15]*s,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,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,n,i,s;const l=e.elements,c=l[0],u=l[4],h=l[8],d=l[1],f=l[5],m=l[9],_=l[2],g=l[6],p=l[10];if(Math.abs(u-d)<.01&&Math.abs(h-_)<.01&&Math.abs(m-g)<.01){if(Math.abs(u+d)<.1&&Math.abs(h+_)<.1&&Math.abs(m+g)<.1&&Math.abs(c+f+p-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const E=(c+1)/2,y=(f+1)/2,I=(p+1)/2,R=(u+d)/4,C=(h+_)/4,L=(m+g)/4;return E>y&&E>I?E<.01?(n=0,i=.707106781,s=.707106781):(n=Math.sqrt(E),i=R/n,s=C/n):y>I?y<.01?(n=.707106781,i=0,s=.707106781):(i=Math.sqrt(y),n=R/i,s=L/i):I<.01?(n=.707106781,i=.707106781,s=0):(s=Math.sqrt(I),n=C/s,i=L/s),this.set(n,i,s,t),this}let M=Math.sqrt((g-m)*(g-m)+(h-_)*(h-_)+(d-u)*(d-u));return Math.abs(M)<.001&&(M=1),this.x=(g-m)/M,this.y=(h-_)/M,this.z=(d-u)/M,this.w=Math.acos((c+f+p-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}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.w=Math.min(this.w,e.w),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.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=yt(this.x,e.x,t.x),this.y=yt(this.y,e.y,t.y),this.z=yt(this.z,e.z,t.z),this.w=yt(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=yt(this.x,e,t),this.y=yt(this.y,e,t),this.z=yt(this.z,e,t),this.w=yt(this.w,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(yt(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,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)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}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.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}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}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}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class $f extends Zi{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:An,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new St(0,0,e,t),this.scissorTest=!1,this.viewport=new St(0,0,e,t);const i={width:e,height:t,depth:n.depth},s=new an(i);this.textures=[];const a=n.count;for(let o=0;o<a;o++)this.textures[o]=s.clone(),this.textures[o].isRenderTargetTexture=!0,this.textures[o].renderTarget=this;this._setTextureOptions(n),this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=n.depthTexture,this.samples=n.samples,this.multiview=n.multiview}_setTextureOptions(e={}){const t={minFilter:An,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(t.mapping=e.mapping),e.wrapS!==void 0&&(t.wrapS=e.wrapS),e.wrapT!==void 0&&(t.wrapT=e.wrapT),e.wrapR!==void 0&&(t.wrapR=e.wrapR),e.magFilter!==void 0&&(t.magFilter=e.magFilter),e.minFilter!==void 0&&(t.minFilter=e.minFilter),e.format!==void 0&&(t.format=e.format),e.type!==void 0&&(t.type=e.type),e.anisotropy!==void 0&&(t.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(t.colorSpace=e.colorSpace),e.flipY!==void 0&&(t.flipY=e.flipY),e.generateMipmaps!==void 0&&(t.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(t.internalFormat=e.internalFormat);for(let n=0;n<this.textures.length;n++)this.textures[n].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let i=0,s=this.textures.length;i<s;i++)this.textures[i].image.width=e,this.textures[i].image.height=t,this.textures[i].image.depth=n,this.textures[i].isArrayTexture=this.textures[i].image.depth>1;this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t<n;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;const i=Object.assign({},e.textures[t].image);this.textures[t].source=new Cl(i)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class Ji extends $f{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}}class ch extends an{constructor(e=null,t=1,n=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=Rn,this.minFilter=Rn,this.wrapR=kn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class Jf extends an{constructor(e=null,t=1,n=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=Rn,this.minFilter=Rn,this.wrapR=kn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Zn{constructor(e=new k(1/0,1/0,1/0),t=new k(-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){this.makeEmpty();for(let t=0,n=e.length;t<n;t+=3)this.expandByPoint(Nn.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(Nn.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=Nn.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);const n=e.geometry;if(n!==void 0){const s=n.getAttribute("position");if(t===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let a=0,o=s.count;a<o;a++)e.isMesh===!0?e.getVertexPosition(a,Nn):Nn.fromBufferAttribute(s,a),Nn.applyMatrix4(e.matrixWorld),this.expandByPoint(Nn);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),vs.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),vs.copy(n.boundingBox)),vs.applyMatrix4(e.matrixWorld),this.union(vs)}const i=e.children;for(let s=0,a=i.length;s<a;s++)this.expandByObject(i[s],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.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.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,Nn),Nn.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Gr),ys.subVectors(this.max,Gr),ar.subVectors(e.a,Gr),or.subVectors(e.b,Gr),lr.subVectors(e.c,Gr),vi.subVectors(or,ar),yi.subVectors(lr,or),Ii.subVectors(ar,lr);let t=[0,-vi.z,vi.y,0,-yi.z,yi.y,0,-Ii.z,Ii.y,vi.z,0,-vi.x,yi.z,0,-yi.x,Ii.z,0,-Ii.x,-vi.y,vi.x,0,-yi.y,yi.x,0,-Ii.y,Ii.x,0];return!Na(t,ar,or,lr,ys)||(t=[1,0,0,0,1,0,0,0,1],!Na(t,ar,or,lr,ys))?!1:(xs.crossVectors(vi,yi),t=[xs.x,xs.y,xs.z],Na(t,ar,or,lr,ys))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Nn).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Nn).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:(ri[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),ri[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),ri[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),ri[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),ri[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),ri[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),ri[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),ri[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(ri),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)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}}const ri=[new k,new k,new k,new k,new k,new k,new k,new k],Nn=new k,vs=new Zn,ar=new k,or=new k,lr=new k,vi=new k,yi=new k,Ii=new k,Gr=new k,ys=new k,xs=new k,Ni=new k;function Na(r,e,t,n,i){for(let s=0,a=r.length-3;s<=a;s+=3){Ni.fromArray(r,s);const o=i.x*Math.abs(Ni.x)+i.y*Math.abs(Ni.y)+i.z*Math.abs(Ni.z),l=e.dot(Ni),c=t.dot(Ni),u=n.dot(Ni);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>o)return!1}return!0}const Zf=new Zn,Wr=new k,Fa=new k;class _i{constructor(e=new k,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const n=this.center;t!==void 0?n.copy(t):Zf.setFromPoints(e).getCenter(n);let i=0;for(let s=0,a=e.length;s<a;s++)i=Math.max(i,n.distanceToSquared(e[s]));return this.radius=Math.sqrt(i),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const n=this.center.distanceToSquared(e);return t.copy(e),n>this.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){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;Wr.subVectors(e,this.center);const t=Wr.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),i=(n-this.radius)*.5;this.center.addScaledVector(Wr,i/n),this.radius+=i}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(Fa.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Wr.copy(e.center).add(Fa)),this.expandByPoint(Wr.copy(e.center).sub(Fa))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}}const si=new k,Oa=new k,Ss=new k,xi=new k,Ba=new k,Ms=new k,ka=new k;class Or{constructor(e=new k,t=new k(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.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,si)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=si.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(si.copy(this.origin).addScaledVector(this.direction,t),si.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){Oa.copy(e).add(t).multiplyScalar(.5),Ss.copy(t).sub(e).normalize(),xi.copy(this.origin).sub(Oa);const s=e.distanceTo(t)*.5,a=-this.direction.dot(Ss),o=xi.dot(this.direction),l=-xi.dot(Ss),c=xi.lengthSq(),u=Math.abs(1-a*a);let h,d,f,m;if(u>0)if(h=a*l-o,d=a*o-l,m=s*u,h>=0)if(d>=-m)if(d<=m){const _=1/u;h*=_,d*=_,f=h*(h+a*d+2*o)+d*(a*h+d+2*l)+c}else d=s,h=Math.max(0,-(a*d+o)),f=-h*h+d*(d+2*l)+c;else d=-s,h=Math.max(0,-(a*d+o)),f=-h*h+d*(d+2*l)+c;else d<=-m?(h=Math.max(0,-(-a*s+o)),d=h>0?-s:Math.min(Math.max(-s,-l),s),f=-h*h+d*(d+2*l)+c):d<=m?(h=0,d=Math.min(Math.max(-s,-l),s),f=d*(d+2*l)+c):(h=Math.max(0,-(a*s+o)),d=h>0?s:Math.min(Math.max(-s,-l),s),f=-h*h+d*(d+2*l)+c);else d=a>0?-s:s,h=Math.max(0,-(a*d+o)),f=-h*h+d*(d+2*l)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,h),i&&i.copy(Oa).addScaledVector(Ss,d),f}intersectSphere(e,t){si.subVectors(e.center,this.origin);const n=si.dot(this.direction),i=si.dot(si)-n*n,s=e.radius*e.radius;if(i>s)return null;const a=Math.sqrt(s-i),o=n-a,l=n+a;return l<0?null:o<0?this.at(l,t):this.at(o,t)}intersectsSphere(e){return e.radius<0?!1: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 n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,i,s,a,o,l;const c=1/this.direction.x,u=1/this.direction.y,h=1/this.direction.z,d=this.origin;return c>=0?(n=(e.min.x-d.x)*c,i=(e.max.x-d.x)*c):(n=(e.max.x-d.x)*c,i=(e.min.x-d.x)*c),u>=0?(s=(e.min.y-d.y)*u,a=(e.max.y-d.y)*u):(s=(e.max.y-d.y)*u,a=(e.min.y-d.y)*u),n>a||s>i||((s>n||isNaN(n))&&(n=s),(a<i||isNaN(i))&&(i=a),h>=0?(o=(e.min.z-d.z)*h,l=(e.max.z-d.z)*h):(o=(e.max.z-d.z)*h,l=(e.min.z-d.z)*h),n>l||o>i)||((o>n||n!==n)&&(n=o),(l<i||i!==i)&&(i=l),i<0)?null:this.at(n>=0?n:i,t)}intersectsBox(e){return this.intersectBox(e,si)!==null}intersectTriangle(e,t,n,i,s){Ba.subVectors(t,e),Ms.subVectors(n,e),ka.crossVectors(Ba,Ms);let a=this.direction.dot(ka),o;if(a>0){if(i)return null;o=1}else if(a<0)o=-1,a=-a;else return null;xi.subVectors(this.origin,e);const l=o*this.direction.dot(Ms.crossVectors(xi,Ms));if(l<0)return null;const c=o*this.direction.dot(Ba.cross(xi));if(c<0||l+c>a)return null;const u=-o*xi.dot(ka);return u<0?null:this.at(u/a,s)}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 ut{constructor(e,t,n,i,s,a,o,l,c,u,h,d,f,m,_,g){ut.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,n,i,s,a,o,l,c,u,h,d,f,m,_,g)}set(e,t,n,i,s,a,o,l,c,u,h,d,f,m,_,g){const p=this.elements;return p[0]=e,p[4]=t,p[8]=n,p[12]=i,p[1]=s,p[5]=a,p[9]=o,p[13]=l,p[2]=c,p[6]=u,p[10]=h,p[14]=d,p[3]=f,p[7]=m,p[11]=_,p[15]=g,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 ut().fromArray(this.elements)}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){const t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[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,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,n=e.elements,i=1/cr.setFromMatrixColumn(e,0).length(),s=1/cr.setFromMatrixColumn(e,1).length(),a=1/cr.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*s,t[5]=n[5]*s,t[6]=n[6]*s,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,n=e.x,i=e.y,s=e.z,a=Math.cos(n),o=Math.sin(n),l=Math.cos(i),c=Math.sin(i),u=Math.cos(s),h=Math.sin(s);if(e.order==="XYZ"){const d=a*u,f=a*h,m=o*u,_=o*h;t[0]=l*u,t[4]=-l*h,t[8]=c,t[1]=f+m*c,t[5]=d-_*c,t[9]=-o*l,t[2]=_-d*c,t[6]=m+f*c,t[10]=a*l}else if(e.order==="YXZ"){const d=l*u,f=l*h,m=c*u,_=c*h;t[0]=d+_*o,t[4]=m*o-f,t[8]=a*c,t[1]=a*h,t[5]=a*u,t[9]=-o,t[2]=f*o-m,t[6]=_+d*o,t[10]=a*l}else if(e.order==="ZXY"){const d=l*u,f=l*h,m=c*u,_=c*h;t[0]=d-_*o,t[4]=-a*h,t[8]=m+f*o,t[1]=f+m*o,t[5]=a*u,t[9]=_-d*o,t[2]=-a*c,t[6]=o,t[10]=a*l}else if(e.order==="ZYX"){const d=a*u,f=a*h,m=o*u,_=o*h;t[0]=l*u,t[4]=m*c-f,t[8]=d*c+_,t[1]=l*h,t[5]=_*c+d,t[9]=f*c-m,t[2]=-c,t[6]=o*l,t[10]=a*l}else if(e.order==="YZX"){const d=a*l,f=a*c,m=o*l,_=o*c;t[0]=l*u,t[4]=_-d*h,t[8]=m*h+f,t[1]=h,t[5]=a*u,t[9]=-o*u,t[2]=-c*u,t[6]=f*h+m,t[10]=d-_*h}else if(e.order==="XZY"){const d=a*l,f=a*c,m=o*l,_=o*c;t[0]=l*u,t[4]=-h,t[8]=c*u,t[1]=d*h+_,t[5]=a*u,t[9]=f*h-m,t[2]=m*h-f,t[6]=o*u,t[10]=_*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(Qf,e,ep)}lookAt(e,t,n){const i=this.elements;return Tn.subVectors(e,t),Tn.lengthSq()===0&&(Tn.z=1),Tn.normalize(),Si.crossVectors(n,Tn),Si.lengthSq()===0&&(Math.abs(n.z)===1?Tn.x+=1e-4:Tn.z+=1e-4,Tn.normalize(),Si.crossVectors(n,Tn)),Si.normalize(),bs.crossVectors(Tn,Si),i[0]=Si.x,i[4]=bs.x,i[8]=Tn.x,i[1]=Si.y,i[5]=bs.y,i[9]=Tn.y,i[2]=Si.z,i[6]=bs.z,i[10]=Tn.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,s=this.elements,a=n[0],o=n[4],l=n[8],c=n[12],u=n[1],h=n[5],d=n[9],f=n[13],m=n[2],_=n[6],g=n[10],p=n[14],M=n[3],E=n[7],y=n[11],I=n[15],R=i[0],C=i[4],L=i[8],b=i[12],x=i[1],w=i[5],B=i[9],z=i[13],X=i[2],j=i[6],O=i[10],K=i[14],H=i[3],ie=i[7],oe=i[11],$=i[15];return s[0]=a*R+o*x+l*X+c*H,s[4]=a*C+o*w+l*j+c*ie,s[8]=a*L+o*B+l*O+c*oe,s[12]=a*b+o*z+l*K+c*$,s[1]=u*R+h*x+d*X+f*H,s[5]=u*C+h*w+d*j+f*ie,s[9]=u*L+h*B+d*O+f*oe,s[13]=u*b+h*z+d*K+f*$,s[2]=m*R+_*x+g*X+p*H,s[6]=m*C+_*w+g*j+p*ie,s[10]=m*L+_*B+g*O+p*oe,s[14]=m*b+_*z+g*K+p*$,s[3]=M*R+E*x+y*X+I*H,s[7]=M*C+E*w+y*j+I*ie,s[11]=M*L+E*B+y*O+I*oe,s[15]=M*b+E*z+y*K+I*$,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],n=e[4],i=e[8],s=e[12],a=e[1],o=e[5],l=e[9],c=e[13],u=e[2],h=e[6],d=e[10],f=e[14],m=e[3],_=e[7],g=e[11],p=e[15];return m*(+s*l*h-i*c*h-s*o*d+n*c*d+i*o*f-n*l*f)+_*(+t*l*f-t*c*d+s*a*d-i*a*f+i*c*u-s*l*u)+g*(+t*c*h-t*o*f-s*a*h+n*a*f+s*o*u-n*c*u)+p*(-i*o*u-t*l*h+t*o*d+i*a*h-n*a*d+n*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,n){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],u=e[8],h=e[9],d=e[10],f=e[11],m=e[12],_=e[13],g=e[14],p=e[15],M=h*g*c-_*d*c+_*l*f-o*g*f-h*l*p+o*d*p,E=m*d*c-u*g*c-m*l*f+a*g*f+u*l*p-a*d*p,y=u*_*c-m*h*c+m*o*f-a*_*f-u*o*p+a*h*p,I=m*h*l-u*_*l-m*o*d+a*_*d+u*o*g-a*h*g,R=t*M+n*E+i*y+s*I;if(R===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const C=1/R;return e[0]=M*C,e[1]=(_*d*s-h*g*s-_*i*f+n*g*f+h*i*p-n*d*p)*C,e[2]=(o*g*s-_*l*s+_*i*c-n*g*c-o*i*p+n*l*p)*C,e[3]=(h*l*s-o*d*s-h*i*c+n*d*c+o*i*f-n*l*f)*C,e[4]=E*C,e[5]=(u*g*s-m*d*s+m*i*f-t*g*f-u*i*p+t*d*p)*C,e[6]=(m*l*s-a*g*s-m*i*c+t*g*c+a*i*p-t*l*p)*C,e[7]=(a*d*s-u*l*s+u*i*c-t*d*c-a*i*f+t*l*f)*C,e[8]=y*C,e[9]=(m*h*s-u*_*s-m*n*f+t*_*f+u*n*p-t*h*p)*C,e[10]=(a*_*s-m*o*s+m*n*c-t*_*c-a*n*p+t*o*p)*C,e[11]=(u*o*s-a*h*s-u*n*c+t*h*c+a*n*f-t*o*f)*C,e[12]=I*C,e[13]=(u*_*i-m*h*i+m*n*d-t*_*d-u*n*g+t*h*g)*C,e[14]=(m*o*i-a*_*i-m*n*l+t*_*l+a*n*g-t*o*g)*C,e[15]=(a*h*i-u*o*i+u*n*l-t*h*l-a*n*d+t*o*d)*C,this}scale(e){const t=this.elements,n=e.x,i=e.y,s=e.z;return t[0]*=n,t[4]*=i,t[8]*=s,t[1]*=n,t[5]*=i,t[9]*=s,t[2]*=n,t[6]*=i,t[10]*=s,t[3]*=n,t[7]*=i,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),i=Math.sin(t),s=1-n,a=e.x,o=e.y,l=e.z,c=s*a,u=s*o;return this.set(c*a+n,c*o-i*l,c*l+i*o,0,c*o+i*l,u*o+n,u*l-i*a,0,c*l-i*o,u*l+i*a,s*l*l+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,i,s,a){return this.set(1,n,s,0,e,1,a,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){const i=this.elements,s=t._x,a=t._y,o=t._z,l=t._w,c=s+s,u=a+a,h=o+o,d=s*c,f=s*u,m=s*h,_=a*u,g=a*h,p=o*h,M=l*c,E=l*u,y=l*h,I=n.x,R=n.y,C=n.z;return i[0]=(1-(_+p))*I,i[1]=(f+y)*I,i[2]=(m-E)*I,i[3]=0,i[4]=(f-y)*R,i[5]=(1-(d+p))*R,i[6]=(g+M)*R,i[7]=0,i[8]=(m+E)*C,i[9]=(g-M)*C,i[10]=(1-(d+_))*C,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,n){const i=this.elements;let s=cr.set(i[0],i[1],i[2]).length();const a=cr.set(i[4],i[5],i[6]).length(),o=cr.set(i[8],i[9],i[10]).length();this.determinant()<0&&(s=-s),e.x=i[12],e.y=i[13],e.z=i[14],Fn.copy(this);const c=1/s,u=1/a,h=1/o;return Fn.elements[0]*=c,Fn.elements[1]*=c,Fn.elements[2]*=c,Fn.elements[4]*=u,Fn.elements[5]*=u,Fn.elements[6]*=u,Fn.elements[8]*=h,Fn.elements[9]*=h,Fn.elements[10]*=h,t.setFromRotationMatrix(Fn),n.x=s,n.y=a,n.z=o,this}makePerspective(e,t,n,i,s,a,o=di){const l=this.elements,c=2*s/(t-e),u=2*s/(n-i),h=(t+e)/(t-e),d=(n+i)/(n-i);let f,m;if(o===di)f=-(a+s)/(a-s),m=-2*a*s/(a-s);else if(o===ma)f=-a/(a-s),m=-a*s/(a-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return l[0]=c,l[4]=0,l[8]=h,l[12]=0,l[1]=0,l[5]=u,l[9]=d,l[13]=0,l[2]=0,l[6]=0,l[10]=f,l[14]=m,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,n,i,s,a,o=di){const l=this.elements,c=1/(t-e),u=1/(n-i),h=1/(a-s),d=(t+e)*c,f=(n+i)*u;let m,_;if(o===di)m=(a+s)*h,_=-2*h;else if(o===ma)m=s*h,_=-1*h;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return l[0]=2*c,l[4]=0,l[8]=0,l[12]=-d,l[1]=0,l[5]=2*u,l[9]=0,l[13]=-f,l[2]=0,l[6]=0,l[10]=_,l[14]=-m,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let i=0;i<16;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}const cr=new k,Fn=new ut,Qf=new k(0,0,0),ep=new k(1,1,1),Si=new k,bs=new k,Tn=new k,fc=new ut,pc=new Cn;class bn{constructor(e=0,t=0,n=0,i=bn.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=i}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,n,i=this._order){return this._x=e,this._y=t,this._z=n,this._order=i,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,n=!0){const i=e.elements,s=i[0],a=i[4],o=i[8],l=i[1],c=i[5],u=i[9],h=i[2],d=i[6],f=i[10];switch(t){case"XYZ":this._y=Math.asin(yt(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-u,f),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(d,c),this._z=0);break;case"YXZ":this._x=Math.asin(-yt(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(o,f),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-h,s),this._z=0);break;case"ZXY":this._x=Math.asin(yt(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-h,f),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-yt(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(d,f),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin(yt(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-h,s)):(this._x=0,this._y=Math.atan2(o,f));break;case"XZY":this._z=Math.asin(-yt(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(d,c),this._y=Math.atan2(o,s)):(this._x=Math.atan2(-u,f),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return fc.makeRotationFromQuaternion(e),this.setFromRotationMatrix(fc,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return pc.setFromEuler(this),this.setFromQuaternion(pc,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}}bn.DEFAULT_ORDER="XYZ";class Pl{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}let tp=0;const mc=new k,ur=new Cn,ai=new ut,Es=new k,Xr=new k,np=new k,ip=new Cn,gc=new k(1,0,0),_c=new k(0,1,0),vc=new k(0,0,1),yc={type:"added"},rp={type:"removed"},hr={type:"childadded",child:null},za={type:"childremoved",child:null};class Ft extends Zi{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:tp++}),this.uuid=zn(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Ft.DEFAULT_UP.clone();const e=new k,t=new bn,n=new Cn,i=new k(1,1,1);function s(){n.setFromEuler(t,!1)}function a(){t.setFromQuaternion(n,void 0,!1)}t._onChange(s),n._onChange(a),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new ut},normalMatrix:{value:new gt}}),this.matrix=new ut,this.matrixWorld=new ut,this.matrixAutoUpdate=Ft.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=Ft.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Pl,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return ur.setFromAxisAngle(e,t),this.quaternion.multiply(ur),this}rotateOnWorldAxis(e,t){return ur.setFromAxisAngle(e,t),this.quaternion.premultiply(ur),this}rotateX(e){return this.rotateOnAxis(gc,e)}rotateY(e){return this.rotateOnAxis(_c,e)}rotateZ(e){return this.rotateOnAxis(vc,e)}translateOnAxis(e,t){return mc.copy(e).applyQuaternion(this.quaternion),this.position.add(mc.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(gc,e)}translateY(e){return this.translateOnAxis(_c,e)}translateZ(e){return this.translateOnAxis(vc,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(ai.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?Es.copy(e):Es.set(e,t,n);const i=this.parent;this.updateWorldMatrix(!0,!1),Xr.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?ai.lookAt(Xr,Es,this.up):ai.lookAt(Es,Xr,this.up),this.quaternion.setFromRotationMatrix(ai),i&&(ai.extractRotation(i.matrixWorld),ur.setFromRotationMatrix(ai),this.quaternion.premultiply(ur.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(yc),hr.child=e,this.dispatchEvent(hr),hr.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(rp),za.child=e,this.dispatchEvent(za),za.child=null),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),ai.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),ai.multiply(e.parent.matrixWorld)),e.applyMatrix4(ai),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(yc),hr.child=e,this.dispatchEvent(hr),hr.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,i=this.children.length;n<i;n++){const a=this.children[n].getObjectByProperty(e,t);if(a!==void 0)return a}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);const i=this.children;for(let s=0,a=i.length;s<a;s++)i[s].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Xr,e,np),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Xr,ip,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverseVisible(e)}traverseAncestors(e){const t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t){const n=this.parent;if(e===!0&&n!==null&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),t===!0){const i=this.children;for(let s=0,a=i.length;s<a;s++)i[s].updateWorldMatrix(!1,!0)}}toJSON(e){const t=e===void 0||typeof e=="string",n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});const i={};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.castShadow===!0&&(i.castShadow=!0),this.receiveShadow===!0&&(i.receiveShadow=!0),this.visible===!1&&(i.visible=!1),this.frustumCulled===!1&&(i.frustumCulled=!1),this.renderOrder!==0&&(i.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.geometryInfo=this._geometryInfo.map(o=>({...o,boundingBox:o.boundingBox?o.boundingBox.toJSON():void 0,boundingSphere:o.boundingSphere?o.boundingSphere.toJSON():void 0})),i.instanceInfo=this._instanceInfo.map(o=>({...o})),i.availableInstanceIds=this._availableInstanceIds.slice(),i.availableGeometryIds=this._availableGeometryIds.slice(),i.nextIndexStart=this._nextIndexStart,i.nextVertexStart=this._nextVertexStart,i.geometryCount=this._geometryCount,i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.matricesTexture=this._matricesTexture.toJSON(e),i.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(i.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(i.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(i.boundingBox=this.boundingBox.toJSON()));function s(o,l){return o[l.uuid]===void 0&&(o[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=s(e.geometries,this.geometry);const o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){const l=o.shapes;if(Array.isArray(l))for(let c=0,u=l.length;c<u;c++){const h=l[c];s(e.shapes,h)}else s(e.shapes,l)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const o=[];for(let l=0,c=this.material.length;l<c;l++)o.push(s(e.materials,this.material[l]));i.material=o}else i.material=s(e.materials,this.material);if(this.children.length>0){i.children=[];for(let o=0;o<this.children.length;o++)i.children.push(this.children[o].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let o=0;o<this.animations.length;o++){const l=this.animations[o];i.animations.push(s(e.animations,l))}}if(t){const o=a(e.geometries),l=a(e.materials),c=a(e.textures),u=a(e.images),h=a(e.shapes),d=a(e.skeletons),f=a(e.animations),m=a(e.nodes);o.length>0&&(n.geometries=o),l.length>0&&(n.materials=l),c.length>0&&(n.textures=c),u.length>0&&(n.images=u),h.length>0&&(n.shapes=h),d.length>0&&(n.skeletons=d),f.length>0&&(n.animations=f),m.length>0&&(n.nodes=m)}return n.object=i,n;function a(o){const l=[];for(const c in o){const u=o[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.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,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.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n<e.children.length;n++){const i=e.children[n];this.add(i.clone())}return this}}Ft.DEFAULT_UP=new k(0,1,0);Ft.DEFAULT_MATRIX_AUTO_UPDATE=!0;Ft.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const On=new k,oi=new k,Va=new k,li=new k,dr=new k,fr=new k,xc=new k,Ha=new k,Ga=new k,Wa=new k,Xa=new St,qa=new St,ja=new St;class Un{constructor(e=new k,t=new k,n=new k){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,i){i.subVectors(n,t),On.subVectors(e,t),i.cross(On);const s=i.lengthSq();return s>0?i.multiplyScalar(1/Math.sqrt(s)):i.set(0,0,0)}static getBarycoord(e,t,n,i,s){On.subVectors(i,t),oi.subVectors(n,t),Va.subVectors(e,t);const a=On.dot(On),o=On.dot(oi),l=On.dot(Va),c=oi.dot(oi),u=oi.dot(Va),h=a*c-o*o;if(h===0)return s.set(0,0,0),null;const d=1/h,f=(c*l-o*u)*d,m=(a*u-o*l)*d;return s.set(1-f-m,m,f)}static containsPoint(e,t,n,i){return this.getBarycoord(e,t,n,i,li)===null?!1:li.x>=0&&li.y>=0&&li.x+li.y<=1}static getInterpolation(e,t,n,i,s,a,o,l){return this.getBarycoord(e,t,n,i,li)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(s,li.x),l.addScaledVector(a,li.y),l.addScaledVector(o,li.z),l)}static getInterpolatedAttribute(e,t,n,i,s,a){return Xa.setScalar(0),qa.setScalar(0),ja.setScalar(0),Xa.fromBufferAttribute(e,t),qa.fromBufferAttribute(e,n),ja.fromBufferAttribute(e,i),a.setScalar(0),a.addScaledVector(Xa,s.x),a.addScaledVector(qa,s.y),a.addScaledVector(ja,s.z),a}static isFrontFacing(e,t,n,i){return On.subVectors(n,t),oi.subVectors(e,t),On.cross(oi).dot(i)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,i),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 On.subVectors(this.c,this.b),oi.subVectors(this.a,this.b),On.cross(oi).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Un.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Un.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,i,s){return Un.getInterpolation(e,this.a,this.b,this.c,t,n,i,s)}containsPoint(e){return Un.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Un.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,i=this.b,s=this.c;let a,o;dr.subVectors(i,n),fr.subVectors(s,n),Ha.subVectors(e,n);const l=dr.dot(Ha),c=fr.dot(Ha);if(l<=0&&c<=0)return t.copy(n);Ga.subVectors(e,i);const u=dr.dot(Ga),h=fr.dot(Ga);if(u>=0&&h<=u)return t.copy(i);const d=l*h-u*c;if(d<=0&&l>=0&&u<=0)return a=l/(l-u),t.copy(n).addScaledVector(dr,a);Wa.subVectors(e,s);const f=dr.dot(Wa),m=fr.dot(Wa);if(m>=0&&f<=m)return t.copy(s);const _=f*c-l*m;if(_<=0&&c>=0&&m<=0)return o=c/(c-m),t.copy(n).addScaledVector(fr,o);const g=u*m-f*h;if(g<=0&&h-u>=0&&f-m>=0)return xc.subVectors(s,i),o=(h-u)/(h-u+(f-m)),t.copy(i).addScaledVector(xc,o);const p=1/(g+_+d);return a=_*p,o=d*p,t.copy(n).addScaledVector(dr,a).addScaledVector(fr,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const uh={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},Mi={h:0,s:0,l:0},Ts={h:0,s:0,l:0};function Ya(r,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?r+(e-r)*6*t:t<1/2?e:t<2/3?r+(e-r)*6*(2/3-t):r}class ht{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){const i=e;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=At){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,vt.colorSpaceToWorking(this,t),this}setRGB(e,t,n,i=vt.workingColorSpace){return this.r=e,this.g=t,this.b=n,vt.colorSpaceToWorking(this,i),this}setHSL(e,t,n,i=vt.workingColorSpace){if(e=Rl(e,1),t=yt(t,0,1),n=yt(n,0,1),t===0)this.r=this.g=this.b=n;else{const s=n<=.5?n*(1+t):n+t-n*t,a=2*n-s;this.r=Ya(a,s,e+1/3),this.g=Ya(a,s,e),this.b=Ya(a,s,e-1/3)}return vt.colorSpaceToWorking(this,i),this}setStyle(e,t=At){function n(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const a=i[1],o=i[2];switch(a){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=i[1],a=s.length;if(a===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(a===6)return this.setHex(parseInt(s,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=At){const n=uh[e.toLowerCase()];return n!==void 0?this.setHex(n,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=pi(e.r),this.g=pi(e.g),this.b=pi(e.b),this}copyLinearToSRGB(e){return this.r=Cr(e.r),this.g=Cr(e.g),this.b=Cr(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=At){return vt.workingToColorSpace(cn.copy(this),e),Math.round(yt(cn.r*255,0,255))*65536+Math.round(yt(cn.g*255,0,255))*256+Math.round(yt(cn.b*255,0,255))}getHexString(e=At){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=vt.workingColorSpace){vt.workingToColorSpace(cn.copy(this),t);const n=cn.r,i=cn.g,s=cn.b,a=Math.max(n,i,s),o=Math.min(n,i,s);let l,c;const u=(o+a)/2;if(o===a)l=0,c=0;else{const h=a-o;switch(c=u<=.5?h/(a+o):h/(2-a-o),a){case n:l=(i-s)/h+(i<s?6:0);break;case i:l=(s-n)/h+2;break;case s:l=(n-i)/h+4;break}l/=6}return e.h=l,e.s=c,e.l=u,e}getRGB(e,t=vt.workingColorSpace){return vt.workingToColorSpace(cn.copy(this),t),e.r=cn.r,e.g=cn.g,e.b=cn.b,e}getStyle(e=At){vt.workingToColorSpace(cn.copy(this),e);const t=cn.r,n=cn.g,i=cn.b;return e!==At?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${i.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(i*255)})`}offsetHSL(e,t,n){return this.getHSL(Mi),this.setHSL(Mi.h+e,Mi.s+t,Mi.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(Mi),e.getHSL(Ts);const n=ns(Mi.h,Ts.h,t),i=ns(Mi.s,Ts.s,t),s=ns(Mi.l,Ts.l,t);return this.setHSL(n,i,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,n=this.g,i=this.b,s=e.elements;return this.r=s[0]*t+s[3]*n+s[6]*i,this.g=s[1]*t+s[4]*n+s[7]*i,this.b=s[2]*t+s[5]*n+s[8]*i,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const cn=new ht;ht.NAMES=uh;let sp=0;class Vn extends Zi{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:sp++}),this.uuid=zn(),this.name="",this.type="Material",this.blending=Ar,this.side=$n,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=So,this.blendDst=Mo,this.blendEquation=Gi,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new ht(0,0,0),this.blendAlpha=0,this.depthFunc=Pr,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=ac,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=rr,this.stencilZFail=rr,this.stencilZPass=rr,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.forceSinglePass=!1,this.allowOverride=!0,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}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const n=e[t];if(n===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==Ar&&(n.blending=this.blending),this.side!==$n&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==So&&(n.blendSrc=this.blendSrc),this.blendDst!==Mo&&(n.blendDst=this.blendDst),this.blendEquation!==Gi&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==Pr&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==ac&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==rr&&(n.stencilFail=this.stencilFail),this.stencilZFail!==rr&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==rr&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function i(s){const a=[];for(const o in s){const l=s[o];delete l.metadata,a.push(l)}return a}if(t){const s=i(e.textures),a=i(e.images);s.length>0&&(n.textures=s),a.length>0&&(n.images=a)}return n}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.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,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 n=null;if(t!==null){const i=t.length;n=new Array(i);for(let s=0;s!==i;++s)n[s]=t[s].clone()}return this.clippingPlanes=n,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.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,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 Ci extends Vn{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new ht(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.envMapRotation=new bn,this.combine=xa,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.envMapRotation.copy(e.envMapRotation),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 jt=new k,ws=new dt;let ap=0;class Xt{constructor(e,t,n=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:ap++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=al,this.updateRanges=[],this.gpuType=Yn,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}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.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,s=this.itemSize;i<s;i++)this.array[e+i]=t.array[n+i];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)ws.fromBufferAttribute(this,t),ws.applyMatrix3(e),this.setXY(t,ws.x,ws.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)jt.fromBufferAttribute(this,t),jt.applyMatrix3(e),this.setXYZ(t,jt.x,jt.y,jt.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)jt.fromBufferAttribute(this,t),jt.applyMatrix4(e),this.setXYZ(t,jt.x,jt.y,jt.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)jt.fromBufferAttribute(this,t),jt.applyNormalMatrix(e),this.setXYZ(t,jt.x,jt.y,jt.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)jt.fromBufferAttribute(this,t),jt.transformDirection(e),this.setXYZ(t,jt.x,jt.y,jt.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];return this.normalized&&(n=Bn(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Lt(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=Bn(t,this.array)),t}setX(e,t){return this.normalized&&(t=Lt(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=Bn(t,this.array)),t}setY(e,t){return this.normalized&&(t=Lt(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=Bn(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Lt(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=Bn(t,this.array)),t}setW(e,t){return this.normalized&&(t=Lt(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=Lt(t,this.array),n=Lt(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,i){return e*=this.itemSize,this.normalized&&(t=Lt(t,this.array),n=Lt(n,this.array),i=Lt(i,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this}setXYZW(e,t,n,i,s){return e*=this.itemSize,this.normalized&&(t=Lt(t,this.array),n=Lt(n,this.array),i=Lt(i,this.array),s=Lt(s,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this.array[e+3]=s,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==al&&(e.usage=this.usage),e}}class hh extends Xt{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class op extends Xt{constructor(e,t,n){super(new Int32Array(e),t,n)}}class dh extends Xt{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class xt extends Xt{constructor(e,t,n){super(new Float32Array(e),t,n)}}let lp=0;const Dn=new ut,Ka=new Ft,pr=new k,wn=new Zn,qr=new Zn,Qt=new k;class Vt extends Zi{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:lp++}),this.uuid=zn(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(lh(e)?dh:hh)(e,1):this.index=e,this}setIndirect(e){return this.indirect=e,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(n!==void 0){const s=new gt().getNormalMatrix(e);n.applyNormalMatrix(s),n.needsUpdate=!0}const i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(e),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return Dn.makeRotationFromQuaternion(e),this.applyMatrix4(Dn),this}rotateX(e){return Dn.makeRotationX(e),this.applyMatrix4(Dn),this}rotateY(e){return Dn.makeRotationY(e),this.applyMatrix4(Dn),this}rotateZ(e){return Dn.makeRotationZ(e),this.applyMatrix4(Dn),this}translate(e,t,n){return Dn.makeTranslation(e,t,n),this.applyMatrix4(Dn),this}scale(e,t,n){return Dn.makeScale(e,t,n),this.applyMatrix4(Dn),this}lookAt(e){return Ka.lookAt(e),Ka.updateMatrix(),this.applyMatrix4(Ka.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(pr).negate(),this.translate(pr.x,pr.y,pr.z),this}setFromPoints(e){const t=this.getAttribute("position");if(t===void 0){const n=[];for(let i=0,s=e.length;i<s;i++){const a=e[i];n.push(a.x,a.y,a.z||0)}this.setAttribute("position",new xt(n,3))}else{const n=Math.min(e.length,t.count);for(let i=0;i<n;i++){const s=e[i];t.setXYZ(i,s.x,s.y,s.z||0)}e.length>t.count&&console.warn("THREE.BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Zn);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new k(-1/0,-1/0,-1/0),new k(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,i=t.length;n<i;n++){const s=t[n];wn.setFromBufferAttribute(s),this.morphTargetsRelative?(Qt.addVectors(this.boundingBox.min,wn.min),this.boundingBox.expandByPoint(Qt),Qt.addVectors(this.boundingBox.max,wn.max),this.boundingBox.expandByPoint(Qt)):(this.boundingBox.expandByPoint(wn.min),this.boundingBox.expandByPoint(wn.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new _i);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new k,1/0);return}if(e){const n=this.boundingSphere.center;if(wn.setFromBufferAttribute(e),t)for(let s=0,a=t.length;s<a;s++){const o=t[s];qr.setFromBufferAttribute(o),this.morphTargetsRelative?(Qt.addVectors(wn.min,qr.min),wn.expandByPoint(Qt),Qt.addVectors(wn.max,qr.max),wn.expandByPoint(Qt)):(wn.expandByPoint(qr.min),wn.expandByPoint(qr.max))}wn.getCenter(n);let i=0;for(let s=0,a=e.count;s<a;s++)Qt.fromBufferAttribute(e,s),i=Math.max(i,n.distanceToSquared(Qt));if(t)for(let s=0,a=t.length;s<a;s++){const o=t[s],l=this.morphTargetsRelative;for(let c=0,u=o.count;c<u;c++)Qt.fromBufferAttribute(o,c),l&&(pr.fromBufferAttribute(e,c),Qt.add(pr)),i=Math.max(i,n.distanceToSquared(Qt))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const n=t.position,i=t.normal,s=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new Xt(new Float32Array(4*n.count),4));const a=this.getAttribute("tangent"),o=[],l=[];for(let L=0;L<n.count;L++)o[L]=new k,l[L]=new k;const c=new k,u=new k,h=new k,d=new dt,f=new dt,m=new dt,_=new k,g=new k;function p(L,b,x){c.fromBufferAttribute(n,L),u.fromBufferAttribute(n,b),h.fromBufferAttribute(n,x),d.fromBufferAttribute(s,L),f.fromBufferAttribute(s,b),m.fromBufferAttribute(s,x),u.sub(c),h.sub(c),f.sub(d),m.sub(d);const w=1/(f.x*m.y-m.x*f.y);isFinite(w)&&(_.copy(u).multiplyScalar(m.y).addScaledVector(h,-f.y).multiplyScalar(w),g.copy(h).multiplyScalar(f.x).addScaledVector(u,-m.x).multiplyScalar(w),o[L].add(_),o[b].add(_),o[x].add(_),l[L].add(g),l[b].add(g),l[x].add(g))}let M=this.groups;M.length===0&&(M=[{start:0,count:e.count}]);for(let L=0,b=M.length;L<b;++L){const x=M[L],w=x.start,B=x.count;for(let z=w,X=w+B;z<X;z+=3)p(e.getX(z+0),e.getX(z+1),e.getX(z+2))}const E=new k,y=new k,I=new k,R=new k;function C(L){I.fromBufferAttribute(i,L),R.copy(I);const b=o[L];E.copy(b),E.sub(I.multiplyScalar(I.dot(b))).normalize(),y.crossVectors(R,b);const w=y.dot(l[L])<0?-1:1;a.setXYZW(L,E.x,E.y,E.z,w)}for(let L=0,b=M.length;L<b;++L){const x=M[L],w=x.start,B=x.count;for(let z=w,X=w+B;z<X;z+=3)C(e.getX(z+0)),C(e.getX(z+1)),C(e.getX(z+2))}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let n=this.getAttribute("normal");if(n===void 0)n=new Xt(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let d=0,f=n.count;d<f;d++)n.setXYZ(d,0,0,0);const i=new k,s=new k,a=new k,o=new k,l=new k,c=new k,u=new k,h=new k;if(e)for(let d=0,f=e.count;d<f;d+=3){const m=e.getX(d+0),_=e.getX(d+1),g=e.getX(d+2);i.fromBufferAttribute(t,m),s.fromBufferAttribute(t,_),a.fromBufferAttribute(t,g),u.subVectors(a,s),h.subVectors(i,s),u.cross(h),o.fromBufferAttribute(n,m),l.fromBufferAttribute(n,_),c.fromBufferAttribute(n,g),o.add(u),l.add(u),c.add(u),n.setXYZ(m,o.x,o.y,o.z),n.setXYZ(_,l.x,l.y,l.z),n.setXYZ(g,c.x,c.y,c.z)}else for(let d=0,f=t.count;d<f;d+=3)i.fromBufferAttribute(t,d+0),s.fromBufferAttribute(t,d+1),a.fromBufferAttribute(t,d+2),u.subVectors(a,s),h.subVectors(i,s),u.cross(h),n.setXYZ(d+0,u.x,u.y,u.z),n.setXYZ(d+1,u.x,u.y,u.z),n.setXYZ(d+2,u.x,u.y,u.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)Qt.fromBufferAttribute(e,t),Qt.normalize(),e.setXYZ(t,Qt.x,Qt.y,Qt.z)}toNonIndexed(){function e(o,l){const c=o.array,u=o.itemSize,h=o.normalized,d=new c.constructor(l.length*u);let f=0,m=0;for(let _=0,g=l.length;_<g;_++){o.isInterleavedBufferAttribute?f=l[_]*o.data.stride+o.offset:f=l[_]*u;for(let p=0;p<u;p++)d[m++]=c[f++]}return new Xt(d,u,h)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new Vt,n=this.index.array,i=this.attributes;for(const o in i){const l=i[o],c=e(l,n);t.setAttribute(o,c)}const s=this.morphAttributes;for(const o in s){const l=[],c=s[o];for(let u=0,h=c.length;u<h;u++){const d=c[u],f=e(d,n);l.push(f)}t.morphAttributes[o]=l}t.morphTargetsRelative=this.morphTargetsRelative;const a=this.groups;for(let o=0,l=a.length;o<l;o++){const c=a[o];t.addGroup(c.start,c.count,c.materialIndex)}return t}toJSON(){const e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(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 n=this.attributes;for(const l in n){const c=n[l];e.data.attributes[l]=c.toJSON(e.data)}const i={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],u=[];for(let h=0,d=c.length;h<d;h++){const f=c[h];u.push(f.toJSON(e.data))}u.length>0&&(i[l]=u,s=!0)}s&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));const o=this.boundingSphere;return o!==null&&(e.data.boundingSphere=o.toJSON()),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 n=e.index;n!==null&&this.setIndex(n.clone());const i=e.attributes;for(const c in i){const u=i[c];this.setAttribute(c,u.clone(t))}const s=e.morphAttributes;for(const c in s){const u=[],h=s[c];for(let d=0,f=h.length;d<f;d++)u.push(h[d].clone(t));this.morphAttributes[c]=u}this.morphTargetsRelative=e.morphTargetsRelative;const a=e.groups;for(let c=0,u=a.length;c<u;c++){const h=a[c];this.addGroup(h.start,h.count,h.materialIndex)}const o=e.boundingBox;o!==null&&(this.boundingBox=o.clone());const l=e.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const Sc=new ut,Fi=new Or,As=new _i,Mc=new k,Rs=new k,Cs=new k,Ps=new k,$a=new k,Ds=new k,bc=new k,Ls=new k;class Ut extends Ft{constructor(e=new Vt,t=new Ci){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=i.length;s<a;s++){const o=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}getVertexPosition(e,t){const n=this.geometry,i=n.attributes.position,s=n.morphAttributes.position,a=n.morphTargetsRelative;t.fromBufferAttribute(i,e);const o=this.morphTargetInfluences;if(s&&o){Ds.set(0,0,0);for(let l=0,c=s.length;l<c;l++){const u=o[l],h=s[l];u!==0&&($a.fromBufferAttribute(h,e),a?Ds.addScaledVector($a,u):Ds.addScaledVector($a.sub(t),u))}t.add(Ds)}return t}raycast(e,t){const n=this.geometry,i=this.material,s=this.matrixWorld;i!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),As.copy(n.boundingSphere),As.applyMatrix4(s),Fi.copy(e.ray).recast(e.near),!(As.containsPoint(Fi.origin)===!1&&(Fi.intersectSphere(As,Mc)===null||Fi.origin.distanceToSquared(Mc)>(e.far-e.near)**2))&&(Sc.copy(s).invert(),Fi.copy(e.ray).applyMatrix4(Sc),!(n.boundingBox!==null&&Fi.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,Fi)))}_computeIntersections(e,t,n){let i;const s=this.geometry,a=this.material,o=s.index,l=s.attributes.position,c=s.attributes.uv,u=s.attributes.uv1,h=s.attributes.normal,d=s.groups,f=s.drawRange;if(o!==null)if(Array.isArray(a))for(let m=0,_=d.length;m<_;m++){const g=d[m],p=a[g.materialIndex],M=Math.max(g.start,f.start),E=Math.min(o.count,Math.min(g.start+g.count,f.start+f.count));for(let y=M,I=E;y<I;y+=3){const R=o.getX(y),C=o.getX(y+1),L=o.getX(y+2);i=Us(this,p,e,n,c,u,h,R,C,L),i&&(i.faceIndex=Math.floor(y/3),i.face.materialIndex=g.materialIndex,t.push(i))}}else{const m=Math.max(0,f.start),_=Math.min(o.count,f.start+f.count);for(let g=m,p=_;g<p;g+=3){const M=o.getX(g),E=o.getX(g+1),y=o.getX(g+2);i=Us(this,a,e,n,c,u,h,M,E,y),i&&(i.faceIndex=Math.floor(g/3),t.push(i))}}else if(l!==void 0)if(Array.isArray(a))for(let m=0,_=d.length;m<_;m++){const g=d[m],p=a[g.materialIndex],M=Math.max(g.start,f.start),E=Math.min(l.count,Math.min(g.start+g.count,f.start+f.count));for(let y=M,I=E;y<I;y+=3){const R=y,C=y+1,L=y+2;i=Us(this,p,e,n,c,u,h,R,C,L),i&&(i.faceIndex=Math.floor(y/3),i.face.materialIndex=g.materialIndex,t.push(i))}}else{const m=Math.max(0,f.start),_=Math.min(l.count,f.start+f.count);for(let g=m,p=_;g<p;g+=3){const M=g,E=g+1,y=g+2;i=Us(this,a,e,n,c,u,h,M,E,y),i&&(i.faceIndex=Math.floor(g/3),t.push(i))}}}}function cp(r,e,t,n,i,s,a,o){let l;if(e.side===_n?l=n.intersectTriangle(a,s,i,!0,o):l=n.intersectTriangle(i,s,a,e.side===$n,o),l===null)return null;Ls.copy(o),Ls.applyMatrix4(r.matrixWorld);const c=t.ray.origin.distanceTo(Ls);return c<t.near||c>t.far?null:{distance:c,point:Ls.clone(),object:r}}function Us(r,e,t,n,i,s,a,o,l,c){r.getVertexPosition(o,Rs),r.getVertexPosition(l,Cs),r.getVertexPosition(c,Ps);const u=cp(r,e,t,n,Rs,Cs,Ps,bc);if(u){const h=new k;Un.getBarycoord(bc,Rs,Cs,Ps,h),i&&(u.uv=Un.getInterpolatedAttribute(i,o,l,c,h,new dt)),s&&(u.uv1=Un.getInterpolatedAttribute(s,o,l,c,h,new dt)),a&&(u.normal=Un.getInterpolatedAttribute(a,o,l,c,h,new k),u.normal.dot(n.direction)>0&&u.normal.multiplyScalar(-1));const d={a:o,b:l,c,normal:new k,materialIndex:0};Un.getNormal(Rs,Cs,Ps,d.normal),u.face=d,u.barycoord=h}return u}class Br extends Vt{constructor(e=1,t=1,n=1,i=1,s=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:s,depthSegments:a};const o=this;i=Math.floor(i),s=Math.floor(s),a=Math.floor(a);const l=[],c=[],u=[],h=[];let d=0,f=0;m("z","y","x",-1,-1,n,t,e,a,s,0),m("z","y","x",1,-1,n,t,-e,a,s,1),m("x","z","y",1,1,e,n,t,i,a,2),m("x","z","y",1,-1,e,n,-t,i,a,3),m("x","y","z",1,-1,e,t,n,i,s,4),m("x","y","z",-1,-1,e,t,-n,i,s,5),this.setIndex(l),this.setAttribute("position",new xt(c,3)),this.setAttribute("normal",new xt(u,3)),this.setAttribute("uv",new xt(h,2));function m(_,g,p,M,E,y,I,R,C,L,b){const x=y/C,w=I/L,B=y/2,z=I/2,X=R/2,j=C+1,O=L+1;let K=0,H=0;const ie=new k;for(let oe=0;oe<O;oe++){const $=oe*w-z;for(let xe=0;xe<j;xe++){const Ee=xe*x-B;ie[_]=Ee*M,ie[g]=$*E,ie[p]=X,c.push(ie.x,ie.y,ie.z),ie[_]=0,ie[g]=0,ie[p]=R>0?1:-1,u.push(ie.x,ie.y,ie.z),h.push(xe/C),h.push(1-oe/L),K+=1}}for(let oe=0;oe<L;oe++)for(let $=0;$<C;$++){const xe=d+$+j*oe,Ee=d+$+j*(oe+1),q=d+($+1)+j*(oe+1),te=d+($+1)+j*oe;l.push(xe,Ee,te),l.push(Ee,q,te),H+=6}o.addGroup(f,H,b),f+=H,d+=K}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Br(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function Nr(r){const e={};for(const t in r){e[t]={};for(const n in r[t]){const i=r[t][n];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)?i.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][n]=null):e[t][n]=i.clone():Array.isArray(i)?e[t][n]=i.slice():e[t][n]=i}}return e}function gn(r){const e={};for(let t=0;t<r.length;t++){const n=Nr(r[t]);for(const i in n)e[i]=n[i]}return e}function up(r){const e=[];for(let t=0;t<r.length;t++)e.push(r[t].clone());return e}function fh(r){const e=r.getRenderTarget();return e===null?r.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:vt.workingColorSpace}const Dl={clone:Nr,merge:gn};var hp=`void main() {
|
|
5
|
+
*/const xl="177",Nd={ROTATE:0,DOLLY:1,PAN:2},Fd={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},Od=0,Zl=1,Bd=2,Ku=1,$u=2,ui=3,$n=0,_n=1,hn=2,Ai=0,Ar=1,Ql=2,ec=3,tc=4,kd=5,Gi=100,zd=101,Vd=102,Hd=103,Gd=104,Wd=200,Xd=201,qd=202,jd=203,So=204,Mo=205,Yd=206,Kd=207,$d=208,Jd=209,Zd=210,Qd=211,ef=212,tf=213,nf=214,bo=0,Eo=1,To=2,Pr=3,wo=4,Ao=5,Ro=6,Co=7,xa=0,rf=1,sf=2,Ri=0,af=1,of=2,lf=3,Ju=4,cf=5,uf=6,hf=7,nc="attached",df="detached",Zu=300,Dr=301,Lr=302,Po=303,Do=304,Sa=306,jn=1e3,kn=1001,Lo=1002,Rn=1003,ff=1004,_s=1005,An=1006,Ca=1007,hi=1008,Jn=1009,Qu=1010,eh=1011,ss=1012,Sl=1013,$i=1014,Yn=1015,hs=1016,Ml=1017,bl=1018,as=1020,th=35902,nh=1021,ih=1022,In=1023,os=1026,ls=1027,rh=1028,El=1029,sh=1030,Tl=1031,wl=1033,na=33776,ia=33777,ra=33778,sa=33779,Uo=35840,Io=35841,No=35842,Fo=35843,Oo=36196,Bo=37492,ko=37496,zo=37808,Vo=37809,Ho=37810,Go=37811,Wo=37812,Xo=37813,qo=37814,jo=37815,Yo=37816,Ko=37817,$o=37818,Jo=37819,Zo=37820,Qo=37821,aa=36492,el=36494,tl=36495,ah=36283,nl=36284,il=36285,rl=36286,fa=2300,sl=2301,Pa=2302,ic=2400,rc=2401,sc=2402,pf=2500,mf=3200,gf=3201,Al=0,_f=1,wi="",At="srgb",Ur="srgb-linear",pa="linear",It="srgb",rr=7680,ac=519,vf=512,yf=513,xf=514,oh=515,Sf=516,Mf=517,bf=518,Ef=519,al=35044,oc="300 es",di=2e3,ma=2001;class Zi{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){const n=this._listeners;return n===void 0?!1:n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){const n=this._listeners;if(n===void 0)return;const i=n[e];if(i!==void 0){const s=i.indexOf(t);s!==-1&&i.splice(s,1)}}dispatchEvent(e){const t=this._listeners;if(t===void 0)return;const n=t[e.type];if(n!==void 0){e.target=this;const i=n.slice(0);for(let s=0,a=i.length;s<a;s++)i[s].call(this,e);e.target=null}}}const ln=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let lc=1234567;const ts=Math.PI/180,Ir=180/Math.PI;function zn(){const r=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(ln[r&255]+ln[r>>8&255]+ln[r>>16&255]+ln[r>>24&255]+"-"+ln[e&255]+ln[e>>8&255]+"-"+ln[e>>16&15|64]+ln[e>>24&255]+"-"+ln[t&63|128]+ln[t>>8&255]+"-"+ln[t>>16&255]+ln[t>>24&255]+ln[n&255]+ln[n>>8&255]+ln[n>>16&255]+ln[n>>24&255]).toLowerCase()}function yt(r,e,t){return Math.max(e,Math.min(t,r))}function Rl(r,e){return(r%e+e)%e}function Tf(r,e,t,n,i){return n+(r-e)*(i-n)/(t-e)}function wf(r,e,t){return r!==e?(t-r)/(e-r):0}function ns(r,e,t){return(1-t)*r+t*e}function Af(r,e,t,n){return ns(r,e,1-Math.exp(-t*n))}function Rf(r,e=1){return e-Math.abs(Rl(r,e*2)-e)}function Cf(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*(3-2*r))}function Pf(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*r*(r*(r*6-15)+10))}function Df(r,e){return r+Math.floor(Math.random()*(e-r+1))}function Lf(r,e){return r+Math.random()*(e-r)}function Uf(r){return r*(.5-Math.random())}function If(r){r!==void 0&&(lc=r);let e=lc+=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 Nf(r){return r*ts}function Ff(r){return r*Ir}function Of(r){return(r&r-1)===0&&r!==0}function Bf(r){return Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))}function kf(r){return Math.pow(2,Math.floor(Math.log(r)/Math.LN2))}function zf(r,e,t,n,i){const s=Math.cos,a=Math.sin,o=s(t/2),l=a(t/2),c=s((e+n)/2),u=a((e+n)/2),h=s((e-n)/2),d=a((e-n)/2),f=s((n-e)/2),m=a((n-e)/2);switch(i){case"XYX":r.set(o*u,l*h,l*d,o*c);break;case"YZY":r.set(l*d,o*u,l*h,o*c);break;case"ZXZ":r.set(l*h,l*d,o*u,o*c);break;case"XZX":r.set(o*u,l*m,l*f,o*c);break;case"YXY":r.set(l*f,o*u,l*m,o*c);break;case"ZYZ":r.set(l*m,l*f,o*u,o*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function Bn(r,e){switch(e.constructor){case Float32Array:return r;case Uint32Array:return r/4294967295;case Uint16Array:return r/65535;case Uint8Array:return r/255;case Int32Array:return Math.max(r/2147483647,-1);case Int16Array:return Math.max(r/32767,-1);case Int8Array:return Math.max(r/127,-1);default:throw new Error("Invalid component type.")}}function Lt(r,e){switch(e.constructor){case Float32Array:return r;case Uint32Array:return Math.round(r*4294967295);case Uint16Array:return Math.round(r*65535);case Uint8Array:return Math.round(r*255);case Int32Array:return Math.round(r*2147483647);case Int16Array:return Math.round(r*32767);case Int8Array:return Math.round(r*127);default:throw new Error("Invalid component type.")}}const Wi={DEG2RAD:ts,RAD2DEG:Ir,generateUUID:zn,clamp:yt,euclideanModulo:Rl,mapLinear:Tf,inverseLerp:wf,lerp:ns,damp:Af,pingpong:Rf,smoothstep:Cf,smootherstep:Pf,randInt:Df,randFloat:Lf,randFloatSpread:Uf,seededRandom:If,degToRad:Nf,radToDeg:Ff,isPowerOfTwo:Of,ceilPowerOfTwo:Bf,floorPowerOfTwo:kf,setQuaternionFromProperEuler:zf,normalize:Lt,denormalize:Bn};class dt{constructor(e=0,t=0){dt.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,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[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=yt(this.x,e.x,t.x),this.y=yt(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=yt(this.x,e,t),this.y=yt(this.y,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(yt(n,e,t))}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=Math.trunc(this.x),this.y=Math.trunc(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}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(yt(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}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,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,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 n=Math.cos(t),i=Math.sin(t),s=this.x-e.x,a=this.y-e.y;return this.x=s*n-a*i+e.x,this.y=s*i+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Cn{constructor(e=0,t=0,n=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=i}static slerpFlat(e,t,n,i,s,a,o){let l=n[i+0],c=n[i+1],u=n[i+2],h=n[i+3];const d=s[a+0],f=s[a+1],m=s[a+2],_=s[a+3];if(o===0){e[t+0]=l,e[t+1]=c,e[t+2]=u,e[t+3]=h;return}if(o===1){e[t+0]=d,e[t+1]=f,e[t+2]=m,e[t+3]=_;return}if(h!==_||l!==d||c!==f||u!==m){let g=1-o;const p=l*d+c*f+u*m+h*_,M=p>=0?1:-1,E=1-p*p;if(E>Number.EPSILON){const I=Math.sqrt(E),R=Math.atan2(I,p*M);g=Math.sin(g*R)/I,o=Math.sin(o*R)/I}const y=o*M;if(l=l*g+d*y,c=c*g+f*y,u=u*g+m*y,h=h*g+_*y,g===1-o){const I=1/Math.sqrt(l*l+c*c+u*u+h*h);l*=I,c*=I,u*=I,h*=I}}e[t]=l,e[t+1]=c,e[t+2]=u,e[t+3]=h}static multiplyQuaternionsFlat(e,t,n,i,s,a){const o=n[i],l=n[i+1],c=n[i+2],u=n[i+3],h=s[a],d=s[a+1],f=s[a+2],m=s[a+3];return e[t]=o*m+u*h+l*f-c*d,e[t+1]=l*m+u*d+c*h-o*f,e[t+2]=c*m+u*f+o*d-l*h,e[t+3]=u*m-o*h-l*d-c*f,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,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,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=!0){const n=e._x,i=e._y,s=e._z,a=e._order,o=Math.cos,l=Math.sin,c=o(n/2),u=o(i/2),h=o(s/2),d=l(n/2),f=l(i/2),m=l(s/2);switch(a){case"XYZ":this._x=d*u*h+c*f*m,this._y=c*f*h-d*u*m,this._z=c*u*m+d*f*h,this._w=c*u*h-d*f*m;break;case"YXZ":this._x=d*u*h+c*f*m,this._y=c*f*h-d*u*m,this._z=c*u*m-d*f*h,this._w=c*u*h+d*f*m;break;case"ZXY":this._x=d*u*h-c*f*m,this._y=c*f*h+d*u*m,this._z=c*u*m+d*f*h,this._w=c*u*h-d*f*m;break;case"ZYX":this._x=d*u*h-c*f*m,this._y=c*f*h+d*u*m,this._z=c*u*m-d*f*h,this._w=c*u*h+d*f*m;break;case"YZX":this._x=d*u*h+c*f*m,this._y=c*f*h+d*u*m,this._z=c*u*m-d*f*h,this._w=c*u*h-d*f*m;break;case"XZY":this._x=d*u*h-c*f*m,this._y=c*f*h-d*u*m,this._z=c*u*m+d*f*h,this._w=c*u*h+d*f*m;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],i=t[4],s=t[8],a=t[1],o=t[5],l=t[9],c=t[2],u=t[6],h=t[10],d=n+o+h;if(d>0){const f=.5/Math.sqrt(d+1);this._w=.25/f,this._x=(u-l)*f,this._y=(s-c)*f,this._z=(a-i)*f}else if(n>o&&n>h){const f=2*Math.sqrt(1+n-o-h);this._w=(u-l)/f,this._x=.25*f,this._y=(i+a)/f,this._z=(s+c)/f}else if(o>h){const f=2*Math.sqrt(1+o-n-h);this._w=(s-c)/f,this._x=(i+a)/f,this._y=.25*f,this._z=(l+u)/f}else{const f=2*Math.sqrt(1+h-n-o);this._w=(a-i)/f,this._x=(s+c)/f,this._y=(l+u)/f,this._z=.25*f}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<Number.EPSILON?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(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=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(yt(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const i=Math.min(1,t/n);return this.slerp(e,i),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 n=e._x,i=e._y,s=e._z,a=e._w,o=t._x,l=t._y,c=t._z,u=t._w;return this._x=n*u+a*o+i*c-s*l,this._y=i*u+a*l+s*o-n*c,this._z=s*u+a*c+n*l-i*o,this._w=a*u-n*o-i*l-s*c,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const n=this._x,i=this._y,s=this._z,a=this._w;let o=a*e._w+n*e._x+i*e._y+s*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=n,this._y=i,this._z=s,this;const l=1-o*o;if(l<=Number.EPSILON){const f=1-t;return this._w=f*a+t*this._w,this._x=f*n+t*this._x,this._y=f*i+t*this._y,this._z=f*s+t*this._z,this.normalize(),this}const c=Math.sqrt(l),u=Math.atan2(c,o),h=Math.sin((1-t)*u)/c,d=Math.sin(t*u)/c;return this._w=a*h+this._w*d,this._x=n*h+this._x*d,this._y=i*h+this._y*d,this._z=s*h+this._z*d,this._onChangeCallback(),this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),i=Math.sqrt(1-n),s=Math.sqrt(n);return this.set(i*Math.sin(e),i*Math.cos(e),s*Math.sin(t),s*Math.cos(t))}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._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class k{constructor(e=0,t=0,n=0){k.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,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(cc.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(cc.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6]*i,this.y=s[1]*t+s[4]*n+s[7]*i,this.z=s[2]*t+s[5]*n+s[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,s=e.elements,a=1/(s[3]*t+s[7]*n+s[11]*i+s[15]);return this.x=(s[0]*t+s[4]*n+s[8]*i+s[12])*a,this.y=(s[1]*t+s[5]*n+s[9]*i+s[13])*a,this.z=(s[2]*t+s[6]*n+s[10]*i+s[14])*a,this}applyQuaternion(e){const t=this.x,n=this.y,i=this.z,s=e.x,a=e.y,o=e.z,l=e.w,c=2*(a*i-o*n),u=2*(o*t-s*i),h=2*(s*n-a*t);return this.x=t+l*c+a*h-o*u,this.y=n+l*u+o*c-s*h,this.z=i+l*h+s*u-a*c,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,n=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*i,this.y=s[1]*t+s[5]*n+s[9]*i,this.z=s[2]*t+s[6]*n+s[10]*i,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=yt(this.x,e.x,t.x),this.y=yt(this.y,e.y,t.y),this.z=yt(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=yt(this.x,e,t),this.y=yt(this.y,e,t),this.z=yt(this.z,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(yt(n,e,t))}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=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(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,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,i=e.y,s=e.z,a=t.x,o=t.y,l=t.z;return this.x=i*l-s*o,this.y=s*a-n*l,this.z=n*o-i*a,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return Da.copy(this).projectOnVector(e),this.sub(Da)}reflect(e){return this.sub(Da.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 n=this.dot(e)/t;return Math.acos(yt(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}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,n){const i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,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(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,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}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,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()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const Da=new k,cc=new Cn;class gt{constructor(e,t,n,i,s,a,o,l,c){gt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,i,s,a,o,l,c)}set(e,t,n,i,s,a,o,l,c){const u=this.elements;return u[0]=e,u[1]=i,u[2]=o,u[3]=t,u[4]=s,u[5]=l,u[6]=n,u[7]=a,u[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.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 n=e.elements,i=t.elements,s=this.elements,a=n[0],o=n[3],l=n[6],c=n[1],u=n[4],h=n[7],d=n[2],f=n[5],m=n[8],_=i[0],g=i[3],p=i[6],M=i[1],E=i[4],y=i[7],I=i[2],R=i[5],C=i[8];return s[0]=a*_+o*M+l*I,s[3]=a*g+o*E+l*R,s[6]=a*p+o*y+l*C,s[1]=c*_+u*M+h*I,s[4]=c*g+u*E+h*R,s[7]=c*p+u*y+h*C,s[2]=d*_+f*M+m*I,s[5]=d*g+f*E+m*R,s[8]=d*p+f*y+m*C,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],n=e[1],i=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],u=e[8];return t*a*u-t*o*c-n*s*u+n*o*l+i*s*c-i*a*l}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],u=e[8],h=u*a-o*c,d=o*l-u*s,f=c*s-a*l,m=t*h+n*d+i*f;if(m===0)return this.set(0,0,0,0,0,0,0,0,0);const _=1/m;return e[0]=h*_,e[1]=(i*c-u*n)*_,e[2]=(o*n-i*a)*_,e[3]=d*_,e[4]=(u*t-i*l)*_,e[5]=(i*s-o*t)*_,e[6]=f*_,e[7]=(n*l-c*t)*_,e[8]=(a*t-n*s)*_,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,n,i,s,a,o){const l=Math.cos(s),c=Math.sin(s);return this.set(n*l,n*c,-n*(l*a+c*o)+a+e,-i*c,i*l,-i*(-c*a+l*o)+o+t,0,0,1),this}scale(e,t){return this.premultiply(La.makeScale(e,t)),this}rotate(e){return this.premultiply(La.makeRotation(-e)),this}translate(e,t){return this.premultiply(La.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,n=e.elements;for(let i=0;i<9;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const La=new gt;function lh(r){for(let e=r.length-1;e>=0;--e)if(r[e]>=65535)return!0;return!1}function cs(r){return document.createElementNS("http://www.w3.org/1999/xhtml",r)}function Vf(){const r=cs("canvas");return r.style.display="block",r}const uc={};function Rr(r){r in uc||(uc[r]=!0,console.warn(r))}function Hf(r,e,t){return new Promise(function(n,i){function s(){switch(r.clientWaitSync(e,r.SYNC_FLUSH_COMMANDS_BIT,0)){case r.WAIT_FAILED:i();break;case r.TIMEOUT_EXPIRED:setTimeout(s,t);break;default:n()}}setTimeout(s,t)})}function Gf(r){const e=r.elements;e[2]=.5*e[2]+.5*e[3],e[6]=.5*e[6]+.5*e[7],e[10]=.5*e[10]+.5*e[11],e[14]=.5*e[14]+.5*e[15]}function Wf(r){const e=r.elements;e[11]===-1?(e[10]=-e[10]-1,e[14]=-e[14]):(e[10]=-e[10],e[14]=-e[14]+1)}const hc=new gt().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),dc=new gt().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function Xf(){const r={enabled:!0,workingColorSpace:Ur,spaces:{},convert:function(i,s,a){return this.enabled===!1||s===a||!s||!a||(this.spaces[s].transfer===It&&(i.r=pi(i.r),i.g=pi(i.g),i.b=pi(i.b)),this.spaces[s].primaries!==this.spaces[a].primaries&&(i.applyMatrix3(this.spaces[s].toXYZ),i.applyMatrix3(this.spaces[a].fromXYZ)),this.spaces[a].transfer===It&&(i.r=Cr(i.r),i.g=Cr(i.g),i.b=Cr(i.b))),i},workingToColorSpace:function(i,s){return this.convert(i,this.workingColorSpace,s)},colorSpaceToWorking:function(i,s){return this.convert(i,s,this.workingColorSpace)},getPrimaries:function(i){return this.spaces[i].primaries},getTransfer:function(i){return i===wi?pa:this.spaces[i].transfer},getLuminanceCoefficients:function(i,s=this.workingColorSpace){return i.fromArray(this.spaces[s].luminanceCoefficients)},define:function(i){Object.assign(this.spaces,i)},_getMatrix:function(i,s,a){return i.copy(this.spaces[s].toXYZ).multiply(this.spaces[a].fromXYZ)},_getDrawingBufferColorSpace:function(i){return this.spaces[i].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(i=this.workingColorSpace){return this.spaces[i].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(i,s){return Rr("THREE.ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),r.workingToColorSpace(i,s)},toWorkingColorSpace:function(i,s){return Rr("THREE.ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),r.colorSpaceToWorking(i,s)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],n=[.3127,.329];return r.define({[Ur]:{primaries:e,whitePoint:n,transfer:pa,toXYZ:hc,fromXYZ:dc,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:At},outputColorSpaceConfig:{drawingBufferColorSpace:At}},[At]:{primaries:e,whitePoint:n,transfer:It,toXYZ:hc,fromXYZ:dc,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:At}}}),r}const vt=Xf();function pi(r){return r<.04045?r*.0773993808:Math.pow(r*.9478672986+.0521327014,2.4)}function Cr(r){return r<.0031308?r*12.92:1.055*Math.pow(r,.41666)-.055}let sr;class qf{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{sr===void 0&&(sr=cs("canvas")),sr.width=e.width,sr.height=e.height;const i=sr.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),n=sr}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=cs("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const i=n.getImageData(0,0,e.width,e.height),s=i.data;for(let a=0;a<s.length;a++)s[a]=pi(s[a]/255)*255;return n.putImageData(i,0,0),t}else if(e.data){const t=e.data.slice(0);for(let n=0;n<t.length;n++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[n]=Math.floor(pi(t[n]/255)*255):t[n]=pi(t[n]);return{data:t,width:e.width,height:e.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let jf=0;class Cl{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:jf++}),this.uuid=zn(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){const t=this.data;return t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight):t!==null?e.set(t.width,t.height,t.depth||0):e.set(0,0,0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const n={uuid:this.uuid,url:""},i=this.data;if(i!==null){let s;if(Array.isArray(i)){s=[];for(let a=0,o=i.length;a<o;a++)i[a].isDataTexture?s.push(Ua(i[a].image)):s.push(Ua(i[a]))}else s=Ua(i);n.url=s}return t||(e.images[this.uuid]=n),n}}function Ua(r){return typeof HTMLImageElement<"u"&&r instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&r instanceof ImageBitmap?qf.getDataURL(r):r.data?{data:Array.from(r.data),width:r.width,height:r.height,type:r.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let Yf=0;const Ia=new k;class an extends Zi{constructor(e=an.DEFAULT_IMAGE,t=an.DEFAULT_MAPPING,n=kn,i=kn,s=An,a=hi,o=In,l=Jn,c=an.DEFAULT_ANISOTROPY,u=wi){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Yf++}),this.uuid=zn(),this.name="",this.source=new Cl(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=i,this.magFilter=s,this.minFilter=a,this.anisotropy=c,this.format=o,this.internalFormat=null,this.type=l,this.offset=new dt(0,0),this.repeat=new dt(1,1),this.center=new dt(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new gt,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=u,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(e&&e.depth&&e.depth>1),this.pmremVersion=0}get width(){return this.source.getSize(Ia).x}get height(){return this.source.getSize(Ia).y}get depth(){return this.source.getSize(Ia).z}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(const t in e){const n=e[t];if(n===void 0){console.warn(`THREE.Texture.setValues(): parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){console.warn(`THREE.Texture.setValues(): property '${t}' does not exist.`);continue}i&&n&&i.isVector2&&n.isVector2||i&&n&&i.isVector3&&n.isVector3||i&&n&&i.isMatrix3&&n.isMatrix3?i.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Zu)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case jn:e.x=e.x-Math.floor(e.x);break;case kn:e.x=e.x<0?0:1;break;case Lo: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 jn:e.y=e.y-Math.floor(e.y);break;case kn:e.y=e.y<0?0:1;break;case Lo: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)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}an.DEFAULT_IMAGE=null;an.DEFAULT_MAPPING=Zu;an.DEFAULT_ANISOTROPY=1;class St{constructor(e=0,t=0,n=0,i=1){St.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=i}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,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,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,n=this.y,i=this.z,s=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*i+a[12]*s,this.y=a[1]*t+a[5]*n+a[9]*i+a[13]*s,this.z=a[2]*t+a[6]*n+a[10]*i+a[14]*s,this.w=a[3]*t+a[7]*n+a[11]*i+a[15]*s,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,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,n,i,s;const l=e.elements,c=l[0],u=l[4],h=l[8],d=l[1],f=l[5],m=l[9],_=l[2],g=l[6],p=l[10];if(Math.abs(u-d)<.01&&Math.abs(h-_)<.01&&Math.abs(m-g)<.01){if(Math.abs(u+d)<.1&&Math.abs(h+_)<.1&&Math.abs(m+g)<.1&&Math.abs(c+f+p-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const E=(c+1)/2,y=(f+1)/2,I=(p+1)/2,R=(u+d)/4,C=(h+_)/4,L=(m+g)/4;return E>y&&E>I?E<.01?(n=0,i=.707106781,s=.707106781):(n=Math.sqrt(E),i=R/n,s=C/n):y>I?y<.01?(n=.707106781,i=0,s=.707106781):(i=Math.sqrt(y),n=R/i,s=L/i):I<.01?(n=.707106781,i=.707106781,s=0):(s=Math.sqrt(I),n=C/s,i=L/s),this.set(n,i,s,t),this}let M=Math.sqrt((g-m)*(g-m)+(h-_)*(h-_)+(d-u)*(d-u));return Math.abs(M)<.001&&(M=1),this.x=(g-m)/M,this.y=(h-_)/M,this.z=(d-u)/M,this.w=Math.acos((c+f+p-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}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.w=Math.min(this.w,e.w),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.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=yt(this.x,e.x,t.x),this.y=yt(this.y,e.y,t.y),this.z=yt(this.z,e.z,t.z),this.w=yt(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=yt(this.x,e,t),this.y=yt(this.y,e,t),this.z=yt(this.z,e,t),this.w=yt(this.w,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(yt(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,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)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}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.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}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}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}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class Kf extends Zi{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:An,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new St(0,0,e,t),this.scissorTest=!1,this.viewport=new St(0,0,e,t);const i={width:e,height:t,depth:n.depth},s=new an(i);this.textures=[];const a=n.count;for(let o=0;o<a;o++)this.textures[o]=s.clone(),this.textures[o].isRenderTargetTexture=!0,this.textures[o].renderTarget=this;this._setTextureOptions(n),this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=n.depthTexture,this.samples=n.samples,this.multiview=n.multiview}_setTextureOptions(e={}){const t={minFilter:An,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(t.mapping=e.mapping),e.wrapS!==void 0&&(t.wrapS=e.wrapS),e.wrapT!==void 0&&(t.wrapT=e.wrapT),e.wrapR!==void 0&&(t.wrapR=e.wrapR),e.magFilter!==void 0&&(t.magFilter=e.magFilter),e.minFilter!==void 0&&(t.minFilter=e.minFilter),e.format!==void 0&&(t.format=e.format),e.type!==void 0&&(t.type=e.type),e.anisotropy!==void 0&&(t.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(t.colorSpace=e.colorSpace),e.flipY!==void 0&&(t.flipY=e.flipY),e.generateMipmaps!==void 0&&(t.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(t.internalFormat=e.internalFormat);for(let n=0;n<this.textures.length;n++)this.textures[n].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let i=0,s=this.textures.length;i<s;i++)this.textures[i].image.width=e,this.textures[i].image.height=t,this.textures[i].image.depth=n,this.textures[i].isArrayTexture=this.textures[i].image.depth>1;this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t<n;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;const i=Object.assign({},e.textures[t].image);this.textures[t].source=new Cl(i)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class Ji extends Kf{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}}class ch extends an{constructor(e=null,t=1,n=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=Rn,this.minFilter=Rn,this.wrapR=kn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class $f extends an{constructor(e=null,t=1,n=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=Rn,this.minFilter=Rn,this.wrapR=kn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Zn{constructor(e=new k(1/0,1/0,1/0),t=new k(-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){this.makeEmpty();for(let t=0,n=e.length;t<n;t+=3)this.expandByPoint(Nn.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(Nn.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=Nn.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);const n=e.geometry;if(n!==void 0){const s=n.getAttribute("position");if(t===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let a=0,o=s.count;a<o;a++)e.isMesh===!0?e.getVertexPosition(a,Nn):Nn.fromBufferAttribute(s,a),Nn.applyMatrix4(e.matrixWorld),this.expandByPoint(Nn);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),vs.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),vs.copy(n.boundingBox)),vs.applyMatrix4(e.matrixWorld),this.union(vs)}const i=e.children;for(let s=0,a=i.length;s<a;s++)this.expandByObject(i[s],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.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.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,Nn),Nn.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Gr),ys.subVectors(this.max,Gr),ar.subVectors(e.a,Gr),or.subVectors(e.b,Gr),lr.subVectors(e.c,Gr),vi.subVectors(or,ar),yi.subVectors(lr,or),Ii.subVectors(ar,lr);let t=[0,-vi.z,vi.y,0,-yi.z,yi.y,0,-Ii.z,Ii.y,vi.z,0,-vi.x,yi.z,0,-yi.x,Ii.z,0,-Ii.x,-vi.y,vi.x,0,-yi.y,yi.x,0,-Ii.y,Ii.x,0];return!Na(t,ar,or,lr,ys)||(t=[1,0,0,0,1,0,0,0,1],!Na(t,ar,or,lr,ys))?!1:(xs.crossVectors(vi,yi),t=[xs.x,xs.y,xs.z],Na(t,ar,or,lr,ys))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Nn).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Nn).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:(ri[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),ri[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),ri[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),ri[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),ri[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),ri[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),ri[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),ri[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(ri),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)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}}const ri=[new k,new k,new k,new k,new k,new k,new k,new k],Nn=new k,vs=new Zn,ar=new k,or=new k,lr=new k,vi=new k,yi=new k,Ii=new k,Gr=new k,ys=new k,xs=new k,Ni=new k;function Na(r,e,t,n,i){for(let s=0,a=r.length-3;s<=a;s+=3){Ni.fromArray(r,s);const o=i.x*Math.abs(Ni.x)+i.y*Math.abs(Ni.y)+i.z*Math.abs(Ni.z),l=e.dot(Ni),c=t.dot(Ni),u=n.dot(Ni);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>o)return!1}return!0}const Jf=new Zn,Wr=new k,Fa=new k;class _i{constructor(e=new k,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const n=this.center;t!==void 0?n.copy(t):Jf.setFromPoints(e).getCenter(n);let i=0;for(let s=0,a=e.length;s<a;s++)i=Math.max(i,n.distanceToSquared(e[s]));return this.radius=Math.sqrt(i),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const n=this.center.distanceToSquared(e);return t.copy(e),n>this.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){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;Wr.subVectors(e,this.center);const t=Wr.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),i=(n-this.radius)*.5;this.center.addScaledVector(Wr,i/n),this.radius+=i}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(Fa.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Wr.copy(e.center).add(Fa)),this.expandByPoint(Wr.copy(e.center).sub(Fa))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}}const si=new k,Oa=new k,Ss=new k,xi=new k,Ba=new k,Ms=new k,ka=new k;class Or{constructor(e=new k,t=new k(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.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,si)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=si.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(si.copy(this.origin).addScaledVector(this.direction,t),si.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){Oa.copy(e).add(t).multiplyScalar(.5),Ss.copy(t).sub(e).normalize(),xi.copy(this.origin).sub(Oa);const s=e.distanceTo(t)*.5,a=-this.direction.dot(Ss),o=xi.dot(this.direction),l=-xi.dot(Ss),c=xi.lengthSq(),u=Math.abs(1-a*a);let h,d,f,m;if(u>0)if(h=a*l-o,d=a*o-l,m=s*u,h>=0)if(d>=-m)if(d<=m){const _=1/u;h*=_,d*=_,f=h*(h+a*d+2*o)+d*(a*h+d+2*l)+c}else d=s,h=Math.max(0,-(a*d+o)),f=-h*h+d*(d+2*l)+c;else d=-s,h=Math.max(0,-(a*d+o)),f=-h*h+d*(d+2*l)+c;else d<=-m?(h=Math.max(0,-(-a*s+o)),d=h>0?-s:Math.min(Math.max(-s,-l),s),f=-h*h+d*(d+2*l)+c):d<=m?(h=0,d=Math.min(Math.max(-s,-l),s),f=d*(d+2*l)+c):(h=Math.max(0,-(a*s+o)),d=h>0?s:Math.min(Math.max(-s,-l),s),f=-h*h+d*(d+2*l)+c);else d=a>0?-s:s,h=Math.max(0,-(a*d+o)),f=-h*h+d*(d+2*l)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,h),i&&i.copy(Oa).addScaledVector(Ss,d),f}intersectSphere(e,t){si.subVectors(e.center,this.origin);const n=si.dot(this.direction),i=si.dot(si)-n*n,s=e.radius*e.radius;if(i>s)return null;const a=Math.sqrt(s-i),o=n-a,l=n+a;return l<0?null:o<0?this.at(l,t):this.at(o,t)}intersectsSphere(e){return e.radius<0?!1: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 n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,i,s,a,o,l;const c=1/this.direction.x,u=1/this.direction.y,h=1/this.direction.z,d=this.origin;return c>=0?(n=(e.min.x-d.x)*c,i=(e.max.x-d.x)*c):(n=(e.max.x-d.x)*c,i=(e.min.x-d.x)*c),u>=0?(s=(e.min.y-d.y)*u,a=(e.max.y-d.y)*u):(s=(e.max.y-d.y)*u,a=(e.min.y-d.y)*u),n>a||s>i||((s>n||isNaN(n))&&(n=s),(a<i||isNaN(i))&&(i=a),h>=0?(o=(e.min.z-d.z)*h,l=(e.max.z-d.z)*h):(o=(e.max.z-d.z)*h,l=(e.min.z-d.z)*h),n>l||o>i)||((o>n||n!==n)&&(n=o),(l<i||i!==i)&&(i=l),i<0)?null:this.at(n>=0?n:i,t)}intersectsBox(e){return this.intersectBox(e,si)!==null}intersectTriangle(e,t,n,i,s){Ba.subVectors(t,e),Ms.subVectors(n,e),ka.crossVectors(Ba,Ms);let a=this.direction.dot(ka),o;if(a>0){if(i)return null;o=1}else if(a<0)o=-1,a=-a;else return null;xi.subVectors(this.origin,e);const l=o*this.direction.dot(Ms.crossVectors(xi,Ms));if(l<0)return null;const c=o*this.direction.dot(Ba.cross(xi));if(c<0||l+c>a)return null;const u=-o*xi.dot(ka);return u<0?null:this.at(u/a,s)}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 ut{constructor(e,t,n,i,s,a,o,l,c,u,h,d,f,m,_,g){ut.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,n,i,s,a,o,l,c,u,h,d,f,m,_,g)}set(e,t,n,i,s,a,o,l,c,u,h,d,f,m,_,g){const p=this.elements;return p[0]=e,p[4]=t,p[8]=n,p[12]=i,p[1]=s,p[5]=a,p[9]=o,p[13]=l,p[2]=c,p[6]=u,p[10]=h,p[14]=d,p[3]=f,p[7]=m,p[11]=_,p[15]=g,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 ut().fromArray(this.elements)}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){const t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[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,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,n=e.elements,i=1/cr.setFromMatrixColumn(e,0).length(),s=1/cr.setFromMatrixColumn(e,1).length(),a=1/cr.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*s,t[5]=n[5]*s,t[6]=n[6]*s,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,n=e.x,i=e.y,s=e.z,a=Math.cos(n),o=Math.sin(n),l=Math.cos(i),c=Math.sin(i),u=Math.cos(s),h=Math.sin(s);if(e.order==="XYZ"){const d=a*u,f=a*h,m=o*u,_=o*h;t[0]=l*u,t[4]=-l*h,t[8]=c,t[1]=f+m*c,t[5]=d-_*c,t[9]=-o*l,t[2]=_-d*c,t[6]=m+f*c,t[10]=a*l}else if(e.order==="YXZ"){const d=l*u,f=l*h,m=c*u,_=c*h;t[0]=d+_*o,t[4]=m*o-f,t[8]=a*c,t[1]=a*h,t[5]=a*u,t[9]=-o,t[2]=f*o-m,t[6]=_+d*o,t[10]=a*l}else if(e.order==="ZXY"){const d=l*u,f=l*h,m=c*u,_=c*h;t[0]=d-_*o,t[4]=-a*h,t[8]=m+f*o,t[1]=f+m*o,t[5]=a*u,t[9]=_-d*o,t[2]=-a*c,t[6]=o,t[10]=a*l}else if(e.order==="ZYX"){const d=a*u,f=a*h,m=o*u,_=o*h;t[0]=l*u,t[4]=m*c-f,t[8]=d*c+_,t[1]=l*h,t[5]=_*c+d,t[9]=f*c-m,t[2]=-c,t[6]=o*l,t[10]=a*l}else if(e.order==="YZX"){const d=a*l,f=a*c,m=o*l,_=o*c;t[0]=l*u,t[4]=_-d*h,t[8]=m*h+f,t[1]=h,t[5]=a*u,t[9]=-o*u,t[2]=-c*u,t[6]=f*h+m,t[10]=d-_*h}else if(e.order==="XZY"){const d=a*l,f=a*c,m=o*l,_=o*c;t[0]=l*u,t[4]=-h,t[8]=c*u,t[1]=d*h+_,t[5]=a*u,t[9]=f*h-m,t[2]=m*h-f,t[6]=o*u,t[10]=_*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(Zf,e,Qf)}lookAt(e,t,n){const i=this.elements;return Tn.subVectors(e,t),Tn.lengthSq()===0&&(Tn.z=1),Tn.normalize(),Si.crossVectors(n,Tn),Si.lengthSq()===0&&(Math.abs(n.z)===1?Tn.x+=1e-4:Tn.z+=1e-4,Tn.normalize(),Si.crossVectors(n,Tn)),Si.normalize(),bs.crossVectors(Tn,Si),i[0]=Si.x,i[4]=bs.x,i[8]=Tn.x,i[1]=Si.y,i[5]=bs.y,i[9]=Tn.y,i[2]=Si.z,i[6]=bs.z,i[10]=Tn.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,s=this.elements,a=n[0],o=n[4],l=n[8],c=n[12],u=n[1],h=n[5],d=n[9],f=n[13],m=n[2],_=n[6],g=n[10],p=n[14],M=n[3],E=n[7],y=n[11],I=n[15],R=i[0],C=i[4],L=i[8],b=i[12],x=i[1],w=i[5],B=i[9],z=i[13],X=i[2],j=i[6],O=i[10],K=i[14],H=i[3],re=i[7],oe=i[11],$=i[15];return s[0]=a*R+o*x+l*X+c*H,s[4]=a*C+o*w+l*j+c*re,s[8]=a*L+o*B+l*O+c*oe,s[12]=a*b+o*z+l*K+c*$,s[1]=u*R+h*x+d*X+f*H,s[5]=u*C+h*w+d*j+f*re,s[9]=u*L+h*B+d*O+f*oe,s[13]=u*b+h*z+d*K+f*$,s[2]=m*R+_*x+g*X+p*H,s[6]=m*C+_*w+g*j+p*re,s[10]=m*L+_*B+g*O+p*oe,s[14]=m*b+_*z+g*K+p*$,s[3]=M*R+E*x+y*X+I*H,s[7]=M*C+E*w+y*j+I*re,s[11]=M*L+E*B+y*O+I*oe,s[15]=M*b+E*z+y*K+I*$,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],n=e[4],i=e[8],s=e[12],a=e[1],o=e[5],l=e[9],c=e[13],u=e[2],h=e[6],d=e[10],f=e[14],m=e[3],_=e[7],g=e[11],p=e[15];return m*(+s*l*h-i*c*h-s*o*d+n*c*d+i*o*f-n*l*f)+_*(+t*l*f-t*c*d+s*a*d-i*a*f+i*c*u-s*l*u)+g*(+t*c*h-t*o*f-s*a*h+n*a*f+s*o*u-n*c*u)+p*(-i*o*u-t*l*h+t*o*d+i*a*h-n*a*d+n*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,n){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],u=e[8],h=e[9],d=e[10],f=e[11],m=e[12],_=e[13],g=e[14],p=e[15],M=h*g*c-_*d*c+_*l*f-o*g*f-h*l*p+o*d*p,E=m*d*c-u*g*c-m*l*f+a*g*f+u*l*p-a*d*p,y=u*_*c-m*h*c+m*o*f-a*_*f-u*o*p+a*h*p,I=m*h*l-u*_*l-m*o*d+a*_*d+u*o*g-a*h*g,R=t*M+n*E+i*y+s*I;if(R===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const C=1/R;return e[0]=M*C,e[1]=(_*d*s-h*g*s-_*i*f+n*g*f+h*i*p-n*d*p)*C,e[2]=(o*g*s-_*l*s+_*i*c-n*g*c-o*i*p+n*l*p)*C,e[3]=(h*l*s-o*d*s-h*i*c+n*d*c+o*i*f-n*l*f)*C,e[4]=E*C,e[5]=(u*g*s-m*d*s+m*i*f-t*g*f-u*i*p+t*d*p)*C,e[6]=(m*l*s-a*g*s-m*i*c+t*g*c+a*i*p-t*l*p)*C,e[7]=(a*d*s-u*l*s+u*i*c-t*d*c-a*i*f+t*l*f)*C,e[8]=y*C,e[9]=(m*h*s-u*_*s-m*n*f+t*_*f+u*n*p-t*h*p)*C,e[10]=(a*_*s-m*o*s+m*n*c-t*_*c-a*n*p+t*o*p)*C,e[11]=(u*o*s-a*h*s-u*n*c+t*h*c+a*n*f-t*o*f)*C,e[12]=I*C,e[13]=(u*_*i-m*h*i+m*n*d-t*_*d-u*n*g+t*h*g)*C,e[14]=(m*o*i-a*_*i-m*n*l+t*_*l+a*n*g-t*o*g)*C,e[15]=(a*h*i-u*o*i+u*n*l-t*h*l-a*n*d+t*o*d)*C,this}scale(e){const t=this.elements,n=e.x,i=e.y,s=e.z;return t[0]*=n,t[4]*=i,t[8]*=s,t[1]*=n,t[5]*=i,t[9]*=s,t[2]*=n,t[6]*=i,t[10]*=s,t[3]*=n,t[7]*=i,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),i=Math.sin(t),s=1-n,a=e.x,o=e.y,l=e.z,c=s*a,u=s*o;return this.set(c*a+n,c*o-i*l,c*l+i*o,0,c*o+i*l,u*o+n,u*l-i*a,0,c*l-i*o,u*l+i*a,s*l*l+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,i,s,a){return this.set(1,n,s,0,e,1,a,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){const i=this.elements,s=t._x,a=t._y,o=t._z,l=t._w,c=s+s,u=a+a,h=o+o,d=s*c,f=s*u,m=s*h,_=a*u,g=a*h,p=o*h,M=l*c,E=l*u,y=l*h,I=n.x,R=n.y,C=n.z;return i[0]=(1-(_+p))*I,i[1]=(f+y)*I,i[2]=(m-E)*I,i[3]=0,i[4]=(f-y)*R,i[5]=(1-(d+p))*R,i[6]=(g+M)*R,i[7]=0,i[8]=(m+E)*C,i[9]=(g-M)*C,i[10]=(1-(d+_))*C,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,n){const i=this.elements;let s=cr.set(i[0],i[1],i[2]).length();const a=cr.set(i[4],i[5],i[6]).length(),o=cr.set(i[8],i[9],i[10]).length();this.determinant()<0&&(s=-s),e.x=i[12],e.y=i[13],e.z=i[14],Fn.copy(this);const c=1/s,u=1/a,h=1/o;return Fn.elements[0]*=c,Fn.elements[1]*=c,Fn.elements[2]*=c,Fn.elements[4]*=u,Fn.elements[5]*=u,Fn.elements[6]*=u,Fn.elements[8]*=h,Fn.elements[9]*=h,Fn.elements[10]*=h,t.setFromRotationMatrix(Fn),n.x=s,n.y=a,n.z=o,this}makePerspective(e,t,n,i,s,a,o=di){const l=this.elements,c=2*s/(t-e),u=2*s/(n-i),h=(t+e)/(t-e),d=(n+i)/(n-i);let f,m;if(o===di)f=-(a+s)/(a-s),m=-2*a*s/(a-s);else if(o===ma)f=-a/(a-s),m=-a*s/(a-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return l[0]=c,l[4]=0,l[8]=h,l[12]=0,l[1]=0,l[5]=u,l[9]=d,l[13]=0,l[2]=0,l[6]=0,l[10]=f,l[14]=m,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,n,i,s,a,o=di){const l=this.elements,c=1/(t-e),u=1/(n-i),h=1/(a-s),d=(t+e)*c,f=(n+i)*u;let m,_;if(o===di)m=(a+s)*h,_=-2*h;else if(o===ma)m=s*h,_=-1*h;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return l[0]=2*c,l[4]=0,l[8]=0,l[12]=-d,l[1]=0,l[5]=2*u,l[9]=0,l[13]=-f,l[2]=0,l[6]=0,l[10]=_,l[14]=-m,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let i=0;i<16;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}const cr=new k,Fn=new ut,Zf=new k(0,0,0),Qf=new k(1,1,1),Si=new k,bs=new k,Tn=new k,fc=new ut,pc=new Cn;class bn{constructor(e=0,t=0,n=0,i=bn.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=i}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,n,i=this._order){return this._x=e,this._y=t,this._z=n,this._order=i,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,n=!0){const i=e.elements,s=i[0],a=i[4],o=i[8],l=i[1],c=i[5],u=i[9],h=i[2],d=i[6],f=i[10];switch(t){case"XYZ":this._y=Math.asin(yt(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-u,f),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(d,c),this._z=0);break;case"YXZ":this._x=Math.asin(-yt(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(o,f),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-h,s),this._z=0);break;case"ZXY":this._x=Math.asin(yt(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-h,f),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-yt(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(d,f),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin(yt(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-h,s)):(this._x=0,this._y=Math.atan2(o,f));break;case"XZY":this._z=Math.asin(-yt(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(d,c),this._y=Math.atan2(o,s)):(this._x=Math.atan2(-u,f),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return fc.makeRotationFromQuaternion(e),this.setFromRotationMatrix(fc,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return pc.setFromEuler(this),this.setFromQuaternion(pc,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}}bn.DEFAULT_ORDER="XYZ";class Pl{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}let ep=0;const mc=new k,ur=new Cn,ai=new ut,Es=new k,Xr=new k,tp=new k,np=new Cn,gc=new k(1,0,0),_c=new k(0,1,0),vc=new k(0,0,1),yc={type:"added"},ip={type:"removed"},hr={type:"childadded",child:null},za={type:"childremoved",child:null};class Ft extends Zi{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:ep++}),this.uuid=zn(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Ft.DEFAULT_UP.clone();const e=new k,t=new bn,n=new Cn,i=new k(1,1,1);function s(){n.setFromEuler(t,!1)}function a(){t.setFromQuaternion(n,void 0,!1)}t._onChange(s),n._onChange(a),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new ut},normalMatrix:{value:new gt}}),this.matrix=new ut,this.matrixWorld=new ut,this.matrixAutoUpdate=Ft.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=Ft.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Pl,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return ur.setFromAxisAngle(e,t),this.quaternion.multiply(ur),this}rotateOnWorldAxis(e,t){return ur.setFromAxisAngle(e,t),this.quaternion.premultiply(ur),this}rotateX(e){return this.rotateOnAxis(gc,e)}rotateY(e){return this.rotateOnAxis(_c,e)}rotateZ(e){return this.rotateOnAxis(vc,e)}translateOnAxis(e,t){return mc.copy(e).applyQuaternion(this.quaternion),this.position.add(mc.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(gc,e)}translateY(e){return this.translateOnAxis(_c,e)}translateZ(e){return this.translateOnAxis(vc,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(ai.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?Es.copy(e):Es.set(e,t,n);const i=this.parent;this.updateWorldMatrix(!0,!1),Xr.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?ai.lookAt(Xr,Es,this.up):ai.lookAt(Es,Xr,this.up),this.quaternion.setFromRotationMatrix(ai),i&&(ai.extractRotation(i.matrixWorld),ur.setFromRotationMatrix(ai),this.quaternion.premultiply(ur.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(yc),hr.child=e,this.dispatchEvent(hr),hr.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(ip),za.child=e,this.dispatchEvent(za),za.child=null),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),ai.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),ai.multiply(e.parent.matrixWorld)),e.applyMatrix4(ai),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(yc),hr.child=e,this.dispatchEvent(hr),hr.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,i=this.children.length;n<i;n++){const a=this.children[n].getObjectByProperty(e,t);if(a!==void 0)return a}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);const i=this.children;for(let s=0,a=i.length;s<a;s++)i[s].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Xr,e,tp),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Xr,np,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverseVisible(e)}traverseAncestors(e){const t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t){const n=this.parent;if(e===!0&&n!==null&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),t===!0){const i=this.children;for(let s=0,a=i.length;s<a;s++)i[s].updateWorldMatrix(!1,!0)}}toJSON(e){const t=e===void 0||typeof e=="string",n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});const i={};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.castShadow===!0&&(i.castShadow=!0),this.receiveShadow===!0&&(i.receiveShadow=!0),this.visible===!1&&(i.visible=!1),this.frustumCulled===!1&&(i.frustumCulled=!1),this.renderOrder!==0&&(i.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.geometryInfo=this._geometryInfo.map(o=>({...o,boundingBox:o.boundingBox?o.boundingBox.toJSON():void 0,boundingSphere:o.boundingSphere?o.boundingSphere.toJSON():void 0})),i.instanceInfo=this._instanceInfo.map(o=>({...o})),i.availableInstanceIds=this._availableInstanceIds.slice(),i.availableGeometryIds=this._availableGeometryIds.slice(),i.nextIndexStart=this._nextIndexStart,i.nextVertexStart=this._nextVertexStart,i.geometryCount=this._geometryCount,i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.matricesTexture=this._matricesTexture.toJSON(e),i.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(i.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(i.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(i.boundingBox=this.boundingBox.toJSON()));function s(o,l){return o[l.uuid]===void 0&&(o[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=s(e.geometries,this.geometry);const o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){const l=o.shapes;if(Array.isArray(l))for(let c=0,u=l.length;c<u;c++){const h=l[c];s(e.shapes,h)}else s(e.shapes,l)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const o=[];for(let l=0,c=this.material.length;l<c;l++)o.push(s(e.materials,this.material[l]));i.material=o}else i.material=s(e.materials,this.material);if(this.children.length>0){i.children=[];for(let o=0;o<this.children.length;o++)i.children.push(this.children[o].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let o=0;o<this.animations.length;o++){const l=this.animations[o];i.animations.push(s(e.animations,l))}}if(t){const o=a(e.geometries),l=a(e.materials),c=a(e.textures),u=a(e.images),h=a(e.shapes),d=a(e.skeletons),f=a(e.animations),m=a(e.nodes);o.length>0&&(n.geometries=o),l.length>0&&(n.materials=l),c.length>0&&(n.textures=c),u.length>0&&(n.images=u),h.length>0&&(n.shapes=h),d.length>0&&(n.skeletons=d),f.length>0&&(n.animations=f),m.length>0&&(n.nodes=m)}return n.object=i,n;function a(o){const l=[];for(const c in o){const u=o[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.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,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.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n<e.children.length;n++){const i=e.children[n];this.add(i.clone())}return this}}Ft.DEFAULT_UP=new k(0,1,0);Ft.DEFAULT_MATRIX_AUTO_UPDATE=!0;Ft.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const On=new k,oi=new k,Va=new k,li=new k,dr=new k,fr=new k,xc=new k,Ha=new k,Ga=new k,Wa=new k,Xa=new St,qa=new St,ja=new St;class Un{constructor(e=new k,t=new k,n=new k){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,i){i.subVectors(n,t),On.subVectors(e,t),i.cross(On);const s=i.lengthSq();return s>0?i.multiplyScalar(1/Math.sqrt(s)):i.set(0,0,0)}static getBarycoord(e,t,n,i,s){On.subVectors(i,t),oi.subVectors(n,t),Va.subVectors(e,t);const a=On.dot(On),o=On.dot(oi),l=On.dot(Va),c=oi.dot(oi),u=oi.dot(Va),h=a*c-o*o;if(h===0)return s.set(0,0,0),null;const d=1/h,f=(c*l-o*u)*d,m=(a*u-o*l)*d;return s.set(1-f-m,m,f)}static containsPoint(e,t,n,i){return this.getBarycoord(e,t,n,i,li)===null?!1:li.x>=0&&li.y>=0&&li.x+li.y<=1}static getInterpolation(e,t,n,i,s,a,o,l){return this.getBarycoord(e,t,n,i,li)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(s,li.x),l.addScaledVector(a,li.y),l.addScaledVector(o,li.z),l)}static getInterpolatedAttribute(e,t,n,i,s,a){return Xa.setScalar(0),qa.setScalar(0),ja.setScalar(0),Xa.fromBufferAttribute(e,t),qa.fromBufferAttribute(e,n),ja.fromBufferAttribute(e,i),a.setScalar(0),a.addScaledVector(Xa,s.x),a.addScaledVector(qa,s.y),a.addScaledVector(ja,s.z),a}static isFrontFacing(e,t,n,i){return On.subVectors(n,t),oi.subVectors(e,t),On.cross(oi).dot(i)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,i),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 On.subVectors(this.c,this.b),oi.subVectors(this.a,this.b),On.cross(oi).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Un.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Un.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,i,s){return Un.getInterpolation(e,this.a,this.b,this.c,t,n,i,s)}containsPoint(e){return Un.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Un.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,i=this.b,s=this.c;let a,o;dr.subVectors(i,n),fr.subVectors(s,n),Ha.subVectors(e,n);const l=dr.dot(Ha),c=fr.dot(Ha);if(l<=0&&c<=0)return t.copy(n);Ga.subVectors(e,i);const u=dr.dot(Ga),h=fr.dot(Ga);if(u>=0&&h<=u)return t.copy(i);const d=l*h-u*c;if(d<=0&&l>=0&&u<=0)return a=l/(l-u),t.copy(n).addScaledVector(dr,a);Wa.subVectors(e,s);const f=dr.dot(Wa),m=fr.dot(Wa);if(m>=0&&f<=m)return t.copy(s);const _=f*c-l*m;if(_<=0&&c>=0&&m<=0)return o=c/(c-m),t.copy(n).addScaledVector(fr,o);const g=u*m-f*h;if(g<=0&&h-u>=0&&f-m>=0)return xc.subVectors(s,i),o=(h-u)/(h-u+(f-m)),t.copy(i).addScaledVector(xc,o);const p=1/(g+_+d);return a=_*p,o=d*p,t.copy(n).addScaledVector(dr,a).addScaledVector(fr,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const uh={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},Mi={h:0,s:0,l:0},Ts={h:0,s:0,l:0};function Ya(r,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?r+(e-r)*6*t:t<1/2?e:t<2/3?r+(e-r)*6*(2/3-t):r}class ht{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){const i=e;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=At){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,vt.colorSpaceToWorking(this,t),this}setRGB(e,t,n,i=vt.workingColorSpace){return this.r=e,this.g=t,this.b=n,vt.colorSpaceToWorking(this,i),this}setHSL(e,t,n,i=vt.workingColorSpace){if(e=Rl(e,1),t=yt(t,0,1),n=yt(n,0,1),t===0)this.r=this.g=this.b=n;else{const s=n<=.5?n*(1+t):n+t-n*t,a=2*n-s;this.r=Ya(a,s,e+1/3),this.g=Ya(a,s,e),this.b=Ya(a,s,e-1/3)}return vt.colorSpaceToWorking(this,i),this}setStyle(e,t=At){function n(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const a=i[1],o=i[2];switch(a){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=i[1],a=s.length;if(a===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(a===6)return this.setHex(parseInt(s,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=At){const n=uh[e.toLowerCase()];return n!==void 0?this.setHex(n,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=pi(e.r),this.g=pi(e.g),this.b=pi(e.b),this}copyLinearToSRGB(e){return this.r=Cr(e.r),this.g=Cr(e.g),this.b=Cr(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=At){return vt.workingToColorSpace(cn.copy(this),e),Math.round(yt(cn.r*255,0,255))*65536+Math.round(yt(cn.g*255,0,255))*256+Math.round(yt(cn.b*255,0,255))}getHexString(e=At){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=vt.workingColorSpace){vt.workingToColorSpace(cn.copy(this),t);const n=cn.r,i=cn.g,s=cn.b,a=Math.max(n,i,s),o=Math.min(n,i,s);let l,c;const u=(o+a)/2;if(o===a)l=0,c=0;else{const h=a-o;switch(c=u<=.5?h/(a+o):h/(2-a-o),a){case n:l=(i-s)/h+(i<s?6:0);break;case i:l=(s-n)/h+2;break;case s:l=(n-i)/h+4;break}l/=6}return e.h=l,e.s=c,e.l=u,e}getRGB(e,t=vt.workingColorSpace){return vt.workingToColorSpace(cn.copy(this),t),e.r=cn.r,e.g=cn.g,e.b=cn.b,e}getStyle(e=At){vt.workingToColorSpace(cn.copy(this),e);const t=cn.r,n=cn.g,i=cn.b;return e!==At?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${i.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(i*255)})`}offsetHSL(e,t,n){return this.getHSL(Mi),this.setHSL(Mi.h+e,Mi.s+t,Mi.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(Mi),e.getHSL(Ts);const n=ns(Mi.h,Ts.h,t),i=ns(Mi.s,Ts.s,t),s=ns(Mi.l,Ts.l,t);return this.setHSL(n,i,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,n=this.g,i=this.b,s=e.elements;return this.r=s[0]*t+s[3]*n+s[6]*i,this.g=s[1]*t+s[4]*n+s[7]*i,this.b=s[2]*t+s[5]*n+s[8]*i,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const cn=new ht;ht.NAMES=uh;let rp=0;class Vn extends Zi{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:rp++}),this.uuid=zn(),this.name="",this.type="Material",this.blending=Ar,this.side=$n,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=So,this.blendDst=Mo,this.blendEquation=Gi,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new ht(0,0,0),this.blendAlpha=0,this.depthFunc=Pr,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=ac,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=rr,this.stencilZFail=rr,this.stencilZPass=rr,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.forceSinglePass=!1,this.allowOverride=!0,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}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const n=e[t];if(n===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==Ar&&(n.blending=this.blending),this.side!==$n&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==So&&(n.blendSrc=this.blendSrc),this.blendDst!==Mo&&(n.blendDst=this.blendDst),this.blendEquation!==Gi&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==Pr&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==ac&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==rr&&(n.stencilFail=this.stencilFail),this.stencilZFail!==rr&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==rr&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function i(s){const a=[];for(const o in s){const l=s[o];delete l.metadata,a.push(l)}return a}if(t){const s=i(e.textures),a=i(e.images);s.length>0&&(n.textures=s),a.length>0&&(n.images=a)}return n}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.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,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 n=null;if(t!==null){const i=t.length;n=new Array(i);for(let s=0;s!==i;++s)n[s]=t[s].clone()}return this.clippingPlanes=n,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.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,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 Ci extends Vn{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new ht(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.envMapRotation=new bn,this.combine=xa,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.envMapRotation.copy(e.envMapRotation),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 jt=new k,ws=new dt;let sp=0;class Xt{constructor(e,t,n=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:sp++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=al,this.updateRanges=[],this.gpuType=Yn,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}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.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,s=this.itemSize;i<s;i++)this.array[e+i]=t.array[n+i];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)ws.fromBufferAttribute(this,t),ws.applyMatrix3(e),this.setXY(t,ws.x,ws.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)jt.fromBufferAttribute(this,t),jt.applyMatrix3(e),this.setXYZ(t,jt.x,jt.y,jt.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)jt.fromBufferAttribute(this,t),jt.applyMatrix4(e),this.setXYZ(t,jt.x,jt.y,jt.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)jt.fromBufferAttribute(this,t),jt.applyNormalMatrix(e),this.setXYZ(t,jt.x,jt.y,jt.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)jt.fromBufferAttribute(this,t),jt.transformDirection(e),this.setXYZ(t,jt.x,jt.y,jt.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];return this.normalized&&(n=Bn(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Lt(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=Bn(t,this.array)),t}setX(e,t){return this.normalized&&(t=Lt(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=Bn(t,this.array)),t}setY(e,t){return this.normalized&&(t=Lt(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=Bn(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Lt(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=Bn(t,this.array)),t}setW(e,t){return this.normalized&&(t=Lt(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=Lt(t,this.array),n=Lt(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,i){return e*=this.itemSize,this.normalized&&(t=Lt(t,this.array),n=Lt(n,this.array),i=Lt(i,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this}setXYZW(e,t,n,i,s){return e*=this.itemSize,this.normalized&&(t=Lt(t,this.array),n=Lt(n,this.array),i=Lt(i,this.array),s=Lt(s,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this.array[e+3]=s,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==al&&(e.usage=this.usage),e}}class hh extends Xt{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class ap extends Xt{constructor(e,t,n){super(new Int32Array(e),t,n)}}class dh extends Xt{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class xt extends Xt{constructor(e,t,n){super(new Float32Array(e),t,n)}}let op=0;const Dn=new ut,Ka=new Ft,pr=new k,wn=new Zn,qr=new Zn,Qt=new k;class Vt extends Zi{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:op++}),this.uuid=zn(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(lh(e)?dh:hh)(e,1):this.index=e,this}setIndirect(e){return this.indirect=e,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(n!==void 0){const s=new gt().getNormalMatrix(e);n.applyNormalMatrix(s),n.needsUpdate=!0}const i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(e),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return Dn.makeRotationFromQuaternion(e),this.applyMatrix4(Dn),this}rotateX(e){return Dn.makeRotationX(e),this.applyMatrix4(Dn),this}rotateY(e){return Dn.makeRotationY(e),this.applyMatrix4(Dn),this}rotateZ(e){return Dn.makeRotationZ(e),this.applyMatrix4(Dn),this}translate(e,t,n){return Dn.makeTranslation(e,t,n),this.applyMatrix4(Dn),this}scale(e,t,n){return Dn.makeScale(e,t,n),this.applyMatrix4(Dn),this}lookAt(e){return Ka.lookAt(e),Ka.updateMatrix(),this.applyMatrix4(Ka.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(pr).negate(),this.translate(pr.x,pr.y,pr.z),this}setFromPoints(e){const t=this.getAttribute("position");if(t===void 0){const n=[];for(let i=0,s=e.length;i<s;i++){const a=e[i];n.push(a.x,a.y,a.z||0)}this.setAttribute("position",new xt(n,3))}else{const n=Math.min(e.length,t.count);for(let i=0;i<n;i++){const s=e[i];t.setXYZ(i,s.x,s.y,s.z||0)}e.length>t.count&&console.warn("THREE.BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Zn);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new k(-1/0,-1/0,-1/0),new k(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,i=t.length;n<i;n++){const s=t[n];wn.setFromBufferAttribute(s),this.morphTargetsRelative?(Qt.addVectors(this.boundingBox.min,wn.min),this.boundingBox.expandByPoint(Qt),Qt.addVectors(this.boundingBox.max,wn.max),this.boundingBox.expandByPoint(Qt)):(this.boundingBox.expandByPoint(wn.min),this.boundingBox.expandByPoint(wn.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new _i);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new k,1/0);return}if(e){const n=this.boundingSphere.center;if(wn.setFromBufferAttribute(e),t)for(let s=0,a=t.length;s<a;s++){const o=t[s];qr.setFromBufferAttribute(o),this.morphTargetsRelative?(Qt.addVectors(wn.min,qr.min),wn.expandByPoint(Qt),Qt.addVectors(wn.max,qr.max),wn.expandByPoint(Qt)):(wn.expandByPoint(qr.min),wn.expandByPoint(qr.max))}wn.getCenter(n);let i=0;for(let s=0,a=e.count;s<a;s++)Qt.fromBufferAttribute(e,s),i=Math.max(i,n.distanceToSquared(Qt));if(t)for(let s=0,a=t.length;s<a;s++){const o=t[s],l=this.morphTargetsRelative;for(let c=0,u=o.count;c<u;c++)Qt.fromBufferAttribute(o,c),l&&(pr.fromBufferAttribute(e,c),Qt.add(pr)),i=Math.max(i,n.distanceToSquared(Qt))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const n=t.position,i=t.normal,s=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new Xt(new Float32Array(4*n.count),4));const a=this.getAttribute("tangent"),o=[],l=[];for(let L=0;L<n.count;L++)o[L]=new k,l[L]=new k;const c=new k,u=new k,h=new k,d=new dt,f=new dt,m=new dt,_=new k,g=new k;function p(L,b,x){c.fromBufferAttribute(n,L),u.fromBufferAttribute(n,b),h.fromBufferAttribute(n,x),d.fromBufferAttribute(s,L),f.fromBufferAttribute(s,b),m.fromBufferAttribute(s,x),u.sub(c),h.sub(c),f.sub(d),m.sub(d);const w=1/(f.x*m.y-m.x*f.y);isFinite(w)&&(_.copy(u).multiplyScalar(m.y).addScaledVector(h,-f.y).multiplyScalar(w),g.copy(h).multiplyScalar(f.x).addScaledVector(u,-m.x).multiplyScalar(w),o[L].add(_),o[b].add(_),o[x].add(_),l[L].add(g),l[b].add(g),l[x].add(g))}let M=this.groups;M.length===0&&(M=[{start:0,count:e.count}]);for(let L=0,b=M.length;L<b;++L){const x=M[L],w=x.start,B=x.count;for(let z=w,X=w+B;z<X;z+=3)p(e.getX(z+0),e.getX(z+1),e.getX(z+2))}const E=new k,y=new k,I=new k,R=new k;function C(L){I.fromBufferAttribute(i,L),R.copy(I);const b=o[L];E.copy(b),E.sub(I.multiplyScalar(I.dot(b))).normalize(),y.crossVectors(R,b);const w=y.dot(l[L])<0?-1:1;a.setXYZW(L,E.x,E.y,E.z,w)}for(let L=0,b=M.length;L<b;++L){const x=M[L],w=x.start,B=x.count;for(let z=w,X=w+B;z<X;z+=3)C(e.getX(z+0)),C(e.getX(z+1)),C(e.getX(z+2))}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let n=this.getAttribute("normal");if(n===void 0)n=new Xt(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let d=0,f=n.count;d<f;d++)n.setXYZ(d,0,0,0);const i=new k,s=new k,a=new k,o=new k,l=new k,c=new k,u=new k,h=new k;if(e)for(let d=0,f=e.count;d<f;d+=3){const m=e.getX(d+0),_=e.getX(d+1),g=e.getX(d+2);i.fromBufferAttribute(t,m),s.fromBufferAttribute(t,_),a.fromBufferAttribute(t,g),u.subVectors(a,s),h.subVectors(i,s),u.cross(h),o.fromBufferAttribute(n,m),l.fromBufferAttribute(n,_),c.fromBufferAttribute(n,g),o.add(u),l.add(u),c.add(u),n.setXYZ(m,o.x,o.y,o.z),n.setXYZ(_,l.x,l.y,l.z),n.setXYZ(g,c.x,c.y,c.z)}else for(let d=0,f=t.count;d<f;d+=3)i.fromBufferAttribute(t,d+0),s.fromBufferAttribute(t,d+1),a.fromBufferAttribute(t,d+2),u.subVectors(a,s),h.subVectors(i,s),u.cross(h),n.setXYZ(d+0,u.x,u.y,u.z),n.setXYZ(d+1,u.x,u.y,u.z),n.setXYZ(d+2,u.x,u.y,u.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)Qt.fromBufferAttribute(e,t),Qt.normalize(),e.setXYZ(t,Qt.x,Qt.y,Qt.z)}toNonIndexed(){function e(o,l){const c=o.array,u=o.itemSize,h=o.normalized,d=new c.constructor(l.length*u);let f=0,m=0;for(let _=0,g=l.length;_<g;_++){o.isInterleavedBufferAttribute?f=l[_]*o.data.stride+o.offset:f=l[_]*u;for(let p=0;p<u;p++)d[m++]=c[f++]}return new Xt(d,u,h)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new Vt,n=this.index.array,i=this.attributes;for(const o in i){const l=i[o],c=e(l,n);t.setAttribute(o,c)}const s=this.morphAttributes;for(const o in s){const l=[],c=s[o];for(let u=0,h=c.length;u<h;u++){const d=c[u],f=e(d,n);l.push(f)}t.morphAttributes[o]=l}t.morphTargetsRelative=this.morphTargetsRelative;const a=this.groups;for(let o=0,l=a.length;o<l;o++){const c=a[o];t.addGroup(c.start,c.count,c.materialIndex)}return t}toJSON(){const e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(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 n=this.attributes;for(const l in n){const c=n[l];e.data.attributes[l]=c.toJSON(e.data)}const i={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],u=[];for(let h=0,d=c.length;h<d;h++){const f=c[h];u.push(f.toJSON(e.data))}u.length>0&&(i[l]=u,s=!0)}s&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));const o=this.boundingSphere;return o!==null&&(e.data.boundingSphere=o.toJSON()),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 n=e.index;n!==null&&this.setIndex(n.clone());const i=e.attributes;for(const c in i){const u=i[c];this.setAttribute(c,u.clone(t))}const s=e.morphAttributes;for(const c in s){const u=[],h=s[c];for(let d=0,f=h.length;d<f;d++)u.push(h[d].clone(t));this.morphAttributes[c]=u}this.morphTargetsRelative=e.morphTargetsRelative;const a=e.groups;for(let c=0,u=a.length;c<u;c++){const h=a[c];this.addGroup(h.start,h.count,h.materialIndex)}const o=e.boundingBox;o!==null&&(this.boundingBox=o.clone());const l=e.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const Sc=new ut,Fi=new Or,As=new _i,Mc=new k,Rs=new k,Cs=new k,Ps=new k,$a=new k,Ds=new k,bc=new k,Ls=new k;class Ut extends Ft{constructor(e=new Vt,t=new Ci){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=i.length;s<a;s++){const o=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}getVertexPosition(e,t){const n=this.geometry,i=n.attributes.position,s=n.morphAttributes.position,a=n.morphTargetsRelative;t.fromBufferAttribute(i,e);const o=this.morphTargetInfluences;if(s&&o){Ds.set(0,0,0);for(let l=0,c=s.length;l<c;l++){const u=o[l],h=s[l];u!==0&&($a.fromBufferAttribute(h,e),a?Ds.addScaledVector($a,u):Ds.addScaledVector($a.sub(t),u))}t.add(Ds)}return t}raycast(e,t){const n=this.geometry,i=this.material,s=this.matrixWorld;i!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),As.copy(n.boundingSphere),As.applyMatrix4(s),Fi.copy(e.ray).recast(e.near),!(As.containsPoint(Fi.origin)===!1&&(Fi.intersectSphere(As,Mc)===null||Fi.origin.distanceToSquared(Mc)>(e.far-e.near)**2))&&(Sc.copy(s).invert(),Fi.copy(e.ray).applyMatrix4(Sc),!(n.boundingBox!==null&&Fi.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,Fi)))}_computeIntersections(e,t,n){let i;const s=this.geometry,a=this.material,o=s.index,l=s.attributes.position,c=s.attributes.uv,u=s.attributes.uv1,h=s.attributes.normal,d=s.groups,f=s.drawRange;if(o!==null)if(Array.isArray(a))for(let m=0,_=d.length;m<_;m++){const g=d[m],p=a[g.materialIndex],M=Math.max(g.start,f.start),E=Math.min(o.count,Math.min(g.start+g.count,f.start+f.count));for(let y=M,I=E;y<I;y+=3){const R=o.getX(y),C=o.getX(y+1),L=o.getX(y+2);i=Us(this,p,e,n,c,u,h,R,C,L),i&&(i.faceIndex=Math.floor(y/3),i.face.materialIndex=g.materialIndex,t.push(i))}}else{const m=Math.max(0,f.start),_=Math.min(o.count,f.start+f.count);for(let g=m,p=_;g<p;g+=3){const M=o.getX(g),E=o.getX(g+1),y=o.getX(g+2);i=Us(this,a,e,n,c,u,h,M,E,y),i&&(i.faceIndex=Math.floor(g/3),t.push(i))}}else if(l!==void 0)if(Array.isArray(a))for(let m=0,_=d.length;m<_;m++){const g=d[m],p=a[g.materialIndex],M=Math.max(g.start,f.start),E=Math.min(l.count,Math.min(g.start+g.count,f.start+f.count));for(let y=M,I=E;y<I;y+=3){const R=y,C=y+1,L=y+2;i=Us(this,p,e,n,c,u,h,R,C,L),i&&(i.faceIndex=Math.floor(y/3),i.face.materialIndex=g.materialIndex,t.push(i))}}else{const m=Math.max(0,f.start),_=Math.min(l.count,f.start+f.count);for(let g=m,p=_;g<p;g+=3){const M=g,E=g+1,y=g+2;i=Us(this,a,e,n,c,u,h,M,E,y),i&&(i.faceIndex=Math.floor(g/3),t.push(i))}}}}function lp(r,e,t,n,i,s,a,o){let l;if(e.side===_n?l=n.intersectTriangle(a,s,i,!0,o):l=n.intersectTriangle(i,s,a,e.side===$n,o),l===null)return null;Ls.copy(o),Ls.applyMatrix4(r.matrixWorld);const c=t.ray.origin.distanceTo(Ls);return c<t.near||c>t.far?null:{distance:c,point:Ls.clone(),object:r}}function Us(r,e,t,n,i,s,a,o,l,c){r.getVertexPosition(o,Rs),r.getVertexPosition(l,Cs),r.getVertexPosition(c,Ps);const u=lp(r,e,t,n,Rs,Cs,Ps,bc);if(u){const h=new k;Un.getBarycoord(bc,Rs,Cs,Ps,h),i&&(u.uv=Un.getInterpolatedAttribute(i,o,l,c,h,new dt)),s&&(u.uv1=Un.getInterpolatedAttribute(s,o,l,c,h,new dt)),a&&(u.normal=Un.getInterpolatedAttribute(a,o,l,c,h,new k),u.normal.dot(n.direction)>0&&u.normal.multiplyScalar(-1));const d={a:o,b:l,c,normal:new k,materialIndex:0};Un.getNormal(Rs,Cs,Ps,d.normal),u.face=d,u.barycoord=h}return u}class Br extends Vt{constructor(e=1,t=1,n=1,i=1,s=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:s,depthSegments:a};const o=this;i=Math.floor(i),s=Math.floor(s),a=Math.floor(a);const l=[],c=[],u=[],h=[];let d=0,f=0;m("z","y","x",-1,-1,n,t,e,a,s,0),m("z","y","x",1,-1,n,t,-e,a,s,1),m("x","z","y",1,1,e,n,t,i,a,2),m("x","z","y",1,-1,e,n,-t,i,a,3),m("x","y","z",1,-1,e,t,n,i,s,4),m("x","y","z",-1,-1,e,t,-n,i,s,5),this.setIndex(l),this.setAttribute("position",new xt(c,3)),this.setAttribute("normal",new xt(u,3)),this.setAttribute("uv",new xt(h,2));function m(_,g,p,M,E,y,I,R,C,L,b){const x=y/C,w=I/L,B=y/2,z=I/2,X=R/2,j=C+1,O=L+1;let K=0,H=0;const re=new k;for(let oe=0;oe<O;oe++){const $=oe*w-z;for(let xe=0;xe<j;xe++){const Ee=xe*x-B;re[_]=Ee*M,re[g]=$*E,re[p]=X,c.push(re.x,re.y,re.z),re[_]=0,re[g]=0,re[p]=R>0?1:-1,u.push(re.x,re.y,re.z),h.push(xe/C),h.push(1-oe/L),K+=1}}for(let oe=0;oe<L;oe++)for(let $=0;$<C;$++){const xe=d+$+j*oe,Ee=d+$+j*(oe+1),q=d+($+1)+j*(oe+1),te=d+($+1)+j*oe;l.push(xe,Ee,te),l.push(Ee,q,te),H+=6}o.addGroup(f,H,b),f+=H,d+=K}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Br(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function Nr(r){const e={};for(const t in r){e[t]={};for(const n in r[t]){const i=r[t][n];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)?i.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][n]=null):e[t][n]=i.clone():Array.isArray(i)?e[t][n]=i.slice():e[t][n]=i}}return e}function gn(r){const e={};for(let t=0;t<r.length;t++){const n=Nr(r[t]);for(const i in n)e[i]=n[i]}return e}function cp(r){const e=[];for(let t=0;t<r.length;t++)e.push(r[t].clone());return e}function fh(r){const e=r.getRenderTarget();return e===null?r.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:vt.workingColorSpace}const Dl={clone:Nr,merge:gn};var up=`void main() {
|
|
6
6
|
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
7
|
-
}`,
|
|
7
|
+
}`,hp=`void main() {
|
|
8
8
|
gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
|
|
9
|
-
}`;class gi extends Vn{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=
|
|
9
|
+
}`;class gi extends Vn{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=up,this.fragmentShader=hp,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=Nr(e.uniforms),this.uniformsGroups=cp(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}toJSON(e){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const i in this.uniforms){const a=this.uniforms[i].value;a&&a.isTexture?t.uniforms[i]={type:"t",value:a.toJSON(e).uuid}:a&&a.isColor?t.uniforms[i]={type:"c",value:a.getHex()}:a&&a.isVector2?t.uniforms[i]={type:"v2",value:a.toArray()}:a&&a.isVector3?t.uniforms[i]={type:"v3",value:a.toArray()}:a&&a.isVector4?t.uniforms[i]={type:"v4",value:a.toArray()}:a&&a.isMatrix3?t.uniforms[i]={type:"m3",value:a.toArray()}:a&&a.isMatrix4?t.uniforms[i]={type:"m4",value:a.toArray()}:t.uniforms[i]={value:a}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const n={};for(const i in this.extensions)this.extensions[i]===!0&&(n[i]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}class ph extends Ft{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new ut,this.projectionMatrix=new ut,this.projectionMatrixInverse=new ut,this.coordinateSystem=di}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}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)}}const bi=new k,Ec=new dt,Tc=new dt;class sn extends ph{constructor(e=50,t=1,n=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=i,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=Ir*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(ts*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Ir*2*Math.atan(Math.tan(ts*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,n){bi.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(bi.x,bi.y).multiplyScalar(-e/bi.z),bi.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(bi.x,bi.y).multiplyScalar(-e/bi.z)}getViewSize(e,t){return this.getViewBounds(e,Ec,Tc),t.subVectors(Tc,Ec)}setViewOffset(e,t,n,i,s,a){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=n,this.view.offsetY=i,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(ts*.5*this.fov)/this.zoom,n=2*t,i=this.aspect*n,s=-.5*i;const a=this.view;if(this.view!==null&&this.view.enabled){const l=a.fullWidth,c=a.fullHeight;s+=a.offsetX*i/l,t-=a.offsetY*n/c,i*=a.width/l,n*=a.height/c}const o=this.filmOffset;o!==0&&(s+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+i,t,t-n,e,this.far,this.coordinateSystem),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 mr=-90,gr=1;class dp extends Ft{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new sn(mr,gr,e,t);i.layers=this.layers,this.add(i);const s=new sn(mr,gr,e,t);s.layers=this.layers,this.add(s);const a=new sn(mr,gr,e,t);a.layers=this.layers,this.add(a);const o=new sn(mr,gr,e,t);o.layers=this.layers,this.add(o);const l=new sn(mr,gr,e,t);l.layers=this.layers,this.add(l);const c=new sn(mr,gr,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,i,s,a,o,l]=t;for(const c of t)this.remove(c);if(e===di)n.up.set(0,1,0),n.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),o.up.set(0,1,0),o.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===ma)n.up.set(0,-1,0),n.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),o.up.set(0,-1,0),o.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const c of t)this.add(c),c.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:i}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,a,o,l,c,u]=this.children,h=e.getRenderTarget(),d=e.getActiveCubeFace(),f=e.getActiveMipmapLevel(),m=e.xr.enabled;e.xr.enabled=!1;const _=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0,i),e.render(t,s),e.setRenderTarget(n,1,i),e.render(t,a),e.setRenderTarget(n,2,i),e.render(t,o),e.setRenderTarget(n,3,i),e.render(t,l),e.setRenderTarget(n,4,i),e.render(t,c),n.texture.generateMipmaps=_,e.setRenderTarget(n,5,i),e.render(t,u),e.setRenderTarget(h,d,f),e.xr.enabled=m,n.texture.needsPMREMUpdate=!0}}class mh extends an{constructor(e=[],t=Dr,n,i,s,a,o,l,c,u){super(e,t,n,i,s,a,o,l,c,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class fp extends Ji{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},i=[n,n,n,n,n,n];this.texture=new mh(i),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:`
|
|
10
10
|
|
|
11
11
|
varying vec3 vWorldDirection;
|
|
12
12
|
|
|
@@ -41,13 +41,13 @@
|
|
|
41
41
|
gl_FragColor = texture2D( tEquirect, sampleUV );
|
|
42
42
|
|
|
43
43
|
}
|
|
44
|
-
`},i=new Br(5,5,5),s=new gi({name:"CubemapFromEquirect",uniforms:Nr(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:_n,blending:Ai});s.uniforms.tEquirect.value=t;const a=new Ut(i,s),o=t.minFilter;return t.minFilter===hi&&(t.minFilter=An),new fp(1,10,this).update(e,a),t.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(e,t=!0,n=!0,i=!0){const s=e.getRenderTarget();for(let a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,n,i);e.setRenderTarget(s)}}class fi extends Ft{constructor(){super(),this.isGroup=!0,this.type="Group"}}const mp={type:"move"};class Ja{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new fi,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 fi,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new k,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new k),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new fi,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new k,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new k),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}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data: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,n){let i=null,s=null,a=null;const o=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){a=!0;for(const _ of e.hand.values()){const g=t.getJointPose(_,n),p=this._getHandJoint(c,_);g!==null&&(p.matrix.fromArray(g.transform.matrix),p.matrix.decompose(p.position,p.rotation,p.scale),p.matrixWorldNeedsUpdate=!0,p.jointRadius=g.radius),p.visible=g!==null}const u=c.joints["index-finger-tip"],h=c.joints["thumb-tip"],d=u.position.distanceTo(h.position),f=.02,m=.005;c.inputState.pinching&&d>f+m?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&d<=f-m&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,n),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1));o!==null&&(i=t.getPose(e.targetRaySpace,n),i===null&&s!==null&&(i=s),i!==null&&(o.matrix.fromArray(i.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,i.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(i.linearVelocity)):o.hasLinearVelocity=!1,i.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(i.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(mp)))}return o!==null&&(o.visible=i!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new fi;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}class Ll extends Ft{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new bn,this.environmentIntensity=1,this.environmentRotation=new bn,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__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()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}class gh{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=al,this.updateRanges=[],this.version=0,this.uuid=zn()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}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,n){e*=this.stride,n*=t.stride;for(let i=0,s=this.stride;i<s;i++)this.array[e+i]=t.array[n+i];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=zn()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=zn()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}const mn=new k;class Kn{constructor(e,t,n,i=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=i}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,n=this.data.count;t<n;t++)mn.fromBufferAttribute(this,t),mn.applyMatrix4(e),this.setXYZ(t,mn.x,mn.y,mn.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)mn.fromBufferAttribute(this,t),mn.applyNormalMatrix(e),this.setXYZ(t,mn.x,mn.y,mn.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)mn.fromBufferAttribute(this,t),mn.transformDirection(e),this.setXYZ(t,mn.x,mn.y,mn.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=Bn(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Lt(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=Lt(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=Lt(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=Lt(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=Lt(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=Bn(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=Bn(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=Bn(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=Bn(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=Lt(t,this.array),n=Lt(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=Lt(t,this.array),n=Lt(n,this.array),i=Lt(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this}setXYZW(e,t,n,i,s){return e=e*this.data.stride+this.offset,this.normalized&&(t=Lt(t,this.array),n=Lt(n,this.array),i=Lt(i,this.array),s=Lt(s,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this.data.array[e+3]=s,this}clone(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const i=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[i+s])}return new Xt(new this.array.constructor(t),this.itemSize,this.normalized)}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new Kn(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const i=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[i+s])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}class Ma extends Vn{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new ht(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}let _r;const jr=new k,vr=new k,yr=new k,xr=new dt,Yr=new dt,_h=new ut,Is=new k,Kr=new k,Ns=new k,wc=new dt,Za=new dt,Ac=new dt;class Ul extends Ft{constructor(e=new Ma){if(super(),this.isSprite=!0,this.type="Sprite",_r===void 0){_r=new Vt;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),n=new gh(t,5);_r.setIndex([0,1,2,0,2,3]),_r.setAttribute("position",new Kn(n,3,0,!1)),_r.setAttribute("uv",new Kn(n,2,3,!1))}this.geometry=_r,this.material=e,this.center=new dt(.5,.5),this.count=1}raycast(e,t){e.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),vr.setFromMatrixScale(this.matrixWorld),_h.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),yr.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&vr.multiplyScalar(-yr.z);const n=this.material.rotation;let i,s;n!==0&&(s=Math.cos(n),i=Math.sin(n));const a=this.center;Fs(Is.set(-.5,-.5,0),yr,a,vr,i,s),Fs(Kr.set(.5,-.5,0),yr,a,vr,i,s),Fs(Ns.set(.5,.5,0),yr,a,vr,i,s),wc.set(0,0),Za.set(1,0),Ac.set(1,1);let o=e.ray.intersectTriangle(Is,Kr,Ns,!1,jr);if(o===null&&(Fs(Kr.set(-.5,.5,0),yr,a,vr,i,s),Za.set(0,1),o=e.ray.intersectTriangle(Is,Ns,Kr,!1,jr),o===null))return;const l=e.ray.origin.distanceTo(jr);l<e.near||l>e.far||t.push({distance:l,point:jr.clone(),uv:Un.getInterpolation(jr,Is,Kr,Ns,wc,Za,Ac,new dt),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function Fs(r,e,t,n,i,s){xr.subVectors(r,t).addScalar(.5).multiply(n),i!==void 0?(Yr.x=s*xr.x-i*xr.y,Yr.y=i*xr.x+s*xr.y):Yr.copy(xr),r.copy(e),r.x+=Yr.x,r.y+=Yr.y,r.applyMatrix4(_h)}const Rc=new k,Cc=new St,Pc=new St,gp=new k,Dc=new ut,Os=new k,Qa=new _i,Lc=new ut,eo=new Or;class _p extends Ut{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=nc,this.bindMatrix=new ut,this.bindMatrixInverse=new ut,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new Zn),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,Os),this.boundingBox.expandByPoint(Os)}computeBoundingSphere(){const e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new _i),this.boundingSphere.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,Os),this.boundingSphere.expandByPoint(Os)}copy(e,t){return super.copy(e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}raycast(e,t){const n=this.material,i=this.matrixWorld;n!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),Qa.copy(this.boundingSphere),Qa.applyMatrix4(i),e.ray.intersectsSphere(Qa)!==!1&&(Lc.copy(i).invert(),eo.copy(e.ray).applyMatrix4(Lc),!(this.boundingBox!==null&&eo.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(e,t,eo)))}getVertexPosition(e,t){return super.getVertexPosition(e,t),this.applyBoneTransform(e,t),t}bind(e,t){this.skeleton=e,t===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const e=new St,t=this.geometry.attributes.skinWeight;for(let n=0,i=t.count;n<i;n++){e.fromBufferAttribute(t,n);const s=1/e.manhattanLength();s!==1/0?e.multiplyScalar(s):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===nc?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===ff?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){const n=this.skeleton,i=this.geometry;Cc.fromBufferAttribute(i.attributes.skinIndex,e),Pc.fromBufferAttribute(i.attributes.skinWeight,e),Rc.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let s=0;s<4;s++){const a=Pc.getComponent(s);if(a!==0){const o=Cc.getComponent(s);Dc.multiplyMatrices(n.bones[o].matrixWorld,n.boneInverses[o]),t.addScaledVector(gp.copy(Rc).applyMatrix4(Dc),a)}}return t.applyMatrix4(this.bindMatrixInverse)}}class vh extends Ft{constructor(){super(),this.isBone=!0,this.type="Bone"}}class yh extends an{constructor(e=null,t=1,n=1,i,s,a,o,l,c=Rn,u=Rn,h,d){super(null,a,o,l,c,u,i,s,h,d),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const Uc=new ut,vp=new ut;class Il{constructor(e=[],t=[]){this.uuid=zn(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.init()}init(){const e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(e.length*16),t.length===0)this.calculateInverses();else if(e.length!==t.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let n=0,i=this.bones.length;n<i;n++)this.boneInverses.push(new ut)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const n=new ut;this.bones[e]&&n.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(n)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){const n=this.bones[e];n&&n.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){const n=this.bones[e];n&&(n.parent&&n.parent.isBone?(n.matrix.copy(n.parent.matrixWorld).invert(),n.matrix.multiply(n.matrixWorld)):n.matrix.copy(n.matrixWorld),n.matrix.decompose(n.position,n.quaternion,n.scale))}}update(){const e=this.bones,t=this.boneInverses,n=this.boneMatrices,i=this.boneTexture;for(let s=0,a=e.length;s<a;s++){const o=e[s]?e[s].matrixWorld:vp;Uc.multiplyMatrices(o,t[s]),Uc.toArray(n,s*16)}i!==null&&(i.needsUpdate=!0)}clone(){return new Il(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const t=new Float32Array(e*e*4);t.set(this.boneMatrices);const n=new yh(t,e,e,In,Yn);return n.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=n,this}getBoneByName(e){for(let t=0,n=this.bones.length;t<n;t++){const i=this.bones[t];if(i.name===e)return i}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let n=0,i=e.bones.length;n<i;n++){const s=e.bones[n];let a=t[s];a===void 0&&(console.warn("THREE.Skeleton: No bone found with UUID:",s),a=new vh),this.bones.push(a),this.boneInverses.push(new ut().fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){const e={metadata:{version:4.7,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const t=this.bones,n=this.boneInverses;for(let i=0,s=t.length;i<s;i++){const a=t[i];e.bones.push(a.uuid);const o=n[i];e.boneInverses.push(o.toArray())}return e}}const to=new k,yp=new k,xp=new gt;class Ti{constructor(e=new k(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,n,i){return this.normal.set(e,t,n),this.constant=i,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){const i=to.subVectors(n,t).cross(yp.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,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(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){const n=e.delta(to),i=this.normal.dot(n);if(i===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/i;return s<0||s>1?null:t.copy(e.start).addScaledVector(n,s)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<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 n=t||xp.getNormalMatrix(e),i=this.coplanarPoint(to).applyMatrix4(e),s=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(s),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 Oi=new _i,Bs=new k;class Nl{constructor(e=new Ti,t=new Ti,n=new Ti,i=new Ti,s=new Ti,a=new Ti){this.planes=[e,t,n,i,s,a]}set(e,t,n,i,s,a){const o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(i),o[4].copy(s),o[5].copy(a),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=di){const n=this.planes,i=e.elements,s=i[0],a=i[1],o=i[2],l=i[3],c=i[4],u=i[5],h=i[6],d=i[7],f=i[8],m=i[9],_=i[10],g=i[11],p=i[12],M=i[13],E=i[14],y=i[15];if(n[0].setComponents(l-s,d-c,g-f,y-p).normalize(),n[1].setComponents(l+s,d+c,g+f,y+p).normalize(),n[2].setComponents(l+a,d+u,g+m,y+M).normalize(),n[3].setComponents(l-a,d-u,g-m,y-M).normalize(),n[4].setComponents(l-o,d-h,g-_,y-E).normalize(),t===di)n[5].setComponents(l+o,d+h,g+_,y+E).normalize();else if(t===ma)n[5].setComponents(o,h,_,E).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Oi.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Oi.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Oi)}intersectsSprite(e){return Oi.center.set(0,0,0),Oi.radius=.7071067811865476,Oi.applyMatrix4(e.matrixWorld),this.intersectsSphere(Oi)}intersectsSphere(e){const t=this.planes,n=e.center,i=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(n)<i)return!1;return!0}intersectsBox(e){const t=this.planes;for(let n=0;n<6;n++){const i=t[n];if(Bs.x=i.normal.x>0?e.max.x:e.min.x,Bs.y=i.normal.y>0?e.max.y:e.min.y,Bs.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(Bs)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}class ji extends Vn{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new ht(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const ga=new k,_a=new k,Ic=new ut,$r=new Or,ks=new _i,no=new k,Nc=new k;class Fl extends Ft{constructor(e=new Vt,t=new ji){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[0];for(let i=1,s=t.count;i<s;i++)ga.fromBufferAttribute(t,i-1),_a.fromBufferAttribute(t,i),n[i]=n[i-1],n[i]+=ga.distanceTo(_a);e.setAttribute("lineDistance",new xt(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,s=e.params.Line.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),ks.copy(n.boundingSphere),ks.applyMatrix4(i),ks.radius+=s,e.ray.intersectsSphere(ks)===!1)return;Ic.copy(i).invert(),$r.copy(e.ray).applyMatrix4(Ic);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=this.isLineSegments?2:1,u=n.index,d=n.attributes.position;if(u!==null){const f=Math.max(0,a.start),m=Math.min(u.count,a.start+a.count);for(let _=f,g=m-1;_<g;_+=c){const p=u.getX(_),M=u.getX(_+1),E=zs(this,e,$r,l,p,M,_);E&&t.push(E)}if(this.isLineLoop){const _=u.getX(m-1),g=u.getX(f),p=zs(this,e,$r,l,_,g,m-1);p&&t.push(p)}}else{const f=Math.max(0,a.start),m=Math.min(d.count,a.start+a.count);for(let _=f,g=m-1;_<g;_+=c){const p=zs(this,e,$r,l,_,_+1,_);p&&t.push(p)}if(this.isLineLoop){const _=zs(this,e,$r,l,m-1,f,m-1);_&&t.push(_)}}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=i.length;s<a;s++){const o=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}}function zs(r,e,t,n,i,s,a){const o=r.geometry.attributes.position;if(ga.fromBufferAttribute(o,i),_a.fromBufferAttribute(o,s),t.distanceSqToSegment(ga,_a,no,Nc)>n)return;no.applyMatrix4(r.matrixWorld);const c=e.ray.origin.distanceTo(no);if(!(c<e.near||c>e.far))return{distance:c,point:Nc.clone().applyMatrix4(r.matrixWorld),index:a,face:null,faceIndex:null,barycoord:null,object:r}}const Fc=new k,Oc=new k;class ol extends Fl{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[];for(let i=0,s=t.count;i<s;i+=2)Fc.fromBufferAttribute(t,i),Oc.fromBufferAttribute(t,i+1),n[i]=i===0?0:n[i-1],n[i+1]=n[i]+Fc.distanceTo(Oc);e.setAttribute("lineDistance",new xt(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class qi extends Vn{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new ht(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}const Bc=new ut,ll=new Or,Vs=new _i,Hs=new k;class is extends Ft{constructor(e=new Vt,t=new qi){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,s=e.params.Points.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),Vs.copy(n.boundingSphere),Vs.applyMatrix4(i),Vs.radius+=s,e.ray.intersectsSphere(Vs)===!1)return;Bc.copy(i).invert(),ll.copy(e.ray).applyMatrix4(Bc);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=n.index,h=n.attributes.position;if(c!==null){const d=Math.max(0,a.start),f=Math.min(c.count,a.start+a.count);for(let m=d,_=f;m<_;m++){const g=c.getX(m);Hs.fromBufferAttribute(h,g),kc(Hs,g,l,i,e,t,this)}}else{const d=Math.max(0,a.start),f=Math.min(h.count,a.start+a.count);for(let m=d,_=f;m<_;m++)Hs.fromBufferAttribute(h,m),kc(Hs,m,l,i,e,t,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=i.length;s<a;s++){const o=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}}function kc(r,e,t,n,i,s,a){const o=ll.distanceSqToPoint(r);if(o<t){const l=new k;ll.closestPointToPoint(r,l),l.applyMatrix4(n);const c=i.ray.origin.distanceTo(l);if(c<i.near||c>i.far)return;s.push({distance:c,distanceToRay:Math.sqrt(o),point:l,index:e,face:null,faceIndex:null,barycoord:null,object:a})}}class Sp extends an{constructor(e,t,n,i,s,a,o,l,c){super(e,t,n,i,s,a,o,l,c),this.isCanvasTexture=!0,this.needsUpdate=!0}}class xh extends an{constructor(e,t,n=$i,i,s,a,o=Rn,l=Rn,c,u=os,h=1){if(u!==os&&u!==ls)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const d={width:e,height:t,depth:h};super(d,i,s,a,o,l,u,n,c),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new Cl(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}class Ol extends Vt{constructor(e=1,t=1,n=1,i=32,s=1,a=!1,o=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:i,heightSegments:s,openEnded:a,thetaStart:o,thetaLength:l};const c=this;i=Math.floor(i),s=Math.floor(s);const u=[],h=[],d=[],f=[];let m=0;const _=[],g=n/2;let p=0;M(),a===!1&&(e>0&&E(!0),t>0&&E(!1)),this.setIndex(u),this.setAttribute("position",new xt(h,3)),this.setAttribute("normal",new xt(d,3)),this.setAttribute("uv",new xt(f,2));function M(){const y=new k,I=new k;let R=0;const C=(t-e)/n;for(let L=0;L<=s;L++){const b=[],x=L/s,w=x*(t-e)+e;for(let B=0;B<=i;B++){const z=B/i,X=z*l+o,j=Math.sin(X),O=Math.cos(X);I.x=w*j,I.y=-x*n+g,I.z=w*O,h.push(I.x,I.y,I.z),y.set(j,C,O).normalize(),d.push(y.x,y.y,y.z),f.push(z,1-x),b.push(m++)}_.push(b)}for(let L=0;L<i;L++)for(let b=0;b<s;b++){const x=_[b][L],w=_[b+1][L],B=_[b+1][L+1],z=_[b][L+1];(e>0||b!==0)&&(u.push(x,w,z),R+=3),(t>0||b!==s-1)&&(u.push(w,B,z),R+=3)}c.addGroup(p,R,0),p+=R}function E(y){const I=m,R=new dt,C=new k;let L=0;const b=y===!0?e:t,x=y===!0?1:-1;for(let B=1;B<=i;B++)h.push(0,g*x,0),d.push(0,x,0),f.push(.5,.5),m++;const w=m;for(let B=0;B<=i;B++){const X=B/i*l+o,j=Math.cos(X),O=Math.sin(X);C.x=b*O,C.y=g*x,C.z=b*j,h.push(C.x,C.y,C.z),d.push(0,x,0),R.x=j*.5+.5,R.y=O*.5*x+.5,f.push(R.x,R.y),m++}for(let B=0;B<i;B++){const z=I+B,X=w+B;y===!0?u.push(X,X+1,z):u.push(X+1,X,z),L+=3}c.addGroup(p,L,y===!0?1:2),p+=L}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Ol(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class ds extends Vt{constructor(e=1,t=1,n=1,i=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:i};const s=e/2,a=t/2,o=Math.floor(n),l=Math.floor(i),c=o+1,u=l+1,h=e/o,d=t/l,f=[],m=[],_=[],g=[];for(let p=0;p<u;p++){const M=p*d-a;for(let E=0;E<c;E++){const y=E*h-s;m.push(y,-M,0),_.push(0,0,1),g.push(E/o),g.push(1-p/l)}}for(let p=0;p<l;p++)for(let M=0;M<o;M++){const E=M+c*p,y=M+c*(p+1),I=M+1+c*(p+1),R=M+1+c*p;f.push(E,y,R),f.push(y,I,R)}this.setIndex(f),this.setAttribute("position",new xt(m,3)),this.setAttribute("normal",new xt(_,3)),this.setAttribute("uv",new xt(g,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ds(e.width,e.height,e.widthSegments,e.heightSegments)}}class ba extends Vt{constructor(e=1,t=32,n=16,i=0,s=Math.PI*2,a=0,o=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:i,phiLength:s,thetaStart:a,thetaLength:o},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));const l=Math.min(a+o,Math.PI);let c=0;const u=[],h=new k,d=new k,f=[],m=[],_=[],g=[];for(let p=0;p<=n;p++){const M=[],E=p/n;let y=0;p===0&&a===0?y=.5/t:p===n&&l===Math.PI&&(y=-.5/t);for(let I=0;I<=t;I++){const R=I/t;h.x=-e*Math.cos(i+R*s)*Math.sin(a+E*o),h.y=e*Math.cos(a+E*o),h.z=e*Math.sin(i+R*s)*Math.sin(a+E*o),m.push(h.x,h.y,h.z),d.copy(h).normalize(),_.push(d.x,d.y,d.z),g.push(R+y,1-E),M.push(c++)}u.push(M)}for(let p=0;p<n;p++)for(let M=0;M<t;M++){const E=u[p][M+1],y=u[p][M],I=u[p+1][M],R=u[p+1][M+1];(p!==0||a>0)&&f.push(E,y,R),(p!==n-1||l<Math.PI)&&f.push(y,I,R)}this.setIndex(f),this.setAttribute("position",new xt(m,3)),this.setAttribute("normal",new xt(_,3)),this.setAttribute("uv",new xt(g,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ba(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class Mp extends Vt{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){const t=[],n=new Set,i=new k,s=new k;if(e.index!==null){const a=e.attributes.position,o=e.index;let l=e.groups;l.length===0&&(l=[{start:0,count:o.count,materialIndex:0}]);for(let c=0,u=l.length;c<u;++c){const h=l[c],d=h.start,f=h.count;for(let m=d,_=d+f;m<_;m+=3)for(let g=0;g<3;g++){const p=o.getX(m+g),M=o.getX(m+(g+1)%3);i.fromBufferAttribute(a,p),s.fromBufferAttribute(a,M),zc(i,s,n)===!0&&(t.push(i.x,i.y,i.z),t.push(s.x,s.y,s.z))}}}else{const a=e.attributes.position;for(let o=0,l=a.count/3;o<l;o++)for(let c=0;c<3;c++){const u=3*o+c,h=3*o+(c+1)%3;i.fromBufferAttribute(a,u),s.fromBufferAttribute(a,h),zc(i,s,n)===!0&&(t.push(i.x,i.y,i.z),t.push(s.x,s.y,s.z))}}this.setAttribute("position",new xt(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}function zc(r,e,t){const n=`${r.x},${r.y},${r.z}-${e.x},${e.y},${e.z}`,i=`${e.x},${e.y},${e.z}-${r.x},${r.y},${r.z}`;return t.has(n)===!0||t.has(i)===!0?!1:(t.add(n),t.add(i),!0)}class Sn extends Vn{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new ht(16777215),this.specular=new ht(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ht(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Al,this.normalScale=new dt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new bn,this.combine=xa,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.envMapRotation.copy(e.envMapRotation),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 bp extends Vn{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new ht(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ht(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Al,this.normalScale=new dt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new bn,this.combine=xa,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.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.envMapRotation.copy(e.envMapRotation),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 Ep extends Vn{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=gf,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 Tp extends Vn{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",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.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}function Gs(r,e){return!r||r.constructor===e?r:typeof e.BYTES_PER_ELEMENT=="number"?new e(r):Array.prototype.slice.call(r)}function wp(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}function Ap(r){function e(i,s){return r[i]-r[s]}const t=r.length,n=new Array(t);for(let i=0;i!==t;++i)n[i]=i;return n.sort(e),n}function Vc(r,e,t){const n=r.length,i=new r.constructor(n);for(let s=0,a=0;a!==n;++s){const o=t[s]*e;for(let l=0;l!==e;++l)i[a++]=r[o+l]}return i}function Sh(r,e,t,n){let i=1,s=r[0];for(;s!==void 0&&s[n]===void 0;)s=r[i++];if(s===void 0)return;let a=s[n];if(a!==void 0)if(Array.isArray(a))do a=s[n],a!==void 0&&(e.push(s.time),t.push(...a)),s=r[i++];while(s!==void 0);else if(a.toArray!==void 0)do a=s[n],a!==void 0&&(e.push(s.time),a.toArray(t,t.length)),s=r[i++];while(s!==void 0);else do a=s[n],a!==void 0&&(e.push(s.time),t.push(a)),s=r[i++];while(s!==void 0)}class Ea{constructor(e,t,n,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=i!==void 0?i:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let n=this._cachedIndex,i=t[n],s=t[n-1];n:{e:{let a;t:{i:if(!(e<i)){for(let o=n+2;;){if(i===void 0){if(e<s)break i;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===o)break;if(s=i,i=t[++n],e<i)break e}a=t.length;break t}if(!(e>=s)){const o=t[1];e<o&&(n=2,s=o);for(let l=n-2;;){if(s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===l)break;if(i=s,s=t[--n-1],e>=s)break e}a=n,n=0;break t}break n}for(;n<a;){const o=n+a>>>1;e<t[o]?a=o:n=o+1}if(i=t[n],s=t[n-1],s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===void 0)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,s,i)}return this.interpolate_(n,s,e,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,s=e*i;for(let a=0;a!==i;++a)t[a]=n[s+a];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class Rp extends Ea{constructor(e,t,n,i){super(e,t,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:ic,endingEnd:ic}}intervalChanged_(e,t,n){const i=this.parameterPositions;let s=e-2,a=e+1,o=i[s],l=i[a];if(o===void 0)switch(this.getSettings_().endingStart){case rc:s=e,o=2*t-n;break;case sc:s=i.length-2,o=t+i[s]-i[s+1];break;default:s=e,o=n}if(l===void 0)switch(this.getSettings_().endingEnd){case rc:a=e,l=2*n-t;break;case sc:a=1,l=n+i[1]-i[0];break;default:a=e-1,l=t}const c=(n-t)*.5,u=this.valueSize;this._weightPrev=c/(t-o),this._weightNext=c/(l-n),this._offsetPrev=s*u,this._offsetNext=a*u}interpolate_(e,t,n,i){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=e*o,c=l-o,u=this._offsetPrev,h=this._offsetNext,d=this._weightPrev,f=this._weightNext,m=(n-t)/(i-t),_=m*m,g=_*m,p=-d*g+2*d*_-d*m,M=(1+d)*g+(-1.5-2*d)*_+(-.5+d)*m+1,E=(-1-f)*g+(1.5+f)*_+.5*m,y=f*g-f*_;for(let I=0;I!==o;++I)s[I]=p*a[u+I]+M*a[c+I]+E*a[l+I]+y*a[h+I];return s}}class Cp extends Ea{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=e*o,c=l-o,u=(n-t)/(i-t),h=1-u;for(let d=0;d!==o;++d)s[d]=a[c+d]*h+a[l+d]*u;return s}}class Pp extends Ea{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e){return this.copySampleValue_(e-1)}}class Gn{constructor(e,t,n,i){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=Gs(t,this.TimeBufferType),this.values=Gs(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(e){const t=e.constructor;let n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:Gs(e.times,Array),values:Gs(e.values,Array)};const i=e.getInterpolation();i!==e.DefaultInterpolation&&(n.interpolation=i)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new Pp(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new Cp(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new Rp(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case fa:t=this.InterpolantFactoryMethodDiscrete;break;case sl:t=this.InterpolantFactoryMethodLinear;break;case Pa:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){const n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(n);return console.warn("THREE.KeyframeTrack:",n),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return fa;case this.InterpolantFactoryMethodLinear:return sl;case this.InterpolantFactoryMethodSmooth:return Pa}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]+=e}return this}scale(e){if(e!==1){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]*=e}return this}trim(e,t){const n=this.times,i=n.length;let s=0,a=i-1;for(;s!==i&&n[s]<e;)++s;for(;a!==-1&&n[a]>t;)--a;if(++a,s!==0||a!==i){s>=a&&(a=Math.max(a,1),s=a-1);const o=this.getValueSize();this.times=n.slice(s,a),this.values=this.values.slice(s*o,a*o)}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 n=this.times,i=this.values,s=n.length;s===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let a=null;for(let o=0;o!==s;o++){const l=n[o];if(typeof l=="number"&&isNaN(l)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,l),e=!1;break}if(a!==null&&a>l){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,l,a),e=!1;break}a=l}if(i!==void 0&&wp(i))for(let o=0,l=i.length;o!==l;++o){const c=i[o];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,o,c),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===Pa,s=e.length-1;let a=1;for(let o=1;o<s;++o){let l=!1;const c=e[o],u=e[o+1];if(c!==u&&(o!==1||c!==e[0]))if(i)l=!0;else{const h=o*n,d=h-n,f=h+n;for(let m=0;m!==n;++m){const _=t[h+m];if(_!==t[d+m]||_!==t[f+m]){l=!0;break}}}if(l){if(o!==a){e[a]=e[o];const h=o*n,d=a*n;for(let f=0;f!==n;++f)t[d+f]=t[h+f]}++a}}if(s>0){e[a]=e[s];for(let o=s*n,l=a*n,c=0;c!==n;++c)t[l+c]=t[o+c];++a}return a!==e.length?(this.times=e.slice(0,a),this.values=t.slice(0,a*n)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),n=this.constructor,i=new n(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}Gn.prototype.ValueTypeName="";Gn.prototype.TimeBufferType=Float32Array;Gn.prototype.ValueBufferType=Float32Array;Gn.prototype.DefaultInterpolation=sl;class kr extends Gn{constructor(e,t,n){super(e,t,n)}}kr.prototype.ValueTypeName="bool";kr.prototype.ValueBufferType=Array;kr.prototype.DefaultInterpolation=fa;kr.prototype.InterpolantFactoryMethodLinear=void 0;kr.prototype.InterpolantFactoryMethodSmooth=void 0;class Mh extends Gn{constructor(e,t,n,i){super(e,t,n,i)}}Mh.prototype.ValueTypeName="color";class va extends Gn{constructor(e,t,n,i){super(e,t,n,i)}}va.prototype.ValueTypeName="number";class Dp extends Ea{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=(n-t)/(i-t);let c=e*o;for(let u=c+o;c!==u;c+=4)Cn.slerpFlat(s,0,a,c-o,a,c,l);return s}}class fs extends Gn{constructor(e,t,n,i){super(e,t,n,i)}InterpolantFactoryMethodLinear(e){return new Dp(this.times,this.values,this.getValueSize(),e)}}fs.prototype.ValueTypeName="quaternion";fs.prototype.InterpolantFactoryMethodSmooth=void 0;class zr extends Gn{constructor(e,t,n){super(e,t,n)}}zr.prototype.ValueTypeName="string";zr.prototype.ValueBufferType=Array;zr.prototype.DefaultInterpolation=fa;zr.prototype.InterpolantFactoryMethodLinear=void 0;zr.prototype.InterpolantFactoryMethodSmooth=void 0;class Fr extends Gn{constructor(e,t,n,i){super(e,t,n,i)}}Fr.prototype.ValueTypeName="vector";class Hc{constructor(e="",t=-1,n=[],i=mf){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=zn(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,i=1/(e.fps||1);for(let a=0,o=n.length;a!==o;++a)t.push(Up(n[a]).scale(i));const s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s}static toJSON(e){const t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let s=0,a=n.length;s!==a;++s)t.push(Gn.toJSON(n[s]));return i}static CreateFromMorphTargetSequence(e,t,n,i){const s=t.length,a=[];for(let o=0;o<s;o++){let l=[],c=[];l.push((o+s-1)%s,o,(o+1)%s),c.push(0,1,0);const u=Ap(l);l=Vc(l,1,u),c=Vc(c,1,u),!i&&l[0]===0&&(l.push(s),c.push(c[0])),a.push(new va(".morphTargetInfluences["+t[o].name+"]",l,c).scale(1/n))}return new this(e,-1,a)}static findByName(e,t){let n=e;if(!Array.isArray(e)){const i=e;n=i.geometry&&i.geometry.animations||i.animations}for(let i=0;i<n.length;i++)if(n[i].name===t)return n[i];return null}static CreateClipsFromMorphTargetSequences(e,t,n){const i={},s=/^([\w-]*?)([\d]+)$/;for(let o=0,l=e.length;o<l;o++){const c=e[o],u=c.name.match(s);if(u&&u.length>1){const h=u[1];let d=i[h];d||(i[h]=d=[]),d.push(c)}}const a=[];for(const o in i)a.push(this.CreateFromMorphTargetSequence(o,i[o],t,n));return a}static parseAnimation(e,t){if(console.warn("THREE.AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(h,d,f,m,_){if(f.length!==0){const g=[],p=[];Sh(f,g,p,m),g.length!==0&&_.push(new h(d,g,p))}},i=[],s=e.name||"default",a=e.fps||30,o=e.blendMode;let l=e.length||-1;const c=e.hierarchy||[];for(let h=0;h<c.length;h++){const d=c[h].keys;if(!(!d||d.length===0))if(d[0].morphTargets){const f={};let m;for(m=0;m<d.length;m++)if(d[m].morphTargets)for(let _=0;_<d[m].morphTargets.length;_++)f[d[m].morphTargets[_]]=-1;for(const _ in f){const g=[],p=[];for(let M=0;M!==d[m].morphTargets.length;++M){const E=d[m];g.push(E.time),p.push(E.morphTarget===_?1:0)}i.push(new va(".morphTargetInfluence["+_+"]",g,p))}l=f.length*a}else{const f=".bones["+t[h].name+"]";n(Fr,f+".position",d,"pos",i),n(fs,f+".quaternion",d,"rot",i),n(Fr,f+".scale",d,"scl",i)}}return i.length===0?null:new this(s,l,i,o)}resetDuration(){const e=this.tracks;let t=0;for(let n=0,i=e.length;n!==i;++n){const s=this.tracks[n];t=Math.max(t,s.times[s.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){const e=[];for(let t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new this.constructor(this.name,this.duration,e,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function Lp(r){switch(r.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return va;case"vector":case"vector2":case"vector3":case"vector4":return Fr;case"color":return Mh;case"quaternion":return fs;case"bool":case"boolean":return kr;case"string":return zr}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+r)}function Up(r){if(r.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=Lp(r.type);if(r.times===void 0){const t=[],n=[];Sh(r.keys,t,n,"value"),r.times=t,r.values=n}return e.parse!==void 0?e.parse(r):new e(r.name,r.times,r.values,r.interpolation)}const ya={enabled:!1,files:{},add:function(r,e){this.enabled!==!1&&(this.files[r]=e)},get:function(r){if(this.enabled!==!1)return this.files[r]},remove:function(r){delete this.files[r]},clear:function(){this.files={}}};class Ip{constructor(e,t,n){const i=this;let s=!1,a=0,o=0,l;const c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(u){o++,s===!1&&i.onStart!==void 0&&i.onStart(u,a,o),s=!0},this.itemEnd=function(u){a++,i.onProgress!==void 0&&i.onProgress(u,a,o),a===o&&(s=!1,i.onLoad!==void 0&&i.onLoad())},this.itemError=function(u){i.onError!==void 0&&i.onError(u)},this.resolveURL=function(u){return l?l(u):u},this.setURLModifier=function(u){return l=u,this},this.addHandler=function(u,h){return c.push(u,h),this},this.removeHandler=function(u){const h=c.indexOf(u);return h!==-1&&c.splice(h,2),this},this.getHandler=function(u){for(let h=0,d=c.length;h<d;h+=2){const f=c[h],m=c[h+1];if(f.global&&(f.lastIndex=0),f.test(u))return m}return null}}}const Bl=new Ip;class Hn{constructor(e){this.manager=e!==void 0?e:Bl,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const n=this;return new Promise(function(i,s){n.load(e,i,t,s)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}}Hn.DEFAULT_MATERIAL_NAME="__DEFAULT";const ci={};class Np extends Error{constructor(e,t){super(e),this.response=t}}class Vr extends Hn{constructor(e){super(e),this.mimeType="",this.responseType=""}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=ya.get(e);if(s!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(s),this.manager.itemEnd(e)},0),s;if(ci[e]!==void 0){ci[e].push({onLoad:t,onProgress:n,onError:i});return}ci[e]=[],ci[e].push({onLoad:t,onProgress:n,onError:i});const a=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),o=this.mimeType,l=this.responseType;fetch(a).then(c=>{if(c.status===200||c.status===0){if(c.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;const u=ci[e],h=c.body.getReader(),d=c.headers.get("X-File-Size")||c.headers.get("Content-Length"),f=d?parseInt(d):0,m=f!==0;let _=0;const g=new ReadableStream({start(p){M();function M(){h.read().then(({done:E,value:y})=>{if(E)p.close();else{_+=y.byteLength;const I=new ProgressEvent("progress",{lengthComputable:m,loaded:_,total:f});for(let R=0,C=u.length;R<C;R++){const L=u[R];L.onProgress&&L.onProgress(I)}p.enqueue(y),M()}},E=>{p.error(E)})}}});return new Response(g)}else throw new Np(`fetch for "${c.url}" responded with ${c.status}: ${c.statusText}`,c)}).then(c=>{switch(l){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then(u=>new DOMParser().parseFromString(u,o));case"json":return c.json();default:if(o==="")return c.text();{const h=/charset="?([^;"\s]*)"?/i.exec(o),d=h&&h[1]?h[1].toLowerCase():void 0,f=new TextDecoder(d);return c.arrayBuffer().then(m=>f.decode(m))}}}).then(c=>{ya.add(e,c);const u=ci[e];delete ci[e];for(let h=0,d=u.length;h<d;h++){const f=u[h];f.onLoad&&f.onLoad(c)}}).catch(c=>{const u=ci[e];if(u===void 0)throw this.manager.itemError(e),c;delete ci[e];for(let h=0,d=u.length;h<d;h++){const f=u[h];f.onError&&f.onError(c)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class Fp extends Hn{constructor(e){super(e)}load(e,t,n,i){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,a=ya.get(e);if(a!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(a),s.manager.itemEnd(e)},0),a;const o=cs("img");function l(){u(),ya.add(e,this),t&&t(this),s.manager.itemEnd(e)}function c(h){u(),i&&i(h),s.manager.itemError(e),s.manager.itemEnd(e)}function u(){o.removeEventListener("load",l,!1),o.removeEventListener("error",c,!1)}return o.addEventListener("load",l,!1),o.addEventListener("error",c,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(o.crossOrigin=this.crossOrigin),s.manager.itemStart(e),o.src=e,o}}class Op extends Hn{constructor(e){super(e)}load(e,t,n,i){const s=this,a=new yh,o=new Vr(this.manager);return o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setPath(this.path),o.setWithCredentials(s.withCredentials),o.load(e,function(l){let c;try{c=s.parse(l)}catch(u){if(i!==void 0)i(u);else{console.error(u);return}}c.image!==void 0?a.image=c.image:c.data!==void 0&&(a.image.width=c.width,a.image.height=c.height,a.image.data=c.data),a.wrapS=c.wrapS!==void 0?c.wrapS:kn,a.wrapT=c.wrapT!==void 0?c.wrapT:kn,a.magFilter=c.magFilter!==void 0?c.magFilter:An,a.minFilter=c.minFilter!==void 0?c.minFilter:An,a.anisotropy=c.anisotropy!==void 0?c.anisotropy:1,c.colorSpace!==void 0&&(a.colorSpace=c.colorSpace),c.flipY!==void 0&&(a.flipY=c.flipY),c.format!==void 0&&(a.format=c.format),c.type!==void 0&&(a.type=c.type),c.mipmaps!==void 0&&(a.mipmaps=c.mipmaps,a.minFilter=hi),c.mipmapCount===1&&(a.minFilter=An),c.generateMipmaps!==void 0&&(a.generateMipmaps=c.generateMipmaps),a.needsUpdate=!0,t&&t(a,c)},n,i),a}}class kl extends Hn{constructor(e){super(e)}load(e,t,n,i){const s=new an,a=new Fp(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,function(o){s.image=o,s.needsUpdate=!0,t!==void 0&&t(s)},n,i),s}}class ps extends Ft{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new ht(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()),this.target!==void 0&&(t.object.target=this.target.uuid),t}}class Bp extends ps{constructor(e,t,n){super(e,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(Ft.DEFAULT_UP),this.updateMatrix(),this.groundColor=new ht(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}}const io=new ut,Gc=new k,Wc=new k;class zl{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new dt(512,512),this.mapType=Jn,this.map=null,this.mapPass=null,this.matrix=new ut,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Nl,this._frameExtents=new dt(1,1),this._viewportCount=1,this._viewports=[new St(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;Gc.setFromMatrixPosition(e.matrixWorld),t.position.copy(Gc),Wc.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(Wc),t.updateMatrixWorld(),io.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(io),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(io)}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.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.normalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.intensity!==1&&(e.intensity=this.intensity),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 kp extends zl{constructor(){super(new sn(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){const t=this.camera,n=Ir*2*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height*this.aspect,s=e.distance||t.far;(n!==t.fov||i!==t.aspect||s!==t.far)&&(t.fov=n,t.aspect=i,t.far=s,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class zp extends ps{constructor(e,t,n=0,i=Math.PI/3,s=0,a=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(Ft.DEFAULT_UP),this.updateMatrix(),this.target=new Ft,this.distance=n,this.angle=i,this.penumbra=s,this.decay=a,this.map=null,this.shadow=new kp}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 Xc=new ut,Jr=new k,ro=new k;class Vp extends zl{constructor(){super(new sn(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new dt(4,2),this._viewportCount=6,this._viewports=[new St(2,1,1,1),new St(0,1,1,1),new St(3,1,1,1),new St(1,1,1,1),new St(3,0,1,1),new St(1,0,1,1)],this._cubeDirections=[new k(1,0,0),new k(-1,0,0),new k(0,0,1),new k(0,0,-1),new k(0,1,0),new k(0,-1,0)],this._cubeUps=[new k(0,1,0),new k(0,1,0),new k(0,1,0),new k(0,1,0),new k(0,0,1),new k(0,0,-1)]}updateMatrices(e,t=0){const n=this.camera,i=this.matrix,s=e.distance||n.far;s!==n.far&&(n.far=s,n.updateProjectionMatrix()),Jr.setFromMatrixPosition(e.matrixWorld),n.position.copy(Jr),ro.copy(n.position),ro.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(ro),n.updateMatrixWorld(),i.makeTranslation(-Jr.x,-Jr.y,-Jr.z),Xc.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Xc)}}class bh extends ps{constructor(e,t,n=0,i=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=i,this.shadow=new Vp}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 Ta extends ph{constructor(e=-1,t=1,n=1,i=-1,s=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=i,this.near=s,this.far=a,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,n,i,s,a){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=n,this.view.offsetY=i,this.view.width=s,this.view.height=a,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),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let s=n-e,a=n+e,o=i+t,l=i-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;s+=c*this.view.offsetX,a=s+c*this.view.width,o-=u*this.view.offsetY,l=o-u*this.view.height}this.projectionMatrix.makeOrthographic(s,a,o,l,this.near,this.far,this.coordinateSystem),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}}class Hp extends zl{constructor(){super(new Ta(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class Eh extends ps{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(Ft.DEFAULT_UP),this.updateMatrix(),this.target=new Ft,this.shadow=new Hp}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class Th extends ps{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class Vl{static extractUrlBase(e){const t=e.lastIndexOf("/");return t===-1?"./":e.slice(0,t+1)}static resolveURL(e,t){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}}class Gp extends Vt{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}toJSON(){const e=super.toJSON();return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}class Wp extends sn{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}class Xp{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=qc(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const t=qc();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function qc(){return performance.now()}class cl extends gh{constructor(e,t,n=1){super(e,t),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=n}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){const t=super.clone(e);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(e){const t=super.toJSON(e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}}const jc=new ut;class qp{constructor(e,t,n=0,i=1/0){this.ray=new Or(e,t),this.near=n,this.far=i,this.camera=null,this.layers=new Pl,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster: Unsupported camera type: "+t.type)}setFromXRController(e){return jc.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(jc),this}intersectObject(e,t=!0,n=[]){return ul(e,this,n,t),n.sort(Yc),n}intersectObjects(e,t=!0,n=[]){for(let i=0,s=e.length;i<s;i++)ul(e[i],this,n,t);return n.sort(Yc),n}}function Yc(r,e){return r.distance-e.distance}function ul(r,e,t,n){let i=!0;if(r.layers.test(e.layers)&&r.raycast(e,t)===!1&&(i=!1),i===!0&&n===!0){const s=r.children;for(let a=0,o=s.length;a<o;a++)ul(s[a],e,t,!0)}}class wh{constructor(e=1,t=0,n=0){this.radius=e,this.phi=t,this.theta=n}set(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=yt(this.phi,1e-6,Math.PI-1e-6),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(yt(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}const Kc=new k,Ws=new k;class jp{constructor(e=new k,t=new k){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){Kc.subVectors(e,this.start),Ws.subVectors(this.end,this.start);const n=Ws.dot(Ws);let s=Ws.dot(Kc)/n;return t&&(s=yt(s,0,1)),s}closestPointToPoint(e,t,n){const i=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(i).add(this.start)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}class Yp extends Zi{constructor(e,t=null){super(),this.object=e,this.domElement=t,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(e){if(e===void 0){console.warn("THREE.Controls: connect() now requires an element.");return}this.domElement!==null&&this.disconnect(),this.domElement=e}disconnect(){}dispose(){}update(){}}function $c(r,e,t,n){const i=Kp(n);switch(t){case nh:return r*e;case rh:return r*e/i.components*i.byteLength;case El:return r*e/i.components*i.byteLength;case sh:return r*e*2/i.components*i.byteLength;case Tl:return r*e*2/i.components*i.byteLength;case ih:return r*e*3/i.components*i.byteLength;case In:return r*e*4/i.components*i.byteLength;case wl:return r*e*4/i.components*i.byteLength;case na:case ia:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*8;case ra:case sa:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case Io:case Fo:return Math.max(r,16)*Math.max(e,8)/4;case Uo:case No:return Math.max(r,8)*Math.max(e,8)/2;case Oo:case Bo:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*8;case ko:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case zo:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case Vo:return Math.floor((r+4)/5)*Math.floor((e+3)/4)*16;case Ho:return Math.floor((r+4)/5)*Math.floor((e+4)/5)*16;case Go:return Math.floor((r+5)/6)*Math.floor((e+4)/5)*16;case Wo:return Math.floor((r+5)/6)*Math.floor((e+5)/6)*16;case Xo:return Math.floor((r+7)/8)*Math.floor((e+4)/5)*16;case qo:return Math.floor((r+7)/8)*Math.floor((e+5)/6)*16;case jo:return Math.floor((r+7)/8)*Math.floor((e+7)/8)*16;case Yo:return Math.floor((r+9)/10)*Math.floor((e+4)/5)*16;case Ko:return Math.floor((r+9)/10)*Math.floor((e+5)/6)*16;case $o:return Math.floor((r+9)/10)*Math.floor((e+7)/8)*16;case Jo:return Math.floor((r+9)/10)*Math.floor((e+9)/10)*16;case Zo:return Math.floor((r+11)/12)*Math.floor((e+9)/10)*16;case Qo:return Math.floor((r+11)/12)*Math.floor((e+11)/12)*16;case aa:case el:case tl:return Math.ceil(r/4)*Math.ceil(e/4)*16;case ah:case nl:return Math.ceil(r/4)*Math.ceil(e/4)*8;case il:case rl:return Math.ceil(r/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function Kp(r){switch(r){case Jn:case Qu:return{byteLength:1,components:1};case ss:case eh:case hs:return{byteLength:2,components:1};case Ml:case bl:return{byteLength:2,components:4};case $i:case Sl:case Yn:return{byteLength:4,components:1};case th:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${r}.`)}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:xl}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=xl);/**
|
|
44
|
+
`},i=new Br(5,5,5),s=new gi({name:"CubemapFromEquirect",uniforms:Nr(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:_n,blending:Ai});s.uniforms.tEquirect.value=t;const a=new Ut(i,s),o=t.minFilter;return t.minFilter===hi&&(t.minFilter=An),new dp(1,10,this).update(e,a),t.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(e,t=!0,n=!0,i=!0){const s=e.getRenderTarget();for(let a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,n,i);e.setRenderTarget(s)}}class fi extends Ft{constructor(){super(),this.isGroup=!0,this.type="Group"}}const pp={type:"move"};class Ja{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new fi,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 fi,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new k,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new k),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new fi,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new k,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new k),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}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data: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,n){let i=null,s=null,a=null;const o=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){a=!0;for(const _ of e.hand.values()){const g=t.getJointPose(_,n),p=this._getHandJoint(c,_);g!==null&&(p.matrix.fromArray(g.transform.matrix),p.matrix.decompose(p.position,p.rotation,p.scale),p.matrixWorldNeedsUpdate=!0,p.jointRadius=g.radius),p.visible=g!==null}const u=c.joints["index-finger-tip"],h=c.joints["thumb-tip"],d=u.position.distanceTo(h.position),f=.02,m=.005;c.inputState.pinching&&d>f+m?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&d<=f-m&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,n),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1));o!==null&&(i=t.getPose(e.targetRaySpace,n),i===null&&s!==null&&(i=s),i!==null&&(o.matrix.fromArray(i.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,i.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(i.linearVelocity)):o.hasLinearVelocity=!1,i.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(i.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(pp)))}return o!==null&&(o.visible=i!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new fi;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}class Ll extends Ft{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new bn,this.environmentIntensity=1,this.environmentRotation=new bn,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__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()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}class gh{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=al,this.updateRanges=[],this.version=0,this.uuid=zn()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}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,n){e*=this.stride,n*=t.stride;for(let i=0,s=this.stride;i<s;i++)this.array[e+i]=t.array[n+i];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=zn()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=zn()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}const mn=new k;class Kn{constructor(e,t,n,i=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=i}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,n=this.data.count;t<n;t++)mn.fromBufferAttribute(this,t),mn.applyMatrix4(e),this.setXYZ(t,mn.x,mn.y,mn.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)mn.fromBufferAttribute(this,t),mn.applyNormalMatrix(e),this.setXYZ(t,mn.x,mn.y,mn.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)mn.fromBufferAttribute(this,t),mn.transformDirection(e),this.setXYZ(t,mn.x,mn.y,mn.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=Bn(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Lt(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=Lt(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=Lt(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=Lt(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=Lt(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=Bn(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=Bn(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=Bn(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=Bn(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=Lt(t,this.array),n=Lt(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=Lt(t,this.array),n=Lt(n,this.array),i=Lt(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this}setXYZW(e,t,n,i,s){return e=e*this.data.stride+this.offset,this.normalized&&(t=Lt(t,this.array),n=Lt(n,this.array),i=Lt(i,this.array),s=Lt(s,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this.data.array[e+3]=s,this}clone(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const i=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[i+s])}return new Xt(new this.array.constructor(t),this.itemSize,this.normalized)}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new Kn(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const i=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[i+s])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}class Ma extends Vn{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new ht(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}let _r;const jr=new k,vr=new k,yr=new k,xr=new dt,Yr=new dt,_h=new ut,Is=new k,Kr=new k,Ns=new k,wc=new dt,Za=new dt,Ac=new dt;class Ul extends Ft{constructor(e=new Ma){if(super(),this.isSprite=!0,this.type="Sprite",_r===void 0){_r=new Vt;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),n=new gh(t,5);_r.setIndex([0,1,2,0,2,3]),_r.setAttribute("position",new Kn(n,3,0,!1)),_r.setAttribute("uv",new Kn(n,2,3,!1))}this.geometry=_r,this.material=e,this.center=new dt(.5,.5),this.count=1}raycast(e,t){e.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),vr.setFromMatrixScale(this.matrixWorld),_h.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),yr.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&vr.multiplyScalar(-yr.z);const n=this.material.rotation;let i,s;n!==0&&(s=Math.cos(n),i=Math.sin(n));const a=this.center;Fs(Is.set(-.5,-.5,0),yr,a,vr,i,s),Fs(Kr.set(.5,-.5,0),yr,a,vr,i,s),Fs(Ns.set(.5,.5,0),yr,a,vr,i,s),wc.set(0,0),Za.set(1,0),Ac.set(1,1);let o=e.ray.intersectTriangle(Is,Kr,Ns,!1,jr);if(o===null&&(Fs(Kr.set(-.5,.5,0),yr,a,vr,i,s),Za.set(0,1),o=e.ray.intersectTriangle(Is,Ns,Kr,!1,jr),o===null))return;const l=e.ray.origin.distanceTo(jr);l<e.near||l>e.far||t.push({distance:l,point:jr.clone(),uv:Un.getInterpolation(jr,Is,Kr,Ns,wc,Za,Ac,new dt),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function Fs(r,e,t,n,i,s){xr.subVectors(r,t).addScalar(.5).multiply(n),i!==void 0?(Yr.x=s*xr.x-i*xr.y,Yr.y=i*xr.x+s*xr.y):Yr.copy(xr),r.copy(e),r.x+=Yr.x,r.y+=Yr.y,r.applyMatrix4(_h)}const Rc=new k,Cc=new St,Pc=new St,mp=new k,Dc=new ut,Os=new k,Qa=new _i,Lc=new ut,eo=new Or;class gp extends Ut{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=nc,this.bindMatrix=new ut,this.bindMatrixInverse=new ut,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new Zn),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,Os),this.boundingBox.expandByPoint(Os)}computeBoundingSphere(){const e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new _i),this.boundingSphere.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,Os),this.boundingSphere.expandByPoint(Os)}copy(e,t){return super.copy(e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}raycast(e,t){const n=this.material,i=this.matrixWorld;n!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),Qa.copy(this.boundingSphere),Qa.applyMatrix4(i),e.ray.intersectsSphere(Qa)!==!1&&(Lc.copy(i).invert(),eo.copy(e.ray).applyMatrix4(Lc),!(this.boundingBox!==null&&eo.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(e,t,eo)))}getVertexPosition(e,t){return super.getVertexPosition(e,t),this.applyBoneTransform(e,t),t}bind(e,t){this.skeleton=e,t===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const e=new St,t=this.geometry.attributes.skinWeight;for(let n=0,i=t.count;n<i;n++){e.fromBufferAttribute(t,n);const s=1/e.manhattanLength();s!==1/0?e.multiplyScalar(s):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===nc?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===df?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){const n=this.skeleton,i=this.geometry;Cc.fromBufferAttribute(i.attributes.skinIndex,e),Pc.fromBufferAttribute(i.attributes.skinWeight,e),Rc.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let s=0;s<4;s++){const a=Pc.getComponent(s);if(a!==0){const o=Cc.getComponent(s);Dc.multiplyMatrices(n.bones[o].matrixWorld,n.boneInverses[o]),t.addScaledVector(mp.copy(Rc).applyMatrix4(Dc),a)}}return t.applyMatrix4(this.bindMatrixInverse)}}class vh extends Ft{constructor(){super(),this.isBone=!0,this.type="Bone"}}class yh extends an{constructor(e=null,t=1,n=1,i,s,a,o,l,c=Rn,u=Rn,h,d){super(null,a,o,l,c,u,i,s,h,d),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const Uc=new ut,_p=new ut;class Il{constructor(e=[],t=[]){this.uuid=zn(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.init()}init(){const e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(e.length*16),t.length===0)this.calculateInverses();else if(e.length!==t.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let n=0,i=this.bones.length;n<i;n++)this.boneInverses.push(new ut)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const n=new ut;this.bones[e]&&n.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(n)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){const n=this.bones[e];n&&n.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){const n=this.bones[e];n&&(n.parent&&n.parent.isBone?(n.matrix.copy(n.parent.matrixWorld).invert(),n.matrix.multiply(n.matrixWorld)):n.matrix.copy(n.matrixWorld),n.matrix.decompose(n.position,n.quaternion,n.scale))}}update(){const e=this.bones,t=this.boneInverses,n=this.boneMatrices,i=this.boneTexture;for(let s=0,a=e.length;s<a;s++){const o=e[s]?e[s].matrixWorld:_p;Uc.multiplyMatrices(o,t[s]),Uc.toArray(n,s*16)}i!==null&&(i.needsUpdate=!0)}clone(){return new Il(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const t=new Float32Array(e*e*4);t.set(this.boneMatrices);const n=new yh(t,e,e,In,Yn);return n.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=n,this}getBoneByName(e){for(let t=0,n=this.bones.length;t<n;t++){const i=this.bones[t];if(i.name===e)return i}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let n=0,i=e.bones.length;n<i;n++){const s=e.bones[n];let a=t[s];a===void 0&&(console.warn("THREE.Skeleton: No bone found with UUID:",s),a=new vh),this.bones.push(a),this.boneInverses.push(new ut().fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){const e={metadata:{version:4.7,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const t=this.bones,n=this.boneInverses;for(let i=0,s=t.length;i<s;i++){const a=t[i];e.bones.push(a.uuid);const o=n[i];e.boneInverses.push(o.toArray())}return e}}const to=new k,vp=new k,yp=new gt;class Ti{constructor(e=new k(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,n,i){return this.normal.set(e,t,n),this.constant=i,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){const i=to.subVectors(n,t).cross(vp.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,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(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){const n=e.delta(to),i=this.normal.dot(n);if(i===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/i;return s<0||s>1?null:t.copy(e.start).addScaledVector(n,s)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<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 n=t||yp.getNormalMatrix(e),i=this.coplanarPoint(to).applyMatrix4(e),s=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(s),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 Oi=new _i,Bs=new k;class Nl{constructor(e=new Ti,t=new Ti,n=new Ti,i=new Ti,s=new Ti,a=new Ti){this.planes=[e,t,n,i,s,a]}set(e,t,n,i,s,a){const o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(i),o[4].copy(s),o[5].copy(a),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=di){const n=this.planes,i=e.elements,s=i[0],a=i[1],o=i[2],l=i[3],c=i[4],u=i[5],h=i[6],d=i[7],f=i[8],m=i[9],_=i[10],g=i[11],p=i[12],M=i[13],E=i[14],y=i[15];if(n[0].setComponents(l-s,d-c,g-f,y-p).normalize(),n[1].setComponents(l+s,d+c,g+f,y+p).normalize(),n[2].setComponents(l+a,d+u,g+m,y+M).normalize(),n[3].setComponents(l-a,d-u,g-m,y-M).normalize(),n[4].setComponents(l-o,d-h,g-_,y-E).normalize(),t===di)n[5].setComponents(l+o,d+h,g+_,y+E).normalize();else if(t===ma)n[5].setComponents(o,h,_,E).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Oi.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Oi.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Oi)}intersectsSprite(e){return Oi.center.set(0,0,0),Oi.radius=.7071067811865476,Oi.applyMatrix4(e.matrixWorld),this.intersectsSphere(Oi)}intersectsSphere(e){const t=this.planes,n=e.center,i=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(n)<i)return!1;return!0}intersectsBox(e){const t=this.planes;for(let n=0;n<6;n++){const i=t[n];if(Bs.x=i.normal.x>0?e.max.x:e.min.x,Bs.y=i.normal.y>0?e.max.y:e.min.y,Bs.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(Bs)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}class ji extends Vn{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new ht(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const ga=new k,_a=new k,Ic=new ut,$r=new Or,ks=new _i,no=new k,Nc=new k;class Fl extends Ft{constructor(e=new Vt,t=new ji){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[0];for(let i=1,s=t.count;i<s;i++)ga.fromBufferAttribute(t,i-1),_a.fromBufferAttribute(t,i),n[i]=n[i-1],n[i]+=ga.distanceTo(_a);e.setAttribute("lineDistance",new xt(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,s=e.params.Line.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),ks.copy(n.boundingSphere),ks.applyMatrix4(i),ks.radius+=s,e.ray.intersectsSphere(ks)===!1)return;Ic.copy(i).invert(),$r.copy(e.ray).applyMatrix4(Ic);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=this.isLineSegments?2:1,u=n.index,d=n.attributes.position;if(u!==null){const f=Math.max(0,a.start),m=Math.min(u.count,a.start+a.count);for(let _=f,g=m-1;_<g;_+=c){const p=u.getX(_),M=u.getX(_+1),E=zs(this,e,$r,l,p,M,_);E&&t.push(E)}if(this.isLineLoop){const _=u.getX(m-1),g=u.getX(f),p=zs(this,e,$r,l,_,g,m-1);p&&t.push(p)}}else{const f=Math.max(0,a.start),m=Math.min(d.count,a.start+a.count);for(let _=f,g=m-1;_<g;_+=c){const p=zs(this,e,$r,l,_,_+1,_);p&&t.push(p)}if(this.isLineLoop){const _=zs(this,e,$r,l,m-1,f,m-1);_&&t.push(_)}}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=i.length;s<a;s++){const o=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}}function zs(r,e,t,n,i,s,a){const o=r.geometry.attributes.position;if(ga.fromBufferAttribute(o,i),_a.fromBufferAttribute(o,s),t.distanceSqToSegment(ga,_a,no,Nc)>n)return;no.applyMatrix4(r.matrixWorld);const c=e.ray.origin.distanceTo(no);if(!(c<e.near||c>e.far))return{distance:c,point:Nc.clone().applyMatrix4(r.matrixWorld),index:a,face:null,faceIndex:null,barycoord:null,object:r}}const Fc=new k,Oc=new k;class ol extends Fl{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[];for(let i=0,s=t.count;i<s;i+=2)Fc.fromBufferAttribute(t,i),Oc.fromBufferAttribute(t,i+1),n[i]=i===0?0:n[i-1],n[i+1]=n[i]+Fc.distanceTo(Oc);e.setAttribute("lineDistance",new xt(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class qi extends Vn{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new ht(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}const Bc=new ut,ll=new Or,Vs=new _i,Hs=new k;class is extends Ft{constructor(e=new Vt,t=new qi){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,s=e.params.Points.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),Vs.copy(n.boundingSphere),Vs.applyMatrix4(i),Vs.radius+=s,e.ray.intersectsSphere(Vs)===!1)return;Bc.copy(i).invert(),ll.copy(e.ray).applyMatrix4(Bc);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=n.index,h=n.attributes.position;if(c!==null){const d=Math.max(0,a.start),f=Math.min(c.count,a.start+a.count);for(let m=d,_=f;m<_;m++){const g=c.getX(m);Hs.fromBufferAttribute(h,g),kc(Hs,g,l,i,e,t,this)}}else{const d=Math.max(0,a.start),f=Math.min(h.count,a.start+a.count);for(let m=d,_=f;m<_;m++)Hs.fromBufferAttribute(h,m),kc(Hs,m,l,i,e,t,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=i.length;s<a;s++){const o=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}}function kc(r,e,t,n,i,s,a){const o=ll.distanceSqToPoint(r);if(o<t){const l=new k;ll.closestPointToPoint(r,l),l.applyMatrix4(n);const c=i.ray.origin.distanceTo(l);if(c<i.near||c>i.far)return;s.push({distance:c,distanceToRay:Math.sqrt(o),point:l,index:e,face:null,faceIndex:null,barycoord:null,object:a})}}class xp extends an{constructor(e,t,n,i,s,a,o,l,c){super(e,t,n,i,s,a,o,l,c),this.isCanvasTexture=!0,this.needsUpdate=!0}}class xh extends an{constructor(e,t,n=$i,i,s,a,o=Rn,l=Rn,c,u=os,h=1){if(u!==os&&u!==ls)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const d={width:e,height:t,depth:h};super(d,i,s,a,o,l,u,n,c),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new Cl(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}class Ol extends Vt{constructor(e=1,t=1,n=1,i=32,s=1,a=!1,o=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:i,heightSegments:s,openEnded:a,thetaStart:o,thetaLength:l};const c=this;i=Math.floor(i),s=Math.floor(s);const u=[],h=[],d=[],f=[];let m=0;const _=[],g=n/2;let p=0;M(),a===!1&&(e>0&&E(!0),t>0&&E(!1)),this.setIndex(u),this.setAttribute("position",new xt(h,3)),this.setAttribute("normal",new xt(d,3)),this.setAttribute("uv",new xt(f,2));function M(){const y=new k,I=new k;let R=0;const C=(t-e)/n;for(let L=0;L<=s;L++){const b=[],x=L/s,w=x*(t-e)+e;for(let B=0;B<=i;B++){const z=B/i,X=z*l+o,j=Math.sin(X),O=Math.cos(X);I.x=w*j,I.y=-x*n+g,I.z=w*O,h.push(I.x,I.y,I.z),y.set(j,C,O).normalize(),d.push(y.x,y.y,y.z),f.push(z,1-x),b.push(m++)}_.push(b)}for(let L=0;L<i;L++)for(let b=0;b<s;b++){const x=_[b][L],w=_[b+1][L],B=_[b+1][L+1],z=_[b][L+1];(e>0||b!==0)&&(u.push(x,w,z),R+=3),(t>0||b!==s-1)&&(u.push(w,B,z),R+=3)}c.addGroup(p,R,0),p+=R}function E(y){const I=m,R=new dt,C=new k;let L=0;const b=y===!0?e:t,x=y===!0?1:-1;for(let B=1;B<=i;B++)h.push(0,g*x,0),d.push(0,x,0),f.push(.5,.5),m++;const w=m;for(let B=0;B<=i;B++){const X=B/i*l+o,j=Math.cos(X),O=Math.sin(X);C.x=b*O,C.y=g*x,C.z=b*j,h.push(C.x,C.y,C.z),d.push(0,x,0),R.x=j*.5+.5,R.y=O*.5*x+.5,f.push(R.x,R.y),m++}for(let B=0;B<i;B++){const z=I+B,X=w+B;y===!0?u.push(X,X+1,z):u.push(X+1,X,z),L+=3}c.addGroup(p,L,y===!0?1:2),p+=L}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Ol(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class ds extends Vt{constructor(e=1,t=1,n=1,i=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:i};const s=e/2,a=t/2,o=Math.floor(n),l=Math.floor(i),c=o+1,u=l+1,h=e/o,d=t/l,f=[],m=[],_=[],g=[];for(let p=0;p<u;p++){const M=p*d-a;for(let E=0;E<c;E++){const y=E*h-s;m.push(y,-M,0),_.push(0,0,1),g.push(E/o),g.push(1-p/l)}}for(let p=0;p<l;p++)for(let M=0;M<o;M++){const E=M+c*p,y=M+c*(p+1),I=M+1+c*(p+1),R=M+1+c*p;f.push(E,y,R),f.push(y,I,R)}this.setIndex(f),this.setAttribute("position",new xt(m,3)),this.setAttribute("normal",new xt(_,3)),this.setAttribute("uv",new xt(g,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ds(e.width,e.height,e.widthSegments,e.heightSegments)}}class ba extends Vt{constructor(e=1,t=32,n=16,i=0,s=Math.PI*2,a=0,o=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:i,phiLength:s,thetaStart:a,thetaLength:o},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));const l=Math.min(a+o,Math.PI);let c=0;const u=[],h=new k,d=new k,f=[],m=[],_=[],g=[];for(let p=0;p<=n;p++){const M=[],E=p/n;let y=0;p===0&&a===0?y=.5/t:p===n&&l===Math.PI&&(y=-.5/t);for(let I=0;I<=t;I++){const R=I/t;h.x=-e*Math.cos(i+R*s)*Math.sin(a+E*o),h.y=e*Math.cos(a+E*o),h.z=e*Math.sin(i+R*s)*Math.sin(a+E*o),m.push(h.x,h.y,h.z),d.copy(h).normalize(),_.push(d.x,d.y,d.z),g.push(R+y,1-E),M.push(c++)}u.push(M)}for(let p=0;p<n;p++)for(let M=0;M<t;M++){const E=u[p][M+1],y=u[p][M],I=u[p+1][M],R=u[p+1][M+1];(p!==0||a>0)&&f.push(E,y,R),(p!==n-1||l<Math.PI)&&f.push(y,I,R)}this.setIndex(f),this.setAttribute("position",new xt(m,3)),this.setAttribute("normal",new xt(_,3)),this.setAttribute("uv",new xt(g,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ba(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class Sp extends Vt{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){const t=[],n=new Set,i=new k,s=new k;if(e.index!==null){const a=e.attributes.position,o=e.index;let l=e.groups;l.length===0&&(l=[{start:0,count:o.count,materialIndex:0}]);for(let c=0,u=l.length;c<u;++c){const h=l[c],d=h.start,f=h.count;for(let m=d,_=d+f;m<_;m+=3)for(let g=0;g<3;g++){const p=o.getX(m+g),M=o.getX(m+(g+1)%3);i.fromBufferAttribute(a,p),s.fromBufferAttribute(a,M),zc(i,s,n)===!0&&(t.push(i.x,i.y,i.z),t.push(s.x,s.y,s.z))}}}else{const a=e.attributes.position;for(let o=0,l=a.count/3;o<l;o++)for(let c=0;c<3;c++){const u=3*o+c,h=3*o+(c+1)%3;i.fromBufferAttribute(a,u),s.fromBufferAttribute(a,h),zc(i,s,n)===!0&&(t.push(i.x,i.y,i.z),t.push(s.x,s.y,s.z))}}this.setAttribute("position",new xt(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}function zc(r,e,t){const n=`${r.x},${r.y},${r.z}-${e.x},${e.y},${e.z}`,i=`${e.x},${e.y},${e.z}-${r.x},${r.y},${r.z}`;return t.has(n)===!0||t.has(i)===!0?!1:(t.add(n),t.add(i),!0)}class Sn extends Vn{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new ht(16777215),this.specular=new ht(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ht(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Al,this.normalScale=new dt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new bn,this.combine=xa,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.envMapRotation.copy(e.envMapRotation),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 Mp extends Vn{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new ht(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ht(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Al,this.normalScale=new dt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new bn,this.combine=xa,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.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.envMapRotation.copy(e.envMapRotation),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 bp extends Vn{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=mf,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 Ep extends Vn{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",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.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}function Gs(r,e){return!r||r.constructor===e?r:typeof e.BYTES_PER_ELEMENT=="number"?new e(r):Array.prototype.slice.call(r)}function Tp(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}function wp(r){function e(i,s){return r[i]-r[s]}const t=r.length,n=new Array(t);for(let i=0;i!==t;++i)n[i]=i;return n.sort(e),n}function Vc(r,e,t){const n=r.length,i=new r.constructor(n);for(let s=0,a=0;a!==n;++s){const o=t[s]*e;for(let l=0;l!==e;++l)i[a++]=r[o+l]}return i}function Sh(r,e,t,n){let i=1,s=r[0];for(;s!==void 0&&s[n]===void 0;)s=r[i++];if(s===void 0)return;let a=s[n];if(a!==void 0)if(Array.isArray(a))do a=s[n],a!==void 0&&(e.push(s.time),t.push(...a)),s=r[i++];while(s!==void 0);else if(a.toArray!==void 0)do a=s[n],a!==void 0&&(e.push(s.time),a.toArray(t,t.length)),s=r[i++];while(s!==void 0);else do a=s[n],a!==void 0&&(e.push(s.time),t.push(a)),s=r[i++];while(s!==void 0)}class Ea{constructor(e,t,n,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=i!==void 0?i:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let n=this._cachedIndex,i=t[n],s=t[n-1];n:{e:{let a;t:{i:if(!(e<i)){for(let o=n+2;;){if(i===void 0){if(e<s)break i;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===o)break;if(s=i,i=t[++n],e<i)break e}a=t.length;break t}if(!(e>=s)){const o=t[1];e<o&&(n=2,s=o);for(let l=n-2;;){if(s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===l)break;if(i=s,s=t[--n-1],e>=s)break e}a=n,n=0;break t}break n}for(;n<a;){const o=n+a>>>1;e<t[o]?a=o:n=o+1}if(i=t[n],s=t[n-1],s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===void 0)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,s,i)}return this.interpolate_(n,s,e,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,s=e*i;for(let a=0;a!==i;++a)t[a]=n[s+a];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class Ap extends Ea{constructor(e,t,n,i){super(e,t,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:ic,endingEnd:ic}}intervalChanged_(e,t,n){const i=this.parameterPositions;let s=e-2,a=e+1,o=i[s],l=i[a];if(o===void 0)switch(this.getSettings_().endingStart){case rc:s=e,o=2*t-n;break;case sc:s=i.length-2,o=t+i[s]-i[s+1];break;default:s=e,o=n}if(l===void 0)switch(this.getSettings_().endingEnd){case rc:a=e,l=2*n-t;break;case sc:a=1,l=n+i[1]-i[0];break;default:a=e-1,l=t}const c=(n-t)*.5,u=this.valueSize;this._weightPrev=c/(t-o),this._weightNext=c/(l-n),this._offsetPrev=s*u,this._offsetNext=a*u}interpolate_(e,t,n,i){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=e*o,c=l-o,u=this._offsetPrev,h=this._offsetNext,d=this._weightPrev,f=this._weightNext,m=(n-t)/(i-t),_=m*m,g=_*m,p=-d*g+2*d*_-d*m,M=(1+d)*g+(-1.5-2*d)*_+(-.5+d)*m+1,E=(-1-f)*g+(1.5+f)*_+.5*m,y=f*g-f*_;for(let I=0;I!==o;++I)s[I]=p*a[u+I]+M*a[c+I]+E*a[l+I]+y*a[h+I];return s}}class Rp extends Ea{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=e*o,c=l-o,u=(n-t)/(i-t),h=1-u;for(let d=0;d!==o;++d)s[d]=a[c+d]*h+a[l+d]*u;return s}}class Cp extends Ea{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e){return this.copySampleValue_(e-1)}}class Gn{constructor(e,t,n,i){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=Gs(t,this.TimeBufferType),this.values=Gs(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(e){const t=e.constructor;let n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:Gs(e.times,Array),values:Gs(e.values,Array)};const i=e.getInterpolation();i!==e.DefaultInterpolation&&(n.interpolation=i)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new Cp(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new Rp(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new Ap(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case fa:t=this.InterpolantFactoryMethodDiscrete;break;case sl:t=this.InterpolantFactoryMethodLinear;break;case Pa:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){const n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(n);return console.warn("THREE.KeyframeTrack:",n),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return fa;case this.InterpolantFactoryMethodLinear:return sl;case this.InterpolantFactoryMethodSmooth:return Pa}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]+=e}return this}scale(e){if(e!==1){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]*=e}return this}trim(e,t){const n=this.times,i=n.length;let s=0,a=i-1;for(;s!==i&&n[s]<e;)++s;for(;a!==-1&&n[a]>t;)--a;if(++a,s!==0||a!==i){s>=a&&(a=Math.max(a,1),s=a-1);const o=this.getValueSize();this.times=n.slice(s,a),this.values=this.values.slice(s*o,a*o)}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 n=this.times,i=this.values,s=n.length;s===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let a=null;for(let o=0;o!==s;o++){const l=n[o];if(typeof l=="number"&&isNaN(l)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,l),e=!1;break}if(a!==null&&a>l){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,l,a),e=!1;break}a=l}if(i!==void 0&&Tp(i))for(let o=0,l=i.length;o!==l;++o){const c=i[o];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,o,c),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===Pa,s=e.length-1;let a=1;for(let o=1;o<s;++o){let l=!1;const c=e[o],u=e[o+1];if(c!==u&&(o!==1||c!==e[0]))if(i)l=!0;else{const h=o*n,d=h-n,f=h+n;for(let m=0;m!==n;++m){const _=t[h+m];if(_!==t[d+m]||_!==t[f+m]){l=!0;break}}}if(l){if(o!==a){e[a]=e[o];const h=o*n,d=a*n;for(let f=0;f!==n;++f)t[d+f]=t[h+f]}++a}}if(s>0){e[a]=e[s];for(let o=s*n,l=a*n,c=0;c!==n;++c)t[l+c]=t[o+c];++a}return a!==e.length?(this.times=e.slice(0,a),this.values=t.slice(0,a*n)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),n=this.constructor,i=new n(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}Gn.prototype.ValueTypeName="";Gn.prototype.TimeBufferType=Float32Array;Gn.prototype.ValueBufferType=Float32Array;Gn.prototype.DefaultInterpolation=sl;class kr extends Gn{constructor(e,t,n){super(e,t,n)}}kr.prototype.ValueTypeName="bool";kr.prototype.ValueBufferType=Array;kr.prototype.DefaultInterpolation=fa;kr.prototype.InterpolantFactoryMethodLinear=void 0;kr.prototype.InterpolantFactoryMethodSmooth=void 0;class Mh extends Gn{constructor(e,t,n,i){super(e,t,n,i)}}Mh.prototype.ValueTypeName="color";class va extends Gn{constructor(e,t,n,i){super(e,t,n,i)}}va.prototype.ValueTypeName="number";class Pp extends Ea{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=(n-t)/(i-t);let c=e*o;for(let u=c+o;c!==u;c+=4)Cn.slerpFlat(s,0,a,c-o,a,c,l);return s}}class fs extends Gn{constructor(e,t,n,i){super(e,t,n,i)}InterpolantFactoryMethodLinear(e){return new Pp(this.times,this.values,this.getValueSize(),e)}}fs.prototype.ValueTypeName="quaternion";fs.prototype.InterpolantFactoryMethodSmooth=void 0;class zr extends Gn{constructor(e,t,n){super(e,t,n)}}zr.prototype.ValueTypeName="string";zr.prototype.ValueBufferType=Array;zr.prototype.DefaultInterpolation=fa;zr.prototype.InterpolantFactoryMethodLinear=void 0;zr.prototype.InterpolantFactoryMethodSmooth=void 0;class Fr extends Gn{constructor(e,t,n,i){super(e,t,n,i)}}Fr.prototype.ValueTypeName="vector";class Hc{constructor(e="",t=-1,n=[],i=pf){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=zn(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,i=1/(e.fps||1);for(let a=0,o=n.length;a!==o;++a)t.push(Lp(n[a]).scale(i));const s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s}static toJSON(e){const t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let s=0,a=n.length;s!==a;++s)t.push(Gn.toJSON(n[s]));return i}static CreateFromMorphTargetSequence(e,t,n,i){const s=t.length,a=[];for(let o=0;o<s;o++){let l=[],c=[];l.push((o+s-1)%s,o,(o+1)%s),c.push(0,1,0);const u=wp(l);l=Vc(l,1,u),c=Vc(c,1,u),!i&&l[0]===0&&(l.push(s),c.push(c[0])),a.push(new va(".morphTargetInfluences["+t[o].name+"]",l,c).scale(1/n))}return new this(e,-1,a)}static findByName(e,t){let n=e;if(!Array.isArray(e)){const i=e;n=i.geometry&&i.geometry.animations||i.animations}for(let i=0;i<n.length;i++)if(n[i].name===t)return n[i];return null}static CreateClipsFromMorphTargetSequences(e,t,n){const i={},s=/^([\w-]*?)([\d]+)$/;for(let o=0,l=e.length;o<l;o++){const c=e[o],u=c.name.match(s);if(u&&u.length>1){const h=u[1];let d=i[h];d||(i[h]=d=[]),d.push(c)}}const a=[];for(const o in i)a.push(this.CreateFromMorphTargetSequence(o,i[o],t,n));return a}static parseAnimation(e,t){if(console.warn("THREE.AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(h,d,f,m,_){if(f.length!==0){const g=[],p=[];Sh(f,g,p,m),g.length!==0&&_.push(new h(d,g,p))}},i=[],s=e.name||"default",a=e.fps||30,o=e.blendMode;let l=e.length||-1;const c=e.hierarchy||[];for(let h=0;h<c.length;h++){const d=c[h].keys;if(!(!d||d.length===0))if(d[0].morphTargets){const f={};let m;for(m=0;m<d.length;m++)if(d[m].morphTargets)for(let _=0;_<d[m].morphTargets.length;_++)f[d[m].morphTargets[_]]=-1;for(const _ in f){const g=[],p=[];for(let M=0;M!==d[m].morphTargets.length;++M){const E=d[m];g.push(E.time),p.push(E.morphTarget===_?1:0)}i.push(new va(".morphTargetInfluence["+_+"]",g,p))}l=f.length*a}else{const f=".bones["+t[h].name+"]";n(Fr,f+".position",d,"pos",i),n(fs,f+".quaternion",d,"rot",i),n(Fr,f+".scale",d,"scl",i)}}return i.length===0?null:new this(s,l,i,o)}resetDuration(){const e=this.tracks;let t=0;for(let n=0,i=e.length;n!==i;++n){const s=this.tracks[n];t=Math.max(t,s.times[s.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){const e=[];for(let t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new this.constructor(this.name,this.duration,e,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function Dp(r){switch(r.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return va;case"vector":case"vector2":case"vector3":case"vector4":return Fr;case"color":return Mh;case"quaternion":return fs;case"bool":case"boolean":return kr;case"string":return zr}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+r)}function Lp(r){if(r.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=Dp(r.type);if(r.times===void 0){const t=[],n=[];Sh(r.keys,t,n,"value"),r.times=t,r.values=n}return e.parse!==void 0?e.parse(r):new e(r.name,r.times,r.values,r.interpolation)}const ya={enabled:!1,files:{},add:function(r,e){this.enabled!==!1&&(this.files[r]=e)},get:function(r){if(this.enabled!==!1)return this.files[r]},remove:function(r){delete this.files[r]},clear:function(){this.files={}}};class Up{constructor(e,t,n){const i=this;let s=!1,a=0,o=0,l;const c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(u){o++,s===!1&&i.onStart!==void 0&&i.onStart(u,a,o),s=!0},this.itemEnd=function(u){a++,i.onProgress!==void 0&&i.onProgress(u,a,o),a===o&&(s=!1,i.onLoad!==void 0&&i.onLoad())},this.itemError=function(u){i.onError!==void 0&&i.onError(u)},this.resolveURL=function(u){return l?l(u):u},this.setURLModifier=function(u){return l=u,this},this.addHandler=function(u,h){return c.push(u,h),this},this.removeHandler=function(u){const h=c.indexOf(u);return h!==-1&&c.splice(h,2),this},this.getHandler=function(u){for(let h=0,d=c.length;h<d;h+=2){const f=c[h],m=c[h+1];if(f.global&&(f.lastIndex=0),f.test(u))return m}return null}}}const Bl=new Up;class Hn{constructor(e){this.manager=e!==void 0?e:Bl,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const n=this;return new Promise(function(i,s){n.load(e,i,t,s)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}}Hn.DEFAULT_MATERIAL_NAME="__DEFAULT";const ci={};class Ip extends Error{constructor(e,t){super(e),this.response=t}}class Vr extends Hn{constructor(e){super(e),this.mimeType="",this.responseType=""}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=ya.get(e);if(s!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(s),this.manager.itemEnd(e)},0),s;if(ci[e]!==void 0){ci[e].push({onLoad:t,onProgress:n,onError:i});return}ci[e]=[],ci[e].push({onLoad:t,onProgress:n,onError:i});const a=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),o=this.mimeType,l=this.responseType;fetch(a).then(c=>{if(c.status===200||c.status===0){if(c.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;const u=ci[e],h=c.body.getReader(),d=c.headers.get("X-File-Size")||c.headers.get("Content-Length"),f=d?parseInt(d):0,m=f!==0;let _=0;const g=new ReadableStream({start(p){M();function M(){h.read().then(({done:E,value:y})=>{if(E)p.close();else{_+=y.byteLength;const I=new ProgressEvent("progress",{lengthComputable:m,loaded:_,total:f});for(let R=0,C=u.length;R<C;R++){const L=u[R];L.onProgress&&L.onProgress(I)}p.enqueue(y),M()}},E=>{p.error(E)})}}});return new Response(g)}else throw new Ip(`fetch for "${c.url}" responded with ${c.status}: ${c.statusText}`,c)}).then(c=>{switch(l){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then(u=>new DOMParser().parseFromString(u,o));case"json":return c.json();default:if(o==="")return c.text();{const h=/charset="?([^;"\s]*)"?/i.exec(o),d=h&&h[1]?h[1].toLowerCase():void 0,f=new TextDecoder(d);return c.arrayBuffer().then(m=>f.decode(m))}}}).then(c=>{ya.add(e,c);const u=ci[e];delete ci[e];for(let h=0,d=u.length;h<d;h++){const f=u[h];f.onLoad&&f.onLoad(c)}}).catch(c=>{const u=ci[e];if(u===void 0)throw this.manager.itemError(e),c;delete ci[e];for(let h=0,d=u.length;h<d;h++){const f=u[h];f.onError&&f.onError(c)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class Np extends Hn{constructor(e){super(e)}load(e,t,n,i){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,a=ya.get(e);if(a!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(a),s.manager.itemEnd(e)},0),a;const o=cs("img");function l(){u(),ya.add(e,this),t&&t(this),s.manager.itemEnd(e)}function c(h){u(),i&&i(h),s.manager.itemError(e),s.manager.itemEnd(e)}function u(){o.removeEventListener("load",l,!1),o.removeEventListener("error",c,!1)}return o.addEventListener("load",l,!1),o.addEventListener("error",c,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(o.crossOrigin=this.crossOrigin),s.manager.itemStart(e),o.src=e,o}}class Fp extends Hn{constructor(e){super(e)}load(e,t,n,i){const s=this,a=new yh,o=new Vr(this.manager);return o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setPath(this.path),o.setWithCredentials(s.withCredentials),o.load(e,function(l){let c;try{c=s.parse(l)}catch(u){if(i!==void 0)i(u);else{console.error(u);return}}c.image!==void 0?a.image=c.image:c.data!==void 0&&(a.image.width=c.width,a.image.height=c.height,a.image.data=c.data),a.wrapS=c.wrapS!==void 0?c.wrapS:kn,a.wrapT=c.wrapT!==void 0?c.wrapT:kn,a.magFilter=c.magFilter!==void 0?c.magFilter:An,a.minFilter=c.minFilter!==void 0?c.minFilter:An,a.anisotropy=c.anisotropy!==void 0?c.anisotropy:1,c.colorSpace!==void 0&&(a.colorSpace=c.colorSpace),c.flipY!==void 0&&(a.flipY=c.flipY),c.format!==void 0&&(a.format=c.format),c.type!==void 0&&(a.type=c.type),c.mipmaps!==void 0&&(a.mipmaps=c.mipmaps,a.minFilter=hi),c.mipmapCount===1&&(a.minFilter=An),c.generateMipmaps!==void 0&&(a.generateMipmaps=c.generateMipmaps),a.needsUpdate=!0,t&&t(a,c)},n,i),a}}class kl extends Hn{constructor(e){super(e)}load(e,t,n,i){const s=new an,a=new Np(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,function(o){s.image=o,s.needsUpdate=!0,t!==void 0&&t(s)},n,i),s}}class ps extends Ft{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new ht(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()),this.target!==void 0&&(t.object.target=this.target.uuid),t}}class Op extends ps{constructor(e,t,n){super(e,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(Ft.DEFAULT_UP),this.updateMatrix(),this.groundColor=new ht(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}}const io=new ut,Gc=new k,Wc=new k;class zl{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new dt(512,512),this.mapType=Jn,this.map=null,this.mapPass=null,this.matrix=new ut,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Nl,this._frameExtents=new dt(1,1),this._viewportCount=1,this._viewports=[new St(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;Gc.setFromMatrixPosition(e.matrixWorld),t.position.copy(Gc),Wc.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(Wc),t.updateMatrixWorld(),io.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(io),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(io)}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.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.normalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.intensity!==1&&(e.intensity=this.intensity),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 Bp extends zl{constructor(){super(new sn(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){const t=this.camera,n=Ir*2*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height*this.aspect,s=e.distance||t.far;(n!==t.fov||i!==t.aspect||s!==t.far)&&(t.fov=n,t.aspect=i,t.far=s,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class kp extends ps{constructor(e,t,n=0,i=Math.PI/3,s=0,a=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(Ft.DEFAULT_UP),this.updateMatrix(),this.target=new Ft,this.distance=n,this.angle=i,this.penumbra=s,this.decay=a,this.map=null,this.shadow=new Bp}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 Xc=new ut,Jr=new k,ro=new k;class zp extends zl{constructor(){super(new sn(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new dt(4,2),this._viewportCount=6,this._viewports=[new St(2,1,1,1),new St(0,1,1,1),new St(3,1,1,1),new St(1,1,1,1),new St(3,0,1,1),new St(1,0,1,1)],this._cubeDirections=[new k(1,0,0),new k(-1,0,0),new k(0,0,1),new k(0,0,-1),new k(0,1,0),new k(0,-1,0)],this._cubeUps=[new k(0,1,0),new k(0,1,0),new k(0,1,0),new k(0,1,0),new k(0,0,1),new k(0,0,-1)]}updateMatrices(e,t=0){const n=this.camera,i=this.matrix,s=e.distance||n.far;s!==n.far&&(n.far=s,n.updateProjectionMatrix()),Jr.setFromMatrixPosition(e.matrixWorld),n.position.copy(Jr),ro.copy(n.position),ro.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(ro),n.updateMatrixWorld(),i.makeTranslation(-Jr.x,-Jr.y,-Jr.z),Xc.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Xc)}}class bh extends ps{constructor(e,t,n=0,i=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=i,this.shadow=new zp}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 Ta extends ph{constructor(e=-1,t=1,n=1,i=-1,s=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=i,this.near=s,this.far=a,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,n,i,s,a){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=n,this.view.offsetY=i,this.view.width=s,this.view.height=a,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),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let s=n-e,a=n+e,o=i+t,l=i-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;s+=c*this.view.offsetX,a=s+c*this.view.width,o-=u*this.view.offsetY,l=o-u*this.view.height}this.projectionMatrix.makeOrthographic(s,a,o,l,this.near,this.far,this.coordinateSystem),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}}class Vp extends zl{constructor(){super(new Ta(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class Eh extends ps{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(Ft.DEFAULT_UP),this.updateMatrix(),this.target=new Ft,this.shadow=new Vp}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class Th extends ps{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class Vl{static extractUrlBase(e){const t=e.lastIndexOf("/");return t===-1?"./":e.slice(0,t+1)}static resolveURL(e,t){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}}class Hp extends Vt{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}toJSON(){const e=super.toJSON();return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}class Gp extends sn{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}class Wp{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=qc(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const t=qc();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function qc(){return performance.now()}class cl extends gh{constructor(e,t,n=1){super(e,t),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=n}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){const t=super.clone(e);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(e){const t=super.toJSON(e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}}const jc=new ut;class Xp{constructor(e,t,n=0,i=1/0){this.ray=new Or(e,t),this.near=n,this.far=i,this.camera=null,this.layers=new Pl,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster: Unsupported camera type: "+t.type)}setFromXRController(e){return jc.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(jc),this}intersectObject(e,t=!0,n=[]){return ul(e,this,n,t),n.sort(Yc),n}intersectObjects(e,t=!0,n=[]){for(let i=0,s=e.length;i<s;i++)ul(e[i],this,n,t);return n.sort(Yc),n}}function Yc(r,e){return r.distance-e.distance}function ul(r,e,t,n){let i=!0;if(r.layers.test(e.layers)&&r.raycast(e,t)===!1&&(i=!1),i===!0&&n===!0){const s=r.children;for(let a=0,o=s.length;a<o;a++)ul(s[a],e,t,!0)}}class wh{constructor(e=1,t=0,n=0){this.radius=e,this.phi=t,this.theta=n}set(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=yt(this.phi,1e-6,Math.PI-1e-6),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(yt(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}const Kc=new k,Ws=new k;class qp{constructor(e=new k,t=new k){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){Kc.subVectors(e,this.start),Ws.subVectors(this.end,this.start);const n=Ws.dot(Ws);let s=Ws.dot(Kc)/n;return t&&(s=yt(s,0,1)),s}closestPointToPoint(e,t,n){const i=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(i).add(this.start)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}class jp extends Zi{constructor(e,t=null){super(),this.object=e,this.domElement=t,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(e){if(e===void 0){console.warn("THREE.Controls: connect() now requires an element.");return}this.domElement!==null&&this.disconnect(),this.domElement=e}disconnect(){}dispose(){}update(){}}function $c(r,e,t,n){const i=Yp(n);switch(t){case nh:return r*e;case rh:return r*e/i.components*i.byteLength;case El:return r*e/i.components*i.byteLength;case sh:return r*e*2/i.components*i.byteLength;case Tl:return r*e*2/i.components*i.byteLength;case ih:return r*e*3/i.components*i.byteLength;case In:return r*e*4/i.components*i.byteLength;case wl:return r*e*4/i.components*i.byteLength;case na:case ia:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*8;case ra:case sa:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case Io:case Fo:return Math.max(r,16)*Math.max(e,8)/4;case Uo:case No:return Math.max(r,8)*Math.max(e,8)/2;case Oo:case Bo:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*8;case ko:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case zo:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case Vo:return Math.floor((r+4)/5)*Math.floor((e+3)/4)*16;case Ho:return Math.floor((r+4)/5)*Math.floor((e+4)/5)*16;case Go:return Math.floor((r+5)/6)*Math.floor((e+4)/5)*16;case Wo:return Math.floor((r+5)/6)*Math.floor((e+5)/6)*16;case Xo:return Math.floor((r+7)/8)*Math.floor((e+4)/5)*16;case qo:return Math.floor((r+7)/8)*Math.floor((e+5)/6)*16;case jo:return Math.floor((r+7)/8)*Math.floor((e+7)/8)*16;case Yo:return Math.floor((r+9)/10)*Math.floor((e+4)/5)*16;case Ko:return Math.floor((r+9)/10)*Math.floor((e+5)/6)*16;case $o:return Math.floor((r+9)/10)*Math.floor((e+7)/8)*16;case Jo:return Math.floor((r+9)/10)*Math.floor((e+9)/10)*16;case Zo:return Math.floor((r+11)/12)*Math.floor((e+9)/10)*16;case Qo:return Math.floor((r+11)/12)*Math.floor((e+11)/12)*16;case aa:case el:case tl:return Math.ceil(r/4)*Math.ceil(e/4)*16;case ah:case nl:return Math.ceil(r/4)*Math.ceil(e/4)*8;case il:case rl:return Math.ceil(r/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function Yp(r){switch(r){case Jn:case Qu:return{byteLength:1,components:1};case ss:case eh:case hs:return{byteLength:2,components:1};case Ml:case bl:return{byteLength:2,components:4};case $i:case Sl:case Yn:return{byteLength:4,components:1};case th:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${r}.`)}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:xl}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=xl);/**
|
|
45
45
|
* @license
|
|
46
46
|
* Copyright 2010-2025 Three.js Authors
|
|
47
47
|
* SPDX-License-Identifier: MIT
|
|
48
|
-
*/function Ah(){let r=null,e=!1,t=null,n=null;function i(s,a){t(s,a),n=r.requestAnimationFrame(i)}return{start:function(){e!==!0&&t!==null&&(n=r.requestAnimationFrame(i),e=!0)},stop:function(){r.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){r=s}}}function
|
|
48
|
+
*/function Ah(){let r=null,e=!1,t=null,n=null;function i(s,a){t(s,a),n=r.requestAnimationFrame(i)}return{start:function(){e!==!0&&t!==null&&(n=r.requestAnimationFrame(i),e=!0)},stop:function(){r.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){r=s}}}function Kp(r){const e=new WeakMap;function t(o,l){const c=o.array,u=o.usage,h=c.byteLength,d=r.createBuffer();r.bindBuffer(l,d),r.bufferData(l,c,u),o.onUploadCallback();let f;if(c instanceof Float32Array)f=r.FLOAT;else if(c instanceof Uint16Array)o.isFloat16BufferAttribute?f=r.HALF_FLOAT:f=r.UNSIGNED_SHORT;else if(c instanceof Int16Array)f=r.SHORT;else if(c instanceof Uint32Array)f=r.UNSIGNED_INT;else if(c instanceof Int32Array)f=r.INT;else if(c instanceof Int8Array)f=r.BYTE;else if(c instanceof Uint8Array)f=r.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)f=r.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:d,type:f,bytesPerElement:c.BYTES_PER_ELEMENT,version:o.version,size:h}}function n(o,l,c){const u=l.array,h=l.updateRanges;if(r.bindBuffer(c,o),h.length===0)r.bufferSubData(c,0,u);else{h.sort((f,m)=>f.start-m.start);let d=0;for(let f=1;f<h.length;f++){const m=h[d],_=h[f];_.start<=m.start+m.count+1?m.count=Math.max(m.count,_.start+_.count-m.start):(++d,h[d]=_)}h.length=d+1;for(let f=0,m=h.length;f<m;f++){const _=h[f];r.bufferSubData(c,_.start*u.BYTES_PER_ELEMENT,u,_.start,_.count)}l.clearUpdateRanges()}l.onUploadCallback()}function i(o){return o.isInterleavedBufferAttribute&&(o=o.data),e.get(o)}function s(o){o.isInterleavedBufferAttribute&&(o=o.data);const l=e.get(o);l&&(r.deleteBuffer(l.buffer),e.delete(o))}function a(o,l){if(o.isInterleavedBufferAttribute&&(o=o.data),o.isGLBufferAttribute){const u=e.get(o);(!u||u.version<o.version)&&e.set(o,{buffer:o.buffer,type:o.type,bytesPerElement:o.elementSize,version:o.version});return}const c=e.get(o);if(c===void 0)e.set(o,t(o,l));else if(c.version<o.version){if(c.size!==o.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");n(c.buffer,o,l),c.version=o.version}}return{get:i,remove:s,update:a}}var $p=`#ifdef USE_ALPHAHASH
|
|
49
49
|
if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
|
|
50
|
-
#endif`,
|
|
50
|
+
#endif`,Jp=`#ifdef USE_ALPHAHASH
|
|
51
51
|
const float ALPHA_HASH_SCALE = 0.05;
|
|
52
52
|
float hash2D( vec2 value ) {
|
|
53
53
|
return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
|
|
@@ -82,20 +82,20 @@
|
|
|
82
82
|
: cases.z;
|
|
83
83
|
return clamp( threshold , 1.0e-6, 1.0 );
|
|
84
84
|
}
|
|
85
|
-
#endif`,
|
|
85
|
+
#endif`,Zp=`#ifdef USE_ALPHAMAP
|
|
86
86
|
diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
|
|
87
|
-
#endif`,
|
|
87
|
+
#endif`,Qp=`#ifdef USE_ALPHAMAP
|
|
88
88
|
uniform sampler2D alphaMap;
|
|
89
|
-
#endif`,
|
|
89
|
+
#endif`,em=`#ifdef USE_ALPHATEST
|
|
90
90
|
#ifdef ALPHA_TO_COVERAGE
|
|
91
91
|
diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );
|
|
92
92
|
if ( diffuseColor.a == 0.0 ) discard;
|
|
93
93
|
#else
|
|
94
94
|
if ( diffuseColor.a < alphaTest ) discard;
|
|
95
95
|
#endif
|
|
96
|
-
#endif`,
|
|
96
|
+
#endif`,tm=`#ifdef USE_ALPHATEST
|
|
97
97
|
uniform float alphaTest;
|
|
98
|
-
#endif`,
|
|
98
|
+
#endif`,nm=`#ifdef USE_AOMAP
|
|
99
99
|
float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
|
|
100
100
|
reflectedLight.indirectDiffuse *= ambientOcclusion;
|
|
101
101
|
#if defined( USE_CLEARCOAT )
|
|
@@ -108,10 +108,10 @@
|
|
|
108
108
|
float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
|
|
109
109
|
reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
|
|
110
110
|
#endif
|
|
111
|
-
#endif`,
|
|
111
|
+
#endif`,im=`#ifdef USE_AOMAP
|
|
112
112
|
uniform sampler2D aoMap;
|
|
113
113
|
uniform float aoMapIntensity;
|
|
114
|
-
#endif`,
|
|
114
|
+
#endif`,rm=`#ifdef USE_BATCHING
|
|
115
115
|
#if ! defined( GL_ANGLE_multi_draw )
|
|
116
116
|
#define gl_DrawID _gl_DrawID
|
|
117
117
|
uniform int _gl_DrawID;
|
|
@@ -145,15 +145,15 @@
|
|
|
145
145
|
int y = j / size;
|
|
146
146
|
return texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;
|
|
147
147
|
}
|
|
148
|
-
#endif`,
|
|
148
|
+
#endif`,sm=`#ifdef USE_BATCHING
|
|
149
149
|
mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );
|
|
150
|
-
#endif`,
|
|
150
|
+
#endif`,am=`vec3 transformed = vec3( position );
|
|
151
151
|
#ifdef USE_ALPHAHASH
|
|
152
152
|
vPosition = vec3( position );
|
|
153
|
-
#endif`,
|
|
153
|
+
#endif`,om=`vec3 objectNormal = vec3( normal );
|
|
154
154
|
#ifdef USE_TANGENT
|
|
155
155
|
vec3 objectTangent = vec3( tangent.xyz );
|
|
156
|
-
#endif`,
|
|
156
|
+
#endif`,lm=`float G_BlinnPhong_Implicit( ) {
|
|
157
157
|
return 0.25;
|
|
158
158
|
}
|
|
159
159
|
float D_BlinnPhong( const in float shininess, const in float dotNH ) {
|
|
@@ -167,7 +167,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
|
|
|
167
167
|
float G = G_BlinnPhong_Implicit( );
|
|
168
168
|
float D = D_BlinnPhong( shininess, dotNH );
|
|
169
169
|
return F * ( G * D );
|
|
170
|
-
} // validated`,
|
|
170
|
+
} // validated`,cm=`#ifdef USE_IRIDESCENCE
|
|
171
171
|
const mat3 XYZ_TO_REC709 = mat3(
|
|
172
172
|
3.2404542, -0.9692660, 0.0556434,
|
|
173
173
|
-1.5371385, 1.8760108, -0.2040259,
|
|
@@ -230,7 +230,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
|
|
|
230
230
|
}
|
|
231
231
|
return max( I, vec3( 0.0 ) );
|
|
232
232
|
}
|
|
233
|
-
#endif`,
|
|
233
|
+
#endif`,um=`#ifdef USE_BUMPMAP
|
|
234
234
|
uniform sampler2D bumpMap;
|
|
235
235
|
uniform float bumpScale;
|
|
236
236
|
vec2 dHdxy_fwd() {
|
|
@@ -251,7 +251,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
|
|
|
251
251
|
vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
|
|
252
252
|
return normalize( abs( fDet ) * surf_norm - vGrad );
|
|
253
253
|
}
|
|
254
|
-
#endif`,
|
|
254
|
+
#endif`,hm=`#if NUM_CLIPPING_PLANES > 0
|
|
255
255
|
vec4 plane;
|
|
256
256
|
#ifdef ALPHA_TO_COVERAGE
|
|
257
257
|
float distanceToPlane, distanceGradient;
|
|
@@ -297,26 +297,26 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
|
|
|
297
297
|
if ( clipped ) discard;
|
|
298
298
|
#endif
|
|
299
299
|
#endif
|
|
300
|
-
#endif`,
|
|
300
|
+
#endif`,dm=`#if NUM_CLIPPING_PLANES > 0
|
|
301
301
|
varying vec3 vClipPosition;
|
|
302
302
|
uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
|
|
303
|
-
#endif`,
|
|
303
|
+
#endif`,fm=`#if NUM_CLIPPING_PLANES > 0
|
|
304
304
|
varying vec3 vClipPosition;
|
|
305
|
-
#endif`,
|
|
305
|
+
#endif`,pm=`#if NUM_CLIPPING_PLANES > 0
|
|
306
306
|
vClipPosition = - mvPosition.xyz;
|
|
307
|
-
#endif`,
|
|
307
|
+
#endif`,mm=`#if defined( USE_COLOR_ALPHA )
|
|
308
308
|
diffuseColor *= vColor;
|
|
309
309
|
#elif defined( USE_COLOR )
|
|
310
310
|
diffuseColor.rgb *= vColor;
|
|
311
|
-
#endif`,
|
|
311
|
+
#endif`,gm=`#if defined( USE_COLOR_ALPHA )
|
|
312
312
|
varying vec4 vColor;
|
|
313
313
|
#elif defined( USE_COLOR )
|
|
314
314
|
varying vec3 vColor;
|
|
315
|
-
#endif`,
|
|
315
|
+
#endif`,_m=`#if defined( USE_COLOR_ALPHA )
|
|
316
316
|
varying vec4 vColor;
|
|
317
317
|
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
|
|
318
318
|
varying vec3 vColor;
|
|
319
|
-
#endif`,
|
|
319
|
+
#endif`,vm=`#if defined( USE_COLOR_ALPHA )
|
|
320
320
|
vColor = vec4( 1.0 );
|
|
321
321
|
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
|
|
322
322
|
vColor = vec3( 1.0 );
|
|
@@ -330,7 +330,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
|
|
|
330
330
|
#ifdef USE_BATCHING_COLOR
|
|
331
331
|
vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );
|
|
332
332
|
vColor.xyz *= batchingColor.xyz;
|
|
333
|
-
#endif`,
|
|
333
|
+
#endif`,ym=`#define PI 3.141592653589793
|
|
334
334
|
#define PI2 6.283185307179586
|
|
335
335
|
#define PI_HALF 1.5707963267948966
|
|
336
336
|
#define RECIPROCAL_PI 0.3183098861837907
|
|
@@ -404,7 +404,7 @@ vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
|
|
|
404
404
|
float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
|
|
405
405
|
float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
|
|
406
406
|
return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
|
|
407
|
-
} // validated`,
|
|
407
|
+
} // validated`,xm=`#ifdef ENVMAP_TYPE_CUBE_UV
|
|
408
408
|
#define cubeUV_minMipLevel 4.0
|
|
409
409
|
#define cubeUV_minTileSize 16.0
|
|
410
410
|
float getFace( vec3 direction ) {
|
|
@@ -497,7 +497,7 @@ float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
|
|
|
497
497
|
return vec4( mix( color0, color1, mipF ), 1.0 );
|
|
498
498
|
}
|
|
499
499
|
}
|
|
500
|
-
#endif`,
|
|
500
|
+
#endif`,Sm=`vec3 transformedNormal = objectNormal;
|
|
501
501
|
#ifdef USE_TANGENT
|
|
502
502
|
vec3 transformedTangent = objectTangent;
|
|
503
503
|
#endif
|
|
@@ -526,21 +526,21 @@ transformedNormal = normalMatrix * transformedNormal;
|
|
|
526
526
|
#ifdef FLIP_SIDED
|
|
527
527
|
transformedTangent = - transformedTangent;
|
|
528
528
|
#endif
|
|
529
|
-
#endif`,
|
|
529
|
+
#endif`,Mm=`#ifdef USE_DISPLACEMENTMAP
|
|
530
530
|
uniform sampler2D displacementMap;
|
|
531
531
|
uniform float displacementScale;
|
|
532
532
|
uniform float displacementBias;
|
|
533
|
-
#endif`,
|
|
533
|
+
#endif`,bm=`#ifdef USE_DISPLACEMENTMAP
|
|
534
534
|
transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
|
|
535
|
-
#endif`,
|
|
535
|
+
#endif`,Em=`#ifdef USE_EMISSIVEMAP
|
|
536
536
|
vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
|
|
537
537
|
#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE
|
|
538
538
|
emissiveColor = sRGBTransferEOTF( emissiveColor );
|
|
539
539
|
#endif
|
|
540
540
|
totalEmissiveRadiance *= emissiveColor.rgb;
|
|
541
|
-
#endif`,
|
|
541
|
+
#endif`,Tm=`#ifdef USE_EMISSIVEMAP
|
|
542
542
|
uniform sampler2D emissiveMap;
|
|
543
|
-
#endif`,
|
|
543
|
+
#endif`,wm="gl_FragColor = linearToOutputTexel( gl_FragColor );",Am=`vec4 LinearTransferOETF( in vec4 value ) {
|
|
544
544
|
return value;
|
|
545
545
|
}
|
|
546
546
|
vec4 sRGBTransferEOTF( in vec4 value ) {
|
|
@@ -548,7 +548,7 @@ vec4 sRGBTransferEOTF( in vec4 value ) {
|
|
|
548
548
|
}
|
|
549
549
|
vec4 sRGBTransferOETF( in vec4 value ) {
|
|
550
550
|
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 );
|
|
551
|
-
}`,
|
|
551
|
+
}`,Rm=`#ifdef USE_ENVMAP
|
|
552
552
|
#ifdef ENV_WORLDPOS
|
|
553
553
|
vec3 cameraToFrag;
|
|
554
554
|
if ( isOrthographic ) {
|
|
@@ -577,7 +577,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
|
|
|
577
577
|
#elif defined( ENVMAP_BLENDING_ADD )
|
|
578
578
|
outgoingLight += envColor.xyz * specularStrength * reflectivity;
|
|
579
579
|
#endif
|
|
580
|
-
#endif`,
|
|
580
|
+
#endif`,Cm=`#ifdef USE_ENVMAP
|
|
581
581
|
uniform float envMapIntensity;
|
|
582
582
|
uniform float flipEnvMap;
|
|
583
583
|
uniform mat3 envMapRotation;
|
|
@@ -587,7 +587,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
|
|
|
587
587
|
uniform sampler2D envMap;
|
|
588
588
|
#endif
|
|
589
589
|
|
|
590
|
-
#endif`,
|
|
590
|
+
#endif`,Pm=`#ifdef USE_ENVMAP
|
|
591
591
|
uniform float reflectivity;
|
|
592
592
|
#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
|
|
593
593
|
#define ENV_WORLDPOS
|
|
@@ -598,7 +598,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
|
|
|
598
598
|
#else
|
|
599
599
|
varying vec3 vReflect;
|
|
600
600
|
#endif
|
|
601
|
-
#endif`,
|
|
601
|
+
#endif`,Dm=`#ifdef USE_ENVMAP
|
|
602
602
|
#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
|
|
603
603
|
#define ENV_WORLDPOS
|
|
604
604
|
#endif
|
|
@@ -609,7 +609,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
|
|
|
609
609
|
varying vec3 vReflect;
|
|
610
610
|
uniform float refractionRatio;
|
|
611
611
|
#endif
|
|
612
|
-
#endif`,
|
|
612
|
+
#endif`,Lm=`#ifdef USE_ENVMAP
|
|
613
613
|
#ifdef ENV_WORLDPOS
|
|
614
614
|
vWorldPosition = worldPosition.xyz;
|
|
615
615
|
#else
|
|
@@ -626,18 +626,18 @@ vec4 sRGBTransferOETF( in vec4 value ) {
|
|
|
626
626
|
vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
|
|
627
627
|
#endif
|
|
628
628
|
#endif
|
|
629
|
-
#endif`,
|
|
629
|
+
#endif`,Um=`#ifdef USE_FOG
|
|
630
630
|
vFogDepth = - mvPosition.z;
|
|
631
|
-
#endif`,
|
|
631
|
+
#endif`,Im=`#ifdef USE_FOG
|
|
632
632
|
varying float vFogDepth;
|
|
633
|
-
#endif`,
|
|
633
|
+
#endif`,Nm=`#ifdef USE_FOG
|
|
634
634
|
#ifdef FOG_EXP2
|
|
635
635
|
float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
|
|
636
636
|
#else
|
|
637
637
|
float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
|
|
638
638
|
#endif
|
|
639
639
|
gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
|
|
640
|
-
#endif`,
|
|
640
|
+
#endif`,Fm=`#ifdef USE_FOG
|
|
641
641
|
uniform vec3 fogColor;
|
|
642
642
|
varying float vFogDepth;
|
|
643
643
|
#ifdef FOG_EXP2
|
|
@@ -646,7 +646,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
|
|
|
646
646
|
uniform float fogNear;
|
|
647
647
|
uniform float fogFar;
|
|
648
648
|
#endif
|
|
649
|
-
#endif`,
|
|
649
|
+
#endif`,Om=`#ifdef USE_GRADIENTMAP
|
|
650
650
|
uniform sampler2D gradientMap;
|
|
651
651
|
#endif
|
|
652
652
|
vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
|
|
@@ -658,12 +658,12 @@ vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
|
|
|
658
658
|
vec2 fw = fwidth( coord ) * 0.5;
|
|
659
659
|
return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
|
|
660
660
|
#endif
|
|
661
|
-
}`,
|
|
661
|
+
}`,Bm=`#ifdef USE_LIGHTMAP
|
|
662
662
|
uniform sampler2D lightMap;
|
|
663
663
|
uniform float lightMapIntensity;
|
|
664
|
-
#endif`,
|
|
664
|
+
#endif`,km=`LambertMaterial material;
|
|
665
665
|
material.diffuseColor = diffuseColor.rgb;
|
|
666
|
-
material.specularStrength = specularStrength;`,
|
|
666
|
+
material.specularStrength = specularStrength;`,zm=`varying vec3 vViewPosition;
|
|
667
667
|
struct LambertMaterial {
|
|
668
668
|
vec3 diffuseColor;
|
|
669
669
|
float specularStrength;
|
|
@@ -677,7 +677,7 @@ void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometr
|
|
|
677
677
|
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
|
678
678
|
}
|
|
679
679
|
#define RE_Direct RE_Direct_Lambert
|
|
680
|
-
#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,
|
|
680
|
+
#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,Vm=`uniform bool receiveShadow;
|
|
681
681
|
uniform vec3 ambientLightColor;
|
|
682
682
|
#if defined( USE_LIGHT_PROBES )
|
|
683
683
|
uniform vec3 lightProbe[ 9 ];
|
|
@@ -793,7 +793,7 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi
|
|
|
793
793
|
vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
|
|
794
794
|
return irradiance;
|
|
795
795
|
}
|
|
796
|
-
#endif`,
|
|
796
|
+
#endif`,Hm=`#ifdef USE_ENVMAP
|
|
797
797
|
vec3 getIBLIrradiance( const in vec3 normal ) {
|
|
798
798
|
#ifdef ENVMAP_TYPE_CUBE_UV
|
|
799
799
|
vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
|
|
@@ -826,8 +826,8 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi
|
|
|
826
826
|
#endif
|
|
827
827
|
}
|
|
828
828
|
#endif
|
|
829
|
-
#endif`,
|
|
830
|
-
material.diffuseColor = diffuseColor.rgb;`,
|
|
829
|
+
#endif`,Gm=`ToonMaterial material;
|
|
830
|
+
material.diffuseColor = diffuseColor.rgb;`,Wm=`varying vec3 vViewPosition;
|
|
831
831
|
struct ToonMaterial {
|
|
832
832
|
vec3 diffuseColor;
|
|
833
833
|
};
|
|
@@ -839,11 +839,11 @@ void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPo
|
|
|
839
839
|
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
|
840
840
|
}
|
|
841
841
|
#define RE_Direct RE_Direct_Toon
|
|
842
|
-
#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,
|
|
842
|
+
#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,Xm=`BlinnPhongMaterial material;
|
|
843
843
|
material.diffuseColor = diffuseColor.rgb;
|
|
844
844
|
material.specularColor = specular;
|
|
845
845
|
material.specularShininess = shininess;
|
|
846
|
-
material.specularStrength = specularStrength;`,
|
|
846
|
+
material.specularStrength = specularStrength;`,qm=`varying vec3 vViewPosition;
|
|
847
847
|
struct BlinnPhongMaterial {
|
|
848
848
|
vec3 diffuseColor;
|
|
849
849
|
vec3 specularColor;
|
|
@@ -860,7 +860,7 @@ void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geom
|
|
|
860
860
|
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
|
861
861
|
}
|
|
862
862
|
#define RE_Direct RE_Direct_BlinnPhong
|
|
863
|
-
#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,
|
|
863
|
+
#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,jm=`PhysicalMaterial material;
|
|
864
864
|
material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );
|
|
865
865
|
vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );
|
|
866
866
|
float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
|
|
@@ -946,7 +946,7 @@ material.roughness = min( material.roughness, 1.0 );
|
|
|
946
946
|
material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
|
|
947
947
|
material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
|
|
948
948
|
material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
|
|
949
|
-
#endif`,
|
|
949
|
+
#endif`,Ym=`struct PhysicalMaterial {
|
|
950
950
|
vec3 diffuseColor;
|
|
951
951
|
float roughness;
|
|
952
952
|
vec3 specularColor;
|
|
@@ -1247,7 +1247,7 @@ void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradia
|
|
|
1247
1247
|
#define RE_IndirectSpecular RE_IndirectSpecular_Physical
|
|
1248
1248
|
float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
|
|
1249
1249
|
return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
|
|
1250
|
-
}
|
|
1250
|
+
}`,Km=`
|
|
1251
1251
|
vec3 geometryPosition = - vViewPosition;
|
|
1252
1252
|
vec3 geometryNormal = normal;
|
|
1253
1253
|
vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
|
|
@@ -1362,7 +1362,7 @@ IncidentLight directLight;
|
|
|
1362
1362
|
#if defined( RE_IndirectSpecular )
|
|
1363
1363
|
vec3 radiance = vec3( 0.0 );
|
|
1364
1364
|
vec3 clearcoatRadiance = vec3( 0.0 );
|
|
1365
|
-
#endif
|
|
1365
|
+
#endif`,$m=`#if defined( RE_IndirectDiffuse )
|
|
1366
1366
|
#ifdef USE_LIGHTMAP
|
|
1367
1367
|
vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
|
|
1368
1368
|
vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
|
|
@@ -1381,32 +1381,32 @@ IncidentLight directLight;
|
|
|
1381
1381
|
#ifdef USE_CLEARCOAT
|
|
1382
1382
|
clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
|
|
1383
1383
|
#endif
|
|
1384
|
-
#endif`,
|
|
1384
|
+
#endif`,Jm=`#if defined( RE_IndirectDiffuse )
|
|
1385
1385
|
RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
|
|
1386
1386
|
#endif
|
|
1387
1387
|
#if defined( RE_IndirectSpecular )
|
|
1388
1388
|
RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
|
|
1389
|
-
#endif`,
|
|
1389
|
+
#endif`,Zm=`#if defined( USE_LOGDEPTHBUF )
|
|
1390
1390
|
gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
|
|
1391
|
-
#endif`,
|
|
1391
|
+
#endif`,Qm=`#if defined( USE_LOGDEPTHBUF )
|
|
1392
1392
|
uniform float logDepthBufFC;
|
|
1393
1393
|
varying float vFragDepth;
|
|
1394
1394
|
varying float vIsPerspective;
|
|
1395
|
-
#endif`,
|
|
1395
|
+
#endif`,eg=`#ifdef USE_LOGDEPTHBUF
|
|
1396
1396
|
varying float vFragDepth;
|
|
1397
1397
|
varying float vIsPerspective;
|
|
1398
|
-
#endif`,
|
|
1398
|
+
#endif`,tg=`#ifdef USE_LOGDEPTHBUF
|
|
1399
1399
|
vFragDepth = 1.0 + gl_Position.w;
|
|
1400
1400
|
vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
|
|
1401
|
-
#endif`,
|
|
1401
|
+
#endif`,ng=`#ifdef USE_MAP
|
|
1402
1402
|
vec4 sampledDiffuseColor = texture2D( map, vMapUv );
|
|
1403
1403
|
#ifdef DECODE_VIDEO_TEXTURE
|
|
1404
1404
|
sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );
|
|
1405
1405
|
#endif
|
|
1406
1406
|
diffuseColor *= sampledDiffuseColor;
|
|
1407
|
-
#endif`,
|
|
1407
|
+
#endif`,ig=`#ifdef USE_MAP
|
|
1408
1408
|
uniform sampler2D map;
|
|
1409
|
-
#endif`,
|
|
1409
|
+
#endif`,rg=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
|
|
1410
1410
|
#if defined( USE_POINTS_UV )
|
|
1411
1411
|
vec2 uv = vUv;
|
|
1412
1412
|
#else
|
|
@@ -1418,7 +1418,7 @@ IncidentLight directLight;
|
|
|
1418
1418
|
#endif
|
|
1419
1419
|
#ifdef USE_ALPHAMAP
|
|
1420
1420
|
diffuseColor.a *= texture2D( alphaMap, uv ).g;
|
|
1421
|
-
#endif`,
|
|
1421
|
+
#endif`,sg=`#if defined( USE_POINTS_UV )
|
|
1422
1422
|
varying vec2 vUv;
|
|
1423
1423
|
#else
|
|
1424
1424
|
#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
|
|
@@ -1430,19 +1430,19 @@ IncidentLight directLight;
|
|
|
1430
1430
|
#endif
|
|
1431
1431
|
#ifdef USE_ALPHAMAP
|
|
1432
1432
|
uniform sampler2D alphaMap;
|
|
1433
|
-
#endif`,
|
|
1433
|
+
#endif`,ag=`float metalnessFactor = metalness;
|
|
1434
1434
|
#ifdef USE_METALNESSMAP
|
|
1435
1435
|
vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
|
|
1436
1436
|
metalnessFactor *= texelMetalness.b;
|
|
1437
|
-
#endif`,
|
|
1437
|
+
#endif`,og=`#ifdef USE_METALNESSMAP
|
|
1438
1438
|
uniform sampler2D metalnessMap;
|
|
1439
|
-
#endif`,
|
|
1439
|
+
#endif`,lg=`#ifdef USE_INSTANCING_MORPH
|
|
1440
1440
|
float morphTargetInfluences[ MORPHTARGETS_COUNT ];
|
|
1441
1441
|
float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;
|
|
1442
1442
|
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
|
|
1443
1443
|
morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;
|
|
1444
1444
|
}
|
|
1445
|
-
#endif`,
|
|
1445
|
+
#endif`,cg=`#if defined( USE_MORPHCOLORS )
|
|
1446
1446
|
vColor *= morphTargetBaseInfluence;
|
|
1447
1447
|
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
|
|
1448
1448
|
#if defined( USE_COLOR_ALPHA )
|
|
@@ -1451,12 +1451,12 @@ IncidentLight directLight;
|
|
|
1451
1451
|
if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
|
|
1452
1452
|
#endif
|
|
1453
1453
|
}
|
|
1454
|
-
#endif`,
|
|
1454
|
+
#endif`,ug=`#ifdef USE_MORPHNORMALS
|
|
1455
1455
|
objectNormal *= morphTargetBaseInfluence;
|
|
1456
1456
|
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
|
|
1457
1457
|
if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
|
|
1458
1458
|
}
|
|
1459
|
-
#endif`,
|
|
1459
|
+
#endif`,hg=`#ifdef USE_MORPHTARGETS
|
|
1460
1460
|
#ifndef USE_INSTANCING_MORPH
|
|
1461
1461
|
uniform float morphTargetBaseInfluence;
|
|
1462
1462
|
uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
|
|
@@ -1470,12 +1470,12 @@ IncidentLight directLight;
|
|
|
1470
1470
|
ivec3 morphUV = ivec3( x, y, morphTargetIndex );
|
|
1471
1471
|
return texelFetch( morphTargetsTexture, morphUV, 0 );
|
|
1472
1472
|
}
|
|
1473
|
-
#endif`,
|
|
1473
|
+
#endif`,dg=`#ifdef USE_MORPHTARGETS
|
|
1474
1474
|
transformed *= morphTargetBaseInfluence;
|
|
1475
1475
|
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
|
|
1476
1476
|
if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
|
|
1477
1477
|
}
|
|
1478
|
-
#endif`,
|
|
1478
|
+
#endif`,fg=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
|
|
1479
1479
|
#ifdef FLAT_SHADED
|
|
1480
1480
|
vec3 fdx = dFdx( vViewPosition );
|
|
1481
1481
|
vec3 fdy = dFdy( vViewPosition );
|
|
@@ -1516,7 +1516,7 @@ IncidentLight directLight;
|
|
|
1516
1516
|
tbn2[1] *= faceDirection;
|
|
1517
1517
|
#endif
|
|
1518
1518
|
#endif
|
|
1519
|
-
vec3 nonPerturbedNormal = normal;`,
|
|
1519
|
+
vec3 nonPerturbedNormal = normal;`,pg=`#ifdef USE_NORMALMAP_OBJECTSPACE
|
|
1520
1520
|
normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
|
|
1521
1521
|
#ifdef FLIP_SIDED
|
|
1522
1522
|
normal = - normal;
|
|
@@ -1531,25 +1531,25 @@ vec3 nonPerturbedNormal = normal;`,mg=`#ifdef USE_NORMALMAP_OBJECTSPACE
|
|
|
1531
1531
|
normal = normalize( tbn * mapN );
|
|
1532
1532
|
#elif defined( USE_BUMPMAP )
|
|
1533
1533
|
normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
|
|
1534
|
-
#endif`,
|
|
1534
|
+
#endif`,mg=`#ifndef FLAT_SHADED
|
|
1535
1535
|
varying vec3 vNormal;
|
|
1536
1536
|
#ifdef USE_TANGENT
|
|
1537
1537
|
varying vec3 vTangent;
|
|
1538
1538
|
varying vec3 vBitangent;
|
|
1539
1539
|
#endif
|
|
1540
|
-
#endif`,
|
|
1540
|
+
#endif`,gg=`#ifndef FLAT_SHADED
|
|
1541
1541
|
varying vec3 vNormal;
|
|
1542
1542
|
#ifdef USE_TANGENT
|
|
1543
1543
|
varying vec3 vTangent;
|
|
1544
1544
|
varying vec3 vBitangent;
|
|
1545
1545
|
#endif
|
|
1546
|
-
#endif`,
|
|
1546
|
+
#endif`,_g=`#ifndef FLAT_SHADED
|
|
1547
1547
|
vNormal = normalize( transformedNormal );
|
|
1548
1548
|
#ifdef USE_TANGENT
|
|
1549
1549
|
vTangent = normalize( transformedTangent );
|
|
1550
1550
|
vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
|
|
1551
1551
|
#endif
|
|
1552
|
-
#endif`,
|
|
1552
|
+
#endif`,vg=`#ifdef USE_NORMALMAP
|
|
1553
1553
|
uniform sampler2D normalMap;
|
|
1554
1554
|
uniform vec2 normalScale;
|
|
1555
1555
|
#endif
|
|
@@ -1571,13 +1571,13 @@ vec3 nonPerturbedNormal = normal;`,mg=`#ifdef USE_NORMALMAP_OBJECTSPACE
|
|
|
1571
1571
|
float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
|
|
1572
1572
|
return mat3( T * scale, B * scale, N );
|
|
1573
1573
|
}
|
|
1574
|
-
#endif`,
|
|
1574
|
+
#endif`,yg=`#ifdef USE_CLEARCOAT
|
|
1575
1575
|
vec3 clearcoatNormal = nonPerturbedNormal;
|
|
1576
|
-
#endif`,
|
|
1576
|
+
#endif`,xg=`#ifdef USE_CLEARCOAT_NORMALMAP
|
|
1577
1577
|
vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
|
|
1578
1578
|
clearcoatMapN.xy *= clearcoatNormalScale;
|
|
1579
1579
|
clearcoatNormal = normalize( tbn2 * clearcoatMapN );
|
|
1580
|
-
#endif`,
|
|
1580
|
+
#endif`,Sg=`#ifdef USE_CLEARCOATMAP
|
|
1581
1581
|
uniform sampler2D clearcoatMap;
|
|
1582
1582
|
#endif
|
|
1583
1583
|
#ifdef USE_CLEARCOAT_NORMALMAP
|
|
@@ -1586,18 +1586,18 @@ vec3 nonPerturbedNormal = normal;`,mg=`#ifdef USE_NORMALMAP_OBJECTSPACE
|
|
|
1586
1586
|
#endif
|
|
1587
1587
|
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
|
|
1588
1588
|
uniform sampler2D clearcoatRoughnessMap;
|
|
1589
|
-
#endif`,
|
|
1589
|
+
#endif`,Mg=`#ifdef USE_IRIDESCENCEMAP
|
|
1590
1590
|
uniform sampler2D iridescenceMap;
|
|
1591
1591
|
#endif
|
|
1592
1592
|
#ifdef USE_IRIDESCENCE_THICKNESSMAP
|
|
1593
1593
|
uniform sampler2D iridescenceThicknessMap;
|
|
1594
|
-
#endif`,
|
|
1594
|
+
#endif`,bg=`#ifdef OPAQUE
|
|
1595
1595
|
diffuseColor.a = 1.0;
|
|
1596
1596
|
#endif
|
|
1597
1597
|
#ifdef USE_TRANSMISSION
|
|
1598
1598
|
diffuseColor.a *= material.transmissionAlpha;
|
|
1599
1599
|
#endif
|
|
1600
|
-
gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,
|
|
1600
|
+
gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,Eg=`vec3 packNormalToRGB( const in vec3 normal ) {
|
|
1601
1601
|
return normalize( normal ) * 0.5 + 0.5;
|
|
1602
1602
|
}
|
|
1603
1603
|
vec3 unpackRGBToNormal( const in vec3 rgb ) {
|
|
@@ -1666,9 +1666,9 @@ float viewZToPerspectiveDepth( const in float viewZ, const in float near, const
|
|
|
1666
1666
|
}
|
|
1667
1667
|
float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {
|
|
1668
1668
|
return ( near * far ) / ( ( far - near ) * depth - far );
|
|
1669
|
-
}`,
|
|
1669
|
+
}`,Tg=`#ifdef PREMULTIPLIED_ALPHA
|
|
1670
1670
|
gl_FragColor.rgb *= gl_FragColor.a;
|
|
1671
|
-
#endif`,
|
|
1671
|
+
#endif`,wg=`vec4 mvPosition = vec4( transformed, 1.0 );
|
|
1672
1672
|
#ifdef USE_BATCHING
|
|
1673
1673
|
mvPosition = batchingMatrix * mvPosition;
|
|
1674
1674
|
#endif
|
|
@@ -1676,22 +1676,22 @@ float perspectiveDepthToViewZ( const in float depth, const in float near, const
|
|
|
1676
1676
|
mvPosition = instanceMatrix * mvPosition;
|
|
1677
1677
|
#endif
|
|
1678
1678
|
mvPosition = modelViewMatrix * mvPosition;
|
|
1679
|
-
gl_Position = projectionMatrix * mvPosition;`,
|
|
1679
|
+
gl_Position = projectionMatrix * mvPosition;`,Ag=`#ifdef DITHERING
|
|
1680
1680
|
gl_FragColor.rgb = dithering( gl_FragColor.rgb );
|
|
1681
|
-
#endif`,
|
|
1681
|
+
#endif`,Rg=`#ifdef DITHERING
|
|
1682
1682
|
vec3 dithering( vec3 color ) {
|
|
1683
1683
|
float grid_position = rand( gl_FragCoord.xy );
|
|
1684
1684
|
vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
|
|
1685
1685
|
dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
|
|
1686
1686
|
return color + dither_shift_RGB;
|
|
1687
1687
|
}
|
|
1688
|
-
#endif`,
|
|
1688
|
+
#endif`,Cg=`float roughnessFactor = roughness;
|
|
1689
1689
|
#ifdef USE_ROUGHNESSMAP
|
|
1690
1690
|
vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
|
|
1691
1691
|
roughnessFactor *= texelRoughness.g;
|
|
1692
|
-
#endif`,
|
|
1692
|
+
#endif`,Pg=`#ifdef USE_ROUGHNESSMAP
|
|
1693
1693
|
uniform sampler2D roughnessMap;
|
|
1694
|
-
#endif`,
|
|
1694
|
+
#endif`,Dg=`#if NUM_SPOT_LIGHT_COORDS > 0
|
|
1695
1695
|
varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
|
|
1696
1696
|
#endif
|
|
1697
1697
|
#if NUM_SPOT_LIGHT_MAPS > 0
|
|
@@ -1877,7 +1877,7 @@ gl_Position = projectionMatrix * mvPosition;`,Rg=`#ifdef DITHERING
|
|
|
1877
1877
|
}
|
|
1878
1878
|
return mix( 1.0, shadow, shadowIntensity );
|
|
1879
1879
|
}
|
|
1880
|
-
#endif`,
|
|
1880
|
+
#endif`,Lg=`#if NUM_SPOT_LIGHT_COORDS > 0
|
|
1881
1881
|
uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
|
|
1882
1882
|
varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
|
|
1883
1883
|
#endif
|
|
@@ -1918,7 +1918,7 @@ gl_Position = projectionMatrix * mvPosition;`,Rg=`#ifdef DITHERING
|
|
|
1918
1918
|
};
|
|
1919
1919
|
uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
|
|
1920
1920
|
#endif
|
|
1921
|
-
#endif`,
|
|
1921
|
+
#endif`,Ug=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
|
|
1922
1922
|
vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
|
|
1923
1923
|
vec4 shadowWorldPosition;
|
|
1924
1924
|
#endif
|
|
@@ -1950,7 +1950,7 @@ gl_Position = projectionMatrix * mvPosition;`,Rg=`#ifdef DITHERING
|
|
|
1950
1950
|
vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
|
|
1951
1951
|
}
|
|
1952
1952
|
#pragma unroll_loop_end
|
|
1953
|
-
#endif`,
|
|
1953
|
+
#endif`,Ig=`float getShadowMask() {
|
|
1954
1954
|
float shadow = 1.0;
|
|
1955
1955
|
#ifdef USE_SHADOWMAP
|
|
1956
1956
|
#if NUM_DIR_LIGHT_SHADOWS > 0
|
|
@@ -1982,12 +1982,12 @@ gl_Position = projectionMatrix * mvPosition;`,Rg=`#ifdef DITHERING
|
|
|
1982
1982
|
#endif
|
|
1983
1983
|
#endif
|
|
1984
1984
|
return shadow;
|
|
1985
|
-
}`,
|
|
1985
|
+
}`,Ng=`#ifdef USE_SKINNING
|
|
1986
1986
|
mat4 boneMatX = getBoneMatrix( skinIndex.x );
|
|
1987
1987
|
mat4 boneMatY = getBoneMatrix( skinIndex.y );
|
|
1988
1988
|
mat4 boneMatZ = getBoneMatrix( skinIndex.z );
|
|
1989
1989
|
mat4 boneMatW = getBoneMatrix( skinIndex.w );
|
|
1990
|
-
#endif`,
|
|
1990
|
+
#endif`,Fg=`#ifdef USE_SKINNING
|
|
1991
1991
|
uniform mat4 bindMatrix;
|
|
1992
1992
|
uniform mat4 bindMatrixInverse;
|
|
1993
1993
|
uniform highp sampler2D boneTexture;
|
|
@@ -2002,7 +2002,7 @@ gl_Position = projectionMatrix * mvPosition;`,Rg=`#ifdef DITHERING
|
|
|
2002
2002
|
vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
|
|
2003
2003
|
return mat4( v1, v2, v3, v4 );
|
|
2004
2004
|
}
|
|
2005
|
-
#endif`,
|
|
2005
|
+
#endif`,Og=`#ifdef USE_SKINNING
|
|
2006
2006
|
vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
|
|
2007
2007
|
vec4 skinned = vec4( 0.0 );
|
|
2008
2008
|
skinned += boneMatX * skinVertex * skinWeight.x;
|
|
@@ -2010,7 +2010,7 @@ gl_Position = projectionMatrix * mvPosition;`,Rg=`#ifdef DITHERING
|
|
|
2010
2010
|
skinned += boneMatZ * skinVertex * skinWeight.z;
|
|
2011
2011
|
skinned += boneMatW * skinVertex * skinWeight.w;
|
|
2012
2012
|
transformed = ( bindMatrixInverse * skinned ).xyz;
|
|
2013
|
-
#endif`,
|
|
2013
|
+
#endif`,Bg=`#ifdef USE_SKINNING
|
|
2014
2014
|
mat4 skinMatrix = mat4( 0.0 );
|
|
2015
2015
|
skinMatrix += skinWeight.x * boneMatX;
|
|
2016
2016
|
skinMatrix += skinWeight.y * boneMatY;
|
|
@@ -2021,17 +2021,17 @@ gl_Position = projectionMatrix * mvPosition;`,Rg=`#ifdef DITHERING
|
|
|
2021
2021
|
#ifdef USE_TANGENT
|
|
2022
2022
|
objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
|
|
2023
2023
|
#endif
|
|
2024
|
-
#endif`,
|
|
2024
|
+
#endif`,kg=`float specularStrength;
|
|
2025
2025
|
#ifdef USE_SPECULARMAP
|
|
2026
2026
|
vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
|
|
2027
2027
|
specularStrength = texelSpecular.r;
|
|
2028
2028
|
#else
|
|
2029
2029
|
specularStrength = 1.0;
|
|
2030
|
-
#endif`,
|
|
2030
|
+
#endif`,zg=`#ifdef USE_SPECULARMAP
|
|
2031
2031
|
uniform sampler2D specularMap;
|
|
2032
|
-
#endif`,
|
|
2032
|
+
#endif`,Vg=`#if defined( TONE_MAPPING )
|
|
2033
2033
|
gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
|
|
2034
|
-
#endif`,
|
|
2034
|
+
#endif`,Hg=`#ifndef saturate
|
|
2035
2035
|
#define saturate( a ) clamp( a, 0.0, 1.0 )
|
|
2036
2036
|
#endif
|
|
2037
2037
|
uniform float toneMappingExposure;
|
|
@@ -2128,7 +2128,7 @@ vec3 NeutralToneMapping( vec3 color ) {
|
|
|
2128
2128
|
float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );
|
|
2129
2129
|
return mix( color, vec3( newPeak ), g );
|
|
2130
2130
|
}
|
|
2131
|
-
vec3 CustomToneMapping( vec3 color ) { return color; }`,
|
|
2131
|
+
vec3 CustomToneMapping( vec3 color ) { return color; }`,Gg=`#ifdef USE_TRANSMISSION
|
|
2132
2132
|
material.transmission = transmission;
|
|
2133
2133
|
material.transmissionAlpha = 1.0;
|
|
2134
2134
|
material.thickness = thickness;
|
|
@@ -2149,7 +2149,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,Wg=`#ifdef USE_TRANSMISS
|
|
|
2149
2149
|
material.attenuationColor, material.attenuationDistance );
|
|
2150
2150
|
material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
|
|
2151
2151
|
totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
|
|
2152
|
-
#endif`,
|
|
2152
|
+
#endif`,Wg=`#ifdef USE_TRANSMISSION
|
|
2153
2153
|
uniform float transmission;
|
|
2154
2154
|
uniform float thickness;
|
|
2155
2155
|
uniform float attenuationDistance;
|
|
@@ -2275,7 +2275,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,Wg=`#ifdef USE_TRANSMISS
|
|
|
2275
2275
|
float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
|
|
2276
2276
|
return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
|
|
2277
2277
|
}
|
|
2278
|
-
#endif`,
|
|
2278
|
+
#endif`,Xg=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
|
|
2279
2279
|
varying vec2 vUv;
|
|
2280
2280
|
#endif
|
|
2281
2281
|
#ifdef USE_MAP
|
|
@@ -2345,7 +2345,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,Wg=`#ifdef USE_TRANSMISS
|
|
|
2345
2345
|
#ifdef USE_THICKNESSMAP
|
|
2346
2346
|
uniform mat3 thicknessMapTransform;
|
|
2347
2347
|
varying vec2 vThicknessMapUv;
|
|
2348
|
-
#endif`,
|
|
2348
|
+
#endif`,qg=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
|
|
2349
2349
|
varying vec2 vUv;
|
|
2350
2350
|
#endif
|
|
2351
2351
|
#ifdef USE_MAP
|
|
@@ -2439,7 +2439,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,Wg=`#ifdef USE_TRANSMISS
|
|
|
2439
2439
|
#ifdef USE_THICKNESSMAP
|
|
2440
2440
|
uniform mat3 thicknessMapTransform;
|
|
2441
2441
|
varying vec2 vThicknessMapUv;
|
|
2442
|
-
#endif`,
|
|
2442
|
+
#endif`,jg=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
|
|
2443
2443
|
vUv = vec3( uv, 1 ).xy;
|
|
2444
2444
|
#endif
|
|
2445
2445
|
#ifdef USE_MAP
|
|
@@ -2510,7 +2510,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,Wg=`#ifdef USE_TRANSMISS
|
|
|
2510
2510
|
#endif
|
|
2511
2511
|
#ifdef USE_THICKNESSMAP
|
|
2512
2512
|
vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
|
|
2513
|
-
#endif`,
|
|
2513
|
+
#endif`,Yg=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
|
|
2514
2514
|
vec4 worldPosition = vec4( transformed, 1.0 );
|
|
2515
2515
|
#ifdef USE_BATCHING
|
|
2516
2516
|
worldPosition = batchingMatrix * worldPosition;
|
|
@@ -2519,12 +2519,12 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,Wg=`#ifdef USE_TRANSMISS
|
|
|
2519
2519
|
worldPosition = instanceMatrix * worldPosition;
|
|
2520
2520
|
#endif
|
|
2521
2521
|
worldPosition = modelMatrix * worldPosition;
|
|
2522
|
-
#endif`;const
|
|
2522
|
+
#endif`;const Kg=`varying vec2 vUv;
|
|
2523
2523
|
uniform mat3 uvTransform;
|
|
2524
2524
|
void main() {
|
|
2525
2525
|
vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
|
|
2526
2526
|
gl_Position = vec4( position.xy, 1.0, 1.0 );
|
|
2527
|
-
}
|
|
2527
|
+
}`,$g=`uniform sampler2D t2D;
|
|
2528
2528
|
uniform float backgroundIntensity;
|
|
2529
2529
|
varying vec2 vUv;
|
|
2530
2530
|
void main() {
|
|
@@ -2536,14 +2536,14 @@ void main() {
|
|
|
2536
2536
|
gl_FragColor = texColor;
|
|
2537
2537
|
#include <tonemapping_fragment>
|
|
2538
2538
|
#include <colorspace_fragment>
|
|
2539
|
-
}`,
|
|
2539
|
+
}`,Jg=`varying vec3 vWorldDirection;
|
|
2540
2540
|
#include <common>
|
|
2541
2541
|
void main() {
|
|
2542
2542
|
vWorldDirection = transformDirection( position, modelMatrix );
|
|
2543
2543
|
#include <begin_vertex>
|
|
2544
2544
|
#include <project_vertex>
|
|
2545
2545
|
gl_Position.z = gl_Position.w;
|
|
2546
|
-
}`,
|
|
2546
|
+
}`,Zg=`#ifdef ENVMAP_TYPE_CUBE
|
|
2547
2547
|
uniform samplerCube envMap;
|
|
2548
2548
|
#elif defined( ENVMAP_TYPE_CUBE_UV )
|
|
2549
2549
|
uniform sampler2D envMap;
|
|
@@ -2566,14 +2566,14 @@ void main() {
|
|
|
2566
2566
|
gl_FragColor = texColor;
|
|
2567
2567
|
#include <tonemapping_fragment>
|
|
2568
2568
|
#include <colorspace_fragment>
|
|
2569
|
-
}`,
|
|
2569
|
+
}`,Qg=`varying vec3 vWorldDirection;
|
|
2570
2570
|
#include <common>
|
|
2571
2571
|
void main() {
|
|
2572
2572
|
vWorldDirection = transformDirection( position, modelMatrix );
|
|
2573
2573
|
#include <begin_vertex>
|
|
2574
2574
|
#include <project_vertex>
|
|
2575
2575
|
gl_Position.z = gl_Position.w;
|
|
2576
|
-
}`,
|
|
2576
|
+
}`,e_=`uniform samplerCube tCube;
|
|
2577
2577
|
uniform float tFlip;
|
|
2578
2578
|
uniform float opacity;
|
|
2579
2579
|
varying vec3 vWorldDirection;
|
|
@@ -2583,7 +2583,7 @@ void main() {
|
|
|
2583
2583
|
gl_FragColor.a *= opacity;
|
|
2584
2584
|
#include <tonemapping_fragment>
|
|
2585
2585
|
#include <colorspace_fragment>
|
|
2586
|
-
}`,
|
|
2586
|
+
}`,t_=`#include <common>
|
|
2587
2587
|
#include <batching_pars_vertex>
|
|
2588
2588
|
#include <uv_pars_vertex>
|
|
2589
2589
|
#include <displacementmap_pars_vertex>
|
|
@@ -2610,7 +2610,7 @@ void main() {
|
|
|
2610
2610
|
#include <logdepthbuf_vertex>
|
|
2611
2611
|
#include <clipping_planes_vertex>
|
|
2612
2612
|
vHighPrecisionZW = gl_Position.zw;
|
|
2613
|
-
}`,
|
|
2613
|
+
}`,n_=`#if DEPTH_PACKING == 3200
|
|
2614
2614
|
uniform float opacity;
|
|
2615
2615
|
#endif
|
|
2616
2616
|
#include <common>
|
|
@@ -2644,7 +2644,7 @@ void main() {
|
|
|
2644
2644
|
#elif DEPTH_PACKING == 3203
|
|
2645
2645
|
gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );
|
|
2646
2646
|
#endif
|
|
2647
|
-
}`,
|
|
2647
|
+
}`,i_=`#define DISTANCE
|
|
2648
2648
|
varying vec3 vWorldPosition;
|
|
2649
2649
|
#include <common>
|
|
2650
2650
|
#include <batching_pars_vertex>
|
|
@@ -2671,7 +2671,7 @@ void main() {
|
|
|
2671
2671
|
#include <worldpos_vertex>
|
|
2672
2672
|
#include <clipping_planes_vertex>
|
|
2673
2673
|
vWorldPosition = worldPosition.xyz;
|
|
2674
|
-
}`,
|
|
2674
|
+
}`,r_=`#define DISTANCE
|
|
2675
2675
|
uniform vec3 referencePosition;
|
|
2676
2676
|
uniform float nearDistance;
|
|
2677
2677
|
uniform float farDistance;
|
|
@@ -2695,13 +2695,13 @@ void main () {
|
|
|
2695
2695
|
dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
|
|
2696
2696
|
dist = saturate( dist );
|
|
2697
2697
|
gl_FragColor = packDepthToRGBA( dist );
|
|
2698
|
-
}`,
|
|
2698
|
+
}`,s_=`varying vec3 vWorldDirection;
|
|
2699
2699
|
#include <common>
|
|
2700
2700
|
void main() {
|
|
2701
2701
|
vWorldDirection = transformDirection( position, modelMatrix );
|
|
2702
2702
|
#include <begin_vertex>
|
|
2703
2703
|
#include <project_vertex>
|
|
2704
|
-
}`,
|
|
2704
|
+
}`,a_=`uniform sampler2D tEquirect;
|
|
2705
2705
|
varying vec3 vWorldDirection;
|
|
2706
2706
|
#include <common>
|
|
2707
2707
|
void main() {
|
|
@@ -2710,7 +2710,7 @@ void main() {
|
|
|
2710
2710
|
gl_FragColor = texture2D( tEquirect, sampleUV );
|
|
2711
2711
|
#include <tonemapping_fragment>
|
|
2712
2712
|
#include <colorspace_fragment>
|
|
2713
|
-
}`,
|
|
2713
|
+
}`,o_=`uniform float scale;
|
|
2714
2714
|
attribute float lineDistance;
|
|
2715
2715
|
varying float vLineDistance;
|
|
2716
2716
|
#include <common>
|
|
@@ -2732,7 +2732,7 @@ void main() {
|
|
|
2732
2732
|
#include <logdepthbuf_vertex>
|
|
2733
2733
|
#include <clipping_planes_vertex>
|
|
2734
2734
|
#include <fog_vertex>
|
|
2735
|
-
}`,
|
|
2735
|
+
}`,l_=`uniform vec3 diffuse;
|
|
2736
2736
|
uniform float opacity;
|
|
2737
2737
|
uniform float dashSize;
|
|
2738
2738
|
uniform float totalSize;
|
|
@@ -2760,7 +2760,7 @@ void main() {
|
|
|
2760
2760
|
#include <colorspace_fragment>
|
|
2761
2761
|
#include <fog_fragment>
|
|
2762
2762
|
#include <premultiplied_alpha_fragment>
|
|
2763
|
-
}`,
|
|
2763
|
+
}`,c_=`#include <common>
|
|
2764
2764
|
#include <batching_pars_vertex>
|
|
2765
2765
|
#include <uv_pars_vertex>
|
|
2766
2766
|
#include <envmap_pars_vertex>
|
|
@@ -2792,7 +2792,7 @@ void main() {
|
|
|
2792
2792
|
#include <worldpos_vertex>
|
|
2793
2793
|
#include <envmap_vertex>
|
|
2794
2794
|
#include <fog_vertex>
|
|
2795
|
-
}`,
|
|
2795
|
+
}`,u_=`uniform vec3 diffuse;
|
|
2796
2796
|
uniform float opacity;
|
|
2797
2797
|
#ifndef FLAT_SHADED
|
|
2798
2798
|
varying vec3 vNormal;
|
|
@@ -2840,7 +2840,7 @@ void main() {
|
|
|
2840
2840
|
#include <fog_fragment>
|
|
2841
2841
|
#include <premultiplied_alpha_fragment>
|
|
2842
2842
|
#include <dithering_fragment>
|
|
2843
|
-
}`,
|
|
2843
|
+
}`,h_=`#define LAMBERT
|
|
2844
2844
|
varying vec3 vViewPosition;
|
|
2845
2845
|
#include <common>
|
|
2846
2846
|
#include <batching_pars_vertex>
|
|
@@ -2879,7 +2879,7 @@ void main() {
|
|
|
2879
2879
|
#include <envmap_vertex>
|
|
2880
2880
|
#include <shadowmap_vertex>
|
|
2881
2881
|
#include <fog_vertex>
|
|
2882
|
-
}`,
|
|
2882
|
+
}`,d_=`#define LAMBERT
|
|
2883
2883
|
uniform vec3 diffuse;
|
|
2884
2884
|
uniform vec3 emissive;
|
|
2885
2885
|
uniform float opacity;
|
|
@@ -2936,7 +2936,7 @@ void main() {
|
|
|
2936
2936
|
#include <fog_fragment>
|
|
2937
2937
|
#include <premultiplied_alpha_fragment>
|
|
2938
2938
|
#include <dithering_fragment>
|
|
2939
|
-
}`,
|
|
2939
|
+
}`,f_=`#define MATCAP
|
|
2940
2940
|
varying vec3 vViewPosition;
|
|
2941
2941
|
#include <common>
|
|
2942
2942
|
#include <batching_pars_vertex>
|
|
@@ -2970,7 +2970,7 @@ void main() {
|
|
|
2970
2970
|
#include <clipping_planes_vertex>
|
|
2971
2971
|
#include <fog_vertex>
|
|
2972
2972
|
vViewPosition = - mvPosition.xyz;
|
|
2973
|
-
}`,
|
|
2973
|
+
}`,p_=`#define MATCAP
|
|
2974
2974
|
uniform vec3 diffuse;
|
|
2975
2975
|
uniform float opacity;
|
|
2976
2976
|
uniform sampler2D matcap;
|
|
@@ -3016,7 +3016,7 @@ void main() {
|
|
|
3016
3016
|
#include <fog_fragment>
|
|
3017
3017
|
#include <premultiplied_alpha_fragment>
|
|
3018
3018
|
#include <dithering_fragment>
|
|
3019
|
-
}`,
|
|
3019
|
+
}`,m_=`#define NORMAL
|
|
3020
3020
|
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
|
|
3021
3021
|
varying vec3 vViewPosition;
|
|
3022
3022
|
#endif
|
|
@@ -3049,7 +3049,7 @@ void main() {
|
|
|
3049
3049
|
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
|
|
3050
3050
|
vViewPosition = - mvPosition.xyz;
|
|
3051
3051
|
#endif
|
|
3052
|
-
}`,
|
|
3052
|
+
}`,g_=`#define NORMAL
|
|
3053
3053
|
uniform float opacity;
|
|
3054
3054
|
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
|
|
3055
3055
|
varying vec3 vViewPosition;
|
|
@@ -3071,7 +3071,7 @@ void main() {
|
|
|
3071
3071
|
#ifdef OPAQUE
|
|
3072
3072
|
gl_FragColor.a = 1.0;
|
|
3073
3073
|
#endif
|
|
3074
|
-
}`,
|
|
3074
|
+
}`,__=`#define PHONG
|
|
3075
3075
|
varying vec3 vViewPosition;
|
|
3076
3076
|
#include <common>
|
|
3077
3077
|
#include <batching_pars_vertex>
|
|
@@ -3110,7 +3110,7 @@ void main() {
|
|
|
3110
3110
|
#include <envmap_vertex>
|
|
3111
3111
|
#include <shadowmap_vertex>
|
|
3112
3112
|
#include <fog_vertex>
|
|
3113
|
-
}`,
|
|
3113
|
+
}`,v_=`#define PHONG
|
|
3114
3114
|
uniform vec3 diffuse;
|
|
3115
3115
|
uniform vec3 emissive;
|
|
3116
3116
|
uniform vec3 specular;
|
|
@@ -3169,7 +3169,7 @@ void main() {
|
|
|
3169
3169
|
#include <fog_fragment>
|
|
3170
3170
|
#include <premultiplied_alpha_fragment>
|
|
3171
3171
|
#include <dithering_fragment>
|
|
3172
|
-
}`,
|
|
3172
|
+
}`,y_=`#define STANDARD
|
|
3173
3173
|
varying vec3 vViewPosition;
|
|
3174
3174
|
#ifdef USE_TRANSMISSION
|
|
3175
3175
|
varying vec3 vWorldPosition;
|
|
@@ -3212,7 +3212,7 @@ void main() {
|
|
|
3212
3212
|
#ifdef USE_TRANSMISSION
|
|
3213
3213
|
vWorldPosition = worldPosition.xyz;
|
|
3214
3214
|
#endif
|
|
3215
|
-
}`,
|
|
3215
|
+
}`,x_=`#define STANDARD
|
|
3216
3216
|
#ifdef PHYSICAL
|
|
3217
3217
|
#define IOR
|
|
3218
3218
|
#define USE_SPECULAR
|
|
@@ -3337,7 +3337,7 @@ void main() {
|
|
|
3337
3337
|
#include <fog_fragment>
|
|
3338
3338
|
#include <premultiplied_alpha_fragment>
|
|
3339
3339
|
#include <dithering_fragment>
|
|
3340
|
-
}`,
|
|
3340
|
+
}`,S_=`#define TOON
|
|
3341
3341
|
varying vec3 vViewPosition;
|
|
3342
3342
|
#include <common>
|
|
3343
3343
|
#include <batching_pars_vertex>
|
|
@@ -3374,7 +3374,7 @@ void main() {
|
|
|
3374
3374
|
#include <worldpos_vertex>
|
|
3375
3375
|
#include <shadowmap_vertex>
|
|
3376
3376
|
#include <fog_vertex>
|
|
3377
|
-
}`,
|
|
3377
|
+
}`,M_=`#define TOON
|
|
3378
3378
|
uniform vec3 diffuse;
|
|
3379
3379
|
uniform vec3 emissive;
|
|
3380
3380
|
uniform float opacity;
|
|
@@ -3427,7 +3427,7 @@ void main() {
|
|
|
3427
3427
|
#include <fog_fragment>
|
|
3428
3428
|
#include <premultiplied_alpha_fragment>
|
|
3429
3429
|
#include <dithering_fragment>
|
|
3430
|
-
}`,
|
|
3430
|
+
}`,b_=`uniform float size;
|
|
3431
3431
|
uniform float scale;
|
|
3432
3432
|
#include <common>
|
|
3433
3433
|
#include <color_pars_vertex>
|
|
@@ -3458,7 +3458,7 @@ void main() {
|
|
|
3458
3458
|
#include <clipping_planes_vertex>
|
|
3459
3459
|
#include <worldpos_vertex>
|
|
3460
3460
|
#include <fog_vertex>
|
|
3461
|
-
}`,
|
|
3461
|
+
}`,E_=`uniform vec3 diffuse;
|
|
3462
3462
|
uniform float opacity;
|
|
3463
3463
|
#include <common>
|
|
3464
3464
|
#include <color_pars_fragment>
|
|
@@ -3483,7 +3483,7 @@ void main() {
|
|
|
3483
3483
|
#include <colorspace_fragment>
|
|
3484
3484
|
#include <fog_fragment>
|
|
3485
3485
|
#include <premultiplied_alpha_fragment>
|
|
3486
|
-
}`,
|
|
3486
|
+
}`,T_=`#include <common>
|
|
3487
3487
|
#include <batching_pars_vertex>
|
|
3488
3488
|
#include <fog_pars_vertex>
|
|
3489
3489
|
#include <morphtarget_pars_vertex>
|
|
@@ -3506,7 +3506,7 @@ void main() {
|
|
|
3506
3506
|
#include <worldpos_vertex>
|
|
3507
3507
|
#include <shadowmap_vertex>
|
|
3508
3508
|
#include <fog_vertex>
|
|
3509
|
-
}`,
|
|
3509
|
+
}`,w_=`uniform vec3 color;
|
|
3510
3510
|
uniform float opacity;
|
|
3511
3511
|
#include <common>
|
|
3512
3512
|
#include <packing>
|
|
@@ -3522,7 +3522,7 @@ void main() {
|
|
|
3522
3522
|
#include <tonemapping_fragment>
|
|
3523
3523
|
#include <colorspace_fragment>
|
|
3524
3524
|
#include <fog_fragment>
|
|
3525
|
-
}`,
|
|
3525
|
+
}`,A_=`uniform float rotation;
|
|
3526
3526
|
uniform vec2 center;
|
|
3527
3527
|
#include <common>
|
|
3528
3528
|
#include <uv_pars_vertex>
|
|
@@ -3546,7 +3546,7 @@ void main() {
|
|
|
3546
3546
|
#include <logdepthbuf_vertex>
|
|
3547
3547
|
#include <clipping_planes_vertex>
|
|
3548
3548
|
#include <fog_vertex>
|
|
3549
|
-
}`,
|
|
3549
|
+
}`,R_=`uniform vec3 diffuse;
|
|
3550
3550
|
uniform float opacity;
|
|
3551
3551
|
#include <common>
|
|
3552
3552
|
#include <uv_pars_fragment>
|
|
@@ -3571,7 +3571,7 @@ void main() {
|
|
|
3571
3571
|
#include <tonemapping_fragment>
|
|
3572
3572
|
#include <colorspace_fragment>
|
|
3573
3573
|
#include <fog_fragment>
|
|
3574
|
-
}`,_t={alphahash_fragment:Jp,alphahash_pars_fragment:Zp,alphamap_fragment:Qp,alphamap_pars_fragment:em,alphatest_fragment:tm,alphatest_pars_fragment:nm,aomap_fragment:im,aomap_pars_fragment:rm,batching_pars_vertex:sm,batching_vertex:am,begin_vertex:om,beginnormal_vertex:lm,bsdfs:cm,iridescence_fragment:um,bumpmap_pars_fragment:hm,clipping_planes_fragment:dm,clipping_planes_pars_fragment:fm,clipping_planes_pars_vertex:pm,clipping_planes_vertex:mm,color_fragment:gm,color_pars_fragment:_m,color_pars_vertex:vm,color_vertex:ym,common:xm,cube_uv_reflection_fragment:Sm,defaultnormal_vertex:Mm,displacementmap_pars_vertex:bm,displacementmap_vertex:Em,emissivemap_fragment:Tm,emissivemap_pars_fragment:wm,colorspace_fragment:Am,colorspace_pars_fragment:Rm,envmap_fragment:Cm,envmap_common_pars_fragment:Pm,envmap_pars_fragment:Dm,envmap_pars_vertex:Lm,envmap_physical_pars_fragment:Gm,envmap_vertex:Um,fog_vertex:Im,fog_pars_vertex:Nm,fog_fragment:Fm,fog_pars_fragment:Om,gradientmap_pars_fragment:Bm,lightmap_pars_fragment:km,lights_lambert_fragment:zm,lights_lambert_pars_fragment:Vm,lights_pars_begin:Hm,lights_toon_fragment:Wm,lights_toon_pars_fragment:Xm,lights_phong_fragment:qm,lights_phong_pars_fragment:jm,lights_physical_fragment:Ym,lights_physical_pars_fragment:Km,lights_fragment_begin:$m,lights_fragment_maps:Jm,lights_fragment_end:Zm,logdepthbuf_fragment:Qm,logdepthbuf_pars_fragment:eg,logdepthbuf_pars_vertex:tg,logdepthbuf_vertex:ng,map_fragment:ig,map_pars_fragment:rg,map_particle_fragment:sg,map_particle_pars_fragment:ag,metalnessmap_fragment:og,metalnessmap_pars_fragment:lg,morphinstance_vertex:cg,morphcolor_vertex:ug,morphnormal_vertex:hg,morphtarget_pars_vertex:dg,morphtarget_vertex:fg,normal_fragment_begin:pg,normal_fragment_maps:mg,normal_pars_fragment:gg,normal_pars_vertex:_g,normal_vertex:vg,normalmap_pars_fragment:yg,clearcoat_normal_fragment_begin:xg,clearcoat_normal_fragment_maps:Sg,clearcoat_pars_fragment:Mg,iridescence_pars_fragment:bg,opaque_fragment:Eg,packing:Tg,premultiplied_alpha_fragment:wg,project_vertex:Ag,dithering_fragment:Rg,dithering_pars_fragment:Cg,roughnessmap_fragment:Pg,roughnessmap_pars_fragment:Dg,shadowmap_pars_fragment:Lg,shadowmap_pars_vertex:Ug,shadowmap_vertex:Ig,shadowmask_pars_fragment:Ng,skinbase_vertex:Fg,skinning_pars_vertex:Og,skinning_vertex:Bg,skinnormal_vertex:kg,specularmap_fragment:zg,specularmap_pars_fragment:Vg,tonemapping_fragment:Hg,tonemapping_pars_fragment:Gg,transmission_fragment:Wg,transmission_pars_fragment:Xg,uv_pars_fragment:qg,uv_pars_vertex:jg,uv_vertex:Yg,worldpos_vertex:Kg,background_vert:$g,background_frag:Jg,backgroundCube_vert:Zg,backgroundCube_frag:Qg,cube_vert:e_,cube_frag:t_,depth_vert:n_,depth_frag:i_,distanceRGBA_vert:r_,distanceRGBA_frag:s_,equirect_vert:a_,equirect_frag:o_,linedashed_vert:l_,linedashed_frag:c_,meshbasic_vert:u_,meshbasic_frag:h_,meshlambert_vert:d_,meshlambert_frag:f_,meshmatcap_vert:p_,meshmatcap_frag:m_,meshnormal_vert:g_,meshnormal_frag:__,meshphong_vert:v_,meshphong_frag:y_,meshphysical_vert:x_,meshphysical_frag:S_,meshtoon_vert:M_,meshtoon_frag:b_,points_vert:E_,points_frag:T_,shadow_vert:w_,shadow_frag:A_,sprite_vert:R_,sprite_frag:C_},Ce={common:{diffuse:{value:new ht(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new gt},alphaMap:{value:null},alphaMapTransform:{value:new gt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new gt}},envmap:{envMap:{value:null},envMapRotation:{value:new gt},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new gt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new gt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new gt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new gt},normalScale:{value:new dt(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new gt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new gt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new gt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new gt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new ht(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,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 ht(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new gt},alphaTest:{value:0},uvTransform:{value:new gt}},sprite:{diffuse:{value:new ht(16777215)},opacity:{value:1},center:{value:new dt(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new gt},alphaMap:{value:null},alphaMapTransform:{value:new gt},alphaTest:{value:0}}},Mn={basic:{uniforms:gn([Ce.common,Ce.specularmap,Ce.envmap,Ce.aomap,Ce.lightmap,Ce.fog]),vertexShader:_t.meshbasic_vert,fragmentShader:_t.meshbasic_frag},lambert:{uniforms:gn([Ce.common,Ce.specularmap,Ce.envmap,Ce.aomap,Ce.lightmap,Ce.emissivemap,Ce.bumpmap,Ce.normalmap,Ce.displacementmap,Ce.fog,Ce.lights,{emissive:{value:new ht(0)}}]),vertexShader:_t.meshlambert_vert,fragmentShader:_t.meshlambert_frag},phong:{uniforms:gn([Ce.common,Ce.specularmap,Ce.envmap,Ce.aomap,Ce.lightmap,Ce.emissivemap,Ce.bumpmap,Ce.normalmap,Ce.displacementmap,Ce.fog,Ce.lights,{emissive:{value:new ht(0)},specular:{value:new ht(1118481)},shininess:{value:30}}]),vertexShader:_t.meshphong_vert,fragmentShader:_t.meshphong_frag},standard:{uniforms:gn([Ce.common,Ce.envmap,Ce.aomap,Ce.lightmap,Ce.emissivemap,Ce.bumpmap,Ce.normalmap,Ce.displacementmap,Ce.roughnessmap,Ce.metalnessmap,Ce.fog,Ce.lights,{emissive:{value:new ht(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:_t.meshphysical_vert,fragmentShader:_t.meshphysical_frag},toon:{uniforms:gn([Ce.common,Ce.aomap,Ce.lightmap,Ce.emissivemap,Ce.bumpmap,Ce.normalmap,Ce.displacementmap,Ce.gradientmap,Ce.fog,Ce.lights,{emissive:{value:new ht(0)}}]),vertexShader:_t.meshtoon_vert,fragmentShader:_t.meshtoon_frag},matcap:{uniforms:gn([Ce.common,Ce.bumpmap,Ce.normalmap,Ce.displacementmap,Ce.fog,{matcap:{value:null}}]),vertexShader:_t.meshmatcap_vert,fragmentShader:_t.meshmatcap_frag},points:{uniforms:gn([Ce.points,Ce.fog]),vertexShader:_t.points_vert,fragmentShader:_t.points_frag},dashed:{uniforms:gn([Ce.common,Ce.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:_t.linedashed_vert,fragmentShader:_t.linedashed_frag},depth:{uniforms:gn([Ce.common,Ce.displacementmap]),vertexShader:_t.depth_vert,fragmentShader:_t.depth_frag},normal:{uniforms:gn([Ce.common,Ce.bumpmap,Ce.normalmap,Ce.displacementmap,{opacity:{value:1}}]),vertexShader:_t.meshnormal_vert,fragmentShader:_t.meshnormal_frag},sprite:{uniforms:gn([Ce.sprite,Ce.fog]),vertexShader:_t.sprite_vert,fragmentShader:_t.sprite_frag},background:{uniforms:{uvTransform:{value:new gt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:_t.background_vert,fragmentShader:_t.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new gt}},vertexShader:_t.backgroundCube_vert,fragmentShader:_t.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:_t.cube_vert,fragmentShader:_t.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:_t.equirect_vert,fragmentShader:_t.equirect_frag},distanceRGBA:{uniforms:gn([Ce.common,Ce.displacementmap,{referencePosition:{value:new k},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:_t.distanceRGBA_vert,fragmentShader:_t.distanceRGBA_frag},shadow:{uniforms:gn([Ce.lights,Ce.fog,{color:{value:new ht(0)},opacity:{value:1}}]),vertexShader:_t.shadow_vert,fragmentShader:_t.shadow_frag}};Mn.physical={uniforms:gn([Mn.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new gt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new gt},clearcoatNormalScale:{value:new dt(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new gt},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new gt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new gt},sheen:{value:0},sheenColor:{value:new ht(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new gt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new gt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new gt},transmissionSamplerSize:{value:new dt},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new gt},attenuationDistance:{value:0},attenuationColor:{value:new ht(0)},specularColor:{value:new ht(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new gt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new gt},anisotropyVector:{value:new dt},anisotropyMap:{value:null},anisotropyMapTransform:{value:new gt}}]),vertexShader:_t.meshphysical_vert,fragmentShader:_t.meshphysical_frag};const Xs={r:0,b:0,g:0},Bi=new bn,P_=new ut;function D_(r,e,t,n,i,s,a){const o=new ht(0);let l=s===!0?0:1,c,u,h=null,d=0,f=null;function m(E){let y=E.isScene===!0?E.background:null;return y&&y.isTexture&&(y=(E.backgroundBlurriness>0?t:e).get(y)),y}function _(E){let y=!1;const I=m(E);I===null?p(o,l):I&&I.isColor&&(p(I,1),y=!0);const R=r.xr.getEnvironmentBlendMode();R==="additive"?n.buffers.color.setClear(0,0,0,1,a):R==="alpha-blend"&&n.buffers.color.setClear(0,0,0,0,a),(r.autoClear||y)&&(n.buffers.depth.setTest(!0),n.buffers.depth.setMask(!0),n.buffers.color.setMask(!0),r.clear(r.autoClearColor,r.autoClearDepth,r.autoClearStencil))}function g(E,y){const I=m(y);I&&(I.isCubeTexture||I.mapping===Sa)?(u===void 0&&(u=new Ut(new Br(1,1,1),new gi({name:"BackgroundCubeMaterial",uniforms:Nr(Mn.backgroundCube.uniforms),vertexShader:Mn.backgroundCube.vertexShader,fragmentShader:Mn.backgroundCube.fragmentShader,side:_n,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),u.geometry.deleteAttribute("normal"),u.geometry.deleteAttribute("uv"),u.onBeforeRender=function(R,C,L){this.matrixWorld.copyPosition(L.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(u)),Bi.copy(y.backgroundRotation),Bi.x*=-1,Bi.y*=-1,Bi.z*=-1,I.isCubeTexture&&I.isRenderTargetTexture===!1&&(Bi.y*=-1,Bi.z*=-1),u.material.uniforms.envMap.value=I,u.material.uniforms.flipEnvMap.value=I.isCubeTexture&&I.isRenderTargetTexture===!1?-1:1,u.material.uniforms.backgroundBlurriness.value=y.backgroundBlurriness,u.material.uniforms.backgroundIntensity.value=y.backgroundIntensity,u.material.uniforms.backgroundRotation.value.setFromMatrix4(P_.makeRotationFromEuler(Bi)),u.material.toneMapped=vt.getTransfer(I.colorSpace)!==It,(h!==I||d!==I.version||f!==r.toneMapping)&&(u.material.needsUpdate=!0,h=I,d=I.version,f=r.toneMapping),u.layers.enableAll(),E.unshift(u,u.geometry,u.material,0,0,null)):I&&I.isTexture&&(c===void 0&&(c=new Ut(new ds(2,2),new gi({name:"BackgroundMaterial",uniforms:Nr(Mn.background.uniforms),vertexShader:Mn.background.vertexShader,fragmentShader:Mn.background.fragmentShader,side:$n,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(c)),c.material.uniforms.t2D.value=I,c.material.uniforms.backgroundIntensity.value=y.backgroundIntensity,c.material.toneMapped=vt.getTransfer(I.colorSpace)!==It,I.matrixAutoUpdate===!0&&I.updateMatrix(),c.material.uniforms.uvTransform.value.copy(I.matrix),(h!==I||d!==I.version||f!==r.toneMapping)&&(c.material.needsUpdate=!0,h=I,d=I.version,f=r.toneMapping),c.layers.enableAll(),E.unshift(c,c.geometry,c.material,0,0,null))}function p(E,y){E.getRGB(Xs,fh(r)),n.buffers.color.setClear(Xs.r,Xs.g,Xs.b,y,a)}function M(){u!==void 0&&(u.geometry.dispose(),u.material.dispose(),u=void 0),c!==void 0&&(c.geometry.dispose(),c.material.dispose(),c=void 0)}return{getClearColor:function(){return o},setClearColor:function(E,y=1){o.set(E),l=y,p(o,l)},getClearAlpha:function(){return l},setClearAlpha:function(E){l=E,p(o,l)},render:_,addToRenderList:g,dispose:M}}function L_(r,e){const t=r.getParameter(r.MAX_VERTEX_ATTRIBS),n={},i=d(null);let s=i,a=!1;function o(x,w,B,z,X){let j=!1;const O=h(z,B,w);s!==O&&(s=O,c(s.object)),j=f(x,z,B,X),j&&m(x,z,B,X),X!==null&&e.update(X,r.ELEMENT_ARRAY_BUFFER),(j||a)&&(a=!1,y(x,w,B,z),X!==null&&r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,e.get(X).buffer))}function l(){return r.createVertexArray()}function c(x){return r.bindVertexArray(x)}function u(x){return r.deleteVertexArray(x)}function h(x,w,B){const z=B.wireframe===!0;let X=n[x.id];X===void 0&&(X={},n[x.id]=X);let j=X[w.id];j===void 0&&(j={},X[w.id]=j);let O=j[z];return O===void 0&&(O=d(l()),j[z]=O),O}function d(x){const w=[],B=[],z=[];for(let X=0;X<t;X++)w[X]=0,B[X]=0,z[X]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:w,enabledAttributes:B,attributeDivisors:z,object:x,attributes:{},index:null}}function f(x,w,B,z){const X=s.attributes,j=w.attributes;let O=0;const K=B.getAttributes();for(const H in K)if(K[H].location>=0){const oe=X[H];let $=j[H];if($===void 0&&(H==="instanceMatrix"&&x.instanceMatrix&&($=x.instanceMatrix),H==="instanceColor"&&x.instanceColor&&($=x.instanceColor)),oe===void 0||oe.attribute!==$||$&&oe.data!==$.data)return!0;O++}return s.attributesNum!==O||s.index!==z}function m(x,w,B,z){const X={},j=w.attributes;let O=0;const K=B.getAttributes();for(const H in K)if(K[H].location>=0){let oe=j[H];oe===void 0&&(H==="instanceMatrix"&&x.instanceMatrix&&(oe=x.instanceMatrix),H==="instanceColor"&&x.instanceColor&&(oe=x.instanceColor));const $={};$.attribute=oe,oe&&oe.data&&($.data=oe.data),X[H]=$,O++}s.attributes=X,s.attributesNum=O,s.index=z}function _(){const x=s.newAttributes;for(let w=0,B=x.length;w<B;w++)x[w]=0}function g(x){p(x,0)}function p(x,w){const B=s.newAttributes,z=s.enabledAttributes,X=s.attributeDivisors;B[x]=1,z[x]===0&&(r.enableVertexAttribArray(x),z[x]=1),X[x]!==w&&(r.vertexAttribDivisor(x,w),X[x]=w)}function M(){const x=s.newAttributes,w=s.enabledAttributes;for(let B=0,z=w.length;B<z;B++)w[B]!==x[B]&&(r.disableVertexAttribArray(B),w[B]=0)}function E(x,w,B,z,X,j,O){O===!0?r.vertexAttribIPointer(x,w,B,X,j):r.vertexAttribPointer(x,w,B,z,X,j)}function y(x,w,B,z){_();const X=z.attributes,j=B.getAttributes(),O=w.defaultAttributeValues;for(const K in j){const H=j[K];if(H.location>=0){let ie=X[K];if(ie===void 0&&(K==="instanceMatrix"&&x.instanceMatrix&&(ie=x.instanceMatrix),K==="instanceColor"&&x.instanceColor&&(ie=x.instanceColor)),ie!==void 0){const oe=ie.normalized,$=ie.itemSize,xe=e.get(ie);if(xe===void 0)continue;const Ee=xe.buffer,q=xe.type,te=xe.bytesPerElement,se=q===r.INT||q===r.UNSIGNED_INT||ie.gpuType===Sl;if(ie.isInterleavedBufferAttribute){const le=ie.data,be=le.stride,st=ie.offset;if(le.isInstancedInterleavedBuffer){for(let Ke=0;Ke<H.locationSize;Ke++)p(H.location+Ke,le.meshPerAttribute);x.isInstancedMesh!==!0&&z._maxInstanceCount===void 0&&(z._maxInstanceCount=le.meshPerAttribute*le.count)}else for(let Ke=0;Ke<H.locationSize;Ke++)g(H.location+Ke);r.bindBuffer(r.ARRAY_BUFFER,Ee);for(let Ke=0;Ke<H.locationSize;Ke++)E(H.location+Ke,$/H.locationSize,q,oe,be*te,(st+$/H.locationSize*Ke)*te,se)}else{if(ie.isInstancedBufferAttribute){for(let le=0;le<H.locationSize;le++)p(H.location+le,ie.meshPerAttribute);x.isInstancedMesh!==!0&&z._maxInstanceCount===void 0&&(z._maxInstanceCount=ie.meshPerAttribute*ie.count)}else for(let le=0;le<H.locationSize;le++)g(H.location+le);r.bindBuffer(r.ARRAY_BUFFER,Ee);for(let le=0;le<H.locationSize;le++)E(H.location+le,$/H.locationSize,q,oe,$*te,$/H.locationSize*le*te,se)}}else if(O!==void 0){const oe=O[K];if(oe!==void 0)switch(oe.length){case 2:r.vertexAttrib2fv(H.location,oe);break;case 3:r.vertexAttrib3fv(H.location,oe);break;case 4:r.vertexAttrib4fv(H.location,oe);break;default:r.vertexAttrib1fv(H.location,oe)}}}}M()}function I(){L();for(const x in n){const w=n[x];for(const B in w){const z=w[B];for(const X in z)u(z[X].object),delete z[X];delete w[B]}delete n[x]}}function R(x){if(n[x.id]===void 0)return;const w=n[x.id];for(const B in w){const z=w[B];for(const X in z)u(z[X].object),delete z[X];delete w[B]}delete n[x.id]}function C(x){for(const w in n){const B=n[w];if(B[x.id]===void 0)continue;const z=B[x.id];for(const X in z)u(z[X].object),delete z[X];delete B[x.id]}}function L(){b(),a=!0,s!==i&&(s=i,c(s.object))}function b(){i.geometry=null,i.program=null,i.wireframe=!1}return{setup:o,reset:L,resetDefaultState:b,dispose:I,releaseStatesOfGeometry:R,releaseStatesOfProgram:C,initAttributes:_,enableAttribute:g,disableUnusedAttributes:M}}function U_(r,e,t){let n;function i(c){n=c}function s(c,u){r.drawArrays(n,c,u),t.update(u,n,1)}function a(c,u,h){h!==0&&(r.drawArraysInstanced(n,c,u,h),t.update(u,n,h))}function o(c,u,h){if(h===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(n,c,0,u,0,h);let f=0;for(let m=0;m<h;m++)f+=u[m];t.update(f,n,1)}function l(c,u,h,d){if(h===0)return;const f=e.get("WEBGL_multi_draw");if(f===null)for(let m=0;m<c.length;m++)a(c[m],u[m],d[m]);else{f.multiDrawArraysInstancedWEBGL(n,c,0,u,0,d,0,h);let m=0;for(let _=0;_<h;_++)m+=u[_]*d[_];t.update(m,n,1)}}this.setMode=i,this.render=s,this.renderInstances=a,this.renderMultiDraw=o,this.renderMultiDrawInstances=l}function I_(r,e,t,n){let i;function s(){if(i!==void 0)return i;if(e.has("EXT_texture_filter_anisotropic")===!0){const C=e.get("EXT_texture_filter_anisotropic");i=r.getParameter(C.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i}function a(C){return!(C!==In&&n.convert(C)!==r.getParameter(r.IMPLEMENTATION_COLOR_READ_FORMAT))}function o(C){const L=C===hs&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(C!==Jn&&n.convert(C)!==r.getParameter(r.IMPLEMENTATION_COLOR_READ_TYPE)&&C!==Yn&&!L)}function l(C){if(C==="highp"){if(r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.HIGH_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT).precision>0)return"highp";C="mediump"}return C==="mediump"&&r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.MEDIUM_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=t.precision!==void 0?t.precision:"highp";const u=l(c);u!==c&&(console.warn("THREE.WebGLRenderer:",c,"not supported, using",u,"instead."),c=u);const h=t.logarithmicDepthBuffer===!0,d=t.reverseDepthBuffer===!0&&e.has("EXT_clip_control"),f=r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS),m=r.getParameter(r.MAX_VERTEX_TEXTURE_IMAGE_UNITS),_=r.getParameter(r.MAX_TEXTURE_SIZE),g=r.getParameter(r.MAX_CUBE_MAP_TEXTURE_SIZE),p=r.getParameter(r.MAX_VERTEX_ATTRIBS),M=r.getParameter(r.MAX_VERTEX_UNIFORM_VECTORS),E=r.getParameter(r.MAX_VARYING_VECTORS),y=r.getParameter(r.MAX_FRAGMENT_UNIFORM_VECTORS),I=m>0,R=r.getParameter(r.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:a,textureTypeReadable:o,precision:c,logarithmicDepthBuffer:h,reverseDepthBuffer:d,maxTextures:f,maxVertexTextures:m,maxTextureSize:_,maxCubemapSize:g,maxAttributes:p,maxVertexUniforms:M,maxVaryings:E,maxFragmentUniforms:y,vertexTextures:I,maxSamples:R}}function N_(r){const e=this;let t=null,n=0,i=!1,s=!1;const a=new Ti,o=new gt,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(h,d){const f=h.length!==0||d||n!==0||i;return i=d,n=h.length,f},this.beginShadows=function(){s=!0,u(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(h,d){t=u(h,d,0)},this.setState=function(h,d,f){const m=h.clippingPlanes,_=h.clipIntersection,g=h.clipShadows,p=r.get(h);if(!i||m===null||m.length===0||s&&!g)s?u(null):c();else{const M=s?0:n,E=M*4;let y=p.clippingState||null;l.value=y,y=u(m,d,E,f);for(let I=0;I!==E;++I)y[I]=t[I];p.clippingState=y,this.numIntersection=_?this.numPlanes:0,this.numPlanes+=M}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function u(h,d,f,m){const _=h!==null?h.length:0;let g=null;if(_!==0){if(g=l.value,m!==!0||g===null){const p=f+_*4,M=d.matrixWorldInverse;o.getNormalMatrix(M),(g===null||g.length<p)&&(g=new Float32Array(p));for(let E=0,y=f;E!==_;++E,y+=4)a.copy(h[E]).applyMatrix4(M,o),a.normal.toArray(g,y),g[y+3]=a.constant}l.value=g,l.needsUpdate=!0}return e.numPlanes=_,e.numIntersection=0,g}}function F_(r){let e=new WeakMap;function t(a,o){return o===Po?a.mapping=Dr:o===Do&&(a.mapping=Lr),a}function n(a){if(a&&a.isTexture){const o=a.mapping;if(o===Po||o===Do)if(e.has(a)){const l=e.get(a).texture;return t(l,a.mapping)}else{const l=a.image;if(l&&l.height>0){const c=new pp(l.height);return c.fromEquirectangularTexture(r,a),e.set(a,c),a.addEventListener("dispose",i),t(c.texture,a.mapping)}else return null}}return a}function i(a){const o=a.target;o.removeEventListener("dispose",i);const l=e.get(o);l!==void 0&&(e.delete(o),l.dispose())}function s(){e=new WeakMap}return{get:n,dispose:s}}const wr=4,Jc=[.125,.215,.35,.446,.526,.582],Xi=20,so=new Ta,Zc=new ht;let ao=null,oo=0,lo=0,co=!1;const Hi=(1+Math.sqrt(5))/2,Sr=1/Hi,Qc=[new k(-Hi,Sr,0),new k(Hi,Sr,0),new k(-Sr,0,Hi),new k(Sr,0,Hi),new k(0,Hi,-Sr),new k(0,Hi,Sr),new k(-1,1,-1),new k(1,1,-1),new k(-1,1,1),new k(1,1,1)],O_=new k;class eu{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,n=.1,i=100,s={}){const{size:a=256,position:o=O_}=s;ao=this._renderer.getRenderTarget(),oo=this._renderer.getActiveCubeFace(),lo=this._renderer.getActiveMipmapLevel(),co=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(a);const l=this._allocateTargets();return l.depthBuffer=!0,this._sceneToCubeUV(e,n,i,l,o),t>0&&this._blur(l,0,0,t),this._applyPMREM(l),this._cleanup(l),l}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=iu(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=nu(),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;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(ao,oo,lo),this._renderer.xr.enabled=co,e.scissorTest=!1,qs(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===Dr||e.mapping===Lr?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),ao=this._renderer.getRenderTarget(),oo=this._renderer.getActiveCubeFace(),lo=this._renderer.getActiveMipmapLevel(),co=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const n=t||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,n={magFilter:An,minFilter:An,generateMipmaps:!1,type:hs,format:In,colorSpace:Ur,depthBuffer:!1},i=tu(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=tu(e,t,n);const{_lodMax:s}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=B_(s)),this._blurMaterial=k_(s,e,t)}return i}_compileMaterial(e){const t=new Ut(this._lodPlanes[0],e);this._renderer.compile(t,so)}_sceneToCubeUV(e,t,n,i,s){const l=new sn(90,1,t,n),c=[1,-1,1,1,1,1],u=[1,1,1,-1,-1,-1],h=this._renderer,d=h.autoClear,f=h.toneMapping;h.getClearColor(Zc),h.toneMapping=Ri,h.autoClear=!1;const m=new Ci({name:"PMREM.Background",side:_n,depthWrite:!1,depthTest:!1}),_=new Ut(new Br,m);let g=!1;const p=e.background;p?p.isColor&&(m.color.copy(p),e.background=null,g=!0):(m.color.copy(Zc),g=!0);for(let M=0;M<6;M++){const E=M%3;E===0?(l.up.set(0,c[M],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x+u[M],s.y,s.z)):E===1?(l.up.set(0,0,c[M]),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y+u[M],s.z)):(l.up.set(0,c[M],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y,s.z+u[M]));const y=this._cubeSize;qs(i,E*y,M>2?y:0,y,y),h.setRenderTarget(i),g&&h.render(_,l),h.render(e,l)}_.geometry.dispose(),_.material.dispose(),h.toneMapping=f,h.autoClear=d,e.background=p}_textureToCubeUV(e,t){const n=this._renderer,i=e.mapping===Dr||e.mapping===Lr;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=iu()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=nu());const s=i?this._cubemapMaterial:this._equirectMaterial,a=new Ut(this._lodPlanes[0],s),o=s.uniforms;o.envMap.value=e;const l=this._cubeSize;qs(t,0,0,3*l,2*l),n.setRenderTarget(t),n.render(a,so)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const i=this._lodPlanes.length;for(let s=1;s<i;s++){const a=Math.sqrt(this._sigmas[s]*this._sigmas[s]-this._sigmas[s-1]*this._sigmas[s-1]),o=Qc[(i-s-1)%Qc.length];this._blur(e,s-1,s,a,o)}t.autoClear=n}_blur(e,t,n,i,s){const a=this._pingPongRenderTarget;this._halfBlur(e,a,t,n,i,"latitudinal",s),this._halfBlur(a,e,n,n,i,"longitudinal",s)}_halfBlur(e,t,n,i,s,a,o){const l=this._renderer,c=this._blurMaterial;a!=="latitudinal"&&a!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");const u=3,h=new Ut(this._lodPlanes[i],c),d=c.uniforms,f=this._sizeLods[n]-1,m=isFinite(s)?Math.PI/(2*f):2*Math.PI/(2*Xi-1),_=s/m,g=isFinite(s)?1+Math.floor(u*_):Xi;g>Xi&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${g} samples when the maximum is set to ${Xi}`);const p=[];let M=0;for(let C=0;C<Xi;++C){const L=C/_,b=Math.exp(-L*L/2);p.push(b),C===0?M+=b:C<g&&(M+=2*b)}for(let C=0;C<p.length;C++)p[C]=p[C]/M;d.envMap.value=e.texture,d.samples.value=g,d.weights.value=p,d.latitudinal.value=a==="latitudinal",o&&(d.poleAxis.value=o);const{_lodMax:E}=this;d.dTheta.value=m,d.mipInt.value=E-n;const y=this._sizeLods[i],I=3*y*(i>E-wr?i-E+wr:0),R=4*(this._cubeSize-y);qs(t,I,R,3*y,2*y),l.setRenderTarget(t),l.render(h,so)}}function B_(r){const e=[],t=[],n=[];let i=r;const s=r-wr+1+Jc.length;for(let a=0;a<s;a++){const o=Math.pow(2,i);t.push(o);let l=1/o;a>r-wr?l=Jc[a-r+wr-1]:a===0&&(l=0),n.push(l);const c=1/(o-2),u=-c,h=1+c,d=[u,u,h,u,h,h,u,u,h,h,u,h],f=6,m=6,_=3,g=2,p=1,M=new Float32Array(_*m*f),E=new Float32Array(g*m*f),y=new Float32Array(p*m*f);for(let R=0;R<f;R++){const C=R%3*2/3-1,L=R>2?0:-1,b=[C,L,0,C+2/3,L,0,C+2/3,L+1,0,C,L,0,C+2/3,L+1,0,C,L+1,0];M.set(b,_*m*R),E.set(d,g*m*R);const x=[R,R,R,R,R,R];y.set(x,p*m*R)}const I=new Vt;I.setAttribute("position",new Xt(M,_)),I.setAttribute("uv",new Xt(E,g)),I.setAttribute("faceIndex",new Xt(y,p)),e.push(I),i>wr&&i--}return{lodPlanes:e,sizeLods:t,sigmas:n}}function tu(r,e,t){const n=new Ji(r,e,t);return n.texture.mapping=Sa,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function qs(r,e,t,n,i){r.viewport.set(e,t,n,i),r.scissor.set(e,t,n,i)}function k_(r,e,t){const n=new Float32Array(Xi),i=new k(0,1,0);return new gi({name:"SphericalGaussianBlur",defines:{n:Xi,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${r}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:Hl(),fragmentShader:`
|
|
3574
|
+
}`,_t={alphahash_fragment:$p,alphahash_pars_fragment:Jp,alphamap_fragment:Zp,alphamap_pars_fragment:Qp,alphatest_fragment:em,alphatest_pars_fragment:tm,aomap_fragment:nm,aomap_pars_fragment:im,batching_pars_vertex:rm,batching_vertex:sm,begin_vertex:am,beginnormal_vertex:om,bsdfs:lm,iridescence_fragment:cm,bumpmap_pars_fragment:um,clipping_planes_fragment:hm,clipping_planes_pars_fragment:dm,clipping_planes_pars_vertex:fm,clipping_planes_vertex:pm,color_fragment:mm,color_pars_fragment:gm,color_pars_vertex:_m,color_vertex:vm,common:ym,cube_uv_reflection_fragment:xm,defaultnormal_vertex:Sm,displacementmap_pars_vertex:Mm,displacementmap_vertex:bm,emissivemap_fragment:Em,emissivemap_pars_fragment:Tm,colorspace_fragment:wm,colorspace_pars_fragment:Am,envmap_fragment:Rm,envmap_common_pars_fragment:Cm,envmap_pars_fragment:Pm,envmap_pars_vertex:Dm,envmap_physical_pars_fragment:Hm,envmap_vertex:Lm,fog_vertex:Um,fog_pars_vertex:Im,fog_fragment:Nm,fog_pars_fragment:Fm,gradientmap_pars_fragment:Om,lightmap_pars_fragment:Bm,lights_lambert_fragment:km,lights_lambert_pars_fragment:zm,lights_pars_begin:Vm,lights_toon_fragment:Gm,lights_toon_pars_fragment:Wm,lights_phong_fragment:Xm,lights_phong_pars_fragment:qm,lights_physical_fragment:jm,lights_physical_pars_fragment:Ym,lights_fragment_begin:Km,lights_fragment_maps:$m,lights_fragment_end:Jm,logdepthbuf_fragment:Zm,logdepthbuf_pars_fragment:Qm,logdepthbuf_pars_vertex:eg,logdepthbuf_vertex:tg,map_fragment:ng,map_pars_fragment:ig,map_particle_fragment:rg,map_particle_pars_fragment:sg,metalnessmap_fragment:ag,metalnessmap_pars_fragment:og,morphinstance_vertex:lg,morphcolor_vertex:cg,morphnormal_vertex:ug,morphtarget_pars_vertex:hg,morphtarget_vertex:dg,normal_fragment_begin:fg,normal_fragment_maps:pg,normal_pars_fragment:mg,normal_pars_vertex:gg,normal_vertex:_g,normalmap_pars_fragment:vg,clearcoat_normal_fragment_begin:yg,clearcoat_normal_fragment_maps:xg,clearcoat_pars_fragment:Sg,iridescence_pars_fragment:Mg,opaque_fragment:bg,packing:Eg,premultiplied_alpha_fragment:Tg,project_vertex:wg,dithering_fragment:Ag,dithering_pars_fragment:Rg,roughnessmap_fragment:Cg,roughnessmap_pars_fragment:Pg,shadowmap_pars_fragment:Dg,shadowmap_pars_vertex:Lg,shadowmap_vertex:Ug,shadowmask_pars_fragment:Ig,skinbase_vertex:Ng,skinning_pars_vertex:Fg,skinning_vertex:Og,skinnormal_vertex:Bg,specularmap_fragment:kg,specularmap_pars_fragment:zg,tonemapping_fragment:Vg,tonemapping_pars_fragment:Hg,transmission_fragment:Gg,transmission_pars_fragment:Wg,uv_pars_fragment:Xg,uv_pars_vertex:qg,uv_vertex:jg,worldpos_vertex:Yg,background_vert:Kg,background_frag:$g,backgroundCube_vert:Jg,backgroundCube_frag:Zg,cube_vert:Qg,cube_frag:e_,depth_vert:t_,depth_frag:n_,distanceRGBA_vert:i_,distanceRGBA_frag:r_,equirect_vert:s_,equirect_frag:a_,linedashed_vert:o_,linedashed_frag:l_,meshbasic_vert:c_,meshbasic_frag:u_,meshlambert_vert:h_,meshlambert_frag:d_,meshmatcap_vert:f_,meshmatcap_frag:p_,meshnormal_vert:m_,meshnormal_frag:g_,meshphong_vert:__,meshphong_frag:v_,meshphysical_vert:y_,meshphysical_frag:x_,meshtoon_vert:S_,meshtoon_frag:M_,points_vert:b_,points_frag:E_,shadow_vert:T_,shadow_frag:w_,sprite_vert:A_,sprite_frag:R_},Ce={common:{diffuse:{value:new ht(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new gt},alphaMap:{value:null},alphaMapTransform:{value:new gt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new gt}},envmap:{envMap:{value:null},envMapRotation:{value:new gt},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new gt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new gt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new gt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new gt},normalScale:{value:new dt(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new gt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new gt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new gt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new gt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new ht(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,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 ht(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new gt},alphaTest:{value:0},uvTransform:{value:new gt}},sprite:{diffuse:{value:new ht(16777215)},opacity:{value:1},center:{value:new dt(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new gt},alphaMap:{value:null},alphaMapTransform:{value:new gt},alphaTest:{value:0}}},Mn={basic:{uniforms:gn([Ce.common,Ce.specularmap,Ce.envmap,Ce.aomap,Ce.lightmap,Ce.fog]),vertexShader:_t.meshbasic_vert,fragmentShader:_t.meshbasic_frag},lambert:{uniforms:gn([Ce.common,Ce.specularmap,Ce.envmap,Ce.aomap,Ce.lightmap,Ce.emissivemap,Ce.bumpmap,Ce.normalmap,Ce.displacementmap,Ce.fog,Ce.lights,{emissive:{value:new ht(0)}}]),vertexShader:_t.meshlambert_vert,fragmentShader:_t.meshlambert_frag},phong:{uniforms:gn([Ce.common,Ce.specularmap,Ce.envmap,Ce.aomap,Ce.lightmap,Ce.emissivemap,Ce.bumpmap,Ce.normalmap,Ce.displacementmap,Ce.fog,Ce.lights,{emissive:{value:new ht(0)},specular:{value:new ht(1118481)},shininess:{value:30}}]),vertexShader:_t.meshphong_vert,fragmentShader:_t.meshphong_frag},standard:{uniforms:gn([Ce.common,Ce.envmap,Ce.aomap,Ce.lightmap,Ce.emissivemap,Ce.bumpmap,Ce.normalmap,Ce.displacementmap,Ce.roughnessmap,Ce.metalnessmap,Ce.fog,Ce.lights,{emissive:{value:new ht(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:_t.meshphysical_vert,fragmentShader:_t.meshphysical_frag},toon:{uniforms:gn([Ce.common,Ce.aomap,Ce.lightmap,Ce.emissivemap,Ce.bumpmap,Ce.normalmap,Ce.displacementmap,Ce.gradientmap,Ce.fog,Ce.lights,{emissive:{value:new ht(0)}}]),vertexShader:_t.meshtoon_vert,fragmentShader:_t.meshtoon_frag},matcap:{uniforms:gn([Ce.common,Ce.bumpmap,Ce.normalmap,Ce.displacementmap,Ce.fog,{matcap:{value:null}}]),vertexShader:_t.meshmatcap_vert,fragmentShader:_t.meshmatcap_frag},points:{uniforms:gn([Ce.points,Ce.fog]),vertexShader:_t.points_vert,fragmentShader:_t.points_frag},dashed:{uniforms:gn([Ce.common,Ce.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:_t.linedashed_vert,fragmentShader:_t.linedashed_frag},depth:{uniforms:gn([Ce.common,Ce.displacementmap]),vertexShader:_t.depth_vert,fragmentShader:_t.depth_frag},normal:{uniforms:gn([Ce.common,Ce.bumpmap,Ce.normalmap,Ce.displacementmap,{opacity:{value:1}}]),vertexShader:_t.meshnormal_vert,fragmentShader:_t.meshnormal_frag},sprite:{uniforms:gn([Ce.sprite,Ce.fog]),vertexShader:_t.sprite_vert,fragmentShader:_t.sprite_frag},background:{uniforms:{uvTransform:{value:new gt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:_t.background_vert,fragmentShader:_t.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new gt}},vertexShader:_t.backgroundCube_vert,fragmentShader:_t.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:_t.cube_vert,fragmentShader:_t.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:_t.equirect_vert,fragmentShader:_t.equirect_frag},distanceRGBA:{uniforms:gn([Ce.common,Ce.displacementmap,{referencePosition:{value:new k},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:_t.distanceRGBA_vert,fragmentShader:_t.distanceRGBA_frag},shadow:{uniforms:gn([Ce.lights,Ce.fog,{color:{value:new ht(0)},opacity:{value:1}}]),vertexShader:_t.shadow_vert,fragmentShader:_t.shadow_frag}};Mn.physical={uniforms:gn([Mn.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new gt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new gt},clearcoatNormalScale:{value:new dt(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new gt},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new gt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new gt},sheen:{value:0},sheenColor:{value:new ht(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new gt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new gt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new gt},transmissionSamplerSize:{value:new dt},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new gt},attenuationDistance:{value:0},attenuationColor:{value:new ht(0)},specularColor:{value:new ht(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new gt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new gt},anisotropyVector:{value:new dt},anisotropyMap:{value:null},anisotropyMapTransform:{value:new gt}}]),vertexShader:_t.meshphysical_vert,fragmentShader:_t.meshphysical_frag};const Xs={r:0,b:0,g:0},Bi=new bn,C_=new ut;function P_(r,e,t,n,i,s,a){const o=new ht(0);let l=s===!0?0:1,c,u,h=null,d=0,f=null;function m(E){let y=E.isScene===!0?E.background:null;return y&&y.isTexture&&(y=(E.backgroundBlurriness>0?t:e).get(y)),y}function _(E){let y=!1;const I=m(E);I===null?p(o,l):I&&I.isColor&&(p(I,1),y=!0);const R=r.xr.getEnvironmentBlendMode();R==="additive"?n.buffers.color.setClear(0,0,0,1,a):R==="alpha-blend"&&n.buffers.color.setClear(0,0,0,0,a),(r.autoClear||y)&&(n.buffers.depth.setTest(!0),n.buffers.depth.setMask(!0),n.buffers.color.setMask(!0),r.clear(r.autoClearColor,r.autoClearDepth,r.autoClearStencil))}function g(E,y){const I=m(y);I&&(I.isCubeTexture||I.mapping===Sa)?(u===void 0&&(u=new Ut(new Br(1,1,1),new gi({name:"BackgroundCubeMaterial",uniforms:Nr(Mn.backgroundCube.uniforms),vertexShader:Mn.backgroundCube.vertexShader,fragmentShader:Mn.backgroundCube.fragmentShader,side:_n,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),u.geometry.deleteAttribute("normal"),u.geometry.deleteAttribute("uv"),u.onBeforeRender=function(R,C,L){this.matrixWorld.copyPosition(L.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(u)),Bi.copy(y.backgroundRotation),Bi.x*=-1,Bi.y*=-1,Bi.z*=-1,I.isCubeTexture&&I.isRenderTargetTexture===!1&&(Bi.y*=-1,Bi.z*=-1),u.material.uniforms.envMap.value=I,u.material.uniforms.flipEnvMap.value=I.isCubeTexture&&I.isRenderTargetTexture===!1?-1:1,u.material.uniforms.backgroundBlurriness.value=y.backgroundBlurriness,u.material.uniforms.backgroundIntensity.value=y.backgroundIntensity,u.material.uniforms.backgroundRotation.value.setFromMatrix4(C_.makeRotationFromEuler(Bi)),u.material.toneMapped=vt.getTransfer(I.colorSpace)!==It,(h!==I||d!==I.version||f!==r.toneMapping)&&(u.material.needsUpdate=!0,h=I,d=I.version,f=r.toneMapping),u.layers.enableAll(),E.unshift(u,u.geometry,u.material,0,0,null)):I&&I.isTexture&&(c===void 0&&(c=new Ut(new ds(2,2),new gi({name:"BackgroundMaterial",uniforms:Nr(Mn.background.uniforms),vertexShader:Mn.background.vertexShader,fragmentShader:Mn.background.fragmentShader,side:$n,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(c)),c.material.uniforms.t2D.value=I,c.material.uniforms.backgroundIntensity.value=y.backgroundIntensity,c.material.toneMapped=vt.getTransfer(I.colorSpace)!==It,I.matrixAutoUpdate===!0&&I.updateMatrix(),c.material.uniforms.uvTransform.value.copy(I.matrix),(h!==I||d!==I.version||f!==r.toneMapping)&&(c.material.needsUpdate=!0,h=I,d=I.version,f=r.toneMapping),c.layers.enableAll(),E.unshift(c,c.geometry,c.material,0,0,null))}function p(E,y){E.getRGB(Xs,fh(r)),n.buffers.color.setClear(Xs.r,Xs.g,Xs.b,y,a)}function M(){u!==void 0&&(u.geometry.dispose(),u.material.dispose(),u=void 0),c!==void 0&&(c.geometry.dispose(),c.material.dispose(),c=void 0)}return{getClearColor:function(){return o},setClearColor:function(E,y=1){o.set(E),l=y,p(o,l)},getClearAlpha:function(){return l},setClearAlpha:function(E){l=E,p(o,l)},render:_,addToRenderList:g,dispose:M}}function D_(r,e){const t=r.getParameter(r.MAX_VERTEX_ATTRIBS),n={},i=d(null);let s=i,a=!1;function o(x,w,B,z,X){let j=!1;const O=h(z,B,w);s!==O&&(s=O,c(s.object)),j=f(x,z,B,X),j&&m(x,z,B,X),X!==null&&e.update(X,r.ELEMENT_ARRAY_BUFFER),(j||a)&&(a=!1,y(x,w,B,z),X!==null&&r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,e.get(X).buffer))}function l(){return r.createVertexArray()}function c(x){return r.bindVertexArray(x)}function u(x){return r.deleteVertexArray(x)}function h(x,w,B){const z=B.wireframe===!0;let X=n[x.id];X===void 0&&(X={},n[x.id]=X);let j=X[w.id];j===void 0&&(j={},X[w.id]=j);let O=j[z];return O===void 0&&(O=d(l()),j[z]=O),O}function d(x){const w=[],B=[],z=[];for(let X=0;X<t;X++)w[X]=0,B[X]=0,z[X]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:w,enabledAttributes:B,attributeDivisors:z,object:x,attributes:{},index:null}}function f(x,w,B,z){const X=s.attributes,j=w.attributes;let O=0;const K=B.getAttributes();for(const H in K)if(K[H].location>=0){const oe=X[H];let $=j[H];if($===void 0&&(H==="instanceMatrix"&&x.instanceMatrix&&($=x.instanceMatrix),H==="instanceColor"&&x.instanceColor&&($=x.instanceColor)),oe===void 0||oe.attribute!==$||$&&oe.data!==$.data)return!0;O++}return s.attributesNum!==O||s.index!==z}function m(x,w,B,z){const X={},j=w.attributes;let O=0;const K=B.getAttributes();for(const H in K)if(K[H].location>=0){let oe=j[H];oe===void 0&&(H==="instanceMatrix"&&x.instanceMatrix&&(oe=x.instanceMatrix),H==="instanceColor"&&x.instanceColor&&(oe=x.instanceColor));const $={};$.attribute=oe,oe&&oe.data&&($.data=oe.data),X[H]=$,O++}s.attributes=X,s.attributesNum=O,s.index=z}function _(){const x=s.newAttributes;for(let w=0,B=x.length;w<B;w++)x[w]=0}function g(x){p(x,0)}function p(x,w){const B=s.newAttributes,z=s.enabledAttributes,X=s.attributeDivisors;B[x]=1,z[x]===0&&(r.enableVertexAttribArray(x),z[x]=1),X[x]!==w&&(r.vertexAttribDivisor(x,w),X[x]=w)}function M(){const x=s.newAttributes,w=s.enabledAttributes;for(let B=0,z=w.length;B<z;B++)w[B]!==x[B]&&(r.disableVertexAttribArray(B),w[B]=0)}function E(x,w,B,z,X,j,O){O===!0?r.vertexAttribIPointer(x,w,B,X,j):r.vertexAttribPointer(x,w,B,z,X,j)}function y(x,w,B,z){_();const X=z.attributes,j=B.getAttributes(),O=w.defaultAttributeValues;for(const K in j){const H=j[K];if(H.location>=0){let re=X[K];if(re===void 0&&(K==="instanceMatrix"&&x.instanceMatrix&&(re=x.instanceMatrix),K==="instanceColor"&&x.instanceColor&&(re=x.instanceColor)),re!==void 0){const oe=re.normalized,$=re.itemSize,xe=e.get(re);if(xe===void 0)continue;const Ee=xe.buffer,q=xe.type,te=xe.bytesPerElement,se=q===r.INT||q===r.UNSIGNED_INT||re.gpuType===Sl;if(re.isInterleavedBufferAttribute){const le=re.data,be=le.stride,st=re.offset;if(le.isInstancedInterleavedBuffer){for(let Ke=0;Ke<H.locationSize;Ke++)p(H.location+Ke,le.meshPerAttribute);x.isInstancedMesh!==!0&&z._maxInstanceCount===void 0&&(z._maxInstanceCount=le.meshPerAttribute*le.count)}else for(let Ke=0;Ke<H.locationSize;Ke++)g(H.location+Ke);r.bindBuffer(r.ARRAY_BUFFER,Ee);for(let Ke=0;Ke<H.locationSize;Ke++)E(H.location+Ke,$/H.locationSize,q,oe,be*te,(st+$/H.locationSize*Ke)*te,se)}else{if(re.isInstancedBufferAttribute){for(let le=0;le<H.locationSize;le++)p(H.location+le,re.meshPerAttribute);x.isInstancedMesh!==!0&&z._maxInstanceCount===void 0&&(z._maxInstanceCount=re.meshPerAttribute*re.count)}else for(let le=0;le<H.locationSize;le++)g(H.location+le);r.bindBuffer(r.ARRAY_BUFFER,Ee);for(let le=0;le<H.locationSize;le++)E(H.location+le,$/H.locationSize,q,oe,$*te,$/H.locationSize*le*te,se)}}else if(O!==void 0){const oe=O[K];if(oe!==void 0)switch(oe.length){case 2:r.vertexAttrib2fv(H.location,oe);break;case 3:r.vertexAttrib3fv(H.location,oe);break;case 4:r.vertexAttrib4fv(H.location,oe);break;default:r.vertexAttrib1fv(H.location,oe)}}}}M()}function I(){L();for(const x in n){const w=n[x];for(const B in w){const z=w[B];for(const X in z)u(z[X].object),delete z[X];delete w[B]}delete n[x]}}function R(x){if(n[x.id]===void 0)return;const w=n[x.id];for(const B in w){const z=w[B];for(const X in z)u(z[X].object),delete z[X];delete w[B]}delete n[x.id]}function C(x){for(const w in n){const B=n[w];if(B[x.id]===void 0)continue;const z=B[x.id];for(const X in z)u(z[X].object),delete z[X];delete B[x.id]}}function L(){b(),a=!0,s!==i&&(s=i,c(s.object))}function b(){i.geometry=null,i.program=null,i.wireframe=!1}return{setup:o,reset:L,resetDefaultState:b,dispose:I,releaseStatesOfGeometry:R,releaseStatesOfProgram:C,initAttributes:_,enableAttribute:g,disableUnusedAttributes:M}}function L_(r,e,t){let n;function i(c){n=c}function s(c,u){r.drawArrays(n,c,u),t.update(u,n,1)}function a(c,u,h){h!==0&&(r.drawArraysInstanced(n,c,u,h),t.update(u,n,h))}function o(c,u,h){if(h===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(n,c,0,u,0,h);let f=0;for(let m=0;m<h;m++)f+=u[m];t.update(f,n,1)}function l(c,u,h,d){if(h===0)return;const f=e.get("WEBGL_multi_draw");if(f===null)for(let m=0;m<c.length;m++)a(c[m],u[m],d[m]);else{f.multiDrawArraysInstancedWEBGL(n,c,0,u,0,d,0,h);let m=0;for(let _=0;_<h;_++)m+=u[_]*d[_];t.update(m,n,1)}}this.setMode=i,this.render=s,this.renderInstances=a,this.renderMultiDraw=o,this.renderMultiDrawInstances=l}function U_(r,e,t,n){let i;function s(){if(i!==void 0)return i;if(e.has("EXT_texture_filter_anisotropic")===!0){const C=e.get("EXT_texture_filter_anisotropic");i=r.getParameter(C.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i}function a(C){return!(C!==In&&n.convert(C)!==r.getParameter(r.IMPLEMENTATION_COLOR_READ_FORMAT))}function o(C){const L=C===hs&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(C!==Jn&&n.convert(C)!==r.getParameter(r.IMPLEMENTATION_COLOR_READ_TYPE)&&C!==Yn&&!L)}function l(C){if(C==="highp"){if(r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.HIGH_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT).precision>0)return"highp";C="mediump"}return C==="mediump"&&r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.MEDIUM_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=t.precision!==void 0?t.precision:"highp";const u=l(c);u!==c&&(console.warn("THREE.WebGLRenderer:",c,"not supported, using",u,"instead."),c=u);const h=t.logarithmicDepthBuffer===!0,d=t.reverseDepthBuffer===!0&&e.has("EXT_clip_control"),f=r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS),m=r.getParameter(r.MAX_VERTEX_TEXTURE_IMAGE_UNITS),_=r.getParameter(r.MAX_TEXTURE_SIZE),g=r.getParameter(r.MAX_CUBE_MAP_TEXTURE_SIZE),p=r.getParameter(r.MAX_VERTEX_ATTRIBS),M=r.getParameter(r.MAX_VERTEX_UNIFORM_VECTORS),E=r.getParameter(r.MAX_VARYING_VECTORS),y=r.getParameter(r.MAX_FRAGMENT_UNIFORM_VECTORS),I=m>0,R=r.getParameter(r.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:a,textureTypeReadable:o,precision:c,logarithmicDepthBuffer:h,reverseDepthBuffer:d,maxTextures:f,maxVertexTextures:m,maxTextureSize:_,maxCubemapSize:g,maxAttributes:p,maxVertexUniforms:M,maxVaryings:E,maxFragmentUniforms:y,vertexTextures:I,maxSamples:R}}function I_(r){const e=this;let t=null,n=0,i=!1,s=!1;const a=new Ti,o=new gt,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(h,d){const f=h.length!==0||d||n!==0||i;return i=d,n=h.length,f},this.beginShadows=function(){s=!0,u(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(h,d){t=u(h,d,0)},this.setState=function(h,d,f){const m=h.clippingPlanes,_=h.clipIntersection,g=h.clipShadows,p=r.get(h);if(!i||m===null||m.length===0||s&&!g)s?u(null):c();else{const M=s?0:n,E=M*4;let y=p.clippingState||null;l.value=y,y=u(m,d,E,f);for(let I=0;I!==E;++I)y[I]=t[I];p.clippingState=y,this.numIntersection=_?this.numPlanes:0,this.numPlanes+=M}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function u(h,d,f,m){const _=h!==null?h.length:0;let g=null;if(_!==0){if(g=l.value,m!==!0||g===null){const p=f+_*4,M=d.matrixWorldInverse;o.getNormalMatrix(M),(g===null||g.length<p)&&(g=new Float32Array(p));for(let E=0,y=f;E!==_;++E,y+=4)a.copy(h[E]).applyMatrix4(M,o),a.normal.toArray(g,y),g[y+3]=a.constant}l.value=g,l.needsUpdate=!0}return e.numPlanes=_,e.numIntersection=0,g}}function N_(r){let e=new WeakMap;function t(a,o){return o===Po?a.mapping=Dr:o===Do&&(a.mapping=Lr),a}function n(a){if(a&&a.isTexture){const o=a.mapping;if(o===Po||o===Do)if(e.has(a)){const l=e.get(a).texture;return t(l,a.mapping)}else{const l=a.image;if(l&&l.height>0){const c=new fp(l.height);return c.fromEquirectangularTexture(r,a),e.set(a,c),a.addEventListener("dispose",i),t(c.texture,a.mapping)}else return null}}return a}function i(a){const o=a.target;o.removeEventListener("dispose",i);const l=e.get(o);l!==void 0&&(e.delete(o),l.dispose())}function s(){e=new WeakMap}return{get:n,dispose:s}}const wr=4,Jc=[.125,.215,.35,.446,.526,.582],Xi=20,so=new Ta,Zc=new ht;let ao=null,oo=0,lo=0,co=!1;const Hi=(1+Math.sqrt(5))/2,Sr=1/Hi,Qc=[new k(-Hi,Sr,0),new k(Hi,Sr,0),new k(-Sr,0,Hi),new k(Sr,0,Hi),new k(0,Hi,-Sr),new k(0,Hi,Sr),new k(-1,1,-1),new k(1,1,-1),new k(-1,1,1),new k(1,1,1)],F_=new k;class eu{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,n=.1,i=100,s={}){const{size:a=256,position:o=F_}=s;ao=this._renderer.getRenderTarget(),oo=this._renderer.getActiveCubeFace(),lo=this._renderer.getActiveMipmapLevel(),co=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(a);const l=this._allocateTargets();return l.depthBuffer=!0,this._sceneToCubeUV(e,n,i,l,o),t>0&&this._blur(l,0,0,t),this._applyPMREM(l),this._cleanup(l),l}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=iu(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=nu(),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;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(ao,oo,lo),this._renderer.xr.enabled=co,e.scissorTest=!1,qs(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===Dr||e.mapping===Lr?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),ao=this._renderer.getRenderTarget(),oo=this._renderer.getActiveCubeFace(),lo=this._renderer.getActiveMipmapLevel(),co=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const n=t||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,n={magFilter:An,minFilter:An,generateMipmaps:!1,type:hs,format:In,colorSpace:Ur,depthBuffer:!1},i=tu(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=tu(e,t,n);const{_lodMax:s}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=O_(s)),this._blurMaterial=B_(s,e,t)}return i}_compileMaterial(e){const t=new Ut(this._lodPlanes[0],e);this._renderer.compile(t,so)}_sceneToCubeUV(e,t,n,i,s){const l=new sn(90,1,t,n),c=[1,-1,1,1,1,1],u=[1,1,1,-1,-1,-1],h=this._renderer,d=h.autoClear,f=h.toneMapping;h.getClearColor(Zc),h.toneMapping=Ri,h.autoClear=!1;const m=new Ci({name:"PMREM.Background",side:_n,depthWrite:!1,depthTest:!1}),_=new Ut(new Br,m);let g=!1;const p=e.background;p?p.isColor&&(m.color.copy(p),e.background=null,g=!0):(m.color.copy(Zc),g=!0);for(let M=0;M<6;M++){const E=M%3;E===0?(l.up.set(0,c[M],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x+u[M],s.y,s.z)):E===1?(l.up.set(0,0,c[M]),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y+u[M],s.z)):(l.up.set(0,c[M],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y,s.z+u[M]));const y=this._cubeSize;qs(i,E*y,M>2?y:0,y,y),h.setRenderTarget(i),g&&h.render(_,l),h.render(e,l)}_.geometry.dispose(),_.material.dispose(),h.toneMapping=f,h.autoClear=d,e.background=p}_textureToCubeUV(e,t){const n=this._renderer,i=e.mapping===Dr||e.mapping===Lr;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=iu()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=nu());const s=i?this._cubemapMaterial:this._equirectMaterial,a=new Ut(this._lodPlanes[0],s),o=s.uniforms;o.envMap.value=e;const l=this._cubeSize;qs(t,0,0,3*l,2*l),n.setRenderTarget(t),n.render(a,so)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const i=this._lodPlanes.length;for(let s=1;s<i;s++){const a=Math.sqrt(this._sigmas[s]*this._sigmas[s]-this._sigmas[s-1]*this._sigmas[s-1]),o=Qc[(i-s-1)%Qc.length];this._blur(e,s-1,s,a,o)}t.autoClear=n}_blur(e,t,n,i,s){const a=this._pingPongRenderTarget;this._halfBlur(e,a,t,n,i,"latitudinal",s),this._halfBlur(a,e,n,n,i,"longitudinal",s)}_halfBlur(e,t,n,i,s,a,o){const l=this._renderer,c=this._blurMaterial;a!=="latitudinal"&&a!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");const u=3,h=new Ut(this._lodPlanes[i],c),d=c.uniforms,f=this._sizeLods[n]-1,m=isFinite(s)?Math.PI/(2*f):2*Math.PI/(2*Xi-1),_=s/m,g=isFinite(s)?1+Math.floor(u*_):Xi;g>Xi&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${g} samples when the maximum is set to ${Xi}`);const p=[];let M=0;for(let C=0;C<Xi;++C){const L=C/_,b=Math.exp(-L*L/2);p.push(b),C===0?M+=b:C<g&&(M+=2*b)}for(let C=0;C<p.length;C++)p[C]=p[C]/M;d.envMap.value=e.texture,d.samples.value=g,d.weights.value=p,d.latitudinal.value=a==="latitudinal",o&&(d.poleAxis.value=o);const{_lodMax:E}=this;d.dTheta.value=m,d.mipInt.value=E-n;const y=this._sizeLods[i],I=3*y*(i>E-wr?i-E+wr:0),R=4*(this._cubeSize-y);qs(t,I,R,3*y,2*y),l.setRenderTarget(t),l.render(h,so)}}function O_(r){const e=[],t=[],n=[];let i=r;const s=r-wr+1+Jc.length;for(let a=0;a<s;a++){const o=Math.pow(2,i);t.push(o);let l=1/o;a>r-wr?l=Jc[a-r+wr-1]:a===0&&(l=0),n.push(l);const c=1/(o-2),u=-c,h=1+c,d=[u,u,h,u,h,h,u,u,h,h,u,h],f=6,m=6,_=3,g=2,p=1,M=new Float32Array(_*m*f),E=new Float32Array(g*m*f),y=new Float32Array(p*m*f);for(let R=0;R<f;R++){const C=R%3*2/3-1,L=R>2?0:-1,b=[C,L,0,C+2/3,L,0,C+2/3,L+1,0,C,L,0,C+2/3,L+1,0,C,L+1,0];M.set(b,_*m*R),E.set(d,g*m*R);const x=[R,R,R,R,R,R];y.set(x,p*m*R)}const I=new Vt;I.setAttribute("position",new Xt(M,_)),I.setAttribute("uv",new Xt(E,g)),I.setAttribute("faceIndex",new Xt(y,p)),e.push(I),i>wr&&i--}return{lodPlanes:e,sizeLods:t,sigmas:n}}function tu(r,e,t){const n=new Ji(r,e,t);return n.texture.mapping=Sa,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function qs(r,e,t,n,i){r.viewport.set(e,t,n,i),r.scissor.set(e,t,n,i)}function B_(r,e,t){const n=new Float32Array(Xi),i=new k(0,1,0);return new gi({name:"SphericalGaussianBlur",defines:{n:Xi,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${r}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:Hl(),fragmentShader:`
|
|
3575
3575
|
|
|
3576
3576
|
precision mediump float;
|
|
3577
3577
|
precision mediump int;
|
|
@@ -3721,17 +3721,17 @@ void main() {
|
|
|
3721
3721
|
gl_Position = vec4( position, 1.0 );
|
|
3722
3722
|
|
|
3723
3723
|
}
|
|
3724
|
-
`}function z_(r){let e=new WeakMap,t=null;function n(o){if(o&&o.isTexture){const l=o.mapping,c=l===Po||l===Do,u=l===Dr||l===Lr;if(c||u){let h=e.get(o);const d=h!==void 0?h.texture.pmremVersion:0;if(o.isRenderTargetTexture&&o.pmremVersion!==d)return t===null&&(t=new eu(r)),h=c?t.fromEquirectangular(o,h):t.fromCubemap(o,h),h.texture.pmremVersion=o.pmremVersion,e.set(o,h),h.texture;if(h!==void 0)return h.texture;{const f=o.image;return c&&f&&f.height>0||u&&f&&i(f)?(t===null&&(t=new eu(r)),h=c?t.fromEquirectangular(o):t.fromCubemap(o),h.texture.pmremVersion=o.pmremVersion,e.set(o,h),o.addEventListener("dispose",s),h.texture):null}}}return o}function i(o){let l=0;const c=6;for(let u=0;u<c;u++)o[u]!==void 0&&l++;return l===c}function s(o){const l=o.target;l.removeEventListener("dispose",s);const c=e.get(l);c!==void 0&&(e.delete(l),c.dispose())}function a(){e=new WeakMap,t!==null&&(t.dispose(),t=null)}return{get:n,dispose:a}}function V_(r){const e={};function t(n){if(e[n]!==void 0)return e[n];let i;switch(n){case"WEBGL_depth_texture":i=r.getExtension("WEBGL_depth_texture")||r.getExtension("MOZ_WEBGL_depth_texture")||r.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=r.getExtension("EXT_texture_filter_anisotropic")||r.getExtension("MOZ_EXT_texture_filter_anisotropic")||r.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=r.getExtension("WEBGL_compressed_texture_s3tc")||r.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||r.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=r.getExtension("WEBGL_compressed_texture_pvrtc")||r.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=r.getExtension(n)}return e[n]=i,i}return{has:function(n){return t(n)!==null},init:function(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(n){const i=t(n);return i===null&&Rr("THREE.WebGLRenderer: "+n+" extension not supported."),i}}}function H_(r,e,t,n){const i={},s=new WeakMap;function a(h){const d=h.target;d.index!==null&&e.remove(d.index);for(const m in d.attributes)e.remove(d.attributes[m]);d.removeEventListener("dispose",a),delete i[d.id];const f=s.get(d);f&&(e.remove(f),s.delete(d)),n.releaseStatesOfGeometry(d),d.isInstancedBufferGeometry===!0&&delete d._maxInstanceCount,t.memory.geometries--}function o(h,d){return i[d.id]===!0||(d.addEventListener("dispose",a),i[d.id]=!0,t.memory.geometries++),d}function l(h){const d=h.attributes;for(const f in d)e.update(d[f],r.ARRAY_BUFFER)}function c(h){const d=[],f=h.index,m=h.attributes.position;let _=0;if(f!==null){const M=f.array;_=f.version;for(let E=0,y=M.length;E<y;E+=3){const I=M[E+0],R=M[E+1],C=M[E+2];d.push(I,R,R,C,C,I)}}else if(m!==void 0){const M=m.array;_=m.version;for(let E=0,y=M.length/3-1;E<y;E+=3){const I=E+0,R=E+1,C=E+2;d.push(I,R,R,C,C,I)}}else return;const g=new(lh(d)?dh:hh)(d,1);g.version=_;const p=s.get(h);p&&e.remove(p),s.set(h,g)}function u(h){const d=s.get(h);if(d){const f=h.index;f!==null&&d.version<f.version&&c(h)}else c(h);return s.get(h)}return{get:o,update:l,getWireframeAttribute:u}}function G_(r,e,t){let n;function i(d){n=d}let s,a;function o(d){s=d.type,a=d.bytesPerElement}function l(d,f){r.drawElements(n,f,s,d*a),t.update(f,n,1)}function c(d,f,m){m!==0&&(r.drawElementsInstanced(n,f,s,d*a,m),t.update(f,n,m))}function u(d,f,m){if(m===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(n,f,0,s,d,0,m);let g=0;for(let p=0;p<m;p++)g+=f[p];t.update(g,n,1)}function h(d,f,m,_){if(m===0)return;const g=e.get("WEBGL_multi_draw");if(g===null)for(let p=0;p<d.length;p++)c(d[p]/a,f[p],_[p]);else{g.multiDrawElementsInstancedWEBGL(n,f,0,s,d,0,_,0,m);let p=0;for(let M=0;M<m;M++)p+=f[M]*_[M];t.update(p,n,1)}}this.setMode=i,this.setIndex=o,this.render=l,this.renderInstances=c,this.renderMultiDraw=u,this.renderMultiDrawInstances=h}function W_(r){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function n(s,a,o){switch(t.calls++,a){case r.TRIANGLES:t.triangles+=o*(s/3);break;case r.LINES:t.lines+=o*(s/2);break;case r.LINE_STRIP:t.lines+=o*(s-1);break;case r.LINE_LOOP:t.lines+=o*s;break;case r.POINTS:t.points+=o*s;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",a);break}}function i(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:i,update:n}}function X_(r,e,t){const n=new WeakMap,i=new St;function s(a,o,l){const c=a.morphTargetInfluences,u=o.morphAttributes.position||o.morphAttributes.normal||o.morphAttributes.color,h=u!==void 0?u.length:0;let d=n.get(o);if(d===void 0||d.count!==h){let b=function(){C.dispose(),n.delete(o),o.removeEventListener("dispose",b)};d!==void 0&&d.texture.dispose();const f=o.morphAttributes.position!==void 0,m=o.morphAttributes.normal!==void 0,_=o.morphAttributes.color!==void 0,g=o.morphAttributes.position||[],p=o.morphAttributes.normal||[],M=o.morphAttributes.color||[];let E=0;f===!0&&(E=1),m===!0&&(E=2),_===!0&&(E=3);let y=o.attributes.position.count*E,I=1;y>e.maxTextureSize&&(I=Math.ceil(y/e.maxTextureSize),y=e.maxTextureSize);const R=new Float32Array(y*I*4*h),C=new ch(R,y,I,h);C.type=Yn,C.needsUpdate=!0;const L=E*4;for(let x=0;x<h;x++){const w=g[x],B=p[x],z=M[x],X=y*I*4*x;for(let j=0;j<w.count;j++){const O=j*L;f===!0&&(i.fromBufferAttribute(w,j),R[X+O+0]=i.x,R[X+O+1]=i.y,R[X+O+2]=i.z,R[X+O+3]=0),m===!0&&(i.fromBufferAttribute(B,j),R[X+O+4]=i.x,R[X+O+5]=i.y,R[X+O+6]=i.z,R[X+O+7]=0),_===!0&&(i.fromBufferAttribute(z,j),R[X+O+8]=i.x,R[X+O+9]=i.y,R[X+O+10]=i.z,R[X+O+11]=z.itemSize===4?i.w:1)}}d={count:h,texture:C,size:new dt(y,I)},n.set(o,d),o.addEventListener("dispose",b)}if(a.isInstancedMesh===!0&&a.morphTexture!==null)l.getUniforms().setValue(r,"morphTexture",a.morphTexture,t);else{let f=0;for(let _=0;_<c.length;_++)f+=c[_];const m=o.morphTargetsRelative?1:1-f;l.getUniforms().setValue(r,"morphTargetBaseInfluence",m),l.getUniforms().setValue(r,"morphTargetInfluences",c)}l.getUniforms().setValue(r,"morphTargetsTexture",d.texture,t),l.getUniforms().setValue(r,"morphTargetsTextureSize",d.size)}return{update:s}}function q_(r,e,t,n){let i=new WeakMap;function s(l){const c=n.render.frame,u=l.geometry,h=e.get(l,u);if(i.get(h)!==c&&(e.update(h),i.set(h,c)),l.isInstancedMesh&&(l.hasEventListener("dispose",o)===!1&&l.addEventListener("dispose",o),i.get(l)!==c&&(t.update(l.instanceMatrix,r.ARRAY_BUFFER),l.instanceColor!==null&&t.update(l.instanceColor,r.ARRAY_BUFFER),i.set(l,c))),l.isSkinnedMesh){const d=l.skeleton;i.get(d)!==c&&(d.update(),i.set(d,c))}return h}function a(){i=new WeakMap}function o(l){const c=l.target;c.removeEventListener("dispose",o),t.remove(c.instanceMatrix),c.instanceColor!==null&&t.remove(c.instanceColor)}return{update:s,dispose:a}}const Rh=new an,ru=new xh(1,1),Ch=new ch,Ph=new Jf,Dh=new mh,su=[],au=[],ou=new Float32Array(16),lu=new Float32Array(9),cu=new Float32Array(4);function Hr(r,e,t){const n=r[0];if(n<=0||n>0)return r;const i=e*t;let s=su[i];if(s===void 0&&(s=new Float32Array(i),su[i]=s),e!==0){n.toArray(s,0);for(let a=1,o=0;a!==e;++a)o+=t,r[a].toArray(s,o)}return s}function $t(r,e){if(r.length!==e.length)return!1;for(let t=0,n=r.length;t<n;t++)if(r[t]!==e[t])return!1;return!0}function Jt(r,e){for(let t=0,n=e.length;t<n;t++)r[t]=e[t]}function wa(r,e){let t=au[e];t===void 0&&(t=new Int32Array(e),au[e]=t);for(let n=0;n!==e;++n)t[n]=r.allocateTextureUnit();return t}function j_(r,e){const t=this.cache;t[0]!==e&&(r.uniform1f(this.addr,e),t[0]=e)}function Y_(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(r.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if($t(t,e))return;r.uniform2fv(this.addr,e),Jt(t,e)}}function K_(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(r.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(r.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if($t(t,e))return;r.uniform3fv(this.addr,e),Jt(t,e)}}function $_(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(r.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if($t(t,e))return;r.uniform4fv(this.addr,e),Jt(t,e)}}function J_(r,e){const t=this.cache,n=e.elements;if(n===void 0){if($t(t,e))return;r.uniformMatrix2fv(this.addr,!1,e),Jt(t,e)}else{if($t(t,n))return;cu.set(n),r.uniformMatrix2fv(this.addr,!1,cu),Jt(t,n)}}function Z_(r,e){const t=this.cache,n=e.elements;if(n===void 0){if($t(t,e))return;r.uniformMatrix3fv(this.addr,!1,e),Jt(t,e)}else{if($t(t,n))return;lu.set(n),r.uniformMatrix3fv(this.addr,!1,lu),Jt(t,n)}}function Q_(r,e){const t=this.cache,n=e.elements;if(n===void 0){if($t(t,e))return;r.uniformMatrix4fv(this.addr,!1,e),Jt(t,e)}else{if($t(t,n))return;ou.set(n),r.uniformMatrix4fv(this.addr,!1,ou),Jt(t,n)}}function e0(r,e){const t=this.cache;t[0]!==e&&(r.uniform1i(this.addr,e),t[0]=e)}function t0(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(r.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if($t(t,e))return;r.uniform2iv(this.addr,e),Jt(t,e)}}function n0(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(r.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if($t(t,e))return;r.uniform3iv(this.addr,e),Jt(t,e)}}function i0(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(r.uniform4i(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if($t(t,e))return;r.uniform4iv(this.addr,e),Jt(t,e)}}function r0(r,e){const t=this.cache;t[0]!==e&&(r.uniform1ui(this.addr,e),t[0]=e)}function s0(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(r.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if($t(t,e))return;r.uniform2uiv(this.addr,e),Jt(t,e)}}function a0(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(r.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if($t(t,e))return;r.uniform3uiv(this.addr,e),Jt(t,e)}}function o0(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(r.uniform4ui(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if($t(t,e))return;r.uniform4uiv(this.addr,e),Jt(t,e)}}function l0(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i);let s;this.type===r.SAMPLER_2D_SHADOW?(ru.compareFunction=oh,s=ru):s=Rh,t.setTexture2D(e||s,i)}function c0(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.setTexture3D(e||Ph,i)}function u0(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.setTextureCube(e||Dh,i)}function h0(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.setTexture2DArray(e||Ch,i)}function d0(r){switch(r){case 5126:return j_;case 35664:return Y_;case 35665:return K_;case 35666:return $_;case 35674:return J_;case 35675:return Z_;case 35676:return Q_;case 5124:case 35670:return e0;case 35667:case 35671:return t0;case 35668:case 35672:return n0;case 35669:case 35673:return i0;case 5125:return r0;case 36294:return s0;case 36295:return a0;case 36296:return o0;case 35678:case 36198:case 36298:case 36306:case 35682:return l0;case 35679:case 36299:case 36307:return c0;case 35680:case 36300:case 36308:case 36293:return u0;case 36289:case 36303:case 36311:case 36292:return h0}}function f0(r,e){r.uniform1fv(this.addr,e)}function p0(r,e){const t=Hr(e,this.size,2);r.uniform2fv(this.addr,t)}function m0(r,e){const t=Hr(e,this.size,3);r.uniform3fv(this.addr,t)}function g0(r,e){const t=Hr(e,this.size,4);r.uniform4fv(this.addr,t)}function _0(r,e){const t=Hr(e,this.size,4);r.uniformMatrix2fv(this.addr,!1,t)}function v0(r,e){const t=Hr(e,this.size,9);r.uniformMatrix3fv(this.addr,!1,t)}function y0(r,e){const t=Hr(e,this.size,16);r.uniformMatrix4fv(this.addr,!1,t)}function x0(r,e){r.uniform1iv(this.addr,e)}function S0(r,e){r.uniform2iv(this.addr,e)}function M0(r,e){r.uniform3iv(this.addr,e)}function b0(r,e){r.uniform4iv(this.addr,e)}function E0(r,e){r.uniform1uiv(this.addr,e)}function T0(r,e){r.uniform2uiv(this.addr,e)}function w0(r,e){r.uniform3uiv(this.addr,e)}function A0(r,e){r.uniform4uiv(this.addr,e)}function R0(r,e,t){const n=this.cache,i=e.length,s=wa(t,i);$t(n,s)||(r.uniform1iv(this.addr,s),Jt(n,s));for(let a=0;a!==i;++a)t.setTexture2D(e[a]||Rh,s[a])}function C0(r,e,t){const n=this.cache,i=e.length,s=wa(t,i);$t(n,s)||(r.uniform1iv(this.addr,s),Jt(n,s));for(let a=0;a!==i;++a)t.setTexture3D(e[a]||Ph,s[a])}function P0(r,e,t){const n=this.cache,i=e.length,s=wa(t,i);$t(n,s)||(r.uniform1iv(this.addr,s),Jt(n,s));for(let a=0;a!==i;++a)t.setTextureCube(e[a]||Dh,s[a])}function D0(r,e,t){const n=this.cache,i=e.length,s=wa(t,i);$t(n,s)||(r.uniform1iv(this.addr,s),Jt(n,s));for(let a=0;a!==i;++a)t.setTexture2DArray(e[a]||Ch,s[a])}function L0(r){switch(r){case 5126:return f0;case 35664:return p0;case 35665:return m0;case 35666:return g0;case 35674:return _0;case 35675:return v0;case 35676:return y0;case 5124:case 35670:return x0;case 35667:case 35671:return S0;case 35668:case 35672:return M0;case 35669:case 35673:return b0;case 5125:return E0;case 36294:return T0;case 36295:return w0;case 36296:return A0;case 35678:case 36198:case 36298:case 36306:case 35682:return R0;case 35679:case 36299:case 36307:return C0;case 35680:case 36300:case 36308:case 36293:return P0;case 36289:case 36303:case 36311:case 36292:return D0}}class U0{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=d0(t.type)}}class I0{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=L0(t.type)}}class N0{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){const i=this.seq;for(let s=0,a=i.length;s!==a;++s){const o=i[s];o.setValue(e,t[o.id],n)}}}const uo=/(\w+)(\])?(\[|\.)?/g;function uu(r,e){r.seq.push(e),r.map[e.id]=e}function F0(r,e,t){const n=r.name,i=n.length;for(uo.lastIndex=0;;){const s=uo.exec(n),a=uo.lastIndex;let o=s[1];const l=s[2]==="]",c=s[3];if(l&&(o=o|0),c===void 0||c==="["&&a+2===i){uu(t,c===void 0?new U0(o,r,e):new I0(o,r,e));break}else{let h=t.map[o];h===void 0&&(h=new N0(o),uu(t,h)),t=h}}}class oa{constructor(e,t){this.seq=[],this.map={};const n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let i=0;i<n;++i){const s=e.getActiveUniform(t,i),a=e.getUniformLocation(t,s.name);F0(s,a,this)}}setValue(e,t,n,i){const s=this.map[t];s!==void 0&&s.setValue(e,n,i)}setOptional(e,t,n){const i=t[n];i!==void 0&&this.setValue(e,n,i)}static upload(e,t,n,i){for(let s=0,a=t.length;s!==a;++s){const o=t[s],l=n[o.id];l.needsUpdate!==!1&&o.setValue(e,l.value,i)}}static seqWithValue(e,t){const n=[];for(let i=0,s=e.length;i!==s;++i){const a=e[i];a.id in t&&n.push(a)}return n}}function hu(r,e,t){const n=r.createShader(e);return r.shaderSource(n,t),r.compileShader(n),n}const O0=37297;let B0=0;function k0(r,e){const t=r.split(`
|
|
3724
|
+
`}function k_(r){let e=new WeakMap,t=null;function n(o){if(o&&o.isTexture){const l=o.mapping,c=l===Po||l===Do,u=l===Dr||l===Lr;if(c||u){let h=e.get(o);const d=h!==void 0?h.texture.pmremVersion:0;if(o.isRenderTargetTexture&&o.pmremVersion!==d)return t===null&&(t=new eu(r)),h=c?t.fromEquirectangular(o,h):t.fromCubemap(o,h),h.texture.pmremVersion=o.pmremVersion,e.set(o,h),h.texture;if(h!==void 0)return h.texture;{const f=o.image;return c&&f&&f.height>0||u&&f&&i(f)?(t===null&&(t=new eu(r)),h=c?t.fromEquirectangular(o):t.fromCubemap(o),h.texture.pmremVersion=o.pmremVersion,e.set(o,h),o.addEventListener("dispose",s),h.texture):null}}}return o}function i(o){let l=0;const c=6;for(let u=0;u<c;u++)o[u]!==void 0&&l++;return l===c}function s(o){const l=o.target;l.removeEventListener("dispose",s);const c=e.get(l);c!==void 0&&(e.delete(l),c.dispose())}function a(){e=new WeakMap,t!==null&&(t.dispose(),t=null)}return{get:n,dispose:a}}function z_(r){const e={};function t(n){if(e[n]!==void 0)return e[n];let i;switch(n){case"WEBGL_depth_texture":i=r.getExtension("WEBGL_depth_texture")||r.getExtension("MOZ_WEBGL_depth_texture")||r.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=r.getExtension("EXT_texture_filter_anisotropic")||r.getExtension("MOZ_EXT_texture_filter_anisotropic")||r.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=r.getExtension("WEBGL_compressed_texture_s3tc")||r.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||r.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=r.getExtension("WEBGL_compressed_texture_pvrtc")||r.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=r.getExtension(n)}return e[n]=i,i}return{has:function(n){return t(n)!==null},init:function(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(n){const i=t(n);return i===null&&Rr("THREE.WebGLRenderer: "+n+" extension not supported."),i}}}function V_(r,e,t,n){const i={},s=new WeakMap;function a(h){const d=h.target;d.index!==null&&e.remove(d.index);for(const m in d.attributes)e.remove(d.attributes[m]);d.removeEventListener("dispose",a),delete i[d.id];const f=s.get(d);f&&(e.remove(f),s.delete(d)),n.releaseStatesOfGeometry(d),d.isInstancedBufferGeometry===!0&&delete d._maxInstanceCount,t.memory.geometries--}function o(h,d){return i[d.id]===!0||(d.addEventListener("dispose",a),i[d.id]=!0,t.memory.geometries++),d}function l(h){const d=h.attributes;for(const f in d)e.update(d[f],r.ARRAY_BUFFER)}function c(h){const d=[],f=h.index,m=h.attributes.position;let _=0;if(f!==null){const M=f.array;_=f.version;for(let E=0,y=M.length;E<y;E+=3){const I=M[E+0],R=M[E+1],C=M[E+2];d.push(I,R,R,C,C,I)}}else if(m!==void 0){const M=m.array;_=m.version;for(let E=0,y=M.length/3-1;E<y;E+=3){const I=E+0,R=E+1,C=E+2;d.push(I,R,R,C,C,I)}}else return;const g=new(lh(d)?dh:hh)(d,1);g.version=_;const p=s.get(h);p&&e.remove(p),s.set(h,g)}function u(h){const d=s.get(h);if(d){const f=h.index;f!==null&&d.version<f.version&&c(h)}else c(h);return s.get(h)}return{get:o,update:l,getWireframeAttribute:u}}function H_(r,e,t){let n;function i(d){n=d}let s,a;function o(d){s=d.type,a=d.bytesPerElement}function l(d,f){r.drawElements(n,f,s,d*a),t.update(f,n,1)}function c(d,f,m){m!==0&&(r.drawElementsInstanced(n,f,s,d*a,m),t.update(f,n,m))}function u(d,f,m){if(m===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(n,f,0,s,d,0,m);let g=0;for(let p=0;p<m;p++)g+=f[p];t.update(g,n,1)}function h(d,f,m,_){if(m===0)return;const g=e.get("WEBGL_multi_draw");if(g===null)for(let p=0;p<d.length;p++)c(d[p]/a,f[p],_[p]);else{g.multiDrawElementsInstancedWEBGL(n,f,0,s,d,0,_,0,m);let p=0;for(let M=0;M<m;M++)p+=f[M]*_[M];t.update(p,n,1)}}this.setMode=i,this.setIndex=o,this.render=l,this.renderInstances=c,this.renderMultiDraw=u,this.renderMultiDrawInstances=h}function G_(r){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function n(s,a,o){switch(t.calls++,a){case r.TRIANGLES:t.triangles+=o*(s/3);break;case r.LINES:t.lines+=o*(s/2);break;case r.LINE_STRIP:t.lines+=o*(s-1);break;case r.LINE_LOOP:t.lines+=o*s;break;case r.POINTS:t.points+=o*s;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",a);break}}function i(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:i,update:n}}function W_(r,e,t){const n=new WeakMap,i=new St;function s(a,o,l){const c=a.morphTargetInfluences,u=o.morphAttributes.position||o.morphAttributes.normal||o.morphAttributes.color,h=u!==void 0?u.length:0;let d=n.get(o);if(d===void 0||d.count!==h){let b=function(){C.dispose(),n.delete(o),o.removeEventListener("dispose",b)};d!==void 0&&d.texture.dispose();const f=o.morphAttributes.position!==void 0,m=o.morphAttributes.normal!==void 0,_=o.morphAttributes.color!==void 0,g=o.morphAttributes.position||[],p=o.morphAttributes.normal||[],M=o.morphAttributes.color||[];let E=0;f===!0&&(E=1),m===!0&&(E=2),_===!0&&(E=3);let y=o.attributes.position.count*E,I=1;y>e.maxTextureSize&&(I=Math.ceil(y/e.maxTextureSize),y=e.maxTextureSize);const R=new Float32Array(y*I*4*h),C=new ch(R,y,I,h);C.type=Yn,C.needsUpdate=!0;const L=E*4;for(let x=0;x<h;x++){const w=g[x],B=p[x],z=M[x],X=y*I*4*x;for(let j=0;j<w.count;j++){const O=j*L;f===!0&&(i.fromBufferAttribute(w,j),R[X+O+0]=i.x,R[X+O+1]=i.y,R[X+O+2]=i.z,R[X+O+3]=0),m===!0&&(i.fromBufferAttribute(B,j),R[X+O+4]=i.x,R[X+O+5]=i.y,R[X+O+6]=i.z,R[X+O+7]=0),_===!0&&(i.fromBufferAttribute(z,j),R[X+O+8]=i.x,R[X+O+9]=i.y,R[X+O+10]=i.z,R[X+O+11]=z.itemSize===4?i.w:1)}}d={count:h,texture:C,size:new dt(y,I)},n.set(o,d),o.addEventListener("dispose",b)}if(a.isInstancedMesh===!0&&a.morphTexture!==null)l.getUniforms().setValue(r,"morphTexture",a.morphTexture,t);else{let f=0;for(let _=0;_<c.length;_++)f+=c[_];const m=o.morphTargetsRelative?1:1-f;l.getUniforms().setValue(r,"morphTargetBaseInfluence",m),l.getUniforms().setValue(r,"morphTargetInfluences",c)}l.getUniforms().setValue(r,"morphTargetsTexture",d.texture,t),l.getUniforms().setValue(r,"morphTargetsTextureSize",d.size)}return{update:s}}function X_(r,e,t,n){let i=new WeakMap;function s(l){const c=n.render.frame,u=l.geometry,h=e.get(l,u);if(i.get(h)!==c&&(e.update(h),i.set(h,c)),l.isInstancedMesh&&(l.hasEventListener("dispose",o)===!1&&l.addEventListener("dispose",o),i.get(l)!==c&&(t.update(l.instanceMatrix,r.ARRAY_BUFFER),l.instanceColor!==null&&t.update(l.instanceColor,r.ARRAY_BUFFER),i.set(l,c))),l.isSkinnedMesh){const d=l.skeleton;i.get(d)!==c&&(d.update(),i.set(d,c))}return h}function a(){i=new WeakMap}function o(l){const c=l.target;c.removeEventListener("dispose",o),t.remove(c.instanceMatrix),c.instanceColor!==null&&t.remove(c.instanceColor)}return{update:s,dispose:a}}const Rh=new an,ru=new xh(1,1),Ch=new ch,Ph=new $f,Dh=new mh,su=[],au=[],ou=new Float32Array(16),lu=new Float32Array(9),cu=new Float32Array(4);function Hr(r,e,t){const n=r[0];if(n<=0||n>0)return r;const i=e*t;let s=su[i];if(s===void 0&&(s=new Float32Array(i),su[i]=s),e!==0){n.toArray(s,0);for(let a=1,o=0;a!==e;++a)o+=t,r[a].toArray(s,o)}return s}function $t(r,e){if(r.length!==e.length)return!1;for(let t=0,n=r.length;t<n;t++)if(r[t]!==e[t])return!1;return!0}function Jt(r,e){for(let t=0,n=e.length;t<n;t++)r[t]=e[t]}function wa(r,e){let t=au[e];t===void 0&&(t=new Int32Array(e),au[e]=t);for(let n=0;n!==e;++n)t[n]=r.allocateTextureUnit();return t}function q_(r,e){const t=this.cache;t[0]!==e&&(r.uniform1f(this.addr,e),t[0]=e)}function j_(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(r.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if($t(t,e))return;r.uniform2fv(this.addr,e),Jt(t,e)}}function Y_(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(r.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(r.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if($t(t,e))return;r.uniform3fv(this.addr,e),Jt(t,e)}}function K_(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(r.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if($t(t,e))return;r.uniform4fv(this.addr,e),Jt(t,e)}}function $_(r,e){const t=this.cache,n=e.elements;if(n===void 0){if($t(t,e))return;r.uniformMatrix2fv(this.addr,!1,e),Jt(t,e)}else{if($t(t,n))return;cu.set(n),r.uniformMatrix2fv(this.addr,!1,cu),Jt(t,n)}}function J_(r,e){const t=this.cache,n=e.elements;if(n===void 0){if($t(t,e))return;r.uniformMatrix3fv(this.addr,!1,e),Jt(t,e)}else{if($t(t,n))return;lu.set(n),r.uniformMatrix3fv(this.addr,!1,lu),Jt(t,n)}}function Z_(r,e){const t=this.cache,n=e.elements;if(n===void 0){if($t(t,e))return;r.uniformMatrix4fv(this.addr,!1,e),Jt(t,e)}else{if($t(t,n))return;ou.set(n),r.uniformMatrix4fv(this.addr,!1,ou),Jt(t,n)}}function Q_(r,e){const t=this.cache;t[0]!==e&&(r.uniform1i(this.addr,e),t[0]=e)}function e0(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(r.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if($t(t,e))return;r.uniform2iv(this.addr,e),Jt(t,e)}}function t0(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(r.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if($t(t,e))return;r.uniform3iv(this.addr,e),Jt(t,e)}}function n0(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(r.uniform4i(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if($t(t,e))return;r.uniform4iv(this.addr,e),Jt(t,e)}}function i0(r,e){const t=this.cache;t[0]!==e&&(r.uniform1ui(this.addr,e),t[0]=e)}function r0(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(r.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if($t(t,e))return;r.uniform2uiv(this.addr,e),Jt(t,e)}}function s0(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(r.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if($t(t,e))return;r.uniform3uiv(this.addr,e),Jt(t,e)}}function a0(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(r.uniform4ui(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if($t(t,e))return;r.uniform4uiv(this.addr,e),Jt(t,e)}}function o0(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i);let s;this.type===r.SAMPLER_2D_SHADOW?(ru.compareFunction=oh,s=ru):s=Rh,t.setTexture2D(e||s,i)}function l0(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.setTexture3D(e||Ph,i)}function c0(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.setTextureCube(e||Dh,i)}function u0(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.setTexture2DArray(e||Ch,i)}function h0(r){switch(r){case 5126:return q_;case 35664:return j_;case 35665:return Y_;case 35666:return K_;case 35674:return $_;case 35675:return J_;case 35676:return Z_;case 5124:case 35670:return Q_;case 35667:case 35671:return e0;case 35668:case 35672:return t0;case 35669:case 35673:return n0;case 5125:return i0;case 36294:return r0;case 36295:return s0;case 36296:return a0;case 35678:case 36198:case 36298:case 36306:case 35682:return o0;case 35679:case 36299:case 36307:return l0;case 35680:case 36300:case 36308:case 36293:return c0;case 36289:case 36303:case 36311:case 36292:return u0}}function d0(r,e){r.uniform1fv(this.addr,e)}function f0(r,e){const t=Hr(e,this.size,2);r.uniform2fv(this.addr,t)}function p0(r,e){const t=Hr(e,this.size,3);r.uniform3fv(this.addr,t)}function m0(r,e){const t=Hr(e,this.size,4);r.uniform4fv(this.addr,t)}function g0(r,e){const t=Hr(e,this.size,4);r.uniformMatrix2fv(this.addr,!1,t)}function _0(r,e){const t=Hr(e,this.size,9);r.uniformMatrix3fv(this.addr,!1,t)}function v0(r,e){const t=Hr(e,this.size,16);r.uniformMatrix4fv(this.addr,!1,t)}function y0(r,e){r.uniform1iv(this.addr,e)}function x0(r,e){r.uniform2iv(this.addr,e)}function S0(r,e){r.uniform3iv(this.addr,e)}function M0(r,e){r.uniform4iv(this.addr,e)}function b0(r,e){r.uniform1uiv(this.addr,e)}function E0(r,e){r.uniform2uiv(this.addr,e)}function T0(r,e){r.uniform3uiv(this.addr,e)}function w0(r,e){r.uniform4uiv(this.addr,e)}function A0(r,e,t){const n=this.cache,i=e.length,s=wa(t,i);$t(n,s)||(r.uniform1iv(this.addr,s),Jt(n,s));for(let a=0;a!==i;++a)t.setTexture2D(e[a]||Rh,s[a])}function R0(r,e,t){const n=this.cache,i=e.length,s=wa(t,i);$t(n,s)||(r.uniform1iv(this.addr,s),Jt(n,s));for(let a=0;a!==i;++a)t.setTexture3D(e[a]||Ph,s[a])}function C0(r,e,t){const n=this.cache,i=e.length,s=wa(t,i);$t(n,s)||(r.uniform1iv(this.addr,s),Jt(n,s));for(let a=0;a!==i;++a)t.setTextureCube(e[a]||Dh,s[a])}function P0(r,e,t){const n=this.cache,i=e.length,s=wa(t,i);$t(n,s)||(r.uniform1iv(this.addr,s),Jt(n,s));for(let a=0;a!==i;++a)t.setTexture2DArray(e[a]||Ch,s[a])}function D0(r){switch(r){case 5126:return d0;case 35664:return f0;case 35665:return p0;case 35666:return m0;case 35674:return g0;case 35675:return _0;case 35676:return v0;case 5124:case 35670:return y0;case 35667:case 35671:return x0;case 35668:case 35672:return S0;case 35669:case 35673:return M0;case 5125:return b0;case 36294:return E0;case 36295:return T0;case 36296:return w0;case 35678:case 36198:case 36298:case 36306:case 35682:return A0;case 35679:case 36299:case 36307:return R0;case 35680:case 36300:case 36308:case 36293:return C0;case 36289:case 36303:case 36311:case 36292:return P0}}class L0{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=h0(t.type)}}class U0{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=D0(t.type)}}class I0{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){const i=this.seq;for(let s=0,a=i.length;s!==a;++s){const o=i[s];o.setValue(e,t[o.id],n)}}}const uo=/(\w+)(\])?(\[|\.)?/g;function uu(r,e){r.seq.push(e),r.map[e.id]=e}function N0(r,e,t){const n=r.name,i=n.length;for(uo.lastIndex=0;;){const s=uo.exec(n),a=uo.lastIndex;let o=s[1];const l=s[2]==="]",c=s[3];if(l&&(o=o|0),c===void 0||c==="["&&a+2===i){uu(t,c===void 0?new L0(o,r,e):new U0(o,r,e));break}else{let h=t.map[o];h===void 0&&(h=new I0(o),uu(t,h)),t=h}}}class oa{constructor(e,t){this.seq=[],this.map={};const n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let i=0;i<n;++i){const s=e.getActiveUniform(t,i),a=e.getUniformLocation(t,s.name);N0(s,a,this)}}setValue(e,t,n,i){const s=this.map[t];s!==void 0&&s.setValue(e,n,i)}setOptional(e,t,n){const i=t[n];i!==void 0&&this.setValue(e,n,i)}static upload(e,t,n,i){for(let s=0,a=t.length;s!==a;++s){const o=t[s],l=n[o.id];l.needsUpdate!==!1&&o.setValue(e,l.value,i)}}static seqWithValue(e,t){const n=[];for(let i=0,s=e.length;i!==s;++i){const a=e[i];a.id in t&&n.push(a)}return n}}function hu(r,e,t){const n=r.createShader(e);return r.shaderSource(n,t),r.compileShader(n),n}const F0=37297;let O0=0;function B0(r,e){const t=r.split(`
|
|
3725
3725
|
`),n=[],i=Math.max(e-6,0),s=Math.min(e+6,t.length);for(let a=i;a<s;a++){const o=a+1;n.push(`${o===e?">":" "} ${o}: ${t[a]}`)}return n.join(`
|
|
3726
|
-
`)}const du=new gt;function
|
|
3726
|
+
`)}const du=new gt;function k0(r){vt._getMatrix(du,vt.workingColorSpace,r);const e=`mat3( ${du.elements.map(t=>t.toFixed(4))} )`;switch(vt.getTransfer(r)){case pa:return[e,"LinearTransferOETF"];case It:return[e,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space: ",r),[e,"LinearTransferOETF"]}}function fu(r,e,t){const n=r.getShaderParameter(e,r.COMPILE_STATUS),i=r.getShaderInfoLog(e).trim();if(n&&i==="")return"";const s=/ERROR: 0:(\d+)/.exec(i);if(s){const a=parseInt(s[1]);return t.toUpperCase()+`
|
|
3727
3727
|
|
|
3728
3728
|
`+i+`
|
|
3729
3729
|
|
|
3730
|
-
`+
|
|
3731
|
-
`)}function
|
|
3732
|
-
`)}function
|
|
3733
|
-
`)}function
|
|
3734
|
-
`)}function
|
|
3730
|
+
`+B0(r.getShaderSource(e),a)}else return i}function z0(r,e){const t=k0(e);return[`vec4 ${r}( vec4 value ) {`,` return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(`
|
|
3731
|
+
`)}function V0(r,e){let t;switch(e){case af:t="Linear";break;case of:t="Reinhard";break;case lf:t="Cineon";break;case Ju:t="ACESFilmic";break;case uf:t="AgX";break;case hf:t="Neutral";break;case cf:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+r+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const js=new k;function H0(){vt.getLuminanceCoefficients(js);const r=js.x.toFixed(4),e=js.y.toFixed(4),t=js.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${r}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(`
|
|
3732
|
+
`)}function G0(r){return[r.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",r.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Qr).join(`
|
|
3733
|
+
`)}function W0(r){const e=[];for(const t in r){const n=r[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(`
|
|
3734
|
+
`)}function X0(r,e){const t={},n=r.getProgramParameter(e,r.ACTIVE_ATTRIBUTES);for(let i=0;i<n;i++){const s=r.getActiveAttrib(e,i),a=s.name;let o=1;s.type===r.FLOAT_MAT2&&(o=2),s.type===r.FLOAT_MAT3&&(o=3),s.type===r.FLOAT_MAT4&&(o=4),t[a]={type:s.type,location:r.getAttribLocation(e,a),locationSize:o}}return t}function Qr(r){return r!==""}function pu(r,e){const t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return r.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,t).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function mu(r,e){return r.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const q0=/^[ \t]*#include +<([\w\d./]+)>/gm;function hl(r){return r.replace(q0,Y0)}const j0=new Map;function Y0(r,e){let t=_t[e];if(t===void 0){const n=j0.get(e);if(n!==void 0)t=_t[n],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,n);else throw new Error("Can not resolve #include <"+e+">")}return hl(t)}const K0=/#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 gu(r){return r.replace(K0,$0)}function $0(r,e,t,n){let i="";for(let s=parseInt(e);s<parseInt(t);s++)i+=n.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return i}function _u(r){let e=`precision ${r.precision} float;
|
|
3735
3735
|
precision ${r.precision} int;
|
|
3736
3736
|
precision ${r.precision} sampler2D;
|
|
3737
3737
|
precision ${r.precision} samplerCube;
|
|
@@ -3751,14 +3751,14 @@ void main() {
|
|
|
3751
3751
|
`;return r.precision==="highp"?e+=`
|
|
3752
3752
|
#define HIGH_PRECISION`:r.precision==="mediump"?e+=`
|
|
3753
3753
|
#define MEDIUM_PRECISION`:r.precision==="lowp"&&(e+=`
|
|
3754
|
-
#define LOW_PRECISION`),e}function
|
|
3754
|
+
#define LOW_PRECISION`),e}function J0(r){let e="SHADOWMAP_TYPE_BASIC";return r.shadowMapType===Ku?e="SHADOWMAP_TYPE_PCF":r.shadowMapType===$u?e="SHADOWMAP_TYPE_PCF_SOFT":r.shadowMapType===ui&&(e="SHADOWMAP_TYPE_VSM"),e}function Z0(r){let e="ENVMAP_TYPE_CUBE";if(r.envMap)switch(r.envMapMode){case Dr:case Lr:e="ENVMAP_TYPE_CUBE";break;case Sa:e="ENVMAP_TYPE_CUBE_UV";break}return e}function Q0(r){let e="ENVMAP_MODE_REFLECTION";if(r.envMap)switch(r.envMapMode){case Lr:e="ENVMAP_MODE_REFRACTION";break}return e}function ev(r){let e="ENVMAP_BLENDING_NONE";if(r.envMap)switch(r.combine){case xa:e="ENVMAP_BLENDING_MULTIPLY";break;case rf:e="ENVMAP_BLENDING_MIX";break;case sf:e="ENVMAP_BLENDING_ADD";break}return e}function tv(r){const e=r.envMapCubeUVHeight;if(e===null)return null;const t=Math.log2(e)-2,n=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),7*16)),texelHeight:n,maxMip:t}}function nv(r,e,t,n){const i=r.getContext(),s=t.defines;let a=t.vertexShader,o=t.fragmentShader;const l=J0(t),c=Z0(t),u=Q0(t),h=ev(t),d=tv(t),f=G0(t),m=W0(s),_=i.createProgram();let g,p,M=t.glslVersion?"#version "+t.glslVersion+`
|
|
3755
3755
|
`:"";t.isRawShaderMaterial?(g=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,m].filter(Qr).join(`
|
|
3756
3756
|
`),g.length>0&&(g+=`
|
|
3757
3757
|
`),p=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,m].filter(Qr).join(`
|
|
3758
3758
|
`),p.length>0&&(p+=`
|
|
3759
3759
|
`)):(g=[_u(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,m,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",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.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",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.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",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?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#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.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","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","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",`
|
|
3760
3760
|
`].filter(Qr).join(`
|
|
3761
|
-
`),p=[_u(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,m,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",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.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor||t.batchingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",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.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==Ri?"#define TONE_MAPPING":"",t.toneMapping!==Ri?_t.tonemapping_pars_fragment:"",t.toneMapping!==Ri?
|
|
3761
|
+
`),p=[_u(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,m,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",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.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor||t.batchingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",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.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==Ri?"#define TONE_MAPPING":"",t.toneMapping!==Ri?_t.tonemapping_pars_fragment:"",t.toneMapping!==Ri?V0("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",_t.colorspace_pars_fragment,z0("linearToOutputTexel",t.outputColorSpace),H0(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
|
|
3762
3762
|
`].filter(Qr).join(`
|
|
3763
3763
|
`)),a=hl(a),a=pu(a,t),a=mu(a,t),o=hl(o),o=pu(o,t),o=mu(o,t),a=gu(a),o=gu(o),t.isRawShaderMaterial!==!0&&(M=`#version 300 es
|
|
3764
3764
|
`,g=[f,"#define attribute in","#define varying out","#define texture2D texture"].join(`
|
|
@@ -3772,9 +3772,9 @@ Material Type: `+w.type+`
|
|
|
3772
3772
|
|
|
3773
3773
|
Program Info Log: `+B+`
|
|
3774
3774
|
`+K+`
|
|
3775
|
-
`+H)}else B!==""?console.warn("THREE.WebGLProgram: Program Info Log:",B):(z===""||X==="")&&(O=!1);O&&(w.diagnostics={runnable:j,programLog:B,vertexShader:{log:z,prefix:g},fragmentShader:{log:X,prefix:p}})}i.deleteShader(I),i.deleteShader(R),L=new oa(i,_),b=q0(i,_)}let L;this.getUniforms=function(){return L===void 0&&C(this),L};let b;this.getAttributes=function(){return b===void 0&&C(this),b};let x=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return x===!1&&(x=i.getProgramParameter(_,O0)),x},this.destroy=function(){n.releaseStatesOfProgram(this),i.deleteProgram(_),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=B0++,this.cacheKey=e,this.usedTimes=1,this.program=_,this.vertexShader=I,this.fragmentShader=R,this}let rv=0;class sv{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,i=this._getShaderStage(t),s=this._getShaderStage(n),a=this._getShaderCacheForMaterial(e);return a.has(i)===!1&&(a.add(i),i.usedTimes++),a.has(s)===!1&&(a.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.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;let n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return n===void 0&&(n=new av(e),t.set(e,n)),n}}class av{constructor(e){this.id=rv++,this.code=e,this.usedTimes=0}}function ov(r,e,t,n,i,s,a){const o=new Pl,l=new sv,c=new Set,u=[],h=i.logarithmicDepthBuffer,d=i.vertexTextures;let f=i.precision;const m={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 _(b){return c.add(b),b===0?"uv":`uv${b}`}function g(b,x,w,B,z){const X=B.fog,j=z.geometry,O=b.isMeshStandardMaterial?B.environment:null,K=(b.isMeshStandardMaterial?t:e).get(b.envMap||O),H=K&&K.mapping===Sa?K.image.height:null,ie=m[b.type];b.precision!==null&&(f=i.getMaxPrecision(b.precision),f!==b.precision&&console.warn("THREE.WebGLProgram.getParameters:",b.precision,"not supported, using",f,"instead."));const oe=j.morphAttributes.position||j.morphAttributes.normal||j.morphAttributes.color,$=oe!==void 0?oe.length:0;let xe=0;j.morphAttributes.position!==void 0&&(xe=1),j.morphAttributes.normal!==void 0&&(xe=2),j.morphAttributes.color!==void 0&&(xe=3);let Ee,q,te,se;if(ie){const Ze=Mn[ie];Ee=Ze.vertexShader,q=Ze.fragmentShader}else Ee=b.vertexShader,q=b.fragmentShader,l.update(b),te=l.getVertexShaderID(b),se=l.getFragmentShaderID(b);const le=r.getRenderTarget(),be=r.state.buffers.depth.getReversed(),st=z.isInstancedMesh===!0,Ke=z.isBatchedMesh===!0,Ct=!!b.map,ae=!!b.matcap,_e=!!K,N=!!b.aoMap,We=!!b.lightMap,Me=!!b.bumpMap,Te=!!b.normalMap,Q=!!b.displacementMap,Be=!!b.emissiveMap,Ie=!!b.metalnessMap,Re=!!b.roughnessMap,pt=b.anisotropy>0,F=b.clearcoat>0,T=b.dispersion>0,Y=b.iridescence>0,ce=b.sheen>0,de=b.transmission>0,ne=pt&&!!b.anisotropyMap,Ge=F&&!!b.clearcoatMap,Se=F&&!!b.clearcoatNormalMap,Fe=F&&!!b.clearcoatRoughnessMap,je=Y&&!!b.iridescenceMap,fe=Y&&!!b.iridescenceThicknessMap,Oe=ce&&!!b.sheenColorMap,tt=ce&&!!b.sheenRoughnessMap,Qe=!!b.specularMap,we=!!b.specularColorMap,at=!!b.specularIntensityMap,V=de&&!!b.transmissionMap,Pe=de&&!!b.thicknessMap,pe=!!b.gradientMap,ke=!!b.alphaMap,ve=b.alphaTest>0,he=!!b.alphaHash,He=!!b.extensions;let me=Ri;b.toneMapped&&(le===null||le.isXRRenderTarget===!0)&&(me=r.toneMapping);const mt={shaderID:ie,shaderType:b.type,shaderName:b.name,vertexShader:Ee,fragmentShader:q,defines:b.defines,customVertexShaderID:te,customFragmentShaderID:se,isRawShaderMaterial:b.isRawShaderMaterial===!0,glslVersion:b.glslVersion,precision:f,batching:Ke,batchingColor:Ke&&z._colorsTexture!==null,instancing:st,instancingColor:st&&z.instanceColor!==null,instancingMorph:st&&z.morphTexture!==null,supportsVertexTextures:d,outputColorSpace:le===null?r.outputColorSpace:le.isXRRenderTarget===!0?le.texture.colorSpace:Ur,alphaToCoverage:!!b.alphaToCoverage,map:Ct,matcap:ae,envMap:_e,envMapMode:_e&&K.mapping,envMapCubeUVHeight:H,aoMap:N,lightMap:We,bumpMap:Me,normalMap:Te,displacementMap:d&&Q,emissiveMap:Be,normalMapObjectSpace:Te&&b.normalMapType===vf,normalMapTangentSpace:Te&&b.normalMapType===Al,metalnessMap:Ie,roughnessMap:Re,anisotropy:pt,anisotropyMap:ne,clearcoat:F,clearcoatMap:Ge,clearcoatNormalMap:Se,clearcoatRoughnessMap:Fe,dispersion:T,iridescence:Y,iridescenceMap:je,iridescenceThicknessMap:fe,sheen:ce,sheenColorMap:Oe,sheenRoughnessMap:tt,specularMap:Qe,specularColorMap:we,specularIntensityMap:at,transmission:de,transmissionMap:V,thicknessMap:Pe,gradientMap:pe,opaque:b.transparent===!1&&b.blending===Ar&&b.alphaToCoverage===!1,alphaMap:ke,alphaTest:ve,alphaHash:he,combine:b.combine,mapUv:Ct&&_(b.map.channel),aoMapUv:N&&_(b.aoMap.channel),lightMapUv:We&&_(b.lightMap.channel),bumpMapUv:Me&&_(b.bumpMap.channel),normalMapUv:Te&&_(b.normalMap.channel),displacementMapUv:Q&&_(b.displacementMap.channel),emissiveMapUv:Be&&_(b.emissiveMap.channel),metalnessMapUv:Ie&&_(b.metalnessMap.channel),roughnessMapUv:Re&&_(b.roughnessMap.channel),anisotropyMapUv:ne&&_(b.anisotropyMap.channel),clearcoatMapUv:Ge&&_(b.clearcoatMap.channel),clearcoatNormalMapUv:Se&&_(b.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Fe&&_(b.clearcoatRoughnessMap.channel),iridescenceMapUv:je&&_(b.iridescenceMap.channel),iridescenceThicknessMapUv:fe&&_(b.iridescenceThicknessMap.channel),sheenColorMapUv:Oe&&_(b.sheenColorMap.channel),sheenRoughnessMapUv:tt&&_(b.sheenRoughnessMap.channel),specularMapUv:Qe&&_(b.specularMap.channel),specularColorMapUv:we&&_(b.specularColorMap.channel),specularIntensityMapUv:at&&_(b.specularIntensityMap.channel),transmissionMapUv:V&&_(b.transmissionMap.channel),thicknessMapUv:Pe&&_(b.thicknessMap.channel),alphaMapUv:ke&&_(b.alphaMap.channel),vertexTangents:!!j.attributes.tangent&&(Te||pt),vertexColors:b.vertexColors,vertexAlphas:b.vertexColors===!0&&!!j.attributes.color&&j.attributes.color.itemSize===4,pointsUvs:z.isPoints===!0&&!!j.attributes.uv&&(Ct||ke),fog:!!X,useFog:b.fog===!0,fogExp2:!!X&&X.isFogExp2,flatShading:b.flatShading===!0,sizeAttenuation:b.sizeAttenuation===!0,logarithmicDepthBuffer:h,reverseDepthBuffer:be,skinning:z.isSkinnedMesh===!0,morphTargets:j.morphAttributes.position!==void 0,morphNormals:j.morphAttributes.normal!==void 0,morphColors:j.morphAttributes.color!==void 0,morphTargetsCount:$,morphTextureStride:xe,numDirLights:x.directional.length,numPointLights:x.point.length,numSpotLights:x.spot.length,numSpotLightMaps:x.spotLightMap.length,numRectAreaLights:x.rectArea.length,numHemiLights:x.hemi.length,numDirLightShadows:x.directionalShadowMap.length,numPointLightShadows:x.pointShadowMap.length,numSpotLightShadows:x.spotShadowMap.length,numSpotLightShadowsWithMaps:x.numSpotLightShadowsWithMaps,numLightProbes:x.numLightProbes,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:b.dithering,shadowMapEnabled:r.shadowMap.enabled&&w.length>0,shadowMapType:r.shadowMap.type,toneMapping:me,decodeVideoTexture:Ct&&b.map.isVideoTexture===!0&&vt.getTransfer(b.map.colorSpace)===It,decodeVideoTextureEmissive:Be&&b.emissiveMap.isVideoTexture===!0&&vt.getTransfer(b.emissiveMap.colorSpace)===It,premultipliedAlpha:b.premultipliedAlpha,doubleSided:b.side===hn,flipSided:b.side===_n,useDepthPacking:b.depthPacking>=0,depthPacking:b.depthPacking||0,index0AttributeName:b.index0AttributeName,extensionClipCullDistance:He&&b.extensions.clipCullDistance===!0&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(He&&b.extensions.multiDraw===!0||Ke)&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:b.customProgramCacheKey()};return mt.vertexUv1s=c.has(1),mt.vertexUv2s=c.has(2),mt.vertexUv3s=c.has(3),c.clear(),mt}function p(b){const x=[];if(b.shaderID?x.push(b.shaderID):(x.push(b.customVertexShaderID),x.push(b.customFragmentShaderID)),b.defines!==void 0)for(const w in b.defines)x.push(w),x.push(b.defines[w]);return b.isRawShaderMaterial===!1&&(M(x,b),E(x,b),x.push(r.outputColorSpace)),x.push(b.customProgramCacheKey),x.join()}function M(b,x){b.push(x.precision),b.push(x.outputColorSpace),b.push(x.envMapMode),b.push(x.envMapCubeUVHeight),b.push(x.mapUv),b.push(x.alphaMapUv),b.push(x.lightMapUv),b.push(x.aoMapUv),b.push(x.bumpMapUv),b.push(x.normalMapUv),b.push(x.displacementMapUv),b.push(x.emissiveMapUv),b.push(x.metalnessMapUv),b.push(x.roughnessMapUv),b.push(x.anisotropyMapUv),b.push(x.clearcoatMapUv),b.push(x.clearcoatNormalMapUv),b.push(x.clearcoatRoughnessMapUv),b.push(x.iridescenceMapUv),b.push(x.iridescenceThicknessMapUv),b.push(x.sheenColorMapUv),b.push(x.sheenRoughnessMapUv),b.push(x.specularMapUv),b.push(x.specularColorMapUv),b.push(x.specularIntensityMapUv),b.push(x.transmissionMapUv),b.push(x.thicknessMapUv),b.push(x.combine),b.push(x.fogExp2),b.push(x.sizeAttenuation),b.push(x.morphTargetsCount),b.push(x.morphAttributeCount),b.push(x.numDirLights),b.push(x.numPointLights),b.push(x.numSpotLights),b.push(x.numSpotLightMaps),b.push(x.numHemiLights),b.push(x.numRectAreaLights),b.push(x.numDirLightShadows),b.push(x.numPointLightShadows),b.push(x.numSpotLightShadows),b.push(x.numSpotLightShadowsWithMaps),b.push(x.numLightProbes),b.push(x.shadowMapType),b.push(x.toneMapping),b.push(x.numClippingPlanes),b.push(x.numClipIntersection),b.push(x.depthPacking)}function E(b,x){o.disableAll(),x.supportsVertexTextures&&o.enable(0),x.instancing&&o.enable(1),x.instancingColor&&o.enable(2),x.instancingMorph&&o.enable(3),x.matcap&&o.enable(4),x.envMap&&o.enable(5),x.normalMapObjectSpace&&o.enable(6),x.normalMapTangentSpace&&o.enable(7),x.clearcoat&&o.enable(8),x.iridescence&&o.enable(9),x.alphaTest&&o.enable(10),x.vertexColors&&o.enable(11),x.vertexAlphas&&o.enable(12),x.vertexUv1s&&o.enable(13),x.vertexUv2s&&o.enable(14),x.vertexUv3s&&o.enable(15),x.vertexTangents&&o.enable(16),x.anisotropy&&o.enable(17),x.alphaHash&&o.enable(18),x.batching&&o.enable(19),x.dispersion&&o.enable(20),x.batchingColor&&o.enable(21),b.push(o.mask),o.disableAll(),x.fog&&o.enable(0),x.useFog&&o.enable(1),x.flatShading&&o.enable(2),x.logarithmicDepthBuffer&&o.enable(3),x.reverseDepthBuffer&&o.enable(4),x.skinning&&o.enable(5),x.morphTargets&&o.enable(6),x.morphNormals&&o.enable(7),x.morphColors&&o.enable(8),x.premultipliedAlpha&&o.enable(9),x.shadowMapEnabled&&o.enable(10),x.doubleSided&&o.enable(11),x.flipSided&&o.enable(12),x.useDepthPacking&&o.enable(13),x.dithering&&o.enable(14),x.transmission&&o.enable(15),x.sheen&&o.enable(16),x.opaque&&o.enable(17),x.pointsUvs&&o.enable(18),x.decodeVideoTexture&&o.enable(19),x.decodeVideoTextureEmissive&&o.enable(20),x.alphaToCoverage&&o.enable(21),b.push(o.mask)}function y(b){const x=m[b.type];let w;if(x){const B=Mn[x];w=Dl.clone(B.uniforms)}else w=b.uniforms;return w}function I(b,x){let w;for(let B=0,z=u.length;B<z;B++){const X=u[B];if(X.cacheKey===x){w=X,++w.usedTimes;break}}return w===void 0&&(w=new iv(r,x,b,s),u.push(w)),w}function R(b){if(--b.usedTimes===0){const x=u.indexOf(b);u[x]=u[u.length-1],u.pop(),b.destroy()}}function C(b){l.remove(b)}function L(){l.dispose()}return{getParameters:g,getProgramCacheKey:p,getUniforms:y,acquireProgram:I,releaseProgram:R,releaseShaderCache:C,programs:u,dispose:L}}function lv(){let r=new WeakMap;function e(a){return r.has(a)}function t(a){let o=r.get(a);return o===void 0&&(o={},r.set(a,o)),o}function n(a){r.delete(a)}function i(a,o,l){r.get(a)[o]=l}function s(){r=new WeakMap}return{has:e,get:t,remove:n,update:i,dispose:s}}function cv(r,e){return r.groupOrder!==e.groupOrder?r.groupOrder-e.groupOrder:r.renderOrder!==e.renderOrder?r.renderOrder-e.renderOrder:r.material.id!==e.material.id?r.material.id-e.material.id:r.z!==e.z?r.z-e.z:r.id-e.id}function vu(r,e){return r.groupOrder!==e.groupOrder?r.groupOrder-e.groupOrder:r.renderOrder!==e.renderOrder?r.renderOrder-e.renderOrder:r.z!==e.z?e.z-r.z:r.id-e.id}function yu(){const r=[];let e=0;const t=[],n=[],i=[];function s(){e=0,t.length=0,n.length=0,i.length=0}function a(h,d,f,m,_,g){let p=r[e];return p===void 0?(p={id:h.id,object:h,geometry:d,material:f,groupOrder:m,renderOrder:h.renderOrder,z:_,group:g},r[e]=p):(p.id=h.id,p.object=h,p.geometry=d,p.material=f,p.groupOrder=m,p.renderOrder=h.renderOrder,p.z=_,p.group=g),e++,p}function o(h,d,f,m,_,g){const p=a(h,d,f,m,_,g);f.transmission>0?n.push(p):f.transparent===!0?i.push(p):t.push(p)}function l(h,d,f,m,_,g){const p=a(h,d,f,m,_,g);f.transmission>0?n.unshift(p):f.transparent===!0?i.unshift(p):t.unshift(p)}function c(h,d){t.length>1&&t.sort(h||cv),n.length>1&&n.sort(d||vu),i.length>1&&i.sort(d||vu)}function u(){for(let h=e,d=r.length;h<d;h++){const f=r[h];if(f.id===null)break;f.id=null,f.object=null,f.geometry=null,f.material=null,f.group=null}}return{opaque:t,transmissive:n,transparent:i,init:s,push:o,unshift:l,finish:u,sort:c}}function uv(){let r=new WeakMap;function e(n,i){const s=r.get(n);let a;return s===void 0?(a=new yu,r.set(n,[a])):i>=s.length?(a=new yu,s.push(a)):a=s[i],a}function t(){r=new WeakMap}return{get:e,dispose:t}}function hv(){const r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new k,color:new ht};break;case"SpotLight":t={position:new k,direction:new k,color:new ht,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new k,color:new ht,distance:0,decay:0};break;case"HemisphereLight":t={direction:new k,skyColor:new ht,groundColor:new ht};break;case"RectAreaLight":t={color:new ht,position:new k,halfWidth:new k,halfHeight:new k};break}return r[e.id]=t,t}}}function dv(){const r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new dt};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new dt};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new dt,shadowCameraNear:1,shadowCameraFar:1e3};break}return r[e.id]=t,t}}}let fv=0;function pv(r,e){return(e.castShadow?2:0)-(r.castShadow?2:0)+(e.map?1:0)-(r.map?1:0)}function mv(r){const e=new hv,t=dv(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let c=0;c<9;c++)n.probe.push(new k);const i=new k,s=new ut,a=new ut;function o(c){let u=0,h=0,d=0;for(let b=0;b<9;b++)n.probe[b].set(0,0,0);let f=0,m=0,_=0,g=0,p=0,M=0,E=0,y=0,I=0,R=0,C=0;c.sort(pv);for(let b=0,x=c.length;b<x;b++){const w=c[b],B=w.color,z=w.intensity,X=w.distance,j=w.shadow&&w.shadow.map?w.shadow.map.texture:null;if(w.isAmbientLight)u+=B.r*z,h+=B.g*z,d+=B.b*z;else if(w.isLightProbe){for(let O=0;O<9;O++)n.probe[O].addScaledVector(w.sh.coefficients[O],z);C++}else if(w.isDirectionalLight){const O=e.get(w);if(O.color.copy(w.color).multiplyScalar(w.intensity),w.castShadow){const K=w.shadow,H=t.get(w);H.shadowIntensity=K.intensity,H.shadowBias=K.bias,H.shadowNormalBias=K.normalBias,H.shadowRadius=K.radius,H.shadowMapSize=K.mapSize,n.directionalShadow[f]=H,n.directionalShadowMap[f]=j,n.directionalShadowMatrix[f]=w.shadow.matrix,M++}n.directional[f]=O,f++}else if(w.isSpotLight){const O=e.get(w);O.position.setFromMatrixPosition(w.matrixWorld),O.color.copy(B).multiplyScalar(z),O.distance=X,O.coneCos=Math.cos(w.angle),O.penumbraCos=Math.cos(w.angle*(1-w.penumbra)),O.decay=w.decay,n.spot[_]=O;const K=w.shadow;if(w.map&&(n.spotLightMap[I]=w.map,I++,K.updateMatrices(w),w.castShadow&&R++),n.spotLightMatrix[_]=K.matrix,w.castShadow){const H=t.get(w);H.shadowIntensity=K.intensity,H.shadowBias=K.bias,H.shadowNormalBias=K.normalBias,H.shadowRadius=K.radius,H.shadowMapSize=K.mapSize,n.spotShadow[_]=H,n.spotShadowMap[_]=j,y++}_++}else if(w.isRectAreaLight){const O=e.get(w);O.color.copy(B).multiplyScalar(z),O.halfWidth.set(w.width*.5,0,0),O.halfHeight.set(0,w.height*.5,0),n.rectArea[g]=O,g++}else if(w.isPointLight){const O=e.get(w);if(O.color.copy(w.color).multiplyScalar(w.intensity),O.distance=w.distance,O.decay=w.decay,w.castShadow){const K=w.shadow,H=t.get(w);H.shadowIntensity=K.intensity,H.shadowBias=K.bias,H.shadowNormalBias=K.normalBias,H.shadowRadius=K.radius,H.shadowMapSize=K.mapSize,H.shadowCameraNear=K.camera.near,H.shadowCameraFar=K.camera.far,n.pointShadow[m]=H,n.pointShadowMap[m]=j,n.pointShadowMatrix[m]=w.shadow.matrix,E++}n.point[m]=O,m++}else if(w.isHemisphereLight){const O=e.get(w);O.skyColor.copy(w.color).multiplyScalar(z),O.groundColor.copy(w.groundColor).multiplyScalar(z),n.hemi[p]=O,p++}}g>0&&(r.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=Ce.LTC_FLOAT_1,n.rectAreaLTC2=Ce.LTC_FLOAT_2):(n.rectAreaLTC1=Ce.LTC_HALF_1,n.rectAreaLTC2=Ce.LTC_HALF_2)),n.ambient[0]=u,n.ambient[1]=h,n.ambient[2]=d;const L=n.hash;(L.directionalLength!==f||L.pointLength!==m||L.spotLength!==_||L.rectAreaLength!==g||L.hemiLength!==p||L.numDirectionalShadows!==M||L.numPointShadows!==E||L.numSpotShadows!==y||L.numSpotMaps!==I||L.numLightProbes!==C)&&(n.directional.length=f,n.spot.length=_,n.rectArea.length=g,n.point.length=m,n.hemi.length=p,n.directionalShadow.length=M,n.directionalShadowMap.length=M,n.pointShadow.length=E,n.pointShadowMap.length=E,n.spotShadow.length=y,n.spotShadowMap.length=y,n.directionalShadowMatrix.length=M,n.pointShadowMatrix.length=E,n.spotLightMatrix.length=y+I-R,n.spotLightMap.length=I,n.numSpotLightShadowsWithMaps=R,n.numLightProbes=C,L.directionalLength=f,L.pointLength=m,L.spotLength=_,L.rectAreaLength=g,L.hemiLength=p,L.numDirectionalShadows=M,L.numPointShadows=E,L.numSpotShadows=y,L.numSpotMaps=I,L.numLightProbes=C,n.version=fv++)}function l(c,u){let h=0,d=0,f=0,m=0,_=0;const g=u.matrixWorldInverse;for(let p=0,M=c.length;p<M;p++){const E=c[p];if(E.isDirectionalLight){const y=n.directional[h];y.direction.setFromMatrixPosition(E.matrixWorld),i.setFromMatrixPosition(E.target.matrixWorld),y.direction.sub(i),y.direction.transformDirection(g),h++}else if(E.isSpotLight){const y=n.spot[f];y.position.setFromMatrixPosition(E.matrixWorld),y.position.applyMatrix4(g),y.direction.setFromMatrixPosition(E.matrixWorld),i.setFromMatrixPosition(E.target.matrixWorld),y.direction.sub(i),y.direction.transformDirection(g),f++}else if(E.isRectAreaLight){const y=n.rectArea[m];y.position.setFromMatrixPosition(E.matrixWorld),y.position.applyMatrix4(g),a.identity(),s.copy(E.matrixWorld),s.premultiply(g),a.extractRotation(s),y.halfWidth.set(E.width*.5,0,0),y.halfHeight.set(0,E.height*.5,0),y.halfWidth.applyMatrix4(a),y.halfHeight.applyMatrix4(a),m++}else if(E.isPointLight){const y=n.point[d];y.position.setFromMatrixPosition(E.matrixWorld),y.position.applyMatrix4(g),d++}else if(E.isHemisphereLight){const y=n.hemi[_];y.direction.setFromMatrixPosition(E.matrixWorld),y.direction.transformDirection(g),_++}}}return{setup:o,setupView:l,state:n}}function xu(r){const e=new mv(r),t=[],n=[];function i(u){c.camera=u,t.length=0,n.length=0}function s(u){t.push(u)}function a(u){n.push(u)}function o(){e.setup(t)}function l(u){e.setupView(t,u)}const c={lightsArray:t,shadowsArray:n,camera:null,lights:e,transmissionRenderTarget:{}};return{init:i,state:c,setupLights:o,setupLightsView:l,pushLight:s,pushShadow:a}}function gv(r){let e=new WeakMap;function t(i,s=0){const a=e.get(i);let o;return a===void 0?(o=new xu(r),e.set(i,[o])):s>=a.length?(o=new xu(r),a.push(o)):o=a[s],o}function n(){e=new WeakMap}return{get:t,dispose:n}}const _v=`void main() {
|
|
3775
|
+
`+H)}else B!==""?console.warn("THREE.WebGLProgram: Program Info Log:",B):(z===""||X==="")&&(O=!1);O&&(w.diagnostics={runnable:j,programLog:B,vertexShader:{log:z,prefix:g},fragmentShader:{log:X,prefix:p}})}i.deleteShader(I),i.deleteShader(R),L=new oa(i,_),b=X0(i,_)}let L;this.getUniforms=function(){return L===void 0&&C(this),L};let b;this.getAttributes=function(){return b===void 0&&C(this),b};let x=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return x===!1&&(x=i.getProgramParameter(_,F0)),x},this.destroy=function(){n.releaseStatesOfProgram(this),i.deleteProgram(_),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=O0++,this.cacheKey=e,this.usedTimes=1,this.program=_,this.vertexShader=I,this.fragmentShader=R,this}let iv=0;class rv{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,i=this._getShaderStage(t),s=this._getShaderStage(n),a=this._getShaderCacheForMaterial(e);return a.has(i)===!1&&(a.add(i),i.usedTimes++),a.has(s)===!1&&(a.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.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;let n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return n===void 0&&(n=new sv(e),t.set(e,n)),n}}class sv{constructor(e){this.id=iv++,this.code=e,this.usedTimes=0}}function av(r,e,t,n,i,s,a){const o=new Pl,l=new rv,c=new Set,u=[],h=i.logarithmicDepthBuffer,d=i.vertexTextures;let f=i.precision;const m={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 _(b){return c.add(b),b===0?"uv":`uv${b}`}function g(b,x,w,B,z){const X=B.fog,j=z.geometry,O=b.isMeshStandardMaterial?B.environment:null,K=(b.isMeshStandardMaterial?t:e).get(b.envMap||O),H=K&&K.mapping===Sa?K.image.height:null,re=m[b.type];b.precision!==null&&(f=i.getMaxPrecision(b.precision),f!==b.precision&&console.warn("THREE.WebGLProgram.getParameters:",b.precision,"not supported, using",f,"instead."));const oe=j.morphAttributes.position||j.morphAttributes.normal||j.morphAttributes.color,$=oe!==void 0?oe.length:0;let xe=0;j.morphAttributes.position!==void 0&&(xe=1),j.morphAttributes.normal!==void 0&&(xe=2),j.morphAttributes.color!==void 0&&(xe=3);let Ee,q,te,se;if(re){const Ze=Mn[re];Ee=Ze.vertexShader,q=Ze.fragmentShader}else Ee=b.vertexShader,q=b.fragmentShader,l.update(b),te=l.getVertexShaderID(b),se=l.getFragmentShaderID(b);const le=r.getRenderTarget(),be=r.state.buffers.depth.getReversed(),st=z.isInstancedMesh===!0,Ke=z.isBatchedMesh===!0,Ct=!!b.map,ae=!!b.matcap,_e=!!K,N=!!b.aoMap,We=!!b.lightMap,Me=!!b.bumpMap,Te=!!b.normalMap,Q=!!b.displacementMap,Be=!!b.emissiveMap,Ie=!!b.metalnessMap,Re=!!b.roughnessMap,pt=b.anisotropy>0,F=b.clearcoat>0,T=b.dispersion>0,Y=b.iridescence>0,ce=b.sheen>0,de=b.transmission>0,ne=pt&&!!b.anisotropyMap,Ge=F&&!!b.clearcoatMap,Se=F&&!!b.clearcoatNormalMap,Fe=F&&!!b.clearcoatRoughnessMap,je=Y&&!!b.iridescenceMap,fe=Y&&!!b.iridescenceThicknessMap,Oe=ce&&!!b.sheenColorMap,tt=ce&&!!b.sheenRoughnessMap,Qe=!!b.specularMap,we=!!b.specularColorMap,at=!!b.specularIntensityMap,V=de&&!!b.transmissionMap,Pe=de&&!!b.thicknessMap,pe=!!b.gradientMap,ke=!!b.alphaMap,ve=b.alphaTest>0,he=!!b.alphaHash,He=!!b.extensions;let me=Ri;b.toneMapped&&(le===null||le.isXRRenderTarget===!0)&&(me=r.toneMapping);const mt={shaderID:re,shaderType:b.type,shaderName:b.name,vertexShader:Ee,fragmentShader:q,defines:b.defines,customVertexShaderID:te,customFragmentShaderID:se,isRawShaderMaterial:b.isRawShaderMaterial===!0,glslVersion:b.glslVersion,precision:f,batching:Ke,batchingColor:Ke&&z._colorsTexture!==null,instancing:st,instancingColor:st&&z.instanceColor!==null,instancingMorph:st&&z.morphTexture!==null,supportsVertexTextures:d,outputColorSpace:le===null?r.outputColorSpace:le.isXRRenderTarget===!0?le.texture.colorSpace:Ur,alphaToCoverage:!!b.alphaToCoverage,map:Ct,matcap:ae,envMap:_e,envMapMode:_e&&K.mapping,envMapCubeUVHeight:H,aoMap:N,lightMap:We,bumpMap:Me,normalMap:Te,displacementMap:d&&Q,emissiveMap:Be,normalMapObjectSpace:Te&&b.normalMapType===_f,normalMapTangentSpace:Te&&b.normalMapType===Al,metalnessMap:Ie,roughnessMap:Re,anisotropy:pt,anisotropyMap:ne,clearcoat:F,clearcoatMap:Ge,clearcoatNormalMap:Se,clearcoatRoughnessMap:Fe,dispersion:T,iridescence:Y,iridescenceMap:je,iridescenceThicknessMap:fe,sheen:ce,sheenColorMap:Oe,sheenRoughnessMap:tt,specularMap:Qe,specularColorMap:we,specularIntensityMap:at,transmission:de,transmissionMap:V,thicknessMap:Pe,gradientMap:pe,opaque:b.transparent===!1&&b.blending===Ar&&b.alphaToCoverage===!1,alphaMap:ke,alphaTest:ve,alphaHash:he,combine:b.combine,mapUv:Ct&&_(b.map.channel),aoMapUv:N&&_(b.aoMap.channel),lightMapUv:We&&_(b.lightMap.channel),bumpMapUv:Me&&_(b.bumpMap.channel),normalMapUv:Te&&_(b.normalMap.channel),displacementMapUv:Q&&_(b.displacementMap.channel),emissiveMapUv:Be&&_(b.emissiveMap.channel),metalnessMapUv:Ie&&_(b.metalnessMap.channel),roughnessMapUv:Re&&_(b.roughnessMap.channel),anisotropyMapUv:ne&&_(b.anisotropyMap.channel),clearcoatMapUv:Ge&&_(b.clearcoatMap.channel),clearcoatNormalMapUv:Se&&_(b.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Fe&&_(b.clearcoatRoughnessMap.channel),iridescenceMapUv:je&&_(b.iridescenceMap.channel),iridescenceThicknessMapUv:fe&&_(b.iridescenceThicknessMap.channel),sheenColorMapUv:Oe&&_(b.sheenColorMap.channel),sheenRoughnessMapUv:tt&&_(b.sheenRoughnessMap.channel),specularMapUv:Qe&&_(b.specularMap.channel),specularColorMapUv:we&&_(b.specularColorMap.channel),specularIntensityMapUv:at&&_(b.specularIntensityMap.channel),transmissionMapUv:V&&_(b.transmissionMap.channel),thicknessMapUv:Pe&&_(b.thicknessMap.channel),alphaMapUv:ke&&_(b.alphaMap.channel),vertexTangents:!!j.attributes.tangent&&(Te||pt),vertexColors:b.vertexColors,vertexAlphas:b.vertexColors===!0&&!!j.attributes.color&&j.attributes.color.itemSize===4,pointsUvs:z.isPoints===!0&&!!j.attributes.uv&&(Ct||ke),fog:!!X,useFog:b.fog===!0,fogExp2:!!X&&X.isFogExp2,flatShading:b.flatShading===!0,sizeAttenuation:b.sizeAttenuation===!0,logarithmicDepthBuffer:h,reverseDepthBuffer:be,skinning:z.isSkinnedMesh===!0,morphTargets:j.morphAttributes.position!==void 0,morphNormals:j.morphAttributes.normal!==void 0,morphColors:j.morphAttributes.color!==void 0,morphTargetsCount:$,morphTextureStride:xe,numDirLights:x.directional.length,numPointLights:x.point.length,numSpotLights:x.spot.length,numSpotLightMaps:x.spotLightMap.length,numRectAreaLights:x.rectArea.length,numHemiLights:x.hemi.length,numDirLightShadows:x.directionalShadowMap.length,numPointLightShadows:x.pointShadowMap.length,numSpotLightShadows:x.spotShadowMap.length,numSpotLightShadowsWithMaps:x.numSpotLightShadowsWithMaps,numLightProbes:x.numLightProbes,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:b.dithering,shadowMapEnabled:r.shadowMap.enabled&&w.length>0,shadowMapType:r.shadowMap.type,toneMapping:me,decodeVideoTexture:Ct&&b.map.isVideoTexture===!0&&vt.getTransfer(b.map.colorSpace)===It,decodeVideoTextureEmissive:Be&&b.emissiveMap.isVideoTexture===!0&&vt.getTransfer(b.emissiveMap.colorSpace)===It,premultipliedAlpha:b.premultipliedAlpha,doubleSided:b.side===hn,flipSided:b.side===_n,useDepthPacking:b.depthPacking>=0,depthPacking:b.depthPacking||0,index0AttributeName:b.index0AttributeName,extensionClipCullDistance:He&&b.extensions.clipCullDistance===!0&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(He&&b.extensions.multiDraw===!0||Ke)&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:b.customProgramCacheKey()};return mt.vertexUv1s=c.has(1),mt.vertexUv2s=c.has(2),mt.vertexUv3s=c.has(3),c.clear(),mt}function p(b){const x=[];if(b.shaderID?x.push(b.shaderID):(x.push(b.customVertexShaderID),x.push(b.customFragmentShaderID)),b.defines!==void 0)for(const w in b.defines)x.push(w),x.push(b.defines[w]);return b.isRawShaderMaterial===!1&&(M(x,b),E(x,b),x.push(r.outputColorSpace)),x.push(b.customProgramCacheKey),x.join()}function M(b,x){b.push(x.precision),b.push(x.outputColorSpace),b.push(x.envMapMode),b.push(x.envMapCubeUVHeight),b.push(x.mapUv),b.push(x.alphaMapUv),b.push(x.lightMapUv),b.push(x.aoMapUv),b.push(x.bumpMapUv),b.push(x.normalMapUv),b.push(x.displacementMapUv),b.push(x.emissiveMapUv),b.push(x.metalnessMapUv),b.push(x.roughnessMapUv),b.push(x.anisotropyMapUv),b.push(x.clearcoatMapUv),b.push(x.clearcoatNormalMapUv),b.push(x.clearcoatRoughnessMapUv),b.push(x.iridescenceMapUv),b.push(x.iridescenceThicknessMapUv),b.push(x.sheenColorMapUv),b.push(x.sheenRoughnessMapUv),b.push(x.specularMapUv),b.push(x.specularColorMapUv),b.push(x.specularIntensityMapUv),b.push(x.transmissionMapUv),b.push(x.thicknessMapUv),b.push(x.combine),b.push(x.fogExp2),b.push(x.sizeAttenuation),b.push(x.morphTargetsCount),b.push(x.morphAttributeCount),b.push(x.numDirLights),b.push(x.numPointLights),b.push(x.numSpotLights),b.push(x.numSpotLightMaps),b.push(x.numHemiLights),b.push(x.numRectAreaLights),b.push(x.numDirLightShadows),b.push(x.numPointLightShadows),b.push(x.numSpotLightShadows),b.push(x.numSpotLightShadowsWithMaps),b.push(x.numLightProbes),b.push(x.shadowMapType),b.push(x.toneMapping),b.push(x.numClippingPlanes),b.push(x.numClipIntersection),b.push(x.depthPacking)}function E(b,x){o.disableAll(),x.supportsVertexTextures&&o.enable(0),x.instancing&&o.enable(1),x.instancingColor&&o.enable(2),x.instancingMorph&&o.enable(3),x.matcap&&o.enable(4),x.envMap&&o.enable(5),x.normalMapObjectSpace&&o.enable(6),x.normalMapTangentSpace&&o.enable(7),x.clearcoat&&o.enable(8),x.iridescence&&o.enable(9),x.alphaTest&&o.enable(10),x.vertexColors&&o.enable(11),x.vertexAlphas&&o.enable(12),x.vertexUv1s&&o.enable(13),x.vertexUv2s&&o.enable(14),x.vertexUv3s&&o.enable(15),x.vertexTangents&&o.enable(16),x.anisotropy&&o.enable(17),x.alphaHash&&o.enable(18),x.batching&&o.enable(19),x.dispersion&&o.enable(20),x.batchingColor&&o.enable(21),b.push(o.mask),o.disableAll(),x.fog&&o.enable(0),x.useFog&&o.enable(1),x.flatShading&&o.enable(2),x.logarithmicDepthBuffer&&o.enable(3),x.reverseDepthBuffer&&o.enable(4),x.skinning&&o.enable(5),x.morphTargets&&o.enable(6),x.morphNormals&&o.enable(7),x.morphColors&&o.enable(8),x.premultipliedAlpha&&o.enable(9),x.shadowMapEnabled&&o.enable(10),x.doubleSided&&o.enable(11),x.flipSided&&o.enable(12),x.useDepthPacking&&o.enable(13),x.dithering&&o.enable(14),x.transmission&&o.enable(15),x.sheen&&o.enable(16),x.opaque&&o.enable(17),x.pointsUvs&&o.enable(18),x.decodeVideoTexture&&o.enable(19),x.decodeVideoTextureEmissive&&o.enable(20),x.alphaToCoverage&&o.enable(21),b.push(o.mask)}function y(b){const x=m[b.type];let w;if(x){const B=Mn[x];w=Dl.clone(B.uniforms)}else w=b.uniforms;return w}function I(b,x){let w;for(let B=0,z=u.length;B<z;B++){const X=u[B];if(X.cacheKey===x){w=X,++w.usedTimes;break}}return w===void 0&&(w=new nv(r,x,b,s),u.push(w)),w}function R(b){if(--b.usedTimes===0){const x=u.indexOf(b);u[x]=u[u.length-1],u.pop(),b.destroy()}}function C(b){l.remove(b)}function L(){l.dispose()}return{getParameters:g,getProgramCacheKey:p,getUniforms:y,acquireProgram:I,releaseProgram:R,releaseShaderCache:C,programs:u,dispose:L}}function ov(){let r=new WeakMap;function e(a){return r.has(a)}function t(a){let o=r.get(a);return o===void 0&&(o={},r.set(a,o)),o}function n(a){r.delete(a)}function i(a,o,l){r.get(a)[o]=l}function s(){r=new WeakMap}return{has:e,get:t,remove:n,update:i,dispose:s}}function lv(r,e){return r.groupOrder!==e.groupOrder?r.groupOrder-e.groupOrder:r.renderOrder!==e.renderOrder?r.renderOrder-e.renderOrder:r.material.id!==e.material.id?r.material.id-e.material.id:r.z!==e.z?r.z-e.z:r.id-e.id}function vu(r,e){return r.groupOrder!==e.groupOrder?r.groupOrder-e.groupOrder:r.renderOrder!==e.renderOrder?r.renderOrder-e.renderOrder:r.z!==e.z?e.z-r.z:r.id-e.id}function yu(){const r=[];let e=0;const t=[],n=[],i=[];function s(){e=0,t.length=0,n.length=0,i.length=0}function a(h,d,f,m,_,g){let p=r[e];return p===void 0?(p={id:h.id,object:h,geometry:d,material:f,groupOrder:m,renderOrder:h.renderOrder,z:_,group:g},r[e]=p):(p.id=h.id,p.object=h,p.geometry=d,p.material=f,p.groupOrder=m,p.renderOrder=h.renderOrder,p.z=_,p.group=g),e++,p}function o(h,d,f,m,_,g){const p=a(h,d,f,m,_,g);f.transmission>0?n.push(p):f.transparent===!0?i.push(p):t.push(p)}function l(h,d,f,m,_,g){const p=a(h,d,f,m,_,g);f.transmission>0?n.unshift(p):f.transparent===!0?i.unshift(p):t.unshift(p)}function c(h,d){t.length>1&&t.sort(h||lv),n.length>1&&n.sort(d||vu),i.length>1&&i.sort(d||vu)}function u(){for(let h=e,d=r.length;h<d;h++){const f=r[h];if(f.id===null)break;f.id=null,f.object=null,f.geometry=null,f.material=null,f.group=null}}return{opaque:t,transmissive:n,transparent:i,init:s,push:o,unshift:l,finish:u,sort:c}}function cv(){let r=new WeakMap;function e(n,i){const s=r.get(n);let a;return s===void 0?(a=new yu,r.set(n,[a])):i>=s.length?(a=new yu,s.push(a)):a=s[i],a}function t(){r=new WeakMap}return{get:e,dispose:t}}function uv(){const r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new k,color:new ht};break;case"SpotLight":t={position:new k,direction:new k,color:new ht,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new k,color:new ht,distance:0,decay:0};break;case"HemisphereLight":t={direction:new k,skyColor:new ht,groundColor:new ht};break;case"RectAreaLight":t={color:new ht,position:new k,halfWidth:new k,halfHeight:new k};break}return r[e.id]=t,t}}}function hv(){const r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new dt};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new dt};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new dt,shadowCameraNear:1,shadowCameraFar:1e3};break}return r[e.id]=t,t}}}let dv=0;function fv(r,e){return(e.castShadow?2:0)-(r.castShadow?2:0)+(e.map?1:0)-(r.map?1:0)}function pv(r){const e=new uv,t=hv(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let c=0;c<9;c++)n.probe.push(new k);const i=new k,s=new ut,a=new ut;function o(c){let u=0,h=0,d=0;for(let b=0;b<9;b++)n.probe[b].set(0,0,0);let f=0,m=0,_=0,g=0,p=0,M=0,E=0,y=0,I=0,R=0,C=0;c.sort(fv);for(let b=0,x=c.length;b<x;b++){const w=c[b],B=w.color,z=w.intensity,X=w.distance,j=w.shadow&&w.shadow.map?w.shadow.map.texture:null;if(w.isAmbientLight)u+=B.r*z,h+=B.g*z,d+=B.b*z;else if(w.isLightProbe){for(let O=0;O<9;O++)n.probe[O].addScaledVector(w.sh.coefficients[O],z);C++}else if(w.isDirectionalLight){const O=e.get(w);if(O.color.copy(w.color).multiplyScalar(w.intensity),w.castShadow){const K=w.shadow,H=t.get(w);H.shadowIntensity=K.intensity,H.shadowBias=K.bias,H.shadowNormalBias=K.normalBias,H.shadowRadius=K.radius,H.shadowMapSize=K.mapSize,n.directionalShadow[f]=H,n.directionalShadowMap[f]=j,n.directionalShadowMatrix[f]=w.shadow.matrix,M++}n.directional[f]=O,f++}else if(w.isSpotLight){const O=e.get(w);O.position.setFromMatrixPosition(w.matrixWorld),O.color.copy(B).multiplyScalar(z),O.distance=X,O.coneCos=Math.cos(w.angle),O.penumbraCos=Math.cos(w.angle*(1-w.penumbra)),O.decay=w.decay,n.spot[_]=O;const K=w.shadow;if(w.map&&(n.spotLightMap[I]=w.map,I++,K.updateMatrices(w),w.castShadow&&R++),n.spotLightMatrix[_]=K.matrix,w.castShadow){const H=t.get(w);H.shadowIntensity=K.intensity,H.shadowBias=K.bias,H.shadowNormalBias=K.normalBias,H.shadowRadius=K.radius,H.shadowMapSize=K.mapSize,n.spotShadow[_]=H,n.spotShadowMap[_]=j,y++}_++}else if(w.isRectAreaLight){const O=e.get(w);O.color.copy(B).multiplyScalar(z),O.halfWidth.set(w.width*.5,0,0),O.halfHeight.set(0,w.height*.5,0),n.rectArea[g]=O,g++}else if(w.isPointLight){const O=e.get(w);if(O.color.copy(w.color).multiplyScalar(w.intensity),O.distance=w.distance,O.decay=w.decay,w.castShadow){const K=w.shadow,H=t.get(w);H.shadowIntensity=K.intensity,H.shadowBias=K.bias,H.shadowNormalBias=K.normalBias,H.shadowRadius=K.radius,H.shadowMapSize=K.mapSize,H.shadowCameraNear=K.camera.near,H.shadowCameraFar=K.camera.far,n.pointShadow[m]=H,n.pointShadowMap[m]=j,n.pointShadowMatrix[m]=w.shadow.matrix,E++}n.point[m]=O,m++}else if(w.isHemisphereLight){const O=e.get(w);O.skyColor.copy(w.color).multiplyScalar(z),O.groundColor.copy(w.groundColor).multiplyScalar(z),n.hemi[p]=O,p++}}g>0&&(r.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=Ce.LTC_FLOAT_1,n.rectAreaLTC2=Ce.LTC_FLOAT_2):(n.rectAreaLTC1=Ce.LTC_HALF_1,n.rectAreaLTC2=Ce.LTC_HALF_2)),n.ambient[0]=u,n.ambient[1]=h,n.ambient[2]=d;const L=n.hash;(L.directionalLength!==f||L.pointLength!==m||L.spotLength!==_||L.rectAreaLength!==g||L.hemiLength!==p||L.numDirectionalShadows!==M||L.numPointShadows!==E||L.numSpotShadows!==y||L.numSpotMaps!==I||L.numLightProbes!==C)&&(n.directional.length=f,n.spot.length=_,n.rectArea.length=g,n.point.length=m,n.hemi.length=p,n.directionalShadow.length=M,n.directionalShadowMap.length=M,n.pointShadow.length=E,n.pointShadowMap.length=E,n.spotShadow.length=y,n.spotShadowMap.length=y,n.directionalShadowMatrix.length=M,n.pointShadowMatrix.length=E,n.spotLightMatrix.length=y+I-R,n.spotLightMap.length=I,n.numSpotLightShadowsWithMaps=R,n.numLightProbes=C,L.directionalLength=f,L.pointLength=m,L.spotLength=_,L.rectAreaLength=g,L.hemiLength=p,L.numDirectionalShadows=M,L.numPointShadows=E,L.numSpotShadows=y,L.numSpotMaps=I,L.numLightProbes=C,n.version=dv++)}function l(c,u){let h=0,d=0,f=0,m=0,_=0;const g=u.matrixWorldInverse;for(let p=0,M=c.length;p<M;p++){const E=c[p];if(E.isDirectionalLight){const y=n.directional[h];y.direction.setFromMatrixPosition(E.matrixWorld),i.setFromMatrixPosition(E.target.matrixWorld),y.direction.sub(i),y.direction.transformDirection(g),h++}else if(E.isSpotLight){const y=n.spot[f];y.position.setFromMatrixPosition(E.matrixWorld),y.position.applyMatrix4(g),y.direction.setFromMatrixPosition(E.matrixWorld),i.setFromMatrixPosition(E.target.matrixWorld),y.direction.sub(i),y.direction.transformDirection(g),f++}else if(E.isRectAreaLight){const y=n.rectArea[m];y.position.setFromMatrixPosition(E.matrixWorld),y.position.applyMatrix4(g),a.identity(),s.copy(E.matrixWorld),s.premultiply(g),a.extractRotation(s),y.halfWidth.set(E.width*.5,0,0),y.halfHeight.set(0,E.height*.5,0),y.halfWidth.applyMatrix4(a),y.halfHeight.applyMatrix4(a),m++}else if(E.isPointLight){const y=n.point[d];y.position.setFromMatrixPosition(E.matrixWorld),y.position.applyMatrix4(g),d++}else if(E.isHemisphereLight){const y=n.hemi[_];y.direction.setFromMatrixPosition(E.matrixWorld),y.direction.transformDirection(g),_++}}}return{setup:o,setupView:l,state:n}}function xu(r){const e=new pv(r),t=[],n=[];function i(u){c.camera=u,t.length=0,n.length=0}function s(u){t.push(u)}function a(u){n.push(u)}function o(){e.setup(t)}function l(u){e.setupView(t,u)}const c={lightsArray:t,shadowsArray:n,camera:null,lights:e,transmissionRenderTarget:{}};return{init:i,state:c,setupLights:o,setupLightsView:l,pushLight:s,pushShadow:a}}function mv(r){let e=new WeakMap;function t(i,s=0){const a=e.get(i);let o;return a===void 0?(o=new xu(r),e.set(i,[o])):s>=a.length?(o=new xu(r),a.push(o)):o=a[s],o}function n(){e=new WeakMap}return{get:t,dispose:n}}const gv=`void main() {
|
|
3776
3776
|
gl_Position = vec4( position, 1.0 );
|
|
3777
|
-
}`,
|
|
3777
|
+
}`,_v=`uniform sampler2D shadow_pass;
|
|
3778
3778
|
uniform vec2 resolution;
|
|
3779
3779
|
uniform float radius;
|
|
3780
3780
|
#include <packing>
|
|
@@ -3800,12 +3800,12 @@ void main() {
|
|
|
3800
3800
|
squared_mean = squared_mean / samples;
|
|
3801
3801
|
float std_dev = sqrt( squared_mean - mean * mean );
|
|
3802
3802
|
gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
|
|
3803
|
-
}`;function yv(r,e,t){let n=new Nl;const i=new dt,s=new dt,a=new St,o=new Ep({depthPacking:_f}),l=new Tp,c={},u=t.maxTextureSize,h={[$n]:_n,[_n]:$n,[hn]:hn},d=new gi({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new dt},radius:{value:4}},vertexShader:_v,fragmentShader:vv}),f=d.clone();f.defines.HORIZONTAL_PASS=1;const m=new Vt;m.setAttribute("position",new Xt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const _=new Ut(m,d),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Ku;let p=this.type;this.render=function(R,C,L){if(g.enabled===!1||g.autoUpdate===!1&&g.needsUpdate===!1||R.length===0)return;const b=r.getRenderTarget(),x=r.getActiveCubeFace(),w=r.getActiveMipmapLevel(),B=r.state;B.setBlending(Ai),B.buffers.color.setClear(1,1,1,1),B.buffers.depth.setTest(!0),B.setScissorTest(!1);const z=p!==ui&&this.type===ui,X=p===ui&&this.type!==ui;for(let j=0,O=R.length;j<O;j++){const K=R[j],H=K.shadow;if(H===void 0){console.warn("THREE.WebGLShadowMap:",K,"has no shadow.");continue}if(H.autoUpdate===!1&&H.needsUpdate===!1)continue;i.copy(H.mapSize);const ie=H.getFrameExtents();if(i.multiply(ie),s.copy(H.mapSize),(i.x>u||i.y>u)&&(i.x>u&&(s.x=Math.floor(u/ie.x),i.x=s.x*ie.x,H.mapSize.x=s.x),i.y>u&&(s.y=Math.floor(u/ie.y),i.y=s.y*ie.y,H.mapSize.y=s.y)),H.map===null||z===!0||X===!0){const $=this.type!==ui?{minFilter:Rn,magFilter:Rn}:{};H.map!==null&&H.map.dispose(),H.map=new Ji(i.x,i.y,$),H.map.texture.name=K.name+".shadowMap",H.camera.updateProjectionMatrix()}r.setRenderTarget(H.map),r.clear();const oe=H.getViewportCount();for(let $=0;$<oe;$++){const xe=H.getViewport($);a.set(s.x*xe.x,s.y*xe.y,s.x*xe.z,s.y*xe.w),B.viewport(a),H.updateMatrices(K,$),n=H.getFrustum(),y(C,L,H.camera,K,this.type)}H.isPointLightShadow!==!0&&this.type===ui&&M(H,L),H.needsUpdate=!1}p=this.type,g.needsUpdate=!1,r.setRenderTarget(b,x,w)};function M(R,C){const L=e.update(_);d.defines.VSM_SAMPLES!==R.blurSamples&&(d.defines.VSM_SAMPLES=R.blurSamples,f.defines.VSM_SAMPLES=R.blurSamples,d.needsUpdate=!0,f.needsUpdate=!0),R.mapPass===null&&(R.mapPass=new Ji(i.x,i.y)),d.uniforms.shadow_pass.value=R.map.texture,d.uniforms.resolution.value=R.mapSize,d.uniforms.radius.value=R.radius,r.setRenderTarget(R.mapPass),r.clear(),r.renderBufferDirect(C,null,L,d,_,null),f.uniforms.shadow_pass.value=R.mapPass.texture,f.uniforms.resolution.value=R.mapSize,f.uniforms.radius.value=R.radius,r.setRenderTarget(R.map),r.clear(),r.renderBufferDirect(C,null,L,f,_,null)}function E(R,C,L,b){let x=null;const w=L.isPointLight===!0?R.customDistanceMaterial:R.customDepthMaterial;if(w!==void 0)x=w;else if(x=L.isPointLight===!0?l:o,r.localClippingEnabled&&C.clipShadows===!0&&Array.isArray(C.clippingPlanes)&&C.clippingPlanes.length!==0||C.displacementMap&&C.displacementScale!==0||C.alphaMap&&C.alphaTest>0||C.map&&C.alphaTest>0||C.alphaToCoverage===!0){const B=x.uuid,z=C.uuid;let X=c[B];X===void 0&&(X={},c[B]=X);let j=X[z];j===void 0&&(j=x.clone(),X[z]=j,C.addEventListener("dispose",I)),x=j}if(x.visible=C.visible,x.wireframe=C.wireframe,b===ui?x.side=C.shadowSide!==null?C.shadowSide:C.side:x.side=C.shadowSide!==null?C.shadowSide:h[C.side],x.alphaMap=C.alphaMap,x.alphaTest=C.alphaToCoverage===!0?.5:C.alphaTest,x.map=C.map,x.clipShadows=C.clipShadows,x.clippingPlanes=C.clippingPlanes,x.clipIntersection=C.clipIntersection,x.displacementMap=C.displacementMap,x.displacementScale=C.displacementScale,x.displacementBias=C.displacementBias,x.wireframeLinewidth=C.wireframeLinewidth,x.linewidth=C.linewidth,L.isPointLight===!0&&x.isMeshDistanceMaterial===!0){const B=r.properties.get(x);B.light=L}return x}function y(R,C,L,b,x){if(R.visible===!1)return;if(R.layers.test(C.layers)&&(R.isMesh||R.isLine||R.isPoints)&&(R.castShadow||R.receiveShadow&&x===ui)&&(!R.frustumCulled||n.intersectsObject(R))){R.modelViewMatrix.multiplyMatrices(L.matrixWorldInverse,R.matrixWorld);const z=e.update(R),X=R.material;if(Array.isArray(X)){const j=z.groups;for(let O=0,K=j.length;O<K;O++){const H=j[O],ie=X[H.materialIndex];if(ie&&ie.visible){const oe=E(R,ie,b,x);R.onBeforeShadow(r,R,C,L,z,oe,H),r.renderBufferDirect(L,null,z,oe,R,H),R.onAfterShadow(r,R,C,L,z,oe,H)}}}else if(X.visible){const j=E(R,X,b,x);R.onBeforeShadow(r,R,C,L,z,j,null),r.renderBufferDirect(L,null,z,j,R,null),R.onAfterShadow(r,R,C,L,z,j,null)}}const B=R.children;for(let z=0,X=B.length;z<X;z++)y(B[z],C,L,b,x)}function I(R){R.target.removeEventListener("dispose",I);for(const L in c){const b=c[L],x=R.target.uuid;x in b&&(b[x].dispose(),delete b[x])}}}const xv={[bo]:Eo,[To]:Ro,[wo]:Co,[Pr]:Ao,[Eo]:bo,[Ro]:To,[Co]:wo,[Ao]:Pr};function Sv(r,e){function t(){let V=!1;const Pe=new St;let pe=null;const ke=new St(0,0,0,0);return{setMask:function(ve){pe!==ve&&!V&&(r.colorMask(ve,ve,ve,ve),pe=ve)},setLocked:function(ve){V=ve},setClear:function(ve,he,He,me,mt){mt===!0&&(ve*=me,he*=me,He*=me),Pe.set(ve,he,He,me),ke.equals(Pe)===!1&&(r.clearColor(ve,he,He,me),ke.copy(Pe))},reset:function(){V=!1,pe=null,ke.set(-1,0,0,0)}}}function n(){let V=!1,Pe=!1,pe=null,ke=null,ve=null;return{setReversed:function(he){if(Pe!==he){const He=e.get("EXT_clip_control");he?He.clipControlEXT(He.LOWER_LEFT_EXT,He.ZERO_TO_ONE_EXT):He.clipControlEXT(He.LOWER_LEFT_EXT,He.NEGATIVE_ONE_TO_ONE_EXT),Pe=he;const me=ve;ve=null,this.setClear(me)}},getReversed:function(){return Pe},setTest:function(he){he?le(r.DEPTH_TEST):be(r.DEPTH_TEST)},setMask:function(he){pe!==he&&!V&&(r.depthMask(he),pe=he)},setFunc:function(he){if(Pe&&(he=xv[he]),ke!==he){switch(he){case bo:r.depthFunc(r.NEVER);break;case Eo:r.depthFunc(r.ALWAYS);break;case To:r.depthFunc(r.LESS);break;case Pr:r.depthFunc(r.LEQUAL);break;case wo:r.depthFunc(r.EQUAL);break;case Ao:r.depthFunc(r.GEQUAL);break;case Ro:r.depthFunc(r.GREATER);break;case Co:r.depthFunc(r.NOTEQUAL);break;default:r.depthFunc(r.LEQUAL)}ke=he}},setLocked:function(he){V=he},setClear:function(he){ve!==he&&(Pe&&(he=1-he),r.clearDepth(he),ve=he)},reset:function(){V=!1,pe=null,ke=null,ve=null,Pe=!1}}}function i(){let V=!1,Pe=null,pe=null,ke=null,ve=null,he=null,He=null,me=null,mt=null;return{setTest:function(Ze){V||(Ze?le(r.STENCIL_TEST):be(r.STENCIL_TEST))},setMask:function(Ze){Pe!==Ze&&!V&&(r.stencilMask(Ze),Pe=Ze)},setFunc:function(Ze,Ht,En){(pe!==Ze||ke!==Ht||ve!==En)&&(r.stencilFunc(Ze,Ht,En),pe=Ze,ke=Ht,ve=En)},setOp:function(Ze,Ht,En){(he!==Ze||He!==Ht||me!==En)&&(r.stencilOp(Ze,Ht,En),he=Ze,He=Ht,me=En)},setLocked:function(Ze){V=Ze},setClear:function(Ze){mt!==Ze&&(r.clearStencil(Ze),mt=Ze)},reset:function(){V=!1,Pe=null,pe=null,ke=null,ve=null,he=null,He=null,me=null,mt=null}}}const s=new t,a=new n,o=new i,l=new WeakMap,c=new WeakMap;let u={},h={},d=new WeakMap,f=[],m=null,_=!1,g=null,p=null,M=null,E=null,y=null,I=null,R=null,C=new ht(0,0,0),L=0,b=!1,x=null,w=null,B=null,z=null,X=null;const j=r.getParameter(r.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let O=!1,K=0;const H=r.getParameter(r.VERSION);H.indexOf("WebGL")!==-1?(K=parseFloat(/^WebGL (\d)/.exec(H)[1]),O=K>=1):H.indexOf("OpenGL ES")!==-1&&(K=parseFloat(/^OpenGL ES (\d)/.exec(H)[1]),O=K>=2);let ie=null,oe={};const $=r.getParameter(r.SCISSOR_BOX),xe=r.getParameter(r.VIEWPORT),Ee=new St().fromArray($),q=new St().fromArray(xe);function te(V,Pe,pe,ke){const ve=new Uint8Array(4),he=r.createTexture();r.bindTexture(V,he),r.texParameteri(V,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(V,r.TEXTURE_MAG_FILTER,r.NEAREST);for(let He=0;He<pe;He++)V===r.TEXTURE_3D||V===r.TEXTURE_2D_ARRAY?r.texImage3D(Pe,0,r.RGBA,1,1,ke,0,r.RGBA,r.UNSIGNED_BYTE,ve):r.texImage2D(Pe+He,0,r.RGBA,1,1,0,r.RGBA,r.UNSIGNED_BYTE,ve);return he}const se={};se[r.TEXTURE_2D]=te(r.TEXTURE_2D,r.TEXTURE_2D,1),se[r.TEXTURE_CUBE_MAP]=te(r.TEXTURE_CUBE_MAP,r.TEXTURE_CUBE_MAP_POSITIVE_X,6),se[r.TEXTURE_2D_ARRAY]=te(r.TEXTURE_2D_ARRAY,r.TEXTURE_2D_ARRAY,1,1),se[r.TEXTURE_3D]=te(r.TEXTURE_3D,r.TEXTURE_3D,1,1),s.setClear(0,0,0,1),a.setClear(1),o.setClear(0),le(r.DEPTH_TEST),a.setFunc(Pr),Me(!1),Te(Zl),le(r.CULL_FACE),N(Ai);function le(V){u[V]!==!0&&(r.enable(V),u[V]=!0)}function be(V){u[V]!==!1&&(r.disable(V),u[V]=!1)}function st(V,Pe){return h[V]!==Pe?(r.bindFramebuffer(V,Pe),h[V]=Pe,V===r.DRAW_FRAMEBUFFER&&(h[r.FRAMEBUFFER]=Pe),V===r.FRAMEBUFFER&&(h[r.DRAW_FRAMEBUFFER]=Pe),!0):!1}function Ke(V,Pe){let pe=f,ke=!1;if(V){pe=d.get(Pe),pe===void 0&&(pe=[],d.set(Pe,pe));const ve=V.textures;if(pe.length!==ve.length||pe[0]!==r.COLOR_ATTACHMENT0){for(let he=0,He=ve.length;he<He;he++)pe[he]=r.COLOR_ATTACHMENT0+he;pe.length=ve.length,ke=!0}}else pe[0]!==r.BACK&&(pe[0]=r.BACK,ke=!0);ke&&r.drawBuffers(pe)}function Ct(V){return m!==V?(r.useProgram(V),m=V,!0):!1}const ae={[Gi]:r.FUNC_ADD,[Vd]:r.FUNC_SUBTRACT,[Hd]:r.FUNC_REVERSE_SUBTRACT};ae[Gd]=r.MIN,ae[Wd]=r.MAX;const _e={[Xd]:r.ZERO,[qd]:r.ONE,[jd]:r.SRC_COLOR,[So]:r.SRC_ALPHA,[Qd]:r.SRC_ALPHA_SATURATE,[Jd]:r.DST_COLOR,[Kd]:r.DST_ALPHA,[Yd]:r.ONE_MINUS_SRC_COLOR,[Mo]:r.ONE_MINUS_SRC_ALPHA,[Zd]:r.ONE_MINUS_DST_COLOR,[$d]:r.ONE_MINUS_DST_ALPHA,[ef]:r.CONSTANT_COLOR,[tf]:r.ONE_MINUS_CONSTANT_COLOR,[nf]:r.CONSTANT_ALPHA,[rf]:r.ONE_MINUS_CONSTANT_ALPHA};function N(V,Pe,pe,ke,ve,he,He,me,mt,Ze){if(V===Ai){_===!0&&(be(r.BLEND),_=!1);return}if(_===!1&&(le(r.BLEND),_=!0),V!==zd){if(V!==g||Ze!==b){if((p!==Gi||y!==Gi)&&(r.blendEquation(r.FUNC_ADD),p=Gi,y=Gi),Ze)switch(V){case Ar:r.blendFuncSeparate(r.ONE,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA);break;case Ql:r.blendFunc(r.ONE,r.ONE);break;case ec:r.blendFuncSeparate(r.ZERO,r.ONE_MINUS_SRC_COLOR,r.ZERO,r.ONE);break;case tc:r.blendFuncSeparate(r.ZERO,r.SRC_COLOR,r.ZERO,r.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",V);break}else switch(V){case Ar:r.blendFuncSeparate(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA);break;case Ql:r.blendFunc(r.SRC_ALPHA,r.ONE);break;case ec:r.blendFuncSeparate(r.ZERO,r.ONE_MINUS_SRC_COLOR,r.ZERO,r.ONE);break;case tc:r.blendFunc(r.ZERO,r.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",V);break}M=null,E=null,I=null,R=null,C.set(0,0,0),L=0,g=V,b=Ze}return}ve=ve||Pe,he=he||pe,He=He||ke,(Pe!==p||ve!==y)&&(r.blendEquationSeparate(ae[Pe],ae[ve]),p=Pe,y=ve),(pe!==M||ke!==E||he!==I||He!==R)&&(r.blendFuncSeparate(_e[pe],_e[ke],_e[he],_e[He]),M=pe,E=ke,I=he,R=He),(me.equals(C)===!1||mt!==L)&&(r.blendColor(me.r,me.g,me.b,mt),C.copy(me),L=mt),g=V,b=!1}function We(V,Pe){V.side===hn?be(r.CULL_FACE):le(r.CULL_FACE);let pe=V.side===_n;Pe&&(pe=!pe),Me(pe),V.blending===Ar&&V.transparent===!1?N(Ai):N(V.blending,V.blendEquation,V.blendSrc,V.blendDst,V.blendEquationAlpha,V.blendSrcAlpha,V.blendDstAlpha,V.blendColor,V.blendAlpha,V.premultipliedAlpha),a.setFunc(V.depthFunc),a.setTest(V.depthTest),a.setMask(V.depthWrite),s.setMask(V.colorWrite);const ke=V.stencilWrite;o.setTest(ke),ke&&(o.setMask(V.stencilWriteMask),o.setFunc(V.stencilFunc,V.stencilRef,V.stencilFuncMask),o.setOp(V.stencilFail,V.stencilZFail,V.stencilZPass)),Be(V.polygonOffset,V.polygonOffsetFactor,V.polygonOffsetUnits),V.alphaToCoverage===!0?le(r.SAMPLE_ALPHA_TO_COVERAGE):be(r.SAMPLE_ALPHA_TO_COVERAGE)}function Me(V){x!==V&&(V?r.frontFace(r.CW):r.frontFace(r.CCW),x=V)}function Te(V){V!==Bd?(le(r.CULL_FACE),V!==w&&(V===Zl?r.cullFace(r.BACK):V===kd?r.cullFace(r.FRONT):r.cullFace(r.FRONT_AND_BACK))):be(r.CULL_FACE),w=V}function Q(V){V!==B&&(O&&r.lineWidth(V),B=V)}function Be(V,Pe,pe){V?(le(r.POLYGON_OFFSET_FILL),(z!==Pe||X!==pe)&&(r.polygonOffset(Pe,pe),z=Pe,X=pe)):be(r.POLYGON_OFFSET_FILL)}function Ie(V){V?le(r.SCISSOR_TEST):be(r.SCISSOR_TEST)}function Re(V){V===void 0&&(V=r.TEXTURE0+j-1),ie!==V&&(r.activeTexture(V),ie=V)}function pt(V,Pe,pe){pe===void 0&&(ie===null?pe=r.TEXTURE0+j-1:pe=ie);let ke=oe[pe];ke===void 0&&(ke={type:void 0,texture:void 0},oe[pe]=ke),(ke.type!==V||ke.texture!==Pe)&&(ie!==pe&&(r.activeTexture(pe),ie=pe),r.bindTexture(V,Pe||se[V]),ke.type=V,ke.texture=Pe)}function F(){const V=oe[ie];V!==void 0&&V.type!==void 0&&(r.bindTexture(V.type,null),V.type=void 0,V.texture=void 0)}function T(){try{r.compressedTexImage2D(...arguments)}catch(V){console.error("THREE.WebGLState:",V)}}function Y(){try{r.compressedTexImage3D(...arguments)}catch(V){console.error("THREE.WebGLState:",V)}}function ce(){try{r.texSubImage2D(...arguments)}catch(V){console.error("THREE.WebGLState:",V)}}function de(){try{r.texSubImage3D(...arguments)}catch(V){console.error("THREE.WebGLState:",V)}}function ne(){try{r.compressedTexSubImage2D(...arguments)}catch(V){console.error("THREE.WebGLState:",V)}}function Ge(){try{r.compressedTexSubImage3D(...arguments)}catch(V){console.error("THREE.WebGLState:",V)}}function Se(){try{r.texStorage2D(...arguments)}catch(V){console.error("THREE.WebGLState:",V)}}function Fe(){try{r.texStorage3D(...arguments)}catch(V){console.error("THREE.WebGLState:",V)}}function je(){try{r.texImage2D(...arguments)}catch(V){console.error("THREE.WebGLState:",V)}}function fe(){try{r.texImage3D(...arguments)}catch(V){console.error("THREE.WebGLState:",V)}}function Oe(V){Ee.equals(V)===!1&&(r.scissor(V.x,V.y,V.z,V.w),Ee.copy(V))}function tt(V){q.equals(V)===!1&&(r.viewport(V.x,V.y,V.z,V.w),q.copy(V))}function Qe(V,Pe){let pe=c.get(Pe);pe===void 0&&(pe=new WeakMap,c.set(Pe,pe));let ke=pe.get(V);ke===void 0&&(ke=r.getUniformBlockIndex(Pe,V.name),pe.set(V,ke))}function we(V,Pe){const ke=c.get(Pe).get(V);l.get(Pe)!==ke&&(r.uniformBlockBinding(Pe,ke,V.__bindingPointIndex),l.set(Pe,ke))}function at(){r.disable(r.BLEND),r.disable(r.CULL_FACE),r.disable(r.DEPTH_TEST),r.disable(r.POLYGON_OFFSET_FILL),r.disable(r.SCISSOR_TEST),r.disable(r.STENCIL_TEST),r.disable(r.SAMPLE_ALPHA_TO_COVERAGE),r.blendEquation(r.FUNC_ADD),r.blendFunc(r.ONE,r.ZERO),r.blendFuncSeparate(r.ONE,r.ZERO,r.ONE,r.ZERO),r.blendColor(0,0,0,0),r.colorMask(!0,!0,!0,!0),r.clearColor(0,0,0,0),r.depthMask(!0),r.depthFunc(r.LESS),a.setReversed(!1),r.clearDepth(1),r.stencilMask(4294967295),r.stencilFunc(r.ALWAYS,0,4294967295),r.stencilOp(r.KEEP,r.KEEP,r.KEEP),r.clearStencil(0),r.cullFace(r.BACK),r.frontFace(r.CCW),r.polygonOffset(0,0),r.activeTexture(r.TEXTURE0),r.bindFramebuffer(r.FRAMEBUFFER,null),r.bindFramebuffer(r.DRAW_FRAMEBUFFER,null),r.bindFramebuffer(r.READ_FRAMEBUFFER,null),r.useProgram(null),r.lineWidth(1),r.scissor(0,0,r.canvas.width,r.canvas.height),r.viewport(0,0,r.canvas.width,r.canvas.height),u={},ie=null,oe={},h={},d=new WeakMap,f=[],m=null,_=!1,g=null,p=null,M=null,E=null,y=null,I=null,R=null,C=new ht(0,0,0),L=0,b=!1,x=null,w=null,B=null,z=null,X=null,Ee.set(0,0,r.canvas.width,r.canvas.height),q.set(0,0,r.canvas.width,r.canvas.height),s.reset(),a.reset(),o.reset()}return{buffers:{color:s,depth:a,stencil:o},enable:le,disable:be,bindFramebuffer:st,drawBuffers:Ke,useProgram:Ct,setBlending:N,setMaterial:We,setFlipSided:Me,setCullFace:Te,setLineWidth:Q,setPolygonOffset:Be,setScissorTest:Ie,activeTexture:Re,bindTexture:pt,unbindTexture:F,compressedTexImage2D:T,compressedTexImage3D:Y,texImage2D:je,texImage3D:fe,updateUBOMapping:Qe,uniformBlockBinding:we,texStorage2D:Se,texStorage3D:Fe,texSubImage2D:ce,texSubImage3D:de,compressedTexSubImage2D:ne,compressedTexSubImage3D:Ge,scissor:Oe,viewport:tt,reset:at}}function Mv(r,e,t,n,i,s,a){const o=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,l=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new dt,u=new WeakMap;let h;const d=new WeakMap;let f=!1;try{f=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function m(F,T){return f?new OffscreenCanvas(F,T):cs("canvas")}function _(F,T,Y){let ce=1;const de=pt(F);if((de.width>Y||de.height>Y)&&(ce=Y/Math.max(de.width,de.height)),ce<1)if(typeof HTMLImageElement<"u"&&F instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&F instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&F instanceof ImageBitmap||typeof VideoFrame<"u"&&F instanceof VideoFrame){const ne=Math.floor(ce*de.width),Ge=Math.floor(ce*de.height);h===void 0&&(h=m(ne,Ge));const Se=T?m(ne,Ge):h;return Se.width=ne,Se.height=Ge,Se.getContext("2d").drawImage(F,0,0,ne,Ge),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+de.width+"x"+de.height+") to ("+ne+"x"+Ge+")."),Se}else return"data"in F&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+de.width+"x"+de.height+")."),F;return F}function g(F){return F.generateMipmaps}function p(F){r.generateMipmap(F)}function M(F){return F.isWebGLCubeRenderTarget?r.TEXTURE_CUBE_MAP:F.isWebGL3DRenderTarget?r.TEXTURE_3D:F.isWebGLArrayRenderTarget||F.isCompressedArrayTexture?r.TEXTURE_2D_ARRAY:r.TEXTURE_2D}function E(F,T,Y,ce,de=!1){if(F!==null){if(r[F]!==void 0)return r[F];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+F+"'")}let ne=T;if(T===r.RED&&(Y===r.FLOAT&&(ne=r.R32F),Y===r.HALF_FLOAT&&(ne=r.R16F),Y===r.UNSIGNED_BYTE&&(ne=r.R8)),T===r.RED_INTEGER&&(Y===r.UNSIGNED_BYTE&&(ne=r.R8UI),Y===r.UNSIGNED_SHORT&&(ne=r.R16UI),Y===r.UNSIGNED_INT&&(ne=r.R32UI),Y===r.BYTE&&(ne=r.R8I),Y===r.SHORT&&(ne=r.R16I),Y===r.INT&&(ne=r.R32I)),T===r.RG&&(Y===r.FLOAT&&(ne=r.RG32F),Y===r.HALF_FLOAT&&(ne=r.RG16F),Y===r.UNSIGNED_BYTE&&(ne=r.RG8)),T===r.RG_INTEGER&&(Y===r.UNSIGNED_BYTE&&(ne=r.RG8UI),Y===r.UNSIGNED_SHORT&&(ne=r.RG16UI),Y===r.UNSIGNED_INT&&(ne=r.RG32UI),Y===r.BYTE&&(ne=r.RG8I),Y===r.SHORT&&(ne=r.RG16I),Y===r.INT&&(ne=r.RG32I)),T===r.RGB_INTEGER&&(Y===r.UNSIGNED_BYTE&&(ne=r.RGB8UI),Y===r.UNSIGNED_SHORT&&(ne=r.RGB16UI),Y===r.UNSIGNED_INT&&(ne=r.RGB32UI),Y===r.BYTE&&(ne=r.RGB8I),Y===r.SHORT&&(ne=r.RGB16I),Y===r.INT&&(ne=r.RGB32I)),T===r.RGBA_INTEGER&&(Y===r.UNSIGNED_BYTE&&(ne=r.RGBA8UI),Y===r.UNSIGNED_SHORT&&(ne=r.RGBA16UI),Y===r.UNSIGNED_INT&&(ne=r.RGBA32UI),Y===r.BYTE&&(ne=r.RGBA8I),Y===r.SHORT&&(ne=r.RGBA16I),Y===r.INT&&(ne=r.RGBA32I)),T===r.RGB&&Y===r.UNSIGNED_INT_5_9_9_9_REV&&(ne=r.RGB9_E5),T===r.RGBA){const Ge=de?pa:vt.getTransfer(ce);Y===r.FLOAT&&(ne=r.RGBA32F),Y===r.HALF_FLOAT&&(ne=r.RGBA16F),Y===r.UNSIGNED_BYTE&&(ne=Ge===It?r.SRGB8_ALPHA8:r.RGBA8),Y===r.UNSIGNED_SHORT_4_4_4_4&&(ne=r.RGBA4),Y===r.UNSIGNED_SHORT_5_5_5_1&&(ne=r.RGB5_A1)}return(ne===r.R16F||ne===r.R32F||ne===r.RG16F||ne===r.RG32F||ne===r.RGBA16F||ne===r.RGBA32F)&&e.get("EXT_color_buffer_float"),ne}function y(F,T){let Y;return F?T===null||T===$i||T===as?Y=r.DEPTH24_STENCIL8:T===Yn?Y=r.DEPTH32F_STENCIL8:T===ss&&(Y=r.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):T===null||T===$i||T===as?Y=r.DEPTH_COMPONENT24:T===Yn?Y=r.DEPTH_COMPONENT32F:T===ss&&(Y=r.DEPTH_COMPONENT16),Y}function I(F,T){return g(F)===!0||F.isFramebufferTexture&&F.minFilter!==Rn&&F.minFilter!==An?Math.log2(Math.max(T.width,T.height))+1:F.mipmaps!==void 0&&F.mipmaps.length>0?F.mipmaps.length:F.isCompressedTexture&&Array.isArray(F.image)?T.mipmaps.length:1}function R(F){const T=F.target;T.removeEventListener("dispose",R),L(T),T.isVideoTexture&&u.delete(T)}function C(F){const T=F.target;T.removeEventListener("dispose",C),x(T)}function L(F){const T=n.get(F);if(T.__webglInit===void 0)return;const Y=F.source,ce=d.get(Y);if(ce){const de=ce[T.__cacheKey];de.usedTimes--,de.usedTimes===0&&b(F),Object.keys(ce).length===0&&d.delete(Y)}n.remove(F)}function b(F){const T=n.get(F);r.deleteTexture(T.__webglTexture);const Y=F.source,ce=d.get(Y);delete ce[T.__cacheKey],a.memory.textures--}function x(F){const T=n.get(F);if(F.depthTexture&&(F.depthTexture.dispose(),n.remove(F.depthTexture)),F.isWebGLCubeRenderTarget)for(let ce=0;ce<6;ce++){if(Array.isArray(T.__webglFramebuffer[ce]))for(let de=0;de<T.__webglFramebuffer[ce].length;de++)r.deleteFramebuffer(T.__webglFramebuffer[ce][de]);else r.deleteFramebuffer(T.__webglFramebuffer[ce]);T.__webglDepthbuffer&&r.deleteRenderbuffer(T.__webglDepthbuffer[ce])}else{if(Array.isArray(T.__webglFramebuffer))for(let ce=0;ce<T.__webglFramebuffer.length;ce++)r.deleteFramebuffer(T.__webglFramebuffer[ce]);else r.deleteFramebuffer(T.__webglFramebuffer);if(T.__webglDepthbuffer&&r.deleteRenderbuffer(T.__webglDepthbuffer),T.__webglMultisampledFramebuffer&&r.deleteFramebuffer(T.__webglMultisampledFramebuffer),T.__webglColorRenderbuffer)for(let ce=0;ce<T.__webglColorRenderbuffer.length;ce++)T.__webglColorRenderbuffer[ce]&&r.deleteRenderbuffer(T.__webglColorRenderbuffer[ce]);T.__webglDepthRenderbuffer&&r.deleteRenderbuffer(T.__webglDepthRenderbuffer)}const Y=F.textures;for(let ce=0,de=Y.length;ce<de;ce++){const ne=n.get(Y[ce]);ne.__webglTexture&&(r.deleteTexture(ne.__webglTexture),a.memory.textures--),n.remove(Y[ce])}n.remove(F)}let w=0;function B(){w=0}function z(){const F=w;return F>=i.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+F+" texture units while this GPU supports only "+i.maxTextures),w+=1,F}function X(F){const T=[];return T.push(F.wrapS),T.push(F.wrapT),T.push(F.wrapR||0),T.push(F.magFilter),T.push(F.minFilter),T.push(F.anisotropy),T.push(F.internalFormat),T.push(F.format),T.push(F.type),T.push(F.generateMipmaps),T.push(F.premultiplyAlpha),T.push(F.flipY),T.push(F.unpackAlignment),T.push(F.colorSpace),T.join()}function j(F,T){const Y=n.get(F);if(F.isVideoTexture&&Ie(F),F.isRenderTargetTexture===!1&&F.version>0&&Y.__version!==F.version){const ce=F.image;if(ce===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(ce.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{se(Y,F,T);return}}t.bindTexture(r.TEXTURE_2D,Y.__webglTexture,r.TEXTURE0+T)}function O(F,T){const Y=n.get(F);if(F.version>0&&Y.__version!==F.version){se(Y,F,T);return}t.bindTexture(r.TEXTURE_2D_ARRAY,Y.__webglTexture,r.TEXTURE0+T)}function K(F,T){const Y=n.get(F);if(F.version>0&&Y.__version!==F.version){se(Y,F,T);return}t.bindTexture(r.TEXTURE_3D,Y.__webglTexture,r.TEXTURE0+T)}function H(F,T){const Y=n.get(F);if(F.version>0&&Y.__version!==F.version){le(Y,F,T);return}t.bindTexture(r.TEXTURE_CUBE_MAP,Y.__webglTexture,r.TEXTURE0+T)}const ie={[jn]:r.REPEAT,[kn]:r.CLAMP_TO_EDGE,[Lo]:r.MIRRORED_REPEAT},oe={[Rn]:r.NEAREST,[pf]:r.NEAREST_MIPMAP_NEAREST,[_s]:r.NEAREST_MIPMAP_LINEAR,[An]:r.LINEAR,[Ca]:r.LINEAR_MIPMAP_NEAREST,[hi]:r.LINEAR_MIPMAP_LINEAR},$={[yf]:r.NEVER,[Tf]:r.ALWAYS,[xf]:r.LESS,[oh]:r.LEQUAL,[Sf]:r.EQUAL,[Ef]:r.GEQUAL,[Mf]:r.GREATER,[bf]:r.NOTEQUAL};function xe(F,T){if(T.type===Yn&&e.has("OES_texture_float_linear")===!1&&(T.magFilter===An||T.magFilter===Ca||T.magFilter===_s||T.magFilter===hi||T.minFilter===An||T.minFilter===Ca||T.minFilter===_s||T.minFilter===hi)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),r.texParameteri(F,r.TEXTURE_WRAP_S,ie[T.wrapS]),r.texParameteri(F,r.TEXTURE_WRAP_T,ie[T.wrapT]),(F===r.TEXTURE_3D||F===r.TEXTURE_2D_ARRAY)&&r.texParameteri(F,r.TEXTURE_WRAP_R,ie[T.wrapR]),r.texParameteri(F,r.TEXTURE_MAG_FILTER,oe[T.magFilter]),r.texParameteri(F,r.TEXTURE_MIN_FILTER,oe[T.minFilter]),T.compareFunction&&(r.texParameteri(F,r.TEXTURE_COMPARE_MODE,r.COMPARE_REF_TO_TEXTURE),r.texParameteri(F,r.TEXTURE_COMPARE_FUNC,$[T.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(T.magFilter===Rn||T.minFilter!==_s&&T.minFilter!==hi||T.type===Yn&&e.has("OES_texture_float_linear")===!1)return;if(T.anisotropy>1||n.get(T).__currentAnisotropy){const Y=e.get("EXT_texture_filter_anisotropic");r.texParameterf(F,Y.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(T.anisotropy,i.getMaxAnisotropy())),n.get(T).__currentAnisotropy=T.anisotropy}}}function Ee(F,T){let Y=!1;F.__webglInit===void 0&&(F.__webglInit=!0,T.addEventListener("dispose",R));const ce=T.source;let de=d.get(ce);de===void 0&&(de={},d.set(ce,de));const ne=X(T);if(ne!==F.__cacheKey){de[ne]===void 0&&(de[ne]={texture:r.createTexture(),usedTimes:0},a.memory.textures++,Y=!0),de[ne].usedTimes++;const Ge=de[F.__cacheKey];Ge!==void 0&&(de[F.__cacheKey].usedTimes--,Ge.usedTimes===0&&b(T)),F.__cacheKey=ne,F.__webglTexture=de[ne].texture}return Y}function q(F,T,Y){return Math.floor(Math.floor(F/Y)/T)}function te(F,T,Y,ce){const ne=F.updateRanges;if(ne.length===0)t.texSubImage2D(r.TEXTURE_2D,0,0,0,T.width,T.height,Y,ce,T.data);else{ne.sort((fe,Oe)=>fe.start-Oe.start);let Ge=0;for(let fe=1;fe<ne.length;fe++){const Oe=ne[Ge],tt=ne[fe],Qe=Oe.start+Oe.count,we=q(tt.start,T.width,4),at=q(Oe.start,T.width,4);tt.start<=Qe+1&&we===at&&q(tt.start+tt.count-1,T.width,4)===we?Oe.count=Math.max(Oe.count,tt.start+tt.count-Oe.start):(++Ge,ne[Ge]=tt)}ne.length=Ge+1;const Se=r.getParameter(r.UNPACK_ROW_LENGTH),Fe=r.getParameter(r.UNPACK_SKIP_PIXELS),je=r.getParameter(r.UNPACK_SKIP_ROWS);r.pixelStorei(r.UNPACK_ROW_LENGTH,T.width);for(let fe=0,Oe=ne.length;fe<Oe;fe++){const tt=ne[fe],Qe=Math.floor(tt.start/4),we=Math.ceil(tt.count/4),at=Qe%T.width,V=Math.floor(Qe/T.width),Pe=we,pe=1;r.pixelStorei(r.UNPACK_SKIP_PIXELS,at),r.pixelStorei(r.UNPACK_SKIP_ROWS,V),t.texSubImage2D(r.TEXTURE_2D,0,at,V,Pe,pe,Y,ce,T.data)}F.clearUpdateRanges(),r.pixelStorei(r.UNPACK_ROW_LENGTH,Se),r.pixelStorei(r.UNPACK_SKIP_PIXELS,Fe),r.pixelStorei(r.UNPACK_SKIP_ROWS,je)}}function se(F,T,Y){let ce=r.TEXTURE_2D;(T.isDataArrayTexture||T.isCompressedArrayTexture)&&(ce=r.TEXTURE_2D_ARRAY),T.isData3DTexture&&(ce=r.TEXTURE_3D);const de=Ee(F,T),ne=T.source;t.bindTexture(ce,F.__webglTexture,r.TEXTURE0+Y);const Ge=n.get(ne);if(ne.version!==Ge.__version||de===!0){t.activeTexture(r.TEXTURE0+Y);const Se=vt.getPrimaries(vt.workingColorSpace),Fe=T.colorSpace===wi?null:vt.getPrimaries(T.colorSpace),je=T.colorSpace===wi||Se===Fe?r.NONE:r.BROWSER_DEFAULT_WEBGL;r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,T.flipY),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,T.premultiplyAlpha),r.pixelStorei(r.UNPACK_ALIGNMENT,T.unpackAlignment),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,je);let fe=_(T.image,!1,i.maxTextureSize);fe=Re(T,fe);const Oe=s.convert(T.format,T.colorSpace),tt=s.convert(T.type);let Qe=E(T.internalFormat,Oe,tt,T.colorSpace,T.isVideoTexture);xe(ce,T);let we;const at=T.mipmaps,V=T.isVideoTexture!==!0,Pe=Ge.__version===void 0||de===!0,pe=ne.dataReady,ke=I(T,fe);if(T.isDepthTexture)Qe=y(T.format===ls,T.type),Pe&&(V?t.texStorage2D(r.TEXTURE_2D,1,Qe,fe.width,fe.height):t.texImage2D(r.TEXTURE_2D,0,Qe,fe.width,fe.height,0,Oe,tt,null));else if(T.isDataTexture)if(at.length>0){V&&Pe&&t.texStorage2D(r.TEXTURE_2D,ke,Qe,at[0].width,at[0].height);for(let ve=0,he=at.length;ve<he;ve++)we=at[ve],V?pe&&t.texSubImage2D(r.TEXTURE_2D,ve,0,0,we.width,we.height,Oe,tt,we.data):t.texImage2D(r.TEXTURE_2D,ve,Qe,we.width,we.height,0,Oe,tt,we.data);T.generateMipmaps=!1}else V?(Pe&&t.texStorage2D(r.TEXTURE_2D,ke,Qe,fe.width,fe.height),pe&&te(T,fe,Oe,tt)):t.texImage2D(r.TEXTURE_2D,0,Qe,fe.width,fe.height,0,Oe,tt,fe.data);else if(T.isCompressedTexture)if(T.isCompressedArrayTexture){V&&Pe&&t.texStorage3D(r.TEXTURE_2D_ARRAY,ke,Qe,at[0].width,at[0].height,fe.depth);for(let ve=0,he=at.length;ve<he;ve++)if(we=at[ve],T.format!==In)if(Oe!==null)if(V){if(pe)if(T.layerUpdates.size>0){const He=$c(we.width,we.height,T.format,T.type);for(const me of T.layerUpdates){const mt=we.data.subarray(me*He/we.data.BYTES_PER_ELEMENT,(me+1)*He/we.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,ve,0,0,me,we.width,we.height,1,Oe,mt)}T.clearLayerUpdates()}else t.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,ve,0,0,0,we.width,we.height,fe.depth,Oe,we.data)}else t.compressedTexImage3D(r.TEXTURE_2D_ARRAY,ve,Qe,we.width,we.height,fe.depth,0,we.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else V?pe&&t.texSubImage3D(r.TEXTURE_2D_ARRAY,ve,0,0,0,we.width,we.height,fe.depth,Oe,tt,we.data):t.texImage3D(r.TEXTURE_2D_ARRAY,ve,Qe,we.width,we.height,fe.depth,0,Oe,tt,we.data)}else{V&&Pe&&t.texStorage2D(r.TEXTURE_2D,ke,Qe,at[0].width,at[0].height);for(let ve=0,he=at.length;ve<he;ve++)we=at[ve],T.format!==In?Oe!==null?V?pe&&t.compressedTexSubImage2D(r.TEXTURE_2D,ve,0,0,we.width,we.height,Oe,we.data):t.compressedTexImage2D(r.TEXTURE_2D,ve,Qe,we.width,we.height,0,we.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):V?pe&&t.texSubImage2D(r.TEXTURE_2D,ve,0,0,we.width,we.height,Oe,tt,we.data):t.texImage2D(r.TEXTURE_2D,ve,Qe,we.width,we.height,0,Oe,tt,we.data)}else if(T.isDataArrayTexture)if(V){if(Pe&&t.texStorage3D(r.TEXTURE_2D_ARRAY,ke,Qe,fe.width,fe.height,fe.depth),pe)if(T.layerUpdates.size>0){const ve=$c(fe.width,fe.height,T.format,T.type);for(const he of T.layerUpdates){const He=fe.data.subarray(he*ve/fe.data.BYTES_PER_ELEMENT,(he+1)*ve/fe.data.BYTES_PER_ELEMENT);t.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,he,fe.width,fe.height,1,Oe,tt,He)}T.clearLayerUpdates()}else t.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,0,fe.width,fe.height,fe.depth,Oe,tt,fe.data)}else t.texImage3D(r.TEXTURE_2D_ARRAY,0,Qe,fe.width,fe.height,fe.depth,0,Oe,tt,fe.data);else if(T.isData3DTexture)V?(Pe&&t.texStorage3D(r.TEXTURE_3D,ke,Qe,fe.width,fe.height,fe.depth),pe&&t.texSubImage3D(r.TEXTURE_3D,0,0,0,0,fe.width,fe.height,fe.depth,Oe,tt,fe.data)):t.texImage3D(r.TEXTURE_3D,0,Qe,fe.width,fe.height,fe.depth,0,Oe,tt,fe.data);else if(T.isFramebufferTexture){if(Pe)if(V)t.texStorage2D(r.TEXTURE_2D,ke,Qe,fe.width,fe.height);else{let ve=fe.width,he=fe.height;for(let He=0;He<ke;He++)t.texImage2D(r.TEXTURE_2D,He,Qe,ve,he,0,Oe,tt,null),ve>>=1,he>>=1}}else if(at.length>0){if(V&&Pe){const ve=pt(at[0]);t.texStorage2D(r.TEXTURE_2D,ke,Qe,ve.width,ve.height)}for(let ve=0,he=at.length;ve<he;ve++)we=at[ve],V?pe&&t.texSubImage2D(r.TEXTURE_2D,ve,0,0,Oe,tt,we):t.texImage2D(r.TEXTURE_2D,ve,Qe,Oe,tt,we);T.generateMipmaps=!1}else if(V){if(Pe){const ve=pt(fe);t.texStorage2D(r.TEXTURE_2D,ke,Qe,ve.width,ve.height)}pe&&t.texSubImage2D(r.TEXTURE_2D,0,0,0,Oe,tt,fe)}else t.texImage2D(r.TEXTURE_2D,0,Qe,Oe,tt,fe);g(T)&&p(ce),Ge.__version=ne.version,T.onUpdate&&T.onUpdate(T)}F.__version=T.version}function le(F,T,Y){if(T.image.length!==6)return;const ce=Ee(F,T),de=T.source;t.bindTexture(r.TEXTURE_CUBE_MAP,F.__webglTexture,r.TEXTURE0+Y);const ne=n.get(de);if(de.version!==ne.__version||ce===!0){t.activeTexture(r.TEXTURE0+Y);const Ge=vt.getPrimaries(vt.workingColorSpace),Se=T.colorSpace===wi?null:vt.getPrimaries(T.colorSpace),Fe=T.colorSpace===wi||Ge===Se?r.NONE:r.BROWSER_DEFAULT_WEBGL;r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,T.flipY),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,T.premultiplyAlpha),r.pixelStorei(r.UNPACK_ALIGNMENT,T.unpackAlignment),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,Fe);const je=T.isCompressedTexture||T.image[0].isCompressedTexture,fe=T.image[0]&&T.image[0].isDataTexture,Oe=[];for(let he=0;he<6;he++)!je&&!fe?Oe[he]=_(T.image[he],!0,i.maxCubemapSize):Oe[he]=fe?T.image[he].image:T.image[he],Oe[he]=Re(T,Oe[he]);const tt=Oe[0],Qe=s.convert(T.format,T.colorSpace),we=s.convert(T.type),at=E(T.internalFormat,Qe,we,T.colorSpace),V=T.isVideoTexture!==!0,Pe=ne.__version===void 0||ce===!0,pe=de.dataReady;let ke=I(T,tt);xe(r.TEXTURE_CUBE_MAP,T);let ve;if(je){V&&Pe&&t.texStorage2D(r.TEXTURE_CUBE_MAP,ke,at,tt.width,tt.height);for(let he=0;he<6;he++){ve=Oe[he].mipmaps;for(let He=0;He<ve.length;He++){const me=ve[He];T.format!==In?Qe!==null?V?pe&&t.compressedTexSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+he,He,0,0,me.width,me.height,Qe,me.data):t.compressedTexImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+he,He,at,me.width,me.height,0,me.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):V?pe&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+he,He,0,0,me.width,me.height,Qe,we,me.data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+he,He,at,me.width,me.height,0,Qe,we,me.data)}}}else{if(ve=T.mipmaps,V&&Pe){ve.length>0&&ke++;const he=pt(Oe[0]);t.texStorage2D(r.TEXTURE_CUBE_MAP,ke,at,he.width,he.height)}for(let he=0;he<6;he++)if(fe){V?pe&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+he,0,0,0,Oe[he].width,Oe[he].height,Qe,we,Oe[he].data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+he,0,at,Oe[he].width,Oe[he].height,0,Qe,we,Oe[he].data);for(let He=0;He<ve.length;He++){const mt=ve[He].image[he].image;V?pe&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+he,He+1,0,0,mt.width,mt.height,Qe,we,mt.data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+he,He+1,at,mt.width,mt.height,0,Qe,we,mt.data)}}else{V?pe&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+he,0,0,0,Qe,we,Oe[he]):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+he,0,at,Qe,we,Oe[he]);for(let He=0;He<ve.length;He++){const me=ve[He];V?pe&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+he,He+1,0,0,Qe,we,me.image[he]):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+he,He+1,at,Qe,we,me.image[he])}}}g(T)&&p(r.TEXTURE_CUBE_MAP),ne.__version=de.version,T.onUpdate&&T.onUpdate(T)}F.__version=T.version}function be(F,T,Y,ce,de,ne){const Ge=s.convert(Y.format,Y.colorSpace),Se=s.convert(Y.type),Fe=E(Y.internalFormat,Ge,Se,Y.colorSpace),je=n.get(T),fe=n.get(Y);if(fe.__renderTarget=T,!je.__hasExternalTextures){const Oe=Math.max(1,T.width>>ne),tt=Math.max(1,T.height>>ne);de===r.TEXTURE_3D||de===r.TEXTURE_2D_ARRAY?t.texImage3D(de,ne,Fe,Oe,tt,T.depth,0,Ge,Se,null):t.texImage2D(de,ne,Fe,Oe,tt,0,Ge,Se,null)}t.bindFramebuffer(r.FRAMEBUFFER,F),Be(T)?o.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,ce,de,fe.__webglTexture,0,Q(T)):(de===r.TEXTURE_2D||de>=r.TEXTURE_CUBE_MAP_POSITIVE_X&&de<=r.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&r.framebufferTexture2D(r.FRAMEBUFFER,ce,de,fe.__webglTexture,ne),t.bindFramebuffer(r.FRAMEBUFFER,null)}function st(F,T,Y){if(r.bindRenderbuffer(r.RENDERBUFFER,F),T.depthBuffer){const ce=T.depthTexture,de=ce&&ce.isDepthTexture?ce.type:null,ne=y(T.stencilBuffer,de),Ge=T.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,Se=Q(T);Be(T)?o.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,Se,ne,T.width,T.height):Y?r.renderbufferStorageMultisample(r.RENDERBUFFER,Se,ne,T.width,T.height):r.renderbufferStorage(r.RENDERBUFFER,ne,T.width,T.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,Ge,r.RENDERBUFFER,F)}else{const ce=T.textures;for(let de=0;de<ce.length;de++){const ne=ce[de],Ge=s.convert(ne.format,ne.colorSpace),Se=s.convert(ne.type),Fe=E(ne.internalFormat,Ge,Se,ne.colorSpace),je=Q(T);Y&&Be(T)===!1?r.renderbufferStorageMultisample(r.RENDERBUFFER,je,Fe,T.width,T.height):Be(T)?o.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,je,Fe,T.width,T.height):r.renderbufferStorage(r.RENDERBUFFER,Fe,T.width,T.height)}}r.bindRenderbuffer(r.RENDERBUFFER,null)}function Ke(F,T){if(T&&T.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(r.FRAMEBUFFER,F),!(T.depthTexture&&T.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const ce=n.get(T.depthTexture);ce.__renderTarget=T,(!ce.__webglTexture||T.depthTexture.image.width!==T.width||T.depthTexture.image.height!==T.height)&&(T.depthTexture.image.width=T.width,T.depthTexture.image.height=T.height,T.depthTexture.needsUpdate=!0),j(T.depthTexture,0);const de=ce.__webglTexture,ne=Q(T);if(T.depthTexture.format===os)Be(T)?o.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.TEXTURE_2D,de,0,ne):r.framebufferTexture2D(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.TEXTURE_2D,de,0);else if(T.depthTexture.format===ls)Be(T)?o.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.TEXTURE_2D,de,0,ne):r.framebufferTexture2D(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.TEXTURE_2D,de,0);else throw new Error("Unknown depthTexture format")}function Ct(F){const T=n.get(F),Y=F.isWebGLCubeRenderTarget===!0;if(T.__boundDepthTexture!==F.depthTexture){const ce=F.depthTexture;if(T.__depthDisposeCallback&&T.__depthDisposeCallback(),ce){const de=()=>{delete T.__boundDepthTexture,delete T.__depthDisposeCallback,ce.removeEventListener("dispose",de)};ce.addEventListener("dispose",de),T.__depthDisposeCallback=de}T.__boundDepthTexture=ce}if(F.depthTexture&&!T.__autoAllocateDepthBuffer){if(Y)throw new Error("target.depthTexture not supported in Cube render targets");const ce=F.texture.mipmaps;ce&&ce.length>0?Ke(T.__webglFramebuffer[0],F):Ke(T.__webglFramebuffer,F)}else if(Y){T.__webglDepthbuffer=[];for(let ce=0;ce<6;ce++)if(t.bindFramebuffer(r.FRAMEBUFFER,T.__webglFramebuffer[ce]),T.__webglDepthbuffer[ce]===void 0)T.__webglDepthbuffer[ce]=r.createRenderbuffer(),st(T.__webglDepthbuffer[ce],F,!1);else{const de=F.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,ne=T.__webglDepthbuffer[ce];r.bindRenderbuffer(r.RENDERBUFFER,ne),r.framebufferRenderbuffer(r.FRAMEBUFFER,de,r.RENDERBUFFER,ne)}}else{const ce=F.texture.mipmaps;if(ce&&ce.length>0?t.bindFramebuffer(r.FRAMEBUFFER,T.__webglFramebuffer[0]):t.bindFramebuffer(r.FRAMEBUFFER,T.__webglFramebuffer),T.__webglDepthbuffer===void 0)T.__webglDepthbuffer=r.createRenderbuffer(),st(T.__webglDepthbuffer,F,!1);else{const de=F.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,ne=T.__webglDepthbuffer;r.bindRenderbuffer(r.RENDERBUFFER,ne),r.framebufferRenderbuffer(r.FRAMEBUFFER,de,r.RENDERBUFFER,ne)}}t.bindFramebuffer(r.FRAMEBUFFER,null)}function ae(F,T,Y){const ce=n.get(F);T!==void 0&&be(ce.__webglFramebuffer,F,F.texture,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,0),Y!==void 0&&Ct(F)}function _e(F){const T=F.texture,Y=n.get(F),ce=n.get(T);F.addEventListener("dispose",C);const de=F.textures,ne=F.isWebGLCubeRenderTarget===!0,Ge=de.length>1;if(Ge||(ce.__webglTexture===void 0&&(ce.__webglTexture=r.createTexture()),ce.__version=T.version,a.memory.textures++),ne){Y.__webglFramebuffer=[];for(let Se=0;Se<6;Se++)if(T.mipmaps&&T.mipmaps.length>0){Y.__webglFramebuffer[Se]=[];for(let Fe=0;Fe<T.mipmaps.length;Fe++)Y.__webglFramebuffer[Se][Fe]=r.createFramebuffer()}else Y.__webglFramebuffer[Se]=r.createFramebuffer()}else{if(T.mipmaps&&T.mipmaps.length>0){Y.__webglFramebuffer=[];for(let Se=0;Se<T.mipmaps.length;Se++)Y.__webglFramebuffer[Se]=r.createFramebuffer()}else Y.__webglFramebuffer=r.createFramebuffer();if(Ge)for(let Se=0,Fe=de.length;Se<Fe;Se++){const je=n.get(de[Se]);je.__webglTexture===void 0&&(je.__webglTexture=r.createTexture(),a.memory.textures++)}if(F.samples>0&&Be(F)===!1){Y.__webglMultisampledFramebuffer=r.createFramebuffer(),Y.__webglColorRenderbuffer=[],t.bindFramebuffer(r.FRAMEBUFFER,Y.__webglMultisampledFramebuffer);for(let Se=0;Se<de.length;Se++){const Fe=de[Se];Y.__webglColorRenderbuffer[Se]=r.createRenderbuffer(),r.bindRenderbuffer(r.RENDERBUFFER,Y.__webglColorRenderbuffer[Se]);const je=s.convert(Fe.format,Fe.colorSpace),fe=s.convert(Fe.type),Oe=E(Fe.internalFormat,je,fe,Fe.colorSpace,F.isXRRenderTarget===!0),tt=Q(F);r.renderbufferStorageMultisample(r.RENDERBUFFER,tt,Oe,F.width,F.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+Se,r.RENDERBUFFER,Y.__webglColorRenderbuffer[Se])}r.bindRenderbuffer(r.RENDERBUFFER,null),F.depthBuffer&&(Y.__webglDepthRenderbuffer=r.createRenderbuffer(),st(Y.__webglDepthRenderbuffer,F,!0)),t.bindFramebuffer(r.FRAMEBUFFER,null)}}if(ne){t.bindTexture(r.TEXTURE_CUBE_MAP,ce.__webglTexture),xe(r.TEXTURE_CUBE_MAP,T);for(let Se=0;Se<6;Se++)if(T.mipmaps&&T.mipmaps.length>0)for(let Fe=0;Fe<T.mipmaps.length;Fe++)be(Y.__webglFramebuffer[Se][Fe],F,T,r.COLOR_ATTACHMENT0,r.TEXTURE_CUBE_MAP_POSITIVE_X+Se,Fe);else be(Y.__webglFramebuffer[Se],F,T,r.COLOR_ATTACHMENT0,r.TEXTURE_CUBE_MAP_POSITIVE_X+Se,0);g(T)&&p(r.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(Ge){for(let Se=0,Fe=de.length;Se<Fe;Se++){const je=de[Se],fe=n.get(je);t.bindTexture(r.TEXTURE_2D,fe.__webglTexture),xe(r.TEXTURE_2D,je),be(Y.__webglFramebuffer,F,je,r.COLOR_ATTACHMENT0+Se,r.TEXTURE_2D,0),g(je)&&p(r.TEXTURE_2D)}t.unbindTexture()}else{let Se=r.TEXTURE_2D;if((F.isWebGL3DRenderTarget||F.isWebGLArrayRenderTarget)&&(Se=F.isWebGL3DRenderTarget?r.TEXTURE_3D:r.TEXTURE_2D_ARRAY),t.bindTexture(Se,ce.__webglTexture),xe(Se,T),T.mipmaps&&T.mipmaps.length>0)for(let Fe=0;Fe<T.mipmaps.length;Fe++)be(Y.__webglFramebuffer[Fe],F,T,r.COLOR_ATTACHMENT0,Se,Fe);else be(Y.__webglFramebuffer,F,T,r.COLOR_ATTACHMENT0,Se,0);g(T)&&p(Se),t.unbindTexture()}F.depthBuffer&&Ct(F)}function N(F){const T=F.textures;for(let Y=0,ce=T.length;Y<ce;Y++){const de=T[Y];if(g(de)){const ne=M(F),Ge=n.get(de).__webglTexture;t.bindTexture(ne,Ge),p(ne),t.unbindTexture()}}}const We=[],Me=[];function Te(F){if(F.samples>0){if(Be(F)===!1){const T=F.textures,Y=F.width,ce=F.height;let de=r.COLOR_BUFFER_BIT;const ne=F.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,Ge=n.get(F),Se=T.length>1;if(Se)for(let je=0;je<T.length;je++)t.bindFramebuffer(r.FRAMEBUFFER,Ge.__webglMultisampledFramebuffer),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+je,r.RENDERBUFFER,null),t.bindFramebuffer(r.FRAMEBUFFER,Ge.__webglFramebuffer),r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0+je,r.TEXTURE_2D,null,0);t.bindFramebuffer(r.READ_FRAMEBUFFER,Ge.__webglMultisampledFramebuffer);const Fe=F.texture.mipmaps;Fe&&Fe.length>0?t.bindFramebuffer(r.DRAW_FRAMEBUFFER,Ge.__webglFramebuffer[0]):t.bindFramebuffer(r.DRAW_FRAMEBUFFER,Ge.__webglFramebuffer);for(let je=0;je<T.length;je++){if(F.resolveDepthBuffer&&(F.depthBuffer&&(de|=r.DEPTH_BUFFER_BIT),F.stencilBuffer&&F.resolveStencilBuffer&&(de|=r.STENCIL_BUFFER_BIT)),Se){r.framebufferRenderbuffer(r.READ_FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.RENDERBUFFER,Ge.__webglColorRenderbuffer[je]);const fe=n.get(T[je]).__webglTexture;r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,fe,0)}r.blitFramebuffer(0,0,Y,ce,0,0,Y,ce,de,r.NEAREST),l===!0&&(We.length=0,Me.length=0,We.push(r.COLOR_ATTACHMENT0+je),F.depthBuffer&&F.resolveDepthBuffer===!1&&(We.push(ne),Me.push(ne),r.invalidateFramebuffer(r.DRAW_FRAMEBUFFER,Me)),r.invalidateFramebuffer(r.READ_FRAMEBUFFER,We))}if(t.bindFramebuffer(r.READ_FRAMEBUFFER,null),t.bindFramebuffer(r.DRAW_FRAMEBUFFER,null),Se)for(let je=0;je<T.length;je++){t.bindFramebuffer(r.FRAMEBUFFER,Ge.__webglMultisampledFramebuffer),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+je,r.RENDERBUFFER,Ge.__webglColorRenderbuffer[je]);const fe=n.get(T[je]).__webglTexture;t.bindFramebuffer(r.FRAMEBUFFER,Ge.__webglFramebuffer),r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0+je,r.TEXTURE_2D,fe,0)}t.bindFramebuffer(r.DRAW_FRAMEBUFFER,Ge.__webglMultisampledFramebuffer)}else if(F.depthBuffer&&F.resolveDepthBuffer===!1&&l){const T=F.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT;r.invalidateFramebuffer(r.DRAW_FRAMEBUFFER,[T])}}}function Q(F){return Math.min(i.maxSamples,F.samples)}function Be(F){const T=n.get(F);return F.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&T.__useRenderToTexture!==!1}function Ie(F){const T=a.render.frame;u.get(F)!==T&&(u.set(F,T),F.update())}function Re(F,T){const Y=F.colorSpace,ce=F.format,de=F.type;return F.isCompressedTexture===!0||F.isVideoTexture===!0||Y!==Ur&&Y!==wi&&(vt.getTransfer(Y)===It?(ce!==In||de!==Jn)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",Y)),T}function pt(F){return typeof HTMLImageElement<"u"&&F instanceof HTMLImageElement?(c.width=F.naturalWidth||F.width,c.height=F.naturalHeight||F.height):typeof VideoFrame<"u"&&F instanceof VideoFrame?(c.width=F.displayWidth,c.height=F.displayHeight):(c.width=F.width,c.height=F.height),c}this.allocateTextureUnit=z,this.resetTextureUnits=B,this.setTexture2D=j,this.setTexture2DArray=O,this.setTexture3D=K,this.setTextureCube=H,this.rebindTextures=ae,this.setupRenderTarget=_e,this.updateRenderTargetMipmap=N,this.updateMultisampleRenderTarget=Te,this.setupDepthRenderbuffer=Ct,this.setupFrameBufferTexture=be,this.useMultisampledRTT=Be}function bv(r,e){function t(n,i=wi){let s;const a=vt.getTransfer(i);if(n===Jn)return r.UNSIGNED_BYTE;if(n===Ml)return r.UNSIGNED_SHORT_4_4_4_4;if(n===bl)return r.UNSIGNED_SHORT_5_5_5_1;if(n===th)return r.UNSIGNED_INT_5_9_9_9_REV;if(n===Qu)return r.BYTE;if(n===eh)return r.SHORT;if(n===ss)return r.UNSIGNED_SHORT;if(n===Sl)return r.INT;if(n===$i)return r.UNSIGNED_INT;if(n===Yn)return r.FLOAT;if(n===hs)return r.HALF_FLOAT;if(n===nh)return r.ALPHA;if(n===ih)return r.RGB;if(n===In)return r.RGBA;if(n===os)return r.DEPTH_COMPONENT;if(n===ls)return r.DEPTH_STENCIL;if(n===rh)return r.RED;if(n===El)return r.RED_INTEGER;if(n===sh)return r.RG;if(n===Tl)return r.RG_INTEGER;if(n===wl)return r.RGBA_INTEGER;if(n===na||n===ia||n===ra||n===sa)if(a===It)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(n===na)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===ia)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===ra)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===sa)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(n===na)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===ia)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===ra)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===sa)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===Uo||n===Io||n===No||n===Fo)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(n===Uo)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===Io)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===No)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===Fo)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===Oo||n===Bo||n===ko)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(n===Oo||n===Bo)return a===It?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(n===ko)return a===It?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(n===zo||n===Vo||n===Ho||n===Go||n===Wo||n===Xo||n===qo||n===jo||n===Yo||n===Ko||n===$o||n===Jo||n===Zo||n===Qo)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(n===zo)return a===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===Vo)return a===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===Ho)return a===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===Go)return a===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===Wo)return a===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===Xo)return a===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===qo)return a===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===jo)return a===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===Yo)return a===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===Ko)return a===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===$o)return a===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===Jo)return a===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===Zo)return a===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===Qo)return a===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===aa||n===el||n===tl)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(n===aa)return a===It?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===el)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===tl)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===ah||n===nl||n===il||n===rl)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(n===aa)return s.COMPRESSED_RED_RGTC1_EXT;if(n===nl)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===il)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===rl)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===as?r.UNSIGNED_INT_24_8:r[n]!==void 0?r[n]:null}return{convert:t}}const Ev=`
|
|
3803
|
+
}`;function vv(r,e,t){let n=new Nl;const i=new dt,s=new dt,a=new St,o=new bp({depthPacking:gf}),l=new Ep,c={},u=t.maxTextureSize,h={[$n]:_n,[_n]:$n,[hn]:hn},d=new gi({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new dt},radius:{value:4}},vertexShader:gv,fragmentShader:_v}),f=d.clone();f.defines.HORIZONTAL_PASS=1;const m=new Vt;m.setAttribute("position",new Xt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const _=new Ut(m,d),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Ku;let p=this.type;this.render=function(R,C,L){if(g.enabled===!1||g.autoUpdate===!1&&g.needsUpdate===!1||R.length===0)return;const b=r.getRenderTarget(),x=r.getActiveCubeFace(),w=r.getActiveMipmapLevel(),B=r.state;B.setBlending(Ai),B.buffers.color.setClear(1,1,1,1),B.buffers.depth.setTest(!0),B.setScissorTest(!1);const z=p!==ui&&this.type===ui,X=p===ui&&this.type!==ui;for(let j=0,O=R.length;j<O;j++){const K=R[j],H=K.shadow;if(H===void 0){console.warn("THREE.WebGLShadowMap:",K,"has no shadow.");continue}if(H.autoUpdate===!1&&H.needsUpdate===!1)continue;i.copy(H.mapSize);const re=H.getFrameExtents();if(i.multiply(re),s.copy(H.mapSize),(i.x>u||i.y>u)&&(i.x>u&&(s.x=Math.floor(u/re.x),i.x=s.x*re.x,H.mapSize.x=s.x),i.y>u&&(s.y=Math.floor(u/re.y),i.y=s.y*re.y,H.mapSize.y=s.y)),H.map===null||z===!0||X===!0){const $=this.type!==ui?{minFilter:Rn,magFilter:Rn}:{};H.map!==null&&H.map.dispose(),H.map=new Ji(i.x,i.y,$),H.map.texture.name=K.name+".shadowMap",H.camera.updateProjectionMatrix()}r.setRenderTarget(H.map),r.clear();const oe=H.getViewportCount();for(let $=0;$<oe;$++){const xe=H.getViewport($);a.set(s.x*xe.x,s.y*xe.y,s.x*xe.z,s.y*xe.w),B.viewport(a),H.updateMatrices(K,$),n=H.getFrustum(),y(C,L,H.camera,K,this.type)}H.isPointLightShadow!==!0&&this.type===ui&&M(H,L),H.needsUpdate=!1}p=this.type,g.needsUpdate=!1,r.setRenderTarget(b,x,w)};function M(R,C){const L=e.update(_);d.defines.VSM_SAMPLES!==R.blurSamples&&(d.defines.VSM_SAMPLES=R.blurSamples,f.defines.VSM_SAMPLES=R.blurSamples,d.needsUpdate=!0,f.needsUpdate=!0),R.mapPass===null&&(R.mapPass=new Ji(i.x,i.y)),d.uniforms.shadow_pass.value=R.map.texture,d.uniforms.resolution.value=R.mapSize,d.uniforms.radius.value=R.radius,r.setRenderTarget(R.mapPass),r.clear(),r.renderBufferDirect(C,null,L,d,_,null),f.uniforms.shadow_pass.value=R.mapPass.texture,f.uniforms.resolution.value=R.mapSize,f.uniforms.radius.value=R.radius,r.setRenderTarget(R.map),r.clear(),r.renderBufferDirect(C,null,L,f,_,null)}function E(R,C,L,b){let x=null;const w=L.isPointLight===!0?R.customDistanceMaterial:R.customDepthMaterial;if(w!==void 0)x=w;else if(x=L.isPointLight===!0?l:o,r.localClippingEnabled&&C.clipShadows===!0&&Array.isArray(C.clippingPlanes)&&C.clippingPlanes.length!==0||C.displacementMap&&C.displacementScale!==0||C.alphaMap&&C.alphaTest>0||C.map&&C.alphaTest>0||C.alphaToCoverage===!0){const B=x.uuid,z=C.uuid;let X=c[B];X===void 0&&(X={},c[B]=X);let j=X[z];j===void 0&&(j=x.clone(),X[z]=j,C.addEventListener("dispose",I)),x=j}if(x.visible=C.visible,x.wireframe=C.wireframe,b===ui?x.side=C.shadowSide!==null?C.shadowSide:C.side:x.side=C.shadowSide!==null?C.shadowSide:h[C.side],x.alphaMap=C.alphaMap,x.alphaTest=C.alphaToCoverage===!0?.5:C.alphaTest,x.map=C.map,x.clipShadows=C.clipShadows,x.clippingPlanes=C.clippingPlanes,x.clipIntersection=C.clipIntersection,x.displacementMap=C.displacementMap,x.displacementScale=C.displacementScale,x.displacementBias=C.displacementBias,x.wireframeLinewidth=C.wireframeLinewidth,x.linewidth=C.linewidth,L.isPointLight===!0&&x.isMeshDistanceMaterial===!0){const B=r.properties.get(x);B.light=L}return x}function y(R,C,L,b,x){if(R.visible===!1)return;if(R.layers.test(C.layers)&&(R.isMesh||R.isLine||R.isPoints)&&(R.castShadow||R.receiveShadow&&x===ui)&&(!R.frustumCulled||n.intersectsObject(R))){R.modelViewMatrix.multiplyMatrices(L.matrixWorldInverse,R.matrixWorld);const z=e.update(R),X=R.material;if(Array.isArray(X)){const j=z.groups;for(let O=0,K=j.length;O<K;O++){const H=j[O],re=X[H.materialIndex];if(re&&re.visible){const oe=E(R,re,b,x);R.onBeforeShadow(r,R,C,L,z,oe,H),r.renderBufferDirect(L,null,z,oe,R,H),R.onAfterShadow(r,R,C,L,z,oe,H)}}}else if(X.visible){const j=E(R,X,b,x);R.onBeforeShadow(r,R,C,L,z,j,null),r.renderBufferDirect(L,null,z,j,R,null),R.onAfterShadow(r,R,C,L,z,j,null)}}const B=R.children;for(let z=0,X=B.length;z<X;z++)y(B[z],C,L,b,x)}function I(R){R.target.removeEventListener("dispose",I);for(const L in c){const b=c[L],x=R.target.uuid;x in b&&(b[x].dispose(),delete b[x])}}}const yv={[bo]:Eo,[To]:Ro,[wo]:Co,[Pr]:Ao,[Eo]:bo,[Ro]:To,[Co]:wo,[Ao]:Pr};function xv(r,e){function t(){let V=!1;const Pe=new St;let pe=null;const ke=new St(0,0,0,0);return{setMask:function(ve){pe!==ve&&!V&&(r.colorMask(ve,ve,ve,ve),pe=ve)},setLocked:function(ve){V=ve},setClear:function(ve,he,He,me,mt){mt===!0&&(ve*=me,he*=me,He*=me),Pe.set(ve,he,He,me),ke.equals(Pe)===!1&&(r.clearColor(ve,he,He,me),ke.copy(Pe))},reset:function(){V=!1,pe=null,ke.set(-1,0,0,0)}}}function n(){let V=!1,Pe=!1,pe=null,ke=null,ve=null;return{setReversed:function(he){if(Pe!==he){const He=e.get("EXT_clip_control");he?He.clipControlEXT(He.LOWER_LEFT_EXT,He.ZERO_TO_ONE_EXT):He.clipControlEXT(He.LOWER_LEFT_EXT,He.NEGATIVE_ONE_TO_ONE_EXT),Pe=he;const me=ve;ve=null,this.setClear(me)}},getReversed:function(){return Pe},setTest:function(he){he?le(r.DEPTH_TEST):be(r.DEPTH_TEST)},setMask:function(he){pe!==he&&!V&&(r.depthMask(he),pe=he)},setFunc:function(he){if(Pe&&(he=yv[he]),ke!==he){switch(he){case bo:r.depthFunc(r.NEVER);break;case Eo:r.depthFunc(r.ALWAYS);break;case To:r.depthFunc(r.LESS);break;case Pr:r.depthFunc(r.LEQUAL);break;case wo:r.depthFunc(r.EQUAL);break;case Ao:r.depthFunc(r.GEQUAL);break;case Ro:r.depthFunc(r.GREATER);break;case Co:r.depthFunc(r.NOTEQUAL);break;default:r.depthFunc(r.LEQUAL)}ke=he}},setLocked:function(he){V=he},setClear:function(he){ve!==he&&(Pe&&(he=1-he),r.clearDepth(he),ve=he)},reset:function(){V=!1,pe=null,ke=null,ve=null,Pe=!1}}}function i(){let V=!1,Pe=null,pe=null,ke=null,ve=null,he=null,He=null,me=null,mt=null;return{setTest:function(Ze){V||(Ze?le(r.STENCIL_TEST):be(r.STENCIL_TEST))},setMask:function(Ze){Pe!==Ze&&!V&&(r.stencilMask(Ze),Pe=Ze)},setFunc:function(Ze,Ht,En){(pe!==Ze||ke!==Ht||ve!==En)&&(r.stencilFunc(Ze,Ht,En),pe=Ze,ke=Ht,ve=En)},setOp:function(Ze,Ht,En){(he!==Ze||He!==Ht||me!==En)&&(r.stencilOp(Ze,Ht,En),he=Ze,He=Ht,me=En)},setLocked:function(Ze){V=Ze},setClear:function(Ze){mt!==Ze&&(r.clearStencil(Ze),mt=Ze)},reset:function(){V=!1,Pe=null,pe=null,ke=null,ve=null,he=null,He=null,me=null,mt=null}}}const s=new t,a=new n,o=new i,l=new WeakMap,c=new WeakMap;let u={},h={},d=new WeakMap,f=[],m=null,_=!1,g=null,p=null,M=null,E=null,y=null,I=null,R=null,C=new ht(0,0,0),L=0,b=!1,x=null,w=null,B=null,z=null,X=null;const j=r.getParameter(r.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let O=!1,K=0;const H=r.getParameter(r.VERSION);H.indexOf("WebGL")!==-1?(K=parseFloat(/^WebGL (\d)/.exec(H)[1]),O=K>=1):H.indexOf("OpenGL ES")!==-1&&(K=parseFloat(/^OpenGL ES (\d)/.exec(H)[1]),O=K>=2);let re=null,oe={};const $=r.getParameter(r.SCISSOR_BOX),xe=r.getParameter(r.VIEWPORT),Ee=new St().fromArray($),q=new St().fromArray(xe);function te(V,Pe,pe,ke){const ve=new Uint8Array(4),he=r.createTexture();r.bindTexture(V,he),r.texParameteri(V,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(V,r.TEXTURE_MAG_FILTER,r.NEAREST);for(let He=0;He<pe;He++)V===r.TEXTURE_3D||V===r.TEXTURE_2D_ARRAY?r.texImage3D(Pe,0,r.RGBA,1,1,ke,0,r.RGBA,r.UNSIGNED_BYTE,ve):r.texImage2D(Pe+He,0,r.RGBA,1,1,0,r.RGBA,r.UNSIGNED_BYTE,ve);return he}const se={};se[r.TEXTURE_2D]=te(r.TEXTURE_2D,r.TEXTURE_2D,1),se[r.TEXTURE_CUBE_MAP]=te(r.TEXTURE_CUBE_MAP,r.TEXTURE_CUBE_MAP_POSITIVE_X,6),se[r.TEXTURE_2D_ARRAY]=te(r.TEXTURE_2D_ARRAY,r.TEXTURE_2D_ARRAY,1,1),se[r.TEXTURE_3D]=te(r.TEXTURE_3D,r.TEXTURE_3D,1,1),s.setClear(0,0,0,1),a.setClear(1),o.setClear(0),le(r.DEPTH_TEST),a.setFunc(Pr),Me(!1),Te(Zl),le(r.CULL_FACE),N(Ai);function le(V){u[V]!==!0&&(r.enable(V),u[V]=!0)}function be(V){u[V]!==!1&&(r.disable(V),u[V]=!1)}function st(V,Pe){return h[V]!==Pe?(r.bindFramebuffer(V,Pe),h[V]=Pe,V===r.DRAW_FRAMEBUFFER&&(h[r.FRAMEBUFFER]=Pe),V===r.FRAMEBUFFER&&(h[r.DRAW_FRAMEBUFFER]=Pe),!0):!1}function Ke(V,Pe){let pe=f,ke=!1;if(V){pe=d.get(Pe),pe===void 0&&(pe=[],d.set(Pe,pe));const ve=V.textures;if(pe.length!==ve.length||pe[0]!==r.COLOR_ATTACHMENT0){for(let he=0,He=ve.length;he<He;he++)pe[he]=r.COLOR_ATTACHMENT0+he;pe.length=ve.length,ke=!0}}else pe[0]!==r.BACK&&(pe[0]=r.BACK,ke=!0);ke&&r.drawBuffers(pe)}function Ct(V){return m!==V?(r.useProgram(V),m=V,!0):!1}const ae={[Gi]:r.FUNC_ADD,[zd]:r.FUNC_SUBTRACT,[Vd]:r.FUNC_REVERSE_SUBTRACT};ae[Hd]=r.MIN,ae[Gd]=r.MAX;const _e={[Wd]:r.ZERO,[Xd]:r.ONE,[qd]:r.SRC_COLOR,[So]:r.SRC_ALPHA,[Zd]:r.SRC_ALPHA_SATURATE,[$d]:r.DST_COLOR,[Yd]:r.DST_ALPHA,[jd]:r.ONE_MINUS_SRC_COLOR,[Mo]:r.ONE_MINUS_SRC_ALPHA,[Jd]:r.ONE_MINUS_DST_COLOR,[Kd]:r.ONE_MINUS_DST_ALPHA,[Qd]:r.CONSTANT_COLOR,[ef]:r.ONE_MINUS_CONSTANT_COLOR,[tf]:r.CONSTANT_ALPHA,[nf]:r.ONE_MINUS_CONSTANT_ALPHA};function N(V,Pe,pe,ke,ve,he,He,me,mt,Ze){if(V===Ai){_===!0&&(be(r.BLEND),_=!1);return}if(_===!1&&(le(r.BLEND),_=!0),V!==kd){if(V!==g||Ze!==b){if((p!==Gi||y!==Gi)&&(r.blendEquation(r.FUNC_ADD),p=Gi,y=Gi),Ze)switch(V){case Ar:r.blendFuncSeparate(r.ONE,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA);break;case Ql:r.blendFunc(r.ONE,r.ONE);break;case ec:r.blendFuncSeparate(r.ZERO,r.ONE_MINUS_SRC_COLOR,r.ZERO,r.ONE);break;case tc:r.blendFuncSeparate(r.ZERO,r.SRC_COLOR,r.ZERO,r.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",V);break}else switch(V){case Ar:r.blendFuncSeparate(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA);break;case Ql:r.blendFunc(r.SRC_ALPHA,r.ONE);break;case ec:r.blendFuncSeparate(r.ZERO,r.ONE_MINUS_SRC_COLOR,r.ZERO,r.ONE);break;case tc:r.blendFunc(r.ZERO,r.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",V);break}M=null,E=null,I=null,R=null,C.set(0,0,0),L=0,g=V,b=Ze}return}ve=ve||Pe,he=he||pe,He=He||ke,(Pe!==p||ve!==y)&&(r.blendEquationSeparate(ae[Pe],ae[ve]),p=Pe,y=ve),(pe!==M||ke!==E||he!==I||He!==R)&&(r.blendFuncSeparate(_e[pe],_e[ke],_e[he],_e[He]),M=pe,E=ke,I=he,R=He),(me.equals(C)===!1||mt!==L)&&(r.blendColor(me.r,me.g,me.b,mt),C.copy(me),L=mt),g=V,b=!1}function We(V,Pe){V.side===hn?be(r.CULL_FACE):le(r.CULL_FACE);let pe=V.side===_n;Pe&&(pe=!pe),Me(pe),V.blending===Ar&&V.transparent===!1?N(Ai):N(V.blending,V.blendEquation,V.blendSrc,V.blendDst,V.blendEquationAlpha,V.blendSrcAlpha,V.blendDstAlpha,V.blendColor,V.blendAlpha,V.premultipliedAlpha),a.setFunc(V.depthFunc),a.setTest(V.depthTest),a.setMask(V.depthWrite),s.setMask(V.colorWrite);const ke=V.stencilWrite;o.setTest(ke),ke&&(o.setMask(V.stencilWriteMask),o.setFunc(V.stencilFunc,V.stencilRef,V.stencilFuncMask),o.setOp(V.stencilFail,V.stencilZFail,V.stencilZPass)),Be(V.polygonOffset,V.polygonOffsetFactor,V.polygonOffsetUnits),V.alphaToCoverage===!0?le(r.SAMPLE_ALPHA_TO_COVERAGE):be(r.SAMPLE_ALPHA_TO_COVERAGE)}function Me(V){x!==V&&(V?r.frontFace(r.CW):r.frontFace(r.CCW),x=V)}function Te(V){V!==Od?(le(r.CULL_FACE),V!==w&&(V===Zl?r.cullFace(r.BACK):V===Bd?r.cullFace(r.FRONT):r.cullFace(r.FRONT_AND_BACK))):be(r.CULL_FACE),w=V}function Q(V){V!==B&&(O&&r.lineWidth(V),B=V)}function Be(V,Pe,pe){V?(le(r.POLYGON_OFFSET_FILL),(z!==Pe||X!==pe)&&(r.polygonOffset(Pe,pe),z=Pe,X=pe)):be(r.POLYGON_OFFSET_FILL)}function Ie(V){V?le(r.SCISSOR_TEST):be(r.SCISSOR_TEST)}function Re(V){V===void 0&&(V=r.TEXTURE0+j-1),re!==V&&(r.activeTexture(V),re=V)}function pt(V,Pe,pe){pe===void 0&&(re===null?pe=r.TEXTURE0+j-1:pe=re);let ke=oe[pe];ke===void 0&&(ke={type:void 0,texture:void 0},oe[pe]=ke),(ke.type!==V||ke.texture!==Pe)&&(re!==pe&&(r.activeTexture(pe),re=pe),r.bindTexture(V,Pe||se[V]),ke.type=V,ke.texture=Pe)}function F(){const V=oe[re];V!==void 0&&V.type!==void 0&&(r.bindTexture(V.type,null),V.type=void 0,V.texture=void 0)}function T(){try{r.compressedTexImage2D(...arguments)}catch(V){console.error("THREE.WebGLState:",V)}}function Y(){try{r.compressedTexImage3D(...arguments)}catch(V){console.error("THREE.WebGLState:",V)}}function ce(){try{r.texSubImage2D(...arguments)}catch(V){console.error("THREE.WebGLState:",V)}}function de(){try{r.texSubImage3D(...arguments)}catch(V){console.error("THREE.WebGLState:",V)}}function ne(){try{r.compressedTexSubImage2D(...arguments)}catch(V){console.error("THREE.WebGLState:",V)}}function Ge(){try{r.compressedTexSubImage3D(...arguments)}catch(V){console.error("THREE.WebGLState:",V)}}function Se(){try{r.texStorage2D(...arguments)}catch(V){console.error("THREE.WebGLState:",V)}}function Fe(){try{r.texStorage3D(...arguments)}catch(V){console.error("THREE.WebGLState:",V)}}function je(){try{r.texImage2D(...arguments)}catch(V){console.error("THREE.WebGLState:",V)}}function fe(){try{r.texImage3D(...arguments)}catch(V){console.error("THREE.WebGLState:",V)}}function Oe(V){Ee.equals(V)===!1&&(r.scissor(V.x,V.y,V.z,V.w),Ee.copy(V))}function tt(V){q.equals(V)===!1&&(r.viewport(V.x,V.y,V.z,V.w),q.copy(V))}function Qe(V,Pe){let pe=c.get(Pe);pe===void 0&&(pe=new WeakMap,c.set(Pe,pe));let ke=pe.get(V);ke===void 0&&(ke=r.getUniformBlockIndex(Pe,V.name),pe.set(V,ke))}function we(V,Pe){const ke=c.get(Pe).get(V);l.get(Pe)!==ke&&(r.uniformBlockBinding(Pe,ke,V.__bindingPointIndex),l.set(Pe,ke))}function at(){r.disable(r.BLEND),r.disable(r.CULL_FACE),r.disable(r.DEPTH_TEST),r.disable(r.POLYGON_OFFSET_FILL),r.disable(r.SCISSOR_TEST),r.disable(r.STENCIL_TEST),r.disable(r.SAMPLE_ALPHA_TO_COVERAGE),r.blendEquation(r.FUNC_ADD),r.blendFunc(r.ONE,r.ZERO),r.blendFuncSeparate(r.ONE,r.ZERO,r.ONE,r.ZERO),r.blendColor(0,0,0,0),r.colorMask(!0,!0,!0,!0),r.clearColor(0,0,0,0),r.depthMask(!0),r.depthFunc(r.LESS),a.setReversed(!1),r.clearDepth(1),r.stencilMask(4294967295),r.stencilFunc(r.ALWAYS,0,4294967295),r.stencilOp(r.KEEP,r.KEEP,r.KEEP),r.clearStencil(0),r.cullFace(r.BACK),r.frontFace(r.CCW),r.polygonOffset(0,0),r.activeTexture(r.TEXTURE0),r.bindFramebuffer(r.FRAMEBUFFER,null),r.bindFramebuffer(r.DRAW_FRAMEBUFFER,null),r.bindFramebuffer(r.READ_FRAMEBUFFER,null),r.useProgram(null),r.lineWidth(1),r.scissor(0,0,r.canvas.width,r.canvas.height),r.viewport(0,0,r.canvas.width,r.canvas.height),u={},re=null,oe={},h={},d=new WeakMap,f=[],m=null,_=!1,g=null,p=null,M=null,E=null,y=null,I=null,R=null,C=new ht(0,0,0),L=0,b=!1,x=null,w=null,B=null,z=null,X=null,Ee.set(0,0,r.canvas.width,r.canvas.height),q.set(0,0,r.canvas.width,r.canvas.height),s.reset(),a.reset(),o.reset()}return{buffers:{color:s,depth:a,stencil:o},enable:le,disable:be,bindFramebuffer:st,drawBuffers:Ke,useProgram:Ct,setBlending:N,setMaterial:We,setFlipSided:Me,setCullFace:Te,setLineWidth:Q,setPolygonOffset:Be,setScissorTest:Ie,activeTexture:Re,bindTexture:pt,unbindTexture:F,compressedTexImage2D:T,compressedTexImage3D:Y,texImage2D:je,texImage3D:fe,updateUBOMapping:Qe,uniformBlockBinding:we,texStorage2D:Se,texStorage3D:Fe,texSubImage2D:ce,texSubImage3D:de,compressedTexSubImage2D:ne,compressedTexSubImage3D:Ge,scissor:Oe,viewport:tt,reset:at}}function Sv(r,e,t,n,i,s,a){const o=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,l=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new dt,u=new WeakMap;let h;const d=new WeakMap;let f=!1;try{f=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function m(F,T){return f?new OffscreenCanvas(F,T):cs("canvas")}function _(F,T,Y){let ce=1;const de=pt(F);if((de.width>Y||de.height>Y)&&(ce=Y/Math.max(de.width,de.height)),ce<1)if(typeof HTMLImageElement<"u"&&F instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&F instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&F instanceof ImageBitmap||typeof VideoFrame<"u"&&F instanceof VideoFrame){const ne=Math.floor(ce*de.width),Ge=Math.floor(ce*de.height);h===void 0&&(h=m(ne,Ge));const Se=T?m(ne,Ge):h;return Se.width=ne,Se.height=Ge,Se.getContext("2d").drawImage(F,0,0,ne,Ge),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+de.width+"x"+de.height+") to ("+ne+"x"+Ge+")."),Se}else return"data"in F&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+de.width+"x"+de.height+")."),F;return F}function g(F){return F.generateMipmaps}function p(F){r.generateMipmap(F)}function M(F){return F.isWebGLCubeRenderTarget?r.TEXTURE_CUBE_MAP:F.isWebGL3DRenderTarget?r.TEXTURE_3D:F.isWebGLArrayRenderTarget||F.isCompressedArrayTexture?r.TEXTURE_2D_ARRAY:r.TEXTURE_2D}function E(F,T,Y,ce,de=!1){if(F!==null){if(r[F]!==void 0)return r[F];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+F+"'")}let ne=T;if(T===r.RED&&(Y===r.FLOAT&&(ne=r.R32F),Y===r.HALF_FLOAT&&(ne=r.R16F),Y===r.UNSIGNED_BYTE&&(ne=r.R8)),T===r.RED_INTEGER&&(Y===r.UNSIGNED_BYTE&&(ne=r.R8UI),Y===r.UNSIGNED_SHORT&&(ne=r.R16UI),Y===r.UNSIGNED_INT&&(ne=r.R32UI),Y===r.BYTE&&(ne=r.R8I),Y===r.SHORT&&(ne=r.R16I),Y===r.INT&&(ne=r.R32I)),T===r.RG&&(Y===r.FLOAT&&(ne=r.RG32F),Y===r.HALF_FLOAT&&(ne=r.RG16F),Y===r.UNSIGNED_BYTE&&(ne=r.RG8)),T===r.RG_INTEGER&&(Y===r.UNSIGNED_BYTE&&(ne=r.RG8UI),Y===r.UNSIGNED_SHORT&&(ne=r.RG16UI),Y===r.UNSIGNED_INT&&(ne=r.RG32UI),Y===r.BYTE&&(ne=r.RG8I),Y===r.SHORT&&(ne=r.RG16I),Y===r.INT&&(ne=r.RG32I)),T===r.RGB_INTEGER&&(Y===r.UNSIGNED_BYTE&&(ne=r.RGB8UI),Y===r.UNSIGNED_SHORT&&(ne=r.RGB16UI),Y===r.UNSIGNED_INT&&(ne=r.RGB32UI),Y===r.BYTE&&(ne=r.RGB8I),Y===r.SHORT&&(ne=r.RGB16I),Y===r.INT&&(ne=r.RGB32I)),T===r.RGBA_INTEGER&&(Y===r.UNSIGNED_BYTE&&(ne=r.RGBA8UI),Y===r.UNSIGNED_SHORT&&(ne=r.RGBA16UI),Y===r.UNSIGNED_INT&&(ne=r.RGBA32UI),Y===r.BYTE&&(ne=r.RGBA8I),Y===r.SHORT&&(ne=r.RGBA16I),Y===r.INT&&(ne=r.RGBA32I)),T===r.RGB&&Y===r.UNSIGNED_INT_5_9_9_9_REV&&(ne=r.RGB9_E5),T===r.RGBA){const Ge=de?pa:vt.getTransfer(ce);Y===r.FLOAT&&(ne=r.RGBA32F),Y===r.HALF_FLOAT&&(ne=r.RGBA16F),Y===r.UNSIGNED_BYTE&&(ne=Ge===It?r.SRGB8_ALPHA8:r.RGBA8),Y===r.UNSIGNED_SHORT_4_4_4_4&&(ne=r.RGBA4),Y===r.UNSIGNED_SHORT_5_5_5_1&&(ne=r.RGB5_A1)}return(ne===r.R16F||ne===r.R32F||ne===r.RG16F||ne===r.RG32F||ne===r.RGBA16F||ne===r.RGBA32F)&&e.get("EXT_color_buffer_float"),ne}function y(F,T){let Y;return F?T===null||T===$i||T===as?Y=r.DEPTH24_STENCIL8:T===Yn?Y=r.DEPTH32F_STENCIL8:T===ss&&(Y=r.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):T===null||T===$i||T===as?Y=r.DEPTH_COMPONENT24:T===Yn?Y=r.DEPTH_COMPONENT32F:T===ss&&(Y=r.DEPTH_COMPONENT16),Y}function I(F,T){return g(F)===!0||F.isFramebufferTexture&&F.minFilter!==Rn&&F.minFilter!==An?Math.log2(Math.max(T.width,T.height))+1:F.mipmaps!==void 0&&F.mipmaps.length>0?F.mipmaps.length:F.isCompressedTexture&&Array.isArray(F.image)?T.mipmaps.length:1}function R(F){const T=F.target;T.removeEventListener("dispose",R),L(T),T.isVideoTexture&&u.delete(T)}function C(F){const T=F.target;T.removeEventListener("dispose",C),x(T)}function L(F){const T=n.get(F);if(T.__webglInit===void 0)return;const Y=F.source,ce=d.get(Y);if(ce){const de=ce[T.__cacheKey];de.usedTimes--,de.usedTimes===0&&b(F),Object.keys(ce).length===0&&d.delete(Y)}n.remove(F)}function b(F){const T=n.get(F);r.deleteTexture(T.__webglTexture);const Y=F.source,ce=d.get(Y);delete ce[T.__cacheKey],a.memory.textures--}function x(F){const T=n.get(F);if(F.depthTexture&&(F.depthTexture.dispose(),n.remove(F.depthTexture)),F.isWebGLCubeRenderTarget)for(let ce=0;ce<6;ce++){if(Array.isArray(T.__webglFramebuffer[ce]))for(let de=0;de<T.__webglFramebuffer[ce].length;de++)r.deleteFramebuffer(T.__webglFramebuffer[ce][de]);else r.deleteFramebuffer(T.__webglFramebuffer[ce]);T.__webglDepthbuffer&&r.deleteRenderbuffer(T.__webglDepthbuffer[ce])}else{if(Array.isArray(T.__webglFramebuffer))for(let ce=0;ce<T.__webglFramebuffer.length;ce++)r.deleteFramebuffer(T.__webglFramebuffer[ce]);else r.deleteFramebuffer(T.__webglFramebuffer);if(T.__webglDepthbuffer&&r.deleteRenderbuffer(T.__webglDepthbuffer),T.__webglMultisampledFramebuffer&&r.deleteFramebuffer(T.__webglMultisampledFramebuffer),T.__webglColorRenderbuffer)for(let ce=0;ce<T.__webglColorRenderbuffer.length;ce++)T.__webglColorRenderbuffer[ce]&&r.deleteRenderbuffer(T.__webglColorRenderbuffer[ce]);T.__webglDepthRenderbuffer&&r.deleteRenderbuffer(T.__webglDepthRenderbuffer)}const Y=F.textures;for(let ce=0,de=Y.length;ce<de;ce++){const ne=n.get(Y[ce]);ne.__webglTexture&&(r.deleteTexture(ne.__webglTexture),a.memory.textures--),n.remove(Y[ce])}n.remove(F)}let w=0;function B(){w=0}function z(){const F=w;return F>=i.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+F+" texture units while this GPU supports only "+i.maxTextures),w+=1,F}function X(F){const T=[];return T.push(F.wrapS),T.push(F.wrapT),T.push(F.wrapR||0),T.push(F.magFilter),T.push(F.minFilter),T.push(F.anisotropy),T.push(F.internalFormat),T.push(F.format),T.push(F.type),T.push(F.generateMipmaps),T.push(F.premultiplyAlpha),T.push(F.flipY),T.push(F.unpackAlignment),T.push(F.colorSpace),T.join()}function j(F,T){const Y=n.get(F);if(F.isVideoTexture&&Ie(F),F.isRenderTargetTexture===!1&&F.version>0&&Y.__version!==F.version){const ce=F.image;if(ce===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(ce.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{se(Y,F,T);return}}t.bindTexture(r.TEXTURE_2D,Y.__webglTexture,r.TEXTURE0+T)}function O(F,T){const Y=n.get(F);if(F.version>0&&Y.__version!==F.version){se(Y,F,T);return}t.bindTexture(r.TEXTURE_2D_ARRAY,Y.__webglTexture,r.TEXTURE0+T)}function K(F,T){const Y=n.get(F);if(F.version>0&&Y.__version!==F.version){se(Y,F,T);return}t.bindTexture(r.TEXTURE_3D,Y.__webglTexture,r.TEXTURE0+T)}function H(F,T){const Y=n.get(F);if(F.version>0&&Y.__version!==F.version){le(Y,F,T);return}t.bindTexture(r.TEXTURE_CUBE_MAP,Y.__webglTexture,r.TEXTURE0+T)}const re={[jn]:r.REPEAT,[kn]:r.CLAMP_TO_EDGE,[Lo]:r.MIRRORED_REPEAT},oe={[Rn]:r.NEAREST,[ff]:r.NEAREST_MIPMAP_NEAREST,[_s]:r.NEAREST_MIPMAP_LINEAR,[An]:r.LINEAR,[Ca]:r.LINEAR_MIPMAP_NEAREST,[hi]:r.LINEAR_MIPMAP_LINEAR},$={[vf]:r.NEVER,[Ef]:r.ALWAYS,[yf]:r.LESS,[oh]:r.LEQUAL,[xf]:r.EQUAL,[bf]:r.GEQUAL,[Sf]:r.GREATER,[Mf]:r.NOTEQUAL};function xe(F,T){if(T.type===Yn&&e.has("OES_texture_float_linear")===!1&&(T.magFilter===An||T.magFilter===Ca||T.magFilter===_s||T.magFilter===hi||T.minFilter===An||T.minFilter===Ca||T.minFilter===_s||T.minFilter===hi)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),r.texParameteri(F,r.TEXTURE_WRAP_S,re[T.wrapS]),r.texParameteri(F,r.TEXTURE_WRAP_T,re[T.wrapT]),(F===r.TEXTURE_3D||F===r.TEXTURE_2D_ARRAY)&&r.texParameteri(F,r.TEXTURE_WRAP_R,re[T.wrapR]),r.texParameteri(F,r.TEXTURE_MAG_FILTER,oe[T.magFilter]),r.texParameteri(F,r.TEXTURE_MIN_FILTER,oe[T.minFilter]),T.compareFunction&&(r.texParameteri(F,r.TEXTURE_COMPARE_MODE,r.COMPARE_REF_TO_TEXTURE),r.texParameteri(F,r.TEXTURE_COMPARE_FUNC,$[T.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(T.magFilter===Rn||T.minFilter!==_s&&T.minFilter!==hi||T.type===Yn&&e.has("OES_texture_float_linear")===!1)return;if(T.anisotropy>1||n.get(T).__currentAnisotropy){const Y=e.get("EXT_texture_filter_anisotropic");r.texParameterf(F,Y.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(T.anisotropy,i.getMaxAnisotropy())),n.get(T).__currentAnisotropy=T.anisotropy}}}function Ee(F,T){let Y=!1;F.__webglInit===void 0&&(F.__webglInit=!0,T.addEventListener("dispose",R));const ce=T.source;let de=d.get(ce);de===void 0&&(de={},d.set(ce,de));const ne=X(T);if(ne!==F.__cacheKey){de[ne]===void 0&&(de[ne]={texture:r.createTexture(),usedTimes:0},a.memory.textures++,Y=!0),de[ne].usedTimes++;const Ge=de[F.__cacheKey];Ge!==void 0&&(de[F.__cacheKey].usedTimes--,Ge.usedTimes===0&&b(T)),F.__cacheKey=ne,F.__webglTexture=de[ne].texture}return Y}function q(F,T,Y){return Math.floor(Math.floor(F/Y)/T)}function te(F,T,Y,ce){const ne=F.updateRanges;if(ne.length===0)t.texSubImage2D(r.TEXTURE_2D,0,0,0,T.width,T.height,Y,ce,T.data);else{ne.sort((fe,Oe)=>fe.start-Oe.start);let Ge=0;for(let fe=1;fe<ne.length;fe++){const Oe=ne[Ge],tt=ne[fe],Qe=Oe.start+Oe.count,we=q(tt.start,T.width,4),at=q(Oe.start,T.width,4);tt.start<=Qe+1&&we===at&&q(tt.start+tt.count-1,T.width,4)===we?Oe.count=Math.max(Oe.count,tt.start+tt.count-Oe.start):(++Ge,ne[Ge]=tt)}ne.length=Ge+1;const Se=r.getParameter(r.UNPACK_ROW_LENGTH),Fe=r.getParameter(r.UNPACK_SKIP_PIXELS),je=r.getParameter(r.UNPACK_SKIP_ROWS);r.pixelStorei(r.UNPACK_ROW_LENGTH,T.width);for(let fe=0,Oe=ne.length;fe<Oe;fe++){const tt=ne[fe],Qe=Math.floor(tt.start/4),we=Math.ceil(tt.count/4),at=Qe%T.width,V=Math.floor(Qe/T.width),Pe=we,pe=1;r.pixelStorei(r.UNPACK_SKIP_PIXELS,at),r.pixelStorei(r.UNPACK_SKIP_ROWS,V),t.texSubImage2D(r.TEXTURE_2D,0,at,V,Pe,pe,Y,ce,T.data)}F.clearUpdateRanges(),r.pixelStorei(r.UNPACK_ROW_LENGTH,Se),r.pixelStorei(r.UNPACK_SKIP_PIXELS,Fe),r.pixelStorei(r.UNPACK_SKIP_ROWS,je)}}function se(F,T,Y){let ce=r.TEXTURE_2D;(T.isDataArrayTexture||T.isCompressedArrayTexture)&&(ce=r.TEXTURE_2D_ARRAY),T.isData3DTexture&&(ce=r.TEXTURE_3D);const de=Ee(F,T),ne=T.source;t.bindTexture(ce,F.__webglTexture,r.TEXTURE0+Y);const Ge=n.get(ne);if(ne.version!==Ge.__version||de===!0){t.activeTexture(r.TEXTURE0+Y);const Se=vt.getPrimaries(vt.workingColorSpace),Fe=T.colorSpace===wi?null:vt.getPrimaries(T.colorSpace),je=T.colorSpace===wi||Se===Fe?r.NONE:r.BROWSER_DEFAULT_WEBGL;r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,T.flipY),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,T.premultiplyAlpha),r.pixelStorei(r.UNPACK_ALIGNMENT,T.unpackAlignment),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,je);let fe=_(T.image,!1,i.maxTextureSize);fe=Re(T,fe);const Oe=s.convert(T.format,T.colorSpace),tt=s.convert(T.type);let Qe=E(T.internalFormat,Oe,tt,T.colorSpace,T.isVideoTexture);xe(ce,T);let we;const at=T.mipmaps,V=T.isVideoTexture!==!0,Pe=Ge.__version===void 0||de===!0,pe=ne.dataReady,ke=I(T,fe);if(T.isDepthTexture)Qe=y(T.format===ls,T.type),Pe&&(V?t.texStorage2D(r.TEXTURE_2D,1,Qe,fe.width,fe.height):t.texImage2D(r.TEXTURE_2D,0,Qe,fe.width,fe.height,0,Oe,tt,null));else if(T.isDataTexture)if(at.length>0){V&&Pe&&t.texStorage2D(r.TEXTURE_2D,ke,Qe,at[0].width,at[0].height);for(let ve=0,he=at.length;ve<he;ve++)we=at[ve],V?pe&&t.texSubImage2D(r.TEXTURE_2D,ve,0,0,we.width,we.height,Oe,tt,we.data):t.texImage2D(r.TEXTURE_2D,ve,Qe,we.width,we.height,0,Oe,tt,we.data);T.generateMipmaps=!1}else V?(Pe&&t.texStorage2D(r.TEXTURE_2D,ke,Qe,fe.width,fe.height),pe&&te(T,fe,Oe,tt)):t.texImage2D(r.TEXTURE_2D,0,Qe,fe.width,fe.height,0,Oe,tt,fe.data);else if(T.isCompressedTexture)if(T.isCompressedArrayTexture){V&&Pe&&t.texStorage3D(r.TEXTURE_2D_ARRAY,ke,Qe,at[0].width,at[0].height,fe.depth);for(let ve=0,he=at.length;ve<he;ve++)if(we=at[ve],T.format!==In)if(Oe!==null)if(V){if(pe)if(T.layerUpdates.size>0){const He=$c(we.width,we.height,T.format,T.type);for(const me of T.layerUpdates){const mt=we.data.subarray(me*He/we.data.BYTES_PER_ELEMENT,(me+1)*He/we.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,ve,0,0,me,we.width,we.height,1,Oe,mt)}T.clearLayerUpdates()}else t.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,ve,0,0,0,we.width,we.height,fe.depth,Oe,we.data)}else t.compressedTexImage3D(r.TEXTURE_2D_ARRAY,ve,Qe,we.width,we.height,fe.depth,0,we.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else V?pe&&t.texSubImage3D(r.TEXTURE_2D_ARRAY,ve,0,0,0,we.width,we.height,fe.depth,Oe,tt,we.data):t.texImage3D(r.TEXTURE_2D_ARRAY,ve,Qe,we.width,we.height,fe.depth,0,Oe,tt,we.data)}else{V&&Pe&&t.texStorage2D(r.TEXTURE_2D,ke,Qe,at[0].width,at[0].height);for(let ve=0,he=at.length;ve<he;ve++)we=at[ve],T.format!==In?Oe!==null?V?pe&&t.compressedTexSubImage2D(r.TEXTURE_2D,ve,0,0,we.width,we.height,Oe,we.data):t.compressedTexImage2D(r.TEXTURE_2D,ve,Qe,we.width,we.height,0,we.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):V?pe&&t.texSubImage2D(r.TEXTURE_2D,ve,0,0,we.width,we.height,Oe,tt,we.data):t.texImage2D(r.TEXTURE_2D,ve,Qe,we.width,we.height,0,Oe,tt,we.data)}else if(T.isDataArrayTexture)if(V){if(Pe&&t.texStorage3D(r.TEXTURE_2D_ARRAY,ke,Qe,fe.width,fe.height,fe.depth),pe)if(T.layerUpdates.size>0){const ve=$c(fe.width,fe.height,T.format,T.type);for(const he of T.layerUpdates){const He=fe.data.subarray(he*ve/fe.data.BYTES_PER_ELEMENT,(he+1)*ve/fe.data.BYTES_PER_ELEMENT);t.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,he,fe.width,fe.height,1,Oe,tt,He)}T.clearLayerUpdates()}else t.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,0,fe.width,fe.height,fe.depth,Oe,tt,fe.data)}else t.texImage3D(r.TEXTURE_2D_ARRAY,0,Qe,fe.width,fe.height,fe.depth,0,Oe,tt,fe.data);else if(T.isData3DTexture)V?(Pe&&t.texStorage3D(r.TEXTURE_3D,ke,Qe,fe.width,fe.height,fe.depth),pe&&t.texSubImage3D(r.TEXTURE_3D,0,0,0,0,fe.width,fe.height,fe.depth,Oe,tt,fe.data)):t.texImage3D(r.TEXTURE_3D,0,Qe,fe.width,fe.height,fe.depth,0,Oe,tt,fe.data);else if(T.isFramebufferTexture){if(Pe)if(V)t.texStorage2D(r.TEXTURE_2D,ke,Qe,fe.width,fe.height);else{let ve=fe.width,he=fe.height;for(let He=0;He<ke;He++)t.texImage2D(r.TEXTURE_2D,He,Qe,ve,he,0,Oe,tt,null),ve>>=1,he>>=1}}else if(at.length>0){if(V&&Pe){const ve=pt(at[0]);t.texStorage2D(r.TEXTURE_2D,ke,Qe,ve.width,ve.height)}for(let ve=0,he=at.length;ve<he;ve++)we=at[ve],V?pe&&t.texSubImage2D(r.TEXTURE_2D,ve,0,0,Oe,tt,we):t.texImage2D(r.TEXTURE_2D,ve,Qe,Oe,tt,we);T.generateMipmaps=!1}else if(V){if(Pe){const ve=pt(fe);t.texStorage2D(r.TEXTURE_2D,ke,Qe,ve.width,ve.height)}pe&&t.texSubImage2D(r.TEXTURE_2D,0,0,0,Oe,tt,fe)}else t.texImage2D(r.TEXTURE_2D,0,Qe,Oe,tt,fe);g(T)&&p(ce),Ge.__version=ne.version,T.onUpdate&&T.onUpdate(T)}F.__version=T.version}function le(F,T,Y){if(T.image.length!==6)return;const ce=Ee(F,T),de=T.source;t.bindTexture(r.TEXTURE_CUBE_MAP,F.__webglTexture,r.TEXTURE0+Y);const ne=n.get(de);if(de.version!==ne.__version||ce===!0){t.activeTexture(r.TEXTURE0+Y);const Ge=vt.getPrimaries(vt.workingColorSpace),Se=T.colorSpace===wi?null:vt.getPrimaries(T.colorSpace),Fe=T.colorSpace===wi||Ge===Se?r.NONE:r.BROWSER_DEFAULT_WEBGL;r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,T.flipY),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,T.premultiplyAlpha),r.pixelStorei(r.UNPACK_ALIGNMENT,T.unpackAlignment),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,Fe);const je=T.isCompressedTexture||T.image[0].isCompressedTexture,fe=T.image[0]&&T.image[0].isDataTexture,Oe=[];for(let he=0;he<6;he++)!je&&!fe?Oe[he]=_(T.image[he],!0,i.maxCubemapSize):Oe[he]=fe?T.image[he].image:T.image[he],Oe[he]=Re(T,Oe[he]);const tt=Oe[0],Qe=s.convert(T.format,T.colorSpace),we=s.convert(T.type),at=E(T.internalFormat,Qe,we,T.colorSpace),V=T.isVideoTexture!==!0,Pe=ne.__version===void 0||ce===!0,pe=de.dataReady;let ke=I(T,tt);xe(r.TEXTURE_CUBE_MAP,T);let ve;if(je){V&&Pe&&t.texStorage2D(r.TEXTURE_CUBE_MAP,ke,at,tt.width,tt.height);for(let he=0;he<6;he++){ve=Oe[he].mipmaps;for(let He=0;He<ve.length;He++){const me=ve[He];T.format!==In?Qe!==null?V?pe&&t.compressedTexSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+he,He,0,0,me.width,me.height,Qe,me.data):t.compressedTexImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+he,He,at,me.width,me.height,0,me.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):V?pe&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+he,He,0,0,me.width,me.height,Qe,we,me.data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+he,He,at,me.width,me.height,0,Qe,we,me.data)}}}else{if(ve=T.mipmaps,V&&Pe){ve.length>0&&ke++;const he=pt(Oe[0]);t.texStorage2D(r.TEXTURE_CUBE_MAP,ke,at,he.width,he.height)}for(let he=0;he<6;he++)if(fe){V?pe&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+he,0,0,0,Oe[he].width,Oe[he].height,Qe,we,Oe[he].data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+he,0,at,Oe[he].width,Oe[he].height,0,Qe,we,Oe[he].data);for(let He=0;He<ve.length;He++){const mt=ve[He].image[he].image;V?pe&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+he,He+1,0,0,mt.width,mt.height,Qe,we,mt.data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+he,He+1,at,mt.width,mt.height,0,Qe,we,mt.data)}}else{V?pe&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+he,0,0,0,Qe,we,Oe[he]):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+he,0,at,Qe,we,Oe[he]);for(let He=0;He<ve.length;He++){const me=ve[He];V?pe&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+he,He+1,0,0,Qe,we,me.image[he]):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+he,He+1,at,Qe,we,me.image[he])}}}g(T)&&p(r.TEXTURE_CUBE_MAP),ne.__version=de.version,T.onUpdate&&T.onUpdate(T)}F.__version=T.version}function be(F,T,Y,ce,de,ne){const Ge=s.convert(Y.format,Y.colorSpace),Se=s.convert(Y.type),Fe=E(Y.internalFormat,Ge,Se,Y.colorSpace),je=n.get(T),fe=n.get(Y);if(fe.__renderTarget=T,!je.__hasExternalTextures){const Oe=Math.max(1,T.width>>ne),tt=Math.max(1,T.height>>ne);de===r.TEXTURE_3D||de===r.TEXTURE_2D_ARRAY?t.texImage3D(de,ne,Fe,Oe,tt,T.depth,0,Ge,Se,null):t.texImage2D(de,ne,Fe,Oe,tt,0,Ge,Se,null)}t.bindFramebuffer(r.FRAMEBUFFER,F),Be(T)?o.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,ce,de,fe.__webglTexture,0,Q(T)):(de===r.TEXTURE_2D||de>=r.TEXTURE_CUBE_MAP_POSITIVE_X&&de<=r.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&r.framebufferTexture2D(r.FRAMEBUFFER,ce,de,fe.__webglTexture,ne),t.bindFramebuffer(r.FRAMEBUFFER,null)}function st(F,T,Y){if(r.bindRenderbuffer(r.RENDERBUFFER,F),T.depthBuffer){const ce=T.depthTexture,de=ce&&ce.isDepthTexture?ce.type:null,ne=y(T.stencilBuffer,de),Ge=T.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,Se=Q(T);Be(T)?o.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,Se,ne,T.width,T.height):Y?r.renderbufferStorageMultisample(r.RENDERBUFFER,Se,ne,T.width,T.height):r.renderbufferStorage(r.RENDERBUFFER,ne,T.width,T.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,Ge,r.RENDERBUFFER,F)}else{const ce=T.textures;for(let de=0;de<ce.length;de++){const ne=ce[de],Ge=s.convert(ne.format,ne.colorSpace),Se=s.convert(ne.type),Fe=E(ne.internalFormat,Ge,Se,ne.colorSpace),je=Q(T);Y&&Be(T)===!1?r.renderbufferStorageMultisample(r.RENDERBUFFER,je,Fe,T.width,T.height):Be(T)?o.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,je,Fe,T.width,T.height):r.renderbufferStorage(r.RENDERBUFFER,Fe,T.width,T.height)}}r.bindRenderbuffer(r.RENDERBUFFER,null)}function Ke(F,T){if(T&&T.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(r.FRAMEBUFFER,F),!(T.depthTexture&&T.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const ce=n.get(T.depthTexture);ce.__renderTarget=T,(!ce.__webglTexture||T.depthTexture.image.width!==T.width||T.depthTexture.image.height!==T.height)&&(T.depthTexture.image.width=T.width,T.depthTexture.image.height=T.height,T.depthTexture.needsUpdate=!0),j(T.depthTexture,0);const de=ce.__webglTexture,ne=Q(T);if(T.depthTexture.format===os)Be(T)?o.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.TEXTURE_2D,de,0,ne):r.framebufferTexture2D(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.TEXTURE_2D,de,0);else if(T.depthTexture.format===ls)Be(T)?o.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.TEXTURE_2D,de,0,ne):r.framebufferTexture2D(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.TEXTURE_2D,de,0);else throw new Error("Unknown depthTexture format")}function Ct(F){const T=n.get(F),Y=F.isWebGLCubeRenderTarget===!0;if(T.__boundDepthTexture!==F.depthTexture){const ce=F.depthTexture;if(T.__depthDisposeCallback&&T.__depthDisposeCallback(),ce){const de=()=>{delete T.__boundDepthTexture,delete T.__depthDisposeCallback,ce.removeEventListener("dispose",de)};ce.addEventListener("dispose",de),T.__depthDisposeCallback=de}T.__boundDepthTexture=ce}if(F.depthTexture&&!T.__autoAllocateDepthBuffer){if(Y)throw new Error("target.depthTexture not supported in Cube render targets");const ce=F.texture.mipmaps;ce&&ce.length>0?Ke(T.__webglFramebuffer[0],F):Ke(T.__webglFramebuffer,F)}else if(Y){T.__webglDepthbuffer=[];for(let ce=0;ce<6;ce++)if(t.bindFramebuffer(r.FRAMEBUFFER,T.__webglFramebuffer[ce]),T.__webglDepthbuffer[ce]===void 0)T.__webglDepthbuffer[ce]=r.createRenderbuffer(),st(T.__webglDepthbuffer[ce],F,!1);else{const de=F.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,ne=T.__webglDepthbuffer[ce];r.bindRenderbuffer(r.RENDERBUFFER,ne),r.framebufferRenderbuffer(r.FRAMEBUFFER,de,r.RENDERBUFFER,ne)}}else{const ce=F.texture.mipmaps;if(ce&&ce.length>0?t.bindFramebuffer(r.FRAMEBUFFER,T.__webglFramebuffer[0]):t.bindFramebuffer(r.FRAMEBUFFER,T.__webglFramebuffer),T.__webglDepthbuffer===void 0)T.__webglDepthbuffer=r.createRenderbuffer(),st(T.__webglDepthbuffer,F,!1);else{const de=F.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,ne=T.__webglDepthbuffer;r.bindRenderbuffer(r.RENDERBUFFER,ne),r.framebufferRenderbuffer(r.FRAMEBUFFER,de,r.RENDERBUFFER,ne)}}t.bindFramebuffer(r.FRAMEBUFFER,null)}function ae(F,T,Y){const ce=n.get(F);T!==void 0&&be(ce.__webglFramebuffer,F,F.texture,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,0),Y!==void 0&&Ct(F)}function _e(F){const T=F.texture,Y=n.get(F),ce=n.get(T);F.addEventListener("dispose",C);const de=F.textures,ne=F.isWebGLCubeRenderTarget===!0,Ge=de.length>1;if(Ge||(ce.__webglTexture===void 0&&(ce.__webglTexture=r.createTexture()),ce.__version=T.version,a.memory.textures++),ne){Y.__webglFramebuffer=[];for(let Se=0;Se<6;Se++)if(T.mipmaps&&T.mipmaps.length>0){Y.__webglFramebuffer[Se]=[];for(let Fe=0;Fe<T.mipmaps.length;Fe++)Y.__webglFramebuffer[Se][Fe]=r.createFramebuffer()}else Y.__webglFramebuffer[Se]=r.createFramebuffer()}else{if(T.mipmaps&&T.mipmaps.length>0){Y.__webglFramebuffer=[];for(let Se=0;Se<T.mipmaps.length;Se++)Y.__webglFramebuffer[Se]=r.createFramebuffer()}else Y.__webglFramebuffer=r.createFramebuffer();if(Ge)for(let Se=0,Fe=de.length;Se<Fe;Se++){const je=n.get(de[Se]);je.__webglTexture===void 0&&(je.__webglTexture=r.createTexture(),a.memory.textures++)}if(F.samples>0&&Be(F)===!1){Y.__webglMultisampledFramebuffer=r.createFramebuffer(),Y.__webglColorRenderbuffer=[],t.bindFramebuffer(r.FRAMEBUFFER,Y.__webglMultisampledFramebuffer);for(let Se=0;Se<de.length;Se++){const Fe=de[Se];Y.__webglColorRenderbuffer[Se]=r.createRenderbuffer(),r.bindRenderbuffer(r.RENDERBUFFER,Y.__webglColorRenderbuffer[Se]);const je=s.convert(Fe.format,Fe.colorSpace),fe=s.convert(Fe.type),Oe=E(Fe.internalFormat,je,fe,Fe.colorSpace,F.isXRRenderTarget===!0),tt=Q(F);r.renderbufferStorageMultisample(r.RENDERBUFFER,tt,Oe,F.width,F.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+Se,r.RENDERBUFFER,Y.__webglColorRenderbuffer[Se])}r.bindRenderbuffer(r.RENDERBUFFER,null),F.depthBuffer&&(Y.__webglDepthRenderbuffer=r.createRenderbuffer(),st(Y.__webglDepthRenderbuffer,F,!0)),t.bindFramebuffer(r.FRAMEBUFFER,null)}}if(ne){t.bindTexture(r.TEXTURE_CUBE_MAP,ce.__webglTexture),xe(r.TEXTURE_CUBE_MAP,T);for(let Se=0;Se<6;Se++)if(T.mipmaps&&T.mipmaps.length>0)for(let Fe=0;Fe<T.mipmaps.length;Fe++)be(Y.__webglFramebuffer[Se][Fe],F,T,r.COLOR_ATTACHMENT0,r.TEXTURE_CUBE_MAP_POSITIVE_X+Se,Fe);else be(Y.__webglFramebuffer[Se],F,T,r.COLOR_ATTACHMENT0,r.TEXTURE_CUBE_MAP_POSITIVE_X+Se,0);g(T)&&p(r.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(Ge){for(let Se=0,Fe=de.length;Se<Fe;Se++){const je=de[Se],fe=n.get(je);t.bindTexture(r.TEXTURE_2D,fe.__webglTexture),xe(r.TEXTURE_2D,je),be(Y.__webglFramebuffer,F,je,r.COLOR_ATTACHMENT0+Se,r.TEXTURE_2D,0),g(je)&&p(r.TEXTURE_2D)}t.unbindTexture()}else{let Se=r.TEXTURE_2D;if((F.isWebGL3DRenderTarget||F.isWebGLArrayRenderTarget)&&(Se=F.isWebGL3DRenderTarget?r.TEXTURE_3D:r.TEXTURE_2D_ARRAY),t.bindTexture(Se,ce.__webglTexture),xe(Se,T),T.mipmaps&&T.mipmaps.length>0)for(let Fe=0;Fe<T.mipmaps.length;Fe++)be(Y.__webglFramebuffer[Fe],F,T,r.COLOR_ATTACHMENT0,Se,Fe);else be(Y.__webglFramebuffer,F,T,r.COLOR_ATTACHMENT0,Se,0);g(T)&&p(Se),t.unbindTexture()}F.depthBuffer&&Ct(F)}function N(F){const T=F.textures;for(let Y=0,ce=T.length;Y<ce;Y++){const de=T[Y];if(g(de)){const ne=M(F),Ge=n.get(de).__webglTexture;t.bindTexture(ne,Ge),p(ne),t.unbindTexture()}}}const We=[],Me=[];function Te(F){if(F.samples>0){if(Be(F)===!1){const T=F.textures,Y=F.width,ce=F.height;let de=r.COLOR_BUFFER_BIT;const ne=F.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,Ge=n.get(F),Se=T.length>1;if(Se)for(let je=0;je<T.length;je++)t.bindFramebuffer(r.FRAMEBUFFER,Ge.__webglMultisampledFramebuffer),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+je,r.RENDERBUFFER,null),t.bindFramebuffer(r.FRAMEBUFFER,Ge.__webglFramebuffer),r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0+je,r.TEXTURE_2D,null,0);t.bindFramebuffer(r.READ_FRAMEBUFFER,Ge.__webglMultisampledFramebuffer);const Fe=F.texture.mipmaps;Fe&&Fe.length>0?t.bindFramebuffer(r.DRAW_FRAMEBUFFER,Ge.__webglFramebuffer[0]):t.bindFramebuffer(r.DRAW_FRAMEBUFFER,Ge.__webglFramebuffer);for(let je=0;je<T.length;je++){if(F.resolveDepthBuffer&&(F.depthBuffer&&(de|=r.DEPTH_BUFFER_BIT),F.stencilBuffer&&F.resolveStencilBuffer&&(de|=r.STENCIL_BUFFER_BIT)),Se){r.framebufferRenderbuffer(r.READ_FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.RENDERBUFFER,Ge.__webglColorRenderbuffer[je]);const fe=n.get(T[je]).__webglTexture;r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,fe,0)}r.blitFramebuffer(0,0,Y,ce,0,0,Y,ce,de,r.NEAREST),l===!0&&(We.length=0,Me.length=0,We.push(r.COLOR_ATTACHMENT0+je),F.depthBuffer&&F.resolveDepthBuffer===!1&&(We.push(ne),Me.push(ne),r.invalidateFramebuffer(r.DRAW_FRAMEBUFFER,Me)),r.invalidateFramebuffer(r.READ_FRAMEBUFFER,We))}if(t.bindFramebuffer(r.READ_FRAMEBUFFER,null),t.bindFramebuffer(r.DRAW_FRAMEBUFFER,null),Se)for(let je=0;je<T.length;je++){t.bindFramebuffer(r.FRAMEBUFFER,Ge.__webglMultisampledFramebuffer),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+je,r.RENDERBUFFER,Ge.__webglColorRenderbuffer[je]);const fe=n.get(T[je]).__webglTexture;t.bindFramebuffer(r.FRAMEBUFFER,Ge.__webglFramebuffer),r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0+je,r.TEXTURE_2D,fe,0)}t.bindFramebuffer(r.DRAW_FRAMEBUFFER,Ge.__webglMultisampledFramebuffer)}else if(F.depthBuffer&&F.resolveDepthBuffer===!1&&l){const T=F.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT;r.invalidateFramebuffer(r.DRAW_FRAMEBUFFER,[T])}}}function Q(F){return Math.min(i.maxSamples,F.samples)}function Be(F){const T=n.get(F);return F.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&T.__useRenderToTexture!==!1}function Ie(F){const T=a.render.frame;u.get(F)!==T&&(u.set(F,T),F.update())}function Re(F,T){const Y=F.colorSpace,ce=F.format,de=F.type;return F.isCompressedTexture===!0||F.isVideoTexture===!0||Y!==Ur&&Y!==wi&&(vt.getTransfer(Y)===It?(ce!==In||de!==Jn)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",Y)),T}function pt(F){return typeof HTMLImageElement<"u"&&F instanceof HTMLImageElement?(c.width=F.naturalWidth||F.width,c.height=F.naturalHeight||F.height):typeof VideoFrame<"u"&&F instanceof VideoFrame?(c.width=F.displayWidth,c.height=F.displayHeight):(c.width=F.width,c.height=F.height),c}this.allocateTextureUnit=z,this.resetTextureUnits=B,this.setTexture2D=j,this.setTexture2DArray=O,this.setTexture3D=K,this.setTextureCube=H,this.rebindTextures=ae,this.setupRenderTarget=_e,this.updateRenderTargetMipmap=N,this.updateMultisampleRenderTarget=Te,this.setupDepthRenderbuffer=Ct,this.setupFrameBufferTexture=be,this.useMultisampledRTT=Be}function Mv(r,e){function t(n,i=wi){let s;const a=vt.getTransfer(i);if(n===Jn)return r.UNSIGNED_BYTE;if(n===Ml)return r.UNSIGNED_SHORT_4_4_4_4;if(n===bl)return r.UNSIGNED_SHORT_5_5_5_1;if(n===th)return r.UNSIGNED_INT_5_9_9_9_REV;if(n===Qu)return r.BYTE;if(n===eh)return r.SHORT;if(n===ss)return r.UNSIGNED_SHORT;if(n===Sl)return r.INT;if(n===$i)return r.UNSIGNED_INT;if(n===Yn)return r.FLOAT;if(n===hs)return r.HALF_FLOAT;if(n===nh)return r.ALPHA;if(n===ih)return r.RGB;if(n===In)return r.RGBA;if(n===os)return r.DEPTH_COMPONENT;if(n===ls)return r.DEPTH_STENCIL;if(n===rh)return r.RED;if(n===El)return r.RED_INTEGER;if(n===sh)return r.RG;if(n===Tl)return r.RG_INTEGER;if(n===wl)return r.RGBA_INTEGER;if(n===na||n===ia||n===ra||n===sa)if(a===It)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(n===na)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===ia)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===ra)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===sa)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(n===na)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===ia)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===ra)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===sa)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===Uo||n===Io||n===No||n===Fo)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(n===Uo)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===Io)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===No)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===Fo)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===Oo||n===Bo||n===ko)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(n===Oo||n===Bo)return a===It?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(n===ko)return a===It?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(n===zo||n===Vo||n===Ho||n===Go||n===Wo||n===Xo||n===qo||n===jo||n===Yo||n===Ko||n===$o||n===Jo||n===Zo||n===Qo)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(n===zo)return a===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===Vo)return a===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===Ho)return a===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===Go)return a===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===Wo)return a===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===Xo)return a===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===qo)return a===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===jo)return a===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===Yo)return a===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===Ko)return a===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===$o)return a===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===Jo)return a===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===Zo)return a===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===Qo)return a===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===aa||n===el||n===tl)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(n===aa)return a===It?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===el)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===tl)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===ah||n===nl||n===il||n===rl)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(n===aa)return s.COMPRESSED_RED_RGTC1_EXT;if(n===nl)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===il)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===rl)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===as?r.UNSIGNED_INT_24_8:r[n]!==void 0?r[n]:null}return{convert:t}}const bv=`
|
|
3804
3804
|
void main() {
|
|
3805
3805
|
|
|
3806
3806
|
gl_Position = vec4( position, 1.0 );
|
|
3807
3807
|
|
|
3808
|
-
}`,
|
|
3808
|
+
}`,Ev=`
|
|
3809
3809
|
uniform sampler2DArray depthColor;
|
|
3810
3810
|
uniform float depthWidth;
|
|
3811
3811
|
uniform float depthHeight;
|
|
@@ -3824,7 +3824,7 @@ void main() {
|
|
|
3824
3824
|
|
|
3825
3825
|
}
|
|
3826
3826
|
|
|
3827
|
-
}`;class wv{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,n){if(this.texture===null){const i=new an,s=e.properties.get(i);s.__webglTexture=t.texture,(t.depthNear!==n.depthNear||t.depthFar!==n.depthFar)&&(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=i}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,n=new gi({vertexShader:Ev,fragmentShader:Tv,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new Ut(new ds(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class Av extends Zi{constructor(e,t){super();const n=this;let i=null,s=1,a=null,o="local-floor",l=1,c=null,u=null,h=null,d=null,f=null,m=null;const _=new wv,g=t.getContextAttributes();let p=null,M=null;const E=[],y=[],I=new dt;let R=null;const C=new sn;C.viewport=new St;const L=new sn;L.viewport=new St;const b=[C,L],x=new Wp;let w=null,B=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(q){let te=E[q];return te===void 0&&(te=new Ja,E[q]=te),te.getTargetRaySpace()},this.getControllerGrip=function(q){let te=E[q];return te===void 0&&(te=new Ja,E[q]=te),te.getGripSpace()},this.getHand=function(q){let te=E[q];return te===void 0&&(te=new Ja,E[q]=te),te.getHandSpace()};function z(q){const te=y.indexOf(q.inputSource);if(te===-1)return;const se=E[te];se!==void 0&&(se.update(q.inputSource,q.frame,c||a),se.dispatchEvent({type:q.type,data:q.inputSource}))}function X(){i.removeEventListener("select",z),i.removeEventListener("selectstart",z),i.removeEventListener("selectend",z),i.removeEventListener("squeeze",z),i.removeEventListener("squeezestart",z),i.removeEventListener("squeezeend",z),i.removeEventListener("end",X),i.removeEventListener("inputsourceschange",j);for(let q=0;q<E.length;q++){const te=y[q];te!==null&&(y[q]=null,E[q].disconnect(te))}w=null,B=null,_.reset(),e.setRenderTarget(p),f=null,d=null,h=null,i=null,M=null,Ee.stop(),n.isPresenting=!1,e.setPixelRatio(R),e.setSize(I.width,I.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(q){s=q,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(q){o=q,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||a},this.setReferenceSpace=function(q){c=q},this.getBaseLayer=function(){return d!==null?d:f},this.getBinding=function(){return h},this.getFrame=function(){return m},this.getSession=function(){return i},this.setSession=async function(q){if(i=q,i!==null){if(p=e.getRenderTarget(),i.addEventListener("select",z),i.addEventListener("selectstart",z),i.addEventListener("selectend",z),i.addEventListener("squeeze",z),i.addEventListener("squeezestart",z),i.addEventListener("squeezeend",z),i.addEventListener("end",X),i.addEventListener("inputsourceschange",j),g.xrCompatible!==!0&&await t.makeXRCompatible(),R=e.getPixelRatio(),e.getSize(I),typeof XRWebGLBinding<"u"&&"createProjectionLayer"in XRWebGLBinding.prototype){let se=null,le=null,be=null;g.depth&&(be=g.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,se=g.stencil?ls:os,le=g.stencil?as:$i);const st={colorFormat:t.RGBA8,depthFormat:be,scaleFactor:s};h=new XRWebGLBinding(i,t),d=h.createProjectionLayer(st),i.updateRenderState({layers:[d]}),e.setPixelRatio(1),e.setSize(d.textureWidth,d.textureHeight,!1),M=new Ji(d.textureWidth,d.textureHeight,{format:In,type:Jn,depthTexture:new xh(d.textureWidth,d.textureHeight,le,void 0,void 0,void 0,void 0,void 0,void 0,se),stencilBuffer:g.stencil,colorSpace:e.outputColorSpace,samples:g.antialias?4:0,resolveDepthBuffer:d.ignoreDepthValues===!1,resolveStencilBuffer:d.ignoreDepthValues===!1})}else{const se={antialias:g.antialias,alpha:!0,depth:g.depth,stencil:g.stencil,framebufferScaleFactor:s};f=new XRWebGLLayer(i,t,se),i.updateRenderState({baseLayer:f}),e.setPixelRatio(1),e.setSize(f.framebufferWidth,f.framebufferHeight,!1),M=new Ji(f.framebufferWidth,f.framebufferHeight,{format:In,type:Jn,colorSpace:e.outputColorSpace,stencilBuffer:g.stencil,resolveDepthBuffer:f.ignoreDepthValues===!1,resolveStencilBuffer:f.ignoreDepthValues===!1})}M.isXRRenderTarget=!0,this.setFoveation(l),c=null,a=await i.requestReferenceSpace(o),Ee.setContext(i),Ee.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(i!==null)return i.environmentBlendMode},this.getDepthTexture=function(){return _.getDepthTexture()};function j(q){for(let te=0;te<q.removed.length;te++){const se=q.removed[te],le=y.indexOf(se);le>=0&&(y[le]=null,E[le].disconnect(se))}for(let te=0;te<q.added.length;te++){const se=q.added[te];let le=y.indexOf(se);if(le===-1){for(let st=0;st<E.length;st++)if(st>=y.length){y.push(se),le=st;break}else if(y[st]===null){y[st]=se,le=st;break}if(le===-1)break}const be=E[le];be&&be.connect(se)}}const O=new k,K=new k;function H(q,te,se){O.setFromMatrixPosition(te.matrixWorld),K.setFromMatrixPosition(se.matrixWorld);const le=O.distanceTo(K),be=te.projectionMatrix.elements,st=se.projectionMatrix.elements,Ke=be[14]/(be[10]-1),Ct=be[14]/(be[10]+1),ae=(be[9]+1)/be[5],_e=(be[9]-1)/be[5],N=(be[8]-1)/be[0],We=(st[8]+1)/st[0],Me=Ke*N,Te=Ke*We,Q=le/(-N+We),Be=Q*-N;if(te.matrixWorld.decompose(q.position,q.quaternion,q.scale),q.translateX(Be),q.translateZ(Q),q.matrixWorld.compose(q.position,q.quaternion,q.scale),q.matrixWorldInverse.copy(q.matrixWorld).invert(),be[10]===-1)q.projectionMatrix.copy(te.projectionMatrix),q.projectionMatrixInverse.copy(te.projectionMatrixInverse);else{const Ie=Ke+Q,Re=Ct+Q,pt=Me-Be,F=Te+(le-Be),T=ae*Ct/Re*Ie,Y=_e*Ct/Re*Ie;q.projectionMatrix.makePerspective(pt,F,T,Y,Ie,Re),q.projectionMatrixInverse.copy(q.projectionMatrix).invert()}}function ie(q,te){te===null?q.matrixWorld.copy(q.matrix):q.matrixWorld.multiplyMatrices(te.matrixWorld,q.matrix),q.matrixWorldInverse.copy(q.matrixWorld).invert()}this.updateCamera=function(q){if(i===null)return;let te=q.near,se=q.far;_.texture!==null&&(_.depthNear>0&&(te=_.depthNear),_.depthFar>0&&(se=_.depthFar)),x.near=L.near=C.near=te,x.far=L.far=C.far=se,(w!==x.near||B!==x.far)&&(i.updateRenderState({depthNear:x.near,depthFar:x.far}),w=x.near,B=x.far),C.layers.mask=q.layers.mask|2,L.layers.mask=q.layers.mask|4,x.layers.mask=C.layers.mask|L.layers.mask;const le=q.parent,be=x.cameras;ie(x,le);for(let st=0;st<be.length;st++)ie(be[st],le);be.length===2?H(x,C,L):x.projectionMatrix.copy(C.projectionMatrix),oe(q,x,le)};function oe(q,te,se){se===null?q.matrix.copy(te.matrixWorld):(q.matrix.copy(se.matrixWorld),q.matrix.invert(),q.matrix.multiply(te.matrixWorld)),q.matrix.decompose(q.position,q.quaternion,q.scale),q.updateMatrixWorld(!0),q.projectionMatrix.copy(te.projectionMatrix),q.projectionMatrixInverse.copy(te.projectionMatrixInverse),q.isPerspectiveCamera&&(q.fov=Ir*2*Math.atan(1/q.projectionMatrix.elements[5]),q.zoom=1)}this.getCamera=function(){return x},this.getFoveation=function(){if(!(d===null&&f===null))return l},this.setFoveation=function(q){l=q,d!==null&&(d.fixedFoveation=q),f!==null&&f.fixedFoveation!==void 0&&(f.fixedFoveation=q)},this.hasDepthSensing=function(){return _.texture!==null},this.getDepthSensingMesh=function(){return _.getMesh(x)};let $=null;function xe(q,te){if(u=te.getViewerPose(c||a),m=te,u!==null){const se=u.views;f!==null&&(e.setRenderTargetFramebuffer(M,f.framebuffer),e.setRenderTarget(M));let le=!1;se.length!==x.cameras.length&&(x.cameras.length=0,le=!0);for(let Ke=0;Ke<se.length;Ke++){const Ct=se[Ke];let ae=null;if(f!==null)ae=f.getViewport(Ct);else{const N=h.getViewSubImage(d,Ct);ae=N.viewport,Ke===0&&(e.setRenderTargetTextures(M,N.colorTexture,N.depthStencilTexture),e.setRenderTarget(M))}let _e=b[Ke];_e===void 0&&(_e=new sn,_e.layers.enable(Ke),_e.viewport=new St,b[Ke]=_e),_e.matrix.fromArray(Ct.transform.matrix),_e.matrix.decompose(_e.position,_e.quaternion,_e.scale),_e.projectionMatrix.fromArray(Ct.projectionMatrix),_e.projectionMatrixInverse.copy(_e.projectionMatrix).invert(),_e.viewport.set(ae.x,ae.y,ae.width,ae.height),Ke===0&&(x.matrix.copy(_e.matrix),x.matrix.decompose(x.position,x.quaternion,x.scale)),le===!0&&x.cameras.push(_e)}const be=i.enabledFeatures;if(be&&be.includes("depth-sensing")&&i.depthUsage=="gpu-optimized"&&h){const Ke=h.getDepthInformation(se[0]);Ke&&Ke.isValid&&Ke.texture&&_.init(e,Ke,i.renderState)}}for(let se=0;se<E.length;se++){const le=y[se],be=E[se];le!==null&&be!==void 0&&be.update(le,te,c||a)}$&&$(q,te),te.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:te}),m=null}const Ee=new Ah;Ee.setAnimationLoop(xe),this.setAnimationLoop=function(q){$=q},this.dispose=function(){}}}const ki=new bn,Rv=new ut;function Cv(r,e){function t(g,p){g.matrixAutoUpdate===!0&&g.updateMatrix(),p.value.copy(g.matrix)}function n(g,p){p.color.getRGB(g.fogColor.value,fh(r)),p.isFog?(g.fogNear.value=p.near,g.fogFar.value=p.far):p.isFogExp2&&(g.fogDensity.value=p.density)}function i(g,p,M,E,y){p.isMeshBasicMaterial||p.isMeshLambertMaterial?s(g,p):p.isMeshToonMaterial?(s(g,p),h(g,p)):p.isMeshPhongMaterial?(s(g,p),u(g,p)):p.isMeshStandardMaterial?(s(g,p),d(g,p),p.isMeshPhysicalMaterial&&f(g,p,y)):p.isMeshMatcapMaterial?(s(g,p),m(g,p)):p.isMeshDepthMaterial?s(g,p):p.isMeshDistanceMaterial?(s(g,p),_(g,p)):p.isMeshNormalMaterial?s(g,p):p.isLineBasicMaterial?(a(g,p),p.isLineDashedMaterial&&o(g,p)):p.isPointsMaterial?l(g,p,M,E):p.isSpriteMaterial?c(g,p):p.isShadowMaterial?(g.color.value.copy(p.color),g.opacity.value=p.opacity):p.isShaderMaterial&&(p.uniformsNeedUpdate=!1)}function s(g,p){g.opacity.value=p.opacity,p.color&&g.diffuse.value.copy(p.color),p.emissive&&g.emissive.value.copy(p.emissive).multiplyScalar(p.emissiveIntensity),p.map&&(g.map.value=p.map,t(p.map,g.mapTransform)),p.alphaMap&&(g.alphaMap.value=p.alphaMap,t(p.alphaMap,g.alphaMapTransform)),p.bumpMap&&(g.bumpMap.value=p.bumpMap,t(p.bumpMap,g.bumpMapTransform),g.bumpScale.value=p.bumpScale,p.side===_n&&(g.bumpScale.value*=-1)),p.normalMap&&(g.normalMap.value=p.normalMap,t(p.normalMap,g.normalMapTransform),g.normalScale.value.copy(p.normalScale),p.side===_n&&g.normalScale.value.negate()),p.displacementMap&&(g.displacementMap.value=p.displacementMap,t(p.displacementMap,g.displacementMapTransform),g.displacementScale.value=p.displacementScale,g.displacementBias.value=p.displacementBias),p.emissiveMap&&(g.emissiveMap.value=p.emissiveMap,t(p.emissiveMap,g.emissiveMapTransform)),p.specularMap&&(g.specularMap.value=p.specularMap,t(p.specularMap,g.specularMapTransform)),p.alphaTest>0&&(g.alphaTest.value=p.alphaTest);const M=e.get(p),E=M.envMap,y=M.envMapRotation;E&&(g.envMap.value=E,ki.copy(y),ki.x*=-1,ki.y*=-1,ki.z*=-1,E.isCubeTexture&&E.isRenderTargetTexture===!1&&(ki.y*=-1,ki.z*=-1),g.envMapRotation.value.setFromMatrix4(Rv.makeRotationFromEuler(ki)),g.flipEnvMap.value=E.isCubeTexture&&E.isRenderTargetTexture===!1?-1:1,g.reflectivity.value=p.reflectivity,g.ior.value=p.ior,g.refractionRatio.value=p.refractionRatio),p.lightMap&&(g.lightMap.value=p.lightMap,g.lightMapIntensity.value=p.lightMapIntensity,t(p.lightMap,g.lightMapTransform)),p.aoMap&&(g.aoMap.value=p.aoMap,g.aoMapIntensity.value=p.aoMapIntensity,t(p.aoMap,g.aoMapTransform))}function a(g,p){g.diffuse.value.copy(p.color),g.opacity.value=p.opacity,p.map&&(g.map.value=p.map,t(p.map,g.mapTransform))}function o(g,p){g.dashSize.value=p.dashSize,g.totalSize.value=p.dashSize+p.gapSize,g.scale.value=p.scale}function l(g,p,M,E){g.diffuse.value.copy(p.color),g.opacity.value=p.opacity,g.size.value=p.size*M,g.scale.value=E*.5,p.map&&(g.map.value=p.map,t(p.map,g.uvTransform)),p.alphaMap&&(g.alphaMap.value=p.alphaMap,t(p.alphaMap,g.alphaMapTransform)),p.alphaTest>0&&(g.alphaTest.value=p.alphaTest)}function c(g,p){g.diffuse.value.copy(p.color),g.opacity.value=p.opacity,g.rotation.value=p.rotation,p.map&&(g.map.value=p.map,t(p.map,g.mapTransform)),p.alphaMap&&(g.alphaMap.value=p.alphaMap,t(p.alphaMap,g.alphaMapTransform)),p.alphaTest>0&&(g.alphaTest.value=p.alphaTest)}function u(g,p){g.specular.value.copy(p.specular),g.shininess.value=Math.max(p.shininess,1e-4)}function h(g,p){p.gradientMap&&(g.gradientMap.value=p.gradientMap)}function d(g,p){g.metalness.value=p.metalness,p.metalnessMap&&(g.metalnessMap.value=p.metalnessMap,t(p.metalnessMap,g.metalnessMapTransform)),g.roughness.value=p.roughness,p.roughnessMap&&(g.roughnessMap.value=p.roughnessMap,t(p.roughnessMap,g.roughnessMapTransform)),p.envMap&&(g.envMapIntensity.value=p.envMapIntensity)}function f(g,p,M){g.ior.value=p.ior,p.sheen>0&&(g.sheenColor.value.copy(p.sheenColor).multiplyScalar(p.sheen),g.sheenRoughness.value=p.sheenRoughness,p.sheenColorMap&&(g.sheenColorMap.value=p.sheenColorMap,t(p.sheenColorMap,g.sheenColorMapTransform)),p.sheenRoughnessMap&&(g.sheenRoughnessMap.value=p.sheenRoughnessMap,t(p.sheenRoughnessMap,g.sheenRoughnessMapTransform))),p.clearcoat>0&&(g.clearcoat.value=p.clearcoat,g.clearcoatRoughness.value=p.clearcoatRoughness,p.clearcoatMap&&(g.clearcoatMap.value=p.clearcoatMap,t(p.clearcoatMap,g.clearcoatMapTransform)),p.clearcoatRoughnessMap&&(g.clearcoatRoughnessMap.value=p.clearcoatRoughnessMap,t(p.clearcoatRoughnessMap,g.clearcoatRoughnessMapTransform)),p.clearcoatNormalMap&&(g.clearcoatNormalMap.value=p.clearcoatNormalMap,t(p.clearcoatNormalMap,g.clearcoatNormalMapTransform),g.clearcoatNormalScale.value.copy(p.clearcoatNormalScale),p.side===_n&&g.clearcoatNormalScale.value.negate())),p.dispersion>0&&(g.dispersion.value=p.dispersion),p.iridescence>0&&(g.iridescence.value=p.iridescence,g.iridescenceIOR.value=p.iridescenceIOR,g.iridescenceThicknessMinimum.value=p.iridescenceThicknessRange[0],g.iridescenceThicknessMaximum.value=p.iridescenceThicknessRange[1],p.iridescenceMap&&(g.iridescenceMap.value=p.iridescenceMap,t(p.iridescenceMap,g.iridescenceMapTransform)),p.iridescenceThicknessMap&&(g.iridescenceThicknessMap.value=p.iridescenceThicknessMap,t(p.iridescenceThicknessMap,g.iridescenceThicknessMapTransform))),p.transmission>0&&(g.transmission.value=p.transmission,g.transmissionSamplerMap.value=M.texture,g.transmissionSamplerSize.value.set(M.width,M.height),p.transmissionMap&&(g.transmissionMap.value=p.transmissionMap,t(p.transmissionMap,g.transmissionMapTransform)),g.thickness.value=p.thickness,p.thicknessMap&&(g.thicknessMap.value=p.thicknessMap,t(p.thicknessMap,g.thicknessMapTransform)),g.attenuationDistance.value=p.attenuationDistance,g.attenuationColor.value.copy(p.attenuationColor)),p.anisotropy>0&&(g.anisotropyVector.value.set(p.anisotropy*Math.cos(p.anisotropyRotation),p.anisotropy*Math.sin(p.anisotropyRotation)),p.anisotropyMap&&(g.anisotropyMap.value=p.anisotropyMap,t(p.anisotropyMap,g.anisotropyMapTransform))),g.specularIntensity.value=p.specularIntensity,g.specularColor.value.copy(p.specularColor),p.specularColorMap&&(g.specularColorMap.value=p.specularColorMap,t(p.specularColorMap,g.specularColorMapTransform)),p.specularIntensityMap&&(g.specularIntensityMap.value=p.specularIntensityMap,t(p.specularIntensityMap,g.specularIntensityMapTransform))}function m(g,p){p.matcap&&(g.matcap.value=p.matcap)}function _(g,p){const M=e.get(p).light;g.referencePosition.value.setFromMatrixPosition(M.matrixWorld),g.nearDistance.value=M.shadow.camera.near,g.farDistance.value=M.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:i}}function Pv(r,e,t,n){let i={},s={},a=[];const o=r.getParameter(r.MAX_UNIFORM_BUFFER_BINDINGS);function l(M,E){const y=E.program;n.uniformBlockBinding(M,y)}function c(M,E){let y=i[M.id];y===void 0&&(m(M),y=u(M),i[M.id]=y,M.addEventListener("dispose",g));const I=E.program;n.updateUBOMapping(M,I);const R=e.render.frame;s[M.id]!==R&&(d(M),s[M.id]=R)}function u(M){const E=h();M.__bindingPointIndex=E;const y=r.createBuffer(),I=M.__size,R=M.usage;return r.bindBuffer(r.UNIFORM_BUFFER,y),r.bufferData(r.UNIFORM_BUFFER,I,R),r.bindBuffer(r.UNIFORM_BUFFER,null),r.bindBufferBase(r.UNIFORM_BUFFER,E,y),y}function h(){for(let M=0;M<o;M++)if(a.indexOf(M)===-1)return a.push(M),M;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function d(M){const E=i[M.id],y=M.uniforms,I=M.__cache;r.bindBuffer(r.UNIFORM_BUFFER,E);for(let R=0,C=y.length;R<C;R++){const L=Array.isArray(y[R])?y[R]:[y[R]];for(let b=0,x=L.length;b<x;b++){const w=L[b];if(f(w,R,b,I)===!0){const B=w.__offset,z=Array.isArray(w.value)?w.value:[w.value];let X=0;for(let j=0;j<z.length;j++){const O=z[j],K=_(O);typeof O=="number"||typeof O=="boolean"?(w.__data[0]=O,r.bufferSubData(r.UNIFORM_BUFFER,B+X,w.__data)):O.isMatrix3?(w.__data[0]=O.elements[0],w.__data[1]=O.elements[1],w.__data[2]=O.elements[2],w.__data[3]=0,w.__data[4]=O.elements[3],w.__data[5]=O.elements[4],w.__data[6]=O.elements[5],w.__data[7]=0,w.__data[8]=O.elements[6],w.__data[9]=O.elements[7],w.__data[10]=O.elements[8],w.__data[11]=0):(O.toArray(w.__data,X),X+=K.storage/Float32Array.BYTES_PER_ELEMENT)}r.bufferSubData(r.UNIFORM_BUFFER,B,w.__data)}}}r.bindBuffer(r.UNIFORM_BUFFER,null)}function f(M,E,y,I){const R=M.value,C=E+"_"+y;if(I[C]===void 0)return typeof R=="number"||typeof R=="boolean"?I[C]=R:I[C]=R.clone(),!0;{const L=I[C];if(typeof R=="number"||typeof R=="boolean"){if(L!==R)return I[C]=R,!0}else if(L.equals(R)===!1)return L.copy(R),!0}return!1}function m(M){const E=M.uniforms;let y=0;const I=16;for(let C=0,L=E.length;C<L;C++){const b=Array.isArray(E[C])?E[C]:[E[C]];for(let x=0,w=b.length;x<w;x++){const B=b[x],z=Array.isArray(B.value)?B.value:[B.value];for(let X=0,j=z.length;X<j;X++){const O=z[X],K=_(O),H=y%I,ie=H%K.boundary,oe=H+ie;y+=ie,oe!==0&&I-oe<K.storage&&(y+=I-oe),B.__data=new Float32Array(K.storage/Float32Array.BYTES_PER_ELEMENT),B.__offset=y,y+=K.storage}}}const R=y%I;return R>0&&(y+=I-R),M.__size=y,M.__cache={},this}function _(M){const E={boundary:0,storage:0};return typeof M=="number"||typeof M=="boolean"?(E.boundary=4,E.storage=4):M.isVector2?(E.boundary=8,E.storage=8):M.isVector3||M.isColor?(E.boundary=16,E.storage=12):M.isVector4?(E.boundary=16,E.storage=16):M.isMatrix3?(E.boundary=48,E.storage=48):M.isMatrix4?(E.boundary=64,E.storage=64):M.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",M),E}function g(M){const E=M.target;E.removeEventListener("dispose",g);const y=a.indexOf(E.__bindingPointIndex);a.splice(y,1),r.deleteBuffer(i[E.id]),delete i[E.id],delete s[E.id]}function p(){for(const M in i)r.deleteBuffer(i[M]);a=[],i={},s={}}return{bind:l,update:c,dispose:p}}class Dv{constructor(e={}){const{canvas:t=Hf(),context:n=null,depth:i=!0,stencil:s=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:h=!1,reverseDepthBuffer:d=!1}=e;this.isWebGLRenderer=!0;let f;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");f=n.getContextAttributes().alpha}else f=a;const m=new Uint32Array(4),_=new Int32Array(4);let g=null,p=null;const M=[],E=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=Ri,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const y=this;let I=!1;this._outputColorSpace=At;let R=0,C=0,L=null,b=-1,x=null;const w=new St,B=new St;let z=null;const X=new ht(0);let j=0,O=t.width,K=t.height,H=1,ie=null,oe=null;const $=new St(0,0,O,K),xe=new St(0,0,O,K);let Ee=!1;const q=new Nl;let te=!1,se=!1;const le=new ut,be=new ut,st=new k,Ke=new St,Ct={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let ae=!1;function _e(){return L===null?H:1}let N=n;function We(P,G){return t.getContext(P,G)}try{const P={alpha:!0,depth:i,stencil:s,antialias:o,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:u,failIfMajorPerformanceCaveat:h};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${xl}`),t.addEventListener("webglcontextlost",ke,!1),t.addEventListener("webglcontextrestored",ve,!1),t.addEventListener("webglcontextcreationerror",he,!1),N===null){const G="webgl2";if(N=We(G,P),N===null)throw We(G)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(P){throw console.error("THREE.WebGLRenderer: "+P.message),P}let Me,Te,Q,Be,Ie,Re,pt,F,T,Y,ce,de,ne,Ge,Se,Fe,je,fe,Oe,tt,Qe,we,at,V;function Pe(){Me=new V_(N),Me.init(),we=new bv(N,Me),Te=new I_(N,Me,e,we),Q=new Sv(N,Me),Te.reverseDepthBuffer&&d&&Q.buffers.depth.setReversed(!0),Be=new W_(N),Ie=new lv,Re=new Mv(N,Me,Q,Ie,Te,we,Be),pt=new F_(y),F=new z_(y),T=new $p(N),at=new L_(N,T),Y=new H_(N,T,Be,at),ce=new q_(N,Y,T,Be),Oe=new X_(N,Te,Re),Fe=new N_(Ie),de=new ov(y,pt,F,Me,Te,at,Fe),ne=new Cv(y,Ie),Ge=new uv,Se=new gv(Me),fe=new D_(y,pt,F,Q,ce,f,l),je=new yv(y,ce,Te),V=new Pv(N,Be,Te,Q),tt=new U_(N,Me,Be),Qe=new G_(N,Me,Be),Be.programs=de.programs,y.capabilities=Te,y.extensions=Me,y.properties=Ie,y.renderLists=Ge,y.shadowMap=je,y.state=Q,y.info=Be}Pe();const pe=new Av(y,N);this.xr=pe,this.getContext=function(){return N},this.getContextAttributes=function(){return N.getContextAttributes()},this.forceContextLoss=function(){const P=Me.get("WEBGL_lose_context");P&&P.loseContext()},this.forceContextRestore=function(){const P=Me.get("WEBGL_lose_context");P&&P.restoreContext()},this.getPixelRatio=function(){return H},this.setPixelRatio=function(P){P!==void 0&&(H=P,this.setSize(O,K,!1))},this.getSize=function(P){return P.set(O,K)},this.setSize=function(P,G,J=!0){if(pe.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}O=P,K=G,t.width=Math.floor(P*H),t.height=Math.floor(G*H),J===!0&&(t.style.width=P+"px",t.style.height=G+"px"),this.setViewport(0,0,P,G)},this.getDrawingBufferSize=function(P){return P.set(O*H,K*H).floor()},this.setDrawingBufferSize=function(P,G,J){O=P,K=G,H=J,t.width=Math.floor(P*J),t.height=Math.floor(G*J),this.setViewport(0,0,P,G)},this.getCurrentViewport=function(P){return P.copy(w)},this.getViewport=function(P){return P.copy($)},this.setViewport=function(P,G,J,Z){P.isVector4?$.set(P.x,P.y,P.z,P.w):$.set(P,G,J,Z),Q.viewport(w.copy($).multiplyScalar(H).round())},this.getScissor=function(P){return P.copy(xe)},this.setScissor=function(P,G,J,Z){P.isVector4?xe.set(P.x,P.y,P.z,P.w):xe.set(P,G,J,Z),Q.scissor(B.copy(xe).multiplyScalar(H).round())},this.getScissorTest=function(){return Ee},this.setScissorTest=function(P){Q.setScissorTest(Ee=P)},this.setOpaqueSort=function(P){ie=P},this.setTransparentSort=function(P){oe=P},this.getClearColor=function(P){return P.copy(fe.getClearColor())},this.setClearColor=function(){fe.setClearColor(...arguments)},this.getClearAlpha=function(){return fe.getClearAlpha()},this.setClearAlpha=function(){fe.setClearAlpha(...arguments)},this.clear=function(P=!0,G=!0,J=!0){let Z=0;if(P){let W=!1;if(L!==null){const ye=L.texture.format;W=ye===wl||ye===Tl||ye===El}if(W){const ye=L.texture.type,Ue=ye===Jn||ye===$i||ye===ss||ye===as||ye===Ml||ye===bl,Xe=fe.getClearColor(),ze=fe.getClearAlpha(),ot=Xe.r,lt=Xe.g,Je=Xe.b;Ue?(m[0]=ot,m[1]=lt,m[2]=Je,m[3]=ze,N.clearBufferuiv(N.COLOR,0,m)):(_[0]=ot,_[1]=lt,_[2]=Je,_[3]=ze,N.clearBufferiv(N.COLOR,0,_))}else Z|=N.COLOR_BUFFER_BIT}G&&(Z|=N.DEPTH_BUFFER_BIT),J&&(Z|=N.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),N.clear(Z)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",ke,!1),t.removeEventListener("webglcontextrestored",ve,!1),t.removeEventListener("webglcontextcreationerror",he,!1),fe.dispose(),Ge.dispose(),Se.dispose(),Ie.dispose(),pt.dispose(),F.dispose(),ce.dispose(),at.dispose(),V.dispose(),de.dispose(),pe.dispose(),pe.removeEventListener("sessionstart",Qn),pe.removeEventListener("sessionend",nt),De.stop()};function ke(P){P.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),I=!0}function ve(){console.log("THREE.WebGLRenderer: Context Restored."),I=!1;const P=Be.autoReset,G=je.enabled,J=je.autoUpdate,Z=je.needsUpdate,W=je.type;Pe(),Be.autoReset=P,je.enabled=G,je.autoUpdate=J,je.needsUpdate=Z,je.type=W}function he(P){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",P.statusMessage)}function He(P){const G=P.target;G.removeEventListener("dispose",He),me(G)}function me(P){mt(P),Ie.remove(P)}function mt(P){const G=Ie.get(P).programs;G!==void 0&&(G.forEach(function(J){de.releaseProgram(J)}),P.isShaderMaterial&&de.releaseShaderCache(P))}this.renderBufferDirect=function(P,G,J,Z,W,ye){G===null&&(G=Ct);const Ue=W.isMesh&&W.matrixWorld.determinant()<0,Xe=Qi(P,G,J,Z,W);Q.setMaterial(Z,Ue);let ze=J.index,ot=1;if(Z.wireframe===!0){if(ze=Y.getWireframeAttribute(J),ze===void 0)return;ot=2}const lt=J.drawRange,Je=J.attributes.position;let ft=lt.start*ot,Rt=(lt.start+lt.count)*ot;ye!==null&&(ft=Math.max(ft,ye.start*ot),Rt=Math.min(Rt,(ye.start+ye.count)*ot)),ze!==null?(ft=Math.max(ft,0),Rt=Math.min(Rt,ze.count)):Je!=null&&(ft=Math.max(ft,0),Rt=Math.min(Rt,Je.count));const Ot=Rt-ft;if(Ot<0||Ot===1/0)return;at.setup(W,Z,Xe,J,ze);let kt,Mt=tt;if(ze!==null&&(kt=T.get(ze),Mt=Qe,Mt.setIndex(kt)),W.isMesh)Z.wireframe===!0?(Q.setLineWidth(Z.wireframeLinewidth*_e()),Mt.setMode(N.LINES)):Mt.setMode(N.TRIANGLES);else if(W.isLine){let it=Z.linewidth;it===void 0&&(it=1),Q.setLineWidth(it*_e()),W.isLineSegments?Mt.setMode(N.LINES):W.isLineLoop?Mt.setMode(N.LINE_LOOP):Mt.setMode(N.LINE_STRIP)}else W.isPoints?Mt.setMode(N.POINTS):W.isSprite&&Mt.setMode(N.TRIANGLES);if(W.isBatchedMesh)if(W._multiDrawInstances!==null)Rr("THREE.WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),Mt.renderMultiDrawInstances(W._multiDrawStarts,W._multiDrawCounts,W._multiDrawCount,W._multiDrawInstances);else if(Me.get("WEBGL_multi_draw"))Mt.renderMultiDraw(W._multiDrawStarts,W._multiDrawCounts,W._multiDrawCount);else{const it=W._multiDrawStarts,Yt=W._multiDrawCounts,Et=W._multiDrawCount,vn=ze?T.get(ze).bytesPerElement:1,Bt=Ie.get(Z).currentProgram.getUniforms();for(let en=0;en<Et;en++)Bt.setValue(N,"_gl_DrawID",en),Mt.render(it[en]/vn,Yt[en])}else if(W.isInstancedMesh)Mt.renderInstances(ft,Ot,W.count);else if(J.isInstancedBufferGeometry){const it=J._maxInstanceCount!==void 0?J._maxInstanceCount:1/0,Yt=Math.min(J.instanceCount,it);Mt.renderInstances(ft,Ot,Yt)}else Mt.render(ft,Ot)};function Ze(P,G,J){P.transparent===!0&&P.side===hn&&P.forceSinglePass===!1?(P.side=_n,P.needsUpdate=!0,ei(P,G,J),P.side=$n,P.needsUpdate=!0,ei(P,G,J),P.side=hn):ei(P,G,J)}this.compile=function(P,G,J=null){J===null&&(J=P),p=Se.get(J),p.init(G),E.push(p),J.traverseVisible(function(W){W.isLight&&W.layers.test(G.layers)&&(p.pushLight(W),W.castShadow&&p.pushShadow(W))}),P!==J&&P.traverseVisible(function(W){W.isLight&&W.layers.test(G.layers)&&(p.pushLight(W),W.castShadow&&p.pushShadow(W))}),p.setupLights();const Z=new Set;return P.traverse(function(W){if(!(W.isMesh||W.isPoints||W.isLine||W.isSprite))return;const ye=W.material;if(ye)if(Array.isArray(ye))for(let Ue=0;Ue<ye.length;Ue++){const Xe=ye[Ue];Ze(Xe,J,W),Z.add(Xe)}else Ze(ye,J,W),Z.add(ye)}),p=E.pop(),Z},this.compileAsync=function(P,G,J=null){const Z=this.compile(P,G,J);return new Promise(W=>{function ye(){if(Z.forEach(function(Ue){Ie.get(Ue).currentProgram.isReady()&&Z.delete(Ue)}),Z.size===0){W(P);return}setTimeout(ye,10)}Me.get("KHR_parallel_shader_compile")!==null?ye():setTimeout(ye,10)})};let Ht=null;function En(P){Ht&&Ht(P)}function Qn(){De.stop()}function nt(){De.start()}const De=new Ah;De.setAnimationLoop(En),typeof self<"u"&&De.setContext(self),this.setAnimationLoop=function(P){Ht=P,pe.setAnimationLoop(P),P===null?De.stop():De.start()},pe.addEventListener("sessionstart",Qn),pe.addEventListener("sessionend",nt),this.render=function(P,G){if(G!==void 0&&G.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(I===!0)return;if(P.matrixWorldAutoUpdate===!0&&P.updateMatrixWorld(),G.parent===null&&G.matrixWorldAutoUpdate===!0&&G.updateMatrixWorld(),pe.enabled===!0&&pe.isPresenting===!0&&(pe.cameraAutoUpdate===!0&&pe.updateCamera(G),G=pe.getCamera()),P.isScene===!0&&P.onBeforeRender(y,P,G,L),p=Se.get(P,E.length),p.init(G),E.push(p),be.multiplyMatrices(G.projectionMatrix,G.matrixWorldInverse),q.setFromProjectionMatrix(be),se=this.localClippingEnabled,te=Fe.init(this.clippingPlanes,se),g=Ge.get(P,M.length),g.init(),M.push(g),pe.enabled===!0&&pe.isPresenting===!0){const ye=y.xr.getDepthSensingMesh();ye!==null&&Gt(ye,G,-1/0,y.sortObjects)}Gt(P,G,0,y.sortObjects),g.finish(),y.sortObjects===!0&&g.sort(ie,oe),ae=pe.enabled===!1||pe.isPresenting===!1||pe.hasDepthSensing()===!1,ae&&fe.addToRenderList(g,P),this.info.render.frame++,te===!0&&Fe.beginShadows();const J=p.state.shadowsArray;je.render(J,P,G),te===!0&&Fe.endShadows(),this.info.autoReset===!0&&this.info.reset();const Z=g.opaque,W=g.transmissive;if(p.setupLights(),G.isArrayCamera){const ye=G.cameras;if(W.length>0)for(let Ue=0,Xe=ye.length;Ue<Xe;Ue++){const ze=ye[Ue];Wt(Z,W,P,ze)}ae&&fe.render(P);for(let Ue=0,Xe=ye.length;Ue<Xe;Ue++){const ze=ye[Ue];Pn(g,P,ze,ze.viewport)}}else W.length>0&&Wt(Z,W,P,G),ae&&fe.render(P),Pn(g,P,G);L!==null&&C===0&&(Re.updateMultisampleRenderTarget(L),Re.updateRenderTargetMipmap(L)),P.isScene===!0&&P.onAfterRender(y,P,G),at.resetDefaultState(),b=-1,x=null,E.pop(),E.length>0?(p=E[E.length-1],te===!0&&Fe.setGlobalState(y.clippingPlanes,p.state.camera)):p=null,M.pop(),M.length>0?g=M[M.length-1]:g=null};function Gt(P,G,J,Z){if(P.visible===!1)return;if(P.layers.test(G.layers)){if(P.isGroup)J=P.renderOrder;else if(P.isLOD)P.autoUpdate===!0&&P.update(G);else if(P.isLight)p.pushLight(P),P.castShadow&&p.pushShadow(P);else if(P.isSprite){if(!P.frustumCulled||q.intersectsSprite(P)){Z&&Ke.setFromMatrixPosition(P.matrixWorld).applyMatrix4(be);const Ue=ce.update(P),Xe=P.material;Xe.visible&&g.push(P,Ue,Xe,J,Ke.z,null)}}else if((P.isMesh||P.isLine||P.isPoints)&&(!P.frustumCulled||q.intersectsObject(P))){const Ue=ce.update(P),Xe=P.material;if(Z&&(P.boundingSphere!==void 0?(P.boundingSphere===null&&P.computeBoundingSphere(),Ke.copy(P.boundingSphere.center)):(Ue.boundingSphere===null&&Ue.computeBoundingSphere(),Ke.copy(Ue.boundingSphere.center)),Ke.applyMatrix4(P.matrixWorld).applyMatrix4(be)),Array.isArray(Xe)){const ze=Ue.groups;for(let ot=0,lt=ze.length;ot<lt;ot++){const Je=ze[ot],ft=Xe[Je.materialIndex];ft&&ft.visible&&g.push(P,Ue,ft,J,Ke.z,Je)}}else Xe.visible&&g.push(P,Ue,Xe,J,Ke.z,null)}}const ye=P.children;for(let Ue=0,Xe=ye.length;Ue<Xe;Ue++)Gt(ye[Ue],G,J,Z)}function Pn(P,G,J,Z){const W=P.opaque,ye=P.transmissive,Ue=P.transparent;p.setupLightsView(J),te===!0&&Fe.setGlobalState(y.clippingPlanes,J),Z&&Q.viewport(w.copy(Z)),W.length>0&&Zt(W,G,J),ye.length>0&&Zt(ye,G,J),Ue.length>0&&Zt(Ue,G,J),Q.buffers.depth.setTest(!0),Q.buffers.depth.setMask(!0),Q.buffers.color.setMask(!0),Q.setPolygonOffset(!1)}function Wt(P,G,J,Z){if((J.isScene===!0?J.overrideMaterial:null)!==null)return;p.state.transmissionRenderTarget[Z.id]===void 0&&(p.state.transmissionRenderTarget[Z.id]=new Ji(1,1,{generateMipmaps:!0,type:Me.has("EXT_color_buffer_half_float")||Me.has("EXT_color_buffer_float")?hs:Jn,minFilter:hi,samples:4,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:vt.workingColorSpace}));const ye=p.state.transmissionRenderTarget[Z.id],Ue=Z.viewport||w;ye.setSize(Ue.z*y.transmissionResolutionScale,Ue.w*y.transmissionResolutionScale);const Xe=y.getRenderTarget();y.setRenderTarget(ye),y.getClearColor(X),j=y.getClearAlpha(),j<1&&y.setClearColor(16777215,.5),y.clear(),ae&&fe.render(J);const ze=y.toneMapping;y.toneMapping=Ri;const ot=Z.viewport;if(Z.viewport!==void 0&&(Z.viewport=void 0),p.setupLightsView(Z),te===!0&&Fe.setGlobalState(y.clippingPlanes,Z),Zt(P,J,Z),Re.updateMultisampleRenderTarget(ye),Re.updateRenderTargetMipmap(ye),Me.has("WEBGL_multisampled_render_to_texture")===!1){let lt=!1;for(let Je=0,ft=G.length;Je<ft;Je++){const Rt=G[Je],Ot=Rt.object,kt=Rt.geometry,Mt=Rt.material,it=Rt.group;if(Mt.side===hn&&Ot.layers.test(Z.layers)){const Yt=Mt.side;Mt.side=_n,Mt.needsUpdate=!0,dn(Ot,J,Z,kt,Mt,it),Mt.side=Yt,Mt.needsUpdate=!0,lt=!0}}lt===!0&&(Re.updateMultisampleRenderTarget(ye),Re.updateRenderTargetMipmap(ye))}y.setRenderTarget(Xe),y.setClearColor(X,j),ot!==void 0&&(Z.viewport=ot),y.toneMapping=ze}function Zt(P,G,J){const Z=G.isScene===!0?G.overrideMaterial:null;for(let W=0,ye=P.length;W<ye;W++){const Ue=P[W],Xe=Ue.object,ze=Ue.geometry,ot=Ue.group;let lt=Ue.material;lt.allowOverride===!0&&Z!==null&&(lt=Z),Xe.layers.test(J.layers)&&dn(Xe,G,J,ze,lt,ot)}}function dn(P,G,J,Z,W,ye){P.onBeforeRender(y,G,J,Z,W,ye),P.modelViewMatrix.multiplyMatrices(J.matrixWorldInverse,P.matrixWorld),P.normalMatrix.getNormalMatrix(P.modelViewMatrix),W.onBeforeRender(y,G,J,Z,P,ye),W.transparent===!0&&W.side===hn&&W.forceSinglePass===!1?(W.side=_n,W.needsUpdate=!0,y.renderBufferDirect(J,G,Z,W,P,ye),W.side=$n,W.needsUpdate=!0,y.renderBufferDirect(J,G,Z,W,P,ye),W.side=hn):y.renderBufferDirect(J,G,Z,W,P,ye),P.onAfterRender(y,G,J,Z,W,ye)}function ei(P,G,J){G.isScene!==!0&&(G=Ct);const Z=Ie.get(P),W=p.state.lights,ye=p.state.shadowsArray,Ue=W.state.version,Xe=de.getParameters(P,W.state,ye,G,J),ze=de.getProgramCacheKey(Xe);let ot=Z.programs;Z.environment=P.isMeshStandardMaterial?G.environment:null,Z.fog=G.fog,Z.envMap=(P.isMeshStandardMaterial?F:pt).get(P.envMap||Z.environment),Z.envMapRotation=Z.environment!==null&&P.envMap===null?G.environmentRotation:P.envMapRotation,ot===void 0&&(P.addEventListener("dispose",He),ot=new Map,Z.programs=ot);let lt=ot.get(ze);if(lt!==void 0){if(Z.currentProgram===lt&&Z.lightsStateVersion===Ue)return Di(P,Xe),lt}else Xe.uniforms=de.getUniforms(P),P.onBeforeCompile(Xe,y),lt=de.acquireProgram(Xe,ze),ot.set(ze,lt),Z.uniforms=Xe.uniforms;const Je=Z.uniforms;return(!P.isShaderMaterial&&!P.isRawShaderMaterial||P.clipping===!0)&&(Je.clippingPlanes=Fe.uniform),Di(P,Xe),Z.needsLights=tr(P),Z.lightsStateVersion=Ue,Z.needsLights&&(Je.ambientLightColor.value=W.state.ambient,Je.lightProbe.value=W.state.probe,Je.directionalLights.value=W.state.directional,Je.directionalLightShadows.value=W.state.directionalShadow,Je.spotLights.value=W.state.spot,Je.spotLightShadows.value=W.state.spotShadow,Je.rectAreaLights.value=W.state.rectArea,Je.ltc_1.value=W.state.rectAreaLTC1,Je.ltc_2.value=W.state.rectAreaLTC2,Je.pointLights.value=W.state.point,Je.pointLightShadows.value=W.state.pointShadow,Je.hemisphereLights.value=W.state.hemi,Je.directionalShadowMap.value=W.state.directionalShadowMap,Je.directionalShadowMatrix.value=W.state.directionalShadowMatrix,Je.spotShadowMap.value=W.state.spotShadowMap,Je.spotLightMatrix.value=W.state.spotLightMatrix,Je.spotLightMap.value=W.state.spotLightMap,Je.pointShadowMap.value=W.state.pointShadowMap,Je.pointShadowMatrix.value=W.state.pointShadowMatrix),Z.currentProgram=lt,Z.uniformsList=null,lt}function Pi(P){if(P.uniformsList===null){const G=P.currentProgram.getUniforms();P.uniformsList=oa.seqWithValue(G.seq,P.uniforms)}return P.uniformsList}function Di(P,G){const J=Ie.get(P);J.outputColorSpace=G.outputColorSpace,J.batching=G.batching,J.batchingColor=G.batchingColor,J.instancing=G.instancing,J.instancingColor=G.instancingColor,J.instancingMorph=G.instancingMorph,J.skinning=G.skinning,J.morphTargets=G.morphTargets,J.morphNormals=G.morphNormals,J.morphColors=G.morphColors,J.morphTargetsCount=G.morphTargetsCount,J.numClippingPlanes=G.numClippingPlanes,J.numIntersection=G.numClipIntersection,J.vertexAlphas=G.vertexAlphas,J.vertexTangents=G.vertexTangents,J.toneMapping=G.toneMapping}function Qi(P,G,J,Z,W){G.isScene!==!0&&(G=Ct),Re.resetTextureUnits();const ye=G.fog,Ue=Z.isMeshStandardMaterial?G.environment:null,Xe=L===null?y.outputColorSpace:L.isXRRenderTarget===!0?L.texture.colorSpace:Ur,ze=(Z.isMeshStandardMaterial?F:pt).get(Z.envMap||Ue),ot=Z.vertexColors===!0&&!!J.attributes.color&&J.attributes.color.itemSize===4,lt=!!J.attributes.tangent&&(!!Z.normalMap||Z.anisotropy>0),Je=!!J.morphAttributes.position,ft=!!J.morphAttributes.normal,Rt=!!J.morphAttributes.color;let Ot=Ri;Z.toneMapped&&(L===null||L.isXRRenderTarget===!0)&&(Ot=y.toneMapping);const kt=J.morphAttributes.position||J.morphAttributes.normal||J.morphAttributes.color,Mt=kt!==void 0?kt.length:0,it=Ie.get(Z),Yt=p.state.lights;if(te===!0&&(se===!0||P!==x)){const qt=P===x&&Z.id===b;Fe.setState(Z,P,qt)}let Et=!1;Z.version===it.__version?(it.needsLights&&it.lightsStateVersion!==Yt.state.version||it.outputColorSpace!==Xe||W.isBatchedMesh&&it.batching===!1||!W.isBatchedMesh&&it.batching===!0||W.isBatchedMesh&&it.batchingColor===!0&&W.colorTexture===null||W.isBatchedMesh&&it.batchingColor===!1&&W.colorTexture!==null||W.isInstancedMesh&&it.instancing===!1||!W.isInstancedMesh&&it.instancing===!0||W.isSkinnedMesh&&it.skinning===!1||!W.isSkinnedMesh&&it.skinning===!0||W.isInstancedMesh&&it.instancingColor===!0&&W.instanceColor===null||W.isInstancedMesh&&it.instancingColor===!1&&W.instanceColor!==null||W.isInstancedMesh&&it.instancingMorph===!0&&W.morphTexture===null||W.isInstancedMesh&&it.instancingMorph===!1&&W.morphTexture!==null||it.envMap!==ze||Z.fog===!0&&it.fog!==ye||it.numClippingPlanes!==void 0&&(it.numClippingPlanes!==Fe.numPlanes||it.numIntersection!==Fe.numIntersection)||it.vertexAlphas!==ot||it.vertexTangents!==lt||it.morphTargets!==Je||it.morphNormals!==ft||it.morphColors!==Rt||it.toneMapping!==Ot||it.morphTargetsCount!==Mt)&&(Et=!0):(Et=!0,it.__version=Z.version);let vn=it.currentProgram;Et===!0&&(vn=ei(Z,G,W));let Bt=!1,en=!1,Ui=!1;const Nt=vn.getUniforms(),pn=it.uniforms;if(Q.useProgram(vn.program)&&(Bt=!0,en=!0,Ui=!0),Z.id!==b&&(b=Z.id,en=!0),Bt||x!==P){Q.buffers.depth.getReversed()?(le.copy(P.projectionMatrix),Wf(le),Xf(le),Nt.setValue(N,"projectionMatrix",le)):Nt.setValue(N,"projectionMatrix",P.projectionMatrix),Nt.setValue(N,"viewMatrix",P.matrixWorldInverse);const Kt=Nt.map.cameraPosition;Kt!==void 0&&Kt.setValue(N,st.setFromMatrixPosition(P.matrixWorld)),Te.logarithmicDepthBuffer&&Nt.setValue(N,"logDepthBufFC",2/(Math.log(P.far+1)/Math.LN2)),(Z.isMeshPhongMaterial||Z.isMeshToonMaterial||Z.isMeshLambertMaterial||Z.isMeshBasicMaterial||Z.isMeshStandardMaterial||Z.isShaderMaterial)&&Nt.setValue(N,"isOrthographic",P.isOrthographicCamera===!0),x!==P&&(x=P,en=!0,Ui=!0)}if(W.isSkinnedMesh){Nt.setOptional(N,W,"bindMatrix"),Nt.setOptional(N,W,"bindMatrixInverse");const qt=W.skeleton;qt&&(qt.boneTexture===null&&qt.computeBoneTexture(),Nt.setValue(N,"boneTexture",qt.boneTexture,Re))}W.isBatchedMesh&&(Nt.setOptional(N,W,"batchingTexture"),Nt.setValue(N,"batchingTexture",W._matricesTexture,Re),Nt.setOptional(N,W,"batchingIdTexture"),Nt.setValue(N,"batchingIdTexture",W._indirectTexture,Re),Nt.setOptional(N,W,"batchingColorTexture"),W._colorsTexture!==null&&Nt.setValue(N,"batchingColorTexture",W._colorsTexture,Re));const on=J.morphAttributes;if((on.position!==void 0||on.normal!==void 0||on.color!==void 0)&&Oe.update(W,J,vn),(en||it.receiveShadow!==W.receiveShadow)&&(it.receiveShadow=W.receiveShadow,Nt.setValue(N,"receiveShadow",W.receiveShadow)),Z.isMeshGouraudMaterial&&Z.envMap!==null&&(pn.envMap.value=ze,pn.flipEnvMap.value=ze.isCubeTexture&&ze.isRenderTargetTexture===!1?-1:1),Z.isMeshStandardMaterial&&Z.envMap===null&&G.environment!==null&&(pn.envMapIntensity.value=G.environmentIntensity),en&&(Nt.setValue(N,"toneMappingExposure",y.toneMappingExposure),it.needsLights&&er(pn,Ui),ye&&Z.fog===!0&&ne.refreshFogUniforms(pn,ye),ne.refreshMaterialUniforms(pn,Z,H,K,p.state.transmissionRenderTarget[P.id]),oa.upload(N,Pi(it),pn,Re)),Z.isShaderMaterial&&Z.uniformsNeedUpdate===!0&&(oa.upload(N,Pi(it),pn,Re),Z.uniformsNeedUpdate=!1),Z.isSpriteMaterial&&Nt.setValue(N,"center",W.center),Nt.setValue(N,"modelViewMatrix",W.modelViewMatrix),Nt.setValue(N,"normalMatrix",W.normalMatrix),Nt.setValue(N,"modelMatrix",W.matrixWorld),Z.isShaderMaterial||Z.isRawShaderMaterial){const qt=Z.uniformsGroups;for(let Kt=0,nr=qt.length;Kt<nr;Kt++){const ni=qt[Kt];V.update(ni,vn),V.bind(ni,vn)}}return vn}function er(P,G){P.ambientLightColor.needsUpdate=G,P.lightProbe.needsUpdate=G,P.directionalLights.needsUpdate=G,P.directionalLightShadows.needsUpdate=G,P.pointLights.needsUpdate=G,P.pointLightShadows.needsUpdate=G,P.spotLights.needsUpdate=G,P.spotLightShadows.needsUpdate=G,P.rectAreaLights.needsUpdate=G,P.hemisphereLights.needsUpdate=G}function tr(P){return P.isMeshLambertMaterial||P.isMeshToonMaterial||P.isMeshPhongMaterial||P.isMeshStandardMaterial||P.isShadowMaterial||P.isShaderMaterial&&P.lights===!0}this.getActiveCubeFace=function(){return R},this.getActiveMipmapLevel=function(){return C},this.getRenderTarget=function(){return L},this.setRenderTargetTextures=function(P,G,J){const Z=Ie.get(P);Z.__autoAllocateDepthBuffer=P.resolveDepthBuffer===!1,Z.__autoAllocateDepthBuffer===!1&&(Z.__useRenderToTexture=!1),Ie.get(P.texture).__webglTexture=G,Ie.get(P.depthTexture).__webglTexture=Z.__autoAllocateDepthBuffer?void 0:J,Z.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(P,G){const J=Ie.get(P);J.__webglFramebuffer=G,J.__useDefaultFramebuffer=G===void 0};const Li=N.createFramebuffer();this.setRenderTarget=function(P,G=0,J=0){L=P,R=G,C=J;let Z=!0,W=null,ye=!1,Ue=!1;if(P){const ze=Ie.get(P);if(ze.__useDefaultFramebuffer!==void 0)Q.bindFramebuffer(N.FRAMEBUFFER,null),Z=!1;else if(ze.__webglFramebuffer===void 0)Re.setupRenderTarget(P);else if(ze.__hasExternalTextures)Re.rebindTextures(P,Ie.get(P.texture).__webglTexture,Ie.get(P.depthTexture).__webglTexture);else if(P.depthBuffer){const Je=P.depthTexture;if(ze.__boundDepthTexture!==Je){if(Je!==null&&Ie.has(Je)&&(P.width!==Je.image.width||P.height!==Je.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");Re.setupDepthRenderbuffer(P)}}const ot=P.texture;(ot.isData3DTexture||ot.isDataArrayTexture||ot.isCompressedArrayTexture)&&(Ue=!0);const lt=Ie.get(P).__webglFramebuffer;P.isWebGLCubeRenderTarget?(Array.isArray(lt[G])?W=lt[G][J]:W=lt[G],ye=!0):P.samples>0&&Re.useMultisampledRTT(P)===!1?W=Ie.get(P).__webglMultisampledFramebuffer:Array.isArray(lt)?W=lt[J]:W=lt,w.copy(P.viewport),B.copy(P.scissor),z=P.scissorTest}else w.copy($).multiplyScalar(H).floor(),B.copy(xe).multiplyScalar(H).floor(),z=Ee;if(J!==0&&(W=Li),Q.bindFramebuffer(N.FRAMEBUFFER,W)&&Z&&Q.drawBuffers(P,W),Q.viewport(w),Q.scissor(B),Q.setScissorTest(z),ye){const ze=Ie.get(P.texture);N.framebufferTexture2D(N.FRAMEBUFFER,N.COLOR_ATTACHMENT0,N.TEXTURE_CUBE_MAP_POSITIVE_X+G,ze.__webglTexture,J)}else if(Ue){const ze=Ie.get(P.texture),ot=G;N.framebufferTextureLayer(N.FRAMEBUFFER,N.COLOR_ATTACHMENT0,ze.__webglTexture,J,ot)}else if(P!==null&&J!==0){const ze=Ie.get(P.texture);N.framebufferTexture2D(N.FRAMEBUFFER,N.COLOR_ATTACHMENT0,N.TEXTURE_2D,ze.__webglTexture,J)}b=-1},this.readRenderTargetPixels=function(P,G,J,Z,W,ye,Ue,Xe=0){if(!(P&&P.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let ze=Ie.get(P).__webglFramebuffer;if(P.isWebGLCubeRenderTarget&&Ue!==void 0&&(ze=ze[Ue]),ze){Q.bindFramebuffer(N.FRAMEBUFFER,ze);try{const ot=P.textures[Xe],lt=ot.format,Je=ot.type;if(!Te.textureFormatReadable(lt)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!Te.textureTypeReadable(Je)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}G>=0&&G<=P.width-Z&&J>=0&&J<=P.height-W&&(P.textures.length>1&&N.readBuffer(N.COLOR_ATTACHMENT0+Xe),N.readPixels(G,J,Z,W,we.convert(lt),we.convert(Je),ye))}finally{const ot=L!==null?Ie.get(L).__webglFramebuffer:null;Q.bindFramebuffer(N.FRAMEBUFFER,ot)}}},this.readRenderTargetPixelsAsync=async function(P,G,J,Z,W,ye,Ue,Xe=0){if(!(P&&P.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let ze=Ie.get(P).__webglFramebuffer;if(P.isWebGLCubeRenderTarget&&Ue!==void 0&&(ze=ze[Ue]),ze)if(G>=0&&G<=P.width-Z&&J>=0&&J<=P.height-W){Q.bindFramebuffer(N.FRAMEBUFFER,ze);const ot=P.textures[Xe],lt=ot.format,Je=ot.type;if(!Te.textureFormatReadable(lt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!Te.textureTypeReadable(Je))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const ft=N.createBuffer();N.bindBuffer(N.PIXEL_PACK_BUFFER,ft),N.bufferData(N.PIXEL_PACK_BUFFER,ye.byteLength,N.STREAM_READ),P.textures.length>1&&N.readBuffer(N.COLOR_ATTACHMENT0+Xe),N.readPixels(G,J,Z,W,we.convert(lt),we.convert(Je),0);const Rt=L!==null?Ie.get(L).__webglFramebuffer:null;Q.bindFramebuffer(N.FRAMEBUFFER,Rt);const Ot=N.fenceSync(N.SYNC_GPU_COMMANDS_COMPLETE,0);return N.flush(),await Gf(N,Ot,4),N.bindBuffer(N.PIXEL_PACK_BUFFER,ft),N.getBufferSubData(N.PIXEL_PACK_BUFFER,0,ye),N.deleteBuffer(ft),N.deleteSync(Ot),ye}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(P,G=null,J=0){const Z=Math.pow(2,-J),W=Math.floor(P.image.width*Z),ye=Math.floor(P.image.height*Z),Ue=G!==null?G.x:0,Xe=G!==null?G.y:0;Re.setTexture2D(P,0),N.copyTexSubImage2D(N.TEXTURE_2D,J,0,0,Ue,Xe,W,ye),Q.unbindTexture()};const fn=N.createFramebuffer(),ti=N.createFramebuffer();this.copyTextureToTexture=function(P,G,J=null,Z=null,W=0,ye=null){ye===null&&(W!==0?(Rr("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),ye=W,W=0):ye=0);let Ue,Xe,ze,ot,lt,Je,ft,Rt,Ot;const kt=P.isCompressedTexture?P.mipmaps[ye]:P.image;if(J!==null)Ue=J.max.x-J.min.x,Xe=J.max.y-J.min.y,ze=J.isBox3?J.max.z-J.min.z:1,ot=J.min.x,lt=J.min.y,Je=J.isBox3?J.min.z:0;else{const on=Math.pow(2,-W);Ue=Math.floor(kt.width*on),Xe=Math.floor(kt.height*on),P.isDataArrayTexture?ze=kt.depth:P.isData3DTexture?ze=Math.floor(kt.depth*on):ze=1,ot=0,lt=0,Je=0}Z!==null?(ft=Z.x,Rt=Z.y,Ot=Z.z):(ft=0,Rt=0,Ot=0);const Mt=we.convert(G.format),it=we.convert(G.type);let Yt;G.isData3DTexture?(Re.setTexture3D(G,0),Yt=N.TEXTURE_3D):G.isDataArrayTexture||G.isCompressedArrayTexture?(Re.setTexture2DArray(G,0),Yt=N.TEXTURE_2D_ARRAY):(Re.setTexture2D(G,0),Yt=N.TEXTURE_2D),N.pixelStorei(N.UNPACK_FLIP_Y_WEBGL,G.flipY),N.pixelStorei(N.UNPACK_PREMULTIPLY_ALPHA_WEBGL,G.premultiplyAlpha),N.pixelStorei(N.UNPACK_ALIGNMENT,G.unpackAlignment);const Et=N.getParameter(N.UNPACK_ROW_LENGTH),vn=N.getParameter(N.UNPACK_IMAGE_HEIGHT),Bt=N.getParameter(N.UNPACK_SKIP_PIXELS),en=N.getParameter(N.UNPACK_SKIP_ROWS),Ui=N.getParameter(N.UNPACK_SKIP_IMAGES);N.pixelStorei(N.UNPACK_ROW_LENGTH,kt.width),N.pixelStorei(N.UNPACK_IMAGE_HEIGHT,kt.height),N.pixelStorei(N.UNPACK_SKIP_PIXELS,ot),N.pixelStorei(N.UNPACK_SKIP_ROWS,lt),N.pixelStorei(N.UNPACK_SKIP_IMAGES,Je);const Nt=P.isDataArrayTexture||P.isData3DTexture,pn=G.isDataArrayTexture||G.isData3DTexture;if(P.isDepthTexture){const on=Ie.get(P),qt=Ie.get(G),Kt=Ie.get(on.__renderTarget),nr=Ie.get(qt.__renderTarget);Q.bindFramebuffer(N.READ_FRAMEBUFFER,Kt.__webglFramebuffer),Q.bindFramebuffer(N.DRAW_FRAMEBUFFER,nr.__webglFramebuffer);for(let ni=0;ni<ze;ni++)Nt&&(N.framebufferTextureLayer(N.READ_FRAMEBUFFER,N.COLOR_ATTACHMENT0,Ie.get(P).__webglTexture,W,Je+ni),N.framebufferTextureLayer(N.DRAW_FRAMEBUFFER,N.COLOR_ATTACHMENT0,Ie.get(G).__webglTexture,ye,Ot+ni)),N.blitFramebuffer(ot,lt,Ue,Xe,ft,Rt,Ue,Xe,N.DEPTH_BUFFER_BIT,N.NEAREST);Q.bindFramebuffer(N.READ_FRAMEBUFFER,null),Q.bindFramebuffer(N.DRAW_FRAMEBUFFER,null)}else if(W!==0||P.isRenderTargetTexture||Ie.has(P)){const on=Ie.get(P),qt=Ie.get(G);Q.bindFramebuffer(N.READ_FRAMEBUFFER,fn),Q.bindFramebuffer(N.DRAW_FRAMEBUFFER,ti);for(let Kt=0;Kt<ze;Kt++)Nt?N.framebufferTextureLayer(N.READ_FRAMEBUFFER,N.COLOR_ATTACHMENT0,on.__webglTexture,W,Je+Kt):N.framebufferTexture2D(N.READ_FRAMEBUFFER,N.COLOR_ATTACHMENT0,N.TEXTURE_2D,on.__webglTexture,W),pn?N.framebufferTextureLayer(N.DRAW_FRAMEBUFFER,N.COLOR_ATTACHMENT0,qt.__webglTexture,ye,Ot+Kt):N.framebufferTexture2D(N.DRAW_FRAMEBUFFER,N.COLOR_ATTACHMENT0,N.TEXTURE_2D,qt.__webglTexture,ye),W!==0?N.blitFramebuffer(ot,lt,Ue,Xe,ft,Rt,Ue,Xe,N.COLOR_BUFFER_BIT,N.NEAREST):pn?N.copyTexSubImage3D(Yt,ye,ft,Rt,Ot+Kt,ot,lt,Ue,Xe):N.copyTexSubImage2D(Yt,ye,ft,Rt,ot,lt,Ue,Xe);Q.bindFramebuffer(N.READ_FRAMEBUFFER,null),Q.bindFramebuffer(N.DRAW_FRAMEBUFFER,null)}else pn?P.isDataTexture||P.isData3DTexture?N.texSubImage3D(Yt,ye,ft,Rt,Ot,Ue,Xe,ze,Mt,it,kt.data):G.isCompressedArrayTexture?N.compressedTexSubImage3D(Yt,ye,ft,Rt,Ot,Ue,Xe,ze,Mt,kt.data):N.texSubImage3D(Yt,ye,ft,Rt,Ot,Ue,Xe,ze,Mt,it,kt):P.isDataTexture?N.texSubImage2D(N.TEXTURE_2D,ye,ft,Rt,Ue,Xe,Mt,it,kt.data):P.isCompressedTexture?N.compressedTexSubImage2D(N.TEXTURE_2D,ye,ft,Rt,kt.width,kt.height,Mt,kt.data):N.texSubImage2D(N.TEXTURE_2D,ye,ft,Rt,Ue,Xe,Mt,it,kt);N.pixelStorei(N.UNPACK_ROW_LENGTH,Et),N.pixelStorei(N.UNPACK_IMAGE_HEIGHT,vn),N.pixelStorei(N.UNPACK_SKIP_PIXELS,Bt),N.pixelStorei(N.UNPACK_SKIP_ROWS,en),N.pixelStorei(N.UNPACK_SKIP_IMAGES,Ui),ye===0&&G.generateMipmaps&&N.generateMipmap(Yt),Q.unbindTexture()},this.copyTextureToTexture3D=function(P,G,J=null,Z=null,W=0){return Rr('WebGLRenderer: copyTextureToTexture3D function has been deprecated. Use "copyTextureToTexture" instead.'),this.copyTextureToTexture(P,G,J,Z,W)},this.initRenderTarget=function(P){Ie.get(P).__webglFramebuffer===void 0&&Re.setupRenderTarget(P)},this.initTexture=function(P){P.isCubeTexture?Re.setTextureCube(P,0):P.isData3DTexture?Re.setTexture3D(P,0):P.isDataArrayTexture||P.isCompressedArrayTexture?Re.setTexture2DArray(P,0):Re.setTexture2D(P,0),Q.unbindTexture()},this.resetState=function(){R=0,C=0,L=null,Q.reset(),at.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return di}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=vt._getDrawingBufferColorSpace(e),t.unpackColorSpace=vt._getUnpackColorSpace()}}var Lv=Object.defineProperty,Uv=(r,e,t)=>e in r?Lv(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Pt=(r,e,t)=>Uv(r,typeof e!="symbol"?e+"":e,t);const Lh=(r,e)=>{const[t,n]=e.split("-");return Object.assign(r.style,{left:n==="left"?"0":n==="center"?"50%":"",right:n==="right"?"0":"",top:t==="top"?"0":t==="bottom"?"":"50%",bottom:t==="bottom"?"0":"",transform:`${n==="center"?"translateX(-50%)":""} ${t==="center"?"translateY(-50%)":""}`}),e},Iv=({placement:r,size:e,offset:t,id:n,className:i})=>{const s=document.createElement("div"),{top:a,left:o,right:l,bottom:c}=t;return Object.assign(s.style,{id:n,position:"absolute",zIndex:"1000",height:`${e}px`,width:`${e}px`,margin:`${a}px ${l}px ${c}px ${o}px`,borderRadius:"100%"}),Lh(s,r),n&&(s.id=n),i&&(s.className=i),s},Nv=r=>{const e=typeof r=="string"?document.querySelector(r):r;if(!e)throw Error("Invalid DOM element");return e};function dl(r,e,t){return Math.max(e,Math.min(t,r))}const Fv=[["x",0,3],["y",1,4],["z",2,5]],Su=new k;function Mu({isSphere:r},e,t){r&&(Su.set(0,0,1).applyQuaternion(t.quaternion),Fv.forEach(([n,i,s])=>{const a=Su[n];let o=e[i],l=o.userData.opacity;o.material.opacity=dl(a>=0?l:l/2,0,1),o=e[s],l=o.userData.opacity,o.material.opacity=dl(a>=0?l/2:l,0,1)}))}const Ov=(r,e,t=10)=>Math.abs(r.clientX-e.x)<t&&Math.abs(r.clientY-e.y)<t,bu=new qp,Eu=new dt,Tu=(r,e,t,n)=>{Eu.set((r.clientX-e.left)/e.width*2-1,-((r.clientY-e.top)/e.height)*2+1),bu.setFromCamera(Eu,t);const i=bu.intersectObjects(n,!1),s=i.length?i[0]:null;return!s||!s.object.visible?null:s},ho=1e-6,Bv=2*Math.PI,Uh=["x","y","z"],us=[...Uh,"nx","ny","nz"],kv=["x","z","y","nx","nz","ny"],zv=["z","x","y","nz","nx","ny"],fl="Right",la="Top",pl="Front",ml="Left",ca="Bottom",gl="Back",Vv=[fl,la,pl,ml,ca,gl].map(r=>r.toLocaleLowerCase()),Ih=1.3,wu=(r,e=!0)=>{const{material:t,userData:n}=r,{color:i,opacity:s}=e?n.hover:n;t.color.set(i),t.opacity=s},zi=r=>JSON.parse(JSON.stringify(r)),Hv=r=>{const e=r.type||"sphere",t=e==="sphere",n=r.resolution||t?64:128,i=Ft.DEFAULT_UP,s=i.z===1,a=i.x===1,{container:o}=r;r.container=void 0,r=JSON.parse(JSON.stringify(r)),r.container=o;const l=s?kv:a?zv:us;Vv.forEach((d,f)=>{r[d]&&(r[l[f]]=r[d])});const c={enabled:!0,color:16777215,opacity:1,scale:.7,labelColor:2236962,line:!1,border:{size:0,color:14540253},hover:{color:t?16777215:9688043,labelColor:2236962,opacity:1,scale:.7,border:{size:0,color:14540253}}},u={line:!1,scale:t?.45:.7,hover:{scale:t?.5:.7}},h={type:e,container:document.body,size:128,placement:"top-right",resolution:n,lineWidth:4,radius:t?1:.2,smoothness:18,animated:!0,speed:1,background:{enabled:!0,color:t?16777215:14739180,opacity:t?0:1,hover:{color:t?16777215:14739180,opacity:t?.2:1}},font:{family:"sans-serif",weight:900},offset:{top:10,left:10,bottom:10,right:10},corners:{enabled:!t,color:t?15915362:16777215,opacity:1,scale:t?.15:.2,radius:1,smoothness:18,hover:{color:t?16777215:9688043,opacity:1,scale:t?.2:.225}},edges:{enabled:!t,color:t?15915362:16777215,opacity:t?1:0,radius:t?1:.125,smoothness:18,scale:t?.15:1,hover:{color:t?16777215:9688043,opacity:1,scale:t?.2:1}},x:{...zi(c),...t?{label:"X",color:16725587,line:!0}:{label:a?la:fl}},y:{...zi(c),...t?{label:"Y",color:9100032,line:!0}:{label:s||a?pl:la}},z:{...zi(c),...t?{label:"Z",color:2920447,line:!0}:{label:s?la:a?fl:pl}},nx:{...zi(u),label:t?"":a?ca:ml},ny:{...zi(u),label:t?"":s||a?gl:ca},nz:{...zi(u),label:t?"":s?ca:a?ml:gl}};return _l(r,h),Uh.forEach(d=>_l(r[`n${d}`],zi(r[d]))),{...r,isSphere:t}};function _l(r,...e){if(r instanceof HTMLElement||typeof r!="object"||r===null)return r;for(const t of e)for(const n in t)n!=="container"&&n in t&&(r[n]===void 0?r[n]=t[n]:typeof t[n]=="object"&&!Array.isArray(t[n])&&(r[n]=_l(r[n]||{},t[n])));return r}const Gv=(r,e=2)=>{const t=new ht,n=e*2,{isSphere:i,resolution:s,radius:a,font:o,corners:l,edges:c}=r,u=us.map(C=>({...r[C],radius:a}));i&&l.enabled&&u.push(l),i&&c.enabled&&u.push(c);const h=document.createElement("canvas"),d=h.getContext("2d");h.width=s*2+n*2,h.height=s*u.length+n*u.length;const[f,m]=I(u,s,o);u.forEach(({radius:C,label:L,color:b,labelColor:x,border:w,hover:{color:B,labelColor:z,border:X}},j)=>{const O=s*j+j*n+e;y(e,O,e,s,C,L,w,b,x),y(s+e*3,O,e,s,C,L,X??w,B??b,z??x)});const _=u.length,g=e/(s*2),p=e/(s*6),M=1/_,E=new Sp(h);return E.repeat.set(.5-2*g,M-2*p),E.offset.set(g,1-p),Object.assign(E,{colorSpace:At,wrapS:jn,wrapT:jn,userData:{offsetX:g,offsetY:p,cellHeight:M}}),E;function y(C,L,b,x,w,B,z,X,j){if(w=w*(x/2),X!=null&&X!==""&&(O(),d.fillStyle=t.set(X).getStyle(),d.fill()),z&&z.size){const K=z.size*x/2;C+=K,L+=K,x-=z.size*x,w=Math.max(0,w-K),O(),d.strokeStyle=t.set(z.color).getStyle(),d.lineWidth=z.size*x,d.stroke()}B&&R(d,C+x/2,L+(x+b)/2,B,t.set(j).getStyle());function O(){d.beginPath(),d.moveTo(C+w,L),d.lineTo(C+x-w,L),d.arcTo(C+x,L,C+x,L+w,w),d.lineTo(C+x,L+x-w),d.arcTo(C+x,L+x,C+x-w,L+x,w),d.lineTo(C+w,L+x),d.arcTo(C,L+x,C,L+x-w,w),d.lineTo(C,L+w),d.arcTo(C,L,C+w,L,w),d.closePath()}}function I(C,L,b){const x=[...C].sort((oe,$)=>{var xe,Ee;return(((xe=oe.label)==null?void 0:xe.length)||0)-(((Ee=$.label)==null?void 0:Ee.length)||0)}).pop().label,{family:w,weight:B}=b,z=i?Math.sqrt(Math.pow(L*.7,2)/2):L;let X=z,j=0,O=0;do{d.font=`${B} ${X}px ${w}`;const oe=d.measureText(x);j=oe.width,O=oe.fontBoundingBoxDescent,X--}while(j>z&&X>0);const K=z/O,H=Math.min(z/j,K),ie=Math.floor(X*H);return[`${B} ${ie}px ${w}`,K]}function R(C,L,b,x,w){C.font=f,C.textAlign="center",C.textBaseline="middle",C.fillStyle=w,C.fillText(x,L,b+(i?m:0))}},Wv=(r,e)=>r.offset.x=(e?.5:0)+r.userData.offsetX,Gl=(r,e)=>{const{offset:t,userData:{offsetY:n,cellHeight:i}}=r;t.y=1-(e+1)*i+n};function Wl(r,e,t=2,n=2){const i=t/2-r,s=n/2-r,a=r/t,o=(t-r)/t,l=r/n,c=(n-r)/n,u=[i,s,0,-i,s,0,-i,-s,0,i,-s,0],h=[o,c,a,c,a,l,o,l],d=[3*(e+1)+3,3*(e+1)+4,e+4,e+5,2*(e+1)+4,2,1,2*(e+1)+3,3,4*(e+1)+3,4,0],f=[0,1,2,0,2,3,4,5,6,4,6,7,8,9,10,8,10,11].map(R=>d[R]);let m,_,g,p,M,E,y,I;for(let R=0;R<4;R++){p=R<1||R>2?i:-i,M=R<2?s:-s,E=R<1||R>2?o:a,y=R<2?c:l;for(let C=0;C<=e;C++)m=Math.PI/2*(R+C/e),_=Math.cos(m),g=Math.sin(m),u.push(p+r*_,M+r*g,0),h.push(E+a*_,y+l*g),C<e&&(I=(e+1)*R+C+4,f.push(R,I,I+1))}return new Vt().setIndex(new Xt(new Uint32Array(f),1)).setAttribute("position",new Xt(new Float32Array(u),3)).setAttribute("uv",new Xt(new Float32Array(h),2))}const Xv=(r,e)=>{const t=new k,{isSphere:n,radius:i,smoothness:s}=r,a=Wl(i,s);return us.map((o,l)=>{const c=l<3,u=us[l],h=l?e.clone():e;Gl(h,l);const{enabled:d,scale:f,opacity:m,hover:_}=r[u],g={map:h,opacity:m,transparent:!0},p=n?new Ul(new Ma(g)):new Ut(a,new Ci(g)),M=c?u:u[1];return p.position[M]=(c?1:-1)*(n?Ih:1),n||p.lookAt(t.copy(p.position).multiplyScalar(1.7)),p.scale.setScalar(f),p.renderOrder=1,p.visible=d,p.userData={scale:f,opacity:m,hover:_},p})},qv=(r,e)=>{const{isSphere:t,corners:n}=r;if(!n.enabled)return[];const{color:i,opacity:s,scale:a,radius:o,smoothness:l,hover:c}=n,u=t?null:Wl(o,l),h={transparent:!0,opacity:s},d=[1,1,1,-1,1,1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,-1,-1,-1,-1,-1].map(m=>m*.85),f=new k;return Array(d.length/3).fill(0).map((m,_)=>{if(t){const M=e.clone();Gl(M,6),h.map=M}else h.color=i;const g=t?new Ul(new Ma(h)):new Ut(u,new Ci(h)),p=_*3;return g.position.set(d[p],d[p+1],d[p+2]),t&&g.position.normalize().multiplyScalar(1.7),g.scale.setScalar(a),g.lookAt(f.copy(g.position).multiplyScalar(2)),g.renderOrder=1,g.userData={color:i,opacity:s,scale:a,hover:c},g})},jv=(r,e,t)=>{const{isSphere:n,edges:i}=r;if(!i.enabled)return[];const{color:s,opacity:a,scale:o,hover:l,radius:c,smoothness:u}=i,h=n?null:Wl(c,u,1.2,.25),d={transparent:!0,opacity:a},f=[0,1,1,0,-1,1,1,0,1,-1,0,1,0,1,-1,0,-1,-1,1,0,-1,-1,0,-1,1,1,0,1,-1,0,-1,1,0,-1,-1,0].map(g=>g*.925),m=new k,_=new k(0,1,0);return Array(f.length/3).fill(0).map((g,p)=>{if(n){const y=e.clone();Gl(y,t),d.map=y}else d.color=s;const M=n?new Ul(new Ma(d)):new Ut(h,new Ci(d)),E=p*3;return M.position.set(f[E],f[E+1],f[E+2]),n&&M.position.normalize().multiplyScalar(1.7),M.scale.setScalar(o),M.up.copy(_),M.lookAt(m.copy(M.position).multiplyScalar(2)),!n&&!M.position.y&&(M.rotation.z=Math.PI/2),M.renderOrder=1,M.userData={color:s,opacity:a,scale:o,hover:l},M})};function Yv(r,e=!1){const t=r[0].index!==null,n=new Set(Object.keys(r[0].attributes)),i=new Set(Object.keys(r[0].morphAttributes)),s={},a={},o=r[0].morphTargetsRelative,l=new Vt;let c=0;for(let u=0;u<r.length;++u){const h=r[u];let d=0;if(t!==(h.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(const f in h.attributes){if(!n.has(f))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+'. All geometries must have compatible attributes; make sure "'+f+'" attribute exists among all geometries, or in none of them.'),null;s[f]===void 0&&(s[f]=[]),s[f].push(h.attributes[f]),d++}if(d!==n.size)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". Make sure all geometries have the same number of attributes."),null;if(o!==h.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(const f in h.morphAttributes){if(!i.has(f))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". .morphAttributes must be consistent throughout all geometries."),null;a[f]===void 0&&(a[f]=[]),a[f].push(h.morphAttributes[f])}if(e){let f;if(t)f=h.index.count;else if(h.attributes.position!==void 0)f=h.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". The geometry must have either an index or a position attribute"),null;l.addGroup(c,f,u),c+=f}}if(t){let u=0;const h=[];for(let d=0;d<r.length;++d){const f=r[d].index;for(let m=0;m<f.count;++m)h.push(f.getX(m)+u);u+=r[d].attributes.position.count}l.setIndex(h)}for(const u in s){const h=Au(s[u]);if(!h)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+u+" attribute."),null;l.setAttribute(u,h)}for(const u in a){const h=a[u][0].length;if(h===0)break;l.morphAttributes=l.morphAttributes||{},l.morphAttributes[u]=[];for(let d=0;d<h;++d){const f=[];for(let _=0;_<a[u].length;++_)f.push(a[u][_][d]);const m=Au(f);if(!m)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+u+" morphAttribute."),null;l.morphAttributes[u].push(m)}}return l}function Au(r){let e,t,n,i=-1,s=0;for(let c=0;c<r.length;++c){const u=r[c];if(e===void 0&&(e=u.array.constructor),e!==u.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(t===void 0&&(t=u.itemSize),t!==u.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(n===void 0&&(n=u.normalized),n!==u.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if(i===-1&&(i=u.gpuType),i!==u.gpuType)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."),null;s+=u.count*t}const a=new e(s),o=new Xt(a,t,n);let l=0;for(let c=0;c<r.length;++c){const u=r[c];if(u.isInterleavedBufferAttribute){const h=l/t;for(let d=0,f=u.count;d<f;d++)for(let m=0;m<t;m++){const _=u.getComponent(d,m);o.setComponent(d+h,m,_)}}else a.set(u.array,l);l+=u.count*t}return i!==void 0&&(o.gpuType=i),o}const Kv=(r,e)=>{const{isSphere:t,background:{enabled:n,color:i,opacity:s,hover:a}}=e;let o;const l=new Ci({color:i,side:_n,opacity:s,transparent:!0,depthWrite:!1});if(!n)return null;if(t)o=new Ut(new ba(1.8,64,64),l);else{let c;r.forEach(u=>{const h=u.scale.x;u.scale.setScalar(.9),u.updateMatrix();const d=u.geometry.clone();d.applyMatrix4(u.matrix),c=c?Yv([c,d]):d,u.scale.setScalar(h)}),o=new Ut(c,l)}return o.userData={color:i,opacity:s,hover:a},o},Ru=new Zn,Ys=new k;class Nh extends Gp{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry";const e=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],t=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],n=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];this.setIndex(n),this.setAttribute("position",new xt(e,3)),this.setAttribute("uv",new xt(t,2))}applyMatrix4(e){const t=this.attributes.instanceStart,n=this.attributes.instanceEnd;return t!==void 0&&(t.applyMatrix4(e),n.applyMatrix4(e),t.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));const n=new cl(t,6,1);return this.setAttribute("instanceStart",new Kn(n,3,0)),this.setAttribute("instanceEnd",new Kn(n,3,3)),this.instanceCount=this.attributes.instanceStart.count,this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));const n=new cl(t,6,1);return this.setAttribute("instanceColorStart",new Kn(n,3,0)),this.setAttribute("instanceColorEnd",new Kn(n,3,3)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(e){return this.fromWireframeGeometry(new Mp(e.geometry)),this}fromLineSegments(e){const t=e.geometry;return this.setPositions(t.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Zn);const e=this.attributes.instanceStart,t=this.attributes.instanceEnd;e!==void 0&&t!==void 0&&(this.boundingBox.setFromBufferAttribute(e),Ru.setFromBufferAttribute(t),this.boundingBox.union(Ru))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new _i),this.boundingBox===null&&this.computeBoundingBox();const e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(e!==void 0&&t!==void 0){const n=this.boundingSphere.center;this.boundingBox.getCenter(n);let i=0;for(let s=0,a=e.count;s<a;s++)Ys.fromBufferAttribute(e,s),i=Math.max(i,n.distanceToSquared(Ys)),Ys.fromBufferAttribute(t,s),i=Math.max(i,n.distanceToSquared(Ys));this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}applyMatrix(e){return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."),this.applyMatrix4(e)}}Ce.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new dt(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}};Mn.line={uniforms:Dl.merge([Ce.common,Ce.fog,Ce.line]),vertexShader:`
|
|
3827
|
+
}`;class Tv{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,n){if(this.texture===null){const i=new an,s=e.properties.get(i);s.__webglTexture=t.texture,(t.depthNear!==n.depthNear||t.depthFar!==n.depthFar)&&(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=i}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,n=new gi({vertexShader:bv,fragmentShader:Ev,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new Ut(new ds(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class wv extends Zi{constructor(e,t){super();const n=this;let i=null,s=1,a=null,o="local-floor",l=1,c=null,u=null,h=null,d=null,f=null,m=null;const _=new Tv,g=t.getContextAttributes();let p=null,M=null;const E=[],y=[],I=new dt;let R=null;const C=new sn;C.viewport=new St;const L=new sn;L.viewport=new St;const b=[C,L],x=new Gp;let w=null,B=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(q){let te=E[q];return te===void 0&&(te=new Ja,E[q]=te),te.getTargetRaySpace()},this.getControllerGrip=function(q){let te=E[q];return te===void 0&&(te=new Ja,E[q]=te),te.getGripSpace()},this.getHand=function(q){let te=E[q];return te===void 0&&(te=new Ja,E[q]=te),te.getHandSpace()};function z(q){const te=y.indexOf(q.inputSource);if(te===-1)return;const se=E[te];se!==void 0&&(se.update(q.inputSource,q.frame,c||a),se.dispatchEvent({type:q.type,data:q.inputSource}))}function X(){i.removeEventListener("select",z),i.removeEventListener("selectstart",z),i.removeEventListener("selectend",z),i.removeEventListener("squeeze",z),i.removeEventListener("squeezestart",z),i.removeEventListener("squeezeend",z),i.removeEventListener("end",X),i.removeEventListener("inputsourceschange",j);for(let q=0;q<E.length;q++){const te=y[q];te!==null&&(y[q]=null,E[q].disconnect(te))}w=null,B=null,_.reset(),e.setRenderTarget(p),f=null,d=null,h=null,i=null,M=null,Ee.stop(),n.isPresenting=!1,e.setPixelRatio(R),e.setSize(I.width,I.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(q){s=q,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(q){o=q,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||a},this.setReferenceSpace=function(q){c=q},this.getBaseLayer=function(){return d!==null?d:f},this.getBinding=function(){return h},this.getFrame=function(){return m},this.getSession=function(){return i},this.setSession=async function(q){if(i=q,i!==null){if(p=e.getRenderTarget(),i.addEventListener("select",z),i.addEventListener("selectstart",z),i.addEventListener("selectend",z),i.addEventListener("squeeze",z),i.addEventListener("squeezestart",z),i.addEventListener("squeezeend",z),i.addEventListener("end",X),i.addEventListener("inputsourceschange",j),g.xrCompatible!==!0&&await t.makeXRCompatible(),R=e.getPixelRatio(),e.getSize(I),typeof XRWebGLBinding<"u"&&"createProjectionLayer"in XRWebGLBinding.prototype){let se=null,le=null,be=null;g.depth&&(be=g.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,se=g.stencil?ls:os,le=g.stencil?as:$i);const st={colorFormat:t.RGBA8,depthFormat:be,scaleFactor:s};h=new XRWebGLBinding(i,t),d=h.createProjectionLayer(st),i.updateRenderState({layers:[d]}),e.setPixelRatio(1),e.setSize(d.textureWidth,d.textureHeight,!1),M=new Ji(d.textureWidth,d.textureHeight,{format:In,type:Jn,depthTexture:new xh(d.textureWidth,d.textureHeight,le,void 0,void 0,void 0,void 0,void 0,void 0,se),stencilBuffer:g.stencil,colorSpace:e.outputColorSpace,samples:g.antialias?4:0,resolveDepthBuffer:d.ignoreDepthValues===!1,resolveStencilBuffer:d.ignoreDepthValues===!1})}else{const se={antialias:g.antialias,alpha:!0,depth:g.depth,stencil:g.stencil,framebufferScaleFactor:s};f=new XRWebGLLayer(i,t,se),i.updateRenderState({baseLayer:f}),e.setPixelRatio(1),e.setSize(f.framebufferWidth,f.framebufferHeight,!1),M=new Ji(f.framebufferWidth,f.framebufferHeight,{format:In,type:Jn,colorSpace:e.outputColorSpace,stencilBuffer:g.stencil,resolveDepthBuffer:f.ignoreDepthValues===!1,resolveStencilBuffer:f.ignoreDepthValues===!1})}M.isXRRenderTarget=!0,this.setFoveation(l),c=null,a=await i.requestReferenceSpace(o),Ee.setContext(i),Ee.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(i!==null)return i.environmentBlendMode},this.getDepthTexture=function(){return _.getDepthTexture()};function j(q){for(let te=0;te<q.removed.length;te++){const se=q.removed[te],le=y.indexOf(se);le>=0&&(y[le]=null,E[le].disconnect(se))}for(let te=0;te<q.added.length;te++){const se=q.added[te];let le=y.indexOf(se);if(le===-1){for(let st=0;st<E.length;st++)if(st>=y.length){y.push(se),le=st;break}else if(y[st]===null){y[st]=se,le=st;break}if(le===-1)break}const be=E[le];be&&be.connect(se)}}const O=new k,K=new k;function H(q,te,se){O.setFromMatrixPosition(te.matrixWorld),K.setFromMatrixPosition(se.matrixWorld);const le=O.distanceTo(K),be=te.projectionMatrix.elements,st=se.projectionMatrix.elements,Ke=be[14]/(be[10]-1),Ct=be[14]/(be[10]+1),ae=(be[9]+1)/be[5],_e=(be[9]-1)/be[5],N=(be[8]-1)/be[0],We=(st[8]+1)/st[0],Me=Ke*N,Te=Ke*We,Q=le/(-N+We),Be=Q*-N;if(te.matrixWorld.decompose(q.position,q.quaternion,q.scale),q.translateX(Be),q.translateZ(Q),q.matrixWorld.compose(q.position,q.quaternion,q.scale),q.matrixWorldInverse.copy(q.matrixWorld).invert(),be[10]===-1)q.projectionMatrix.copy(te.projectionMatrix),q.projectionMatrixInverse.copy(te.projectionMatrixInverse);else{const Ie=Ke+Q,Re=Ct+Q,pt=Me-Be,F=Te+(le-Be),T=ae*Ct/Re*Ie,Y=_e*Ct/Re*Ie;q.projectionMatrix.makePerspective(pt,F,T,Y,Ie,Re),q.projectionMatrixInverse.copy(q.projectionMatrix).invert()}}function re(q,te){te===null?q.matrixWorld.copy(q.matrix):q.matrixWorld.multiplyMatrices(te.matrixWorld,q.matrix),q.matrixWorldInverse.copy(q.matrixWorld).invert()}this.updateCamera=function(q){if(i===null)return;let te=q.near,se=q.far;_.texture!==null&&(_.depthNear>0&&(te=_.depthNear),_.depthFar>0&&(se=_.depthFar)),x.near=L.near=C.near=te,x.far=L.far=C.far=se,(w!==x.near||B!==x.far)&&(i.updateRenderState({depthNear:x.near,depthFar:x.far}),w=x.near,B=x.far),C.layers.mask=q.layers.mask|2,L.layers.mask=q.layers.mask|4,x.layers.mask=C.layers.mask|L.layers.mask;const le=q.parent,be=x.cameras;re(x,le);for(let st=0;st<be.length;st++)re(be[st],le);be.length===2?H(x,C,L):x.projectionMatrix.copy(C.projectionMatrix),oe(q,x,le)};function oe(q,te,se){se===null?q.matrix.copy(te.matrixWorld):(q.matrix.copy(se.matrixWorld),q.matrix.invert(),q.matrix.multiply(te.matrixWorld)),q.matrix.decompose(q.position,q.quaternion,q.scale),q.updateMatrixWorld(!0),q.projectionMatrix.copy(te.projectionMatrix),q.projectionMatrixInverse.copy(te.projectionMatrixInverse),q.isPerspectiveCamera&&(q.fov=Ir*2*Math.atan(1/q.projectionMatrix.elements[5]),q.zoom=1)}this.getCamera=function(){return x},this.getFoveation=function(){if(!(d===null&&f===null))return l},this.setFoveation=function(q){l=q,d!==null&&(d.fixedFoveation=q),f!==null&&f.fixedFoveation!==void 0&&(f.fixedFoveation=q)},this.hasDepthSensing=function(){return _.texture!==null},this.getDepthSensingMesh=function(){return _.getMesh(x)};let $=null;function xe(q,te){if(u=te.getViewerPose(c||a),m=te,u!==null){const se=u.views;f!==null&&(e.setRenderTargetFramebuffer(M,f.framebuffer),e.setRenderTarget(M));let le=!1;se.length!==x.cameras.length&&(x.cameras.length=0,le=!0);for(let Ke=0;Ke<se.length;Ke++){const Ct=se[Ke];let ae=null;if(f!==null)ae=f.getViewport(Ct);else{const N=h.getViewSubImage(d,Ct);ae=N.viewport,Ke===0&&(e.setRenderTargetTextures(M,N.colorTexture,N.depthStencilTexture),e.setRenderTarget(M))}let _e=b[Ke];_e===void 0&&(_e=new sn,_e.layers.enable(Ke),_e.viewport=new St,b[Ke]=_e),_e.matrix.fromArray(Ct.transform.matrix),_e.matrix.decompose(_e.position,_e.quaternion,_e.scale),_e.projectionMatrix.fromArray(Ct.projectionMatrix),_e.projectionMatrixInverse.copy(_e.projectionMatrix).invert(),_e.viewport.set(ae.x,ae.y,ae.width,ae.height),Ke===0&&(x.matrix.copy(_e.matrix),x.matrix.decompose(x.position,x.quaternion,x.scale)),le===!0&&x.cameras.push(_e)}const be=i.enabledFeatures;if(be&&be.includes("depth-sensing")&&i.depthUsage=="gpu-optimized"&&h){const Ke=h.getDepthInformation(se[0]);Ke&&Ke.isValid&&Ke.texture&&_.init(e,Ke,i.renderState)}}for(let se=0;se<E.length;se++){const le=y[se],be=E[se];le!==null&&be!==void 0&&be.update(le,te,c||a)}$&&$(q,te),te.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:te}),m=null}const Ee=new Ah;Ee.setAnimationLoop(xe),this.setAnimationLoop=function(q){$=q},this.dispose=function(){}}}const ki=new bn,Av=new ut;function Rv(r,e){function t(g,p){g.matrixAutoUpdate===!0&&g.updateMatrix(),p.value.copy(g.matrix)}function n(g,p){p.color.getRGB(g.fogColor.value,fh(r)),p.isFog?(g.fogNear.value=p.near,g.fogFar.value=p.far):p.isFogExp2&&(g.fogDensity.value=p.density)}function i(g,p,M,E,y){p.isMeshBasicMaterial||p.isMeshLambertMaterial?s(g,p):p.isMeshToonMaterial?(s(g,p),h(g,p)):p.isMeshPhongMaterial?(s(g,p),u(g,p)):p.isMeshStandardMaterial?(s(g,p),d(g,p),p.isMeshPhysicalMaterial&&f(g,p,y)):p.isMeshMatcapMaterial?(s(g,p),m(g,p)):p.isMeshDepthMaterial?s(g,p):p.isMeshDistanceMaterial?(s(g,p),_(g,p)):p.isMeshNormalMaterial?s(g,p):p.isLineBasicMaterial?(a(g,p),p.isLineDashedMaterial&&o(g,p)):p.isPointsMaterial?l(g,p,M,E):p.isSpriteMaterial?c(g,p):p.isShadowMaterial?(g.color.value.copy(p.color),g.opacity.value=p.opacity):p.isShaderMaterial&&(p.uniformsNeedUpdate=!1)}function s(g,p){g.opacity.value=p.opacity,p.color&&g.diffuse.value.copy(p.color),p.emissive&&g.emissive.value.copy(p.emissive).multiplyScalar(p.emissiveIntensity),p.map&&(g.map.value=p.map,t(p.map,g.mapTransform)),p.alphaMap&&(g.alphaMap.value=p.alphaMap,t(p.alphaMap,g.alphaMapTransform)),p.bumpMap&&(g.bumpMap.value=p.bumpMap,t(p.bumpMap,g.bumpMapTransform),g.bumpScale.value=p.bumpScale,p.side===_n&&(g.bumpScale.value*=-1)),p.normalMap&&(g.normalMap.value=p.normalMap,t(p.normalMap,g.normalMapTransform),g.normalScale.value.copy(p.normalScale),p.side===_n&&g.normalScale.value.negate()),p.displacementMap&&(g.displacementMap.value=p.displacementMap,t(p.displacementMap,g.displacementMapTransform),g.displacementScale.value=p.displacementScale,g.displacementBias.value=p.displacementBias),p.emissiveMap&&(g.emissiveMap.value=p.emissiveMap,t(p.emissiveMap,g.emissiveMapTransform)),p.specularMap&&(g.specularMap.value=p.specularMap,t(p.specularMap,g.specularMapTransform)),p.alphaTest>0&&(g.alphaTest.value=p.alphaTest);const M=e.get(p),E=M.envMap,y=M.envMapRotation;E&&(g.envMap.value=E,ki.copy(y),ki.x*=-1,ki.y*=-1,ki.z*=-1,E.isCubeTexture&&E.isRenderTargetTexture===!1&&(ki.y*=-1,ki.z*=-1),g.envMapRotation.value.setFromMatrix4(Av.makeRotationFromEuler(ki)),g.flipEnvMap.value=E.isCubeTexture&&E.isRenderTargetTexture===!1?-1:1,g.reflectivity.value=p.reflectivity,g.ior.value=p.ior,g.refractionRatio.value=p.refractionRatio),p.lightMap&&(g.lightMap.value=p.lightMap,g.lightMapIntensity.value=p.lightMapIntensity,t(p.lightMap,g.lightMapTransform)),p.aoMap&&(g.aoMap.value=p.aoMap,g.aoMapIntensity.value=p.aoMapIntensity,t(p.aoMap,g.aoMapTransform))}function a(g,p){g.diffuse.value.copy(p.color),g.opacity.value=p.opacity,p.map&&(g.map.value=p.map,t(p.map,g.mapTransform))}function o(g,p){g.dashSize.value=p.dashSize,g.totalSize.value=p.dashSize+p.gapSize,g.scale.value=p.scale}function l(g,p,M,E){g.diffuse.value.copy(p.color),g.opacity.value=p.opacity,g.size.value=p.size*M,g.scale.value=E*.5,p.map&&(g.map.value=p.map,t(p.map,g.uvTransform)),p.alphaMap&&(g.alphaMap.value=p.alphaMap,t(p.alphaMap,g.alphaMapTransform)),p.alphaTest>0&&(g.alphaTest.value=p.alphaTest)}function c(g,p){g.diffuse.value.copy(p.color),g.opacity.value=p.opacity,g.rotation.value=p.rotation,p.map&&(g.map.value=p.map,t(p.map,g.mapTransform)),p.alphaMap&&(g.alphaMap.value=p.alphaMap,t(p.alphaMap,g.alphaMapTransform)),p.alphaTest>0&&(g.alphaTest.value=p.alphaTest)}function u(g,p){g.specular.value.copy(p.specular),g.shininess.value=Math.max(p.shininess,1e-4)}function h(g,p){p.gradientMap&&(g.gradientMap.value=p.gradientMap)}function d(g,p){g.metalness.value=p.metalness,p.metalnessMap&&(g.metalnessMap.value=p.metalnessMap,t(p.metalnessMap,g.metalnessMapTransform)),g.roughness.value=p.roughness,p.roughnessMap&&(g.roughnessMap.value=p.roughnessMap,t(p.roughnessMap,g.roughnessMapTransform)),p.envMap&&(g.envMapIntensity.value=p.envMapIntensity)}function f(g,p,M){g.ior.value=p.ior,p.sheen>0&&(g.sheenColor.value.copy(p.sheenColor).multiplyScalar(p.sheen),g.sheenRoughness.value=p.sheenRoughness,p.sheenColorMap&&(g.sheenColorMap.value=p.sheenColorMap,t(p.sheenColorMap,g.sheenColorMapTransform)),p.sheenRoughnessMap&&(g.sheenRoughnessMap.value=p.sheenRoughnessMap,t(p.sheenRoughnessMap,g.sheenRoughnessMapTransform))),p.clearcoat>0&&(g.clearcoat.value=p.clearcoat,g.clearcoatRoughness.value=p.clearcoatRoughness,p.clearcoatMap&&(g.clearcoatMap.value=p.clearcoatMap,t(p.clearcoatMap,g.clearcoatMapTransform)),p.clearcoatRoughnessMap&&(g.clearcoatRoughnessMap.value=p.clearcoatRoughnessMap,t(p.clearcoatRoughnessMap,g.clearcoatRoughnessMapTransform)),p.clearcoatNormalMap&&(g.clearcoatNormalMap.value=p.clearcoatNormalMap,t(p.clearcoatNormalMap,g.clearcoatNormalMapTransform),g.clearcoatNormalScale.value.copy(p.clearcoatNormalScale),p.side===_n&&g.clearcoatNormalScale.value.negate())),p.dispersion>0&&(g.dispersion.value=p.dispersion),p.iridescence>0&&(g.iridescence.value=p.iridescence,g.iridescenceIOR.value=p.iridescenceIOR,g.iridescenceThicknessMinimum.value=p.iridescenceThicknessRange[0],g.iridescenceThicknessMaximum.value=p.iridescenceThicknessRange[1],p.iridescenceMap&&(g.iridescenceMap.value=p.iridescenceMap,t(p.iridescenceMap,g.iridescenceMapTransform)),p.iridescenceThicknessMap&&(g.iridescenceThicknessMap.value=p.iridescenceThicknessMap,t(p.iridescenceThicknessMap,g.iridescenceThicknessMapTransform))),p.transmission>0&&(g.transmission.value=p.transmission,g.transmissionSamplerMap.value=M.texture,g.transmissionSamplerSize.value.set(M.width,M.height),p.transmissionMap&&(g.transmissionMap.value=p.transmissionMap,t(p.transmissionMap,g.transmissionMapTransform)),g.thickness.value=p.thickness,p.thicknessMap&&(g.thicknessMap.value=p.thicknessMap,t(p.thicknessMap,g.thicknessMapTransform)),g.attenuationDistance.value=p.attenuationDistance,g.attenuationColor.value.copy(p.attenuationColor)),p.anisotropy>0&&(g.anisotropyVector.value.set(p.anisotropy*Math.cos(p.anisotropyRotation),p.anisotropy*Math.sin(p.anisotropyRotation)),p.anisotropyMap&&(g.anisotropyMap.value=p.anisotropyMap,t(p.anisotropyMap,g.anisotropyMapTransform))),g.specularIntensity.value=p.specularIntensity,g.specularColor.value.copy(p.specularColor),p.specularColorMap&&(g.specularColorMap.value=p.specularColorMap,t(p.specularColorMap,g.specularColorMapTransform)),p.specularIntensityMap&&(g.specularIntensityMap.value=p.specularIntensityMap,t(p.specularIntensityMap,g.specularIntensityMapTransform))}function m(g,p){p.matcap&&(g.matcap.value=p.matcap)}function _(g,p){const M=e.get(p).light;g.referencePosition.value.setFromMatrixPosition(M.matrixWorld),g.nearDistance.value=M.shadow.camera.near,g.farDistance.value=M.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:i}}function Cv(r,e,t,n){let i={},s={},a=[];const o=r.getParameter(r.MAX_UNIFORM_BUFFER_BINDINGS);function l(M,E){const y=E.program;n.uniformBlockBinding(M,y)}function c(M,E){let y=i[M.id];y===void 0&&(m(M),y=u(M),i[M.id]=y,M.addEventListener("dispose",g));const I=E.program;n.updateUBOMapping(M,I);const R=e.render.frame;s[M.id]!==R&&(d(M),s[M.id]=R)}function u(M){const E=h();M.__bindingPointIndex=E;const y=r.createBuffer(),I=M.__size,R=M.usage;return r.bindBuffer(r.UNIFORM_BUFFER,y),r.bufferData(r.UNIFORM_BUFFER,I,R),r.bindBuffer(r.UNIFORM_BUFFER,null),r.bindBufferBase(r.UNIFORM_BUFFER,E,y),y}function h(){for(let M=0;M<o;M++)if(a.indexOf(M)===-1)return a.push(M),M;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function d(M){const E=i[M.id],y=M.uniforms,I=M.__cache;r.bindBuffer(r.UNIFORM_BUFFER,E);for(let R=0,C=y.length;R<C;R++){const L=Array.isArray(y[R])?y[R]:[y[R]];for(let b=0,x=L.length;b<x;b++){const w=L[b];if(f(w,R,b,I)===!0){const B=w.__offset,z=Array.isArray(w.value)?w.value:[w.value];let X=0;for(let j=0;j<z.length;j++){const O=z[j],K=_(O);typeof O=="number"||typeof O=="boolean"?(w.__data[0]=O,r.bufferSubData(r.UNIFORM_BUFFER,B+X,w.__data)):O.isMatrix3?(w.__data[0]=O.elements[0],w.__data[1]=O.elements[1],w.__data[2]=O.elements[2],w.__data[3]=0,w.__data[4]=O.elements[3],w.__data[5]=O.elements[4],w.__data[6]=O.elements[5],w.__data[7]=0,w.__data[8]=O.elements[6],w.__data[9]=O.elements[7],w.__data[10]=O.elements[8],w.__data[11]=0):(O.toArray(w.__data,X),X+=K.storage/Float32Array.BYTES_PER_ELEMENT)}r.bufferSubData(r.UNIFORM_BUFFER,B,w.__data)}}}r.bindBuffer(r.UNIFORM_BUFFER,null)}function f(M,E,y,I){const R=M.value,C=E+"_"+y;if(I[C]===void 0)return typeof R=="number"||typeof R=="boolean"?I[C]=R:I[C]=R.clone(),!0;{const L=I[C];if(typeof R=="number"||typeof R=="boolean"){if(L!==R)return I[C]=R,!0}else if(L.equals(R)===!1)return L.copy(R),!0}return!1}function m(M){const E=M.uniforms;let y=0;const I=16;for(let C=0,L=E.length;C<L;C++){const b=Array.isArray(E[C])?E[C]:[E[C]];for(let x=0,w=b.length;x<w;x++){const B=b[x],z=Array.isArray(B.value)?B.value:[B.value];for(let X=0,j=z.length;X<j;X++){const O=z[X],K=_(O),H=y%I,re=H%K.boundary,oe=H+re;y+=re,oe!==0&&I-oe<K.storage&&(y+=I-oe),B.__data=new Float32Array(K.storage/Float32Array.BYTES_PER_ELEMENT),B.__offset=y,y+=K.storage}}}const R=y%I;return R>0&&(y+=I-R),M.__size=y,M.__cache={},this}function _(M){const E={boundary:0,storage:0};return typeof M=="number"||typeof M=="boolean"?(E.boundary=4,E.storage=4):M.isVector2?(E.boundary=8,E.storage=8):M.isVector3||M.isColor?(E.boundary=16,E.storage=12):M.isVector4?(E.boundary=16,E.storage=16):M.isMatrix3?(E.boundary=48,E.storage=48):M.isMatrix4?(E.boundary=64,E.storage=64):M.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",M),E}function g(M){const E=M.target;E.removeEventListener("dispose",g);const y=a.indexOf(E.__bindingPointIndex);a.splice(y,1),r.deleteBuffer(i[E.id]),delete i[E.id],delete s[E.id]}function p(){for(const M in i)r.deleteBuffer(i[M]);a=[],i={},s={}}return{bind:l,update:c,dispose:p}}class Pv{constructor(e={}){const{canvas:t=Vf(),context:n=null,depth:i=!0,stencil:s=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:h=!1,reverseDepthBuffer:d=!1}=e;this.isWebGLRenderer=!0;let f;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");f=n.getContextAttributes().alpha}else f=a;const m=new Uint32Array(4),_=new Int32Array(4);let g=null,p=null;const M=[],E=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=Ri,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const y=this;let I=!1;this._outputColorSpace=At;let R=0,C=0,L=null,b=-1,x=null;const w=new St,B=new St;let z=null;const X=new ht(0);let j=0,O=t.width,K=t.height,H=1,re=null,oe=null;const $=new St(0,0,O,K),xe=new St(0,0,O,K);let Ee=!1;const q=new Nl;let te=!1,se=!1;const le=new ut,be=new ut,st=new k,Ke=new St,Ct={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let ae=!1;function _e(){return L===null?H:1}let N=n;function We(P,G){return t.getContext(P,G)}try{const P={alpha:!0,depth:i,stencil:s,antialias:o,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:u,failIfMajorPerformanceCaveat:h};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${xl}`),t.addEventListener("webglcontextlost",ke,!1),t.addEventListener("webglcontextrestored",ve,!1),t.addEventListener("webglcontextcreationerror",he,!1),N===null){const G="webgl2";if(N=We(G,P),N===null)throw We(G)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(P){throw console.error("THREE.WebGLRenderer: "+P.message),P}let Me,Te,Q,Be,Ie,Re,pt,F,T,Y,ce,de,ne,Ge,Se,Fe,je,fe,Oe,tt,Qe,we,at,V;function Pe(){Me=new z_(N),Me.init(),we=new Mv(N,Me),Te=new U_(N,Me,e,we),Q=new xv(N,Me),Te.reverseDepthBuffer&&d&&Q.buffers.depth.setReversed(!0),Be=new G_(N),Ie=new ov,Re=new Sv(N,Me,Q,Ie,Te,we,Be),pt=new N_(y),F=new k_(y),T=new Kp(N),at=new D_(N,T),Y=new V_(N,T,Be,at),ce=new X_(N,Y,T,Be),Oe=new W_(N,Te,Re),Fe=new I_(Ie),de=new av(y,pt,F,Me,Te,at,Fe),ne=new Rv(y,Ie),Ge=new cv,Se=new mv(Me),fe=new P_(y,pt,F,Q,ce,f,l),je=new vv(y,ce,Te),V=new Cv(N,Be,Te,Q),tt=new L_(N,Me,Be),Qe=new H_(N,Me,Be),Be.programs=de.programs,y.capabilities=Te,y.extensions=Me,y.properties=Ie,y.renderLists=Ge,y.shadowMap=je,y.state=Q,y.info=Be}Pe();const pe=new wv(y,N);this.xr=pe,this.getContext=function(){return N},this.getContextAttributes=function(){return N.getContextAttributes()},this.forceContextLoss=function(){const P=Me.get("WEBGL_lose_context");P&&P.loseContext()},this.forceContextRestore=function(){const P=Me.get("WEBGL_lose_context");P&&P.restoreContext()},this.getPixelRatio=function(){return H},this.setPixelRatio=function(P){P!==void 0&&(H=P,this.setSize(O,K,!1))},this.getSize=function(P){return P.set(O,K)},this.setSize=function(P,G,J=!0){if(pe.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}O=P,K=G,t.width=Math.floor(P*H),t.height=Math.floor(G*H),J===!0&&(t.style.width=P+"px",t.style.height=G+"px"),this.setViewport(0,0,P,G)},this.getDrawingBufferSize=function(P){return P.set(O*H,K*H).floor()},this.setDrawingBufferSize=function(P,G,J){O=P,K=G,H=J,t.width=Math.floor(P*J),t.height=Math.floor(G*J),this.setViewport(0,0,P,G)},this.getCurrentViewport=function(P){return P.copy(w)},this.getViewport=function(P){return P.copy($)},this.setViewport=function(P,G,J,Z){P.isVector4?$.set(P.x,P.y,P.z,P.w):$.set(P,G,J,Z),Q.viewport(w.copy($).multiplyScalar(H).round())},this.getScissor=function(P){return P.copy(xe)},this.setScissor=function(P,G,J,Z){P.isVector4?xe.set(P.x,P.y,P.z,P.w):xe.set(P,G,J,Z),Q.scissor(B.copy(xe).multiplyScalar(H).round())},this.getScissorTest=function(){return Ee},this.setScissorTest=function(P){Q.setScissorTest(Ee=P)},this.setOpaqueSort=function(P){re=P},this.setTransparentSort=function(P){oe=P},this.getClearColor=function(P){return P.copy(fe.getClearColor())},this.setClearColor=function(){fe.setClearColor(...arguments)},this.getClearAlpha=function(){return fe.getClearAlpha()},this.setClearAlpha=function(){fe.setClearAlpha(...arguments)},this.clear=function(P=!0,G=!0,J=!0){let Z=0;if(P){let W=!1;if(L!==null){const ye=L.texture.format;W=ye===wl||ye===Tl||ye===El}if(W){const ye=L.texture.type,Ue=ye===Jn||ye===$i||ye===ss||ye===as||ye===Ml||ye===bl,Xe=fe.getClearColor(),ze=fe.getClearAlpha(),ot=Xe.r,lt=Xe.g,Je=Xe.b;Ue?(m[0]=ot,m[1]=lt,m[2]=Je,m[3]=ze,N.clearBufferuiv(N.COLOR,0,m)):(_[0]=ot,_[1]=lt,_[2]=Je,_[3]=ze,N.clearBufferiv(N.COLOR,0,_))}else Z|=N.COLOR_BUFFER_BIT}G&&(Z|=N.DEPTH_BUFFER_BIT),J&&(Z|=N.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),N.clear(Z)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",ke,!1),t.removeEventListener("webglcontextrestored",ve,!1),t.removeEventListener("webglcontextcreationerror",he,!1),fe.dispose(),Ge.dispose(),Se.dispose(),Ie.dispose(),pt.dispose(),F.dispose(),ce.dispose(),at.dispose(),V.dispose(),de.dispose(),pe.dispose(),pe.removeEventListener("sessionstart",Qn),pe.removeEventListener("sessionend",nt),De.stop()};function ke(P){P.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),I=!0}function ve(){console.log("THREE.WebGLRenderer: Context Restored."),I=!1;const P=Be.autoReset,G=je.enabled,J=je.autoUpdate,Z=je.needsUpdate,W=je.type;Pe(),Be.autoReset=P,je.enabled=G,je.autoUpdate=J,je.needsUpdate=Z,je.type=W}function he(P){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",P.statusMessage)}function He(P){const G=P.target;G.removeEventListener("dispose",He),me(G)}function me(P){mt(P),Ie.remove(P)}function mt(P){const G=Ie.get(P).programs;G!==void 0&&(G.forEach(function(J){de.releaseProgram(J)}),P.isShaderMaterial&&de.releaseShaderCache(P))}this.renderBufferDirect=function(P,G,J,Z,W,ye){G===null&&(G=Ct);const Ue=W.isMesh&&W.matrixWorld.determinant()<0,Xe=Qi(P,G,J,Z,W);Q.setMaterial(Z,Ue);let ze=J.index,ot=1;if(Z.wireframe===!0){if(ze=Y.getWireframeAttribute(J),ze===void 0)return;ot=2}const lt=J.drawRange,Je=J.attributes.position;let ft=lt.start*ot,Rt=(lt.start+lt.count)*ot;ye!==null&&(ft=Math.max(ft,ye.start*ot),Rt=Math.min(Rt,(ye.start+ye.count)*ot)),ze!==null?(ft=Math.max(ft,0),Rt=Math.min(Rt,ze.count)):Je!=null&&(ft=Math.max(ft,0),Rt=Math.min(Rt,Je.count));const Ot=Rt-ft;if(Ot<0||Ot===1/0)return;at.setup(W,Z,Xe,J,ze);let kt,Mt=tt;if(ze!==null&&(kt=T.get(ze),Mt=Qe,Mt.setIndex(kt)),W.isMesh)Z.wireframe===!0?(Q.setLineWidth(Z.wireframeLinewidth*_e()),Mt.setMode(N.LINES)):Mt.setMode(N.TRIANGLES);else if(W.isLine){let it=Z.linewidth;it===void 0&&(it=1),Q.setLineWidth(it*_e()),W.isLineSegments?Mt.setMode(N.LINES):W.isLineLoop?Mt.setMode(N.LINE_LOOP):Mt.setMode(N.LINE_STRIP)}else W.isPoints?Mt.setMode(N.POINTS):W.isSprite&&Mt.setMode(N.TRIANGLES);if(W.isBatchedMesh)if(W._multiDrawInstances!==null)Rr("THREE.WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),Mt.renderMultiDrawInstances(W._multiDrawStarts,W._multiDrawCounts,W._multiDrawCount,W._multiDrawInstances);else if(Me.get("WEBGL_multi_draw"))Mt.renderMultiDraw(W._multiDrawStarts,W._multiDrawCounts,W._multiDrawCount);else{const it=W._multiDrawStarts,Yt=W._multiDrawCounts,Et=W._multiDrawCount,vn=ze?T.get(ze).bytesPerElement:1,Bt=Ie.get(Z).currentProgram.getUniforms();for(let en=0;en<Et;en++)Bt.setValue(N,"_gl_DrawID",en),Mt.render(it[en]/vn,Yt[en])}else if(W.isInstancedMesh)Mt.renderInstances(ft,Ot,W.count);else if(J.isInstancedBufferGeometry){const it=J._maxInstanceCount!==void 0?J._maxInstanceCount:1/0,Yt=Math.min(J.instanceCount,it);Mt.renderInstances(ft,Ot,Yt)}else Mt.render(ft,Ot)};function Ze(P,G,J){P.transparent===!0&&P.side===hn&&P.forceSinglePass===!1?(P.side=_n,P.needsUpdate=!0,ei(P,G,J),P.side=$n,P.needsUpdate=!0,ei(P,G,J),P.side=hn):ei(P,G,J)}this.compile=function(P,G,J=null){J===null&&(J=P),p=Se.get(J),p.init(G),E.push(p),J.traverseVisible(function(W){W.isLight&&W.layers.test(G.layers)&&(p.pushLight(W),W.castShadow&&p.pushShadow(W))}),P!==J&&P.traverseVisible(function(W){W.isLight&&W.layers.test(G.layers)&&(p.pushLight(W),W.castShadow&&p.pushShadow(W))}),p.setupLights();const Z=new Set;return P.traverse(function(W){if(!(W.isMesh||W.isPoints||W.isLine||W.isSprite))return;const ye=W.material;if(ye)if(Array.isArray(ye))for(let Ue=0;Ue<ye.length;Ue++){const Xe=ye[Ue];Ze(Xe,J,W),Z.add(Xe)}else Ze(ye,J,W),Z.add(ye)}),p=E.pop(),Z},this.compileAsync=function(P,G,J=null){const Z=this.compile(P,G,J);return new Promise(W=>{function ye(){if(Z.forEach(function(Ue){Ie.get(Ue).currentProgram.isReady()&&Z.delete(Ue)}),Z.size===0){W(P);return}setTimeout(ye,10)}Me.get("KHR_parallel_shader_compile")!==null?ye():setTimeout(ye,10)})};let Ht=null;function En(P){Ht&&Ht(P)}function Qn(){De.stop()}function nt(){De.start()}const De=new Ah;De.setAnimationLoop(En),typeof self<"u"&&De.setContext(self),this.setAnimationLoop=function(P){Ht=P,pe.setAnimationLoop(P),P===null?De.stop():De.start()},pe.addEventListener("sessionstart",Qn),pe.addEventListener("sessionend",nt),this.render=function(P,G){if(G!==void 0&&G.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(I===!0)return;if(P.matrixWorldAutoUpdate===!0&&P.updateMatrixWorld(),G.parent===null&&G.matrixWorldAutoUpdate===!0&&G.updateMatrixWorld(),pe.enabled===!0&&pe.isPresenting===!0&&(pe.cameraAutoUpdate===!0&&pe.updateCamera(G),G=pe.getCamera()),P.isScene===!0&&P.onBeforeRender(y,P,G,L),p=Se.get(P,E.length),p.init(G),E.push(p),be.multiplyMatrices(G.projectionMatrix,G.matrixWorldInverse),q.setFromProjectionMatrix(be),se=this.localClippingEnabled,te=Fe.init(this.clippingPlanes,se),g=Ge.get(P,M.length),g.init(),M.push(g),pe.enabled===!0&&pe.isPresenting===!0){const ye=y.xr.getDepthSensingMesh();ye!==null&&Gt(ye,G,-1/0,y.sortObjects)}Gt(P,G,0,y.sortObjects),g.finish(),y.sortObjects===!0&&g.sort(re,oe),ae=pe.enabled===!1||pe.isPresenting===!1||pe.hasDepthSensing()===!1,ae&&fe.addToRenderList(g,P),this.info.render.frame++,te===!0&&Fe.beginShadows();const J=p.state.shadowsArray;je.render(J,P,G),te===!0&&Fe.endShadows(),this.info.autoReset===!0&&this.info.reset();const Z=g.opaque,W=g.transmissive;if(p.setupLights(),G.isArrayCamera){const ye=G.cameras;if(W.length>0)for(let Ue=0,Xe=ye.length;Ue<Xe;Ue++){const ze=ye[Ue];Wt(Z,W,P,ze)}ae&&fe.render(P);for(let Ue=0,Xe=ye.length;Ue<Xe;Ue++){const ze=ye[Ue];Pn(g,P,ze,ze.viewport)}}else W.length>0&&Wt(Z,W,P,G),ae&&fe.render(P),Pn(g,P,G);L!==null&&C===0&&(Re.updateMultisampleRenderTarget(L),Re.updateRenderTargetMipmap(L)),P.isScene===!0&&P.onAfterRender(y,P,G),at.resetDefaultState(),b=-1,x=null,E.pop(),E.length>0?(p=E[E.length-1],te===!0&&Fe.setGlobalState(y.clippingPlanes,p.state.camera)):p=null,M.pop(),M.length>0?g=M[M.length-1]:g=null};function Gt(P,G,J,Z){if(P.visible===!1)return;if(P.layers.test(G.layers)){if(P.isGroup)J=P.renderOrder;else if(P.isLOD)P.autoUpdate===!0&&P.update(G);else if(P.isLight)p.pushLight(P),P.castShadow&&p.pushShadow(P);else if(P.isSprite){if(!P.frustumCulled||q.intersectsSprite(P)){Z&&Ke.setFromMatrixPosition(P.matrixWorld).applyMatrix4(be);const Ue=ce.update(P),Xe=P.material;Xe.visible&&g.push(P,Ue,Xe,J,Ke.z,null)}}else if((P.isMesh||P.isLine||P.isPoints)&&(!P.frustumCulled||q.intersectsObject(P))){const Ue=ce.update(P),Xe=P.material;if(Z&&(P.boundingSphere!==void 0?(P.boundingSphere===null&&P.computeBoundingSphere(),Ke.copy(P.boundingSphere.center)):(Ue.boundingSphere===null&&Ue.computeBoundingSphere(),Ke.copy(Ue.boundingSphere.center)),Ke.applyMatrix4(P.matrixWorld).applyMatrix4(be)),Array.isArray(Xe)){const ze=Ue.groups;for(let ot=0,lt=ze.length;ot<lt;ot++){const Je=ze[ot],ft=Xe[Je.materialIndex];ft&&ft.visible&&g.push(P,Ue,ft,J,Ke.z,Je)}}else Xe.visible&&g.push(P,Ue,Xe,J,Ke.z,null)}}const ye=P.children;for(let Ue=0,Xe=ye.length;Ue<Xe;Ue++)Gt(ye[Ue],G,J,Z)}function Pn(P,G,J,Z){const W=P.opaque,ye=P.transmissive,Ue=P.transparent;p.setupLightsView(J),te===!0&&Fe.setGlobalState(y.clippingPlanes,J),Z&&Q.viewport(w.copy(Z)),W.length>0&&Zt(W,G,J),ye.length>0&&Zt(ye,G,J),Ue.length>0&&Zt(Ue,G,J),Q.buffers.depth.setTest(!0),Q.buffers.depth.setMask(!0),Q.buffers.color.setMask(!0),Q.setPolygonOffset(!1)}function Wt(P,G,J,Z){if((J.isScene===!0?J.overrideMaterial:null)!==null)return;p.state.transmissionRenderTarget[Z.id]===void 0&&(p.state.transmissionRenderTarget[Z.id]=new Ji(1,1,{generateMipmaps:!0,type:Me.has("EXT_color_buffer_half_float")||Me.has("EXT_color_buffer_float")?hs:Jn,minFilter:hi,samples:4,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:vt.workingColorSpace}));const ye=p.state.transmissionRenderTarget[Z.id],Ue=Z.viewport||w;ye.setSize(Ue.z*y.transmissionResolutionScale,Ue.w*y.transmissionResolutionScale);const Xe=y.getRenderTarget();y.setRenderTarget(ye),y.getClearColor(X),j=y.getClearAlpha(),j<1&&y.setClearColor(16777215,.5),y.clear(),ae&&fe.render(J);const ze=y.toneMapping;y.toneMapping=Ri;const ot=Z.viewport;if(Z.viewport!==void 0&&(Z.viewport=void 0),p.setupLightsView(Z),te===!0&&Fe.setGlobalState(y.clippingPlanes,Z),Zt(P,J,Z),Re.updateMultisampleRenderTarget(ye),Re.updateRenderTargetMipmap(ye),Me.has("WEBGL_multisampled_render_to_texture")===!1){let lt=!1;for(let Je=0,ft=G.length;Je<ft;Je++){const Rt=G[Je],Ot=Rt.object,kt=Rt.geometry,Mt=Rt.material,it=Rt.group;if(Mt.side===hn&&Ot.layers.test(Z.layers)){const Yt=Mt.side;Mt.side=_n,Mt.needsUpdate=!0,dn(Ot,J,Z,kt,Mt,it),Mt.side=Yt,Mt.needsUpdate=!0,lt=!0}}lt===!0&&(Re.updateMultisampleRenderTarget(ye),Re.updateRenderTargetMipmap(ye))}y.setRenderTarget(Xe),y.setClearColor(X,j),ot!==void 0&&(Z.viewport=ot),y.toneMapping=ze}function Zt(P,G,J){const Z=G.isScene===!0?G.overrideMaterial:null;for(let W=0,ye=P.length;W<ye;W++){const Ue=P[W],Xe=Ue.object,ze=Ue.geometry,ot=Ue.group;let lt=Ue.material;lt.allowOverride===!0&&Z!==null&&(lt=Z),Xe.layers.test(J.layers)&&dn(Xe,G,J,ze,lt,ot)}}function dn(P,G,J,Z,W,ye){P.onBeforeRender(y,G,J,Z,W,ye),P.modelViewMatrix.multiplyMatrices(J.matrixWorldInverse,P.matrixWorld),P.normalMatrix.getNormalMatrix(P.modelViewMatrix),W.onBeforeRender(y,G,J,Z,P,ye),W.transparent===!0&&W.side===hn&&W.forceSinglePass===!1?(W.side=_n,W.needsUpdate=!0,y.renderBufferDirect(J,G,Z,W,P,ye),W.side=$n,W.needsUpdate=!0,y.renderBufferDirect(J,G,Z,W,P,ye),W.side=hn):y.renderBufferDirect(J,G,Z,W,P,ye),P.onAfterRender(y,G,J,Z,W,ye)}function ei(P,G,J){G.isScene!==!0&&(G=Ct);const Z=Ie.get(P),W=p.state.lights,ye=p.state.shadowsArray,Ue=W.state.version,Xe=de.getParameters(P,W.state,ye,G,J),ze=de.getProgramCacheKey(Xe);let ot=Z.programs;Z.environment=P.isMeshStandardMaterial?G.environment:null,Z.fog=G.fog,Z.envMap=(P.isMeshStandardMaterial?F:pt).get(P.envMap||Z.environment),Z.envMapRotation=Z.environment!==null&&P.envMap===null?G.environmentRotation:P.envMapRotation,ot===void 0&&(P.addEventListener("dispose",He),ot=new Map,Z.programs=ot);let lt=ot.get(ze);if(lt!==void 0){if(Z.currentProgram===lt&&Z.lightsStateVersion===Ue)return Di(P,Xe),lt}else Xe.uniforms=de.getUniforms(P),P.onBeforeCompile(Xe,y),lt=de.acquireProgram(Xe,ze),ot.set(ze,lt),Z.uniforms=Xe.uniforms;const Je=Z.uniforms;return(!P.isShaderMaterial&&!P.isRawShaderMaterial||P.clipping===!0)&&(Je.clippingPlanes=Fe.uniform),Di(P,Xe),Z.needsLights=tr(P),Z.lightsStateVersion=Ue,Z.needsLights&&(Je.ambientLightColor.value=W.state.ambient,Je.lightProbe.value=W.state.probe,Je.directionalLights.value=W.state.directional,Je.directionalLightShadows.value=W.state.directionalShadow,Je.spotLights.value=W.state.spot,Je.spotLightShadows.value=W.state.spotShadow,Je.rectAreaLights.value=W.state.rectArea,Je.ltc_1.value=W.state.rectAreaLTC1,Je.ltc_2.value=W.state.rectAreaLTC2,Je.pointLights.value=W.state.point,Je.pointLightShadows.value=W.state.pointShadow,Je.hemisphereLights.value=W.state.hemi,Je.directionalShadowMap.value=W.state.directionalShadowMap,Je.directionalShadowMatrix.value=W.state.directionalShadowMatrix,Je.spotShadowMap.value=W.state.spotShadowMap,Je.spotLightMatrix.value=W.state.spotLightMatrix,Je.spotLightMap.value=W.state.spotLightMap,Je.pointShadowMap.value=W.state.pointShadowMap,Je.pointShadowMatrix.value=W.state.pointShadowMatrix),Z.currentProgram=lt,Z.uniformsList=null,lt}function Pi(P){if(P.uniformsList===null){const G=P.currentProgram.getUniforms();P.uniformsList=oa.seqWithValue(G.seq,P.uniforms)}return P.uniformsList}function Di(P,G){const J=Ie.get(P);J.outputColorSpace=G.outputColorSpace,J.batching=G.batching,J.batchingColor=G.batchingColor,J.instancing=G.instancing,J.instancingColor=G.instancingColor,J.instancingMorph=G.instancingMorph,J.skinning=G.skinning,J.morphTargets=G.morphTargets,J.morphNormals=G.morphNormals,J.morphColors=G.morphColors,J.morphTargetsCount=G.morphTargetsCount,J.numClippingPlanes=G.numClippingPlanes,J.numIntersection=G.numClipIntersection,J.vertexAlphas=G.vertexAlphas,J.vertexTangents=G.vertexTangents,J.toneMapping=G.toneMapping}function Qi(P,G,J,Z,W){G.isScene!==!0&&(G=Ct),Re.resetTextureUnits();const ye=G.fog,Ue=Z.isMeshStandardMaterial?G.environment:null,Xe=L===null?y.outputColorSpace:L.isXRRenderTarget===!0?L.texture.colorSpace:Ur,ze=(Z.isMeshStandardMaterial?F:pt).get(Z.envMap||Ue),ot=Z.vertexColors===!0&&!!J.attributes.color&&J.attributes.color.itemSize===4,lt=!!J.attributes.tangent&&(!!Z.normalMap||Z.anisotropy>0),Je=!!J.morphAttributes.position,ft=!!J.morphAttributes.normal,Rt=!!J.morphAttributes.color;let Ot=Ri;Z.toneMapped&&(L===null||L.isXRRenderTarget===!0)&&(Ot=y.toneMapping);const kt=J.morphAttributes.position||J.morphAttributes.normal||J.morphAttributes.color,Mt=kt!==void 0?kt.length:0,it=Ie.get(Z),Yt=p.state.lights;if(te===!0&&(se===!0||P!==x)){const qt=P===x&&Z.id===b;Fe.setState(Z,P,qt)}let Et=!1;Z.version===it.__version?(it.needsLights&&it.lightsStateVersion!==Yt.state.version||it.outputColorSpace!==Xe||W.isBatchedMesh&&it.batching===!1||!W.isBatchedMesh&&it.batching===!0||W.isBatchedMesh&&it.batchingColor===!0&&W.colorTexture===null||W.isBatchedMesh&&it.batchingColor===!1&&W.colorTexture!==null||W.isInstancedMesh&&it.instancing===!1||!W.isInstancedMesh&&it.instancing===!0||W.isSkinnedMesh&&it.skinning===!1||!W.isSkinnedMesh&&it.skinning===!0||W.isInstancedMesh&&it.instancingColor===!0&&W.instanceColor===null||W.isInstancedMesh&&it.instancingColor===!1&&W.instanceColor!==null||W.isInstancedMesh&&it.instancingMorph===!0&&W.morphTexture===null||W.isInstancedMesh&&it.instancingMorph===!1&&W.morphTexture!==null||it.envMap!==ze||Z.fog===!0&&it.fog!==ye||it.numClippingPlanes!==void 0&&(it.numClippingPlanes!==Fe.numPlanes||it.numIntersection!==Fe.numIntersection)||it.vertexAlphas!==ot||it.vertexTangents!==lt||it.morphTargets!==Je||it.morphNormals!==ft||it.morphColors!==Rt||it.toneMapping!==Ot||it.morphTargetsCount!==Mt)&&(Et=!0):(Et=!0,it.__version=Z.version);let vn=it.currentProgram;Et===!0&&(vn=ei(Z,G,W));let Bt=!1,en=!1,Ui=!1;const Nt=vn.getUniforms(),pn=it.uniforms;if(Q.useProgram(vn.program)&&(Bt=!0,en=!0,Ui=!0),Z.id!==b&&(b=Z.id,en=!0),Bt||x!==P){Q.buffers.depth.getReversed()?(le.copy(P.projectionMatrix),Gf(le),Wf(le),Nt.setValue(N,"projectionMatrix",le)):Nt.setValue(N,"projectionMatrix",P.projectionMatrix),Nt.setValue(N,"viewMatrix",P.matrixWorldInverse);const Kt=Nt.map.cameraPosition;Kt!==void 0&&Kt.setValue(N,st.setFromMatrixPosition(P.matrixWorld)),Te.logarithmicDepthBuffer&&Nt.setValue(N,"logDepthBufFC",2/(Math.log(P.far+1)/Math.LN2)),(Z.isMeshPhongMaterial||Z.isMeshToonMaterial||Z.isMeshLambertMaterial||Z.isMeshBasicMaterial||Z.isMeshStandardMaterial||Z.isShaderMaterial)&&Nt.setValue(N,"isOrthographic",P.isOrthographicCamera===!0),x!==P&&(x=P,en=!0,Ui=!0)}if(W.isSkinnedMesh){Nt.setOptional(N,W,"bindMatrix"),Nt.setOptional(N,W,"bindMatrixInverse");const qt=W.skeleton;qt&&(qt.boneTexture===null&&qt.computeBoneTexture(),Nt.setValue(N,"boneTexture",qt.boneTexture,Re))}W.isBatchedMesh&&(Nt.setOptional(N,W,"batchingTexture"),Nt.setValue(N,"batchingTexture",W._matricesTexture,Re),Nt.setOptional(N,W,"batchingIdTexture"),Nt.setValue(N,"batchingIdTexture",W._indirectTexture,Re),Nt.setOptional(N,W,"batchingColorTexture"),W._colorsTexture!==null&&Nt.setValue(N,"batchingColorTexture",W._colorsTexture,Re));const on=J.morphAttributes;if((on.position!==void 0||on.normal!==void 0||on.color!==void 0)&&Oe.update(W,J,vn),(en||it.receiveShadow!==W.receiveShadow)&&(it.receiveShadow=W.receiveShadow,Nt.setValue(N,"receiveShadow",W.receiveShadow)),Z.isMeshGouraudMaterial&&Z.envMap!==null&&(pn.envMap.value=ze,pn.flipEnvMap.value=ze.isCubeTexture&&ze.isRenderTargetTexture===!1?-1:1),Z.isMeshStandardMaterial&&Z.envMap===null&&G.environment!==null&&(pn.envMapIntensity.value=G.environmentIntensity),en&&(Nt.setValue(N,"toneMappingExposure",y.toneMappingExposure),it.needsLights&&er(pn,Ui),ye&&Z.fog===!0&&ne.refreshFogUniforms(pn,ye),ne.refreshMaterialUniforms(pn,Z,H,K,p.state.transmissionRenderTarget[P.id]),oa.upload(N,Pi(it),pn,Re)),Z.isShaderMaterial&&Z.uniformsNeedUpdate===!0&&(oa.upload(N,Pi(it),pn,Re),Z.uniformsNeedUpdate=!1),Z.isSpriteMaterial&&Nt.setValue(N,"center",W.center),Nt.setValue(N,"modelViewMatrix",W.modelViewMatrix),Nt.setValue(N,"normalMatrix",W.normalMatrix),Nt.setValue(N,"modelMatrix",W.matrixWorld),Z.isShaderMaterial||Z.isRawShaderMaterial){const qt=Z.uniformsGroups;for(let Kt=0,nr=qt.length;Kt<nr;Kt++){const ni=qt[Kt];V.update(ni,vn),V.bind(ni,vn)}}return vn}function er(P,G){P.ambientLightColor.needsUpdate=G,P.lightProbe.needsUpdate=G,P.directionalLights.needsUpdate=G,P.directionalLightShadows.needsUpdate=G,P.pointLights.needsUpdate=G,P.pointLightShadows.needsUpdate=G,P.spotLights.needsUpdate=G,P.spotLightShadows.needsUpdate=G,P.rectAreaLights.needsUpdate=G,P.hemisphereLights.needsUpdate=G}function tr(P){return P.isMeshLambertMaterial||P.isMeshToonMaterial||P.isMeshPhongMaterial||P.isMeshStandardMaterial||P.isShadowMaterial||P.isShaderMaterial&&P.lights===!0}this.getActiveCubeFace=function(){return R},this.getActiveMipmapLevel=function(){return C},this.getRenderTarget=function(){return L},this.setRenderTargetTextures=function(P,G,J){const Z=Ie.get(P);Z.__autoAllocateDepthBuffer=P.resolveDepthBuffer===!1,Z.__autoAllocateDepthBuffer===!1&&(Z.__useRenderToTexture=!1),Ie.get(P.texture).__webglTexture=G,Ie.get(P.depthTexture).__webglTexture=Z.__autoAllocateDepthBuffer?void 0:J,Z.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(P,G){const J=Ie.get(P);J.__webglFramebuffer=G,J.__useDefaultFramebuffer=G===void 0};const Li=N.createFramebuffer();this.setRenderTarget=function(P,G=0,J=0){L=P,R=G,C=J;let Z=!0,W=null,ye=!1,Ue=!1;if(P){const ze=Ie.get(P);if(ze.__useDefaultFramebuffer!==void 0)Q.bindFramebuffer(N.FRAMEBUFFER,null),Z=!1;else if(ze.__webglFramebuffer===void 0)Re.setupRenderTarget(P);else if(ze.__hasExternalTextures)Re.rebindTextures(P,Ie.get(P.texture).__webglTexture,Ie.get(P.depthTexture).__webglTexture);else if(P.depthBuffer){const Je=P.depthTexture;if(ze.__boundDepthTexture!==Je){if(Je!==null&&Ie.has(Je)&&(P.width!==Je.image.width||P.height!==Je.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");Re.setupDepthRenderbuffer(P)}}const ot=P.texture;(ot.isData3DTexture||ot.isDataArrayTexture||ot.isCompressedArrayTexture)&&(Ue=!0);const lt=Ie.get(P).__webglFramebuffer;P.isWebGLCubeRenderTarget?(Array.isArray(lt[G])?W=lt[G][J]:W=lt[G],ye=!0):P.samples>0&&Re.useMultisampledRTT(P)===!1?W=Ie.get(P).__webglMultisampledFramebuffer:Array.isArray(lt)?W=lt[J]:W=lt,w.copy(P.viewport),B.copy(P.scissor),z=P.scissorTest}else w.copy($).multiplyScalar(H).floor(),B.copy(xe).multiplyScalar(H).floor(),z=Ee;if(J!==0&&(W=Li),Q.bindFramebuffer(N.FRAMEBUFFER,W)&&Z&&Q.drawBuffers(P,W),Q.viewport(w),Q.scissor(B),Q.setScissorTest(z),ye){const ze=Ie.get(P.texture);N.framebufferTexture2D(N.FRAMEBUFFER,N.COLOR_ATTACHMENT0,N.TEXTURE_CUBE_MAP_POSITIVE_X+G,ze.__webglTexture,J)}else if(Ue){const ze=Ie.get(P.texture),ot=G;N.framebufferTextureLayer(N.FRAMEBUFFER,N.COLOR_ATTACHMENT0,ze.__webglTexture,J,ot)}else if(P!==null&&J!==0){const ze=Ie.get(P.texture);N.framebufferTexture2D(N.FRAMEBUFFER,N.COLOR_ATTACHMENT0,N.TEXTURE_2D,ze.__webglTexture,J)}b=-1},this.readRenderTargetPixels=function(P,G,J,Z,W,ye,Ue,Xe=0){if(!(P&&P.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let ze=Ie.get(P).__webglFramebuffer;if(P.isWebGLCubeRenderTarget&&Ue!==void 0&&(ze=ze[Ue]),ze){Q.bindFramebuffer(N.FRAMEBUFFER,ze);try{const ot=P.textures[Xe],lt=ot.format,Je=ot.type;if(!Te.textureFormatReadable(lt)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!Te.textureTypeReadable(Je)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}G>=0&&G<=P.width-Z&&J>=0&&J<=P.height-W&&(P.textures.length>1&&N.readBuffer(N.COLOR_ATTACHMENT0+Xe),N.readPixels(G,J,Z,W,we.convert(lt),we.convert(Je),ye))}finally{const ot=L!==null?Ie.get(L).__webglFramebuffer:null;Q.bindFramebuffer(N.FRAMEBUFFER,ot)}}},this.readRenderTargetPixelsAsync=async function(P,G,J,Z,W,ye,Ue,Xe=0){if(!(P&&P.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let ze=Ie.get(P).__webglFramebuffer;if(P.isWebGLCubeRenderTarget&&Ue!==void 0&&(ze=ze[Ue]),ze)if(G>=0&&G<=P.width-Z&&J>=0&&J<=P.height-W){Q.bindFramebuffer(N.FRAMEBUFFER,ze);const ot=P.textures[Xe],lt=ot.format,Je=ot.type;if(!Te.textureFormatReadable(lt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!Te.textureTypeReadable(Je))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const ft=N.createBuffer();N.bindBuffer(N.PIXEL_PACK_BUFFER,ft),N.bufferData(N.PIXEL_PACK_BUFFER,ye.byteLength,N.STREAM_READ),P.textures.length>1&&N.readBuffer(N.COLOR_ATTACHMENT0+Xe),N.readPixels(G,J,Z,W,we.convert(lt),we.convert(Je),0);const Rt=L!==null?Ie.get(L).__webglFramebuffer:null;Q.bindFramebuffer(N.FRAMEBUFFER,Rt);const Ot=N.fenceSync(N.SYNC_GPU_COMMANDS_COMPLETE,0);return N.flush(),await Hf(N,Ot,4),N.bindBuffer(N.PIXEL_PACK_BUFFER,ft),N.getBufferSubData(N.PIXEL_PACK_BUFFER,0,ye),N.deleteBuffer(ft),N.deleteSync(Ot),ye}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(P,G=null,J=0){const Z=Math.pow(2,-J),W=Math.floor(P.image.width*Z),ye=Math.floor(P.image.height*Z),Ue=G!==null?G.x:0,Xe=G!==null?G.y:0;Re.setTexture2D(P,0),N.copyTexSubImage2D(N.TEXTURE_2D,J,0,0,Ue,Xe,W,ye),Q.unbindTexture()};const fn=N.createFramebuffer(),ti=N.createFramebuffer();this.copyTextureToTexture=function(P,G,J=null,Z=null,W=0,ye=null){ye===null&&(W!==0?(Rr("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),ye=W,W=0):ye=0);let Ue,Xe,ze,ot,lt,Je,ft,Rt,Ot;const kt=P.isCompressedTexture?P.mipmaps[ye]:P.image;if(J!==null)Ue=J.max.x-J.min.x,Xe=J.max.y-J.min.y,ze=J.isBox3?J.max.z-J.min.z:1,ot=J.min.x,lt=J.min.y,Je=J.isBox3?J.min.z:0;else{const on=Math.pow(2,-W);Ue=Math.floor(kt.width*on),Xe=Math.floor(kt.height*on),P.isDataArrayTexture?ze=kt.depth:P.isData3DTexture?ze=Math.floor(kt.depth*on):ze=1,ot=0,lt=0,Je=0}Z!==null?(ft=Z.x,Rt=Z.y,Ot=Z.z):(ft=0,Rt=0,Ot=0);const Mt=we.convert(G.format),it=we.convert(G.type);let Yt;G.isData3DTexture?(Re.setTexture3D(G,0),Yt=N.TEXTURE_3D):G.isDataArrayTexture||G.isCompressedArrayTexture?(Re.setTexture2DArray(G,0),Yt=N.TEXTURE_2D_ARRAY):(Re.setTexture2D(G,0),Yt=N.TEXTURE_2D),N.pixelStorei(N.UNPACK_FLIP_Y_WEBGL,G.flipY),N.pixelStorei(N.UNPACK_PREMULTIPLY_ALPHA_WEBGL,G.premultiplyAlpha),N.pixelStorei(N.UNPACK_ALIGNMENT,G.unpackAlignment);const Et=N.getParameter(N.UNPACK_ROW_LENGTH),vn=N.getParameter(N.UNPACK_IMAGE_HEIGHT),Bt=N.getParameter(N.UNPACK_SKIP_PIXELS),en=N.getParameter(N.UNPACK_SKIP_ROWS),Ui=N.getParameter(N.UNPACK_SKIP_IMAGES);N.pixelStorei(N.UNPACK_ROW_LENGTH,kt.width),N.pixelStorei(N.UNPACK_IMAGE_HEIGHT,kt.height),N.pixelStorei(N.UNPACK_SKIP_PIXELS,ot),N.pixelStorei(N.UNPACK_SKIP_ROWS,lt),N.pixelStorei(N.UNPACK_SKIP_IMAGES,Je);const Nt=P.isDataArrayTexture||P.isData3DTexture,pn=G.isDataArrayTexture||G.isData3DTexture;if(P.isDepthTexture){const on=Ie.get(P),qt=Ie.get(G),Kt=Ie.get(on.__renderTarget),nr=Ie.get(qt.__renderTarget);Q.bindFramebuffer(N.READ_FRAMEBUFFER,Kt.__webglFramebuffer),Q.bindFramebuffer(N.DRAW_FRAMEBUFFER,nr.__webglFramebuffer);for(let ni=0;ni<ze;ni++)Nt&&(N.framebufferTextureLayer(N.READ_FRAMEBUFFER,N.COLOR_ATTACHMENT0,Ie.get(P).__webglTexture,W,Je+ni),N.framebufferTextureLayer(N.DRAW_FRAMEBUFFER,N.COLOR_ATTACHMENT0,Ie.get(G).__webglTexture,ye,Ot+ni)),N.blitFramebuffer(ot,lt,Ue,Xe,ft,Rt,Ue,Xe,N.DEPTH_BUFFER_BIT,N.NEAREST);Q.bindFramebuffer(N.READ_FRAMEBUFFER,null),Q.bindFramebuffer(N.DRAW_FRAMEBUFFER,null)}else if(W!==0||P.isRenderTargetTexture||Ie.has(P)){const on=Ie.get(P),qt=Ie.get(G);Q.bindFramebuffer(N.READ_FRAMEBUFFER,fn),Q.bindFramebuffer(N.DRAW_FRAMEBUFFER,ti);for(let Kt=0;Kt<ze;Kt++)Nt?N.framebufferTextureLayer(N.READ_FRAMEBUFFER,N.COLOR_ATTACHMENT0,on.__webglTexture,W,Je+Kt):N.framebufferTexture2D(N.READ_FRAMEBUFFER,N.COLOR_ATTACHMENT0,N.TEXTURE_2D,on.__webglTexture,W),pn?N.framebufferTextureLayer(N.DRAW_FRAMEBUFFER,N.COLOR_ATTACHMENT0,qt.__webglTexture,ye,Ot+Kt):N.framebufferTexture2D(N.DRAW_FRAMEBUFFER,N.COLOR_ATTACHMENT0,N.TEXTURE_2D,qt.__webglTexture,ye),W!==0?N.blitFramebuffer(ot,lt,Ue,Xe,ft,Rt,Ue,Xe,N.COLOR_BUFFER_BIT,N.NEAREST):pn?N.copyTexSubImage3D(Yt,ye,ft,Rt,Ot+Kt,ot,lt,Ue,Xe):N.copyTexSubImage2D(Yt,ye,ft,Rt,ot,lt,Ue,Xe);Q.bindFramebuffer(N.READ_FRAMEBUFFER,null),Q.bindFramebuffer(N.DRAW_FRAMEBUFFER,null)}else pn?P.isDataTexture||P.isData3DTexture?N.texSubImage3D(Yt,ye,ft,Rt,Ot,Ue,Xe,ze,Mt,it,kt.data):G.isCompressedArrayTexture?N.compressedTexSubImage3D(Yt,ye,ft,Rt,Ot,Ue,Xe,ze,Mt,kt.data):N.texSubImage3D(Yt,ye,ft,Rt,Ot,Ue,Xe,ze,Mt,it,kt):P.isDataTexture?N.texSubImage2D(N.TEXTURE_2D,ye,ft,Rt,Ue,Xe,Mt,it,kt.data):P.isCompressedTexture?N.compressedTexSubImage2D(N.TEXTURE_2D,ye,ft,Rt,kt.width,kt.height,Mt,kt.data):N.texSubImage2D(N.TEXTURE_2D,ye,ft,Rt,Ue,Xe,Mt,it,kt);N.pixelStorei(N.UNPACK_ROW_LENGTH,Et),N.pixelStorei(N.UNPACK_IMAGE_HEIGHT,vn),N.pixelStorei(N.UNPACK_SKIP_PIXELS,Bt),N.pixelStorei(N.UNPACK_SKIP_ROWS,en),N.pixelStorei(N.UNPACK_SKIP_IMAGES,Ui),ye===0&&G.generateMipmaps&&N.generateMipmap(Yt),Q.unbindTexture()},this.copyTextureToTexture3D=function(P,G,J=null,Z=null,W=0){return Rr('WebGLRenderer: copyTextureToTexture3D function has been deprecated. Use "copyTextureToTexture" instead.'),this.copyTextureToTexture(P,G,J,Z,W)},this.initRenderTarget=function(P){Ie.get(P).__webglFramebuffer===void 0&&Re.setupRenderTarget(P)},this.initTexture=function(P){P.isCubeTexture?Re.setTextureCube(P,0):P.isData3DTexture?Re.setTexture3D(P,0):P.isDataArrayTexture||P.isCompressedArrayTexture?Re.setTexture2DArray(P,0):Re.setTexture2D(P,0),Q.unbindTexture()},this.resetState=function(){R=0,C=0,L=null,Q.reset(),at.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return di}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=vt._getDrawingBufferColorSpace(e),t.unpackColorSpace=vt._getUnpackColorSpace()}}var Dv=Object.defineProperty,Lv=(r,e,t)=>e in r?Dv(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Pt=(r,e,t)=>Lv(r,typeof e!="symbol"?e+"":e,t);const Lh=(r,e)=>{const[t,n]=e.split("-");return Object.assign(r.style,{left:n==="left"?"0":n==="center"?"50%":"",right:n==="right"?"0":"",top:t==="top"?"0":t==="bottom"?"":"50%",bottom:t==="bottom"?"0":"",transform:`${n==="center"?"translateX(-50%)":""} ${t==="center"?"translateY(-50%)":""}`}),e},Uv=({placement:r,size:e,offset:t,id:n,className:i})=>{const s=document.createElement("div"),{top:a,left:o,right:l,bottom:c}=t;return Object.assign(s.style,{id:n,position:"absolute",zIndex:"1000",height:`${e}px`,width:`${e}px`,margin:`${a}px ${l}px ${c}px ${o}px`,borderRadius:"100%"}),Lh(s,r),n&&(s.id=n),i&&(s.className=i),s},Iv=r=>{const e=typeof r=="string"?document.querySelector(r):r;if(!e)throw Error("Invalid DOM element");return e};function dl(r,e,t){return Math.max(e,Math.min(t,r))}const Nv=[["x",0,3],["y",1,4],["z",2,5]],Su=new k;function Mu({isSphere:r},e,t){r&&(Su.set(0,0,1).applyQuaternion(t.quaternion),Nv.forEach(([n,i,s])=>{const a=Su[n];let o=e[i],l=o.userData.opacity;o.material.opacity=dl(a>=0?l:l/2,0,1),o=e[s],l=o.userData.opacity,o.material.opacity=dl(a>=0?l/2:l,0,1)}))}const Fv=(r,e,t=10)=>Math.abs(r.clientX-e.x)<t&&Math.abs(r.clientY-e.y)<t,bu=new Xp,Eu=new dt,Tu=(r,e,t,n)=>{Eu.set((r.clientX-e.left)/e.width*2-1,-((r.clientY-e.top)/e.height)*2+1),bu.setFromCamera(Eu,t);const i=bu.intersectObjects(n,!1),s=i.length?i[0]:null;return!s||!s.object.visible?null:s},ho=1e-6,Ov=2*Math.PI,Uh=["x","y","z"],us=[...Uh,"nx","ny","nz"],Bv=["x","z","y","nx","nz","ny"],kv=["z","x","y","nz","nx","ny"],fl="Right",la="Top",pl="Front",ml="Left",ca="Bottom",gl="Back",zv=[fl,la,pl,ml,ca,gl].map(r=>r.toLocaleLowerCase()),Ih=1.3,wu=(r,e=!0)=>{const{material:t,userData:n}=r,{color:i,opacity:s}=e?n.hover:n;t.color.set(i),t.opacity=s},zi=r=>JSON.parse(JSON.stringify(r)),Vv=r=>{const e=r.type||"sphere",t=e==="sphere",n=r.resolution||t?64:128,i=Ft.DEFAULT_UP,s=i.z===1,a=i.x===1,{container:o}=r;r.container=void 0,r=JSON.parse(JSON.stringify(r)),r.container=o;const l=s?Bv:a?kv:us;zv.forEach((d,f)=>{r[d]&&(r[l[f]]=r[d])});const c={enabled:!0,color:16777215,opacity:1,scale:.7,labelColor:2236962,line:!1,border:{size:0,color:14540253},hover:{color:t?16777215:9688043,labelColor:2236962,opacity:1,scale:.7,border:{size:0,color:14540253}}},u={line:!1,scale:t?.45:.7,hover:{scale:t?.5:.7}},h={type:e,container:document.body,size:128,placement:"top-right",resolution:n,lineWidth:4,radius:t?1:.2,smoothness:18,animated:!0,speed:1,background:{enabled:!0,color:t?16777215:14739180,opacity:t?0:1,hover:{color:t?16777215:14739180,opacity:t?.2:1}},font:{family:"sans-serif",weight:900},offset:{top:10,left:10,bottom:10,right:10},corners:{enabled:!t,color:t?15915362:16777215,opacity:1,scale:t?.15:.2,radius:1,smoothness:18,hover:{color:t?16777215:9688043,opacity:1,scale:t?.2:.225}},edges:{enabled:!t,color:t?15915362:16777215,opacity:t?1:0,radius:t?1:.125,smoothness:18,scale:t?.15:1,hover:{color:t?16777215:9688043,opacity:1,scale:t?.2:1}},x:{...zi(c),...t?{label:"X",color:16725587,line:!0}:{label:a?la:fl}},y:{...zi(c),...t?{label:"Y",color:9100032,line:!0}:{label:s||a?pl:la}},z:{...zi(c),...t?{label:"Z",color:2920447,line:!0}:{label:s?la:a?fl:pl}},nx:{...zi(u),label:t?"":a?ca:ml},ny:{...zi(u),label:t?"":s||a?gl:ca},nz:{...zi(u),label:t?"":s?ca:a?ml:gl}};return _l(r,h),Uh.forEach(d=>_l(r[`n${d}`],zi(r[d]))),{...r,isSphere:t}};function _l(r,...e){if(r instanceof HTMLElement||typeof r!="object"||r===null)return r;for(const t of e)for(const n in t)n!=="container"&&n in t&&(r[n]===void 0?r[n]=t[n]:typeof t[n]=="object"&&!Array.isArray(t[n])&&(r[n]=_l(r[n]||{},t[n])));return r}const Hv=(r,e=2)=>{const t=new ht,n=e*2,{isSphere:i,resolution:s,radius:a,font:o,corners:l,edges:c}=r,u=us.map(C=>({...r[C],radius:a}));i&&l.enabled&&u.push(l),i&&c.enabled&&u.push(c);const h=document.createElement("canvas"),d=h.getContext("2d");h.width=s*2+n*2,h.height=s*u.length+n*u.length;const[f,m]=I(u,s,o);u.forEach(({radius:C,label:L,color:b,labelColor:x,border:w,hover:{color:B,labelColor:z,border:X}},j)=>{const O=s*j+j*n+e;y(e,O,e,s,C,L,w,b,x),y(s+e*3,O,e,s,C,L,X??w,B??b,z??x)});const _=u.length,g=e/(s*2),p=e/(s*6),M=1/_,E=new xp(h);return E.repeat.set(.5-2*g,M-2*p),E.offset.set(g,1-p),Object.assign(E,{colorSpace:At,wrapS:jn,wrapT:jn,userData:{offsetX:g,offsetY:p,cellHeight:M}}),E;function y(C,L,b,x,w,B,z,X,j){if(w=w*(x/2),X!=null&&X!==""&&(O(),d.fillStyle=t.set(X).getStyle(),d.fill()),z&&z.size){const K=z.size*x/2;C+=K,L+=K,x-=z.size*x,w=Math.max(0,w-K),O(),d.strokeStyle=t.set(z.color).getStyle(),d.lineWidth=z.size*x,d.stroke()}B&&R(d,C+x/2,L+(x+b)/2,B,t.set(j).getStyle());function O(){d.beginPath(),d.moveTo(C+w,L),d.lineTo(C+x-w,L),d.arcTo(C+x,L,C+x,L+w,w),d.lineTo(C+x,L+x-w),d.arcTo(C+x,L+x,C+x-w,L+x,w),d.lineTo(C+w,L+x),d.arcTo(C,L+x,C,L+x-w,w),d.lineTo(C,L+w),d.arcTo(C,L,C+w,L,w),d.closePath()}}function I(C,L,b){const x=[...C].sort((oe,$)=>{var xe,Ee;return(((xe=oe.label)==null?void 0:xe.length)||0)-(((Ee=$.label)==null?void 0:Ee.length)||0)}).pop().label,{family:w,weight:B}=b,z=i?Math.sqrt(Math.pow(L*.7,2)/2):L;let X=z,j=0,O=0;do{d.font=`${B} ${X}px ${w}`;const oe=d.measureText(x);j=oe.width,O=oe.fontBoundingBoxDescent,X--}while(j>z&&X>0);const K=z/O,H=Math.min(z/j,K),re=Math.floor(X*H);return[`${B} ${re}px ${w}`,K]}function R(C,L,b,x,w){C.font=f,C.textAlign="center",C.textBaseline="middle",C.fillStyle=w,C.fillText(x,L,b+(i?m:0))}},Gv=(r,e)=>r.offset.x=(e?.5:0)+r.userData.offsetX,Gl=(r,e)=>{const{offset:t,userData:{offsetY:n,cellHeight:i}}=r;t.y=1-(e+1)*i+n};function Wl(r,e,t=2,n=2){const i=t/2-r,s=n/2-r,a=r/t,o=(t-r)/t,l=r/n,c=(n-r)/n,u=[i,s,0,-i,s,0,-i,-s,0,i,-s,0],h=[o,c,a,c,a,l,o,l],d=[3*(e+1)+3,3*(e+1)+4,e+4,e+5,2*(e+1)+4,2,1,2*(e+1)+3,3,4*(e+1)+3,4,0],f=[0,1,2,0,2,3,4,5,6,4,6,7,8,9,10,8,10,11].map(R=>d[R]);let m,_,g,p,M,E,y,I;for(let R=0;R<4;R++){p=R<1||R>2?i:-i,M=R<2?s:-s,E=R<1||R>2?o:a,y=R<2?c:l;for(let C=0;C<=e;C++)m=Math.PI/2*(R+C/e),_=Math.cos(m),g=Math.sin(m),u.push(p+r*_,M+r*g,0),h.push(E+a*_,y+l*g),C<e&&(I=(e+1)*R+C+4,f.push(R,I,I+1))}return new Vt().setIndex(new Xt(new Uint32Array(f),1)).setAttribute("position",new Xt(new Float32Array(u),3)).setAttribute("uv",new Xt(new Float32Array(h),2))}const Wv=(r,e)=>{const t=new k,{isSphere:n,radius:i,smoothness:s}=r,a=Wl(i,s);return us.map((o,l)=>{const c=l<3,u=us[l],h=l?e.clone():e;Gl(h,l);const{enabled:d,scale:f,opacity:m,hover:_}=r[u],g={map:h,opacity:m,transparent:!0},p=n?new Ul(new Ma(g)):new Ut(a,new Ci(g)),M=c?u:u[1];return p.position[M]=(c?1:-1)*(n?Ih:1),n||p.lookAt(t.copy(p.position).multiplyScalar(1.7)),p.scale.setScalar(f),p.renderOrder=1,p.visible=d,p.userData={scale:f,opacity:m,hover:_},p})},Xv=(r,e)=>{const{isSphere:t,corners:n}=r;if(!n.enabled)return[];const{color:i,opacity:s,scale:a,radius:o,smoothness:l,hover:c}=n,u=t?null:Wl(o,l),h={transparent:!0,opacity:s},d=[1,1,1,-1,1,1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,-1,-1,-1,-1,-1].map(m=>m*.85),f=new k;return Array(d.length/3).fill(0).map((m,_)=>{if(t){const M=e.clone();Gl(M,6),h.map=M}else h.color=i;const g=t?new Ul(new Ma(h)):new Ut(u,new Ci(h)),p=_*3;return g.position.set(d[p],d[p+1],d[p+2]),t&&g.position.normalize().multiplyScalar(1.7),g.scale.setScalar(a),g.lookAt(f.copy(g.position).multiplyScalar(2)),g.renderOrder=1,g.userData={color:i,opacity:s,scale:a,hover:c},g})},qv=(r,e,t)=>{const{isSphere:n,edges:i}=r;if(!i.enabled)return[];const{color:s,opacity:a,scale:o,hover:l,radius:c,smoothness:u}=i,h=n?null:Wl(c,u,1.2,.25),d={transparent:!0,opacity:a},f=[0,1,1,0,-1,1,1,0,1,-1,0,1,0,1,-1,0,-1,-1,1,0,-1,-1,0,-1,1,1,0,1,-1,0,-1,1,0,-1,-1,0].map(g=>g*.925),m=new k,_=new k(0,1,0);return Array(f.length/3).fill(0).map((g,p)=>{if(n){const y=e.clone();Gl(y,t),d.map=y}else d.color=s;const M=n?new Ul(new Ma(d)):new Ut(h,new Ci(d)),E=p*3;return M.position.set(f[E],f[E+1],f[E+2]),n&&M.position.normalize().multiplyScalar(1.7),M.scale.setScalar(o),M.up.copy(_),M.lookAt(m.copy(M.position).multiplyScalar(2)),!n&&!M.position.y&&(M.rotation.z=Math.PI/2),M.renderOrder=1,M.userData={color:s,opacity:a,scale:o,hover:l},M})};function jv(r,e=!1){const t=r[0].index!==null,n=new Set(Object.keys(r[0].attributes)),i=new Set(Object.keys(r[0].morphAttributes)),s={},a={},o=r[0].morphTargetsRelative,l=new Vt;let c=0;for(let u=0;u<r.length;++u){const h=r[u];let d=0;if(t!==(h.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(const f in h.attributes){if(!n.has(f))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+'. All geometries must have compatible attributes; make sure "'+f+'" attribute exists among all geometries, or in none of them.'),null;s[f]===void 0&&(s[f]=[]),s[f].push(h.attributes[f]),d++}if(d!==n.size)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". Make sure all geometries have the same number of attributes."),null;if(o!==h.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(const f in h.morphAttributes){if(!i.has(f))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". .morphAttributes must be consistent throughout all geometries."),null;a[f]===void 0&&(a[f]=[]),a[f].push(h.morphAttributes[f])}if(e){let f;if(t)f=h.index.count;else if(h.attributes.position!==void 0)f=h.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". The geometry must have either an index or a position attribute"),null;l.addGroup(c,f,u),c+=f}}if(t){let u=0;const h=[];for(let d=0;d<r.length;++d){const f=r[d].index;for(let m=0;m<f.count;++m)h.push(f.getX(m)+u);u+=r[d].attributes.position.count}l.setIndex(h)}for(const u in s){const h=Au(s[u]);if(!h)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+u+" attribute."),null;l.setAttribute(u,h)}for(const u in a){const h=a[u][0].length;if(h===0)break;l.morphAttributes=l.morphAttributes||{},l.morphAttributes[u]=[];for(let d=0;d<h;++d){const f=[];for(let _=0;_<a[u].length;++_)f.push(a[u][_][d]);const m=Au(f);if(!m)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+u+" morphAttribute."),null;l.morphAttributes[u].push(m)}}return l}function Au(r){let e,t,n,i=-1,s=0;for(let c=0;c<r.length;++c){const u=r[c];if(e===void 0&&(e=u.array.constructor),e!==u.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(t===void 0&&(t=u.itemSize),t!==u.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(n===void 0&&(n=u.normalized),n!==u.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if(i===-1&&(i=u.gpuType),i!==u.gpuType)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."),null;s+=u.count*t}const a=new e(s),o=new Xt(a,t,n);let l=0;for(let c=0;c<r.length;++c){const u=r[c];if(u.isInterleavedBufferAttribute){const h=l/t;for(let d=0,f=u.count;d<f;d++)for(let m=0;m<t;m++){const _=u.getComponent(d,m);o.setComponent(d+h,m,_)}}else a.set(u.array,l);l+=u.count*t}return i!==void 0&&(o.gpuType=i),o}const Yv=(r,e)=>{const{isSphere:t,background:{enabled:n,color:i,opacity:s,hover:a}}=e;let o;const l=new Ci({color:i,side:_n,opacity:s,transparent:!0,depthWrite:!1});if(!n)return null;if(t)o=new Ut(new ba(1.8,64,64),l);else{let c;r.forEach(u=>{const h=u.scale.x;u.scale.setScalar(.9),u.updateMatrix();const d=u.geometry.clone();d.applyMatrix4(u.matrix),c=c?jv([c,d]):d,u.scale.setScalar(h)}),o=new Ut(c,l)}return o.userData={color:i,opacity:s,hover:a},o},Ru=new Zn,Ys=new k;class Nh extends Hp{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry";const e=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],t=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],n=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];this.setIndex(n),this.setAttribute("position",new xt(e,3)),this.setAttribute("uv",new xt(t,2))}applyMatrix4(e){const t=this.attributes.instanceStart,n=this.attributes.instanceEnd;return t!==void 0&&(t.applyMatrix4(e),n.applyMatrix4(e),t.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));const n=new cl(t,6,1);return this.setAttribute("instanceStart",new Kn(n,3,0)),this.setAttribute("instanceEnd",new Kn(n,3,3)),this.instanceCount=this.attributes.instanceStart.count,this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));const n=new cl(t,6,1);return this.setAttribute("instanceColorStart",new Kn(n,3,0)),this.setAttribute("instanceColorEnd",new Kn(n,3,3)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(e){return this.fromWireframeGeometry(new Sp(e.geometry)),this}fromLineSegments(e){const t=e.geometry;return this.setPositions(t.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Zn);const e=this.attributes.instanceStart,t=this.attributes.instanceEnd;e!==void 0&&t!==void 0&&(this.boundingBox.setFromBufferAttribute(e),Ru.setFromBufferAttribute(t),this.boundingBox.union(Ru))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new _i),this.boundingBox===null&&this.computeBoundingBox();const e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(e!==void 0&&t!==void 0){const n=this.boundingSphere.center;this.boundingBox.getCenter(n);let i=0;for(let s=0,a=e.count;s<a;s++)Ys.fromBufferAttribute(e,s),i=Math.max(i,n.distanceToSquared(Ys)),Ys.fromBufferAttribute(t,s),i=Math.max(i,n.distanceToSquared(Ys));this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}applyMatrix(e){return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."),this.applyMatrix4(e)}}Ce.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new dt(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}};Mn.line={uniforms:Dl.merge([Ce.common,Ce.fog,Ce.line]),vertexShader:`
|
|
3828
3828
|
#include <common>
|
|
3829
3829
|
#include <color_pars_vertex>
|
|
3830
3830
|
#include <fog_pars_vertex>
|
|
@@ -4194,14 +4194,14 @@ void main() {
|
|
|
4194
4194
|
#include <premultiplied_alpha_fragment>
|
|
4195
4195
|
|
|
4196
4196
|
}
|
|
4197
|
-
`};class Xl extends gi{constructor(e){super({type:"LineMaterial",uniforms:Dl.clone(Mn.line.uniforms),vertexShader:Mn.line.vertexShader,fragmentShader:Mn.line.fragmentShader,clipping:!0}),this.isLineMaterial=!0,this.setValues(e)}get color(){return this.uniforms.diffuse.value}set color(e){this.uniforms.diffuse.value=e}get worldUnits(){return"WORLD_UNITS"in this.defines}set worldUnits(e){e===!0?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}get linewidth(){return this.uniforms.linewidth.value}set linewidth(e){this.uniforms.linewidth&&(this.uniforms.linewidth.value=e)}get dashed(){return"USE_DASH"in this.defines}set dashed(e){e===!0!==this.dashed&&(this.needsUpdate=!0),e===!0?this.defines.USE_DASH="":delete this.defines.USE_DASH}get dashScale(){return this.uniforms.dashScale.value}set dashScale(e){this.uniforms.dashScale.value=e}get dashSize(){return this.uniforms.dashSize.value}set dashSize(e){this.uniforms.dashSize.value=e}get dashOffset(){return this.uniforms.dashOffset.value}set dashOffset(e){this.uniforms.dashOffset.value=e}get gapSize(){return this.uniforms.gapSize.value}set gapSize(e){this.uniforms.gapSize.value=e}get opacity(){return this.uniforms.opacity.value}set opacity(e){this.uniforms&&(this.uniforms.opacity.value=e)}get resolution(){return this.uniforms.resolution.value}set resolution(e){this.uniforms.resolution.value.copy(e)}get alphaToCoverage(){return"USE_ALPHA_TO_COVERAGE"in this.defines}set alphaToCoverage(e){this.defines&&(e===!0!==this.alphaToCoverage&&(this.needsUpdate=!0),e===!0?this.defines.USE_ALPHA_TO_COVERAGE="":delete this.defines.USE_ALPHA_TO_COVERAGE)}}const fo=new St,Cu=new k,Pu=new k,tn=new St,nn=new St,Wn=new St,po=new k,mo=new ut,rn=new jp,Du=new k,Ks=new Zn,$s=new _i,Xn=new St;let qn,Yi;function Lu(r,e,t){return Xn.set(0,0,-e,1).applyMatrix4(r.projectionMatrix),Xn.multiplyScalar(1/Xn.w),Xn.x=Yi/t.width,Xn.y=Yi/t.height,Xn.applyMatrix4(r.projectionMatrixInverse),Xn.multiplyScalar(1/Xn.w),Math.abs(Math.max(Xn.x,Xn.y))}function $v(r,e){const t=r.matrixWorld,n=r.geometry,i=n.attributes.instanceStart,s=n.attributes.instanceEnd,a=Math.min(n.instanceCount,i.count);for(let o=0,l=a;o<l;o++){rn.start.fromBufferAttribute(i,o),rn.end.fromBufferAttribute(s,o),rn.applyMatrix4(t);const c=new k,u=new k;qn.distanceSqToSegment(rn.start,rn.end,u,c),u.distanceTo(c)<Yi*.5&&e.push({point:u,pointOnLine:c,distance:qn.origin.distanceTo(u),object:r,face:null,faceIndex:o,uv:null,uv1:null})}}function Jv(r,e,t){const n=e.projectionMatrix,i=r.material.resolution,s=r.matrixWorld,a=r.geometry,o=a.attributes.instanceStart,l=a.attributes.instanceEnd,c=Math.min(a.instanceCount,o.count),u=-e.near;qn.at(1,Wn),Wn.w=1,Wn.applyMatrix4(e.matrixWorldInverse),Wn.applyMatrix4(n),Wn.multiplyScalar(1/Wn.w),Wn.x*=i.x/2,Wn.y*=i.y/2,Wn.z=0,po.copy(Wn),mo.multiplyMatrices(e.matrixWorldInverse,s);for(let h=0,d=c;h<d;h++){if(tn.fromBufferAttribute(o,h),nn.fromBufferAttribute(l,h),tn.w=1,nn.w=1,tn.applyMatrix4(mo),nn.applyMatrix4(mo),tn.z>u&&nn.z>u)continue;if(tn.z>u){const p=tn.z-nn.z,M=(tn.z-u)/p;tn.lerp(nn,M)}else if(nn.z>u){const p=nn.z-tn.z,M=(nn.z-u)/p;nn.lerp(tn,M)}tn.applyMatrix4(n),nn.applyMatrix4(n),tn.multiplyScalar(1/tn.w),nn.multiplyScalar(1/nn.w),tn.x*=i.x/2,tn.y*=i.y/2,nn.x*=i.x/2,nn.y*=i.y/2,rn.start.copy(tn),rn.start.z=0,rn.end.copy(nn),rn.end.z=0;const f=rn.closestPointToPointParameter(po,!0);rn.at(f,Du);const m=Wi.lerp(tn.z,nn.z,f),_=m>=-1&&m<=1,g=po.distanceTo(Du)<Yi*.5;if(_&&g){rn.start.fromBufferAttribute(o,h),rn.end.fromBufferAttribute(l,h),rn.start.applyMatrix4(s),rn.end.applyMatrix4(s);const p=new k,M=new k;qn.distanceSqToSegment(rn.start,rn.end,M,p),t.push({point:M,pointOnLine:p,distance:qn.origin.distanceTo(M),object:r,face:null,faceIndex:h,uv:null,uv1:null})}}}class Zv extends Ut{constructor(e=new Nh,t=new Xl({color:Math.random()*16777215})){super(e,t),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){const e=this.geometry,t=e.attributes.instanceStart,n=e.attributes.instanceEnd,i=new Float32Array(2*t.count);for(let a=0,o=0,l=t.count;a<l;a++,o+=2)Cu.fromBufferAttribute(t,a),Pu.fromBufferAttribute(n,a),i[o]=o===0?0:i[o-1],i[o+1]=i[o]+Cu.distanceTo(Pu);const s=new cl(i,2,1);return e.setAttribute("instanceDistanceStart",new Kn(s,1,0)),e.setAttribute("instanceDistanceEnd",new Kn(s,1,1)),this}raycast(e,t){const n=this.material.worldUnits,i=e.camera;i===null&&!n&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.');const s=e.params.Line2!==void 0&&e.params.Line2.threshold||0;qn=e.ray;const a=this.matrixWorld,o=this.geometry,l=this.material;Yi=l.linewidth+s,o.boundingSphere===null&&o.computeBoundingSphere(),$s.copy(o.boundingSphere).applyMatrix4(a);let c;if(n)c=Yi*.5;else{const h=Math.max(i.near,$s.distanceToPoint(qn.origin));c=Lu(i,h,l.resolution)}if($s.radius+=c,qn.intersectsSphere($s)===!1)return;o.boundingBox===null&&o.computeBoundingBox(),Ks.copy(o.boundingBox).applyMatrix4(a);let u;if(n)u=Yi*.5;else{const h=Math.max(i.near,Ks.distanceToPoint(qn.origin));u=Lu(i,h,l.resolution)}Ks.expandByScalar(u),qn.intersectsBox(Ks)!==!1&&(n?$v(this,t):Jv(this,i,t))}onBeforeRender(e){const t=this.material.uniforms;t&&t.resolution&&(e.getViewport(fo),this.material.uniforms.resolution.value.set(fo.z,fo.w))}}class Fh extends Nh{constructor(){super(),this.isLineGeometry=!0,this.type="LineGeometry"}setPositions(e){const t=e.length-3,n=new Float32Array(2*t);for(let i=0;i<t;i+=3)n[2*i]=e[i],n[2*i+1]=e[i+1],n[2*i+2]=e[i+2],n[2*i+3]=e[i+3],n[2*i+4]=e[i+4],n[2*i+5]=e[i+5];return super.setPositions(n),this}setColors(e){const t=e.length-3,n=new Float32Array(2*t);for(let i=0;i<t;i+=3)n[2*i]=e[i],n[2*i+1]=e[i+1],n[2*i+2]=e[i+2],n[2*i+3]=e[i+3],n[2*i+4]=e[i+4],n[2*i+5]=e[i+5];return super.setColors(n),this}setFromPoints(e){const t=e.length-1,n=new Float32Array(6*t);for(let i=0;i<t;i++)n[6*i]=e[i].x,n[6*i+1]=e[i].y,n[6*i+2]=e[i].z||0,n[6*i+3]=e[i+1].x,n[6*i+4]=e[i+1].y,n[6*i+5]=e[i+1].z||0;return super.setPositions(n),this}fromLine(e){const t=e.geometry;return this.setPositions(t.attributes.position.array),this}}class Qv extends Zv{constructor(e=new Fh,t=new Xl({color:Math.random()*16777215})){super(e,t),this.isLine2=!0,this.type="Line2"}}const ey=r=>{const e=new ht,t=[],n=[],{isSphere:i}=r;if(us.forEach((o,l)=>{const{enabled:c,line:u,scale:h,color:d}=r[o];if(!c||!u)return;const f=l<3?1:-1,m=(i?Ih-h/2:.975)*f;t.push(o.includes("x")?m:0,o.includes("y")?m:0,o.includes("z")?m:0,0,0,0);const _=e.set(d).toArray();n.push(..._,..._)}),!t.length)return null;const s=new Fh().setPositions(t).setColors(n),a=new Xl({linewidth:r.lineWidth,vertexColors:!0,resolution:new dt(window.innerWidth,window.innerHeight)});return new Qv(s,a).computeLineDistances()},ty=r=>{const{corners:e,edges:t}=r,n=[],i=Gv(r),s=Xv(r,i);n.push(...s),e.enabled&&n.push(...qv(r,i)),t.enabled&&n.push(...jv(r,i,e.enabled?7:6));const a=Kv(s,r),o=ey(r);return[n,a,o]},Zr=(r,e=!0)=>{const{material:t,userData:n}=r,{opacity:i,color:s,scale:a}=e?n.hover:n;r.scale.setScalar(a),t.opacity=i,t.map?Wv(t.map,e):t.color.set(s)},Mr=new ut,Uu=new wh,ny=new dt,Vi=new k,Iu=new St;class iy extends Ft{constructor(e,t,n={}){super(),Pt(this,"enabled",!0),Pt(this,"camera"),Pt(this,"renderer"),Pt(this,"options"),Pt(this,"target",new k),Pt(this,"animated",!0),Pt(this,"speed",1),Pt(this,"animating",!1),Pt(this,"_options"),Pt(this,"_intersections"),Pt(this,"_background",null),Pt(this,"_viewport",[0,0,0,0]),Pt(this,"_originalViewport",[0,0,0,0]),Pt(this,"_originalScissor",[0,0,0,0]),Pt(this,"_scene"),Pt(this,"_camera"),Pt(this,"_container"),Pt(this,"_domElement"),Pt(this,"_domRect"),Pt(this,"_dragging",!1),Pt(this,"_distance",0),Pt(this,"_clock",new Xp),Pt(this,"_targetQuaternion",new Cn),Pt(this,"_quaternionStart",new Cn),Pt(this,"_quaternionEnd",new Cn),Pt(this,"_pointerStart",new dt),Pt(this,"_focus",null),Pt(this,"_placement"),Pt(this,"_controls"),Pt(this,"_controlsListeners"),this.camera=e,this.renderer=t,this._scene=new Ll().add(this),this.set(n)}get placement(){return this._placement}set placement(e){this._placement=Lh(this._domElement,e),this.domUpdate()}set(e={}){this.dispose(),this.options=e,this._options=Hv(e),this._camera=this._options.isSphere?new Ta(-1.8,1.8,1.8,-1.8,5,10):new sn(26,1,5,10),this._camera.position.set(0,0,7);const[t,n,i]=ty(this._options);n&&this.add(n),i&&this.add(i),this.add(...t),this._background=n,this._intersections=t;const{container:s,animated:a,speed:o}=this._options;return this.animated=a,this.speed=o,this._container=s?Nv(s):document.body,this._domElement=Iv(this._options),this._domElement.onpointerdown=l=>this._onPointerDown(l),this._domElement.onpointermove=l=>this._onPointerMove(l),this._domElement.onpointerleave=()=>this._onPointerLeave(),this._container.appendChild(this._domElement),this._controls&&this.attachControls(this._controls),this.update(),this._updateOrientation(!0),this}render(){this.animating&&this._animate();const{renderer:e,_viewport:t}=this,n=e.getScissorTest(),i=e.autoClear;return e.autoClear=!1,e.setViewport(...t),n&&e.setScissor(...t),e.clear(!1,!0,!1),e.render(this._scene,this._camera),e.setViewport(...this._originalViewport),n&&e.setScissor(...this._originalScissor),e.autoClear=i,this}domUpdate(){this._domRect=this._domElement.getBoundingClientRect();const e=this.renderer,t=this._domRect,n=e.domElement.getBoundingClientRect();return this._viewport.splice(0,4,t.left-n.left,e.domElement.clientHeight-(t.top-n.top+t.height),t.width,t.height),e.getViewport(Iu).toArray(this._originalViewport),e.getScissorTest()&&e.getScissor(Iu).toArray(this._originalScissor),this}cameraUpdate(){return this._updateOrientation(),this}update(e=!0){return e&&this._controls&&this._controls.update(),this.domUpdate().cameraUpdate()}attachControls(e){return this.detachControls(),this.target=e.target,this._controlsListeners={start:()=>e.enabled=!1,end:()=>e.enabled=!0,change:()=>this.update(!1)},this.addEventListener("start",this._controlsListeners.start),this.addEventListener("end",this._controlsListeners.end),e.addEventListener("change",this._controlsListeners.change),this._controls=e,this}detachControls(){if(!(!this._controlsListeners||!this._controls))return this.target=new k().copy(this._controls.target),this.removeEventListener("start",this._controlsListeners.start),this.removeEventListener("end",this._controlsListeners.end),this._controls.removeEventListener("change",this._controlsListeners.change),this._controlsListeners=void 0,this._controls=void 0,this}dispose(){var e;this.detachControls(),this.children.forEach(t=>{var n,i,s,a;this.remove(t);const o=t;(n=o.material)==null||n.dispose(),(s=(i=o.material)==null?void 0:i.map)==null||s.dispose(),(a=o.geometry)==null||a.dispose()}),(e=this._domElement)==null||e.remove()}_updateOrientation(e=!0){e&&(this.quaternion.copy(this.camera.quaternion).invert(),this.updateMatrixWorld()),Mu(this._options,this._intersections,this.camera)}_animate(){const{position:e,quaternion:t}=this.camera;if(e.set(0,0,1),!this.animated){e.applyQuaternion(this._quaternionEnd).multiplyScalar(this._distance).add(this.target),t.copy(this._targetQuaternion),this._updateOrientation(),this.animating=!1,this.dispatchEvent({type:"change"}),this.dispatchEvent({type:"end"});return}this._controls&&(this._controls.enabled=!1);const n=this._clock.getDelta()*Bv*this.speed;this._quaternionStart.rotateTowards(this._quaternionEnd,n),e.applyQuaternion(this._quaternionStart).multiplyScalar(this._distance).add(this.target),t.rotateTowards(this._targetQuaternion,n),this._updateOrientation(),requestAnimationFrame(()=>this.dispatchEvent({type:"change"})),this._quaternionStart.angleTo(this._quaternionEnd)<ho&&(this._controls&&(this._controls.enabled=!0),this.animating=!1,this.dispatchEvent({type:"end"}))}_setOrientation(e){const t=this.camera,n=this.target;Vi.copy(e).multiplyScalar(this._distance),Mr.setPosition(Vi).lookAt(Vi,this.position,this.up),this._targetQuaternion.setFromRotationMatrix(Mr),Vi.add(n),Mr.lookAt(Vi,n,this.up),this._quaternionEnd.setFromRotationMatrix(Mr),Mr.setPosition(t.position).lookAt(t.position,n,this.up),this._quaternionStart.setFromRotationMatrix(Mr),this.animating=!0,this._clock.start(),this.dispatchEvent({type:"start"})}_onPointerDown(e){if(!this.enabled)return;const t=l=>{if(!this._dragging){if(Ov(l,this._pointerStart))return;this._dragging=!0}const c=ny.set(l.clientX,l.clientY).sub(this._pointerStart).multiplyScalar(1/this._domRect.width*Math.PI),u=this.coordinateConversion(Vi.subVectors(this.camera.position,this.target)),h=Uu.setFromVector3(u);h.theta=a-c.x,h.phi=dl(o-c.y,ho,Math.PI-ho),this.coordinateConversion(this.camera.position.setFromSpherical(h),!0).add(this.target),this.camera.lookAt(this.target),this.quaternion.copy(this.camera.quaternion).invert(),this._updateOrientation(!1),this.dispatchEvent({type:"change"})},n=()=>{if(document.removeEventListener("pointermove",t,!1),document.removeEventListener("pointerup",n,!1),!this._dragging)return this._handleClick(e);this._focus&&(Zr(this._focus,!1),this._focus=null),this._dragging=!1,this.dispatchEvent({type:"end"})};if(this.animating)return;e.preventDefault(),this._pointerStart.set(e.clientX,e.clientY);const i=this.coordinateConversion(Vi.subVectors(this.camera.position,this.target)),s=Uu.setFromVector3(i),a=s.theta,o=s.phi;this._distance=s.radius,document.addEventListener("pointermove",t,!1),document.addEventListener("pointerup",n,!1),this.dispatchEvent({type:"start"})}coordinateConversion(e,t=!1){const{x:n,y:i,z:s}=e,a=Ft.DEFAULT_UP;return a.x===1?t?e.set(i,s,n):e.set(s,n,i):a.z===1?t?e.set(s,n,i):e.set(i,s,n):e}_onPointerMove(e){!this.enabled||this._dragging||(this._background&&wu(this._background,!0),this._handleHover(e))}_onPointerLeave(){!this.enabled||this._dragging||(this._background&&wu(this._background,!1),this._focus&&Zr(this._focus,!1),this._domElement.style.cursor="")}_handleClick(e){const t=Tu(e,this._domRect,this._camera,this._intersections);this._focus&&(Zr(this._focus,!1),this._focus=null),t&&(this._setOrientation(t.object.position),this.dispatchEvent({type:"change"}))}_handleHover(e){const t=Tu(e,this._domRect,this._camera,this._intersections),n=(t==null?void 0:t.object)||null;this._focus!==n&&(this._domElement.style.cursor=n?"pointer":"",this._focus&&Zr(this._focus,!1),(this._focus=n)?Zr(n,!0):Mu(this._options,this._intersections,this.camera))}}const ry=/^[og]\s*(.+)?/,sy=/^mtllib /,ay=/^usemtl /,oy=/^usemap /,Nu=/\s+/,Fu=new k,go=new k,Ou=new k,Bu=new k,Ln=new k,Js=new ht;function ly(){const r={objects:[],object:{},vertices:[],normals:[],colors:[],uvs:[],materials:{},materialLibraries:[],startObject:function(e,t){if(this.object&&this.object.fromDeclaration===!1){this.object.name=e,this.object.fromDeclaration=t!==!1;return}const n=this.object&&typeof this.object.currentMaterial=="function"?this.object.currentMaterial():void 0;if(this.object&&typeof this.object._finalize=="function"&&this.object._finalize(!0),this.object={name:e||"",fromDeclaration:t!==!1,geometry:{vertices:[],normals:[],colors:[],uvs:[],hasUVIndices:!1},materials:[],smooth:!0,startMaterial:function(i,s){const a=this._finalize(!1);a&&(a.inherited||a.groupCount<=0)&&this.materials.splice(a.index,1);const o={index:this.materials.length,name:i||"",mtllib:Array.isArray(s)&&s.length>0?s[s.length-1]:"",smooth:a!==void 0?a.smooth:this.smooth,groupStart:a!==void 0?a.groupEnd:0,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(l){const c={index:typeof l=="number"?l:this.index,name:this.name,mtllib:this.mtllib,smooth:this.smooth,groupStart:0,groupEnd:-1,groupCount:-1,inherited:!1};return c.clone=this.clone.bind(c),c}};return this.materials.push(o),o},currentMaterial:function(){if(this.materials.length>0)return this.materials[this.materials.length-1]},_finalize:function(i){const s=this.currentMaterial();if(s&&s.groupEnd===-1&&(s.groupEnd=this.geometry.vertices.length/3,s.groupCount=s.groupEnd-s.groupStart,s.inherited=!1),i&&this.materials.length>1)for(let a=this.materials.length-1;a>=0;a--)this.materials[a].groupCount<=0&&this.materials.splice(a,1);return i&&this.materials.length===0&&this.materials.push({name:"",smooth:this.smooth}),s}},n&&n.name&&typeof n.clone=="function"){const i=n.clone(0);i.inherited=!0,this.object.materials.push(i)}this.objects.push(this.object)},finalize:function(){this.object&&typeof this.object._finalize=="function"&&this.object._finalize(!0)},parseVertexIndex:function(e,t){const n=parseInt(e,10);return(n>=0?n-1:n+t/3)*3},parseNormalIndex:function(e,t){const n=parseInt(e,10);return(n>=0?n-1:n+t/3)*3},parseUVIndex:function(e,t){const n=parseInt(e,10);return(n>=0?n-1:n+t/2)*2},addVertex:function(e,t,n){const i=this.vertices,s=this.object.geometry.vertices;s.push(i[e+0],i[e+1],i[e+2]),s.push(i[t+0],i[t+1],i[t+2]),s.push(i[n+0],i[n+1],i[n+2])},addVertexPoint:function(e){const t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addVertexLine:function(e){const t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addNormal:function(e,t,n){const i=this.normals,s=this.object.geometry.normals;s.push(i[e+0],i[e+1],i[e+2]),s.push(i[t+0],i[t+1],i[t+2]),s.push(i[n+0],i[n+1],i[n+2])},addFaceNormal:function(e,t,n){const i=this.vertices,s=this.object.geometry.normals;Fu.fromArray(i,e),go.fromArray(i,t),Ou.fromArray(i,n),Ln.subVectors(Ou,go),Bu.subVectors(Fu,go),Ln.cross(Bu),Ln.normalize(),s.push(Ln.x,Ln.y,Ln.z),s.push(Ln.x,Ln.y,Ln.z),s.push(Ln.x,Ln.y,Ln.z)},addColor:function(e,t,n){const i=this.colors,s=this.object.geometry.colors;i[e]!==void 0&&s.push(i[e+0],i[e+1],i[e+2]),i[t]!==void 0&&s.push(i[t+0],i[t+1],i[t+2]),i[n]!==void 0&&s.push(i[n+0],i[n+1],i[n+2])},addUV:function(e,t,n){const i=this.uvs,s=this.object.geometry.uvs;s.push(i[e+0],i[e+1]),s.push(i[t+0],i[t+1]),s.push(i[n+0],i[n+1])},addDefaultUV:function(){const e=this.object.geometry.uvs;e.push(0,0),e.push(0,0),e.push(0,0)},addUVLine:function(e){const t=this.uvs;this.object.geometry.uvs.push(t[e+0],t[e+1])},addFace:function(e,t,n,i,s,a,o,l,c){const u=this.vertices.length;let h=this.parseVertexIndex(e,u),d=this.parseVertexIndex(t,u),f=this.parseVertexIndex(n,u);if(this.addVertex(h,d,f),this.addColor(h,d,f),o!==void 0&&o!==""){const m=this.normals.length;h=this.parseNormalIndex(o,m),d=this.parseNormalIndex(l,m),f=this.parseNormalIndex(c,m),this.addNormal(h,d,f)}else this.addFaceNormal(h,d,f);if(i!==void 0&&i!==""){const m=this.uvs.length;h=this.parseUVIndex(i,m),d=this.parseUVIndex(s,m),f=this.parseUVIndex(a,m),this.addUV(h,d,f),this.object.geometry.hasUVIndices=!0}else this.addDefaultUV()},addPointGeometry:function(e){this.object.geometry.type="Points";const t=this.vertices.length;for(let n=0,i=e.length;n<i;n++){const s=this.parseVertexIndex(e[n],t);this.addVertexPoint(s),this.addColor(s)}},addLineGeometry:function(e,t){this.object.geometry.type="Line";const n=this.vertices.length,i=this.uvs.length;for(let s=0,a=e.length;s<a;s++)this.addVertexLine(this.parseVertexIndex(e[s],n));for(let s=0,a=t.length;s<a;s++)this.addUVLine(this.parseUVIndex(t[s],i))}};return r.startObject("",!1),r}class _o extends Hn{constructor(e){super(e),this.materials=null}load(e,t,n,i){const s=this,a=new Vr(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(o){try{t(s.parse(o))}catch(l){i?i(l):console.error(l),s.manager.itemError(e)}},n,i)}setMaterials(e){return this.materials=e,this}parse(e){const t=new ly;e.indexOf(`\r
|
|
4197
|
+
`};class Xl extends gi{constructor(e){super({type:"LineMaterial",uniforms:Dl.clone(Mn.line.uniforms),vertexShader:Mn.line.vertexShader,fragmentShader:Mn.line.fragmentShader,clipping:!0}),this.isLineMaterial=!0,this.setValues(e)}get color(){return this.uniforms.diffuse.value}set color(e){this.uniforms.diffuse.value=e}get worldUnits(){return"WORLD_UNITS"in this.defines}set worldUnits(e){e===!0?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}get linewidth(){return this.uniforms.linewidth.value}set linewidth(e){this.uniforms.linewidth&&(this.uniforms.linewidth.value=e)}get dashed(){return"USE_DASH"in this.defines}set dashed(e){e===!0!==this.dashed&&(this.needsUpdate=!0),e===!0?this.defines.USE_DASH="":delete this.defines.USE_DASH}get dashScale(){return this.uniforms.dashScale.value}set dashScale(e){this.uniforms.dashScale.value=e}get dashSize(){return this.uniforms.dashSize.value}set dashSize(e){this.uniforms.dashSize.value=e}get dashOffset(){return this.uniforms.dashOffset.value}set dashOffset(e){this.uniforms.dashOffset.value=e}get gapSize(){return this.uniforms.gapSize.value}set gapSize(e){this.uniforms.gapSize.value=e}get opacity(){return this.uniforms.opacity.value}set opacity(e){this.uniforms&&(this.uniforms.opacity.value=e)}get resolution(){return this.uniforms.resolution.value}set resolution(e){this.uniforms.resolution.value.copy(e)}get alphaToCoverage(){return"USE_ALPHA_TO_COVERAGE"in this.defines}set alphaToCoverage(e){this.defines&&(e===!0!==this.alphaToCoverage&&(this.needsUpdate=!0),e===!0?this.defines.USE_ALPHA_TO_COVERAGE="":delete this.defines.USE_ALPHA_TO_COVERAGE)}}const fo=new St,Cu=new k,Pu=new k,tn=new St,nn=new St,Wn=new St,po=new k,mo=new ut,rn=new qp,Du=new k,Ks=new Zn,$s=new _i,Xn=new St;let qn,Yi;function Lu(r,e,t){return Xn.set(0,0,-e,1).applyMatrix4(r.projectionMatrix),Xn.multiplyScalar(1/Xn.w),Xn.x=Yi/t.width,Xn.y=Yi/t.height,Xn.applyMatrix4(r.projectionMatrixInverse),Xn.multiplyScalar(1/Xn.w),Math.abs(Math.max(Xn.x,Xn.y))}function Kv(r,e){const t=r.matrixWorld,n=r.geometry,i=n.attributes.instanceStart,s=n.attributes.instanceEnd,a=Math.min(n.instanceCount,i.count);for(let o=0,l=a;o<l;o++){rn.start.fromBufferAttribute(i,o),rn.end.fromBufferAttribute(s,o),rn.applyMatrix4(t);const c=new k,u=new k;qn.distanceSqToSegment(rn.start,rn.end,u,c),u.distanceTo(c)<Yi*.5&&e.push({point:u,pointOnLine:c,distance:qn.origin.distanceTo(u),object:r,face:null,faceIndex:o,uv:null,uv1:null})}}function $v(r,e,t){const n=e.projectionMatrix,i=r.material.resolution,s=r.matrixWorld,a=r.geometry,o=a.attributes.instanceStart,l=a.attributes.instanceEnd,c=Math.min(a.instanceCount,o.count),u=-e.near;qn.at(1,Wn),Wn.w=1,Wn.applyMatrix4(e.matrixWorldInverse),Wn.applyMatrix4(n),Wn.multiplyScalar(1/Wn.w),Wn.x*=i.x/2,Wn.y*=i.y/2,Wn.z=0,po.copy(Wn),mo.multiplyMatrices(e.matrixWorldInverse,s);for(let h=0,d=c;h<d;h++){if(tn.fromBufferAttribute(o,h),nn.fromBufferAttribute(l,h),tn.w=1,nn.w=1,tn.applyMatrix4(mo),nn.applyMatrix4(mo),tn.z>u&&nn.z>u)continue;if(tn.z>u){const p=tn.z-nn.z,M=(tn.z-u)/p;tn.lerp(nn,M)}else if(nn.z>u){const p=nn.z-tn.z,M=(nn.z-u)/p;nn.lerp(tn,M)}tn.applyMatrix4(n),nn.applyMatrix4(n),tn.multiplyScalar(1/tn.w),nn.multiplyScalar(1/nn.w),tn.x*=i.x/2,tn.y*=i.y/2,nn.x*=i.x/2,nn.y*=i.y/2,rn.start.copy(tn),rn.start.z=0,rn.end.copy(nn),rn.end.z=0;const f=rn.closestPointToPointParameter(po,!0);rn.at(f,Du);const m=Wi.lerp(tn.z,nn.z,f),_=m>=-1&&m<=1,g=po.distanceTo(Du)<Yi*.5;if(_&&g){rn.start.fromBufferAttribute(o,h),rn.end.fromBufferAttribute(l,h),rn.start.applyMatrix4(s),rn.end.applyMatrix4(s);const p=new k,M=new k;qn.distanceSqToSegment(rn.start,rn.end,M,p),t.push({point:M,pointOnLine:p,distance:qn.origin.distanceTo(M),object:r,face:null,faceIndex:h,uv:null,uv1:null})}}}class Jv extends Ut{constructor(e=new Nh,t=new Xl({color:Math.random()*16777215})){super(e,t),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){const e=this.geometry,t=e.attributes.instanceStart,n=e.attributes.instanceEnd,i=new Float32Array(2*t.count);for(let a=0,o=0,l=t.count;a<l;a++,o+=2)Cu.fromBufferAttribute(t,a),Pu.fromBufferAttribute(n,a),i[o]=o===0?0:i[o-1],i[o+1]=i[o]+Cu.distanceTo(Pu);const s=new cl(i,2,1);return e.setAttribute("instanceDistanceStart",new Kn(s,1,0)),e.setAttribute("instanceDistanceEnd",new Kn(s,1,1)),this}raycast(e,t){const n=this.material.worldUnits,i=e.camera;i===null&&!n&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.');const s=e.params.Line2!==void 0&&e.params.Line2.threshold||0;qn=e.ray;const a=this.matrixWorld,o=this.geometry,l=this.material;Yi=l.linewidth+s,o.boundingSphere===null&&o.computeBoundingSphere(),$s.copy(o.boundingSphere).applyMatrix4(a);let c;if(n)c=Yi*.5;else{const h=Math.max(i.near,$s.distanceToPoint(qn.origin));c=Lu(i,h,l.resolution)}if($s.radius+=c,qn.intersectsSphere($s)===!1)return;o.boundingBox===null&&o.computeBoundingBox(),Ks.copy(o.boundingBox).applyMatrix4(a);let u;if(n)u=Yi*.5;else{const h=Math.max(i.near,Ks.distanceToPoint(qn.origin));u=Lu(i,h,l.resolution)}Ks.expandByScalar(u),qn.intersectsBox(Ks)!==!1&&(n?Kv(this,t):$v(this,i,t))}onBeforeRender(e){const t=this.material.uniforms;t&&t.resolution&&(e.getViewport(fo),this.material.uniforms.resolution.value.set(fo.z,fo.w))}}class Fh extends Nh{constructor(){super(),this.isLineGeometry=!0,this.type="LineGeometry"}setPositions(e){const t=e.length-3,n=new Float32Array(2*t);for(let i=0;i<t;i+=3)n[2*i]=e[i],n[2*i+1]=e[i+1],n[2*i+2]=e[i+2],n[2*i+3]=e[i+3],n[2*i+4]=e[i+4],n[2*i+5]=e[i+5];return super.setPositions(n),this}setColors(e){const t=e.length-3,n=new Float32Array(2*t);for(let i=0;i<t;i+=3)n[2*i]=e[i],n[2*i+1]=e[i+1],n[2*i+2]=e[i+2],n[2*i+3]=e[i+3],n[2*i+4]=e[i+4],n[2*i+5]=e[i+5];return super.setColors(n),this}setFromPoints(e){const t=e.length-1,n=new Float32Array(6*t);for(let i=0;i<t;i++)n[6*i]=e[i].x,n[6*i+1]=e[i].y,n[6*i+2]=e[i].z||0,n[6*i+3]=e[i+1].x,n[6*i+4]=e[i+1].y,n[6*i+5]=e[i+1].z||0;return super.setPositions(n),this}fromLine(e){const t=e.geometry;return this.setPositions(t.attributes.position.array),this}}class Zv extends Jv{constructor(e=new Fh,t=new Xl({color:Math.random()*16777215})){super(e,t),this.isLine2=!0,this.type="Line2"}}const Qv=r=>{const e=new ht,t=[],n=[],{isSphere:i}=r;if(us.forEach((o,l)=>{const{enabled:c,line:u,scale:h,color:d}=r[o];if(!c||!u)return;const f=l<3?1:-1,m=(i?Ih-h/2:.975)*f;t.push(o.includes("x")?m:0,o.includes("y")?m:0,o.includes("z")?m:0,0,0,0);const _=e.set(d).toArray();n.push(..._,..._)}),!t.length)return null;const s=new Fh().setPositions(t).setColors(n),a=new Xl({linewidth:r.lineWidth,vertexColors:!0,resolution:new dt(window.innerWidth,window.innerHeight)});return new Zv(s,a).computeLineDistances()},ey=r=>{const{corners:e,edges:t}=r,n=[],i=Hv(r),s=Wv(r,i);n.push(...s),e.enabled&&n.push(...Xv(r,i)),t.enabled&&n.push(...qv(r,i,e.enabled?7:6));const a=Yv(s,r),o=Qv(r);return[n,a,o]},Zr=(r,e=!0)=>{const{material:t,userData:n}=r,{opacity:i,color:s,scale:a}=e?n.hover:n;r.scale.setScalar(a),t.opacity=i,t.map?Gv(t.map,e):t.color.set(s)},Mr=new ut,Uu=new wh,ty=new dt,Vi=new k,Iu=new St;class ny extends Ft{constructor(e,t,n={}){super(),Pt(this,"enabled",!0),Pt(this,"camera"),Pt(this,"renderer"),Pt(this,"options"),Pt(this,"target",new k),Pt(this,"animated",!0),Pt(this,"speed",1),Pt(this,"animating",!1),Pt(this,"_options"),Pt(this,"_intersections"),Pt(this,"_background",null),Pt(this,"_viewport",[0,0,0,0]),Pt(this,"_originalViewport",[0,0,0,0]),Pt(this,"_originalScissor",[0,0,0,0]),Pt(this,"_scene"),Pt(this,"_camera"),Pt(this,"_container"),Pt(this,"_domElement"),Pt(this,"_domRect"),Pt(this,"_dragging",!1),Pt(this,"_distance",0),Pt(this,"_clock",new Wp),Pt(this,"_targetQuaternion",new Cn),Pt(this,"_quaternionStart",new Cn),Pt(this,"_quaternionEnd",new Cn),Pt(this,"_pointerStart",new dt),Pt(this,"_focus",null),Pt(this,"_placement"),Pt(this,"_controls"),Pt(this,"_controlsListeners"),this.camera=e,this.renderer=t,this._scene=new Ll().add(this),this.set(n)}get placement(){return this._placement}set placement(e){this._placement=Lh(this._domElement,e),this.domUpdate()}set(e={}){this.dispose(),this.options=e,this._options=Vv(e),this._camera=this._options.isSphere?new Ta(-1.8,1.8,1.8,-1.8,5,10):new sn(26,1,5,10),this._camera.position.set(0,0,7);const[t,n,i]=ey(this._options);n&&this.add(n),i&&this.add(i),this.add(...t),this._background=n,this._intersections=t;const{container:s,animated:a,speed:o}=this._options;return this.animated=a,this.speed=o,this._container=s?Iv(s):document.body,this._domElement=Uv(this._options),this._domElement.onpointerdown=l=>this._onPointerDown(l),this._domElement.onpointermove=l=>this._onPointerMove(l),this._domElement.onpointerleave=()=>this._onPointerLeave(),this._container.appendChild(this._domElement),this._controls&&this.attachControls(this._controls),this.update(),this._updateOrientation(!0),this}render(){this.animating&&this._animate();const{renderer:e,_viewport:t}=this,n=e.getScissorTest(),i=e.autoClear;return e.autoClear=!1,e.setViewport(...t),n&&e.setScissor(...t),e.clear(!1,!0,!1),e.render(this._scene,this._camera),e.setViewport(...this._originalViewport),n&&e.setScissor(...this._originalScissor),e.autoClear=i,this}domUpdate(){this._domRect=this._domElement.getBoundingClientRect();const e=this.renderer,t=this._domRect,n=e.domElement.getBoundingClientRect();return this._viewport.splice(0,4,t.left-n.left,e.domElement.clientHeight-(t.top-n.top+t.height),t.width,t.height),e.getViewport(Iu).toArray(this._originalViewport),e.getScissorTest()&&e.getScissor(Iu).toArray(this._originalScissor),this}cameraUpdate(){return this._updateOrientation(),this}update(e=!0){return e&&this._controls&&this._controls.update(),this.domUpdate().cameraUpdate()}attachControls(e){return this.detachControls(),this.target=e.target,this._controlsListeners={start:()=>e.enabled=!1,end:()=>e.enabled=!0,change:()=>this.update(!1)},this.addEventListener("start",this._controlsListeners.start),this.addEventListener("end",this._controlsListeners.end),e.addEventListener("change",this._controlsListeners.change),this._controls=e,this}detachControls(){if(!(!this._controlsListeners||!this._controls))return this.target=new k().copy(this._controls.target),this.removeEventListener("start",this._controlsListeners.start),this.removeEventListener("end",this._controlsListeners.end),this._controls.removeEventListener("change",this._controlsListeners.change),this._controlsListeners=void 0,this._controls=void 0,this}dispose(){var e;this.detachControls(),this.children.forEach(t=>{var n,i,s,a;this.remove(t);const o=t;(n=o.material)==null||n.dispose(),(s=(i=o.material)==null?void 0:i.map)==null||s.dispose(),(a=o.geometry)==null||a.dispose()}),(e=this._domElement)==null||e.remove()}_updateOrientation(e=!0){e&&(this.quaternion.copy(this.camera.quaternion).invert(),this.updateMatrixWorld()),Mu(this._options,this._intersections,this.camera)}_animate(){const{position:e,quaternion:t}=this.camera;if(e.set(0,0,1),!this.animated){e.applyQuaternion(this._quaternionEnd).multiplyScalar(this._distance).add(this.target),t.copy(this._targetQuaternion),this._updateOrientation(),this.animating=!1,this.dispatchEvent({type:"change"}),this.dispatchEvent({type:"end"});return}this._controls&&(this._controls.enabled=!1);const n=this._clock.getDelta()*Ov*this.speed;this._quaternionStart.rotateTowards(this._quaternionEnd,n),e.applyQuaternion(this._quaternionStart).multiplyScalar(this._distance).add(this.target),t.rotateTowards(this._targetQuaternion,n),this._updateOrientation(),requestAnimationFrame(()=>this.dispatchEvent({type:"change"})),this._quaternionStart.angleTo(this._quaternionEnd)<ho&&(this._controls&&(this._controls.enabled=!0),this.animating=!1,this.dispatchEvent({type:"end"}))}_setOrientation(e){const t=this.camera,n=this.target;Vi.copy(e).multiplyScalar(this._distance),Mr.setPosition(Vi).lookAt(Vi,this.position,this.up),this._targetQuaternion.setFromRotationMatrix(Mr),Vi.add(n),Mr.lookAt(Vi,n,this.up),this._quaternionEnd.setFromRotationMatrix(Mr),Mr.setPosition(t.position).lookAt(t.position,n,this.up),this._quaternionStart.setFromRotationMatrix(Mr),this.animating=!0,this._clock.start(),this.dispatchEvent({type:"start"})}_onPointerDown(e){if(!this.enabled)return;const t=l=>{if(!this._dragging){if(Fv(l,this._pointerStart))return;this._dragging=!0}const c=ty.set(l.clientX,l.clientY).sub(this._pointerStart).multiplyScalar(1/this._domRect.width*Math.PI),u=this.coordinateConversion(Vi.subVectors(this.camera.position,this.target)),h=Uu.setFromVector3(u);h.theta=a-c.x,h.phi=dl(o-c.y,ho,Math.PI-ho),this.coordinateConversion(this.camera.position.setFromSpherical(h),!0).add(this.target),this.camera.lookAt(this.target),this.quaternion.copy(this.camera.quaternion).invert(),this._updateOrientation(!1),this.dispatchEvent({type:"change"})},n=()=>{if(document.removeEventListener("pointermove",t,!1),document.removeEventListener("pointerup",n,!1),!this._dragging)return this._handleClick(e);this._focus&&(Zr(this._focus,!1),this._focus=null),this._dragging=!1,this.dispatchEvent({type:"end"})};if(this.animating)return;e.preventDefault(),this._pointerStart.set(e.clientX,e.clientY);const i=this.coordinateConversion(Vi.subVectors(this.camera.position,this.target)),s=Uu.setFromVector3(i),a=s.theta,o=s.phi;this._distance=s.radius,document.addEventListener("pointermove",t,!1),document.addEventListener("pointerup",n,!1),this.dispatchEvent({type:"start"})}coordinateConversion(e,t=!1){const{x:n,y:i,z:s}=e,a=Ft.DEFAULT_UP;return a.x===1?t?e.set(i,s,n):e.set(s,n,i):a.z===1?t?e.set(s,n,i):e.set(i,s,n):e}_onPointerMove(e){!this.enabled||this._dragging||(this._background&&wu(this._background,!0),this._handleHover(e))}_onPointerLeave(){!this.enabled||this._dragging||(this._background&&wu(this._background,!1),this._focus&&Zr(this._focus,!1),this._domElement.style.cursor="")}_handleClick(e){const t=Tu(e,this._domRect,this._camera,this._intersections);this._focus&&(Zr(this._focus,!1),this._focus=null),t&&(this._setOrientation(t.object.position),this.dispatchEvent({type:"change"}))}_handleHover(e){const t=Tu(e,this._domRect,this._camera,this._intersections),n=(t==null?void 0:t.object)||null;this._focus!==n&&(this._domElement.style.cursor=n?"pointer":"",this._focus&&Zr(this._focus,!1),(this._focus=n)?Zr(n,!0):Mu(this._options,this._intersections,this.camera))}}const iy=/^[og]\s*(.+)?/,ry=/^mtllib /,sy=/^usemtl /,ay=/^usemap /,Nu=/\s+/,Fu=new k,go=new k,Ou=new k,Bu=new k,Ln=new k,Js=new ht;function oy(){const r={objects:[],object:{},vertices:[],normals:[],colors:[],uvs:[],materials:{},materialLibraries:[],startObject:function(e,t){if(this.object&&this.object.fromDeclaration===!1){this.object.name=e,this.object.fromDeclaration=t!==!1;return}const n=this.object&&typeof this.object.currentMaterial=="function"?this.object.currentMaterial():void 0;if(this.object&&typeof this.object._finalize=="function"&&this.object._finalize(!0),this.object={name:e||"",fromDeclaration:t!==!1,geometry:{vertices:[],normals:[],colors:[],uvs:[],hasUVIndices:!1},materials:[],smooth:!0,startMaterial:function(i,s){const a=this._finalize(!1);a&&(a.inherited||a.groupCount<=0)&&this.materials.splice(a.index,1);const o={index:this.materials.length,name:i||"",mtllib:Array.isArray(s)&&s.length>0?s[s.length-1]:"",smooth:a!==void 0?a.smooth:this.smooth,groupStart:a!==void 0?a.groupEnd:0,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(l){const c={index:typeof l=="number"?l:this.index,name:this.name,mtllib:this.mtllib,smooth:this.smooth,groupStart:0,groupEnd:-1,groupCount:-1,inherited:!1};return c.clone=this.clone.bind(c),c}};return this.materials.push(o),o},currentMaterial:function(){if(this.materials.length>0)return this.materials[this.materials.length-1]},_finalize:function(i){const s=this.currentMaterial();if(s&&s.groupEnd===-1&&(s.groupEnd=this.geometry.vertices.length/3,s.groupCount=s.groupEnd-s.groupStart,s.inherited=!1),i&&this.materials.length>1)for(let a=this.materials.length-1;a>=0;a--)this.materials[a].groupCount<=0&&this.materials.splice(a,1);return i&&this.materials.length===0&&this.materials.push({name:"",smooth:this.smooth}),s}},n&&n.name&&typeof n.clone=="function"){const i=n.clone(0);i.inherited=!0,this.object.materials.push(i)}this.objects.push(this.object)},finalize:function(){this.object&&typeof this.object._finalize=="function"&&this.object._finalize(!0)},parseVertexIndex:function(e,t){const n=parseInt(e,10);return(n>=0?n-1:n+t/3)*3},parseNormalIndex:function(e,t){const n=parseInt(e,10);return(n>=0?n-1:n+t/3)*3},parseUVIndex:function(e,t){const n=parseInt(e,10);return(n>=0?n-1:n+t/2)*2},addVertex:function(e,t,n){const i=this.vertices,s=this.object.geometry.vertices;s.push(i[e+0],i[e+1],i[e+2]),s.push(i[t+0],i[t+1],i[t+2]),s.push(i[n+0],i[n+1],i[n+2])},addVertexPoint:function(e){const t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addVertexLine:function(e){const t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addNormal:function(e,t,n){const i=this.normals,s=this.object.geometry.normals;s.push(i[e+0],i[e+1],i[e+2]),s.push(i[t+0],i[t+1],i[t+2]),s.push(i[n+0],i[n+1],i[n+2])},addFaceNormal:function(e,t,n){const i=this.vertices,s=this.object.geometry.normals;Fu.fromArray(i,e),go.fromArray(i,t),Ou.fromArray(i,n),Ln.subVectors(Ou,go),Bu.subVectors(Fu,go),Ln.cross(Bu),Ln.normalize(),s.push(Ln.x,Ln.y,Ln.z),s.push(Ln.x,Ln.y,Ln.z),s.push(Ln.x,Ln.y,Ln.z)},addColor:function(e,t,n){const i=this.colors,s=this.object.geometry.colors;i[e]!==void 0&&s.push(i[e+0],i[e+1],i[e+2]),i[t]!==void 0&&s.push(i[t+0],i[t+1],i[t+2]),i[n]!==void 0&&s.push(i[n+0],i[n+1],i[n+2])},addUV:function(e,t,n){const i=this.uvs,s=this.object.geometry.uvs;s.push(i[e+0],i[e+1]),s.push(i[t+0],i[t+1]),s.push(i[n+0],i[n+1])},addDefaultUV:function(){const e=this.object.geometry.uvs;e.push(0,0),e.push(0,0),e.push(0,0)},addUVLine:function(e){const t=this.uvs;this.object.geometry.uvs.push(t[e+0],t[e+1])},addFace:function(e,t,n,i,s,a,o,l,c){const u=this.vertices.length;let h=this.parseVertexIndex(e,u),d=this.parseVertexIndex(t,u),f=this.parseVertexIndex(n,u);if(this.addVertex(h,d,f),this.addColor(h,d,f),o!==void 0&&o!==""){const m=this.normals.length;h=this.parseNormalIndex(o,m),d=this.parseNormalIndex(l,m),f=this.parseNormalIndex(c,m),this.addNormal(h,d,f)}else this.addFaceNormal(h,d,f);if(i!==void 0&&i!==""){const m=this.uvs.length;h=this.parseUVIndex(i,m),d=this.parseUVIndex(s,m),f=this.parseUVIndex(a,m),this.addUV(h,d,f),this.object.geometry.hasUVIndices=!0}else this.addDefaultUV()},addPointGeometry:function(e){this.object.geometry.type="Points";const t=this.vertices.length;for(let n=0,i=e.length;n<i;n++){const s=this.parseVertexIndex(e[n],t);this.addVertexPoint(s),this.addColor(s)}},addLineGeometry:function(e,t){this.object.geometry.type="Line";const n=this.vertices.length,i=this.uvs.length;for(let s=0,a=e.length;s<a;s++)this.addVertexLine(this.parseVertexIndex(e[s],n));for(let s=0,a=t.length;s<a;s++)this.addUVLine(this.parseUVIndex(t[s],i))}};return r.startObject("",!1),r}class _o extends Hn{constructor(e){super(e),this.materials=null}load(e,t,n,i){const s=this,a=new Vr(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(o){try{t(s.parse(o))}catch(l){i?i(l):console.error(l),s.manager.itemError(e)}},n,i)}setMaterials(e){return this.materials=e,this}parse(e){const t=new oy;e.indexOf(`\r
|
|
4198
4198
|
`)!==-1&&(e=e.replace(/\r\n/g,`
|
|
4199
4199
|
`)),e.indexOf(`\\
|
|
4200
4200
|
`)!==-1&&(e=e.replace(/\\\n/g,""));const n=e.split(`
|
|
4201
|
-
`);let i=[];for(let o=0,l=n.length;o<l;o++){const c=n[o].trimStart();if(c.length===0)continue;const u=c.charAt(0);if(u!=="#")if(u==="v"){const h=c.split(Nu);switch(h[0]){case"v":t.vertices.push(parseFloat(h[1]),parseFloat(h[2]),parseFloat(h[3])),h.length>=7?(Js.setRGB(parseFloat(h[4]),parseFloat(h[5]),parseFloat(h[6]),At),t.colors.push(Js.r,Js.g,Js.b)):t.colors.push(void 0,void 0,void 0);break;case"vn":t.normals.push(parseFloat(h[1]),parseFloat(h[2]),parseFloat(h[3]));break;case"vt":t.uvs.push(parseFloat(h[1]),parseFloat(h[2]));break}}else if(u==="f"){const d=c.slice(1).trim().split(Nu),f=[];for(let _=0,g=d.length;_<g;_++){const p=d[_];if(p.length>0){const M=p.split("/");f.push(M)}}const m=f[0];for(let _=1,g=f.length-1;_<g;_++){const p=f[_],M=f[_+1];t.addFace(m[0],p[0],M[0],m[1],p[1],M[1],m[2],p[2],M[2])}}else if(u==="l"){const h=c.substring(1).trim().split(" ");let d=[];const f=[];if(c.indexOf("/")===-1)d=h;else for(let m=0,_=h.length;m<_;m++){const g=h[m].split("/");g[0]!==""&&d.push(g[0]),g[1]!==""&&f.push(g[1])}t.addLineGeometry(d,f)}else if(u==="p"){const d=c.slice(1).trim().split(" ");t.addPointGeometry(d)}else if((i=
|
|
4202
|
-
`);let i={};const s=/\s+/,a={};for(let l=0;l<n.length;l++){let c=n[l];if(c=c.trim(),c.length===0||c.charAt(0)==="#")continue;const u=c.indexOf(" ");let h=u>=0?c.substring(0,u):c;h=h.toLowerCase();let d=u>=0?c.substring(u+1):"";if(d=d.trim(),h==="newmtl")i={name:d},a[d]=i;else if(h==="ka"||h==="kd"||h==="ks"||h==="ke"){const f=d.split(s,3);i[h]=[parseFloat(f[0]),parseFloat(f[1]),parseFloat(f[2])]}else i[h]=d}const o=new
|
|
4201
|
+
`);let i=[];for(let o=0,l=n.length;o<l;o++){const c=n[o].trimStart();if(c.length===0)continue;const u=c.charAt(0);if(u!=="#")if(u==="v"){const h=c.split(Nu);switch(h[0]){case"v":t.vertices.push(parseFloat(h[1]),parseFloat(h[2]),parseFloat(h[3])),h.length>=7?(Js.setRGB(parseFloat(h[4]),parseFloat(h[5]),parseFloat(h[6]),At),t.colors.push(Js.r,Js.g,Js.b)):t.colors.push(void 0,void 0,void 0);break;case"vn":t.normals.push(parseFloat(h[1]),parseFloat(h[2]),parseFloat(h[3]));break;case"vt":t.uvs.push(parseFloat(h[1]),parseFloat(h[2]));break}}else if(u==="f"){const d=c.slice(1).trim().split(Nu),f=[];for(let _=0,g=d.length;_<g;_++){const p=d[_];if(p.length>0){const M=p.split("/");f.push(M)}}const m=f[0];for(let _=1,g=f.length-1;_<g;_++){const p=f[_],M=f[_+1];t.addFace(m[0],p[0],M[0],m[1],p[1],M[1],m[2],p[2],M[2])}}else if(u==="l"){const h=c.substring(1).trim().split(" ");let d=[];const f=[];if(c.indexOf("/")===-1)d=h;else for(let m=0,_=h.length;m<_;m++){const g=h[m].split("/");g[0]!==""&&d.push(g[0]),g[1]!==""&&f.push(g[1])}t.addLineGeometry(d,f)}else if(u==="p"){const d=c.slice(1).trim().split(" ");t.addPointGeometry(d)}else if((i=iy.exec(c))!==null){const h=(" "+i[0].slice(1).trim()).slice(1);t.startObject(h)}else if(sy.test(c))t.object.startMaterial(c.substring(7).trim(),t.materialLibraries);else if(ry.test(c))t.materialLibraries.push(c.substring(7).trim());else if(ay.test(c))console.warn('THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.');else if(u==="s"){if(i=c.split(" "),i.length>1){const d=i[1].trim().toLowerCase();t.object.smooth=d!=="0"&&d!=="off"}else t.object.smooth=!0;const h=t.object.currentMaterial();h&&(h.smooth=t.object.smooth)}else{if(c==="\0")continue;console.warn('THREE.OBJLoader: Unexpected line: "'+c+'"')}}t.finalize();const s=new fi;if(s.materialLibraries=[].concat(t.materialLibraries),!(t.objects.length===1&&t.objects[0].geometry.vertices.length===0)===!0)for(let o=0,l=t.objects.length;o<l;o++){const c=t.objects[o],u=c.geometry,h=c.materials,d=u.type==="Line",f=u.type==="Points";let m=!1;if(u.vertices.length===0)continue;const _=new Vt;_.setAttribute("position",new xt(u.vertices,3)),u.normals.length>0&&_.setAttribute("normal",new xt(u.normals,3)),u.colors.length>0&&(m=!0,_.setAttribute("color",new xt(u.colors,3))),u.hasUVIndices===!0&&_.setAttribute("uv",new xt(u.uvs,2));const g=[];for(let M=0,E=h.length;M<E;M++){const y=h[M],I=y.name+"_"+y.smooth+"_"+m;let R=t.materials[I];if(this.materials!==null){if(R=this.materials.create(y.name),d&&R&&!(R instanceof ji)){const C=new ji;Vn.prototype.copy.call(C,R),C.color.copy(R.color),R=C}else if(f&&R&&!(R instanceof qi)){const C=new qi({size:10,sizeAttenuation:!1});Vn.prototype.copy.call(C,R),C.color.copy(R.color),C.map=R.map,R=C}}R===void 0&&(d?R=new ji:f?R=new qi({size:1,sizeAttenuation:!1}):R=new Sn,R.name=y.name,R.flatShading=!y.smooth,R.vertexColors=m,t.materials[I]=R),g.push(R)}let p;if(g.length>1){for(let M=0,E=h.length;M<E;M++){const y=h[M];_.addGroup(y.groupStart,y.groupCount,M)}d?p=new ol(_,g):f?p=new is(_,g):p=new Ut(_,g)}else d?p=new ol(_,g[0]):f?p=new is(_,g[0]):p=new Ut(_,g[0]);p.name=c.name,s.add(p)}else if(t.vertices.length>0){const o=new qi({size:1,sizeAttenuation:!1}),l=new Vt;l.setAttribute("position",new xt(t.vertices,3)),t.colors.length>0&&t.colors[0]!==void 0&&(l.setAttribute("color",new xt(t.colors,3)),o.vertexColors=!0);const c=new is(l,o);s.add(c)}return s}}class vo extends Hn{constructor(e){super(e)}load(e,t,n,i){const s=this,a=this.path===""?Vl.extractUrlBase(e):this.path,o=new Vr(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(l){try{t(s.parse(l,a))}catch(c){i?i(c):console.error(c),s.manager.itemError(e)}},n,i)}setMaterialOptions(e){return this.materialOptions=e,this}parse(e,t){const n=e.split(`
|
|
4202
|
+
`);let i={};const s=/\s+/,a={};for(let l=0;l<n.length;l++){let c=n[l];if(c=c.trim(),c.length===0||c.charAt(0)==="#")continue;const u=c.indexOf(" ");let h=u>=0?c.substring(0,u):c;h=h.toLowerCase();let d=u>=0?c.substring(u+1):"";if(d=d.trim(),h==="newmtl")i={name:d},a[d]=i;else if(h==="ka"||h==="kd"||h==="ks"||h==="ke"){const f=d.split(s,3);i[h]=[parseFloat(f[0]),parseFloat(f[1]),parseFloat(f[2])]}else i[h]=d}const o=new ly(this.resourcePath||t,this.materialOptions);return o.setCrossOrigin(this.crossOrigin),o.setManager(this.manager),o.setMaterials(a),o}}class ly{constructor(e="",t={}){this.baseUrl=e,this.options=t,this.materialsInfo={},this.materials={},this.materialsArray=[],this.nameLookup={},this.crossOrigin="anonymous",this.side=this.options.side!==void 0?this.options.side:$n,this.wrap=this.options.wrap!==void 0?this.options.wrap:jn}setCrossOrigin(e){return this.crossOrigin=e,this}setManager(e){this.manager=e}setMaterials(e){this.materialsInfo=this.convert(e),this.materials={},this.materialsArray=[],this.nameLookup={}}convert(e){if(!this.options)return e;const t={};for(const n in e){const i=e[n],s={};t[n]=s;for(const a in i){let o=!0,l=i[a];const c=a.toLowerCase();switch(c){case"kd":case"ka":case"ks":this.options&&this.options.normalizeRGB&&(l=[l[0]/255,l[1]/255,l[2]/255]),this.options&&this.options.ignoreZeroRGBs&&l[0]===0&&l[1]===0&&l[2]===0&&(o=!1);break}o&&(s[c]=l)}}return t}preload(){for(const e in this.materialsInfo)this.create(e)}getIndex(e){return this.nameLookup[e]}getAsArray(){let e=0;for(const t in this.materialsInfo)this.materialsArray[e]=this.create(t),this.nameLookup[t]=e,e++;return this.materialsArray}create(e){return this.materials[e]===void 0&&this.createMaterial_(e),this.materials[e]}createMaterial_(e){const t=this,n=this.materialsInfo[e],i={name:e,side:this.side};function s(o,l){return typeof l!="string"||l===""?"":/^https?:\/\//i.test(l)?l:o+l}function a(o,l){if(i[o])return;const c=t.getTextureParams(l,i),u=t.loadTexture(s(t.baseUrl,c.url));u.repeat.copy(c.scale),u.offset.copy(c.offset),u.wrapS=t.wrap,u.wrapT=t.wrap,(o==="map"||o==="emissiveMap")&&(u.colorSpace=At),i[o]=u}for(const o in n){const l=n[o];let c;if(l!=="")switch(o.toLowerCase()){case"kd":i.color=vt.colorSpaceToWorking(new ht().fromArray(l),At);break;case"ks":i.specular=vt.colorSpaceToWorking(new ht().fromArray(l),At);break;case"ke":i.emissive=vt.colorSpaceToWorking(new ht().fromArray(l),At);break;case"map_kd":a("map",l);break;case"map_ks":a("specularMap",l);break;case"map_ke":a("emissiveMap",l);break;case"norm":a("normalMap",l);break;case"map_bump":case"bump":a("bumpMap",l);break;case"disp":a("displacementMap",l);break;case"map_d":a("alphaMap",l),i.transparent=!0;break;case"ns":i.shininess=parseFloat(l);break;case"d":c=parseFloat(l),c<1&&(i.opacity=c,i.transparent=!0);break;case"tr":c=parseFloat(l),this.options&&this.options.invertTrProperty&&(c=1-c),c>0&&(i.opacity=1-c,i.transparent=!0);break}}return this.materials[e]=new Sn(i),this.materials[e]}getTextureParams(e,t){const n={scale:new dt(1,1),offset:new dt(0,0)},i=e.split(/\s+/);let s;return s=i.indexOf("-bm"),s>=0&&(t.bumpScale=parseFloat(i[s+1]),i.splice(s,2)),s=i.indexOf("-mm"),s>=0&&(t.displacementBias=parseFloat(i[s+1]),t.displacementScale=parseFloat(i[s+2]),i.splice(s,3)),s=i.indexOf("-s"),s>=0&&(n.scale.set(parseFloat(i[s+1]),parseFloat(i[s+2])),i.splice(s,4)),s=i.indexOf("-o"),s>=0&&(n.offset.set(parseFloat(i[s+1]),parseFloat(i[s+2])),i.splice(s,4)),n.url=i.join(" ").trim(),n}loadTexture(e,t,n,i,s){const a=this.manager!==void 0?this.manager:Bl;let o=a.getHandler(e);o===null&&(o=new kl(a)),o.setCrossOrigin&&o.setCrossOrigin(this.crossOrigin);const l=o.load(e,n,i,s);return t!==void 0&&(l.mapping=t),l}}class ua extends Hn{constructor(e){super(e)}load(e,t,n,i){const s=this,a=new Vr(this.manager);a.setPath(this.path),a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(o){try{t(s.parse(o))}catch(l){i?i(l):console.error(l),s.manager.itemError(e)}},n,i)}parse(e){function t(c){const u=new DataView(c),h=32/8*3+32/8*3*3+16/8,d=u.getUint32(80,!0);if(80+32/8+d*h===u.byteLength)return!0;const m=[115,111,108,105,100];for(let _=0;_<5;_++)if(n(m,u,_))return!1;return!0}function n(c,u,h){for(let d=0,f=c.length;d<f;d++)if(c[d]!==u.getUint8(h+d))return!1;return!0}function i(c){const u=new DataView(c),h=u.getUint32(80,!0);let d,f,m,_=!1,g,p,M,E,y;for(let w=0;w<70;w++)u.getUint32(w,!1)==1129270351&&u.getUint8(w+4)==82&&u.getUint8(w+5)==61&&(_=!0,g=new Float32Array(h*3*3),p=u.getUint8(w+6)/255,M=u.getUint8(w+7)/255,E=u.getUint8(w+8)/255,y=u.getUint8(w+9)/255);const I=84,R=12*4+2,C=new Vt,L=new Float32Array(h*3*3),b=new Float32Array(h*3*3),x=new ht;for(let w=0;w<h;w++){const B=I+w*R,z=u.getFloat32(B,!0),X=u.getFloat32(B+4,!0),j=u.getFloat32(B+8,!0);if(_){const O=u.getUint16(B+48,!0);(O&32768)===0?(d=(O&31)/31,f=(O>>5&31)/31,m=(O>>10&31)/31):(d=p,f=M,m=E)}for(let O=1;O<=3;O++){const K=B+O*12,H=w*3*3+(O-1)*3;L[H]=u.getFloat32(K,!0),L[H+1]=u.getFloat32(K+4,!0),L[H+2]=u.getFloat32(K+8,!0),b[H]=z,b[H+1]=X,b[H+2]=j,_&&(x.setRGB(d,f,m,At),g[H]=x.r,g[H+1]=x.g,g[H+2]=x.b)}}return C.setAttribute("position",new Xt(L,3)),C.setAttribute("normal",new Xt(b,3)),_&&(C.setAttribute("color",new Xt(g,3)),C.hasColors=!0,C.alpha=y),C}function s(c){const u=new Vt,h=/solid([\s\S]*?)endsolid/g,d=/facet([\s\S]*?)endfacet/g,f=/solid\s(.+)/;let m=0;const _=/[\s]+([+-]?(?:\d*)(?:\.\d*)?(?:[eE][+-]?\d+)?)/.source,g=new RegExp("vertex"+_+_+_,"g"),p=new RegExp("normal"+_+_+_,"g"),M=[],E=[],y=[],I=new k;let R,C=0,L=0,b=0;for(;(R=h.exec(c))!==null;){L=b;const x=R[0],w=(R=f.exec(x))!==null?R[1]:"";for(y.push(w);(R=d.exec(x))!==null;){let X=0,j=0;const O=R[0];for(;(R=p.exec(O))!==null;)I.x=parseFloat(R[1]),I.y=parseFloat(R[2]),I.z=parseFloat(R[3]),j++;for(;(R=g.exec(O))!==null;)M.push(parseFloat(R[1]),parseFloat(R[2]),parseFloat(R[3])),E.push(I.x,I.y,I.z),X++,b++;j!==1&&console.error("THREE.STLLoader: Something isn't right with the normal of face number "+m),X!==3&&console.error("THREE.STLLoader: Something isn't right with the vertices of face number "+m),m++}const B=L,z=b-L;u.userData.groupNames=y,u.addGroup(B,z,C),C++}return u.setAttribute("position",new xt(M,3)),u.setAttribute("normal",new xt(E,3)),u}function a(c){return typeof c!="string"?new TextDecoder().decode(c):c}function o(c){if(typeof c=="string"){const u=new Uint8Array(c.length);for(let h=0;h<c.length;h++)u[h]=c.charCodeAt(h)&255;return u.buffer||u}else return c}const l=o(e);return t(l)?i(l):s(a(e))}}class cy extends Hn{constructor(e){super(e),this.littleEndian=!0}load(e,t,n,i){const s=this,a=new Vr(s.manager);a.setPath(s.path),a.setResponseType("arraybuffer"),a.setRequestHeader(s.requestHeader),a.setWithCredentials(s.withCredentials),a.load(e,function(o){try{t(s.parse(o))}catch(l){i?i(l):console.error(l),s.manager.itemError(e)}},n,i)}_getDataView(e,t,n,i){switch(n){case"F":return i===8?e.getFloat64(t,this.littleEndian):e.getFloat32(t,this.littleEndian);case"I":return i===1?e.getInt8(t):i===2?e.getInt16(t,this.littleEndian):e.getInt32(t,this.littleEndian);case"U":return i===1?e.getUint8(t):i===2?e.getUint16(t,this.littleEndian):e.getUint32(t,this.littleEndian)}}parse(e){function t(f,m){const _=f.length,g=new Uint8Array(m);let p=0,M=0,E,y,I;do if(E=f[p++],E<32){if(E++,M+E>m)throw new Error("Output buffer is not large enough");if(p+E>_)throw new Error("Invalid compressed data");do g[M++]=f[p++];while(--E)}else{if(y=E>>5,I=M-((E&31)<<8)-1,p>=_)throw new Error("Invalid compressed data");if(y===7&&(y+=f[p++],p>=_))throw new Error("Invalid compressed data");if(I-=f[p++],M+y+2>m)throw new Error("Output buffer is not large enough");if(I<0)throw new Error("Invalid compressed data");if(I>=M)throw new Error("Invalid compressed data");do g[M++]=g[I++];while(--y+2)}while(p<_);return g}function n(f){const m={},_=new Uint8Array(f);let g="",p="",M=0,E=!1;const y=_.length;for(;M<y&&E===!1;){const L=String.fromCharCode(_[M++]);L===`
|
|
4203
4203
|
`||L==="\r"?(p.trim().toLowerCase().startsWith("data")&&(E=!0),p=""):p+=L,g+=L}const I=g.search(/[\r\n]DATA\s(\S*)\s/i),R=/[\r\n]DATA\s(\S*)\s/i.exec(g.slice(I-1));if(m.data=R[1],m.headerLen=R[0].length+I,m.str=g.slice(0,m.headerLen),m.str=m.str.replace(/#.*/gi,""),m.version=/^VERSION (.*)/im.exec(m.str),m.fields=/^FIELDS (.*)/im.exec(m.str),m.size=/^SIZE (.*)/im.exec(m.str),m.type=/^TYPE (.*)/im.exec(m.str),m.count=/^COUNT (.*)/im.exec(m.str),m.width=/^WIDTH (.*)/im.exec(m.str),m.height=/^HEIGHT (.*)/im.exec(m.str),m.viewpoint=/^VIEWPOINT (.*)/im.exec(m.str),m.points=/^POINTS (.*)/im.exec(m.str),m.version!==null&&(m.version=parseFloat(m.version[1])),m.fields=m.fields!==null?m.fields[1].split(" "):[],m.type!==null&&(m.type=m.type[1].split(" ")),m.width!==null&&(m.width=parseInt(m.width[1])),m.height!==null&&(m.height=parseInt(m.height[1])),m.viewpoint!==null&&(m.viewpoint=m.viewpoint[1]),m.points!==null&&(m.points=parseInt(m.points[1],10)),m.points===null&&(m.points=m.width*m.height),m.size!==null&&(m.size=m.size[1].split(" ").map(function(L){return parseInt(L,10)})),m.count!==null)m.count=m.count[1].split(" ").map(function(L){return parseInt(L,10)});else{m.count=[];for(let L=0,b=m.fields.length;L<b;L++)m.count.push(1)}m.offset={};let C=0;for(let L=0,b=m.fields.length;L<b;L++)m.data==="ascii"?m.offset[m.fields[L]]=L:(m.offset[m.fields[L]]=C,C+=m.size[L]*m.count[L]);return m.rowSize=C,m}const i=n(e),s=[],a=[],o=[],l=[],c=[],u=new ht;if(i.data==="ascii"){const f=i.offset,g=new TextDecoder().decode(e).slice(i.headerLen).split(`
|
|
4204
|
-
`);for(let p=0,M=g.length;p<M;p++){if(g[p]==="")continue;const E=g[p].split(" ");if(f.x!==void 0&&(s.push(parseFloat(E[f.x])),s.push(parseFloat(E[f.y])),s.push(parseFloat(E[f.z]))),f.rgb!==void 0){const y=i.fields.findIndex(w=>w==="rgb"),I=i.type[y],R=parseFloat(E[f.rgb]);let C=R;if(I==="F"){const w=new Float32Array(1);w[0]=R,C=new Int32Array(w.buffer)[0]}const L=(C>>16&255)/255,b=(C>>8&255)/255,x=(C>>0&255)/255;u.setRGB(L,b,x,At),o.push(u.r,u.g,u.b)}f.normal_x!==void 0&&(a.push(parseFloat(E[f.normal_x])),a.push(parseFloat(E[f.normal_y])),a.push(parseFloat(E[f.normal_z]))),f.intensity!==void 0&&l.push(parseFloat(E[f.intensity])),f.label!==void 0&&c.push(parseInt(E[f.label]))}}if(i.data==="binary_compressed"){const f=new Uint32Array(e.slice(i.headerLen,i.headerLen+8)),m=f[0],_=f[1],g=t(new Uint8Array(e,i.headerLen+8,m),_),p=new DataView(g.buffer),M=i.offset;for(let E=0;E<i.points;E++){if(M.x!==void 0){const y=i.fields.indexOf("x"),I=i.fields.indexOf("y"),R=i.fields.indexOf("z");s.push(this._getDataView(p,i.points*M.x+i.size[y]*E,i.type[y],i.size[y])),s.push(this._getDataView(p,i.points*M.y+i.size[I]*E,i.type[I],i.size[I])),s.push(this._getDataView(p,i.points*M.z+i.size[R]*E,i.type[R],i.size[R]))}if(M.rgb!==void 0){const y=i.fields.indexOf("rgb"),I=p.getUint8(i.points*M.rgb+i.size[y]*E+2)/255,R=p.getUint8(i.points*M.rgb+i.size[y]*E+1)/255,C=p.getUint8(i.points*M.rgb+i.size[y]*E+0)/255;u.setRGB(I,R,C,At),o.push(u.r,u.g,u.b)}if(M.normal_x!==void 0){const y=i.fields.indexOf("normal_x"),I=i.fields.indexOf("normal_y"),R=i.fields.indexOf("normal_z");a.push(this._getDataView(p,i.points*M.normal_x+i.size[y]*E,i.type[y],i.size[y])),a.push(this._getDataView(p,i.points*M.normal_y+i.size[I]*E,i.type[I],i.size[I])),a.push(this._getDataView(p,i.points*M.normal_z+i.size[R]*E,i.type[R],i.size[R]))}if(M.intensity!==void 0){const y=i.fields.indexOf("intensity");l.push(this._getDataView(p,i.points*M.intensity+i.size[y]*E,i.type[y],i.size[y]))}if(M.label!==void 0){const y=i.fields.indexOf("label");c.push(p.getInt32(i.points*M.label+i.size[y]*E,this.littleEndian))}}}if(i.data==="binary"){const f=new DataView(e,i.headerLen),m=i.offset;for(let _=0,g=0;_<i.points;_++,g+=i.rowSize){if(m.x!==void 0){const p=i.fields.indexOf("x"),M=i.fields.indexOf("y"),E=i.fields.indexOf("z");s.push(this._getDataView(f,g+m.x,i.type[p],i.size[p])),s.push(this._getDataView(f,g+m.y,i.type[M],i.size[M])),s.push(this._getDataView(f,g+m.z,i.type[E],i.size[E]))}if(m.rgb!==void 0){const p=f.getUint8(g+m.rgb+2)/255,M=f.getUint8(g+m.rgb+1)/255,E=f.getUint8(g+m.rgb+0)/255;u.setRGB(p,M,E,At),o.push(u.r,u.g,u.b)}if(m.normal_x!==void 0){const p=i.fields.indexOf("normal_x"),M=i.fields.indexOf("normal_y"),E=i.fields.indexOf("normal_z");a.push(this._getDataView(f,g+m.normal_x,i.type[p],i.size[p])),a.push(this._getDataView(f,g+m.normal_y,i.type[M],i.size[M])),a.push(this._getDataView(f,g+m.normal_z,i.type[E],i.size[E]))}if(m.intensity!==void 0){const p=i.fields.indexOf("intensity");l.push(this._getDataView(f,g+m.intensity,i.type[p],i.size[p]))}m.label!==void 0&&c.push(f.getInt32(g+m.label,this.littleEndian))}}const h=new Vt;s.length>0&&h.setAttribute("position",new xt(s,3)),a.length>0&&h.setAttribute("normal",new xt(a,3)),o.length>0&&h.setAttribute("color",new xt(o,3)),l.length>0&&h.setAttribute("intensity",new xt(l,1)),c.length>0&&h.setAttribute("label",new op(c,1)),h.computeBoundingSphere();const d=new qi({size:.005});return o.length>0&&(d.vertexColors=!0),new is(h,d)}}class ku extends Op{constructor(e){super(e)}parse(e){function t(O){switch(O.image_type){case d:case _:if(O.colormap_length>256||O.colormap_size!==24||O.colormap_type!==1)throw new Error("THREE.TGALoader: Invalid type colormap data for indexed type.");break;case f:case m:case g:case p:if(O.colormap_type)throw new Error("THREE.TGALoader: Invalid type colormap data for colormap type.");break;case h:throw new Error("THREE.TGALoader: No data.");default:throw new Error("THREE.TGALoader: Invalid type "+O.image_type)}if(O.width<=0||O.height<=0)throw new Error("THREE.TGALoader: Invalid image size.");if(O.pixel_size!==8&&O.pixel_size!==16&&O.pixel_size!==24&&O.pixel_size!==32)throw new Error("THREE.TGALoader: Invalid pixel size "+O.pixel_size)}function n(O,K,H,ie,oe){let $,xe;const Ee=H.pixel_size>>3,q=H.width*H.height*Ee;if(K&&(xe=oe.subarray(ie,ie+=H.colormap_length*(H.colormap_size>>3))),O){$=new Uint8Array(q);let te,se,le,be=0;const st=new Uint8Array(Ee);for(;be<q;)if(te=oe[ie++],se=(te&127)+1,te&128){for(le=0;le<Ee;++le)st[le]=oe[ie++];for(le=0;le<se;++le)$.set(st,be+le*Ee);be+=Ee*se}else{for(se*=Ee,le=0;le<se;++le)$[be+le]=oe[ie++];be+=se}}else $=oe.subarray(ie,ie+=K?H.width*H.height:q);return{pixel_data:$,palettes:xe}}function i(O,K,H,ie,oe,$,xe,Ee,q){const te=q;let se,le=0,be,st;const Ke=x.width;for(st=K;st!==ie;st+=H)for(be=oe;be!==xe;be+=$,le++)se=Ee[le],O[(be+Ke*st)*4+3]=255,O[(be+Ke*st)*4+2]=te[se*3+0],O[(be+Ke*st)*4+1]=te[se*3+1],O[(be+Ke*st)*4+0]=te[se*3+2];return O}function s(O,K,H,ie,oe,$,xe,Ee){let q,te=0,se,le;const be=x.width;for(le=K;le!==ie;le+=H)for(se=oe;se!==xe;se+=$,te+=2)q=Ee[te+0]+(Ee[te+1]<<8),O[(se+be*le)*4+0]=(q&31744)>>7,O[(se+be*le)*4+1]=(q&992)>>2,O[(se+be*le)*4+2]=(q&31)<<3,O[(se+be*le)*4+3]=q&32768?0:255;return O}function a(O,K,H,ie,oe,$,xe,Ee){let q=0,te,se;const le=x.width;for(se=K;se!==ie;se+=H)for(te=oe;te!==xe;te+=$,q+=3)O[(te+le*se)*4+3]=255,O[(te+le*se)*4+2]=Ee[q+0],O[(te+le*se)*4+1]=Ee[q+1],O[(te+le*se)*4+0]=Ee[q+2];return O}function o(O,K,H,ie,oe,$,xe,Ee){let q=0,te,se;const le=x.width;for(se=K;se!==ie;se+=H)for(te=oe;te!==xe;te+=$,q+=4)O[(te+le*se)*4+2]=Ee[q+0],O[(te+le*se)*4+1]=Ee[q+1],O[(te+le*se)*4+0]=Ee[q+2],O[(te+le*se)*4+3]=Ee[q+3];return O}function l(O,K,H,ie,oe,$,xe,Ee){let q,te=0,se,le;const be=x.width;for(le=K;le!==ie;le+=H)for(se=oe;se!==xe;se+=$,te++)q=Ee[te],O[(se+be*le)*4+0]=q,O[(se+be*le)*4+1]=q,O[(se+be*le)*4+2]=q,O[(se+be*le)*4+3]=255;return O}function c(O,K,H,ie,oe,$,xe,Ee){let q=0,te,se;const le=x.width;for(se=K;se!==ie;se+=H)for(te=oe;te!==xe;te+=$,q+=2)O[(te+le*se)*4+0]=Ee[q+0],O[(te+le*se)*4+1]=Ee[q+0],O[(te+le*se)*4+2]=Ee[q+0],O[(te+le*se)*4+3]=Ee[q+1];return O}function u(O,K,H,ie,oe){let $,xe,Ee,q,te,se;switch((x.flags&M)>>E){default:case R:$=0,Ee=1,te=K,xe=0,q=1,se=H;break;case y:$=0,Ee=1,te=K,xe=H-1,q=-1,se=-1;break;case C:$=K-1,Ee=-1,te=-1,xe=0,q=1,se=H;break;case I:$=K-1,Ee=-1,te=-1,xe=H-1,q=-1,se=-1;break}if(z)switch(x.pixel_size){case 8:l(O,xe,q,se,$,Ee,te,ie);break;case 16:c(O,xe,q,se,$,Ee,te,ie);break;default:throw new Error("THREE.TGALoader: Format not supported.")}else switch(x.pixel_size){case 8:i(O,xe,q,se,$,Ee,te,ie,oe);break;case 16:s(O,xe,q,se,$,Ee,te,ie);break;case 24:a(O,xe,q,se,$,Ee,te,ie);break;case 32:o(O,xe,q,se,$,Ee,te,ie);break;default:throw new Error("THREE.TGALoader: Format not supported.")}return O}const h=0,d=1,f=2,m=3,_=9,g=10,p=11,M=48,E=4,y=0,I=1,R=2,C=3;if(e.length<19)throw new Error("THREE.TGALoader: Not enough data to contain header.");let L=0;const b=new Uint8Array(e),x={id_length:b[L++],colormap_type:b[L++],image_type:b[L++],colormap_index:b[L++]|b[L++]<<8,colormap_length:b[L++]|b[L++]<<8,colormap_size:b[L++],origin:[b[L++]|b[L++]<<8,b[L++]|b[L++]<<8],width:b[L++]|b[L++]<<8,height:b[L++]|b[L++]<<8,pixel_size:b[L++],flags:b[L++]};if(t(x),x.id_length+L>e.length)throw new Error("THREE.TGALoader: No data.");L+=x.id_length;let w=!1,B=!1,z=!1;switch(x.image_type){case _:w=!0,B=!0;break;case d:B=!0;break;case g:w=!0;break;case f:break;case p:w=!0,z=!0;break;case m:z=!0;break}const X=new Uint8Array(x.width*x.height*4),j=n(w,B,x,L,b);return u(X,x.width,x.height,j.pixel_data,j.palettes),{data:X,width:x.width,height:x.height,flipY:!0,generateMipmaps:!0,minFilter:hi}}}class hy extends Hn{load(e,t,n,i){const s=this,a=s.path===""?Vl.extractUrlBase(e):s.path,o=new Vr(s.manager);o.setPath(s.path),o.setRequestHeader(s.requestHeader),o.setWithCredentials(s.withCredentials),o.load(e,function(l){try{t(s.parse(l,a))}catch(c){i?i(c):console.error(c),s.manager.itemError(e)}},n,i)}parse(e,t){function n(S,v){const D=[],A=S.childNodes;for(let U=0,ee=A.length;U<ee;U++){const ue=A[U];ue.nodeName===v&&D.push(ue)}return D}function i(S){if(S.length===0)return[];const v=S.trim().split(/\s+/),D=new Array(v.length);for(let A=0,U=v.length;A<U;A++)D[A]=v[A];return D}function s(S){if(S.length===0)return[];const v=S.trim().split(/\s+/),D=new Array(v.length);for(let A=0,U=v.length;A<U;A++)D[A]=parseFloat(v[A]);return D}function a(S){if(S.length===0)return[];const v=S.trim().split(/\s+/),D=new Array(v.length);for(let A=0,U=v.length;A<U;A++)D[A]=parseInt(v[A]);return D}function o(S){return S.substring(1)}function l(){return"three_default_"+ni++}function c(S){return Object.keys(S).length===0}function u(S){return{unit:h(n(S,"unit")[0]),upAxis:d(n(S,"up_axis")[0])}}function h(S){return S!==void 0&&S.hasAttribute("meter")===!0?parseFloat(S.getAttribute("meter")):1}function d(S){return S!==void 0?S.textContent:"Y_UP"}function f(S,v,D,A){const U=n(S,v)[0];if(U!==void 0){const ee=n(U,D);for(let ue=0;ue<ee.length;ue++)A(ee[ue])}}function m(S,v){for(const D in S){const A=S[D];A.build=v(S[D])}}function _(S,v){return S.build!==void 0||(S.build=v(S)),S.build}function g(S){const v={sources:{},samplers:{},channels:{}};let D=!1;for(let A=0,U=S.childNodes.length;A<U;A++){const ee=S.childNodes[A];if(ee.nodeType!==1)continue;let ue;switch(ee.nodeName){case"source":ue=ee.getAttribute("id"),v.sources[ue]=pe(ee);break;case"sampler":ue=ee.getAttribute("id"),v.samplers[ue]=p(ee);break;case"channel":ue=ee.getAttribute("target"),v.channels[ue]=M(ee);break;case"animation":g(ee),D=!0;break;default:console.log(ee)}}D===!1&&(ct.animations[S.getAttribute("id")||Wi.generateUUID()]=v)}function p(S){const v={inputs:{}};for(let D=0,A=S.childNodes.length;D<A;D++){const U=S.childNodes[D];if(U.nodeType===1)switch(U.nodeName){case"input":const ee=o(U.getAttribute("source")),ue=U.getAttribute("semantic");v.inputs[ue]=ee;break}}return v}function M(S){const v={};let A=S.getAttribute("target").split("/");const U=A.shift();let ee=A.shift();const ue=ee.indexOf("(")!==-1,Ve=ee.indexOf(".")!==-1;if(Ve)A=ee.split("."),ee=A.shift(),v.member=A.shift();else if(ue){const Ae=ee.split("(");ee=Ae.shift();for(let Ne=0;Ne<Ae.length;Ne++)Ae[Ne]=parseInt(Ae[Ne].replace(/\)/,""));v.indices=Ae}return v.id=U,v.sid=ee,v.arraySyntax=ue,v.memberSyntax=Ve,v.sampler=o(S.getAttribute("source")),v}function E(S){const v=[],D=S.channels,A=S.samplers,U=S.sources;for(const ee in D)if(D.hasOwnProperty(ee)){const ue=D[ee],Ve=A[ue.sampler],Ae=Ve.inputs.INPUT,Ne=Ve.inputs.OUTPUT,$e=U[Ae],ge=U[Ne],Ye=I(ue,$e,ge);x(Ye,v)}return v}function y(S){return _(ct.animations[S],E)}function I(S,v,D){const A=ct.nodes[S.id],U=ft(A.id),ee=A.transforms[S.sid],ue=A.matrix.clone().transpose();let Ve,Ae,Ne,$e,ge,Ye;const qe={};switch(ee){case"matrix":for(Ne=0,$e=v.array.length;Ne<$e;Ne++)if(Ve=v.array[Ne],Ae=Ne*D.stride,qe[Ve]===void 0&&(qe[Ve]={}),S.arraySyntax===!0){const zt=D.array[Ae],Dt=S.indices[0]+4*S.indices[1];qe[Ve][Dt]=zt}else for(ge=0,Ye=D.stride;ge<Ye;ge++)qe[Ve][ge]=D.array[Ae+ge];break;case"translate":console.warn('THREE.ColladaLoader: Animation transform type "%s" not yet implemented.',ee);break;case"rotate":console.warn('THREE.ColladaLoader: Animation transform type "%s" not yet implemented.',ee);break;case"scale":console.warn('THREE.ColladaLoader: Animation transform type "%s" not yet implemented.',ee);break}const rt=R(qe,ue);return{name:U.uuid,keyframes:rt}}function R(S,v){const D=[];for(const U in S)D.push({time:parseFloat(U),value:S[U]});D.sort(A);for(let U=0;U<16;U++)w(D,U,v.elements[U]);return D;function A(U,ee){return U.time-ee.time}}const C=new k,L=new k,b=new Cn;function x(S,v){const D=S.keyframes,A=S.name,U=[],ee=[],ue=[],Ve=[];for(let Ae=0,Ne=D.length;Ae<Ne;Ae++){const $e=D[Ae],ge=$e.time,Ye=$e.value;G.fromArray(Ye).transpose(),G.decompose(C,b,L),U.push(ge),ee.push(C.x,C.y,C.z),ue.push(b.x,b.y,b.z,b.w),Ve.push(L.x,L.y,L.z)}return ee.length>0&&v.push(new Fr(A+".position",U,ee)),ue.length>0&&v.push(new fs(A+".quaternion",U,ue)),Ve.length>0&&v.push(new Fr(A+".scale",U,Ve)),v}function w(S,v,D){let A,U=!0,ee,ue;for(ee=0,ue=S.length;ee<ue;ee++)A=S[ee],A.value[v]===void 0?A.value[v]=null:U=!1;if(U===!0)for(ee=0,ue=S.length;ee<ue;ee++)A=S[ee],A.value[v]=D;else B(S,v)}function B(S,v){let D,A;for(let U=0,ee=S.length;U<ee;U++){const ue=S[U];if(ue.value[v]===null){if(D=z(S,U,v),A=X(S,U,v),D===null){ue.value[v]=A.value[v];continue}if(A===null){ue.value[v]=D.value[v];continue}j(ue,D,A,v)}}}function z(S,v,D){for(;v>=0;){const A=S[v];if(A.value[D]!==null)return A;v--}return null}function X(S,v,D){for(;v<S.length;){const A=S[v];if(A.value[D]!==null)return A;v++}return null}function j(S,v,D,A){if(D.time-v.time===0){S.value[A]=v.value[A];return}S.value[A]=(S.time-v.time)*(D.value[A]-v.value[A])/(D.time-v.time)+v.value[A]}function O(S){const v={name:S.getAttribute("id")||"default",start:parseFloat(S.getAttribute("start")||0),end:parseFloat(S.getAttribute("end")||0),animations:[]};for(let D=0,A=S.childNodes.length;D<A;D++){const U=S.childNodes[D];if(U.nodeType===1)switch(U.nodeName){case"instance_animation":v.animations.push(o(U.getAttribute("url")));break}}ct.clips[S.getAttribute("id")]=v}function K(S){const v=[],D=S.name,A=S.end-S.start||-1,U=S.animations;for(let ee=0,ue=U.length;ee<ue;ee++){const Ve=y(U[ee]);for(let Ae=0,Ne=Ve.length;Ae<Ne;Ae++)v.push(Ve[Ae])}return new Hc(D,A,v)}function H(S){return _(ct.clips[S],K)}function ie(S){const v={};for(let D=0,A=S.childNodes.length;D<A;D++){const U=S.childNodes[D];if(U.nodeType===1)switch(U.nodeName){case"skin":v.id=o(U.getAttribute("source")),v.skin=oe(U);break;case"morph":v.id=o(U.getAttribute("source")),console.warn("THREE.ColladaLoader: Morph target animation not supported yet.");break}}ct.controllers[S.getAttribute("id")]=v}function oe(S){const v={sources:{}};for(let D=0,A=S.childNodes.length;D<A;D++){const U=S.childNodes[D];if(U.nodeType===1)switch(U.nodeName){case"bind_shape_matrix":v.bindShapeMatrix=s(U.textContent);break;case"source":const ee=U.getAttribute("id");v.sources[ee]=pe(U);break;case"joints":v.joints=$(U);break;case"vertex_weights":v.vertexWeights=xe(U);break}}return v}function $(S){const v={inputs:{}};for(let D=0,A=S.childNodes.length;D<A;D++){const U=S.childNodes[D];if(U.nodeType===1)switch(U.nodeName){case"input":const ee=U.getAttribute("semantic"),ue=o(U.getAttribute("source"));v.inputs[ee]=ue;break}}return v}function xe(S){const v={inputs:{}};for(let D=0,A=S.childNodes.length;D<A;D++){const U=S.childNodes[D];if(U.nodeType===1)switch(U.nodeName){case"input":const ee=U.getAttribute("semantic"),ue=o(U.getAttribute("source")),Ve=parseInt(U.getAttribute("offset"));v.inputs[ee]={id:ue,offset:Ve};break;case"vcount":v.vcount=a(U.textContent);break;case"v":v.v=a(U.textContent);break}}return v}function Ee(S){const v={id:S.id},D=ct.geometries[v.id];return S.skin!==void 0&&(v.skin=q(S.skin),D.sources.skinIndices=v.skin.indices,D.sources.skinWeights=v.skin.weights),v}function q(S){const D={joints:[],indices:{array:[],stride:4},weights:{array:[],stride:4}},A=S.sources,U=S.vertexWeights,ee=U.vcount,ue=U.v,Ve=U.inputs.JOINT.offset,Ae=U.inputs.WEIGHT.offset,Ne=S.sources[S.joints.inputs.JOINT],$e=S.sources[S.joints.inputs.INV_BIND_MATRIX],ge=A[U.inputs.WEIGHT.id].array;let Ye=0,qe,rt,et;for(qe=0,et=ee.length;qe<et;qe++){const Dt=ee[qe],Tt=[];for(rt=0;rt<Dt;rt++){const wt=ue[Ye+Ve],ii=ue[Ye+Ae],yn=ge[ii];Tt.push({index:wt,weight:yn}),Ye+=2}for(Tt.sort(zt),rt=0;rt<4;rt++){const wt=Tt[rt];wt!==void 0?(D.indices.array.push(wt.index),D.weights.array.push(wt.weight)):(D.indices.array.push(0),D.weights.array.push(0))}}for(S.bindShapeMatrix?D.bindMatrix=new ut().fromArray(S.bindShapeMatrix).transpose():D.bindMatrix=new ut().identity(),qe=0,et=Ne.array.length;qe<et;qe++){const Dt=Ne.array[qe],Tt=new ut().fromArray($e.array,qe*$e.stride).transpose();D.joints.push({name:Dt,boneInverse:Tt})}return D;function zt(Dt,Tt){return Tt.weight-Dt.weight}}function te(S){return _(ct.controllers[S],Ee)}function se(S){const v={init_from:n(S,"init_from")[0].textContent};ct.images[S.getAttribute("id")]=v}function le(S){return S.build!==void 0?S.build:S.init_from}function be(S){const v=ct.images[S];return v!==void 0?_(v,le):(console.warn("THREE.ColladaLoader: Couldn't find image with ID:",S),null)}function st(S){const v={};for(let D=0,A=S.childNodes.length;D<A;D++){const U=S.childNodes[D];if(U.nodeType===1)switch(U.nodeName){case"profile_COMMON":v.profile=Ke(U);break}}ct.effects[S.getAttribute("id")]=v}function Ke(S){const v={surfaces:{},samplers:{}};for(let D=0,A=S.childNodes.length;D<A;D++){const U=S.childNodes[D];if(U.nodeType===1)switch(U.nodeName){case"newparam":Ct(U,v);break;case"technique":v.technique=N(U);break;case"extra":v.extra=Ie(U);break}}return v}function Ct(S,v){const D=S.getAttribute("sid");for(let A=0,U=S.childNodes.length;A<U;A++){const ee=S.childNodes[A];if(ee.nodeType===1)switch(ee.nodeName){case"surface":v.surfaces[D]=ae(ee);break;case"sampler2D":v.samplers[D]=_e(ee);break}}}function ae(S){const v={};for(let D=0,A=S.childNodes.length;D<A;D++){const U=S.childNodes[D];if(U.nodeType===1)switch(U.nodeName){case"init_from":v.init_from=U.textContent;break}}return v}function _e(S){const v={};for(let D=0,A=S.childNodes.length;D<A;D++){const U=S.childNodes[D];if(U.nodeType===1)switch(U.nodeName){case"source":v.source=U.textContent;break}}return v}function N(S){const v={};for(let D=0,A=S.childNodes.length;D<A;D++){const U=S.childNodes[D];if(U.nodeType===1)switch(U.nodeName){case"constant":case"lambert":case"blinn":case"phong":v.type=U.nodeName,v.parameters=We(U);break;case"extra":v.extra=Ie(U);break}}return v}function We(S){const v={};for(let D=0,A=S.childNodes.length;D<A;D++){const U=S.childNodes[D];if(U.nodeType===1)switch(U.nodeName){case"emission":case"diffuse":case"specular":case"bump":case"ambient":case"shininess":case"transparency":v[U.nodeName]=Me(U);break;case"transparent":v[U.nodeName]={opaque:U.hasAttribute("opaque")?U.getAttribute("opaque"):"A_ONE",data:Me(U)};break}}return v}function Me(S){const v={};for(let D=0,A=S.childNodes.length;D<A;D++){const U=S.childNodes[D];if(U.nodeType===1)switch(U.nodeName){case"color":v[U.nodeName]=s(U.textContent);break;case"float":v[U.nodeName]=parseFloat(U.textContent);break;case"texture":v[U.nodeName]={id:U.getAttribute("texture"),extra:Te(U)};break}}return v}function Te(S){const v={technique:{}};for(let D=0,A=S.childNodes.length;D<A;D++){const U=S.childNodes[D];if(U.nodeType===1)switch(U.nodeName){case"extra":Q(U,v);break}}return v}function Q(S,v){for(let D=0,A=S.childNodes.length;D<A;D++){const U=S.childNodes[D];if(U.nodeType===1)switch(U.nodeName){case"technique":Be(U,v);break}}}function Be(S,v){for(let D=0,A=S.childNodes.length;D<A;D++){const U=S.childNodes[D];if(U.nodeType===1)switch(U.nodeName){case"repeatU":case"repeatV":case"offsetU":case"offsetV":v.technique[U.nodeName]=parseFloat(U.textContent);break;case"wrapU":case"wrapV":U.textContent.toUpperCase()==="TRUE"?v.technique[U.nodeName]=1:U.textContent.toUpperCase()==="FALSE"?v.technique[U.nodeName]=0:v.technique[U.nodeName]=parseInt(U.textContent);break;case"bump":v[U.nodeName]=pt(U);break}}}function Ie(S){const v={};for(let D=0,A=S.childNodes.length;D<A;D++){const U=S.childNodes[D];if(U.nodeType===1)switch(U.nodeName){case"technique":v.technique=Re(U);break}}return v}function Re(S){const v={};for(let D=0,A=S.childNodes.length;D<A;D++){const U=S.childNodes[D];if(U.nodeType===1)switch(U.nodeName){case"double_sided":v[U.nodeName]=parseInt(U.textContent);break;case"bump":v[U.nodeName]=pt(U);break}}return v}function pt(S){const v={};for(let D=0,A=S.childNodes.length;D<A;D++){const U=S.childNodes[D];if(U.nodeType===1)switch(U.nodeName){case"texture":v[U.nodeName]={id:U.getAttribute("texture"),texcoord:U.getAttribute("texcoord"),extra:Te(U)};break}}return v}function F(S){return S}function T(S){return _(ct.effects[S],F)}function Y(S){const v={name:S.getAttribute("name")};for(let D=0,A=S.childNodes.length;D<A;D++){const U=S.childNodes[D];if(U.nodeType===1)switch(U.nodeName){case"instance_effect":v.url=o(U.getAttribute("url"));break}}ct.materials[S.getAttribute("id")]=v}function ce(S){let v,D=S.slice((S.lastIndexOf(".")-1>>>0)+2);switch(D=D.toLowerCase(),D){case"tga":v=on;break;default:v=pn}return v}function de(S){const v=T(S.url),D=v.profile.technique;let A;switch(D.type){case"phong":case"blinn":A=new Sn;break;case"lambert":A=new bp;break;default:A=new Ci;break}A.name=S.name||"";function U(Ae,Ne=null){const $e=v.profile.samplers[Ae.id];let ge=null;if($e!==void 0){const Ye=v.profile.surfaces[$e.source];ge=be(Ye.init_from)}else console.warn("THREE.ColladaLoader: Undefined sampler. Access image directly (see #12530)."),ge=be(Ae.id);if(ge!==null){const Ye=ce(ge);if(Ye!==void 0){const qe=Ye.load(ge),rt=Ae.extra;if(rt!==void 0&&rt.technique!==void 0&&c(rt.technique)===!1){const et=rt.technique;qe.wrapS=et.wrapU?jn:kn,qe.wrapT=et.wrapV?jn:kn,qe.offset.set(et.offsetU||0,et.offsetV||0),qe.repeat.set(et.repeatU||1,et.repeatV||1)}else qe.wrapS=jn,qe.wrapT=jn;return Ne!==null&&(qe.colorSpace=Ne),qe}else return console.warn("THREE.ColladaLoader: Loader for texture %s not found.",ge),null}else return console.warn("THREE.ColladaLoader: Couldn't create texture with ID:",Ae.id),null}const ee=D.parameters;for(const Ae in ee){const Ne=ee[Ae];switch(Ae){case"diffuse":Ne.color&&A.color.fromArray(Ne.color),Ne.texture&&(A.map=U(Ne.texture,At));break;case"specular":Ne.color&&A.specular&&A.specular.fromArray(Ne.color),Ne.texture&&(A.specularMap=U(Ne.texture));break;case"bump":Ne.texture&&(A.normalMap=U(Ne.texture));break;case"ambient":Ne.texture&&(A.lightMap=U(Ne.texture,At));break;case"shininess":Ne.float&&A.shininess&&(A.shininess=Ne.float);break;case"emission":Ne.color&&A.emissive&&A.emissive.fromArray(Ne.color),Ne.texture&&(A.emissiveMap=U(Ne.texture,At));break}}vt.colorSpaceToWorking(A.color,At),A.specular&&vt.colorSpaceToWorking(A.specular,At),A.emissive&&vt.colorSpaceToWorking(A.emissive,At);let ue=ee.transparent,Ve=ee.transparency;if(Ve===void 0&&ue&&(Ve={float:1}),ue===void 0&&Ve&&(ue={opaque:"A_ONE",data:{color:[1,1,1,1]}}),ue&&Ve)if(ue.data.texture)A.transparent=!0;else{const Ae=ue.data.color;switch(ue.opaque){case"A_ONE":A.opacity=Ae[3]*Ve.float;break;case"RGB_ZERO":A.opacity=1-Ae[0]*Ve.float;break;case"A_ZERO":A.opacity=1-Ae[3]*Ve.float;break;case"RGB_ONE":A.opacity=Ae[0]*Ve.float;break;default:console.warn('THREE.ColladaLoader: Invalid opaque type "%s" of transparent tag.',ue.opaque)}A.opacity<1&&(A.transparent=!0)}if(D.extra!==void 0&&D.extra.technique!==void 0){const Ae=D.extra.technique;for(const Ne in Ae){const $e=Ae[Ne];switch(Ne){case"double_sided":A.side=$e===1?hn:$n;break;case"bump":A.normalMap=U($e.texture),A.normalScale=new dt(1,1);break}}}return A}function ne(S){return _(ct.materials[S],de)}function Ge(S){const v={name:S.getAttribute("name")};for(let D=0,A=S.childNodes.length;D<A;D++){const U=S.childNodes[D];if(U.nodeType===1)switch(U.nodeName){case"optics":v.optics=Se(U);break}}ct.cameras[S.getAttribute("id")]=v}function Se(S){for(let v=0;v<S.childNodes.length;v++){const D=S.childNodes[v];switch(D.nodeName){case"technique_common":return Fe(D)}}return{}}function Fe(S){const v={};for(let D=0;D<S.childNodes.length;D++){const A=S.childNodes[D];switch(A.nodeName){case"perspective":case"orthographic":v.technique=A.nodeName,v.parameters=je(A);break}}return v}function je(S){const v={};for(let D=0;D<S.childNodes.length;D++){const A=S.childNodes[D];switch(A.nodeName){case"xfov":case"yfov":case"xmag":case"ymag":case"znear":case"zfar":case"aspect_ratio":v[A.nodeName]=parseFloat(A.textContent);break}}return v}function fe(S){let v;switch(S.optics.technique){case"perspective":v=new sn(S.optics.parameters.yfov,S.optics.parameters.aspect_ratio,S.optics.parameters.znear,S.optics.parameters.zfar);break;case"orthographic":let D=S.optics.parameters.ymag,A=S.optics.parameters.xmag;const U=S.optics.parameters.aspect_ratio;A=A===void 0?D*U:A,D=D===void 0?A/U:D,A*=.5,D*=.5,v=new Ta(-A,A,D,-D,S.optics.parameters.znear,S.optics.parameters.zfar);break;default:v=new sn;break}return v.name=S.name||"",v}function Oe(S){const v=ct.cameras[S];return v!==void 0?_(v,fe):(console.warn("THREE.ColladaLoader: Couldn't find camera with ID:",S),null)}function tt(S){let v={};for(let D=0,A=S.childNodes.length;D<A;D++){const U=S.childNodes[D];if(U.nodeType===1)switch(U.nodeName){case"technique_common":v=Qe(U);break}}ct.lights[S.getAttribute("id")]=v}function Qe(S){const v={};for(let D=0,A=S.childNodes.length;D<A;D++){const U=S.childNodes[D];if(U.nodeType===1)switch(U.nodeName){case"directional":case"point":case"spot":case"ambient":v.technique=U.nodeName,v.parameters=we(U)}}return v}function we(S){const v={};for(let D=0,A=S.childNodes.length;D<A;D++){const U=S.childNodes[D];if(U.nodeType===1)switch(U.nodeName){case"color":const ee=s(U.textContent);v.color=new ht().fromArray(ee),vt.colorSpaceToWorking(v.color,At);break;case"falloff_angle":v.falloffAngle=parseFloat(U.textContent);break;case"quadratic_attenuation":const ue=parseFloat(U.textContent);v.distance=ue?Math.sqrt(1/ue):0;break}}return v}function at(S){let v;switch(S.technique){case"directional":v=new Eh;break;case"point":v=new bh;break;case"spot":v=new zp;break;case"ambient":v=new Th;break}return S.parameters.color&&v.color.copy(S.parameters.color),S.parameters.distance&&(v.distance=S.parameters.distance),v}function V(S){const v=ct.lights[S];return v!==void 0?_(v,at):(console.warn("THREE.ColladaLoader: Couldn't find light with ID:",S),null)}function Pe(S){const v={name:S.getAttribute("name"),sources:{},vertices:{},primitives:[]},D=n(S,"mesh")[0];if(D!==void 0){for(let A=0;A<D.childNodes.length;A++){const U=D.childNodes[A];if(U.nodeType!==1)continue;const ee=U.getAttribute("id");switch(U.nodeName){case"source":v.sources[ee]=pe(U);break;case"vertices":v.vertices=ke(U);break;case"polygons":console.warn("THREE.ColladaLoader: Unsupported primitive type: ",U.nodeName);break;case"lines":case"linestrips":case"polylist":case"triangles":v.primitives.push(ve(U));break;default:console.log(U)}}ct.geometries[S.getAttribute("id")]=v}}function pe(S){const v={array:[],stride:3};for(let D=0;D<S.childNodes.length;D++){const A=S.childNodes[D];if(A.nodeType===1)switch(A.nodeName){case"float_array":v.array=s(A.textContent);break;case"Name_array":v.array=i(A.textContent);break;case"technique_common":const U=n(A,"accessor")[0];U!==void 0&&(v.stride=parseInt(U.getAttribute("stride")));break}}return v}function ke(S){const v={};for(let D=0;D<S.childNodes.length;D++){const A=S.childNodes[D];A.nodeType===1&&(v[A.getAttribute("semantic")]=o(A.getAttribute("source")))}return v}function ve(S){const v={type:S.nodeName,material:S.getAttribute("material"),count:parseInt(S.getAttribute("count")),inputs:{},stride:0,hasUV:!1};for(let D=0,A=S.childNodes.length;D<A;D++){const U=S.childNodes[D];if(U.nodeType===1)switch(U.nodeName){case"input":const ee=o(U.getAttribute("source")),ue=U.getAttribute("semantic"),Ve=parseInt(U.getAttribute("offset")),Ae=parseInt(U.getAttribute("set")),Ne=Ae>0?ue+Ae:ue;v.inputs[Ne]={id:ee,offset:Ve},v.stride=Math.max(v.stride,Ve+1),ue==="TEXCOORD"&&(v.hasUV=!0);break;case"vcount":v.vcount=a(U.textContent);break;case"p":v.p=a(U.textContent);break}}return v}function he(S){const v={};for(let D=0;D<S.length;D++){const A=S[D];v[A.type]===void 0&&(v[A.type]=[]),v[A.type].push(A)}return v}function He(S){let v=0;for(let D=0,A=S.length;D<A;D++)S[D].hasUV===!0&&v++;v>0&&v<S.length&&(S.uvsNeedsFix=!0)}function me(S){const v={},D=S.sources,A=S.vertices,U=S.primitives;if(U.length===0)return{};const ee=he(U);for(const ue in ee){const Ve=ee[ue];He(Ve),v[ue]=mt(Ve,D,A)}return v}function mt(S,v,D){const A={},U={array:[],stride:0},ee={array:[],stride:0},ue={array:[],stride:0},Ve={array:[],stride:0},Ae={array:[],stride:0},Ne={array:[],stride:4},$e={array:[],stride:4},ge=new Vt,Ye=[];let qe=0;for(let rt=0;rt<S.length;rt++){const et=S[rt],zt=et.inputs;let Dt=0;switch(et.type){case"lines":case"linestrips":Dt=et.count*2;break;case"triangles":Dt=et.count*3;break;case"polylist":for(let Tt=0;Tt<et.count;Tt++){const wt=et.vcount[Tt];switch(wt){case 3:Dt+=3;break;case 4:Dt+=6;break;default:Dt+=(wt-2)*3;break}}break;default:console.warn("THREE.ColladaLoader: Unknown primitive type:",et.type)}ge.addGroup(qe,Dt,rt),qe+=Dt,et.material&&Ye.push(et.material);for(const Tt in zt){const wt=zt[Tt];switch(Tt){case"VERTEX":for(const ii in D){const yn=D[ii];switch(ii){case"POSITION":const ir=U.array.length;if(Ze(et,v[yn],wt.offset,U.array),U.stride=v[yn].stride,v.skinWeights&&v.skinIndices&&(Ze(et,v.skinIndices,wt.offset,Ne.array),Ze(et,v.skinWeights,wt.offset,$e.array)),et.hasUV===!1&&S.uvsNeedsFix===!0){const jh=(U.array.length-ir)/U.stride;for(let jl=0;jl<jh;jl++)ue.array.push(0,0)}break;case"NORMAL":Ze(et,v[yn],wt.offset,ee.array),ee.stride=v[yn].stride;break;case"COLOR":Ze(et,v[yn],wt.offset,Ae.array),Ae.stride=v[yn].stride;break;case"TEXCOORD":Ze(et,v[yn],wt.offset,ue.array),ue.stride=v[yn].stride;break;case"TEXCOORD1":Ze(et,v[yn],wt.offset,Ve.array),ue.stride=v[yn].stride;break;default:console.warn('THREE.ColladaLoader: Semantic "%s" not handled in geometry build process.',ii)}}break;case"NORMAL":Ze(et,v[wt.id],wt.offset,ee.array),ee.stride=v[wt.id].stride;break;case"COLOR":Ze(et,v[wt.id],wt.offset,Ae.array,!0),Ae.stride=v[wt.id].stride;break;case"TEXCOORD":Ze(et,v[wt.id],wt.offset,ue.array),ue.stride=v[wt.id].stride;break;case"TEXCOORD1":Ze(et,v[wt.id],wt.offset,Ve.array),Ve.stride=v[wt.id].stride;break}}}return U.array.length>0&&ge.setAttribute("position",new xt(U.array,U.stride)),ee.array.length>0&&ge.setAttribute("normal",new xt(ee.array,ee.stride)),Ae.array.length>0&&ge.setAttribute("color",new xt(Ae.array,Ae.stride)),ue.array.length>0&&ge.setAttribute("uv",new xt(ue.array,ue.stride)),Ve.array.length>0&&ge.setAttribute("uv1",new xt(Ve.array,Ve.stride)),Ne.array.length>0&&ge.setAttribute("skinIndex",new xt(Ne.array,Ne.stride)),$e.array.length>0&&ge.setAttribute("skinWeight",new xt($e.array,$e.stride)),A.data=ge,A.type=S[0].type,A.materialKeys=Ye,A}function Ze(S,v,D,A,U=!1){const ee=S.p,ue=S.stride,Ve=S.vcount;function Ae(ge){let Ye=ee[ge+D]*$e;const qe=Ye+$e;for(;Ye<qe;Ye++)A.push(Ne[Ye]);if(U){const rt=A.length-$e-1;qt.setRGB(A[rt+0],A[rt+1],A[rt+2],At),A[rt+0]=qt.r,A[rt+1]=qt.g,A[rt+2]=qt.b}}const Ne=v.array,$e=v.stride;if(S.vcount!==void 0){let ge=0;for(let Ye=0,qe=Ve.length;Ye<qe;Ye++){const rt=Ve[Ye];if(rt===4){const et=ge+ue*0,zt=ge+ue*1,Dt=ge+ue*2,Tt=ge+ue*3;Ae(et),Ae(zt),Ae(Tt),Ae(zt),Ae(Dt),Ae(Tt)}else if(rt===3){const et=ge+ue*0,zt=ge+ue*1,Dt=ge+ue*2;Ae(et),Ae(zt),Ae(Dt)}else if(rt>4)for(let et=1,zt=rt-2;et<=zt;et++){const Dt=ge+ue*0,Tt=ge+ue*et,wt=ge+ue*(et+1);Ae(Dt),Ae(Tt),Ae(wt)}ge+=ue*rt}}else for(let ge=0,Ye=ee.length;ge<Ye;ge+=ue)Ae(ge)}function Ht(S){return _(ct.geometries[S],me)}function En(S){const v={name:S.getAttribute("name")||"",joints:{},links:[]};for(let D=0;D<S.childNodes.length;D++){const A=S.childNodes[D];if(A.nodeType===1)switch(A.nodeName){case"technique_common":De(A,v);break}}ct.kinematicsModels[S.getAttribute("id")]=v}function Qn(S){return S.build!==void 0?S.build:S}function nt(S){return _(ct.kinematicsModels[S],Qn)}function De(S,v){for(let D=0;D<S.childNodes.length;D++){const A=S.childNodes[D];if(A.nodeType===1)switch(A.nodeName){case"joint":v.joints[A.getAttribute("sid")]=Gt(A);break;case"link":v.links.push(Wt(A));break}}}function Gt(S){let v;for(let D=0;D<S.childNodes.length;D++){const A=S.childNodes[D];if(A.nodeType===1)switch(A.nodeName){case"prismatic":case"revolute":v=Pn(A);break}}return v}function Pn(S){const v={sid:S.getAttribute("sid"),name:S.getAttribute("name")||"",axis:new k,limits:{min:0,max:0},type:S.nodeName,static:!1,zeroPosition:0,middlePosition:0};for(let D=0;D<S.childNodes.length;D++){const A=S.childNodes[D];if(A.nodeType===1)switch(A.nodeName){case"axis":const U=s(A.textContent);v.axis.fromArray(U);break;case"limits":const ee=A.getElementsByTagName("max")[0],ue=A.getElementsByTagName("min")[0];v.limits.max=parseFloat(ee.textContent),v.limits.min=parseFloat(ue.textContent);break}}return v.limits.min>=v.limits.max&&(v.static=!0),v.middlePosition=(v.limits.min+v.limits.max)/2,v}function Wt(S){const v={sid:S.getAttribute("sid"),name:S.getAttribute("name")||"",attachments:[],transforms:[]};for(let D=0;D<S.childNodes.length;D++){const A=S.childNodes[D];if(A.nodeType===1)switch(A.nodeName){case"attachment_full":v.attachments.push(Zt(A));break;case"matrix":case"translate":case"rotate":v.transforms.push(dn(A));break}}return v}function Zt(S){const v={joint:S.getAttribute("joint").split("/").pop(),transforms:[],links:[]};for(let D=0;D<S.childNodes.length;D++){const A=S.childNodes[D];if(A.nodeType===1)switch(A.nodeName){case"link":v.links.push(Wt(A));break;case"matrix":case"translate":case"rotate":v.transforms.push(dn(A));break}}return v}function dn(S){const v={type:S.nodeName},D=s(S.textContent);switch(v.type){case"matrix":v.obj=new ut,v.obj.fromArray(D).transpose();break;case"translate":v.obj=new k,v.obj.fromArray(D);break;case"rotate":v.obj=new k,v.obj.fromArray(D),v.angle=Wi.degToRad(D[3]);break}return v}function ei(S){const v={name:S.getAttribute("name")||"",rigidBodies:{}};for(let D=0;D<S.childNodes.length;D++){const A=S.childNodes[D];if(A.nodeType===1)switch(A.nodeName){case"rigid_body":v.rigidBodies[A.getAttribute("name")]={},Pi(A,v.rigidBodies[A.getAttribute("name")]);break}}ct.physicsModels[S.getAttribute("id")]=v}function Pi(S,v){for(let D=0;D<S.childNodes.length;D++){const A=S.childNodes[D];if(A.nodeType===1)switch(A.nodeName){case"technique_common":Di(A,v);break}}}function Di(S,v){for(let D=0;D<S.childNodes.length;D++){const A=S.childNodes[D];if(A.nodeType===1)switch(A.nodeName){case"inertia":v.inertia=s(A.textContent);break;case"mass":v.mass=s(A.textContent)[0];break}}}function Qi(S){const v={bindJointAxis:[]};for(let D=0;D<S.childNodes.length;D++){const A=S.childNodes[D];if(A.nodeType===1)switch(A.nodeName){case"bind_joint_axis":v.bindJointAxis.push(er(A));break}}ct.kinematicsScenes[o(S.getAttribute("url"))]=v}function er(S){const v={target:S.getAttribute("target").split("/").pop()};for(let D=0;D<S.childNodes.length;D++){const A=S.childNodes[D];if(A.nodeType===1)switch(A.nodeName){case"axis":const U=A.getElementsByTagName("param")[0];v.axis=U.textContent;const ee=v.axis.split("inst_").pop().split("axis")[0];v.jointIndex=ee.substring(0,ee.length-1);break}}return v}function tr(S){return S.build!==void 0?S.build:S}function Li(S){return _(ct.kinematicsScenes[S],tr)}function fn(){const S=Object.keys(ct.kinematicsModels)[0],v=Object.keys(ct.kinematicsScenes)[0],D=Object.keys(ct.visualScenes)[0];if(S===void 0||v===void 0)return;const A=nt(S),U=Li(v),ee=Mt(D),ue=U.bindJointAxis,Ve={};for(let $e=0,ge=ue.length;$e<ge;$e++){const Ye=ue[$e],qe=Bt.querySelector('[sid="'+Ye.target+'"]');if(qe){const rt=qe.parentElement;Ae(Ye.jointIndex,rt)}}function Ae($e,ge){const Ye=ge.getAttribute("name"),qe=A.joints[$e];ee.traverse(function(rt){rt.name===Ye&&(Ve[$e]={object:rt,transforms:ti(ge),joint:qe,position:qe.zeroPosition})})}const Ne=new ut;nr={joints:A&&A.joints,getJointValue:function($e){const ge=Ve[$e];if(ge)return ge.position;console.warn("THREE.ColladaLoader: Joint "+$e+" doesn't exist.")},setJointValue:function($e,ge){const Ye=Ve[$e];if(Ye){const qe=Ye.joint;if(ge>qe.limits.max||ge<qe.limits.min)console.warn("THREE.ColladaLoader: Joint "+$e+" value "+ge+" outside of limits (min: "+qe.limits.min+", max: "+qe.limits.max+").");else if(qe.static)console.warn("THREE.ColladaLoader: Joint "+$e+" is static.");else{const rt=Ye.object,et=qe.axis,zt=Ye.transforms;G.identity();for(let Dt=0;Dt<zt.length;Dt++){const Tt=zt[Dt];if(Tt.sid&&Tt.sid.indexOf($e)!==-1)switch(qe.type){case"revolute":G.multiply(Ne.makeRotationAxis(et,Wi.degToRad(ge)));break;case"prismatic":G.multiply(Ne.makeTranslation(et.x*ge,et.y*ge,et.z*ge));break;default:console.warn("THREE.ColladaLoader: Unknown joint type: "+qe.type);break}else switch(Tt.type){case"matrix":G.multiply(Tt.obj);break;case"translate":G.multiply(Ne.makeTranslation(Tt.obj.x,Tt.obj.y,Tt.obj.z));break;case"scale":G.scale(Tt.obj);break;case"rotate":G.multiply(Ne.makeRotationAxis(Tt.obj,Tt.angle));break}}rt.matrix.copy(G),rt.matrix.decompose(rt.position,rt.quaternion,rt.scale),Ve[$e].position=ge}}else console.log("THREE.ColladaLoader: "+$e+" does not exist.")}}}function ti(S){const v=[],D=Bt.querySelector('[id="'+S.id+'"]');for(let A=0;A<D.childNodes.length;A++){const U=D.childNodes[A];if(U.nodeType!==1)continue;let ee,ue;switch(U.nodeName){case"matrix":ee=s(U.textContent);const Ve=new ut().fromArray(ee).transpose();v.push({sid:U.getAttribute("sid"),type:U.nodeName,obj:Ve});break;case"translate":case"scale":ee=s(U.textContent),ue=new k().fromArray(ee),v.push({sid:U.getAttribute("sid"),type:U.nodeName,obj:ue});break;case"rotate":ee=s(U.textContent),ue=new k().fromArray(ee);const Ae=Wi.degToRad(ee[3]);v.push({sid:U.getAttribute("sid"),type:U.nodeName,obj:ue,angle:Ae});break}}return v}function P(S){const v=S.getElementsByTagName("node");for(let D=0;D<v.length;D++){const A=v[D];A.hasAttribute("id")===!1&&A.setAttribute("id",l())}}const G=new ut,J=new k;function Z(S){const v={name:S.getAttribute("name")||"",type:S.getAttribute("type"),id:S.getAttribute("id"),sid:S.getAttribute("sid"),matrix:new ut,nodes:[],instanceCameras:[],instanceControllers:[],instanceLights:[],instanceGeometries:[],instanceNodes:[],transforms:{}};for(let D=0;D<S.childNodes.length;D++){const A=S.childNodes[D];if(A.nodeType!==1)continue;let U;switch(A.nodeName){case"node":v.nodes.push(A.getAttribute("id")),Z(A);break;case"instance_camera":v.instanceCameras.push(o(A.getAttribute("url")));break;case"instance_controller":v.instanceControllers.push(W(A));break;case"instance_light":v.instanceLights.push(o(A.getAttribute("url")));break;case"instance_geometry":v.instanceGeometries.push(W(A));break;case"instance_node":v.instanceNodes.push(o(A.getAttribute("url")));break;case"matrix":U=s(A.textContent),v.matrix.multiply(G.fromArray(U).transpose()),v.transforms[A.getAttribute("sid")]=A.nodeName;break;case"translate":U=s(A.textContent),J.fromArray(U),v.matrix.multiply(G.makeTranslation(J.x,J.y,J.z)),v.transforms[A.getAttribute("sid")]=A.nodeName;break;case"rotate":U=s(A.textContent);const ee=Wi.degToRad(U[3]);v.matrix.multiply(G.makeRotationAxis(J.fromArray(U),ee)),v.transforms[A.getAttribute("sid")]=A.nodeName;break;case"scale":U=s(A.textContent),v.matrix.scale(J.fromArray(U)),v.transforms[A.getAttribute("sid")]=A.nodeName;break;case"extra":break;default:console.log(A)}}return Je(v.id)?console.warn("THREE.ColladaLoader: There is already a node with ID %s. Exclude current node from further processing.",v.id):ct.nodes[v.id]=v,v}function W(S){const v={id:o(S.getAttribute("url")),materials:{},skeletons:[]};for(let D=0;D<S.childNodes.length;D++){const A=S.childNodes[D];switch(A.nodeName){case"bind_material":const U=A.getElementsByTagName("instance_material");for(let ee=0;ee<U.length;ee++){const ue=U[ee],Ve=ue.getAttribute("symbol"),Ae=ue.getAttribute("target");v.materials[Ve]=o(Ae)}break;case"skeleton":v.skeletons.push(o(A.textContent));break}}return v}function ye(S,v){const D=[],A=[];let U,ee,ue;for(U=0;U<S.length;U++){const Ne=S[U];let $e;if(Je(Ne))$e=ft(Ne),Ue($e,v,D);else if(kt(Ne)){const Ye=ct.visualScenes[Ne].children;for(let qe=0;qe<Ye.length;qe++){const rt=Ye[qe];if(rt.type==="JOINT"){const et=ft(rt.id);Ue(et,v,D)}}}else console.error("THREE.ColladaLoader: Unable to find root bone of skeleton with ID:",Ne)}for(U=0;U<v.length;U++)for(ee=0;ee<D.length;ee++)if(ue=D[ee],ue.bone.name===v[U].name){A[U]=ue,ue.processed=!0;break}for(U=0;U<D.length;U++)ue=D[U],ue.processed===!1&&(A.push(ue),ue.processed=!0);const Ve=[],Ae=[];for(U=0;U<A.length;U++)ue=A[U],Ve.push(ue.bone),Ae.push(ue.boneInverse);return new Il(Ve,Ae)}function Ue(S,v,D){S.traverse(function(A){if(A.isBone===!0){let U;for(let ee=0;ee<v.length;ee++){const ue=v[ee];if(ue.name===A.name){U=ue.boneInverse;break}}U===void 0&&(U=new ut),D.push({bone:A,boneInverse:U,processed:!1})}})}function Xe(S){const v=[],D=S.matrix,A=S.nodes,U=S.type,ee=S.instanceCameras,ue=S.instanceControllers,Ve=S.instanceLights,Ae=S.instanceGeometries,Ne=S.instanceNodes;for(let ge=0,Ye=A.length;ge<Ye;ge++)v.push(ft(A[ge]));for(let ge=0,Ye=ee.length;ge<Ye;ge++){const qe=Oe(ee[ge]);qe!==null&&v.push(qe.clone())}for(let ge=0,Ye=ue.length;ge<Ye;ge++){const qe=ue[ge],rt=te(qe.id),et=Ht(rt.id),zt=lt(et,qe.materials),Dt=qe.skeletons,Tt=rt.skin.joints,wt=ye(Dt,Tt);for(let ii=0,yn=zt.length;ii<yn;ii++){const ir=zt[ii];ir.isSkinnedMesh&&(ir.bind(wt,rt.skin.bindMatrix),ir.normalizeSkinWeights()),v.push(ir)}}for(let ge=0,Ye=Ve.length;ge<Ye;ge++){const qe=V(Ve[ge]);qe!==null&&v.push(qe.clone())}for(let ge=0,Ye=Ae.length;ge<Ye;ge++){const qe=Ae[ge],rt=Ht(qe.id),et=lt(rt,qe.materials);for(let zt=0,Dt=et.length;zt<Dt;zt++)v.push(et[zt])}for(let ge=0,Ye=Ne.length;ge<Ye;ge++)v.push(ft(Ne[ge]).clone());let $e;if(A.length===0&&v.length===1)$e=v[0];else{$e=U==="JOINT"?new vh:new fi;for(let ge=0;ge<v.length;ge++)$e.add(v[ge])}return $e.name=U==="JOINT"?S.sid:S.name,$e.matrix.copy(D),$e.matrix.decompose($e.position,$e.quaternion,$e.scale),$e}const ze=new Ci({name:Hn.DEFAULT_MATERIAL_NAME,color:16711935});function ot(S,v){const D=[];for(let A=0,U=S.length;A<U;A++){const ee=v[S[A]];ee===void 0?(console.warn("THREE.ColladaLoader: Material with key %s not found. Apply fallback material.",S[A]),D.push(ze)):D.push(ne(ee))}return D}function lt(S,v){const D=[];for(const A in S){const U=S[A],ee=ot(U.materialKeys,v);if(ee.length===0&&(A==="lines"||A==="linestrips"?ee.push(new ji):ee.push(new Sn)),A==="lines"||A==="linestrips")for(let Ne=0,$e=ee.length;Ne<$e;Ne++){const ge=ee[Ne];if(ge.isMeshPhongMaterial===!0||ge.isMeshLambertMaterial===!0){const Ye=new ji;Ye.color.copy(ge.color),Ye.opacity=ge.opacity,Ye.transparent=ge.transparent,ee[Ne]=Ye}}const ue=U.data.attributes.skinIndex!==void 0,Ve=ee.length===1?ee[0]:ee;let Ae;switch(A){case"lines":Ae=new ol(U.data,Ve);break;case"linestrips":Ae=new Fl(U.data,Ve);break;case"triangles":case"polylist":ue?Ae=new _p(U.data,Ve):Ae=new Ut(U.data,Ve);break}D.push(Ae)}return D}function Je(S){return ct.nodes[S]!==void 0}function ft(S){return _(ct.nodes[S],Xe)}function Rt(S){const v={name:S.getAttribute("name"),children:[]};P(S);const D=n(S,"node");for(let A=0;A<D.length;A++)v.children.push(Z(D[A]));ct.visualScenes[S.getAttribute("id")]=v}function Ot(S){const v=new fi;v.name=S.name;const D=S.children;for(let A=0;A<D.length;A++){const U=D[A];v.add(ft(U.id))}return v}function kt(S){return ct.visualScenes[S]!==void 0}function Mt(S){return _(ct.visualScenes[S],Ot)}function it(S){const v=n(S,"instance_visual_scene")[0];return Mt(o(v.getAttribute("url")))}function Yt(){const S=ct.clips;if(c(S)===!0){if(c(ct.animations)===!1){const v=[];for(const D in ct.animations){const A=y(D);for(let U=0,ee=A.length;U<ee;U++)v.push(A[U])}Kt.push(new Hc("default",-1,v))}}else for(const v in S)Kt.push(H(v))}function Et(S){let v="";const D=[S];for(;D.length;){const A=D.shift();A.nodeType===Node.TEXT_NODE?v+=A.textContent:(v+=`
|
|
4204
|
+
`);for(let p=0,M=g.length;p<M;p++){if(g[p]==="")continue;const E=g[p].split(" ");if(f.x!==void 0&&(s.push(parseFloat(E[f.x])),s.push(parseFloat(E[f.y])),s.push(parseFloat(E[f.z]))),f.rgb!==void 0){const y=i.fields.findIndex(w=>w==="rgb"),I=i.type[y],R=parseFloat(E[f.rgb]);let C=R;if(I==="F"){const w=new Float32Array(1);w[0]=R,C=new Int32Array(w.buffer)[0]}const L=(C>>16&255)/255,b=(C>>8&255)/255,x=(C>>0&255)/255;u.setRGB(L,b,x,At),o.push(u.r,u.g,u.b)}f.normal_x!==void 0&&(a.push(parseFloat(E[f.normal_x])),a.push(parseFloat(E[f.normal_y])),a.push(parseFloat(E[f.normal_z]))),f.intensity!==void 0&&l.push(parseFloat(E[f.intensity])),f.label!==void 0&&c.push(parseInt(E[f.label]))}}if(i.data==="binary_compressed"){const f=new Uint32Array(e.slice(i.headerLen,i.headerLen+8)),m=f[0],_=f[1],g=t(new Uint8Array(e,i.headerLen+8,m),_),p=new DataView(g.buffer),M=i.offset;for(let E=0;E<i.points;E++){if(M.x!==void 0){const y=i.fields.indexOf("x"),I=i.fields.indexOf("y"),R=i.fields.indexOf("z");s.push(this._getDataView(p,i.points*M.x+i.size[y]*E,i.type[y],i.size[y])),s.push(this._getDataView(p,i.points*M.y+i.size[I]*E,i.type[I],i.size[I])),s.push(this._getDataView(p,i.points*M.z+i.size[R]*E,i.type[R],i.size[R]))}if(M.rgb!==void 0){const y=i.fields.indexOf("rgb"),I=p.getUint8(i.points*M.rgb+i.size[y]*E+2)/255,R=p.getUint8(i.points*M.rgb+i.size[y]*E+1)/255,C=p.getUint8(i.points*M.rgb+i.size[y]*E+0)/255;u.setRGB(I,R,C,At),o.push(u.r,u.g,u.b)}if(M.normal_x!==void 0){const y=i.fields.indexOf("normal_x"),I=i.fields.indexOf("normal_y"),R=i.fields.indexOf("normal_z");a.push(this._getDataView(p,i.points*M.normal_x+i.size[y]*E,i.type[y],i.size[y])),a.push(this._getDataView(p,i.points*M.normal_y+i.size[I]*E,i.type[I],i.size[I])),a.push(this._getDataView(p,i.points*M.normal_z+i.size[R]*E,i.type[R],i.size[R]))}if(M.intensity!==void 0){const y=i.fields.indexOf("intensity");l.push(this._getDataView(p,i.points*M.intensity+i.size[y]*E,i.type[y],i.size[y]))}if(M.label!==void 0){const y=i.fields.indexOf("label");c.push(p.getInt32(i.points*M.label+i.size[y]*E,this.littleEndian))}}}if(i.data==="binary"){const f=new DataView(e,i.headerLen),m=i.offset;for(let _=0,g=0;_<i.points;_++,g+=i.rowSize){if(m.x!==void 0){const p=i.fields.indexOf("x"),M=i.fields.indexOf("y"),E=i.fields.indexOf("z");s.push(this._getDataView(f,g+m.x,i.type[p],i.size[p])),s.push(this._getDataView(f,g+m.y,i.type[M],i.size[M])),s.push(this._getDataView(f,g+m.z,i.type[E],i.size[E]))}if(m.rgb!==void 0){const p=f.getUint8(g+m.rgb+2)/255,M=f.getUint8(g+m.rgb+1)/255,E=f.getUint8(g+m.rgb+0)/255;u.setRGB(p,M,E,At),o.push(u.r,u.g,u.b)}if(m.normal_x!==void 0){const p=i.fields.indexOf("normal_x"),M=i.fields.indexOf("normal_y"),E=i.fields.indexOf("normal_z");a.push(this._getDataView(f,g+m.normal_x,i.type[p],i.size[p])),a.push(this._getDataView(f,g+m.normal_y,i.type[M],i.size[M])),a.push(this._getDataView(f,g+m.normal_z,i.type[E],i.size[E]))}if(m.intensity!==void 0){const p=i.fields.indexOf("intensity");l.push(this._getDataView(f,g+m.intensity,i.type[p],i.size[p]))}m.label!==void 0&&c.push(f.getInt32(g+m.label,this.littleEndian))}}const h=new Vt;s.length>0&&h.setAttribute("position",new xt(s,3)),a.length>0&&h.setAttribute("normal",new xt(a,3)),o.length>0&&h.setAttribute("color",new xt(o,3)),l.length>0&&h.setAttribute("intensity",new xt(l,1)),c.length>0&&h.setAttribute("label",new ap(c,1)),h.computeBoundingSphere();const d=new qi({size:.005});return o.length>0&&(d.vertexColors=!0),new is(h,d)}}class ku extends Fp{constructor(e){super(e)}parse(e){function t(O){switch(O.image_type){case d:case _:if(O.colormap_length>256||O.colormap_size!==24||O.colormap_type!==1)throw new Error("THREE.TGALoader: Invalid type colormap data for indexed type.");break;case f:case m:case g:case p:if(O.colormap_type)throw new Error("THREE.TGALoader: Invalid type colormap data for colormap type.");break;case h:throw new Error("THREE.TGALoader: No data.");default:throw new Error("THREE.TGALoader: Invalid type "+O.image_type)}if(O.width<=0||O.height<=0)throw new Error("THREE.TGALoader: Invalid image size.");if(O.pixel_size!==8&&O.pixel_size!==16&&O.pixel_size!==24&&O.pixel_size!==32)throw new Error("THREE.TGALoader: Invalid pixel size "+O.pixel_size)}function n(O,K,H,re,oe){let $,xe;const Ee=H.pixel_size>>3,q=H.width*H.height*Ee;if(K&&(xe=oe.subarray(re,re+=H.colormap_length*(H.colormap_size>>3))),O){$=new Uint8Array(q);let te,se,le,be=0;const st=new Uint8Array(Ee);for(;be<q;)if(te=oe[re++],se=(te&127)+1,te&128){for(le=0;le<Ee;++le)st[le]=oe[re++];for(le=0;le<se;++le)$.set(st,be+le*Ee);be+=Ee*se}else{for(se*=Ee,le=0;le<se;++le)$[be+le]=oe[re++];be+=se}}else $=oe.subarray(re,re+=K?H.width*H.height:q);return{pixel_data:$,palettes:xe}}function i(O,K,H,re,oe,$,xe,Ee,q){const te=q;let se,le=0,be,st;const Ke=x.width;for(st=K;st!==re;st+=H)for(be=oe;be!==xe;be+=$,le++)se=Ee[le],O[(be+Ke*st)*4+3]=255,O[(be+Ke*st)*4+2]=te[se*3+0],O[(be+Ke*st)*4+1]=te[se*3+1],O[(be+Ke*st)*4+0]=te[se*3+2];return O}function s(O,K,H,re,oe,$,xe,Ee){let q,te=0,se,le;const be=x.width;for(le=K;le!==re;le+=H)for(se=oe;se!==xe;se+=$,te+=2)q=Ee[te+0]+(Ee[te+1]<<8),O[(se+be*le)*4+0]=(q&31744)>>7,O[(se+be*le)*4+1]=(q&992)>>2,O[(se+be*le)*4+2]=(q&31)<<3,O[(se+be*le)*4+3]=q&32768?0:255;return O}function a(O,K,H,re,oe,$,xe,Ee){let q=0,te,se;const le=x.width;for(se=K;se!==re;se+=H)for(te=oe;te!==xe;te+=$,q+=3)O[(te+le*se)*4+3]=255,O[(te+le*se)*4+2]=Ee[q+0],O[(te+le*se)*4+1]=Ee[q+1],O[(te+le*se)*4+0]=Ee[q+2];return O}function o(O,K,H,re,oe,$,xe,Ee){let q=0,te,se;const le=x.width;for(se=K;se!==re;se+=H)for(te=oe;te!==xe;te+=$,q+=4)O[(te+le*se)*4+2]=Ee[q+0],O[(te+le*se)*4+1]=Ee[q+1],O[(te+le*se)*4+0]=Ee[q+2],O[(te+le*se)*4+3]=Ee[q+3];return O}function l(O,K,H,re,oe,$,xe,Ee){let q,te=0,se,le;const be=x.width;for(le=K;le!==re;le+=H)for(se=oe;se!==xe;se+=$,te++)q=Ee[te],O[(se+be*le)*4+0]=q,O[(se+be*le)*4+1]=q,O[(se+be*le)*4+2]=q,O[(se+be*le)*4+3]=255;return O}function c(O,K,H,re,oe,$,xe,Ee){let q=0,te,se;const le=x.width;for(se=K;se!==re;se+=H)for(te=oe;te!==xe;te+=$,q+=2)O[(te+le*se)*4+0]=Ee[q+0],O[(te+le*se)*4+1]=Ee[q+0],O[(te+le*se)*4+2]=Ee[q+0],O[(te+le*se)*4+3]=Ee[q+1];return O}function u(O,K,H,re,oe){let $,xe,Ee,q,te,se;switch((x.flags&M)>>E){default:case R:$=0,Ee=1,te=K,xe=0,q=1,se=H;break;case y:$=0,Ee=1,te=K,xe=H-1,q=-1,se=-1;break;case C:$=K-1,Ee=-1,te=-1,xe=0,q=1,se=H;break;case I:$=K-1,Ee=-1,te=-1,xe=H-1,q=-1,se=-1;break}if(z)switch(x.pixel_size){case 8:l(O,xe,q,se,$,Ee,te,re);break;case 16:c(O,xe,q,se,$,Ee,te,re);break;default:throw new Error("THREE.TGALoader: Format not supported.")}else switch(x.pixel_size){case 8:i(O,xe,q,se,$,Ee,te,re,oe);break;case 16:s(O,xe,q,se,$,Ee,te,re);break;case 24:a(O,xe,q,se,$,Ee,te,re);break;case 32:o(O,xe,q,se,$,Ee,te,re);break;default:throw new Error("THREE.TGALoader: Format not supported.")}return O}const h=0,d=1,f=2,m=3,_=9,g=10,p=11,M=48,E=4,y=0,I=1,R=2,C=3;if(e.length<19)throw new Error("THREE.TGALoader: Not enough data to contain header.");let L=0;const b=new Uint8Array(e),x={id_length:b[L++],colormap_type:b[L++],image_type:b[L++],colormap_index:b[L++]|b[L++]<<8,colormap_length:b[L++]|b[L++]<<8,colormap_size:b[L++],origin:[b[L++]|b[L++]<<8,b[L++]|b[L++]<<8],width:b[L++]|b[L++]<<8,height:b[L++]|b[L++]<<8,pixel_size:b[L++],flags:b[L++]};if(t(x),x.id_length+L>e.length)throw new Error("THREE.TGALoader: No data.");L+=x.id_length;let w=!1,B=!1,z=!1;switch(x.image_type){case _:w=!0,B=!0;break;case d:B=!0;break;case g:w=!0;break;case f:break;case p:w=!0,z=!0;break;case m:z=!0;break}const X=new Uint8Array(x.width*x.height*4),j=n(w,B,x,L,b);return u(X,x.width,x.height,j.pixel_data,j.palettes),{data:X,width:x.width,height:x.height,flipY:!0,generateMipmaps:!0,minFilter:hi}}}class uy extends Hn{load(e,t,n,i){const s=this,a=s.path===""?Vl.extractUrlBase(e):s.path,o=new Vr(s.manager);o.setPath(s.path),o.setRequestHeader(s.requestHeader),o.setWithCredentials(s.withCredentials),o.load(e,function(l){try{t(s.parse(l,a))}catch(c){i?i(c):console.error(c),s.manager.itemError(e)}},n,i)}parse(e,t){function n(S,v){const D=[],A=S.childNodes;for(let U=0,ee=A.length;U<ee;U++){const ue=A[U];ue.nodeName===v&&D.push(ue)}return D}function i(S){if(S.length===0)return[];const v=S.trim().split(/\s+/),D=new Array(v.length);for(let A=0,U=v.length;A<U;A++)D[A]=v[A];return D}function s(S){if(S.length===0)return[];const v=S.trim().split(/\s+/),D=new Array(v.length);for(let A=0,U=v.length;A<U;A++)D[A]=parseFloat(v[A]);return D}function a(S){if(S.length===0)return[];const v=S.trim().split(/\s+/),D=new Array(v.length);for(let A=0,U=v.length;A<U;A++)D[A]=parseInt(v[A]);return D}function o(S){return S.substring(1)}function l(){return"three_default_"+ni++}function c(S){return Object.keys(S).length===0}function u(S){return{unit:h(n(S,"unit")[0]),upAxis:d(n(S,"up_axis")[0])}}function h(S){return S!==void 0&&S.hasAttribute("meter")===!0?parseFloat(S.getAttribute("meter")):1}function d(S){return S!==void 0?S.textContent:"Y_UP"}function f(S,v,D,A){const U=n(S,v)[0];if(U!==void 0){const ee=n(U,D);for(let ue=0;ue<ee.length;ue++)A(ee[ue])}}function m(S,v){for(const D in S){const A=S[D];A.build=v(S[D])}}function _(S,v){return S.build!==void 0||(S.build=v(S)),S.build}function g(S){const v={sources:{},samplers:{},channels:{}};let D=!1;for(let A=0,U=S.childNodes.length;A<U;A++){const ee=S.childNodes[A];if(ee.nodeType!==1)continue;let ue;switch(ee.nodeName){case"source":ue=ee.getAttribute("id"),v.sources[ue]=pe(ee);break;case"sampler":ue=ee.getAttribute("id"),v.samplers[ue]=p(ee);break;case"channel":ue=ee.getAttribute("target"),v.channels[ue]=M(ee);break;case"animation":g(ee),D=!0;break;default:console.log(ee)}}D===!1&&(ct.animations[S.getAttribute("id")||Wi.generateUUID()]=v)}function p(S){const v={inputs:{}};for(let D=0,A=S.childNodes.length;D<A;D++){const U=S.childNodes[D];if(U.nodeType===1)switch(U.nodeName){case"input":const ee=o(U.getAttribute("source")),ue=U.getAttribute("semantic");v.inputs[ue]=ee;break}}return v}function M(S){const v={};let A=S.getAttribute("target").split("/");const U=A.shift();let ee=A.shift();const ue=ee.indexOf("(")!==-1,Ve=ee.indexOf(".")!==-1;if(Ve)A=ee.split("."),ee=A.shift(),v.member=A.shift();else if(ue){const Ae=ee.split("(");ee=Ae.shift();for(let Ne=0;Ne<Ae.length;Ne++)Ae[Ne]=parseInt(Ae[Ne].replace(/\)/,""));v.indices=Ae}return v.id=U,v.sid=ee,v.arraySyntax=ue,v.memberSyntax=Ve,v.sampler=o(S.getAttribute("source")),v}function E(S){const v=[],D=S.channels,A=S.samplers,U=S.sources;for(const ee in D)if(D.hasOwnProperty(ee)){const ue=D[ee],Ve=A[ue.sampler],Ae=Ve.inputs.INPUT,Ne=Ve.inputs.OUTPUT,$e=U[Ae],ge=U[Ne],Ye=I(ue,$e,ge);x(Ye,v)}return v}function y(S){return _(ct.animations[S],E)}function I(S,v,D){const A=ct.nodes[S.id],U=ft(A.id),ee=A.transforms[S.sid],ue=A.matrix.clone().transpose();let Ve,Ae,Ne,$e,ge,Ye;const qe={};switch(ee){case"matrix":for(Ne=0,$e=v.array.length;Ne<$e;Ne++)if(Ve=v.array[Ne],Ae=Ne*D.stride,qe[Ve]===void 0&&(qe[Ve]={}),S.arraySyntax===!0){const zt=D.array[Ae],Dt=S.indices[0]+4*S.indices[1];qe[Ve][Dt]=zt}else for(ge=0,Ye=D.stride;ge<Ye;ge++)qe[Ve][ge]=D.array[Ae+ge];break;case"translate":console.warn('THREE.ColladaLoader: Animation transform type "%s" not yet implemented.',ee);break;case"rotate":console.warn('THREE.ColladaLoader: Animation transform type "%s" not yet implemented.',ee);break;case"scale":console.warn('THREE.ColladaLoader: Animation transform type "%s" not yet implemented.',ee);break}const rt=R(qe,ue);return{name:U.uuid,keyframes:rt}}function R(S,v){const D=[];for(const U in S)D.push({time:parseFloat(U),value:S[U]});D.sort(A);for(let U=0;U<16;U++)w(D,U,v.elements[U]);return D;function A(U,ee){return U.time-ee.time}}const C=new k,L=new k,b=new Cn;function x(S,v){const D=S.keyframes,A=S.name,U=[],ee=[],ue=[],Ve=[];for(let Ae=0,Ne=D.length;Ae<Ne;Ae++){const $e=D[Ae],ge=$e.time,Ye=$e.value;G.fromArray(Ye).transpose(),G.decompose(C,b,L),U.push(ge),ee.push(C.x,C.y,C.z),ue.push(b.x,b.y,b.z,b.w),Ve.push(L.x,L.y,L.z)}return ee.length>0&&v.push(new Fr(A+".position",U,ee)),ue.length>0&&v.push(new fs(A+".quaternion",U,ue)),Ve.length>0&&v.push(new Fr(A+".scale",U,Ve)),v}function w(S,v,D){let A,U=!0,ee,ue;for(ee=0,ue=S.length;ee<ue;ee++)A=S[ee],A.value[v]===void 0?A.value[v]=null:U=!1;if(U===!0)for(ee=0,ue=S.length;ee<ue;ee++)A=S[ee],A.value[v]=D;else B(S,v)}function B(S,v){let D,A;for(let U=0,ee=S.length;U<ee;U++){const ue=S[U];if(ue.value[v]===null){if(D=z(S,U,v),A=X(S,U,v),D===null){ue.value[v]=A.value[v];continue}if(A===null){ue.value[v]=D.value[v];continue}j(ue,D,A,v)}}}function z(S,v,D){for(;v>=0;){const A=S[v];if(A.value[D]!==null)return A;v--}return null}function X(S,v,D){for(;v<S.length;){const A=S[v];if(A.value[D]!==null)return A;v++}return null}function j(S,v,D,A){if(D.time-v.time===0){S.value[A]=v.value[A];return}S.value[A]=(S.time-v.time)*(D.value[A]-v.value[A])/(D.time-v.time)+v.value[A]}function O(S){const v={name:S.getAttribute("id")||"default",start:parseFloat(S.getAttribute("start")||0),end:parseFloat(S.getAttribute("end")||0),animations:[]};for(let D=0,A=S.childNodes.length;D<A;D++){const U=S.childNodes[D];if(U.nodeType===1)switch(U.nodeName){case"instance_animation":v.animations.push(o(U.getAttribute("url")));break}}ct.clips[S.getAttribute("id")]=v}function K(S){const v=[],D=S.name,A=S.end-S.start||-1,U=S.animations;for(let ee=0,ue=U.length;ee<ue;ee++){const Ve=y(U[ee]);for(let Ae=0,Ne=Ve.length;Ae<Ne;Ae++)v.push(Ve[Ae])}return new Hc(D,A,v)}function H(S){return _(ct.clips[S],K)}function re(S){const v={};for(let D=0,A=S.childNodes.length;D<A;D++){const U=S.childNodes[D];if(U.nodeType===1)switch(U.nodeName){case"skin":v.id=o(U.getAttribute("source")),v.skin=oe(U);break;case"morph":v.id=o(U.getAttribute("source")),console.warn("THREE.ColladaLoader: Morph target animation not supported yet.");break}}ct.controllers[S.getAttribute("id")]=v}function oe(S){const v={sources:{}};for(let D=0,A=S.childNodes.length;D<A;D++){const U=S.childNodes[D];if(U.nodeType===1)switch(U.nodeName){case"bind_shape_matrix":v.bindShapeMatrix=s(U.textContent);break;case"source":const ee=U.getAttribute("id");v.sources[ee]=pe(U);break;case"joints":v.joints=$(U);break;case"vertex_weights":v.vertexWeights=xe(U);break}}return v}function $(S){const v={inputs:{}};for(let D=0,A=S.childNodes.length;D<A;D++){const U=S.childNodes[D];if(U.nodeType===1)switch(U.nodeName){case"input":const ee=U.getAttribute("semantic"),ue=o(U.getAttribute("source"));v.inputs[ee]=ue;break}}return v}function xe(S){const v={inputs:{}};for(let D=0,A=S.childNodes.length;D<A;D++){const U=S.childNodes[D];if(U.nodeType===1)switch(U.nodeName){case"input":const ee=U.getAttribute("semantic"),ue=o(U.getAttribute("source")),Ve=parseInt(U.getAttribute("offset"));v.inputs[ee]={id:ue,offset:Ve};break;case"vcount":v.vcount=a(U.textContent);break;case"v":v.v=a(U.textContent);break}}return v}function Ee(S){const v={id:S.id},D=ct.geometries[v.id];return S.skin!==void 0&&(v.skin=q(S.skin),D.sources.skinIndices=v.skin.indices,D.sources.skinWeights=v.skin.weights),v}function q(S){const D={joints:[],indices:{array:[],stride:4},weights:{array:[],stride:4}},A=S.sources,U=S.vertexWeights,ee=U.vcount,ue=U.v,Ve=U.inputs.JOINT.offset,Ae=U.inputs.WEIGHT.offset,Ne=S.sources[S.joints.inputs.JOINT],$e=S.sources[S.joints.inputs.INV_BIND_MATRIX],ge=A[U.inputs.WEIGHT.id].array;let Ye=0,qe,rt,et;for(qe=0,et=ee.length;qe<et;qe++){const Dt=ee[qe],Tt=[];for(rt=0;rt<Dt;rt++){const wt=ue[Ye+Ve],ii=ue[Ye+Ae],yn=ge[ii];Tt.push({index:wt,weight:yn}),Ye+=2}for(Tt.sort(zt),rt=0;rt<4;rt++){const wt=Tt[rt];wt!==void 0?(D.indices.array.push(wt.index),D.weights.array.push(wt.weight)):(D.indices.array.push(0),D.weights.array.push(0))}}for(S.bindShapeMatrix?D.bindMatrix=new ut().fromArray(S.bindShapeMatrix).transpose():D.bindMatrix=new ut().identity(),qe=0,et=Ne.array.length;qe<et;qe++){const Dt=Ne.array[qe],Tt=new ut().fromArray($e.array,qe*$e.stride).transpose();D.joints.push({name:Dt,boneInverse:Tt})}return D;function zt(Dt,Tt){return Tt.weight-Dt.weight}}function te(S){return _(ct.controllers[S],Ee)}function se(S){const v={init_from:n(S,"init_from")[0].textContent};ct.images[S.getAttribute("id")]=v}function le(S){return S.build!==void 0?S.build:S.init_from}function be(S){const v=ct.images[S];return v!==void 0?_(v,le):(console.warn("THREE.ColladaLoader: Couldn't find image with ID:",S),null)}function st(S){const v={};for(let D=0,A=S.childNodes.length;D<A;D++){const U=S.childNodes[D];if(U.nodeType===1)switch(U.nodeName){case"profile_COMMON":v.profile=Ke(U);break}}ct.effects[S.getAttribute("id")]=v}function Ke(S){const v={surfaces:{},samplers:{}};for(let D=0,A=S.childNodes.length;D<A;D++){const U=S.childNodes[D];if(U.nodeType===1)switch(U.nodeName){case"newparam":Ct(U,v);break;case"technique":v.technique=N(U);break;case"extra":v.extra=Ie(U);break}}return v}function Ct(S,v){const D=S.getAttribute("sid");for(let A=0,U=S.childNodes.length;A<U;A++){const ee=S.childNodes[A];if(ee.nodeType===1)switch(ee.nodeName){case"surface":v.surfaces[D]=ae(ee);break;case"sampler2D":v.samplers[D]=_e(ee);break}}}function ae(S){const v={};for(let D=0,A=S.childNodes.length;D<A;D++){const U=S.childNodes[D];if(U.nodeType===1)switch(U.nodeName){case"init_from":v.init_from=U.textContent;break}}return v}function _e(S){const v={};for(let D=0,A=S.childNodes.length;D<A;D++){const U=S.childNodes[D];if(U.nodeType===1)switch(U.nodeName){case"source":v.source=U.textContent;break}}return v}function N(S){const v={};for(let D=0,A=S.childNodes.length;D<A;D++){const U=S.childNodes[D];if(U.nodeType===1)switch(U.nodeName){case"constant":case"lambert":case"blinn":case"phong":v.type=U.nodeName,v.parameters=We(U);break;case"extra":v.extra=Ie(U);break}}return v}function We(S){const v={};for(let D=0,A=S.childNodes.length;D<A;D++){const U=S.childNodes[D];if(U.nodeType===1)switch(U.nodeName){case"emission":case"diffuse":case"specular":case"bump":case"ambient":case"shininess":case"transparency":v[U.nodeName]=Me(U);break;case"transparent":v[U.nodeName]={opaque:U.hasAttribute("opaque")?U.getAttribute("opaque"):"A_ONE",data:Me(U)};break}}return v}function Me(S){const v={};for(let D=0,A=S.childNodes.length;D<A;D++){const U=S.childNodes[D];if(U.nodeType===1)switch(U.nodeName){case"color":v[U.nodeName]=s(U.textContent);break;case"float":v[U.nodeName]=parseFloat(U.textContent);break;case"texture":v[U.nodeName]={id:U.getAttribute("texture"),extra:Te(U)};break}}return v}function Te(S){const v={technique:{}};for(let D=0,A=S.childNodes.length;D<A;D++){const U=S.childNodes[D];if(U.nodeType===1)switch(U.nodeName){case"extra":Q(U,v);break}}return v}function Q(S,v){for(let D=0,A=S.childNodes.length;D<A;D++){const U=S.childNodes[D];if(U.nodeType===1)switch(U.nodeName){case"technique":Be(U,v);break}}}function Be(S,v){for(let D=0,A=S.childNodes.length;D<A;D++){const U=S.childNodes[D];if(U.nodeType===1)switch(U.nodeName){case"repeatU":case"repeatV":case"offsetU":case"offsetV":v.technique[U.nodeName]=parseFloat(U.textContent);break;case"wrapU":case"wrapV":U.textContent.toUpperCase()==="TRUE"?v.technique[U.nodeName]=1:U.textContent.toUpperCase()==="FALSE"?v.technique[U.nodeName]=0:v.technique[U.nodeName]=parseInt(U.textContent);break;case"bump":v[U.nodeName]=pt(U);break}}}function Ie(S){const v={};for(let D=0,A=S.childNodes.length;D<A;D++){const U=S.childNodes[D];if(U.nodeType===1)switch(U.nodeName){case"technique":v.technique=Re(U);break}}return v}function Re(S){const v={};for(let D=0,A=S.childNodes.length;D<A;D++){const U=S.childNodes[D];if(U.nodeType===1)switch(U.nodeName){case"double_sided":v[U.nodeName]=parseInt(U.textContent);break;case"bump":v[U.nodeName]=pt(U);break}}return v}function pt(S){const v={};for(let D=0,A=S.childNodes.length;D<A;D++){const U=S.childNodes[D];if(U.nodeType===1)switch(U.nodeName){case"texture":v[U.nodeName]={id:U.getAttribute("texture"),texcoord:U.getAttribute("texcoord"),extra:Te(U)};break}}return v}function F(S){return S}function T(S){return _(ct.effects[S],F)}function Y(S){const v={name:S.getAttribute("name")};for(let D=0,A=S.childNodes.length;D<A;D++){const U=S.childNodes[D];if(U.nodeType===1)switch(U.nodeName){case"instance_effect":v.url=o(U.getAttribute("url"));break}}ct.materials[S.getAttribute("id")]=v}function ce(S){let v,D=S.slice((S.lastIndexOf(".")-1>>>0)+2);switch(D=D.toLowerCase(),D){case"tga":v=on;break;default:v=pn}return v}function de(S){const v=T(S.url),D=v.profile.technique;let A;switch(D.type){case"phong":case"blinn":A=new Sn;break;case"lambert":A=new Mp;break;default:A=new Ci;break}A.name=S.name||"";function U(Ae,Ne=null){const $e=v.profile.samplers[Ae.id];let ge=null;if($e!==void 0){const Ye=v.profile.surfaces[$e.source];ge=be(Ye.init_from)}else console.warn("THREE.ColladaLoader: Undefined sampler. Access image directly (see #12530)."),ge=be(Ae.id);if(ge!==null){const Ye=ce(ge);if(Ye!==void 0){const qe=Ye.load(ge),rt=Ae.extra;if(rt!==void 0&&rt.technique!==void 0&&c(rt.technique)===!1){const et=rt.technique;qe.wrapS=et.wrapU?jn:kn,qe.wrapT=et.wrapV?jn:kn,qe.offset.set(et.offsetU||0,et.offsetV||0),qe.repeat.set(et.repeatU||1,et.repeatV||1)}else qe.wrapS=jn,qe.wrapT=jn;return Ne!==null&&(qe.colorSpace=Ne),qe}else return console.warn("THREE.ColladaLoader: Loader for texture %s not found.",ge),null}else return console.warn("THREE.ColladaLoader: Couldn't create texture with ID:",Ae.id),null}const ee=D.parameters;for(const Ae in ee){const Ne=ee[Ae];switch(Ae){case"diffuse":Ne.color&&A.color.fromArray(Ne.color),Ne.texture&&(A.map=U(Ne.texture,At));break;case"specular":Ne.color&&A.specular&&A.specular.fromArray(Ne.color),Ne.texture&&(A.specularMap=U(Ne.texture));break;case"bump":Ne.texture&&(A.normalMap=U(Ne.texture));break;case"ambient":Ne.texture&&(A.lightMap=U(Ne.texture,At));break;case"shininess":Ne.float&&A.shininess&&(A.shininess=Ne.float);break;case"emission":Ne.color&&A.emissive&&A.emissive.fromArray(Ne.color),Ne.texture&&(A.emissiveMap=U(Ne.texture,At));break}}vt.colorSpaceToWorking(A.color,At),A.specular&&vt.colorSpaceToWorking(A.specular,At),A.emissive&&vt.colorSpaceToWorking(A.emissive,At);let ue=ee.transparent,Ve=ee.transparency;if(Ve===void 0&&ue&&(Ve={float:1}),ue===void 0&&Ve&&(ue={opaque:"A_ONE",data:{color:[1,1,1,1]}}),ue&&Ve)if(ue.data.texture)A.transparent=!0;else{const Ae=ue.data.color;switch(ue.opaque){case"A_ONE":A.opacity=Ae[3]*Ve.float;break;case"RGB_ZERO":A.opacity=1-Ae[0]*Ve.float;break;case"A_ZERO":A.opacity=1-Ae[3]*Ve.float;break;case"RGB_ONE":A.opacity=Ae[0]*Ve.float;break;default:console.warn('THREE.ColladaLoader: Invalid opaque type "%s" of transparent tag.',ue.opaque)}A.opacity<1&&(A.transparent=!0)}if(D.extra!==void 0&&D.extra.technique!==void 0){const Ae=D.extra.technique;for(const Ne in Ae){const $e=Ae[Ne];switch(Ne){case"double_sided":A.side=$e===1?hn:$n;break;case"bump":A.normalMap=U($e.texture),A.normalScale=new dt(1,1);break}}}return A}function ne(S){return _(ct.materials[S],de)}function Ge(S){const v={name:S.getAttribute("name")};for(let D=0,A=S.childNodes.length;D<A;D++){const U=S.childNodes[D];if(U.nodeType===1)switch(U.nodeName){case"optics":v.optics=Se(U);break}}ct.cameras[S.getAttribute("id")]=v}function Se(S){for(let v=0;v<S.childNodes.length;v++){const D=S.childNodes[v];switch(D.nodeName){case"technique_common":return Fe(D)}}return{}}function Fe(S){const v={};for(let D=0;D<S.childNodes.length;D++){const A=S.childNodes[D];switch(A.nodeName){case"perspective":case"orthographic":v.technique=A.nodeName,v.parameters=je(A);break}}return v}function je(S){const v={};for(let D=0;D<S.childNodes.length;D++){const A=S.childNodes[D];switch(A.nodeName){case"xfov":case"yfov":case"xmag":case"ymag":case"znear":case"zfar":case"aspect_ratio":v[A.nodeName]=parseFloat(A.textContent);break}}return v}function fe(S){let v;switch(S.optics.technique){case"perspective":v=new sn(S.optics.parameters.yfov,S.optics.parameters.aspect_ratio,S.optics.parameters.znear,S.optics.parameters.zfar);break;case"orthographic":let D=S.optics.parameters.ymag,A=S.optics.parameters.xmag;const U=S.optics.parameters.aspect_ratio;A=A===void 0?D*U:A,D=D===void 0?A/U:D,A*=.5,D*=.5,v=new Ta(-A,A,D,-D,S.optics.parameters.znear,S.optics.parameters.zfar);break;default:v=new sn;break}return v.name=S.name||"",v}function Oe(S){const v=ct.cameras[S];return v!==void 0?_(v,fe):(console.warn("THREE.ColladaLoader: Couldn't find camera with ID:",S),null)}function tt(S){let v={};for(let D=0,A=S.childNodes.length;D<A;D++){const U=S.childNodes[D];if(U.nodeType===1)switch(U.nodeName){case"technique_common":v=Qe(U);break}}ct.lights[S.getAttribute("id")]=v}function Qe(S){const v={};for(let D=0,A=S.childNodes.length;D<A;D++){const U=S.childNodes[D];if(U.nodeType===1)switch(U.nodeName){case"directional":case"point":case"spot":case"ambient":v.technique=U.nodeName,v.parameters=we(U)}}return v}function we(S){const v={};for(let D=0,A=S.childNodes.length;D<A;D++){const U=S.childNodes[D];if(U.nodeType===1)switch(U.nodeName){case"color":const ee=s(U.textContent);v.color=new ht().fromArray(ee),vt.colorSpaceToWorking(v.color,At);break;case"falloff_angle":v.falloffAngle=parseFloat(U.textContent);break;case"quadratic_attenuation":const ue=parseFloat(U.textContent);v.distance=ue?Math.sqrt(1/ue):0;break}}return v}function at(S){let v;switch(S.technique){case"directional":v=new Eh;break;case"point":v=new bh;break;case"spot":v=new kp;break;case"ambient":v=new Th;break}return S.parameters.color&&v.color.copy(S.parameters.color),S.parameters.distance&&(v.distance=S.parameters.distance),v}function V(S){const v=ct.lights[S];return v!==void 0?_(v,at):(console.warn("THREE.ColladaLoader: Couldn't find light with ID:",S),null)}function Pe(S){const v={name:S.getAttribute("name"),sources:{},vertices:{},primitives:[]},D=n(S,"mesh")[0];if(D!==void 0){for(let A=0;A<D.childNodes.length;A++){const U=D.childNodes[A];if(U.nodeType!==1)continue;const ee=U.getAttribute("id");switch(U.nodeName){case"source":v.sources[ee]=pe(U);break;case"vertices":v.vertices=ke(U);break;case"polygons":console.warn("THREE.ColladaLoader: Unsupported primitive type: ",U.nodeName);break;case"lines":case"linestrips":case"polylist":case"triangles":v.primitives.push(ve(U));break;default:console.log(U)}}ct.geometries[S.getAttribute("id")]=v}}function pe(S){const v={array:[],stride:3};for(let D=0;D<S.childNodes.length;D++){const A=S.childNodes[D];if(A.nodeType===1)switch(A.nodeName){case"float_array":v.array=s(A.textContent);break;case"Name_array":v.array=i(A.textContent);break;case"technique_common":const U=n(A,"accessor")[0];U!==void 0&&(v.stride=parseInt(U.getAttribute("stride")));break}}return v}function ke(S){const v={};for(let D=0;D<S.childNodes.length;D++){const A=S.childNodes[D];A.nodeType===1&&(v[A.getAttribute("semantic")]=o(A.getAttribute("source")))}return v}function ve(S){const v={type:S.nodeName,material:S.getAttribute("material"),count:parseInt(S.getAttribute("count")),inputs:{},stride:0,hasUV:!1};for(let D=0,A=S.childNodes.length;D<A;D++){const U=S.childNodes[D];if(U.nodeType===1)switch(U.nodeName){case"input":const ee=o(U.getAttribute("source")),ue=U.getAttribute("semantic"),Ve=parseInt(U.getAttribute("offset")),Ae=parseInt(U.getAttribute("set")),Ne=Ae>0?ue+Ae:ue;v.inputs[Ne]={id:ee,offset:Ve},v.stride=Math.max(v.stride,Ve+1),ue==="TEXCOORD"&&(v.hasUV=!0);break;case"vcount":v.vcount=a(U.textContent);break;case"p":v.p=a(U.textContent);break}}return v}function he(S){const v={};for(let D=0;D<S.length;D++){const A=S[D];v[A.type]===void 0&&(v[A.type]=[]),v[A.type].push(A)}return v}function He(S){let v=0;for(let D=0,A=S.length;D<A;D++)S[D].hasUV===!0&&v++;v>0&&v<S.length&&(S.uvsNeedsFix=!0)}function me(S){const v={},D=S.sources,A=S.vertices,U=S.primitives;if(U.length===0)return{};const ee=he(U);for(const ue in ee){const Ve=ee[ue];He(Ve),v[ue]=mt(Ve,D,A)}return v}function mt(S,v,D){const A={},U={array:[],stride:0},ee={array:[],stride:0},ue={array:[],stride:0},Ve={array:[],stride:0},Ae={array:[],stride:0},Ne={array:[],stride:4},$e={array:[],stride:4},ge=new Vt,Ye=[];let qe=0;for(let rt=0;rt<S.length;rt++){const et=S[rt],zt=et.inputs;let Dt=0;switch(et.type){case"lines":case"linestrips":Dt=et.count*2;break;case"triangles":Dt=et.count*3;break;case"polylist":for(let Tt=0;Tt<et.count;Tt++){const wt=et.vcount[Tt];switch(wt){case 3:Dt+=3;break;case 4:Dt+=6;break;default:Dt+=(wt-2)*3;break}}break;default:console.warn("THREE.ColladaLoader: Unknown primitive type:",et.type)}ge.addGroup(qe,Dt,rt),qe+=Dt,et.material&&Ye.push(et.material);for(const Tt in zt){const wt=zt[Tt];switch(Tt){case"VERTEX":for(const ii in D){const yn=D[ii];switch(ii){case"POSITION":const ir=U.array.length;if(Ze(et,v[yn],wt.offset,U.array),U.stride=v[yn].stride,v.skinWeights&&v.skinIndices&&(Ze(et,v.skinIndices,wt.offset,Ne.array),Ze(et,v.skinWeights,wt.offset,$e.array)),et.hasUV===!1&&S.uvsNeedsFix===!0){const jh=(U.array.length-ir)/U.stride;for(let jl=0;jl<jh;jl++)ue.array.push(0,0)}break;case"NORMAL":Ze(et,v[yn],wt.offset,ee.array),ee.stride=v[yn].stride;break;case"COLOR":Ze(et,v[yn],wt.offset,Ae.array),Ae.stride=v[yn].stride;break;case"TEXCOORD":Ze(et,v[yn],wt.offset,ue.array),ue.stride=v[yn].stride;break;case"TEXCOORD1":Ze(et,v[yn],wt.offset,Ve.array),ue.stride=v[yn].stride;break;default:console.warn('THREE.ColladaLoader: Semantic "%s" not handled in geometry build process.',ii)}}break;case"NORMAL":Ze(et,v[wt.id],wt.offset,ee.array),ee.stride=v[wt.id].stride;break;case"COLOR":Ze(et,v[wt.id],wt.offset,Ae.array,!0),Ae.stride=v[wt.id].stride;break;case"TEXCOORD":Ze(et,v[wt.id],wt.offset,ue.array),ue.stride=v[wt.id].stride;break;case"TEXCOORD1":Ze(et,v[wt.id],wt.offset,Ve.array),Ve.stride=v[wt.id].stride;break}}}return U.array.length>0&&ge.setAttribute("position",new xt(U.array,U.stride)),ee.array.length>0&&ge.setAttribute("normal",new xt(ee.array,ee.stride)),Ae.array.length>0&&ge.setAttribute("color",new xt(Ae.array,Ae.stride)),ue.array.length>0&&ge.setAttribute("uv",new xt(ue.array,ue.stride)),Ve.array.length>0&&ge.setAttribute("uv1",new xt(Ve.array,Ve.stride)),Ne.array.length>0&&ge.setAttribute("skinIndex",new xt(Ne.array,Ne.stride)),$e.array.length>0&&ge.setAttribute("skinWeight",new xt($e.array,$e.stride)),A.data=ge,A.type=S[0].type,A.materialKeys=Ye,A}function Ze(S,v,D,A,U=!1){const ee=S.p,ue=S.stride,Ve=S.vcount;function Ae(ge){let Ye=ee[ge+D]*$e;const qe=Ye+$e;for(;Ye<qe;Ye++)A.push(Ne[Ye]);if(U){const rt=A.length-$e-1;qt.setRGB(A[rt+0],A[rt+1],A[rt+2],At),A[rt+0]=qt.r,A[rt+1]=qt.g,A[rt+2]=qt.b}}const Ne=v.array,$e=v.stride;if(S.vcount!==void 0){let ge=0;for(let Ye=0,qe=Ve.length;Ye<qe;Ye++){const rt=Ve[Ye];if(rt===4){const et=ge+ue*0,zt=ge+ue*1,Dt=ge+ue*2,Tt=ge+ue*3;Ae(et),Ae(zt),Ae(Tt),Ae(zt),Ae(Dt),Ae(Tt)}else if(rt===3){const et=ge+ue*0,zt=ge+ue*1,Dt=ge+ue*2;Ae(et),Ae(zt),Ae(Dt)}else if(rt>4)for(let et=1,zt=rt-2;et<=zt;et++){const Dt=ge+ue*0,Tt=ge+ue*et,wt=ge+ue*(et+1);Ae(Dt),Ae(Tt),Ae(wt)}ge+=ue*rt}}else for(let ge=0,Ye=ee.length;ge<Ye;ge+=ue)Ae(ge)}function Ht(S){return _(ct.geometries[S],me)}function En(S){const v={name:S.getAttribute("name")||"",joints:{},links:[]};for(let D=0;D<S.childNodes.length;D++){const A=S.childNodes[D];if(A.nodeType===1)switch(A.nodeName){case"technique_common":De(A,v);break}}ct.kinematicsModels[S.getAttribute("id")]=v}function Qn(S){return S.build!==void 0?S.build:S}function nt(S){return _(ct.kinematicsModels[S],Qn)}function De(S,v){for(let D=0;D<S.childNodes.length;D++){const A=S.childNodes[D];if(A.nodeType===1)switch(A.nodeName){case"joint":v.joints[A.getAttribute("sid")]=Gt(A);break;case"link":v.links.push(Wt(A));break}}}function Gt(S){let v;for(let D=0;D<S.childNodes.length;D++){const A=S.childNodes[D];if(A.nodeType===1)switch(A.nodeName){case"prismatic":case"revolute":v=Pn(A);break}}return v}function Pn(S){const v={sid:S.getAttribute("sid"),name:S.getAttribute("name")||"",axis:new k,limits:{min:0,max:0},type:S.nodeName,static:!1,zeroPosition:0,middlePosition:0};for(let D=0;D<S.childNodes.length;D++){const A=S.childNodes[D];if(A.nodeType===1)switch(A.nodeName){case"axis":const U=s(A.textContent);v.axis.fromArray(U);break;case"limits":const ee=A.getElementsByTagName("max")[0],ue=A.getElementsByTagName("min")[0];v.limits.max=parseFloat(ee.textContent),v.limits.min=parseFloat(ue.textContent);break}}return v.limits.min>=v.limits.max&&(v.static=!0),v.middlePosition=(v.limits.min+v.limits.max)/2,v}function Wt(S){const v={sid:S.getAttribute("sid"),name:S.getAttribute("name")||"",attachments:[],transforms:[]};for(let D=0;D<S.childNodes.length;D++){const A=S.childNodes[D];if(A.nodeType===1)switch(A.nodeName){case"attachment_full":v.attachments.push(Zt(A));break;case"matrix":case"translate":case"rotate":v.transforms.push(dn(A));break}}return v}function Zt(S){const v={joint:S.getAttribute("joint").split("/").pop(),transforms:[],links:[]};for(let D=0;D<S.childNodes.length;D++){const A=S.childNodes[D];if(A.nodeType===1)switch(A.nodeName){case"link":v.links.push(Wt(A));break;case"matrix":case"translate":case"rotate":v.transforms.push(dn(A));break}}return v}function dn(S){const v={type:S.nodeName},D=s(S.textContent);switch(v.type){case"matrix":v.obj=new ut,v.obj.fromArray(D).transpose();break;case"translate":v.obj=new k,v.obj.fromArray(D);break;case"rotate":v.obj=new k,v.obj.fromArray(D),v.angle=Wi.degToRad(D[3]);break}return v}function ei(S){const v={name:S.getAttribute("name")||"",rigidBodies:{}};for(let D=0;D<S.childNodes.length;D++){const A=S.childNodes[D];if(A.nodeType===1)switch(A.nodeName){case"rigid_body":v.rigidBodies[A.getAttribute("name")]={},Pi(A,v.rigidBodies[A.getAttribute("name")]);break}}ct.physicsModels[S.getAttribute("id")]=v}function Pi(S,v){for(let D=0;D<S.childNodes.length;D++){const A=S.childNodes[D];if(A.nodeType===1)switch(A.nodeName){case"technique_common":Di(A,v);break}}}function Di(S,v){for(let D=0;D<S.childNodes.length;D++){const A=S.childNodes[D];if(A.nodeType===1)switch(A.nodeName){case"inertia":v.inertia=s(A.textContent);break;case"mass":v.mass=s(A.textContent)[0];break}}}function Qi(S){const v={bindJointAxis:[]};for(let D=0;D<S.childNodes.length;D++){const A=S.childNodes[D];if(A.nodeType===1)switch(A.nodeName){case"bind_joint_axis":v.bindJointAxis.push(er(A));break}}ct.kinematicsScenes[o(S.getAttribute("url"))]=v}function er(S){const v={target:S.getAttribute("target").split("/").pop()};for(let D=0;D<S.childNodes.length;D++){const A=S.childNodes[D];if(A.nodeType===1)switch(A.nodeName){case"axis":const U=A.getElementsByTagName("param")[0];v.axis=U.textContent;const ee=v.axis.split("inst_").pop().split("axis")[0];v.jointIndex=ee.substring(0,ee.length-1);break}}return v}function tr(S){return S.build!==void 0?S.build:S}function Li(S){return _(ct.kinematicsScenes[S],tr)}function fn(){const S=Object.keys(ct.kinematicsModels)[0],v=Object.keys(ct.kinematicsScenes)[0],D=Object.keys(ct.visualScenes)[0];if(S===void 0||v===void 0)return;const A=nt(S),U=Li(v),ee=Mt(D),ue=U.bindJointAxis,Ve={};for(let $e=0,ge=ue.length;$e<ge;$e++){const Ye=ue[$e],qe=Bt.querySelector('[sid="'+Ye.target+'"]');if(qe){const rt=qe.parentElement;Ae(Ye.jointIndex,rt)}}function Ae($e,ge){const Ye=ge.getAttribute("name"),qe=A.joints[$e];ee.traverse(function(rt){rt.name===Ye&&(Ve[$e]={object:rt,transforms:ti(ge),joint:qe,position:qe.zeroPosition})})}const Ne=new ut;nr={joints:A&&A.joints,getJointValue:function($e){const ge=Ve[$e];if(ge)return ge.position;console.warn("THREE.ColladaLoader: Joint "+$e+" doesn't exist.")},setJointValue:function($e,ge){const Ye=Ve[$e];if(Ye){const qe=Ye.joint;if(ge>qe.limits.max||ge<qe.limits.min)console.warn("THREE.ColladaLoader: Joint "+$e+" value "+ge+" outside of limits (min: "+qe.limits.min+", max: "+qe.limits.max+").");else if(qe.static)console.warn("THREE.ColladaLoader: Joint "+$e+" is static.");else{const rt=Ye.object,et=qe.axis,zt=Ye.transforms;G.identity();for(let Dt=0;Dt<zt.length;Dt++){const Tt=zt[Dt];if(Tt.sid&&Tt.sid.indexOf($e)!==-1)switch(qe.type){case"revolute":G.multiply(Ne.makeRotationAxis(et,Wi.degToRad(ge)));break;case"prismatic":G.multiply(Ne.makeTranslation(et.x*ge,et.y*ge,et.z*ge));break;default:console.warn("THREE.ColladaLoader: Unknown joint type: "+qe.type);break}else switch(Tt.type){case"matrix":G.multiply(Tt.obj);break;case"translate":G.multiply(Ne.makeTranslation(Tt.obj.x,Tt.obj.y,Tt.obj.z));break;case"scale":G.scale(Tt.obj);break;case"rotate":G.multiply(Ne.makeRotationAxis(Tt.obj,Tt.angle));break}}rt.matrix.copy(G),rt.matrix.decompose(rt.position,rt.quaternion,rt.scale),Ve[$e].position=ge}}else console.log("THREE.ColladaLoader: "+$e+" does not exist.")}}}function ti(S){const v=[],D=Bt.querySelector('[id="'+S.id+'"]');for(let A=0;A<D.childNodes.length;A++){const U=D.childNodes[A];if(U.nodeType!==1)continue;let ee,ue;switch(U.nodeName){case"matrix":ee=s(U.textContent);const Ve=new ut().fromArray(ee).transpose();v.push({sid:U.getAttribute("sid"),type:U.nodeName,obj:Ve});break;case"translate":case"scale":ee=s(U.textContent),ue=new k().fromArray(ee),v.push({sid:U.getAttribute("sid"),type:U.nodeName,obj:ue});break;case"rotate":ee=s(U.textContent),ue=new k().fromArray(ee);const Ae=Wi.degToRad(ee[3]);v.push({sid:U.getAttribute("sid"),type:U.nodeName,obj:ue,angle:Ae});break}}return v}function P(S){const v=S.getElementsByTagName("node");for(let D=0;D<v.length;D++){const A=v[D];A.hasAttribute("id")===!1&&A.setAttribute("id",l())}}const G=new ut,J=new k;function Z(S){const v={name:S.getAttribute("name")||"",type:S.getAttribute("type"),id:S.getAttribute("id"),sid:S.getAttribute("sid"),matrix:new ut,nodes:[],instanceCameras:[],instanceControllers:[],instanceLights:[],instanceGeometries:[],instanceNodes:[],transforms:{}};for(let D=0;D<S.childNodes.length;D++){const A=S.childNodes[D];if(A.nodeType!==1)continue;let U;switch(A.nodeName){case"node":v.nodes.push(A.getAttribute("id")),Z(A);break;case"instance_camera":v.instanceCameras.push(o(A.getAttribute("url")));break;case"instance_controller":v.instanceControllers.push(W(A));break;case"instance_light":v.instanceLights.push(o(A.getAttribute("url")));break;case"instance_geometry":v.instanceGeometries.push(W(A));break;case"instance_node":v.instanceNodes.push(o(A.getAttribute("url")));break;case"matrix":U=s(A.textContent),v.matrix.multiply(G.fromArray(U).transpose()),v.transforms[A.getAttribute("sid")]=A.nodeName;break;case"translate":U=s(A.textContent),J.fromArray(U),v.matrix.multiply(G.makeTranslation(J.x,J.y,J.z)),v.transforms[A.getAttribute("sid")]=A.nodeName;break;case"rotate":U=s(A.textContent);const ee=Wi.degToRad(U[3]);v.matrix.multiply(G.makeRotationAxis(J.fromArray(U),ee)),v.transforms[A.getAttribute("sid")]=A.nodeName;break;case"scale":U=s(A.textContent),v.matrix.scale(J.fromArray(U)),v.transforms[A.getAttribute("sid")]=A.nodeName;break;case"extra":break;default:console.log(A)}}return Je(v.id)?console.warn("THREE.ColladaLoader: There is already a node with ID %s. Exclude current node from further processing.",v.id):ct.nodes[v.id]=v,v}function W(S){const v={id:o(S.getAttribute("url")),materials:{},skeletons:[]};for(let D=0;D<S.childNodes.length;D++){const A=S.childNodes[D];switch(A.nodeName){case"bind_material":const U=A.getElementsByTagName("instance_material");for(let ee=0;ee<U.length;ee++){const ue=U[ee],Ve=ue.getAttribute("symbol"),Ae=ue.getAttribute("target");v.materials[Ve]=o(Ae)}break;case"skeleton":v.skeletons.push(o(A.textContent));break}}return v}function ye(S,v){const D=[],A=[];let U,ee,ue;for(U=0;U<S.length;U++){const Ne=S[U];let $e;if(Je(Ne))$e=ft(Ne),Ue($e,v,D);else if(kt(Ne)){const Ye=ct.visualScenes[Ne].children;for(let qe=0;qe<Ye.length;qe++){const rt=Ye[qe];if(rt.type==="JOINT"){const et=ft(rt.id);Ue(et,v,D)}}}else console.error("THREE.ColladaLoader: Unable to find root bone of skeleton with ID:",Ne)}for(U=0;U<v.length;U++)for(ee=0;ee<D.length;ee++)if(ue=D[ee],ue.bone.name===v[U].name){A[U]=ue,ue.processed=!0;break}for(U=0;U<D.length;U++)ue=D[U],ue.processed===!1&&(A.push(ue),ue.processed=!0);const Ve=[],Ae=[];for(U=0;U<A.length;U++)ue=A[U],Ve.push(ue.bone),Ae.push(ue.boneInverse);return new Il(Ve,Ae)}function Ue(S,v,D){S.traverse(function(A){if(A.isBone===!0){let U;for(let ee=0;ee<v.length;ee++){const ue=v[ee];if(ue.name===A.name){U=ue.boneInverse;break}}U===void 0&&(U=new ut),D.push({bone:A,boneInverse:U,processed:!1})}})}function Xe(S){const v=[],D=S.matrix,A=S.nodes,U=S.type,ee=S.instanceCameras,ue=S.instanceControllers,Ve=S.instanceLights,Ae=S.instanceGeometries,Ne=S.instanceNodes;for(let ge=0,Ye=A.length;ge<Ye;ge++)v.push(ft(A[ge]));for(let ge=0,Ye=ee.length;ge<Ye;ge++){const qe=Oe(ee[ge]);qe!==null&&v.push(qe.clone())}for(let ge=0,Ye=ue.length;ge<Ye;ge++){const qe=ue[ge],rt=te(qe.id),et=Ht(rt.id),zt=lt(et,qe.materials),Dt=qe.skeletons,Tt=rt.skin.joints,wt=ye(Dt,Tt);for(let ii=0,yn=zt.length;ii<yn;ii++){const ir=zt[ii];ir.isSkinnedMesh&&(ir.bind(wt,rt.skin.bindMatrix),ir.normalizeSkinWeights()),v.push(ir)}}for(let ge=0,Ye=Ve.length;ge<Ye;ge++){const qe=V(Ve[ge]);qe!==null&&v.push(qe.clone())}for(let ge=0,Ye=Ae.length;ge<Ye;ge++){const qe=Ae[ge],rt=Ht(qe.id),et=lt(rt,qe.materials);for(let zt=0,Dt=et.length;zt<Dt;zt++)v.push(et[zt])}for(let ge=0,Ye=Ne.length;ge<Ye;ge++)v.push(ft(Ne[ge]).clone());let $e;if(A.length===0&&v.length===1)$e=v[0];else{$e=U==="JOINT"?new vh:new fi;for(let ge=0;ge<v.length;ge++)$e.add(v[ge])}return $e.name=U==="JOINT"?S.sid:S.name,$e.matrix.copy(D),$e.matrix.decompose($e.position,$e.quaternion,$e.scale),$e}const ze=new Ci({name:Hn.DEFAULT_MATERIAL_NAME,color:16711935});function ot(S,v){const D=[];for(let A=0,U=S.length;A<U;A++){const ee=v[S[A]];ee===void 0?(console.warn("THREE.ColladaLoader: Material with key %s not found. Apply fallback material.",S[A]),D.push(ze)):D.push(ne(ee))}return D}function lt(S,v){const D=[];for(const A in S){const U=S[A],ee=ot(U.materialKeys,v);if(ee.length===0&&(A==="lines"||A==="linestrips"?ee.push(new ji):ee.push(new Sn)),A==="lines"||A==="linestrips")for(let Ne=0,$e=ee.length;Ne<$e;Ne++){const ge=ee[Ne];if(ge.isMeshPhongMaterial===!0||ge.isMeshLambertMaterial===!0){const Ye=new ji;Ye.color.copy(ge.color),Ye.opacity=ge.opacity,Ye.transparent=ge.transparent,ee[Ne]=Ye}}const ue=U.data.attributes.skinIndex!==void 0,Ve=ee.length===1?ee[0]:ee;let Ae;switch(A){case"lines":Ae=new ol(U.data,Ve);break;case"linestrips":Ae=new Fl(U.data,Ve);break;case"triangles":case"polylist":ue?Ae=new gp(U.data,Ve):Ae=new Ut(U.data,Ve);break}D.push(Ae)}return D}function Je(S){return ct.nodes[S]!==void 0}function ft(S){return _(ct.nodes[S],Xe)}function Rt(S){const v={name:S.getAttribute("name"),children:[]};P(S);const D=n(S,"node");for(let A=0;A<D.length;A++)v.children.push(Z(D[A]));ct.visualScenes[S.getAttribute("id")]=v}function Ot(S){const v=new fi;v.name=S.name;const D=S.children;for(let A=0;A<D.length;A++){const U=D[A];v.add(ft(U.id))}return v}function kt(S){return ct.visualScenes[S]!==void 0}function Mt(S){return _(ct.visualScenes[S],Ot)}function it(S){const v=n(S,"instance_visual_scene")[0];return Mt(o(v.getAttribute("url")))}function Yt(){const S=ct.clips;if(c(S)===!0){if(c(ct.animations)===!1){const v=[];for(const D in ct.animations){const A=y(D);for(let U=0,ee=A.length;U<ee;U++)v.push(A[U])}Kt.push(new Hc("default",-1,v))}}else for(const v in S)Kt.push(H(v))}function Et(S){let v="";const D=[S];for(;D.length;){const A=D.shift();A.nodeType===Node.TEXT_NODE?v+=A.textContent:(v+=`
|
|
4205
4205
|
`,D.push(...A.childNodes))}return v.trim()}if(e.length===0)return{scene:new Ll};const vn=new DOMParser().parseFromString(e,"application/xml"),Bt=n(vn,"COLLADA")[0],en=vn.getElementsByTagName("parsererror")[0];if(en!==void 0){const S=n(en,"div")[0];let v;return S?v=S.textContent:v=Et(en),console.error(`THREE.ColladaLoader: Failed to parse collada file.
|
|
4206
|
-
`,v),null}const Ui=Bt.getAttribute("version");console.debug("THREE.ColladaLoader: File version",Ui);const Nt=u(n(Bt,"asset")[0]),pn=new kl(this.manager);pn.setPath(this.resourcePath||t).setCrossOrigin(this.crossOrigin);let on;ku&&(on=new ku(this.manager),on.setPath(this.resourcePath||t));const qt=new ht,Kt=[];let nr={},ni=0;const ct={animations:{},clips:{},controllers:{},images:{},effects:{},materials:{},cameras:{},lights:{},geometries:{},nodes:{},visualScenes:{},kinematicsModels:{},physicsModels:{},kinematicsScenes:{}};f(Bt,"library_animations","animation",g),f(Bt,"library_animation_clips","animation_clip",O),f(Bt,"library_controllers","controller",ie),f(Bt,"library_images","image",se),f(Bt,"library_effects","effect",st),f(Bt,"library_materials","material",Y),f(Bt,"library_cameras","camera",Ge),f(Bt,"library_lights","light",tt),f(Bt,"library_geometries","geometry",Pe),f(Bt,"library_nodes","node",Z),f(Bt,"library_visual_scenes","visual_scene",Rt),f(Bt,"library_kinematics_models","kinematics_model",En),f(Bt,"library_physics_models","physics_model",ei),f(Bt,"scene","instance_kinematics_scene",Qi),m(ct.animations,E),m(ct.clips,K),m(ct.controllers,Ee),m(ct.images,le),m(ct.effects,F),m(ct.materials,de),m(ct.cameras,fe),m(ct.lights,at),m(ct.geometries,me),m(ct.visualScenes,Ot),Yt(),fn();const ms=it(n(Bt,"scene")[0]);return ms.animations=Kt,Nt.upAxis==="Z_UP"&&(console.warn("THREE.ColladaLoader: You are loading an asset with a Z-UP coordinate system. The loader just rotates the asset to transform it into Y-UP. The vertex data are not converted, see #24289."),ms.rotation.set(-Math.PI/2,0,0)),ms.scale.multiplyScalar(Nt.unit),{get animations(){return console.warn("THREE.ColladaLoader: Please access animations over scene.animations now."),Kt},kinematics:nr,library:ct,scene:ms}}}const zu=new k,dy=new bn,Zs=new ut,Ei=new ut,Qs=new Cn,ea=new k(1,1,1),ta=new k;class Aa extends Ft{constructor(...e){super(...e),this.urdfNode=null,this.urdfName=""}copy(e,t){return super.copy(e,t),this.urdfNode=e.urdfNode,this.urdfName=e.urdfName,this}}class fy extends Aa{constructor(...e){super(...e),this.isURDFCollider=!0,this.type="URDFCollider"}}class py extends Aa{constructor(...e){super(...e),this.isURDFVisual=!0,this.type="URDFVisual"}}class Oh extends Aa{constructor(...e){super(...e),this.isURDFLink=!0,this.type="URDFLink"}}class Bh extends Aa{get jointType(){return this._jointType}set jointType(e){if(this.jointType!==e)switch(this._jointType=e,this.matrixWorldNeedsUpdate=!0,e){case"fixed":this.jointValue=[];break;case"continuous":case"revolute":case"prismatic":this.jointValue=new Array(1).fill(0);break;case"planar":this.jointValue=new Array(3).fill(0),this.axis=new k(0,0,1);break;case"floating":this.jointValue=new Array(6).fill(0);break}}get angle(){return this.jointValue[0]}constructor(...e){super(...e),this.isURDFJoint=!0,this.type="URDFJoint",this.jointValue=null,this.jointType="fixed",this.axis=new k(1,0,0),this.limit={lower:0,upper:0},this.ignoreLimits=!1,this.origPosition=null,this.origQuaternion=null,this.mimicJoints=[]}copy(e,t){return super.copy(e,t),this.jointType=e.jointType,this.axis=e.axis.clone(),this.limit.lower=e.limit.lower,this.limit.upper=e.limit.upper,this.ignoreLimits=!1,this.jointValue=[...e.jointValue],this.origPosition=e.origPosition?e.origPosition.clone():null,this.origQuaternion=e.origQuaternion?e.origQuaternion.clone():null,this.mimicJoints=[...e.mimicJoints],this}setJointValue(...e){e=e.map(n=>n===null?null:parseFloat(n)),(!this.origPosition||!this.origQuaternion)&&(this.origPosition=this.position.clone(),this.origQuaternion=this.quaternion.clone());let t=!1;switch(this.mimicJoints.forEach(n=>{t=n.updateFromMimickedJoint(...e)||t}),this.jointType){case"fixed":return t;case"continuous":case"revolute":{let n=e[0];return n==null||n===this.jointValue[0]?t:(!this.ignoreLimits&&this.jointType==="revolute"&&(n=Math.min(this.limit.upper,n),n=Math.max(this.limit.lower,n)),this.quaternion.setFromAxisAngle(this.axis,n).premultiply(this.origQuaternion),this.jointValue[0]!==n?(this.jointValue[0]=n,this.matrixWorldNeedsUpdate=!0,!0):t)}case"prismatic":{let n=e[0];return n==null||n===this.jointValue[0]?t:(this.ignoreLimits||(n=Math.min(this.limit.upper,n),n=Math.max(this.limit.lower,n)),this.position.copy(this.origPosition),zu.copy(this.axis).applyEuler(this.rotation),this.position.addScaledVector(zu,n),this.jointValue[0]!==n?(this.jointValue[0]=n,this.matrixWorldNeedsUpdate=!0,!0):t)}case"floating":return this.jointValue.every((n,i)=>e[i]===n||e[i]===null)?t:(this.jointValue[0]=e[0]!==null?e[0]:this.jointValue[0],this.jointValue[1]=e[1]!==null?e[1]:this.jointValue[1],this.jointValue[2]=e[2]!==null?e[2]:this.jointValue[2],this.jointValue[3]=e[3]!==null?e[3]:this.jointValue[3],this.jointValue[4]=e[4]!==null?e[4]:this.jointValue[4],this.jointValue[5]=e[5]!==null?e[5]:this.jointValue[5],Ei.compose(this.origPosition,this.origQuaternion,ea),Qs.setFromEuler(dy.set(this.jointValue[3],this.jointValue[4],this.jointValue[5],"XYZ")),ta.set(this.jointValue[0],this.jointValue[1],this.jointValue[2]),Zs.compose(ta,Qs,ea),Ei.premultiply(Zs),this.position.setFromMatrixPosition(Ei),this.rotation.setFromRotationMatrix(Ei),this.matrixWorldNeedsUpdate=!0,!0);case"planar":return this.jointValue.every((n,i)=>e[i]===n||e[i]===null)?t:(this.jointValue[0]=e[0]!==null?e[0]:this.jointValue[0],this.jointValue[1]=e[1]!==null?e[1]:this.jointValue[1],this.jointValue[2]=e[2]!==null?e[2]:this.jointValue[2],Ei.compose(this.origPosition,this.origQuaternion,ea),Qs.setFromAxisAngle(this.axis,this.jointValue[2]),ta.set(this.jointValue[0],this.jointValue[1],0),Zs.compose(ta,Qs,ea),Ei.premultiply(Zs),this.position.setFromMatrixPosition(Ei),this.rotation.setFromRotationMatrix(Ei),this.matrixWorldNeedsUpdate=!0,!0)}return t}}class Vu extends Bh{constructor(...e){super(...e),this.type="URDFMimicJoint",this.mimicJoint=null,this.offset=0,this.multiplier=1}updateFromMimickedJoint(...e){const t=e.map(n=>n*this.multiplier+this.offset);return super.setJointValue(...t)}copy(e,t){return super.copy(e,t),this.mimicJoint=e.mimicJoint,this.offset=e.offset,this.multiplier=e.multiplier,this}}class my extends Oh{constructor(...e){super(...e),this.isURDFRobot=!0,this.urdfNode=null,this.urdfRobotNode=null,this.robotName=null,this.links=null,this.joints=null,this.colliders=null,this.visual=null,this.frames=null}copy(e,t){super.copy(e,t),this.urdfRobotNode=e.urdfRobotNode,this.robotName=e.robotName,this.links={},this.joints={},this.colliders={},this.visual={},this.traverse(n=>{n.isURDFJoint&&n.urdfName in e.joints&&(this.joints[n.urdfName]=n),n.isURDFLink&&n.urdfName in e.links&&(this.links[n.urdfName]=n),n.isURDFCollider&&n.urdfName in e.colliders&&(this.colliders[n.urdfName]=n),n.isURDFVisual&&n.urdfName in e.visual&&(this.visual[n.urdfName]=n)});for(const n in this.joints)this.joints[n].mimicJoints=this.joints[n].mimicJoints.map(i=>this.joints[i.name]);return this.frames={...this.colliders,...this.visual,...this.links,...this.joints},this}getFrame(e){return this.frames[e]}setJointValue(e,...t){const n=this.joints[e];return n?n.setJointValue(...t):!1}setJointValues(e){let t=!1;for(const n in e){const i=e[n];Array.isArray(i)?t=this.setJointValue(n,...i)||t:t=this.setJointValue(n,i)||t}return t}}const yo=new Cn,Hu=new bn;function br(r){return r?r.trim().split(/\s+/g).map(e=>parseFloat(e)):[0,0,0]}function Gu(r,e,t=!1){t||r.rotation.set(0,0,0),Hu.set(e[0],e[1],e[2],"ZYX"),yo.setFromEuler(Hu),yo.multiply(r.quaternion),r.quaternion.copy(yo)}class gy{constructor(e){this.manager=e||Bl,this.loadMeshCb=this.defaultMeshLoader.bind(this),this.parseVisual=!0,this.parseCollision=!1,this.packages="",this.workingPath="",this.fetchOptions={}}loadAsync(e){return new Promise((t,n)=>{this.load(e,t,null,n)})}load(e,t,n,i){const s=this.manager,a=Vl.extractUrlBase(e),o=this.manager.resolveURL(e);s.itemStart(o),fetch(o,this.fetchOptions).then(l=>{if(l.ok)return n&&n(null),l.text();throw new Error(`URDFLoader: Failed to load url '${o}' with error code ${l.status} : ${l.statusText}.`)}).then(l=>{const c=this.parse(l,this.workingPath||a);t(c),s.itemEnd(o)}).catch(l=>{i?i(l):console.error("URDFLoader: Error loading file.",l),s.itemError(o),s.itemEnd(o)})}parse(e,t=this.workingPath){const n=this.packages,i=this.loadMeshCb,s=this.parseVisual,a=this.parseCollision,o=this.manager,l={},c={},u={};function h(M){if(!/^package:\/\//.test(M))return t?t+M:M;const[E,y]=M.replace(/^package:\/\//,"").split(/\/(.+)/);if(typeof n=="string")return n.endsWith(E)?n+"/"+y:n+"/"+E+"/"+y;if(n instanceof Function)return n(E)+"/"+y;if(typeof n=="object")return E in n?n[E]+"/"+y:(console.error(`URDFLoader : ${E} not found in provided package list.`),null)}function d(M){let E;M instanceof Document?E=[...M.children]:M instanceof Element?E=[M]:E=[...new DOMParser().parseFromString(M,"text/xml").children];const y=E.filter(I=>I.nodeName==="robot").pop();return f(y)}function f(M){const E=[...M.children],y=E.filter(w=>w.nodeName.toLowerCase()==="link"),I=E.filter(w=>w.nodeName.toLowerCase()==="joint"),R=E.filter(w=>w.nodeName.toLowerCase()==="material"),C=new my;C.robotName=M.getAttribute("name"),C.urdfRobotNode=M,R.forEach(w=>{const B=w.getAttribute("name");u[B]=g(w)});const L={},b={};y.forEach(w=>{const B=w.getAttribute("name"),z=M.querySelector(`child[link="${B}"]`)===null;l[B]=_(w,L,b,z?C:null)}),I.forEach(w=>{const B=w.getAttribute("name");c[B]=m(w)}),C.joints=c,C.links=l,C.colliders=b,C.visual=L;const x=Object.values(c);return x.forEach(w=>{w instanceof Vu&&c[w.mimicJoint].mimicJoints.push(w)}),x.forEach(w=>{const B=new Set,z=X=>{if(B.has(X))throw new Error("URDFLoader: Detected an infinite loop of mimic joints.");B.add(X),X.mimicJoints.forEach(j=>{z(j)})};z(w)}),C.frames={...b,...L,...l,...c},C}function m(M){const E=[...M.children],y=M.getAttribute("type");let I;const R=E.find(B=>B.nodeName.toLowerCase()==="mimic");R?(I=new Vu,I.mimicJoint=R.getAttribute("joint"),I.multiplier=parseFloat(R.getAttribute("multiplier")||1),I.offset=parseFloat(R.getAttribute("offset")||0)):I=new Bh,I.urdfNode=M,I.name=M.getAttribute("name"),I.urdfName=I.name,I.jointType=y;let C=null,L=null,b=[0,0,0],x=[0,0,0];E.forEach(B=>{const z=B.nodeName.toLowerCase();z==="origin"?(b=br(B.getAttribute("xyz")),x=br(B.getAttribute("rpy"))):z==="child"?L=l[B.getAttribute("link")]:z==="parent"?C=l[B.getAttribute("link")]:z==="limit"&&(I.limit.lower=parseFloat(B.getAttribute("lower")||I.limit.lower),I.limit.upper=parseFloat(B.getAttribute("upper")||I.limit.upper))}),C.add(I),I.add(L),Gu(I,x),I.position.set(b[0],b[1],b[2]);const w=E.filter(B=>B.nodeName.toLowerCase()==="axis")[0];if(w){const B=w.getAttribute("xyz").split(/\s+/g).map(z=>parseFloat(z));I.axis=new k(B[0],B[1],B[2]),I.axis.normalize()}return I}function _(M,E,y,I=null){I===null&&(I=new Oh);const R=[...M.children];return I.name=M.getAttribute("name"),I.urdfName=I.name,I.urdfNode=M,s&&R.filter(L=>L.nodeName.toLowerCase()==="visual").forEach(L=>{const b=p(L,u);if(I.add(b),L.hasAttribute("name")){const x=L.getAttribute("name");b.name=x,b.urdfName=x,E[x]=b}}),a&&R.filter(L=>L.nodeName.toLowerCase()==="collision").forEach(L=>{const b=p(L);if(I.add(b),L.hasAttribute("name")){const x=L.getAttribute("name");b.name=x,b.urdfName=x,y[x]=b}}),I}function g(M){const E=[...M.children],y=new Sn;return y.name=M.getAttribute("name")||"",E.forEach(I=>{const R=I.nodeName.toLowerCase();if(R==="color"){const C=I.getAttribute("rgba").split(/\s/g).map(L=>parseFloat(L));y.color.setRGB(C[0],C[1],C[2]),y.opacity=C[3],y.transparent=C[3]<1,y.depthWrite=!y.transparent}else if(R==="texture"){const C=I.getAttribute("filename");if(C){const L=new kl(o),b=h(C);y.map=L.load(b),y.map.colorSpace=At}}}),y}function p(M,E={}){const y=M.nodeName.toLowerCase()==="collision",I=[...M.children];let R=null;const C=I.filter(b=>b.nodeName.toLowerCase()==="material")[0];if(C){const b=C.getAttribute("name");b&&b in E?R=E[b]:R=g(C)}else R=new Sn;const L=y?new fy:new py;return L.urdfNode=M,I.forEach(b=>{const x=b.nodeName.toLowerCase();if(x==="geometry"){const w=b.children[0].nodeName.toLowerCase();if(w==="mesh"){const B=b.children[0].getAttribute("filename"),z=h(B);if(z!==null){const X=b.children[0].getAttribute("scale");if(X){const j=br(X);L.scale.set(j[0],j[1],j[2])}i(z,o,(j,O)=>{O?console.error("URDFLoader: Error loading mesh.",O):j&&(j instanceof Ut&&(j.material=R),j.position.set(0,0,0),j.quaternion.identity(),L.add(j))})}}else if(w==="box"){const B=new Ut;B.geometry=new Br(1,1,1),B.material=R;const z=br(b.children[0].getAttribute("size"));B.scale.set(z[0],z[1],z[2]),L.add(B)}else if(w==="sphere"){const B=new Ut;B.geometry=new ba(1,30,30),B.material=R;const z=parseFloat(b.children[0].getAttribute("radius"))||0;B.scale.set(z,z,z),L.add(B)}else if(w==="cylinder"){const B=new Ut;B.geometry=new Ol(1,1,1,30),B.material=R;const z=parseFloat(b.children[0].getAttribute("radius"))||0,X=parseFloat(b.children[0].getAttribute("length"))||0;B.scale.set(z,X,z),B.rotation.set(Math.PI/2,0,0),L.add(B)}}else if(x==="origin"){const w=br(b.getAttribute("xyz")),B=br(b.getAttribute("rpy"));L.position.set(w[0],w[1],w[2]),L.rotation.set(0,0,0),Gu(L,B)}}),L}return d(e)}defaultMeshLoader(e,t,n){/\.stl$/i.test(e)?new ua(t).load(e,s=>{const a=new Ut(s,new Sn);n(a)}):/\.dae$/i.test(e)?new hy(t).load(e,s=>n(s.scene)):console.warn(`URDFLoader: Could not load model at ${e}.
|
|
4207
|
-
No loader available`)}}const _y=yl(Tr.pinia),{systemPath:Er}=bt.storeToRefs(_y),xo=re.ref();function vy(r,e,t,n,i){const s=async d=>{try{const f=await Yh.downloadAvatarApi({url:d});if(f.status!==200)throw new Error(`下载失败: ${f.status}`);return f.data}catch(f){throw console.error("addModelFromUrl失败:",f),f}},a=d=>new Promise((f,m)=>{const _=new FileReader;_.onload=g=>{try{const p=g.target.result,E=new vo().parse(p);E.preload(),f(E)}catch(p){m(p)}},_.onerror=()=>{m(new Error("MTL文件读取失败"))},_.readAsText(d)}),o=async d=>{const f={materials:{},create:function(m){return this.materials[m]?this.materials[m]:(console.warn(`Material '${m}' not found, using default material`),new Sn({color:8947848,side:hn}))},getAsArray:function(){const m=[];for(const _ in this.materials)m.push(this.materials[_]);return m},preload:function(){for(const m in this.materials)this.materials[m].map&&(this.materials[m].map.needsUpdate=!0)}};for(const m of d){const _=await a(m);Object.assign(f.materials,_.materials)}return f.preload(),f},l=async(d,f=[])=>new Promise((m,_)=>{const g=new FileReader;g.onload=async p=>{try{const M=p.target.result;let E=null;f&&f.length>0&&(f.length===1?E=await a(f[0]):E=await o(f));const y=new _o;E&&y.setMaterials(E);const I=y.parse(M);E||I.traverse(R=>{R.isMesh&&(R.material=new Sn({color:8947848,side:hn}))}),m(I)}catch(M){_(M)}},g.onerror=()=>{_(new Error("OBJ文件读取失败"))},g.readAsText(d)}),c=async d=>{var f;try{t.value=!0;const{scene:m}=r();if(!m)throw new Error("Scene not initialized");i();const _=[];for(let g=0;g<d.length;g++){const p=d[g];n.value=`正在加载模型 ${g+1}/${d.length}...`;const M=await s(p.objUrl),E=((f=p.objUrl)==null?void 0:f.split("/").pop())||`model_${g}.obj`,y=new File([M],E,{type:M.type});let I=[];if(p.mtlUrls){const C=Array.isArray(p.mtlUrls)?p.mtlUrls:[p.mtlUrls];for(let L=0;L<C.length;L++){const b=C[L],x=await s(b),w=(b==null?void 0:b.split("/").pop())||`material_${g}_${L}.mtl`,B=new File([x],w,{type:x.type});I.push(B)}}const R=await l(y,I);m.add(R),e.value.push(R),_.push(R)}return t.value=!1,_}catch(m){throw console.error("加载模型失败:",m),t.value=!1,m}},u=async(d,f,m=[],_=[])=>{let g;const p=d.toLowerCase();switch(p){case".txt":case".cpt":case".obj":const M=await f.text();if(p===".txt"||p===".cpt"){const O=/^(?!.*\bf\b)[^\n]*?(-?\d*\.?\d+)[^\n]*?(-?\d*\.?\d+)[^\n]*?(-?\d*\.?\d+)[^\n]*?$/gm,H=[...M.matchAll(O)].map($=>({x:parseFloat($[1]),y:parseFloat($[2]),z:parseFloat($[3])})),ie=new Vt,oe=H.flatMap($=>[$.x,$.y,$.z]);if(ie.setAttribute("position",new xt(oe,3)),p===".txt"){const $=new qi({color:"#5B5C99",size:1,sizeAttenuation:!1});g=new is(ie,$)}else if(p===".cpt"){const $=new ji({color:"#5B5C99",linewidth:100});g=new Fl(ie,$)}}else if(p===".obj"){const O=new _o;if(m&&m.length>0){const K=new vo;for(const H of m){const ie=await H.text(),oe=K.parse(ie);oe.preload(),O.setMaterials(oe);break}}g=O.parse(M),(!m||m.length===0)&&g.traverse(K=>{K.isMesh&&(K.material=new Sn({color:"#B3B3D4"})),K instanceof Ut&&(K.material.side=hn)})}break;case".stl":const E=await f.arrayBuffer(),I=new ua().parse(E),R=new Sn({color:"#B3B3D4",side:hn});g=new Ut(I,R);break;case".nc":const C=["Mach_B_Axis_0.STL","Mach_C_Axis_0.STL","Mach_X_Axis_0.STL","Mach_Y_Axis_0.STL","Mach_Z_Axis_0.STL","Mach_Spindle_0.STL"],L={"Mach_Y_Axis_0.STL":"rgb(128,118,152)","Mach_B_Axis_0.STL":"rgb(204,143,89)","Mach_C_Axis_0.STL":"rgb(145,245,251)","Mach_X_Axis_0.STL":"rgb(125,158,192)","Mach_Z_Axis_0.STL":"rgb(248,228,118)","Mach_Spindle_0.STL":"rgb(145,145,145)"},b=new fi,x=C.map(O=>new Promise((K,H)=>{new ua().load(Er.value===""?`/model/${O}`:`${Er.value}\\${O}`,oe=>{const $=new Sn({color:L[O]||"#B3B3D4",side:hn}),xe=new Ut(oe,$);K(xe)},void 0,H)}));try{(await Promise.all(x)).forEach(K=>b.add(K)),g=b}catch(O){throw console.error("加载NC文件对应的STL文件失败:",O),new Error("无法加载.NC文件对应的STL文件")}break;case".pcd":const w=new uy,B=new fi;try{const O=await new Promise((H,ie)=>{w.load(Er.value===""?"/model/final.pcd":`${Er.value}\\final.pcd`,oe=>{const $=new Float32Array(oe.geometry.attributes.position.count*3);for(let xe=0;xe<oe.geometry.attributes.position.count;xe++)$[xe*3]=1,$[xe*3+1]=0,$[xe*3+2]=0;oe.geometry.setAttribute("color",new Xt($,3)),oe.material.vertexColors=!0,oe.scale.set(.3,.3,.3),H(oe)},void 0,ie)}),K=await new Promise((H,ie)=>{w.load(Er.value===""?"/model/target.pcd":`${Er.value}\\target.pcd`,oe=>{const $=new Float32Array(oe.geometry.attributes.position.count*3);for(let xe=0;xe<oe.geometry.attributes.position.count;xe++)$[xe*3]=0,$[xe*3+1]=1,$[xe*3+2]=0;oe.geometry.setAttribute("color",new Xt($,3)),oe.material.vertexColors=!0,oe.scale.set(.3,.3,.3),H(oe)},void 0,ie)});B.add(O),B.add(K),g=B}catch(O){throw console.error("PCD文件加载失败:",O),new Error("无法加载PCD文件")}break;case".urdf":const z=URL.createObjectURL(f),X=new gy,j=new Map;_.forEach(O=>{j.set(O.name,O.blob)}),X.loadMeshCb=async(O,K,H,ie,oe)=>{const $=O.split("/").pop();let xe=await bt.axios.get(`http://139.196.154.85:20026/chfs/shared/机器人/urdf/SmallBender_R-2000iC-165F/meshes/${$}`,{responseType:"blob",headers:{"Content-Type":"application/json"}});const q=new Blob([xe.data],{type:"application/octet-stream;charset=UTF-8"});if(!q){oe(new Error(`找不到文件: ${$}`));return}const te=$.split(".").pop().toLowerCase();switch(te){case"stl":const se=await q.arrayBuffer(),be=new ua(K).parse(se),st=new Ut(be,new Sn);H(st);break;case"obj":const Ke=await q.text(),Ct=new _o(K),ae=$.replace(".obj",".mtl");let _e=await bt.axios.get(`http://139.196.154.85:20026/chfs/shared/机器人/urdf/SmallBender_R-2000iC-165F/meshes/${ae}`,{responseType:"blob",headers:{"Content-Type":"application/json"}}),N=new Blob([_e.data],{type:"application/octet-stream;charset=UTF-8"});if(N){const Me=await N.text(),Q=new vo(K).parse(Me);Q.preload(),Ct.setMaterials(Q)}const We=Ct.parse(Ke);H(We);break;default:oe(new Error(`不支持的文件格式: ${te}`))}},z?(g=await X.loadAsync(z),xo.value=g):xo.value=void 0;break;default:throw new Error(`不支持的文件格式: ${d}`)}return g};return{addModelsFromUrls:c,loadModelByDefaultPath:async d=>{console.log(d);try{t.value=!0,n.value="正在加载模型...";const{scene:f}=r();if(!f)throw new Error("Scene not initialized");i(),await new Promise(_=>setTimeout(_,100));const m=[];for(let _=0;_<d.length;_++){const g=d[_],p=await u(g.suffix,g.blob,g.mtlBlobs||[],g.meshFiles||[]);f.add(p),e.value.push(p),m.push(p)}return t.value=!1,n.value="",m}catch(f){throw console.error("加载模型失败:",f),t.value=!1,n.value="",f}},urdfModel:xo}}const kh=bt.defineStore("formToTableComp",{state:()=>({selectArray:[],selectString:""}),actions:{setSelectArray(r){this.selectArray=r},setSelectString(r){this.selectString=r}}}),yy={class:"calculator-content"},xy={class:"calculator-child"},Sy={class:"calculator-child"},My=re.defineComponent({__name:"calculator",setup(r){const e=re.ref(),t=re.ref();return re.onMounted(()=>{e.value=[{type:"Upload",label:"输入",name:"input"}],t.value=[{type:"Upload",label:"输出",name:"output"}]}),(n,i)=>(re.openBlock(),re.createElementBlock("div",yy,[re.createElementVNode("div",xy,[re.createVNode(xn.ssForm,{rowContents:e.value,isRowFlex:!0},null,8,["rowContents"])]),re.createElementVNode("div",Sy,[re.createVNode(xn.ssForm,{rowContents:t.value,isEdit:!1,isRowFlex:!0},null,8,["rowContents"])])]))}}),by=vl._export_sfc(My,[["__scopeId","data-v-73db0fe7"]]),zh=bt.defineStore("unit",{state:()=>({selectIndex:"",selectMenu:"",selectTitle:[]}),actions:{setSelectIndex(r){this.selectIndex=r},setSelectMenu(r){this.selectMenu=r},setSelectTitle(r){this.selectTitle=r}}}),Vh=(r,e)=>{let t=r,n=e;return Array.isArray(t)&&(t=t==null?void 0:t.map((i,s)=>{if(Array.isArray(i)){let a={};return i=i==null?void 0:i.forEach((o,l)=>{var c;(c=n==null?void 0:n[l])!=null&&c.prop?a[n[l].prop]=o:Array.isArray(o)&&(a.children=Vh(o,n))}),Object.assign(a,{id:s})}else return i})),t},Hh=(r,e,t)=>{let n=r,i=e;return n=n==null?void 0:n.map((s,a)=>{var o,l;return!Array.isArray(s)||!((o=i==null?void 0:i[a])!=null&&o.label)&&!t||(s.unshift(((l=i==null?void 0:i[a])==null?void 0:l.label)??""),s.some(c=>Array.isArray(c))&&(s=s==null?void 0:s.map(c=>{var u;return Array.isArray(c)&&(c=Hh(c,(u=i==null?void 0:i[a])==null?void 0:u.children,t)),c}))),s}),n},Ey=(r,e,t)=>{if(e==="")return r==null?void 0:r.filter(n=>(n==null?void 0:n.id)!==t);{const n=e.split("-");return Ty(r,n,t)}},Ty=(r,e,t)=>{let n=r,i=e;return(i==null?void 0:i.length)===0?n=n==null?void 0:n.filter(s=>s.id!==t):n=n==null?void 0:n.map(s=>(s.id.toString()===(i==null?void 0:i[0])&&(i==null||i.shift(),s=Gh(s,i,t)),s)),n},Gh=(r,e,t)=>{var s,a;let n=r,i=e;return(i==null?void 0:i.length)===0?n.children=(s=n.children)==null?void 0:s.filter(o=>o.id!==t):n.children=(a=n.children)==null?void 0:a.map(o=>(o.id.toString()===(i==null?void 0:i[0])&&(i==null||i.shift(),o=Gh(o,i,t)),o)),n},wy=(r,e,t)=>{if(e==="")return t;{const n=e.split("-");return Ay(r,n,t)}},Ay=(r,e,t)=>{let n=r,i=e;return(i==null?void 0:i.length)===0?n=t:n=n==null?void 0:n.map(s=>(s.id.toString()===(i==null?void 0:i[0])&&(i==null||i.shift(),s=Wh(s,i,t)),s)),n},Wh=(r,e,t)=>{var s;let n=r,i=e;return(i==null?void 0:i.length)===0?n.children=t:n.children=(s=n.children)==null?void 0:s.map(a=>(a.id.toString()===(i==null?void 0:i[0])&&(i==null||i.shift(),a=Wh(a,i,t)),a)),n},ql=(r,e)=>r==null?void 0:r.map(n=>{var i,s,a,o,l,c;if(Array.isArray(n)?n=n:n=[n],(i=n==null?void 0:n.filter(u=>!(u!=null&&u.id)))!=null&&i.every(u=>typeof u!="object"||u===null))return n;if((s=n==null?void 0:n.filter(u=>!(u!=null&&u.id)))!=null&&s.some(u=>Array.isArray(u)))return n;{let u=[];if(u.push(n==null?void 0:n.find(h=>h==null?void 0:h.id)),Array.isArray(e==null?void 0:e[0])){const h=(a=n==null?void 0:n.filter(d=>!(d!=null&&d.id)))==null?void 0:a[0];(o=xn.getColumnChild(Le.cloneDeep(e==null?void 0:e[0])))==null||o.forEach(d=>{u.push(h==null?void 0:h[(d==null?void 0:d.prop)??(d==null?void 0:d.label)??d])})}else{const h=(l=n==null?void 0:n.filter(d=>!(d!=null&&d.id)))==null?void 0:l[0];(c=xn.getColumnChild(Le.cloneDeep(e)))==null||c.forEach(d=>{u.push(h==null?void 0:h[(d==null?void 0:d.prop)??(d==null?void 0:d.label)??d])})}return u}}),Ry=r=>{try{return JSON.parse(r),!0}catch{return!1}},Wu=(r,e)=>Td(r,e),Ki=r=>{let e=[];function t(i){Array.isArray(i)&&(i==null||i.forEach(s=>{Array.isArray(s)||(s=[s]),s==null||s.forEach(a=>{!(a!=null&&a.children)||a.children.length===0?e.push(a.label):n(a.children)})}))}function n(i){i==null||i.forEach(s=>{!(s!=null&&s.children)||s.children.length===0?e.push(s.label):n(s.children)})}return t(r),e},Cy=(r,e,t)=>{var i;let n=(i=Le.cloneDeep(r))==null?void 0:i.map(s=>(s=s.filter(a=>!(a!=null&&a.id)),s));return n=n==null?void 0:n.map(s=>{var a;return s=(a=s.map((o,l)=>{let c={};if(t!=null&&t.find(u=>u===e[l]))return c[e[l]]=o,c}))==null?void 0:a.filter(o=>o),s}),n},Py=(r,e)=>{var a,o;const t=Le.cloneDeep(r),n=(a=t==null?void 0:t.find(l=>(l==null?void 0:l.key)==="header"))==null?void 0:a.contents,i=(o=t==null?void 0:t.find(l=>(l==null?void 0:l.key)==="tableContents"))==null?void 0:o.contents;return Cy(i,Ki(n).slice(0,Ki(n).length-1),e)},un=r=>{var i,s,a,o;const e=r;let t=[];e.compData=(i=e.compData)==null?void 0:i.filter(l=>(l==null?void 0:l.key)!=="tableContents"&&(l==null?void 0:l.key)!=="tableIndex");const n=(a=(s=Le.cloneDeep(e.compData))==null?void 0:s.find(l=>(l==null?void 0:l.key)==="tableIndexColumn"))==null?void 0:a.contents;return(o=Le.cloneDeep(e.compData))==null||o.forEach(l=>{if((l==null?void 0:l.key)!=="tableIndexColumn"&&(l==null?void 0:l.key)!=="header")t.push(l);else if((l==null?void 0:l.key)==="header"){let c=l.contents;n&&(c!=null&&c.every(u=>Array.isArray(u))?c==null||c[0].unshift({label:n}):c.unshift({label:n})),t.push({key:"header",contents:c})}}),e.compData=t,e},ha=r=>{var s,a,o,l,c;const e=(s=r.compData)==null?void 0:s.filter(u=>(u==null?void 0:u.key)==="tableContents"||(u==null?void 0:u.key)==="tableIndex"),t=(o=(a=e==null?void 0:e.find(u=>(u==null?void 0:u.key)==="tableIndex"))==null?void 0:a.contents)==null?void 0:o.map(u=>u.label),n=(l=e==null?void 0:e.find(u=>(u==null?void 0:u.key)==="tableContents"))==null?void 0:l.contents;let i=[];return(t==null?void 0:t.length)>0&&(n!=null&&n.every(u=>Array.isArray(u)))?i=t==null?void 0:t.map((u,h)=>n[h]?[u,...n[h]]:[u]):Array.isArray(n==null?void 0:n[0])&&((c=n==null?void 0:n[0])!=null&&c.every(u=>Array.isArray(u)))?i=n==null?void 0:n[0]:Array.isArray(n==null?void 0:n[0])?i=n:i.push(n),i},Dy=r=>{const e=[];function t(n){!n||n.length===0||(e.push(n==null?void 0:n.map(i=>({label:i.label}))),n==null||n.forEach(i=>{i!=null&&i.children&&(i==null?void 0:i.children.length)>0&&t(i==null?void 0:i.children)}))}return t(r),e},Ly=r=>{const e=[];function t(n,i=[]){!n||n.length===0||(e.push({key:i==null?void 0:i.filter(s=>!Array.isArray(s)),value:n}),n==null||n.forEach(s=>{s!=null&&s.some(a=>Array.isArray(a))&&t(s.find(a=>Array.isArray(a)),s)}))}return t(r),e},Uy=r=>{const e=[];function t(n){!n||n.length===0||(e.push(n==null?void 0:n.map(i=>i==null?void 0:i.filter(s=>!Array.isArray(s)))),n==null||n.forEach(i=>{i!=null&&i.some(s=>Array.isArray(s))&&t(i.find(s=>Array.isArray(s)))}))}return t(r),e},Iy=r=>{const e=[];function t(n){var i;!n||n.length===0||(n!=null&&n.every(s=>!Array.isArray(s))?e.push(n):(e.push((i=n==null?void 0:n.map(s=>s==null?void 0:s.filter(a=>!Array.isArray(a))))==null?void 0:i[0]),n==null||n.forEach(s=>{s!=null&&s.some(a=>Array.isArray(a))&&t(s.find(a=>Array.isArray(a)))})))}return t(r),e},Ny=(r,e)=>{let t;function n(i,s,a=1){var l;if(!i||i.length===0)return;const o=(l=Le.cloneDeep(s))==null?void 0:l.map(c=>c==null?void 0:c.filter(u=>!Array.isArray(u)));return o!=null&&o.find(c=>Wu(c,i==null?void 0:i.key))?(s==null||s.forEach(c=>{!n(i,c.find(h=>Array.isArray(h)))&&Wu(c.filter(h=>!Array.isArray(h)),i==null?void 0:i.key)&&(t={type:a,contents:c.filter(h=>!Array.isArray(h))})}),!0):!1}return n(r,e,0),t},Xu=(r,e)=>{function t(n,i){return!n||n.length===0||n==null?void 0:n.map((a,o)=>{var c,u;let l=a;return l.unshift((c=i==null?void 0:i[o])==null?void 0:c.label),l.some(h=>Array.isArray(h))&&(l[l.length-1]=t(l.find(h=>Array.isArray(h)),(u=i==null?void 0:i[o])==null?void 0:u.children)),l})}return t(r,e)},es=r=>{var t,n,i,s,a,o,l,c,u,h,d,f,m,_,g,p,M,E,y,I,R,C,L,b,x;const e=r;if((r==null?void 0:r.comp)==="Table"){if((i=(n=(t=r.compData)==null?void 0:t.find(w=>(w==null?void 0:w.key)==="tableIndex"))==null?void 0:n.contents)!=null&&i.every(w=>!(w!=null&&w.children))||!((s=r.compData)!=null&&s.find(w=>(w==null?void 0:w.key)==="tableIndex")))return((l=(o=(a=e.compData)==null?void 0:a.find(w=>(w==null?void 0:w.key)==="tableContents"))==null?void 0:o.contents)==null?void 0:l.length)===1&&((d=(h=(u=(c=e.compData)==null?void 0:c.find(w=>(w==null?void 0:w.key)==="tableContents"))==null?void 0:u.contents)==null?void 0:h[0])!=null&&d.every(w=>Array.isArray(w)))?(e.compData=(f=e.compData)==null?void 0:f.map(w=>{var B;return(w==null?void 0:w.key)==="tableContents"&&(w.contents=(B=w.contents)==null?void 0:B[0]),w}),[e]):[e];{let w=[];const B=e.compData,z=(m=Le.cloneDeep(B))==null?void 0:m.find($=>($==null?void 0:$.key)==="tableIndexColumn"),X=(_=Le.cloneDeep(B))==null?void 0:_.find($=>($==null?void 0:$.key)==="extraButton"),j=(g=Le.cloneDeep(B))==null?void 0:g.find($=>($==null?void 0:$.key)==="rowButton"),O=Iy((M=(p=Le.cloneDeep(B))==null?void 0:p.find($=>($==null?void 0:$.key)==="header"))==null?void 0:M.contents),K=(E=Le.cloneDeep(B))==null?void 0:E.find($=>($==null?void 0:$.key)==="tableIndex"),H=Uy((I=(y=Le.cloneDeep(B))==null?void 0:y.find($=>($==null?void 0:$.key)==="tableContents"))==null?void 0:I.contents),ie=Xu((C=(R=Le.cloneDeep(B))==null?void 0:R.find($=>($==null?void 0:$.key)==="tableContents"))==null?void 0:C.contents,K==null?void 0:K.contents),oe=Ly(Xu((b=(L=Le.cloneDeep(B))==null?void 0:L.find($=>($==null?void 0:$.key)==="tableContents"))==null?void 0:b.contents,K==null?void 0:K.contents));if(K)return(x=Dy(K.contents))==null||x.forEach(($,xe)=>{var q;let Ee=[];Ee.push({key:"tableIndex",contents:$}),Ee.push(z),Ee.push(X),Ee.push(j),Ee.push({key:"tableContents",contents:H[xe]}),Ee.push({key:"header",contents:O!=null&&O[xe]?[O==null?void 0:O[xe]]:[O==null?void 0:O[0]]}),w.push({comp:"Table",compData:Ee,name:"",parentTableContents:((q=Ny(oe[xe],ie))==null?void 0:q.contents)??""})}),w}}else return[e]},rs=(r,e)=>{let t={};return Array.isArray(r)?r==null||r.forEach((n,i)=>{t[e[i]]=n}):[r].forEach((n,i)=>{t[e[i]]=n}),t},Fy=async r=>{let e=[];r==null||r.forEach(t=>{var n;(n=t.compData)==null||n.forEach(async i=>{var a,o;const s=(a=Le.cloneDeep(i==null?void 0:i.contents))==null?void 0:a.map(l=>{var c,u,h,d;if(Array.isArray(l)){let f=(c=l==null?void 0:l.map)==null?void 0:c.call(l,m=>{var g;return(g=es(Le.cloneDeep(m)))==null?void 0:g.map(p=>{var M,E,y,I;if(m.comp==="Table")return{key:{systemKey:sessionStorage.getItem("systemKey"),pageKey:t.name,type:"structure",version:1,parentTable:(p==null?void 0:p.parentTableContents)??""},value:{pageData:{comp:(M=un(Le.cloneDeep(p)))==null?void 0:M.comp,compData:(E=un(Le.cloneDeep(p)))==null?void 0:E.compData,name:(y=un(Le.cloneDeep(p)))==null?void 0:y.name}}};if((p==null?void 0:p.key)==="extraButton"){if(((I=Object.values(p==null?void 0:p.value))==null?void 0:I.length)!==0)return{key:{systemKey:sessionStorage.getItem("systemKey"),pageKey:t.name,type:"structureMethod",version:1},value:{pageData:p.value}}}else return{key:{systemKey:sessionStorage.getItem("systemKey"),pageKey:t.name,type:"structure",version:1,parentTable:(p==null?void 0:p.parentTableContents)??""},value:{pageData:p}}})});return f=(u=f==null?void 0:f.map(m=>m!=null&&m.every(_=>_)?m:[]))==null?void 0:u.filter(m=>m.length>0),(h=f==null?void 0:f[0])==null?void 0:h[0]}else{const f=(d=es(Le.cloneDeep(l)))==null?void 0:d.map(m=>{var _,g,p,M;if(l.comp==="Table")return{key:{systemKey:sessionStorage.getItem("systemKey"),pageKey:t.name,type:"structure",version:1,parentTable:(m==null?void 0:m.parentTableContents)??""},value:{pageData:{comp:(_=un(Le.cloneDeep(m)))==null?void 0:_.comp,compData:(g=un(Le.cloneDeep(m)))==null?void 0:g.compData,name:(p=un(Le.cloneDeep(m)))==null?void 0:p.name}}};if((m==null?void 0:m.key)==="extraButton"){if(((M=Object.values(m==null?void 0:m.value))==null?void 0:M.length)!==0)return{key:{systemKey:sessionStorage.getItem("systemKey"),pageKey:t.name,type:"structureMethod",version:1},value:{pageData:m.value}}}else return{key:{systemKey:sessionStorage.getItem("systemKey"),pageKey:t.name,type:"structure",version:1,parentTable:(m==null?void 0:m.parentTableContents)??""},value:{pageData:m}}});return f==null?void 0:f[0]}});if((s==null?void 0:s.length)>0){const l=await bt.batchAddInsofDataApi({dataList:s});e.push(l)}(o=i.contents)==null||o.forEach(async l=>{var c;Array.isArray(l)?l==null||l.forEach(async u=>{var h;(h=es(Le.cloneDeep(u)))==null||h.forEach(async d=>{var f,m,_,g,p,M;if(u.comp==="Table"){const y=(p=(g=(await bt.getInsofDataApi({key:{systemKey:sessionStorage.getItem("systemKey"),pageKey:t.name,type:"structure",version:1,parentTable:(d==null?void 0:d.parentTableContents)??""},value:{pageData:{comp:(f=un(Le.cloneDeep(d)))==null?void 0:f.comp,compData:(m=un(Le.cloneDeep(d)))==null?void 0:m.compData,name:(_=un(Le.cloneDeep(d)))==null?void 0:_.name}}})).data.result)==null?void 0:g[0])==null?void 0:p.id,I=await((M=ha(Le.cloneDeep(d)))==null?void 0:M.map(async R=>{var x,w,B,z,X;let C;R.length!==0&&(C=await bt.createInsofDataApi({key:{systemKey:sessionStorage.getItem("systemKey"),pageKey:t.name,type:"data",tableId:y},value:{tableData:rs(R,(z=Ki((B=(w=(x=un(Le.cloneDeep(d)))==null?void 0:x.compData)==null?void 0:w.find(j=>(j==null?void 0:j.key)==="header"))==null?void 0:B.contents))==null?void 0:z.filter(j=>j!=="操作"))}}));const b=await((X=(await bt.getInsofDataApi({key:{systemKey:sessionStorage.getItem("systemKey"),pageKey:t.name,type:"structure",parentTable:R}})).data.result)==null?void 0:X.map(async j=>await bt.updateInsofDataApi({id:j.id,key:{systemKey:j.key.systemKey,pageKey:j.key.pageKey,type:j.key.type,version:j.key.version,parentTable:C.data.result}})));return e.push(b),C}));e.push(I)}})}):(c=es(Le.cloneDeep(l)))==null||c.forEach(async u=>{var h,d,f,m,_,g,p;if(l.comp==="Table"){const E=(_=(m=(await bt.getInsofDataApi({key:{systemKey:sessionStorage.getItem("systemKey"),pageKey:t.name,type:"structure",version:1,parentTable:(u==null?void 0:u.parentTableContents)??""},value:{pageData:{comp:(h=un(Le.cloneDeep(u)))==null?void 0:h.comp,compData:(d=un(Le.cloneDeep(u)))==null?void 0:d.compData,name:(f=un(Le.cloneDeep(u)))==null?void 0:f.name}}})).data.result)==null?void 0:m[0])==null?void 0:_.id,y=(g=ha(Le.cloneDeep(u)))==null?void 0:g.map(C=>{var L,b,x,w;if((C==null?void 0:C.length)!==0)return{key:{systemKey:sessionStorage.getItem("systemKey"),pageKey:t.name,type:"data",tableId:E},value:{tableData:rs(C,(w=Ki((x=(b=(L=un(Le.cloneDeep(u)))==null?void 0:L.compData)==null?void 0:b.find(B=>(B==null?void 0:B.key)==="header"))==null?void 0:x.contents))==null?void 0:w.filter(B=>B!=="操作"))}}}),I=await bt.batchAddInsofDataApi({dataList:y});e.push(I);const R=await((p=ha(Le.cloneDeep(u)))==null?void 0:p.map(async C=>{var w,B,z,X,j;let L;return(C==null?void 0:C.length)!==0&&(L=await bt.getInsofDataApi({key:{systemKey:sessionStorage.getItem("systemKey"),pageKey:t.name,type:"data",tableId:E},value:{tableData:rs(C,(X=Ki((z=(B=(w=un(Le.cloneDeep(u)))==null?void 0:w.compData)==null?void 0:B.find(O=>(O==null?void 0:O.key)==="header"))==null?void 0:z.contents))==null?void 0:X.filter(O=>O!=="操作"))}})),await((j=(await bt.getInsofDataApi({key:{parentTable:C,systemKey:sessionStorage.getItem("systemKey"),pageKey:t.name,type:"structure"}})).data.result)==null?void 0:j.map(async O=>{var H,ie;return await bt.updateInsofDataApi({id:O.id,key:{systemKey:O.key.systemKey,pageKey:O.key.pageKey,type:O.key.type,version:O.key.version,parentTable:O.key.parentTable===""?"":(ie=(H=L.data.result)==null?void 0:H[0])==null?void 0:ie.id}})}))}));e.push(R)}})})})}),await Promise.all(e)},qu=bt.useMenuState(Tr.pinia),Oy=r=>{var t;const e=Array.isArray(r)?r==null?void 0:r[0]:{};return(t=e==null?void 0:e.contents)==null?void 0:t.map(n=>({...n[0],...n[1]}))},By=async r=>{var a,o,l,c,u,h,d,f,m,_,g,p,M,E;const e=(o=(a=r==null?void 0:r.find(y=>(y==null?void 0:y.key)==="header"))==null?void 0:a.contents)==null?void 0:o.find(y=>y==null?void 0:y.columnPath);let t=(c=(l=Le.cloneDeep(e==null?void 0:e.columnPath))==null?void 0:l.split("["))==null?void 0:c[0],n=(m=(f=(d=(h=(u=Le.cloneDeep(e==null?void 0:e.columnPath))==null?void 0:u.split("["))==null?void 0:h[1])==null?void 0:d.split("]"))==null?void 0:f[0])==null?void 0:m.replaceAll("'",""),i=[];const s=await bt.getInsofDataApi({key:{pageKey:t,systemKey:sessionStorage.getItem("systemKey"),type:"structure"}});if(Array.isArray((_=s==null?void 0:s.data)==null?void 0:_.result)&&((p=(g=s==null?void 0:s.data)==null?void 0:g.result)==null?void 0:p.length)>0){const y=await((E=(M=s==null?void 0:s.data)==null?void 0:M.result)==null?void 0:E.map(async I=>{var R,C,L,b,x,w,B,z,X,j;if(((C=(R=I==null?void 0:I.value)==null?void 0:R.pageData)==null?void 0:C.name)===n){i=Le.cloneDeep((b=(L=I==null?void 0:I.value)==null?void 0:L.pageData)==null?void 0:b.compData);const O=await bt.getInsofDataApi({key:{pageKey:t,systemKey:sessionStorage.getItem("systemKey"),tableId:I==null?void 0:I.id,type:"data"}}),K=(w=(x=O==null?void 0:O.data)==null?void 0:x.result)==null?void 0:w.map(H=>{var oe;let ie=[];return ie.push({id:H==null?void 0:H.id}),ie.push((oe=H==null?void 0:H.value)==null?void 0:oe.tableData),ie});i.push({key:"tableContents",contents:ql(K,(j=(X=(z=(B=I==null?void 0:I.value)==null?void 0:B.pageData)==null?void 0:z.compData)==null?void 0:X.find(H=>(H==null?void 0:H.key)==="header"))==null?void 0:j.contents)})}}));await Promise.all(y)}return i},Xh=async(r,e,t="",n)=>{var d,f,m,_,g,p;const i=await bt.getInsofDataApi({key:{pageKey:r,systemKey:e,parentTable:t}}),s=await bt.getInsofDataApi({key:{pageKey:r,systemKey:e,type:"structureMethod"}}),a=(d=i.data.result)==null?void 0:d.map(M=>M.id),o=a==null?void 0:a.map(M=>bt.getInsofDataApi({key:{pageKey:r,systemKey:e,tableId:M}})),l=await Promise.all(o),c=[];l==null||l.forEach(M=>{var I,R,C,L;const E=(I=M.data.result)==null?void 0:I.map(b=>{const x=Array.isArray(b.value.tableData)?b.value.tableData:[b.value.tableData];return x.unshift({id:b.id}),x}),y=(L=(C=(R=M.data.result)==null?void 0:R[0])==null?void 0:C.key)==null?void 0:L.tableId;c.push({key:y,contents:E})});const u=[],h=await((f=i.data.result)==null?void 0:f.map(async M=>{var I,R,C,L,b,x;const E=M.value.pageData;let y=(I=Le.cloneDeep(E.compData))==null?void 0:I.filter(w=>(w==null?void 0:w.key)!=="tableContents");if(y&&(y!=null&&y.find(w=>(w==null?void 0:w.key)==="header"))&&((C=(R=y==null?void 0:y.find(w=>(w==null?void 0:w.key)==="header"))==null?void 0:R.contents)!=null&&C.every(w=>!(w!=null&&w.columnPath)))?y.push({key:"tableContents",contents:n==="/系统管理/用户管理"?Oy(c):ql((L=c==null?void 0:c.find(w=>(w==null?void 0:w.key)===M.id))==null?void 0:L.contents,(b=y==null?void 0:y.find(w=>(w==null?void 0:w.key)==="header"))==null?void 0:b.contents)}):y&&(y!=null&&y.find(w=>(w==null?void 0:w.key)==="header"))&&(y=await By(Le.cloneDeep(y))),E.compData=y,E.id=M.id,((x=M.key)==null?void 0:x.type)!=="method")u.push(E);else{let w;w={name:"",compData:[E],comp:"calculator"},u.push(w)}}));return await Promise.all(h),((_=(m=s.data.result)==null?void 0:m.map(M=>M.value.pageData))==null?void 0:_.filter(M=>Object.values(M).length>0).length)>0&&u.push({comp:"methodButton",name:"",compData:(p=(g=s.data.result)==null?void 0:g.map(M=>M.value.pageData))==null?void 0:p.filter(M=>Object.values(M).length>0)}),u},ky=async r=>{await bt.deleteInsofDataApi({id:r})},zy=async(r,e,t,n,i,s)=>{var a;await bt.createInsofDataApi({key:{type:r,pageKey:e,tableId:t,systemKey:n},value:{tableData:rs(i,(a=Ki(s))==null?void 0:a.filter(o=>o!=="操作"))}})},Vy=async(r,e,t,n,i,s,a)=>{var o;await bt.updateInsofDataApi({key:{type:r,pageKey:e,tableId:t,systemKey:i},value:{tableData:rs(s,(o=Ki(a))==null?void 0:o.filter(l=>l!=="操作"))},id:n})},Hy=async(r,e)=>{await bt.updateInsofDataApi({value:{pageData:e},id:r})},Gy=async(r,e)=>await bt.getInsofDataApi({key:r,valueLikes:e}),Wy=async()=>{var r,e,t,n,i,s,a,o,l;try{const c=await bt.getInsofDataApi({key:{systemKey:sessionStorage.getItem("systemKey"),layer:"superAdmin"}});((r=c==null?void 0:c.data)==null?void 0:r.code)===200&&(qu.setPlatform(((i=(n=(t=(e=c==null?void 0:c.data)==null?void 0:e.result)==null?void 0:t[0])==null?void 0:n.key)==null?void 0:i.systemType)==="制造系统"?"client":"browser"),qu.setPlatName(((l=(o=(a=(s=c==null?void 0:c.data)==null?void 0:s.result)==null?void 0:a[0])==null?void 0:o.key)==null?void 0:l.name)??""))}catch(c){return Promise.reject(c)}},qh=bt.defineStore("modelTableComp",{state:()=>({tableIndex:0,tableShowThree:""}),actions:{setTableIndex(r){this.tableIndex=r},setTableShowThree(r){this.tableShowThree=r}}}),Xy={class:"table-content"},qy=["onClick"],jy={class:"form-content"},Yy={key:0,class:"dialog-footer"},Ky={class:"dialog-footer"},$y={__name:"index",props:{compName:{type:String,default:"",required:!1},operatingForm:{type:Object,default:()=>{}},itemData:{type:Array,default:()=>[]},childItemData:{type:Array,default:()=>[]},index:Number,changedContent:{type:Object,default:()=>{}}},emits:["change","contentChange","onButtonClick","contentClick","pageChange"],setup(r,{emit:e}){const t=r,n=e,i=re.ref([]),s=bt.useMenuState(),{activeMenuPath:a}=bt.storeToRefs(s),o=qh(Tr.pinia),l=yl(Tr.pinia),{extraContents:c}=bt.storeToRefs(l),u=re.ref([]);re.ref(!1);const h=re.ref("");re.ref();const d=re.ref(!0),f=re.ref(0),m=re.ref(!1),_=re.ref(""),g=re.ref(!1),p=re.ref({label:"查看三维模型"}),M=re.ref(!1),E=re.ref(),y=re.ref([]),I=re.ref([]),R=re.ref(!1),C=re.ref([]),L=re.ref([]),b=re.ref(),x=re.ref(),w=kh(Tr.pinia),B=re.ref(),z=zh(Tr.pinia),{selectIndex:X,selectMenu:j,selectTitle:O}=bt.storeToRefs(z),{selectString:K}=bt.storeToRefs(w),H=re.ref(720),ie=()=>{g.value=!1},oe=ae=>{n("clickTrigger",ae)},$=(ae,_e)=>{if(Object.values(_e).length!==0)return Object.values(_e).find(N=>{var We,Me,Te;return((We=N==null?void 0:N.toString())==null?void 0:We.includes(".txt"))||((Me=N==null?void 0:N.toString())==null?void 0:Me.includes(".cpt"))||((Te=N==null?void 0:N.toString())==null?void 0:Te.includes(".obj"))})?[...ae,p.value]:ae},xe=ae=>{var Me;K.value===""?ae==null||ae[0]:(ae==null?void 0:ae.find(Te=>(Te==null?void 0:Te.selectLabel)==="("+K.value+")"))??(ae==null||ae.find(Te=>!(Te!=null&&Te.selectLabel)));let _e=ae;(Me=i.value)!=null&&Me.find(Te=>Te.prop==="index");let N=b.value;const We=[];return _e==null||_e.forEach((Te,Q)=>{var Ie;let Be={};if(Array.isArray(Te)){let Re=[];Te==null||Te.filter(pt=>!(pt!=null&&pt.id)).forEach((pt,F)=>{var T,Y,ce,de,ne;if((T=N==null?void 0:N[F])!=null&&T.prop&&!Array.isArray(pt)){let Ge={};Ge[N[F].column]=pt,c!=null&&c.value&&((Y=c==null?void 0:c.value)==null?void 0:Y.length)>0&&((ce=c==null?void 0:c.value)!=null&&ce.find(Se=>JSON.stringify(Se==null?void 0:Se[0])===JSON.stringify(Ge)))&&(Re=(de=c==null?void 0:c.value)==null?void 0:de.find(Se=>JSON.stringify(Se==null?void 0:Se[0])===JSON.stringify(Ge))),Re&&Re.length>0?Be[N[F].prop]=Re!=null&&Re.find(Se=>{var Fe;return((Fe=Object.keys(Se))==null?void 0:Fe[0])===N[F].column})?(ne=Re==null?void 0:Re.find(Se=>{var Fe;return((Fe=Object.keys(Se))==null?void 0:Fe[0])===N[F].column}))==null?void 0:ne[N[F].column]:pt:Be[N[F].prop]=pt}})}else Be=Te;Array.isArray(Te)&&Te.some(Re=>Re==null?void 0:Re.id)?We.push(Object.assign(Be,{id:(Ie=Te==null?void 0:Te.find(Re=>Re.id))==null?void 0:Ie.id})):Be.id?We.push(Be):We.push(Object.assign(Be,{id:Q}))}),We},Ee=async ae=>{var Me,Te,Q,Be,Ie;let _e={};for(let Re in ae)ae[Re]!==""&&(_e["tableData."+Re]=ae[Re]);const N=await Gy({type:"data",tableId:t==null?void 0:t.index,systemKey:sessionStorage.getItem("systemKey"),pageKey:a.value},_e),We=(Q=(Te=(Me=Le.cloneDeep(N))==null?void 0:Me.data)==null?void 0:Te.result)==null?void 0:Q.map(Re=>{var F;let pt=[];return pt.push({id:Re.id}),pt.push((F=Re==null?void 0:Re.value)==null?void 0:F.tableData),pt});u.value=xe(ql(We,(Ie=(Be=Le.cloneDeep(i.value))==null?void 0:Be.map(Re=>Re.label))==null?void 0:Ie.filter(Re=>Re!=="操作")))},q=async ae=>{var N,We,Me,Te,Q,Be,Ie;let _e=await Xh(a.value,sessionStorage.getItem("systemKey"),ae.id);if(_e=_e==null?void 0:_e.filter(Re=>Re.comp!=="methodButton"),_e&&_e.length>0){const Re=!Array.isArray(O.value)&&((N=O.value)==null?void 0:N.key)!=="main"?[]:O.value;Re.push({key:j.value===""?(We=ae==null?void 0:ae.id)==null?void 0:We.toString():j.value+"-"+((Me=ae==null?void 0:ae.id)==null?void 0:Me.toString()),value:ae[(Te=Object.keys(ae))==null?void 0:Te.filter(pt=>pt!=="index"&&pt!=="id")[0]]}),z.setSelectMenu(j.value===""?(Q=ae==null?void 0:ae.id)==null?void 0:Q.toString():j.value+"-"+((Be=ae==null?void 0:ae.id)==null?void 0:Be.toString())),z.setSelectTitle(Re),z.setSelectIndex((Ie=ae==null?void 0:ae.id)==null?void 0:Ie.toString()),n("pageChange",_e)}},te=ae=>{var _e;(_e=Le.cloneDeep(t.itemData))==null||_e.map(N=>((N==null?void 0:N.key)==="tableContents"&&(N.contents=ae),N))},se=(ae,_e,N)=>{n("contentClick",ae,_e,N,{id:t==null?void 0:t.index})};re.watch(()=>t.changedContent,()=>{var N,We;if(!t.changedContent)return;let ae=(N=u.value)==null?void 0:N.map(Me=>{var Te;return Me.id===((Te=t.changedContent)==null?void 0:Te.id)&&(Me={...t.changedContent,id:t.changedContent.newId?t.changedContent.newId:t.changedContent.id},delete Me.newId),Me});const _e=(We=t.itemData)==null?void 0:We.map(Me=>((Me==null?void 0:Me.key)==="tableContents"&&(Me.contents=ae),Me));u.value=ae,n("contentChange",{contents:_e,index:t.index}),n("change",{content:ae,index:t==null?void 0:t.index,buttonName:"",id:t==null?void 0:t.index})},{deep:!0,immediate:!0});const le=()=>{},be=(ae,_e,N)=>{var We,Me,Te;if(h.value="",R.value=!0,d.value=!0,n("onButtonClick",ae,_e),ae==="删除"){u.value=(We=Le.cloneDeep(u.value))==null?void 0:We.filter(Be=>(Be==null?void 0:Be.id)!==(_e==null?void 0:_e.id));const Q=Ey(B.value,j.value,_e==null?void 0:_e.id);te(Q),n("change",{content:u.value,singleContent:_e,index:t==null?void 0:t.index,type:"delete",buttonName:ae,column:i.value})}else if(ae==="新增")_.value="新增",st(""),g.value=!0;else if(ae==="编辑")_.value="编辑",st(_e),g.value=!0;else if(ae==="查看")_.value="查看",st(_e),R.value=!1,d.value=!1,g.value=!0;else if(ae==="查看三维模型"){const Q={};for(let Ie in _e)Ie!=="id"&&(Q[Ie]=_e[Ie]);let Be=(Me=Object.values(Q))==null?void 0:Me[1];o.setTableShowThree(Be)}else((Te=N==null?void 0:N.extra)==null?void 0:Te.type)==="modelExample"&&(_.value=ae,M.value=!0)},st=ae=>{var We,Me,Te;const _e=[];let N=[];for(let Q in ae)Array.isArray(ae==null?void 0:ae[Q])&&N.push(Q);(Me=xn.getColumnChild((We=Le.cloneDeep(i.value))==null?void 0:We.filter(Q=>(Q==null?void 0:Q.label)!=="操作")))==null||Me.forEach((Q,Be)=>{N.find(Ie=>Ie===(Q==null?void 0:Q.prop))||_e.push({label:(Q==null?void 0:Q.label)??"",name:(Q==null?void 0:Q.prop)??"t"+Be,type:!(Q!=null&&Q.formType)||(Q==null?void 0:Q.formType)===""?"Input":Q==null?void 0:Q.formType,value:(ae==null?void 0:ae[Q==null?void 0:Q.prop])??(Q==null?void 0:Q.value)??"",id:(Q==null?void 0:Q.id)??Be,contents:(Q==null?void 0:Q.options)??[],width:1,isFormColHidden:Q==null?void 0:Q.isFormColHidden})}),ae===""||!ae||(h.value=ae==null?void 0:ae.id),L.value=y.value&&((Te=y.value)==null?void 0:Te.length)>0?y.value:_e};re.onMounted(()=>{E.value=window.innerWidth-240*2});const Ke=()=>{let ae,_e=Le.cloneDeep(u.value);h.value===""?(f.value++,_e.push(Object.assign(x.value,{id:f.value})),ae=Object.assign(x.value,{id:f.value})):_e=_e==null?void 0:_e.map(We=>((We==null?void 0:We.id)===h.value&&(We=Object.assign(We,x.value),ae=We),We)),u.value=_e;const N=wy(B.value,j.value,_e);te(N),g.value=!1,n("change",{content:N,singleContent:ae,index:t==null?void 0:t.index,buttonName:_.value,column:i.value})},Ct=ae=>{x.value=ae,n("onFormChange",ae)};return re.watch(()=>[t.itemData,K.value,X.value,j.value,c==null?void 0:c.value],()=>{var Ie,Re,pt,F,T,Y,ce,de,ne,Ge,Se,Fe,je,fe,Oe,tt,Qe,we,at,V,Pe,pe,ke,ve,he,He;const ae=(Ie=Le.cloneDeep(t.itemData))==null?void 0:Ie.filter(me=>(me==null?void 0:me.key)==="header");(Re=Le.cloneDeep(t.itemData))==null||Re.filter(me=>(me==null?void 0:me.key)==="tableIndexColumn")[0];const _e=(pt=Le.cloneDeep(t.itemData))==null?void 0:pt.find(me=>(me==null?void 0:me.key)==="page"),N=(F=Le.cloneDeep(t.itemData))==null?void 0:F.find(me=>(me==null?void 0:me.key)==="rowButton"),We=(T=Le.cloneDeep(t.itemData))==null?void 0:T.find(me=>(me==null?void 0:me.key)==="extraButton"),Me=(Y=Le.cloneDeep(t.itemData))==null?void 0:Y.filter(me=>(me==null?void 0:me.key)==="tableContents"),Te=(ce=Le.cloneDeep(t.itemData))==null?void 0:ce.filter(me=>(me==null?void 0:me.key)==="tableIndex");y.value=(Ge=(ne=(de=Le.cloneDeep(t.itemData))==null?void 0:de.filter(me=>(me==null?void 0:me.key)==="tableToForm"))==null?void 0:ne[0])==null?void 0:Ge.contents,m.value=(_e==null?void 0:_e.contents)??!1;let Q=[];K.value===""?Q=ae==null?void 0:ae[0]:Q=(ae==null?void 0:ae.find(me=>(me==null?void 0:me.selectLabel)==="("+K.value+")"))??(ae==null?void 0:ae.find(me=>!(me!=null&&me.selectLabel)));let Be=[];if(K.value===""?Be=Te==null?void 0:Te[0]:Be=(Te==null?void 0:Te.find(me=>(me==null?void 0:me.selectLabel)==="("+K.value+")"))??(Te==null?void 0:Te.find(me=>!(me!=null&&me.selectLabel))),((Se=Q==null?void 0:Q.contents)==null?void 0:Se.length)>0){let me=[];if(Q!=null&&Q.contents.some(nt=>Array.isArray(nt)&&(nt==null?void 0:nt.find(De=>De.children))))j.value===""?me=(je=(Fe=xn.getGradeColumns(Le.cloneDeep(Q==null?void 0:Q.contents)))==null?void 0:Fe[0])==null?void 0:je.filter(nt=>!Array.isArray(nt)):(j.value.split("-"),me=(fe=xn.getGradeColumns(Le.cloneDeep(Q==null?void 0:Q.contents)))==null?void 0:fe[0]);else{const nt=Q!=null&&Q.contents.some(De=>Array.isArray(De))?(Oe=Q==null?void 0:Q.contents)==null?void 0:Oe[0]:Q==null?void 0:Q.contents;nt==null||nt.forEach((De,Gt)=>{me.push({label:(De==null?void 0:De.label)??"",prop:(De==null?void 0:De.label)==="操作"?"operate":(De==null?void 0:De.prop)??"a"+Gt,width:(De==null?void 0:De.label)==="操作"?"200":De!=null&&De.width?parseInt(De.width):"",fixed:(De==null?void 0:De.fixed)??void 0,sortable:(De==null?void 0:De.sortable)??!1,align:(De==null?void 0:De.align)??"center",showOverflowTooltip:(De==null?void 0:De.showOverflowTooltip)??!0,isNotDrag:(De==null?void 0:De.isNotDrag)??!1,isEditCol:(De==null?void 0:De.isEditCol)??!1,isOperate:(De==null?void 0:De.isOperate)??!1,id:(De==null?void 0:De.id)??Gt,type:(De==null?void 0:De.label)==="操作"?"operate":void 0,formType:(De==null?void 0:De.formType)??"",isTableColHidden:De==null?void 0:De.isTableColHidden,isFormColHidden:De==null?void 0:De.isFormColHidden,options:(De==null?void 0:De.options)??[],value:(De==null?void 0:De.value)??""})})}i.value=me;let mt=(Qe=(tt=xn.getAllLeafNodes(Le.cloneDeep(i.value)))==null?void 0:tt.filter(nt=>(nt==null?void 0:nt.type)!=="operate"))==null?void 0:Qe.map((nt,De)=>({prop:(nt==null?void 0:nt.prop)??"a"+De,column:nt.label}));b.value=mt;let Ze=[];K.value===""?Ze=Me==null?void 0:Me[0]:Ze=(Me==null?void 0:Me.find(nt=>(nt==null?void 0:nt.selectLabel)==="("+K.value+")"))??(Me==null?void 0:Me.find(nt=>!(nt!=null&&nt.selectLabel)));let Ht=Array.isArray((we=Ze==null?void 0:Ze.contents)==null?void 0:we[0])&&((at=Ze==null?void 0:Ze.contents)!=null&&at[0].every(nt=>Array.isArray(nt)))?(V=Le.cloneDeep(Ze==null?void 0:Ze.contents))==null?void 0:V[0]:Le.cloneDeep(Ze==null?void 0:Ze.contents);Be!=null&&Be.contents&&((Pe=Be==null?void 0:Be.contents)==null?void 0:Pe.length)!==0&&(Ht=(pe=Le.cloneDeep(Ht))==null?void 0:pe.map((nt,De)=>{if(!Array.isArray(nt)){let Gt={};for(let Pn in nt)Pn!=="id"&&Pn!=="index"&&(Gt[Pn]=nt[Pn]);nt=Object.values(Gt)}return nt}));const En=!!((ke=i.value)!=null&&ke.find(nt=>nt.prop==="index"));Ht=Hh(Le.cloneDeep(Ht),Be==null?void 0:Be.contents,En);const Qn=[];Ht==null||Ht.forEach((nt,De)=>{var Pn;let Gt={};if(Array.isArray(nt)){let Wt=[];nt==null||nt.filter(Zt=>!(Zt!=null&&Zt.id)).forEach((Zt,dn)=>{var ei,Pi,Di,Qi,er,tr;if((ei=mt==null?void 0:mt[dn])!=null&&ei.prop&&!Array.isArray(Zt)){let Li={};Li[mt[dn].column]=Zt,c!=null&&c.value&&((Pi=c==null?void 0:c.value)==null?void 0:Pi.length)>0&&((Di=c==null?void 0:c.value)!=null&&Di.find(fn=>JSON.stringify(fn==null?void 0:fn[0])===JSON.stringify(Li)))&&(Wt=(Qi=c==null?void 0:c.value)==null?void 0:Qi.find(fn=>JSON.stringify(fn==null?void 0:fn[0])===JSON.stringify(Li))),Wt&&Wt.length>0?Gt[mt[dn].prop]=Wt!=null&&Wt.find(fn=>{var ti;return((ti=Object.keys(fn))==null?void 0:ti[0])===mt[dn].column})?(er=Wt==null?void 0:Wt.find(fn=>{var ti;return((ti=Object.keys(fn))==null?void 0:ti[0])===mt[dn].column}))==null?void 0:er[mt[dn].column]:Zt:Gt[mt[dn].prop]=Zt}else Array.isArray(Zt)&&((tr=mt[dn])!=null&&tr.prop?Gt[mt[dn].prop]=Zt:Gt.children=Vh(Zt,mt))})}else Gt=nt;Array.isArray(nt)&&nt.some(Wt=>Wt==null?void 0:Wt.id)?Qn.push(Object.assign(Gt,{id:(Pn=nt==null?void 0:nt.find(Wt=>Wt.id))==null?void 0:Pn.id})):Gt.id?Qn.push(Gt):Qn.push(Object.assign(Gt,{id:De}))}),u.value=Qn}else i.value=[],u.value=[];((ve=N==null?void 0:N.contents)==null?void 0:ve.length)>0?I.value=N==null?void 0:N.contents:I.value=[],((he=We==null?void 0:We.contents)==null?void 0:he.length)>0?C.value=We==null?void 0:We.contents:C.value=[],f.value=((He=u==null?void 0:u.value)==null?void 0:He.length)??0,B.value=u.value},{deep:!0,immediate:!0}),re.watch(()=>t==null?void 0:t.operatingForm,ae=>{ae!=null&&ae.form&&(st(ae==null?void 0:ae.form),_.value=ae==null?void 0:ae.dialogTitle,R.value=!0,g.value=!0)},{immediate:!0,deep:!0}),(ae,_e)=>{var N;return re.openBlock(),re.createElementBlock("div",Xy,[(re.openBlock(),re.createBlock(xn.ssTable,{columns:i.value,key:i.value,tableData:u.value,isShowPagination:m.value,isShowEdit:!1,isShowDelete:!1,onDbClickRow:q,extraButton:C.value,onContentClick:se},re.createSlots({headerButton:re.withCtx(We=>[re.createVNode(Nd,{compName:r.compName,buttons:We.buttons,onButtonClick:_e[0]||(_e[0]=Me=>be(Me,"",{})),columns:i.value,onFilter:Ee},null,8,["compName","buttons","columns"])]),_:2},[((N=I.value)==null?void 0:N.length)>0?{name:"actions",fn:re.withCtx(({item:We})=>[(re.openBlock(!0),re.createElementBlock(re.Fragment,null,re.renderList($(I.value,We),(Me,Te)=>(re.openBlock(),re.createElementBlock("div",{key:Te},[re.createElementVNode("div",{style:re.normalizeStyle({color:Me==null?void 0:Me.textColor}),class:"extra-button-label",onClick:Q=>be(Me==null?void 0:Me.label,We,{extra:Me})},re.toDisplayString(Me==null?void 0:Me.label),13,qy)]))),128))]),key:"0"}:void 0]),1032,["columns","tableData","isShowPagination","extraButton"])),re.createVNode(xn.ssDialog,{title:_.value,visible:g.value,width:H.value,onBeforeDestroy:ie},{default:re.withCtx(()=>[re.createElementVNode("div",jy,[re.createVNode(xn.ssForm,{rowContents:L.value,isEnableWrap:!1,onChange:Ct,onClickTrigger:oe,isEdit:d.value},null,8,["rowContents","isEdit"])])]),footer:re.withCtx(()=>[R.value?(re.openBlock(),re.createElementBlock("div",Yy,[re.createElementVNode("div",{onClick:_e[1]||(_e[1]=We=>g.value=!1),class:"cancel-button"},re.toDisplayString("取消")),re.createElementVNode("div",{class:"ok-button",onClick:Ke},re.toDisplayString("确认"))])):re.createCommentVNode("",!0)]),_:1},8,["title","visible","width"]),re.createVNode(xn.ssDialog,{title:_.value,visible:M.value,width:E.value,onBeforeDestroy:_e[3]||(_e[3]=We=>M.value=!1)},{default:re.withCtx(()=>[re.createVNode(by)]),footer:re.withCtx(()=>[re.createElementVNode("div",Ky,[re.createElementVNode("div",{onClick:_e[2]||(_e[2]=We=>M.value=!1),class:"cancel-button"},re.toDisplayString("取消")),re.createElementVNode("div",{class:"ok-button",onClick:le},re.toDisplayString("确认"))])]),_:1},8,["title","visible","width"])])}}},Jy=vl._export_sfc($y,[["__scopeId","data-v-4098a946"]]);exports.ACESFilmicToneMapping=Ju;exports.AmbientLight=Th;exports.Box3=Zn;exports.Color=ht;exports.Controls=Yp;exports.DirectionalLight=Eh;exports.DoubleSide=hn;exports.Euler=bn;exports.HemisphereLight=Bp;exports.IsJson=Ry;exports.MOUSE=Fd;exports.MathUtils=Wi;exports.Mesh=Ut;exports.MeshPhongMaterial=Sn;exports.PCFSoftShadowMap=$u;exports.PerspectiveCamera=sn;exports.Plane=Ti;exports.PlaneGeometry=ds;exports.PointLight=bh;exports.Quaternion=Cn;exports.Ray=Or;exports.SRGBColorSpace=At;exports.Scene=Ll;exports.Spherical=wh;exports.TOUCH=Od;exports.Vector2=dt;exports.Vector3=k;exports.WebGLRenderer=Dv;exports.Xe=iy;exports.addTableContents=zy;exports.conStructContents=Fy;exports.deleteTableContents=ky;exports.fixFormContents=Hy;exports.fixTableContents=Vy;exports.getItemData=Xh;exports.loadingSystemType=Wy;exports.methodTableToContent=Py;exports.ssTable=Jy;exports.tableEveryContents=es;exports.tableToContents=ha;exports.tableToStruct=un;exports.useFormToTableComp=kh;exports.useModelComp=yl;exports.useModelLoader=vy;exports.useTableComp=qh;exports.useUnit=zh;
|
|
4206
|
+
`,v),null}const Ui=Bt.getAttribute("version");console.debug("THREE.ColladaLoader: File version",Ui);const Nt=u(n(Bt,"asset")[0]),pn=new kl(this.manager);pn.setPath(this.resourcePath||t).setCrossOrigin(this.crossOrigin);let on;ku&&(on=new ku(this.manager),on.setPath(this.resourcePath||t));const qt=new ht,Kt=[];let nr={},ni=0;const ct={animations:{},clips:{},controllers:{},images:{},effects:{},materials:{},cameras:{},lights:{},geometries:{},nodes:{},visualScenes:{},kinematicsModels:{},physicsModels:{},kinematicsScenes:{}};f(Bt,"library_animations","animation",g),f(Bt,"library_animation_clips","animation_clip",O),f(Bt,"library_controllers","controller",re),f(Bt,"library_images","image",se),f(Bt,"library_effects","effect",st),f(Bt,"library_materials","material",Y),f(Bt,"library_cameras","camera",Ge),f(Bt,"library_lights","light",tt),f(Bt,"library_geometries","geometry",Pe),f(Bt,"library_nodes","node",Z),f(Bt,"library_visual_scenes","visual_scene",Rt),f(Bt,"library_kinematics_models","kinematics_model",En),f(Bt,"library_physics_models","physics_model",ei),f(Bt,"scene","instance_kinematics_scene",Qi),m(ct.animations,E),m(ct.clips,K),m(ct.controllers,Ee),m(ct.images,le),m(ct.effects,F),m(ct.materials,de),m(ct.cameras,fe),m(ct.lights,at),m(ct.geometries,me),m(ct.visualScenes,Ot),Yt(),fn();const ms=it(n(Bt,"scene")[0]);return ms.animations=Kt,Nt.upAxis==="Z_UP"&&(console.warn("THREE.ColladaLoader: You are loading an asset with a Z-UP coordinate system. The loader just rotates the asset to transform it into Y-UP. The vertex data are not converted, see #24289."),ms.rotation.set(-Math.PI/2,0,0)),ms.scale.multiplyScalar(Nt.unit),{get animations(){return console.warn("THREE.ColladaLoader: Please access animations over scene.animations now."),Kt},kinematics:nr,library:ct,scene:ms}}}const zu=new k,hy=new bn,Zs=new ut,Ei=new ut,Qs=new Cn,ea=new k(1,1,1),ta=new k;class Aa extends Ft{constructor(...e){super(...e),this.urdfNode=null,this.urdfName=""}copy(e,t){return super.copy(e,t),this.urdfNode=e.urdfNode,this.urdfName=e.urdfName,this}}class dy extends Aa{constructor(...e){super(...e),this.isURDFCollider=!0,this.type="URDFCollider"}}class fy extends Aa{constructor(...e){super(...e),this.isURDFVisual=!0,this.type="URDFVisual"}}class Oh extends Aa{constructor(...e){super(...e),this.isURDFLink=!0,this.type="URDFLink"}}class Bh extends Aa{get jointType(){return this._jointType}set jointType(e){if(this.jointType!==e)switch(this._jointType=e,this.matrixWorldNeedsUpdate=!0,e){case"fixed":this.jointValue=[];break;case"continuous":case"revolute":case"prismatic":this.jointValue=new Array(1).fill(0);break;case"planar":this.jointValue=new Array(3).fill(0),this.axis=new k(0,0,1);break;case"floating":this.jointValue=new Array(6).fill(0);break}}get angle(){return this.jointValue[0]}constructor(...e){super(...e),this.isURDFJoint=!0,this.type="URDFJoint",this.jointValue=null,this.jointType="fixed",this.axis=new k(1,0,0),this.limit={lower:0,upper:0},this.ignoreLimits=!1,this.origPosition=null,this.origQuaternion=null,this.mimicJoints=[]}copy(e,t){return super.copy(e,t),this.jointType=e.jointType,this.axis=e.axis.clone(),this.limit.lower=e.limit.lower,this.limit.upper=e.limit.upper,this.ignoreLimits=!1,this.jointValue=[...e.jointValue],this.origPosition=e.origPosition?e.origPosition.clone():null,this.origQuaternion=e.origQuaternion?e.origQuaternion.clone():null,this.mimicJoints=[...e.mimicJoints],this}setJointValue(...e){e=e.map(n=>n===null?null:parseFloat(n)),(!this.origPosition||!this.origQuaternion)&&(this.origPosition=this.position.clone(),this.origQuaternion=this.quaternion.clone());let t=!1;switch(this.mimicJoints.forEach(n=>{t=n.updateFromMimickedJoint(...e)||t}),this.jointType){case"fixed":return t;case"continuous":case"revolute":{let n=e[0];return n==null||n===this.jointValue[0]?t:(!this.ignoreLimits&&this.jointType==="revolute"&&(n=Math.min(this.limit.upper,n),n=Math.max(this.limit.lower,n)),this.quaternion.setFromAxisAngle(this.axis,n).premultiply(this.origQuaternion),this.jointValue[0]!==n?(this.jointValue[0]=n,this.matrixWorldNeedsUpdate=!0,!0):t)}case"prismatic":{let n=e[0];return n==null||n===this.jointValue[0]?t:(this.ignoreLimits||(n=Math.min(this.limit.upper,n),n=Math.max(this.limit.lower,n)),this.position.copy(this.origPosition),zu.copy(this.axis).applyEuler(this.rotation),this.position.addScaledVector(zu,n),this.jointValue[0]!==n?(this.jointValue[0]=n,this.matrixWorldNeedsUpdate=!0,!0):t)}case"floating":return this.jointValue.every((n,i)=>e[i]===n||e[i]===null)?t:(this.jointValue[0]=e[0]!==null?e[0]:this.jointValue[0],this.jointValue[1]=e[1]!==null?e[1]:this.jointValue[1],this.jointValue[2]=e[2]!==null?e[2]:this.jointValue[2],this.jointValue[3]=e[3]!==null?e[3]:this.jointValue[3],this.jointValue[4]=e[4]!==null?e[4]:this.jointValue[4],this.jointValue[5]=e[5]!==null?e[5]:this.jointValue[5],Ei.compose(this.origPosition,this.origQuaternion,ea),Qs.setFromEuler(hy.set(this.jointValue[3],this.jointValue[4],this.jointValue[5],"XYZ")),ta.set(this.jointValue[0],this.jointValue[1],this.jointValue[2]),Zs.compose(ta,Qs,ea),Ei.premultiply(Zs),this.position.setFromMatrixPosition(Ei),this.rotation.setFromRotationMatrix(Ei),this.matrixWorldNeedsUpdate=!0,!0);case"planar":return this.jointValue.every((n,i)=>e[i]===n||e[i]===null)?t:(this.jointValue[0]=e[0]!==null?e[0]:this.jointValue[0],this.jointValue[1]=e[1]!==null?e[1]:this.jointValue[1],this.jointValue[2]=e[2]!==null?e[2]:this.jointValue[2],Ei.compose(this.origPosition,this.origQuaternion,ea),Qs.setFromAxisAngle(this.axis,this.jointValue[2]),ta.set(this.jointValue[0],this.jointValue[1],0),Zs.compose(ta,Qs,ea),Ei.premultiply(Zs),this.position.setFromMatrixPosition(Ei),this.rotation.setFromRotationMatrix(Ei),this.matrixWorldNeedsUpdate=!0,!0)}return t}}class Vu extends Bh{constructor(...e){super(...e),this.type="URDFMimicJoint",this.mimicJoint=null,this.offset=0,this.multiplier=1}updateFromMimickedJoint(...e){const t=e.map(n=>n*this.multiplier+this.offset);return super.setJointValue(...t)}copy(e,t){return super.copy(e,t),this.mimicJoint=e.mimicJoint,this.offset=e.offset,this.multiplier=e.multiplier,this}}class py extends Oh{constructor(...e){super(...e),this.isURDFRobot=!0,this.urdfNode=null,this.urdfRobotNode=null,this.robotName=null,this.links=null,this.joints=null,this.colliders=null,this.visual=null,this.frames=null}copy(e,t){super.copy(e,t),this.urdfRobotNode=e.urdfRobotNode,this.robotName=e.robotName,this.links={},this.joints={},this.colliders={},this.visual={},this.traverse(n=>{n.isURDFJoint&&n.urdfName in e.joints&&(this.joints[n.urdfName]=n),n.isURDFLink&&n.urdfName in e.links&&(this.links[n.urdfName]=n),n.isURDFCollider&&n.urdfName in e.colliders&&(this.colliders[n.urdfName]=n),n.isURDFVisual&&n.urdfName in e.visual&&(this.visual[n.urdfName]=n)});for(const n in this.joints)this.joints[n].mimicJoints=this.joints[n].mimicJoints.map(i=>this.joints[i.name]);return this.frames={...this.colliders,...this.visual,...this.links,...this.joints},this}getFrame(e){return this.frames[e]}setJointValue(e,...t){const n=this.joints[e];return n?n.setJointValue(...t):!1}setJointValues(e){let t=!1;for(const n in e){const i=e[n];Array.isArray(i)?t=this.setJointValue(n,...i)||t:t=this.setJointValue(n,i)||t}return t}}const yo=new Cn,Hu=new bn;function br(r){return r?r.trim().split(/\s+/g).map(e=>parseFloat(e)):[0,0,0]}function Gu(r,e,t=!1){t||r.rotation.set(0,0,0),Hu.set(e[0],e[1],e[2],"ZYX"),yo.setFromEuler(Hu),yo.multiply(r.quaternion),r.quaternion.copy(yo)}class my{constructor(e){this.manager=e||Bl,this.loadMeshCb=this.defaultMeshLoader.bind(this),this.parseVisual=!0,this.parseCollision=!1,this.packages="",this.workingPath="",this.fetchOptions={}}loadAsync(e){return new Promise((t,n)=>{this.load(e,t,null,n)})}load(e,t,n,i){const s=this.manager,a=Vl.extractUrlBase(e),o=this.manager.resolveURL(e);s.itemStart(o),fetch(o,this.fetchOptions).then(l=>{if(l.ok)return n&&n(null),l.text();throw new Error(`URDFLoader: Failed to load url '${o}' with error code ${l.status} : ${l.statusText}.`)}).then(l=>{const c=this.parse(l,this.workingPath||a);t(c),s.itemEnd(o)}).catch(l=>{i?i(l):console.error("URDFLoader: Error loading file.",l),s.itemError(o),s.itemEnd(o)})}parse(e,t=this.workingPath){const n=this.packages,i=this.loadMeshCb,s=this.parseVisual,a=this.parseCollision,o=this.manager,l={},c={},u={};function h(M){if(!/^package:\/\//.test(M))return t?t+M:M;const[E,y]=M.replace(/^package:\/\//,"").split(/\/(.+)/);if(typeof n=="string")return n.endsWith(E)?n+"/"+y:n+"/"+E+"/"+y;if(n instanceof Function)return n(E)+"/"+y;if(typeof n=="object")return E in n?n[E]+"/"+y:(console.error(`URDFLoader : ${E} not found in provided package list.`),null)}function d(M){let E;M instanceof Document?E=[...M.children]:M instanceof Element?E=[M]:E=[...new DOMParser().parseFromString(M,"text/xml").children];const y=E.filter(I=>I.nodeName==="robot").pop();return f(y)}function f(M){const E=[...M.children],y=E.filter(w=>w.nodeName.toLowerCase()==="link"),I=E.filter(w=>w.nodeName.toLowerCase()==="joint"),R=E.filter(w=>w.nodeName.toLowerCase()==="material"),C=new py;C.robotName=M.getAttribute("name"),C.urdfRobotNode=M,R.forEach(w=>{const B=w.getAttribute("name");u[B]=g(w)});const L={},b={};y.forEach(w=>{const B=w.getAttribute("name"),z=M.querySelector(`child[link="${B}"]`)===null;l[B]=_(w,L,b,z?C:null)}),I.forEach(w=>{const B=w.getAttribute("name");c[B]=m(w)}),C.joints=c,C.links=l,C.colliders=b,C.visual=L;const x=Object.values(c);return x.forEach(w=>{w instanceof Vu&&c[w.mimicJoint].mimicJoints.push(w)}),x.forEach(w=>{const B=new Set,z=X=>{if(B.has(X))throw new Error("URDFLoader: Detected an infinite loop of mimic joints.");B.add(X),X.mimicJoints.forEach(j=>{z(j)})};z(w)}),C.frames={...b,...L,...l,...c},C}function m(M){const E=[...M.children],y=M.getAttribute("type");let I;const R=E.find(B=>B.nodeName.toLowerCase()==="mimic");R?(I=new Vu,I.mimicJoint=R.getAttribute("joint"),I.multiplier=parseFloat(R.getAttribute("multiplier")||1),I.offset=parseFloat(R.getAttribute("offset")||0)):I=new Bh,I.urdfNode=M,I.name=M.getAttribute("name"),I.urdfName=I.name,I.jointType=y;let C=null,L=null,b=[0,0,0],x=[0,0,0];E.forEach(B=>{const z=B.nodeName.toLowerCase();z==="origin"?(b=br(B.getAttribute("xyz")),x=br(B.getAttribute("rpy"))):z==="child"?L=l[B.getAttribute("link")]:z==="parent"?C=l[B.getAttribute("link")]:z==="limit"&&(I.limit.lower=parseFloat(B.getAttribute("lower")||I.limit.lower),I.limit.upper=parseFloat(B.getAttribute("upper")||I.limit.upper))}),C.add(I),I.add(L),Gu(I,x),I.position.set(b[0],b[1],b[2]);const w=E.filter(B=>B.nodeName.toLowerCase()==="axis")[0];if(w){const B=w.getAttribute("xyz").split(/\s+/g).map(z=>parseFloat(z));I.axis=new k(B[0],B[1],B[2]),I.axis.normalize()}return I}function _(M,E,y,I=null){I===null&&(I=new Oh);const R=[...M.children];return I.name=M.getAttribute("name"),I.urdfName=I.name,I.urdfNode=M,s&&R.filter(L=>L.nodeName.toLowerCase()==="visual").forEach(L=>{const b=p(L,u);if(I.add(b),L.hasAttribute("name")){const x=L.getAttribute("name");b.name=x,b.urdfName=x,E[x]=b}}),a&&R.filter(L=>L.nodeName.toLowerCase()==="collision").forEach(L=>{const b=p(L);if(I.add(b),L.hasAttribute("name")){const x=L.getAttribute("name");b.name=x,b.urdfName=x,y[x]=b}}),I}function g(M){const E=[...M.children],y=new Sn;return y.name=M.getAttribute("name")||"",E.forEach(I=>{const R=I.nodeName.toLowerCase();if(R==="color"){const C=I.getAttribute("rgba").split(/\s/g).map(L=>parseFloat(L));y.color.setRGB(C[0],C[1],C[2]),y.opacity=C[3],y.transparent=C[3]<1,y.depthWrite=!y.transparent}else if(R==="texture"){const C=I.getAttribute("filename");if(C){const L=new kl(o),b=h(C);y.map=L.load(b),y.map.colorSpace=At}}}),y}function p(M,E={}){const y=M.nodeName.toLowerCase()==="collision",I=[...M.children];let R=null;const C=I.filter(b=>b.nodeName.toLowerCase()==="material")[0];if(C){const b=C.getAttribute("name");b&&b in E?R=E[b]:R=g(C)}else R=new Sn;const L=y?new dy:new fy;return L.urdfNode=M,I.forEach(b=>{const x=b.nodeName.toLowerCase();if(x==="geometry"){const w=b.children[0].nodeName.toLowerCase();if(w==="mesh"){const B=b.children[0].getAttribute("filename"),z=h(B);if(z!==null){const X=b.children[0].getAttribute("scale");if(X){const j=br(X);L.scale.set(j[0],j[1],j[2])}i(z,o,(j,O)=>{O?console.error("URDFLoader: Error loading mesh.",O):j&&(j instanceof Ut&&(j.material=R),j.position.set(0,0,0),j.quaternion.identity(),L.add(j))})}}else if(w==="box"){const B=new Ut;B.geometry=new Br(1,1,1),B.material=R;const z=br(b.children[0].getAttribute("size"));B.scale.set(z[0],z[1],z[2]),L.add(B)}else if(w==="sphere"){const B=new Ut;B.geometry=new ba(1,30,30),B.material=R;const z=parseFloat(b.children[0].getAttribute("radius"))||0;B.scale.set(z,z,z),L.add(B)}else if(w==="cylinder"){const B=new Ut;B.geometry=new Ol(1,1,1,30),B.material=R;const z=parseFloat(b.children[0].getAttribute("radius"))||0,X=parseFloat(b.children[0].getAttribute("length"))||0;B.scale.set(z,X,z),B.rotation.set(Math.PI/2,0,0),L.add(B)}}else if(x==="origin"){const w=br(b.getAttribute("xyz")),B=br(b.getAttribute("rpy"));L.position.set(w[0],w[1],w[2]),L.rotation.set(0,0,0),Gu(L,B)}}),L}return d(e)}defaultMeshLoader(e,t,n){/\.stl$/i.test(e)?new ua(t).load(e,s=>{const a=new Ut(s,new Sn);n(a)}):/\.dae$/i.test(e)?new uy(t).load(e,s=>n(s.scene)):console.warn(`URDFLoader: Could not load model at ${e}.
|
|
4207
|
+
No loader available`)}}const gy=yl(Tr.pinia),{systemPath:Er}=bt.storeToRefs(gy),xo=ie.ref();function _y(r,e,t,n,i){const s=async d=>{try{const f=await Yh.downloadAvatarApi({url:d});if(f.status!==200)throw new Error(`下载失败: ${f.status}`);return f.data}catch(f){throw console.error("addModelFromUrl失败:",f),f}},a=d=>new Promise((f,m)=>{const _=new FileReader;_.onload=g=>{try{const p=g.target.result,E=new vo().parse(p);E.preload(),f(E)}catch(p){m(p)}},_.onerror=()=>{m(new Error("MTL文件读取失败"))},_.readAsText(d)}),o=async d=>{const f={materials:{},create:function(m){return this.materials[m]?this.materials[m]:(console.warn(`Material '${m}' not found, using default material`),new Sn({color:8947848,side:hn}))},getAsArray:function(){const m=[];for(const _ in this.materials)m.push(this.materials[_]);return m},preload:function(){for(const m in this.materials)this.materials[m].map&&(this.materials[m].map.needsUpdate=!0)}};for(const m of d){const _=await a(m);Object.assign(f.materials,_.materials)}return f.preload(),f},l=async(d,f=[])=>new Promise((m,_)=>{const g=new FileReader;g.onload=async p=>{try{const M=p.target.result;let E=null;f&&f.length>0&&(f.length===1?E=await a(f[0]):E=await o(f));const y=new _o;E&&y.setMaterials(E);const I=y.parse(M);E||I.traverse(R=>{R.isMesh&&(R.material=new Sn({color:8947848,side:hn}))}),m(I)}catch(M){_(M)}},g.onerror=()=>{_(new Error("OBJ文件读取失败"))},g.readAsText(d)}),c=async d=>{var f;try{t.value=!0;const{scene:m}=r();if(!m)throw new Error("Scene not initialized");i();const _=[];for(let g=0;g<d.length;g++){const p=d[g];n.value=`正在加载模型 ${g+1}/${d.length}...`;const M=await s(p.objUrl),E=((f=p.objUrl)==null?void 0:f.split("/").pop())||`model_${g}.obj`,y=new File([M],E,{type:M.type});let I=[];if(p.mtlUrls){const C=Array.isArray(p.mtlUrls)?p.mtlUrls:[p.mtlUrls];for(let L=0;L<C.length;L++){const b=C[L],x=await s(b),w=(b==null?void 0:b.split("/").pop())||`material_${g}_${L}.mtl`,B=new File([x],w,{type:x.type});I.push(B)}}const R=await l(y,I);m.add(R),e.value.push(R),_.push(R)}return t.value=!1,_}catch(m){throw console.error("加载模型失败:",m),t.value=!1,m}},u=async(d,f,m=[],_=[])=>{let g;const p=d.toLowerCase();switch(p){case".txt":case".cpt":case".obj":const M=await f.text();if(p===".txt"||p===".cpt"){const O=/^(?!.*\bf\b)[^\n]*?(-?\d*\.?\d+)[^\n]*?(-?\d*\.?\d+)[^\n]*?(-?\d*\.?\d+)[^\n]*?$/gm,H=[...M.matchAll(O)].map($=>({x:parseFloat($[1]),y:parseFloat($[2]),z:parseFloat($[3])})),re=new Vt,oe=H.flatMap($=>[$.x,$.y,$.z]);if(re.setAttribute("position",new xt(oe,3)),p===".txt"){const $=new qi({color:"#5B5C99",size:1,sizeAttenuation:!1});g=new is(re,$)}else if(p===".cpt"){const $=new ji({color:"#5B5C99",linewidth:100});g=new Fl(re,$)}}else if(p===".obj"){const O=new _o;if(m&&m.length>0){const K=new vo;for(const H of m){const re=await H.text(),oe=K.parse(re);oe.preload(),O.setMaterials(oe);break}}g=O.parse(M),(!m||m.length===0)&&g.traverse(K=>{K.isMesh&&(K.material=new Sn({color:"#B3B3D4"})),K instanceof Ut&&(K.material.side=hn)})}break;case".stl":const E=await f.arrayBuffer(),I=new ua().parse(E),R=new Sn({color:"#B3B3D4",side:hn});g=new Ut(I,R);break;case".nc":const C=["Mach_B_Axis_0.STL","Mach_C_Axis_0.STL","Mach_X_Axis_0.STL","Mach_Y_Axis_0.STL","Mach_Z_Axis_0.STL","Mach_Spindle_0.STL"],L={"Mach_Y_Axis_0.STL":"rgb(128,118,152)","Mach_B_Axis_0.STL":"rgb(204,143,89)","Mach_C_Axis_0.STL":"rgb(145,245,251)","Mach_X_Axis_0.STL":"rgb(125,158,192)","Mach_Z_Axis_0.STL":"rgb(248,228,118)","Mach_Spindle_0.STL":"rgb(145,145,145)"},b=new fi,x=C.map(O=>new Promise((K,H)=>{new ua().load(Er.value===""?`/model/${O}`:`${Er.value}\\${O}`,oe=>{const $=new Sn({color:L[O]||"#B3B3D4",side:hn}),xe=new Ut(oe,$);K(xe)},void 0,H)}));try{(await Promise.all(x)).forEach(K=>b.add(K)),g=b}catch(O){throw console.error("加载NC文件对应的STL文件失败:",O),new Error("无法加载.NC文件对应的STL文件")}break;case".pcd":const w=new cy,B=new fi;try{const O=await new Promise((H,re)=>{w.load(Er.value===""?"/model/final.pcd":`${Er.value}\\final.pcd`,oe=>{const $=new Float32Array(oe.geometry.attributes.position.count*3);for(let xe=0;xe<oe.geometry.attributes.position.count;xe++)$[xe*3]=1,$[xe*3+1]=0,$[xe*3+2]=0;oe.geometry.setAttribute("color",new Xt($,3)),oe.material.vertexColors=!0,oe.scale.set(.3,.3,.3),H(oe)},void 0,re)}),K=await new Promise((H,re)=>{w.load(Er.value===""?"/model/target.pcd":`${Er.value}\\target.pcd`,oe=>{const $=new Float32Array(oe.geometry.attributes.position.count*3);for(let xe=0;xe<oe.geometry.attributes.position.count;xe++)$[xe*3]=0,$[xe*3+1]=1,$[xe*3+2]=0;oe.geometry.setAttribute("color",new Xt($,3)),oe.material.vertexColors=!0,oe.scale.set(.3,.3,.3),H(oe)},void 0,re)});B.add(O),B.add(K),g=B}catch(O){throw console.error("PCD文件加载失败:",O),new Error("无法加载PCD文件")}break;case".urdf":const z=URL.createObjectURL(f),X=new my,j=new Map;_.forEach(O=>{j.set(O.name,O.blob)}),X.loadMeshCb=async(O,K,H,re,oe)=>{const $=O.split("/").pop();let xe=await bt.axios.get(`http://139.196.154.85:20026/chfs/shared/机器人/urdf/SmallBender_R-2000iC-165F/meshes/${$}`,{responseType:"blob",headers:{"Content-Type":"application/json"}});const q=new Blob([xe.data],{type:"application/octet-stream;charset=UTF-8"});if(!q){oe(new Error(`找不到文件: ${$}`));return}const te=$.split(".").pop().toLowerCase();switch(te){case"stl":const se=await q.arrayBuffer(),be=new ua(K).parse(se),st=new Ut(be,new Sn);H(st);break;case"obj":const Ke=await q.text(),Ct=new _o(K),ae=$.replace(".obj",".mtl");let _e=await bt.axios.get(`http://139.196.154.85:20026/chfs/shared/机器人/urdf/SmallBender_R-2000iC-165F/meshes/${ae}`,{responseType:"blob",headers:{"Content-Type":"application/json"}}),N=new Blob([_e.data],{type:"application/octet-stream;charset=UTF-8"});if(N){const Me=await N.text(),Q=new vo(K).parse(Me);Q.preload(),Ct.setMaterials(Q)}const We=Ct.parse(Ke);H(We);break;default:oe(new Error(`不支持的文件格式: ${te}`))}},z?(g=await X.loadAsync(z),xo.value=g):xo.value=void 0;break;default:throw new Error(`不支持的文件格式: ${d}`)}return g};return{addModelsFromUrls:c,loadModelByDefaultPath:async d=>{console.log(d);try{t.value=!0,n.value="正在加载模型...";const{scene:f}=r();if(!f)throw new Error("Scene not initialized");i(),await new Promise(_=>setTimeout(_,100));const m=[];for(let _=0;_<d.length;_++){const g=d[_],p=await u(g.suffix,g.blob,g.mtlBlobs||[],g.meshFiles||[]);f.add(p),e.value.push(p),m.push(p)}return t.value=!1,n.value="",m}catch(f){throw console.error("加载模型失败:",f),t.value=!1,n.value="",f}},urdfModel:xo}}const kh=bt.defineStore("formToTableComp",{state:()=>({selectArray:[],selectString:""}),actions:{setSelectArray(r){this.selectArray=r},setSelectString(r){this.selectString=r}}}),vy={class:"calculator-content"},yy={class:"calculator-child"},xy={class:"calculator-child"},Sy=ie.defineComponent({__name:"calculator",setup(r){const e=ie.ref(),t=ie.ref();return ie.onMounted(()=>{e.value=[{type:"Upload",label:"输入",name:"input"}],t.value=[{type:"Upload",label:"输出",name:"output"}]}),(n,i)=>(ie.openBlock(),ie.createElementBlock("div",vy,[ie.createElementVNode("div",yy,[ie.createVNode(xn.ssForm,{rowContents:e.value,isRowFlex:!0},null,8,["rowContents"])]),ie.createElementVNode("div",xy,[ie.createVNode(xn.ssForm,{rowContents:t.value,isEdit:!1,isRowFlex:!0},null,8,["rowContents"])])]))}}),My=vl._export_sfc(Sy,[["__scopeId","data-v-73db0fe7"]]),zh=bt.defineStore("unit",{state:()=>({selectIndex:"",selectMenu:"",selectTitle:[]}),actions:{setSelectIndex(r){this.selectIndex=r},setSelectMenu(r){this.selectMenu=r},setSelectTitle(r){this.selectTitle=r}}}),Vh=(r,e)=>{let t=r,n=e;return Array.isArray(t)&&(t=t==null?void 0:t.map((i,s)=>{if(Array.isArray(i)){let a={};return i=i==null?void 0:i.forEach((o,l)=>{var c;(c=n==null?void 0:n[l])!=null&&c.prop?a[n[l].prop]=o:Array.isArray(o)&&(a.children=Vh(o,n))}),Object.assign(a,{id:s})}else return i})),t},Hh=(r,e,t)=>{let n=r,i=e;return n=n==null?void 0:n.map((s,a)=>{var o,l;return!Array.isArray(s)||!((o=i==null?void 0:i[a])!=null&&o.label)&&!t||(s.unshift(((l=i==null?void 0:i[a])==null?void 0:l.label)??""),s.some(c=>Array.isArray(c))&&(s=s==null?void 0:s.map(c=>{var u;return Array.isArray(c)&&(c=Hh(c,(u=i==null?void 0:i[a])==null?void 0:u.children,t)),c}))),s}),n},by=(r,e,t)=>{if(e==="")return r==null?void 0:r.filter(n=>(n==null?void 0:n.id)!==t);{const n=e.split("-");return Ey(r,n,t)}},Ey=(r,e,t)=>{let n=r,i=e;return(i==null?void 0:i.length)===0?n=n==null?void 0:n.filter(s=>s.id!==t):n=n==null?void 0:n.map(s=>(s.id.toString()===(i==null?void 0:i[0])&&(i==null||i.shift(),s=Gh(s,i,t)),s)),n},Gh=(r,e,t)=>{var s,a;let n=r,i=e;return(i==null?void 0:i.length)===0?n.children=(s=n.children)==null?void 0:s.filter(o=>o.id!==t):n.children=(a=n.children)==null?void 0:a.map(o=>(o.id.toString()===(i==null?void 0:i[0])&&(i==null||i.shift(),o=Gh(o,i,t)),o)),n},Ty=(r,e,t)=>{if(e==="")return t;{const n=e.split("-");return wy(r,n,t)}},wy=(r,e,t)=>{let n=r,i=e;return(i==null?void 0:i.length)===0?n=t:n=n==null?void 0:n.map(s=>(s.id.toString()===(i==null?void 0:i[0])&&(i==null||i.shift(),s=Wh(s,i,t)),s)),n},Wh=(r,e,t)=>{var s;let n=r,i=e;return(i==null?void 0:i.length)===0?n.children=t:n.children=(s=n.children)==null?void 0:s.map(a=>(a.id.toString()===(i==null?void 0:i[0])&&(i==null||i.shift(),a=Wh(a,i,t)),a)),n},ql=(r,e)=>r==null?void 0:r.map(n=>{var i,s,a,o,l,c;if(Array.isArray(n)?n=n:n=[n],(i=n==null?void 0:n.filter(u=>!(u!=null&&u.id)))!=null&&i.every(u=>typeof u!="object"||u===null))return n;if((s=n==null?void 0:n.filter(u=>!(u!=null&&u.id)))!=null&&s.some(u=>Array.isArray(u)))return n;{let u=[];if(u.push(n==null?void 0:n.find(h=>h==null?void 0:h.id)),Array.isArray(e==null?void 0:e[0])){const h=(a=n==null?void 0:n.filter(d=>!(d!=null&&d.id)))==null?void 0:a[0];(o=xn.getColumnChild(Le.cloneDeep(e==null?void 0:e[0])))==null||o.forEach(d=>{u.push(h==null?void 0:h[(d==null?void 0:d.prop)??(d==null?void 0:d.label)??d])})}else{const h=(l=n==null?void 0:n.filter(d=>!(d!=null&&d.id)))==null?void 0:l[0];(c=xn.getColumnChild(Le.cloneDeep(e)))==null||c.forEach(d=>{u.push(h==null?void 0:h[(d==null?void 0:d.prop)??(d==null?void 0:d.label)??d])})}return u}}),Ay=r=>{try{return JSON.parse(r),!0}catch{return!1}},Wu=(r,e)=>Td(r,e),Ki=r=>{let e=[];function t(i){Array.isArray(i)&&(i==null||i.forEach(s=>{Array.isArray(s)||(s=[s]),s==null||s.forEach(a=>{!(a!=null&&a.children)||a.children.length===0?e.push(a.label):n(a.children)})}))}function n(i){i==null||i.forEach(s=>{!(s!=null&&s.children)||s.children.length===0?e.push(s.label):n(s.children)})}return t(r),e},Ry=(r,e,t)=>{var i;let n=(i=Le.cloneDeep(r))==null?void 0:i.map(s=>(s=s.filter(a=>!(a!=null&&a.id)),s));return n=n==null?void 0:n.map(s=>{var a;return s=(a=s.map((o,l)=>{let c={};if(t!=null&&t.find(u=>u===e[l]))return c[e[l]]=o,c}))==null?void 0:a.filter(o=>o),s}),n},Cy=(r,e)=>{var a,o;const t=Le.cloneDeep(r),n=(a=t==null?void 0:t.find(l=>(l==null?void 0:l.key)==="header"))==null?void 0:a.contents,i=(o=t==null?void 0:t.find(l=>(l==null?void 0:l.key)==="tableContents"))==null?void 0:o.contents;return Ry(i,Ki(n).slice(0,Ki(n).length-1),e)},un=r=>{var i,s,a,o;const e=r;let t=[];e.compData=(i=e.compData)==null?void 0:i.filter(l=>(l==null?void 0:l.key)!=="tableContents"&&(l==null?void 0:l.key)!=="tableIndex");const n=(a=(s=Le.cloneDeep(e.compData))==null?void 0:s.find(l=>(l==null?void 0:l.key)==="tableIndexColumn"))==null?void 0:a.contents;return(o=Le.cloneDeep(e.compData))==null||o.forEach(l=>{if((l==null?void 0:l.key)!=="tableIndexColumn"&&(l==null?void 0:l.key)!=="header")t.push(l);else if((l==null?void 0:l.key)==="header"){let c=l.contents;n&&(c!=null&&c.every(u=>Array.isArray(u))?c==null||c[0].unshift({label:n}):c.unshift({label:n})),t.push({key:"header",contents:c})}}),e.compData=t,e},ha=r=>{var s,a,o,l,c;const e=(s=r.compData)==null?void 0:s.filter(u=>(u==null?void 0:u.key)==="tableContents"||(u==null?void 0:u.key)==="tableIndex"),t=(o=(a=e==null?void 0:e.find(u=>(u==null?void 0:u.key)==="tableIndex"))==null?void 0:a.contents)==null?void 0:o.map(u=>u.label),n=(l=e==null?void 0:e.find(u=>(u==null?void 0:u.key)==="tableContents"))==null?void 0:l.contents;let i=[];return(t==null?void 0:t.length)>0&&(n!=null&&n.every(u=>Array.isArray(u)))?i=t==null?void 0:t.map((u,h)=>n[h]?[u,...n[h]]:[u]):Array.isArray(n==null?void 0:n[0])&&((c=n==null?void 0:n[0])!=null&&c.every(u=>Array.isArray(u)))?i=n==null?void 0:n[0]:Array.isArray(n==null?void 0:n[0])?i=n:i.push(n),i},Py=r=>{const e=[];function t(n){!n||n.length===0||(e.push(n==null?void 0:n.map(i=>({label:i.label}))),n==null||n.forEach(i=>{i!=null&&i.children&&(i==null?void 0:i.children.length)>0&&t(i==null?void 0:i.children)}))}return t(r),e},Dy=r=>{const e=[];function t(n,i=[]){!n||n.length===0||(e.push({key:i==null?void 0:i.filter(s=>!Array.isArray(s)),value:n}),n==null||n.forEach(s=>{s!=null&&s.some(a=>Array.isArray(a))&&t(s.find(a=>Array.isArray(a)),s)}))}return t(r),e},Ly=r=>{const e=[];function t(n){!n||n.length===0||(e.push(n==null?void 0:n.map(i=>i==null?void 0:i.filter(s=>!Array.isArray(s)))),n==null||n.forEach(i=>{i!=null&&i.some(s=>Array.isArray(s))&&t(i.find(s=>Array.isArray(s)))}))}return t(r),e},Uy=r=>{const e=[];function t(n){var i;!n||n.length===0||(n!=null&&n.every(s=>!Array.isArray(s))?e.push(n):(e.push((i=n==null?void 0:n.map(s=>s==null?void 0:s.filter(a=>!Array.isArray(a))))==null?void 0:i[0]),n==null||n.forEach(s=>{s!=null&&s.some(a=>Array.isArray(a))&&t(s.find(a=>Array.isArray(a)))})))}return t(r),e},Iy=(r,e)=>{let t;function n(i,s,a=1){var l;if(!i||i.length===0)return;const o=(l=Le.cloneDeep(s))==null?void 0:l.map(c=>c==null?void 0:c.filter(u=>!Array.isArray(u)));return o!=null&&o.find(c=>Wu(c,i==null?void 0:i.key))?(s==null||s.forEach(c=>{!n(i,c.find(h=>Array.isArray(h)))&&Wu(c.filter(h=>!Array.isArray(h)),i==null?void 0:i.key)&&(t={type:a,contents:c.filter(h=>!Array.isArray(h))})}),!0):!1}return n(r,e,0),t},Xu=(r,e)=>{function t(n,i){return!n||n.length===0||n==null?void 0:n.map((a,o)=>{var c,u;let l=a;return l.unshift((c=i==null?void 0:i[o])==null?void 0:c.label),l.some(h=>Array.isArray(h))&&(l[l.length-1]=t(l.find(h=>Array.isArray(h)),(u=i==null?void 0:i[o])==null?void 0:u.children)),l})}return t(r,e)},es=r=>{var t,n,i,s,a,o,l,c,u,h,d,f,m,_,g,p,M,E,y,I,R,C,L,b,x;const e=r;if((r==null?void 0:r.comp)==="Table"){if((i=(n=(t=r.compData)==null?void 0:t.find(w=>(w==null?void 0:w.key)==="tableIndex"))==null?void 0:n.contents)!=null&&i.every(w=>!(w!=null&&w.children))||!((s=r.compData)!=null&&s.find(w=>(w==null?void 0:w.key)==="tableIndex")))return((l=(o=(a=e.compData)==null?void 0:a.find(w=>(w==null?void 0:w.key)==="tableContents"))==null?void 0:o.contents)==null?void 0:l.length)===1&&((d=(h=(u=(c=e.compData)==null?void 0:c.find(w=>(w==null?void 0:w.key)==="tableContents"))==null?void 0:u.contents)==null?void 0:h[0])!=null&&d.every(w=>Array.isArray(w)))?(e.compData=(f=e.compData)==null?void 0:f.map(w=>{var B;return(w==null?void 0:w.key)==="tableContents"&&(w.contents=(B=w.contents)==null?void 0:B[0]),w}),[e]):[e];{let w=[];const B=e.compData,z=(m=Le.cloneDeep(B))==null?void 0:m.find($=>($==null?void 0:$.key)==="tableIndexColumn"),X=(_=Le.cloneDeep(B))==null?void 0:_.find($=>($==null?void 0:$.key)==="extraButton"),j=(g=Le.cloneDeep(B))==null?void 0:g.find($=>($==null?void 0:$.key)==="rowButton"),O=Uy((M=(p=Le.cloneDeep(B))==null?void 0:p.find($=>($==null?void 0:$.key)==="header"))==null?void 0:M.contents),K=(E=Le.cloneDeep(B))==null?void 0:E.find($=>($==null?void 0:$.key)==="tableIndex"),H=Ly((I=(y=Le.cloneDeep(B))==null?void 0:y.find($=>($==null?void 0:$.key)==="tableContents"))==null?void 0:I.contents),re=Xu((C=(R=Le.cloneDeep(B))==null?void 0:R.find($=>($==null?void 0:$.key)==="tableContents"))==null?void 0:C.contents,K==null?void 0:K.contents),oe=Dy(Xu((b=(L=Le.cloneDeep(B))==null?void 0:L.find($=>($==null?void 0:$.key)==="tableContents"))==null?void 0:b.contents,K==null?void 0:K.contents));if(K)return(x=Py(K.contents))==null||x.forEach(($,xe)=>{var q;let Ee=[];Ee.push({key:"tableIndex",contents:$}),Ee.push(z),Ee.push(X),Ee.push(j),Ee.push({key:"tableContents",contents:H[xe]}),Ee.push({key:"header",contents:O!=null&&O[xe]?[O==null?void 0:O[xe]]:[O==null?void 0:O[0]]}),w.push({comp:"Table",compData:Ee,name:"",parentTableContents:((q=Iy(oe[xe],re))==null?void 0:q.contents)??""})}),w}}else return[e]},rs=(r,e)=>{let t={};return Array.isArray(r)?r==null||r.forEach((n,i)=>{t[e[i]]=n}):[r].forEach((n,i)=>{t[e[i]]=n}),t},Ny=async r=>{let e=[];r==null||r.forEach(t=>{var n;(n=t.compData)==null||n.forEach(async i=>{var a,o;const s=(a=Le.cloneDeep(i==null?void 0:i.contents))==null?void 0:a.map(l=>{var c,u,h,d;if(Array.isArray(l)){let f=(c=l==null?void 0:l.map)==null?void 0:c.call(l,m=>{var g;return(g=es(Le.cloneDeep(m)))==null?void 0:g.map(p=>{var M,E,y,I;if(m.comp==="Table")return{key:{systemKey:sessionStorage.getItem("systemKey"),pageKey:t.name,type:"structure",version:1,parentTable:(p==null?void 0:p.parentTableContents)??""},value:{pageData:{comp:(M=un(Le.cloneDeep(p)))==null?void 0:M.comp,compData:(E=un(Le.cloneDeep(p)))==null?void 0:E.compData,name:(y=un(Le.cloneDeep(p)))==null?void 0:y.name}}};if((p==null?void 0:p.key)==="extraButton"){if(((I=Object.values(p==null?void 0:p.value))==null?void 0:I.length)!==0)return{key:{systemKey:sessionStorage.getItem("systemKey"),pageKey:t.name,type:"structureMethod",version:1},value:{pageData:p.value}}}else return{key:{systemKey:sessionStorage.getItem("systemKey"),pageKey:t.name,type:"structure",version:1,parentTable:(p==null?void 0:p.parentTableContents)??""},value:{pageData:p}}})});return f=(u=f==null?void 0:f.map(m=>m!=null&&m.every(_=>_)?m:[]))==null?void 0:u.filter(m=>m.length>0),(h=f==null?void 0:f[0])==null?void 0:h[0]}else{const f=(d=es(Le.cloneDeep(l)))==null?void 0:d.map(m=>{var _,g,p,M;if(l.comp==="Table")return{key:{systemKey:sessionStorage.getItem("systemKey"),pageKey:t.name,type:"structure",version:1,parentTable:(m==null?void 0:m.parentTableContents)??""},value:{pageData:{comp:(_=un(Le.cloneDeep(m)))==null?void 0:_.comp,compData:(g=un(Le.cloneDeep(m)))==null?void 0:g.compData,name:(p=un(Le.cloneDeep(m)))==null?void 0:p.name}}};if((m==null?void 0:m.key)==="extraButton"){if(((M=Object.values(m==null?void 0:m.value))==null?void 0:M.length)!==0)return{key:{systemKey:sessionStorage.getItem("systemKey"),pageKey:t.name,type:"structureMethod",version:1},value:{pageData:m.value}}}else return{key:{systemKey:sessionStorage.getItem("systemKey"),pageKey:t.name,type:"structure",version:1,parentTable:(m==null?void 0:m.parentTableContents)??""},value:{pageData:m}}});return f==null?void 0:f[0]}});if((s==null?void 0:s.length)>0){const l=await bt.batchAddInsofDataApi({dataList:s});e.push(l)}(o=i.contents)==null||o.forEach(async l=>{var c;Array.isArray(l)?l==null||l.forEach(async u=>{var h;(h=es(Le.cloneDeep(u)))==null||h.forEach(async d=>{var f,m,_,g,p,M;if(u.comp==="Table"){const y=(p=(g=(await bt.getInsofDataApi({key:{systemKey:sessionStorage.getItem("systemKey"),pageKey:t.name,type:"structure",version:1,parentTable:(d==null?void 0:d.parentTableContents)??""},value:{pageData:{comp:(f=un(Le.cloneDeep(d)))==null?void 0:f.comp,compData:(m=un(Le.cloneDeep(d)))==null?void 0:m.compData,name:(_=un(Le.cloneDeep(d)))==null?void 0:_.name}}})).data.result)==null?void 0:g[0])==null?void 0:p.id,I=await((M=ha(Le.cloneDeep(d)))==null?void 0:M.map(async R=>{var x,w,B,z,X;let C;R.length!==0&&(C=await bt.createInsofDataApi({key:{systemKey:sessionStorage.getItem("systemKey"),pageKey:t.name,type:"data",tableId:y},value:{tableData:rs(R,(z=Ki((B=(w=(x=un(Le.cloneDeep(d)))==null?void 0:x.compData)==null?void 0:w.find(j=>(j==null?void 0:j.key)==="header"))==null?void 0:B.contents))==null?void 0:z.filter(j=>j!=="操作"))}}));const b=await((X=(await bt.getInsofDataApi({key:{systemKey:sessionStorage.getItem("systemKey"),pageKey:t.name,type:"structure",parentTable:R}})).data.result)==null?void 0:X.map(async j=>await bt.updateInsofDataApi({id:j.id,key:{systemKey:j.key.systemKey,pageKey:j.key.pageKey,type:j.key.type,version:j.key.version,parentTable:C.data.result}})));return e.push(b),C}));e.push(I)}})}):(c=es(Le.cloneDeep(l)))==null||c.forEach(async u=>{var h,d,f,m,_,g,p;if(l.comp==="Table"){const E=(_=(m=(await bt.getInsofDataApi({key:{systemKey:sessionStorage.getItem("systemKey"),pageKey:t.name,type:"structure",version:1,parentTable:(u==null?void 0:u.parentTableContents)??""},value:{pageData:{comp:(h=un(Le.cloneDeep(u)))==null?void 0:h.comp,compData:(d=un(Le.cloneDeep(u)))==null?void 0:d.compData,name:(f=un(Le.cloneDeep(u)))==null?void 0:f.name}}})).data.result)==null?void 0:m[0])==null?void 0:_.id,y=(g=ha(Le.cloneDeep(u)))==null?void 0:g.map(C=>{var L,b,x,w;if((C==null?void 0:C.length)!==0)return{key:{systemKey:sessionStorage.getItem("systemKey"),pageKey:t.name,type:"data",tableId:E},value:{tableData:rs(C,(w=Ki((x=(b=(L=un(Le.cloneDeep(u)))==null?void 0:L.compData)==null?void 0:b.find(B=>(B==null?void 0:B.key)==="header"))==null?void 0:x.contents))==null?void 0:w.filter(B=>B!=="操作"))}}}),I=await bt.batchAddInsofDataApi({dataList:y});e.push(I);const R=await((p=ha(Le.cloneDeep(u)))==null?void 0:p.map(async C=>{var w,B,z,X,j;let L;return(C==null?void 0:C.length)!==0&&(L=await bt.getInsofDataApi({key:{systemKey:sessionStorage.getItem("systemKey"),pageKey:t.name,type:"data",tableId:E},value:{tableData:rs(C,(X=Ki((z=(B=(w=un(Le.cloneDeep(u)))==null?void 0:w.compData)==null?void 0:B.find(O=>(O==null?void 0:O.key)==="header"))==null?void 0:z.contents))==null?void 0:X.filter(O=>O!=="操作"))}})),await((j=(await bt.getInsofDataApi({key:{parentTable:C,systemKey:sessionStorage.getItem("systemKey"),pageKey:t.name,type:"structure"}})).data.result)==null?void 0:j.map(async O=>{var H,re;return await bt.updateInsofDataApi({id:O.id,key:{systemKey:O.key.systemKey,pageKey:O.key.pageKey,type:O.key.type,version:O.key.version,parentTable:O.key.parentTable===""?"":(re=(H=L.data.result)==null?void 0:H[0])==null?void 0:re.id}})}))}));e.push(R)}})})})}),await Promise.all(e)},qu=bt.useMenuState(Tr.pinia),Fy=r=>{var t;const e=Array.isArray(r)?r==null?void 0:r[0]:{};return(t=e==null?void 0:e.contents)==null?void 0:t.map(n=>({...n[0],...n[1]}))},Oy=async r=>{var a,o,l,c,u,h,d,f,m,_,g,p,M,E;const e=(o=(a=r==null?void 0:r.find(y=>(y==null?void 0:y.key)==="header"))==null?void 0:a.contents)==null?void 0:o.find(y=>y==null?void 0:y.columnPath);let t=(c=(l=Le.cloneDeep(e==null?void 0:e.columnPath))==null?void 0:l.split("["))==null?void 0:c[0],n=(m=(f=(d=(h=(u=Le.cloneDeep(e==null?void 0:e.columnPath))==null?void 0:u.split("["))==null?void 0:h[1])==null?void 0:d.split("]"))==null?void 0:f[0])==null?void 0:m.replaceAll("'",""),i=[];const s=await bt.getInsofDataApi({key:{pageKey:t,systemKey:sessionStorage.getItem("systemKey"),type:"structure"}});if(Array.isArray((_=s==null?void 0:s.data)==null?void 0:_.result)&&((p=(g=s==null?void 0:s.data)==null?void 0:g.result)==null?void 0:p.length)>0){const y=await((E=(M=s==null?void 0:s.data)==null?void 0:M.result)==null?void 0:E.map(async I=>{var R,C,L,b,x,w,B,z,X,j;if(((C=(R=I==null?void 0:I.value)==null?void 0:R.pageData)==null?void 0:C.name)===n){i=Le.cloneDeep((b=(L=I==null?void 0:I.value)==null?void 0:L.pageData)==null?void 0:b.compData);const O=await bt.getInsofDataApi({key:{pageKey:t,systemKey:sessionStorage.getItem("systemKey"),tableId:I==null?void 0:I.id,type:"data"}}),K=(w=(x=O==null?void 0:O.data)==null?void 0:x.result)==null?void 0:w.map(H=>{var oe;let re=[];return re.push({id:H==null?void 0:H.id}),re.push((oe=H==null?void 0:H.value)==null?void 0:oe.tableData),re});i.push({key:"tableContents",contents:ql(K,(j=(X=(z=(B=I==null?void 0:I.value)==null?void 0:B.pageData)==null?void 0:z.compData)==null?void 0:X.find(H=>(H==null?void 0:H.key)==="header"))==null?void 0:j.contents)})}}));await Promise.all(y)}return i},Xh=async(r,e,t="",n)=>{var d,f,m,_,g,p;const i=await bt.getInsofDataApi({key:{pageKey:r,systemKey:e,parentTable:t}}),s=await bt.getInsofDataApi({key:{pageKey:r,systemKey:e,type:"structureMethod"}}),a=(d=i.data.result)==null?void 0:d.map(M=>M.id),o=a==null?void 0:a.map(M=>bt.getInsofDataApi({key:{pageKey:r,systemKey:e,tableId:M}})),l=await Promise.all(o),c=[];l==null||l.forEach(M=>{var I,R,C,L;const E=(I=M.data.result)==null?void 0:I.map(b=>{const x=Array.isArray(b.value.tableData)?b.value.tableData:[b.value.tableData];return x.unshift({id:b.id}),x}),y=(L=(C=(R=M.data.result)==null?void 0:R[0])==null?void 0:C.key)==null?void 0:L.tableId;c.push({key:y,contents:E})});const u=[],h=await((f=i.data.result)==null?void 0:f.map(async M=>{var I,R,C,L,b,x;const E=M.value.pageData;let y=(I=Le.cloneDeep(E.compData))==null?void 0:I.filter(w=>(w==null?void 0:w.key)!=="tableContents");if(y&&(y!=null&&y.find(w=>(w==null?void 0:w.key)==="header"))&&((C=(R=y==null?void 0:y.find(w=>(w==null?void 0:w.key)==="header"))==null?void 0:R.contents)!=null&&C.every(w=>!(w!=null&&w.columnPath)))?y.push({key:"tableContents",contents:n==="/系统管理/用户管理"?Fy(c):ql((L=c==null?void 0:c.find(w=>(w==null?void 0:w.key)===M.id))==null?void 0:L.contents,(b=y==null?void 0:y.find(w=>(w==null?void 0:w.key)==="header"))==null?void 0:b.contents)}):y&&(y!=null&&y.find(w=>(w==null?void 0:w.key)==="header"))&&(y=await Oy(Le.cloneDeep(y))),E.compData=y,E.id=M.id,((x=M.key)==null?void 0:x.type)!=="method")u.push(E);else{let w;w={name:"",compData:[E],comp:"calculator"},u.push(w)}}));return await Promise.all(h),((_=(m=s.data.result)==null?void 0:m.map(M=>M.value.pageData))==null?void 0:_.filter(M=>Object.values(M).length>0).length)>0&&u.push({comp:"methodButton",name:"",compData:(p=(g=s.data.result)==null?void 0:g.map(M=>M.value.pageData))==null?void 0:p.filter(M=>Object.values(M).length>0)}),u},By=async r=>{await bt.deleteInsofDataApi({id:r})},ky=async(r,e,t,n,i,s)=>{var a;await bt.createInsofDataApi({key:{type:r,pageKey:e,tableId:t,systemKey:n},value:{tableData:rs(i,(a=Ki(s))==null?void 0:a.filter(o=>o!=="操作"))}})},zy=async(r,e,t,n,i,s,a)=>{var o;await bt.updateInsofDataApi({key:{type:r,pageKey:e,tableId:t,systemKey:i},value:{tableData:rs(s,(o=Ki(a))==null?void 0:o.filter(l=>l!=="操作"))},id:n})},Vy=async(r,e)=>{await bt.updateInsofDataApi({value:{pageData:e},id:r})},Hy=async(r,e)=>await bt.getInsofDataApi({key:r,valueLikes:e}),Gy=async()=>{var r,e,t,n,i,s,a,o,l;try{const c=await bt.getInsofDataApi({key:{systemKey:sessionStorage.getItem("systemKey"),layer:"superAdmin"}});((r=c==null?void 0:c.data)==null?void 0:r.code)===200&&(qu.setPlatform(((i=(n=(t=(e=c==null?void 0:c.data)==null?void 0:e.result)==null?void 0:t[0])==null?void 0:n.key)==null?void 0:i.systemType)==="制造系统"?"client":"browser"),qu.setPlatName(((l=(o=(a=(s=c==null?void 0:c.data)==null?void 0:s.result)==null?void 0:a[0])==null?void 0:o.key)==null?void 0:l.name)??""))}catch(c){return Promise.reject(c)}},qh=bt.defineStore("modelTableComp",{state:()=>({tableIndex:0,tableShowThree:""}),actions:{setTableIndex(r){this.tableIndex=r},setTableShowThree(r){this.tableShowThree=r}}}),Wy={class:"table-content"},Xy=["onClick"],qy={class:"form-content"},jy={key:0,class:"dialog-footer"},Yy={class:"dialog-footer"},Ky={__name:"index",props:{compName:{type:String,default:"",required:!1},operatingForm:{type:Object,default:()=>{}},itemData:{type:Array,default:()=>[]},childItemData:{type:Array,default:()=>[]},index:Number,changedContent:{type:Object,default:()=>{}}},emits:["change","contentChange","onButtonClick","contentClick","pageChange"],setup(r,{emit:e}){const t=r,n=e,i=ie.ref([]),s=bt.useMenuState(),{activeMenuPath:a}=bt.storeToRefs(s),o=qh(Tr.pinia),l=yl(Tr.pinia),{extraContents:c}=bt.storeToRefs(l),u=ie.ref([]);ie.ref(!1);const h=ie.ref("");ie.ref();const d=ie.ref(!0),f=ie.ref(0),m=ie.ref(!1),_=ie.ref(""),g=ie.ref(!1),p=ie.ref({label:"查看三维模型"}),M=ie.ref(!1),E=ie.ref(),y=ie.ref([]),I=ie.ref([]),R=ie.ref(!1),C=ie.ref([]),L=ie.ref([]),b=ie.ref(),x=ie.ref(),w=kh(Tr.pinia),B=ie.ref(),z=zh(Tr.pinia),{selectIndex:X,selectMenu:j,selectTitle:O}=bt.storeToRefs(z),{selectString:K}=bt.storeToRefs(w),H=ie.ref(720),re=()=>{g.value=!1},oe=ae=>{n("clickTrigger",ae)},$=(ae,_e)=>{if(Object.values(_e).length!==0)return Object.values(_e).find(N=>{var We,Me,Te;return((We=N==null?void 0:N.toString())==null?void 0:We.includes(".txt"))||((Me=N==null?void 0:N.toString())==null?void 0:Me.includes(".cpt"))||((Te=N==null?void 0:N.toString())==null?void 0:Te.includes(".obj"))})?[...ae,p.value]:ae},xe=ae=>{var Me;K.value===""?ae==null||ae[0]:(ae==null?void 0:ae.find(Te=>(Te==null?void 0:Te.selectLabel)==="("+K.value+")"))??(ae==null||ae.find(Te=>!(Te!=null&&Te.selectLabel)));let _e=ae;(Me=i.value)!=null&&Me.find(Te=>Te.prop==="index");let N=b.value;const We=[];return _e==null||_e.forEach((Te,Q)=>{var Ie;let Be={};if(Array.isArray(Te)){let Re=[];Te==null||Te.filter(pt=>!(pt!=null&&pt.id)).forEach((pt,F)=>{var T,Y,ce,de,ne;if((T=N==null?void 0:N[F])!=null&&T.prop&&!Array.isArray(pt)){let Ge={};Ge[N[F].column]=pt,c!=null&&c.value&&((Y=c==null?void 0:c.value)==null?void 0:Y.length)>0&&((ce=c==null?void 0:c.value)!=null&&ce.find(Se=>JSON.stringify(Se==null?void 0:Se[0])===JSON.stringify(Ge)))&&(Re=(de=c==null?void 0:c.value)==null?void 0:de.find(Se=>JSON.stringify(Se==null?void 0:Se[0])===JSON.stringify(Ge))),Re&&Re.length>0?Be[N[F].prop]=Re!=null&&Re.find(Se=>{var Fe;return((Fe=Object.keys(Se))==null?void 0:Fe[0])===N[F].column})?(ne=Re==null?void 0:Re.find(Se=>{var Fe;return((Fe=Object.keys(Se))==null?void 0:Fe[0])===N[F].column}))==null?void 0:ne[N[F].column]:pt:Be[N[F].prop]=pt}})}else Be=Te;Array.isArray(Te)&&Te.some(Re=>Re==null?void 0:Re.id)?We.push(Object.assign(Be,{id:(Ie=Te==null?void 0:Te.find(Re=>Re.id))==null?void 0:Ie.id})):Be.id?We.push(Be):We.push(Object.assign(Be,{id:Q}))}),We},Ee=async ae=>{var Me,Te,Q,Be,Ie;let _e={};for(let Re in ae)ae[Re]!==""&&(_e["tableData."+Re]=ae[Re]);const N=await Hy({type:"data",tableId:t==null?void 0:t.index,systemKey:sessionStorage.getItem("systemKey"),pageKey:a.value},_e),We=(Q=(Te=(Me=Le.cloneDeep(N))==null?void 0:Me.data)==null?void 0:Te.result)==null?void 0:Q.map(Re=>{var F;let pt=[];return pt.push({id:Re.id}),pt.push((F=Re==null?void 0:Re.value)==null?void 0:F.tableData),pt});u.value=xe(ql(We,(Ie=(Be=Le.cloneDeep(i.value))==null?void 0:Be.map(Re=>Re.label))==null?void 0:Ie.filter(Re=>Re!=="操作")))},q=async ae=>{var N,We,Me,Te,Q,Be,Ie;let _e=await Xh(a.value,sessionStorage.getItem("systemKey"),ae.id);if(_e=_e==null?void 0:_e.filter(Re=>Re.comp!=="methodButton"),_e&&_e.length>0){const Re=!Array.isArray(O.value)&&((N=O.value)==null?void 0:N.key)!=="main"?[]:O.value;Re.push({key:j.value===""?(We=ae==null?void 0:ae.id)==null?void 0:We.toString():j.value+"-"+((Me=ae==null?void 0:ae.id)==null?void 0:Me.toString()),value:ae[(Te=Object.keys(ae))==null?void 0:Te.filter(pt=>pt!=="index"&&pt!=="id")[0]]}),z.setSelectMenu(j.value===""?(Q=ae==null?void 0:ae.id)==null?void 0:Q.toString():j.value+"-"+((Be=ae==null?void 0:ae.id)==null?void 0:Be.toString())),z.setSelectTitle(Re),z.setSelectIndex((Ie=ae==null?void 0:ae.id)==null?void 0:Ie.toString()),n("pageChange",_e)}},te=ae=>{var _e;(_e=Le.cloneDeep(t.itemData))==null||_e.map(N=>((N==null?void 0:N.key)==="tableContents"&&(N.contents=ae),N))},se=(ae,_e,N)=>{n("contentClick",ae,_e,N,{id:t==null?void 0:t.index})};ie.watch(()=>t.changedContent,()=>{var N,We;if(!t.changedContent)return;let ae=(N=u.value)==null?void 0:N.map(Me=>{var Te;return Me.id===((Te=t.changedContent)==null?void 0:Te.id)&&(Me={...t.changedContent,id:t.changedContent.newId?t.changedContent.newId:t.changedContent.id},delete Me.newId),Me});const _e=(We=t.itemData)==null?void 0:We.map(Me=>((Me==null?void 0:Me.key)==="tableContents"&&(Me.contents=ae),Me));u.value=ae,n("contentChange",{contents:_e,index:t.index}),n("change",{content:ae,index:t==null?void 0:t.index,buttonName:"",id:t==null?void 0:t.index})},{deep:!0,immediate:!0});const le=()=>{},be=(ae,_e,N)=>{var We,Me,Te;if(h.value="",R.value=!0,d.value=!0,n("onButtonClick",ae,_e),ae==="删除"){u.value=(We=Le.cloneDeep(u.value))==null?void 0:We.filter(Be=>(Be==null?void 0:Be.id)!==(_e==null?void 0:_e.id));const Q=by(B.value,j.value,_e==null?void 0:_e.id);te(Q),n("change",{content:u.value,singleContent:_e,index:t==null?void 0:t.index,type:"delete",buttonName:ae,column:i.value})}else if(ae==="新增")_.value="新增",st(""),g.value=!0;else if(ae==="编辑")_.value="编辑",st(_e),g.value=!0;else if(ae==="查看")_.value="查看",st(_e),R.value=!1,d.value=!1,g.value=!0;else if(ae==="查看三维模型"){const Q={};for(let Ie in _e)Ie!=="id"&&(Q[Ie]=_e[Ie]);let Be=(Me=Object.values(Q))==null?void 0:Me[1];o.setTableShowThree(Be)}else((Te=N==null?void 0:N.extra)==null?void 0:Te.type)==="modelExample"&&(_.value=ae,M.value=!0)},st=ae=>{var We,Me,Te;const _e=[];let N=[];for(let Q in ae)Array.isArray(ae==null?void 0:ae[Q])&&N.push(Q);(Me=xn.getColumnChild((We=Le.cloneDeep(i.value))==null?void 0:We.filter(Q=>(Q==null?void 0:Q.label)!=="操作")))==null||Me.forEach((Q,Be)=>{N.find(Ie=>Ie===(Q==null?void 0:Q.prop))||_e.push({label:(Q==null?void 0:Q.label)??"",name:(Q==null?void 0:Q.prop)??"t"+Be,type:!(Q!=null&&Q.formType)||(Q==null?void 0:Q.formType)===""?"Input":Q==null?void 0:Q.formType,value:(ae==null?void 0:ae[Q==null?void 0:Q.prop])??(Q==null?void 0:Q.value)??"",id:(Q==null?void 0:Q.id)??Be,contents:(Q==null?void 0:Q.options)??[],width:1,isFormColHidden:Q==null?void 0:Q.isFormColHidden})}),ae===""||!ae||(h.value=ae==null?void 0:ae.id),L.value=y.value&&((Te=y.value)==null?void 0:Te.length)>0?y.value:_e};ie.onMounted(()=>{E.value=window.innerWidth-240*2});const Ke=()=>{let ae,_e=Le.cloneDeep(u.value);h.value===""?(f.value++,_e.push(Object.assign(x.value,{id:f.value})),ae=Object.assign(x.value,{id:f.value})):_e=_e==null?void 0:_e.map(We=>((We==null?void 0:We.id)===h.value&&(We=Object.assign(We,x.value),ae=We),We)),u.value=_e;const N=Ty(B.value,j.value,_e);te(N),g.value=!1,n("change",{content:N,singleContent:ae,index:t==null?void 0:t.index,buttonName:_.value,column:i.value})},Ct=ae=>{x.value=ae,n("onFormChange",ae)};return ie.watch(()=>[t.itemData,K.value,X.value,j.value,c==null?void 0:c.value],()=>{var Ie,Re,pt,F,T,Y,ce,de,ne,Ge,Se,Fe,je,fe,Oe,tt,Qe,we,at,V,Pe,pe,ke,ve,he,He;const ae=(Ie=Le.cloneDeep(t.itemData))==null?void 0:Ie.filter(me=>(me==null?void 0:me.key)==="header");(Re=Le.cloneDeep(t.itemData))==null||Re.filter(me=>(me==null?void 0:me.key)==="tableIndexColumn")[0];const _e=(pt=Le.cloneDeep(t.itemData))==null?void 0:pt.find(me=>(me==null?void 0:me.key)==="page"),N=(F=Le.cloneDeep(t.itemData))==null?void 0:F.find(me=>(me==null?void 0:me.key)==="rowButton"),We=(T=Le.cloneDeep(t.itemData))==null?void 0:T.find(me=>(me==null?void 0:me.key)==="extraButton"),Me=(Y=Le.cloneDeep(t.itemData))==null?void 0:Y.filter(me=>(me==null?void 0:me.key)==="tableContents"),Te=(ce=Le.cloneDeep(t.itemData))==null?void 0:ce.filter(me=>(me==null?void 0:me.key)==="tableIndex");y.value=(Ge=(ne=(de=Le.cloneDeep(t.itemData))==null?void 0:de.filter(me=>(me==null?void 0:me.key)==="tableToForm"))==null?void 0:ne[0])==null?void 0:Ge.contents,m.value=(_e==null?void 0:_e.contents)??!1;let Q=[];K.value===""?Q=ae==null?void 0:ae[0]:Q=(ae==null?void 0:ae.find(me=>(me==null?void 0:me.selectLabel)==="("+K.value+")"))??(ae==null?void 0:ae.find(me=>!(me!=null&&me.selectLabel)));let Be=[];if(K.value===""?Be=Te==null?void 0:Te[0]:Be=(Te==null?void 0:Te.find(me=>(me==null?void 0:me.selectLabel)==="("+K.value+")"))??(Te==null?void 0:Te.find(me=>!(me!=null&&me.selectLabel))),((Se=Q==null?void 0:Q.contents)==null?void 0:Se.length)>0){let me=[];if(Q!=null&&Q.contents.some(nt=>Array.isArray(nt)&&(nt==null?void 0:nt.find(De=>De.children))))j.value===""?me=(je=(Fe=xn.getGradeColumns(Le.cloneDeep(Q==null?void 0:Q.contents)))==null?void 0:Fe[0])==null?void 0:je.filter(nt=>!Array.isArray(nt)):(j.value.split("-"),me=(fe=xn.getGradeColumns(Le.cloneDeep(Q==null?void 0:Q.contents)))==null?void 0:fe[0]);else{const nt=Q!=null&&Q.contents.some(De=>Array.isArray(De))?(Oe=Q==null?void 0:Q.contents)==null?void 0:Oe[0]:Q==null?void 0:Q.contents;nt==null||nt.forEach((De,Gt)=>{me.push({label:(De==null?void 0:De.label)??"",prop:(De==null?void 0:De.label)==="操作"?"operate":(De==null?void 0:De.prop)??"a"+Gt,width:(De==null?void 0:De.label)==="操作"?"200":De!=null&&De.width?parseInt(De.width):"",fixed:(De==null?void 0:De.fixed)??void 0,sortable:(De==null?void 0:De.sortable)??!1,align:(De==null?void 0:De.align)??"center",showOverflowTooltip:(De==null?void 0:De.showOverflowTooltip)??!0,isNotDrag:(De==null?void 0:De.isNotDrag)??!1,isEditCol:(De==null?void 0:De.isEditCol)??!1,isOperate:(De==null?void 0:De.isOperate)??!1,id:(De==null?void 0:De.id)??Gt,type:(De==null?void 0:De.label)==="操作"?"operate":void 0,formType:(De==null?void 0:De.formType)??"",isTableColHidden:De==null?void 0:De.isTableColHidden,isFormColHidden:De==null?void 0:De.isFormColHidden,options:(De==null?void 0:De.options)??[],value:(De==null?void 0:De.value)??""})})}i.value=me;let mt=(Qe=(tt=xn.getAllLeafNodes(Le.cloneDeep(i.value)))==null?void 0:tt.filter(nt=>(nt==null?void 0:nt.type)!=="operate"))==null?void 0:Qe.map((nt,De)=>({prop:(nt==null?void 0:nt.prop)??"a"+De,column:nt.label}));b.value=mt;let Ze=[];K.value===""?Ze=Me==null?void 0:Me[0]:Ze=(Me==null?void 0:Me.find(nt=>(nt==null?void 0:nt.selectLabel)==="("+K.value+")"))??(Me==null?void 0:Me.find(nt=>!(nt!=null&&nt.selectLabel)));let Ht=Array.isArray((we=Ze==null?void 0:Ze.contents)==null?void 0:we[0])&&((at=Ze==null?void 0:Ze.contents)!=null&&at[0].every(nt=>Array.isArray(nt)))?(V=Le.cloneDeep(Ze==null?void 0:Ze.contents))==null?void 0:V[0]:Le.cloneDeep(Ze==null?void 0:Ze.contents);Be!=null&&Be.contents&&((Pe=Be==null?void 0:Be.contents)==null?void 0:Pe.length)!==0&&(Ht=(pe=Le.cloneDeep(Ht))==null?void 0:pe.map((nt,De)=>{if(!Array.isArray(nt)){let Gt={};for(let Pn in nt)Pn!=="id"&&Pn!=="index"&&(Gt[Pn]=nt[Pn]);nt=Object.values(Gt)}return nt}));const En=!!((ke=i.value)!=null&&ke.find(nt=>nt.prop==="index"));Ht=Hh(Le.cloneDeep(Ht),Be==null?void 0:Be.contents,En);const Qn=[];Ht==null||Ht.forEach((nt,De)=>{var Pn;let Gt={};if(Array.isArray(nt)){let Wt=[];nt==null||nt.filter(Zt=>!(Zt!=null&&Zt.id)).forEach((Zt,dn)=>{var ei,Pi,Di,Qi,er,tr;if((ei=mt==null?void 0:mt[dn])!=null&&ei.prop&&!Array.isArray(Zt)){let Li={};Li[mt[dn].column]=Zt,c!=null&&c.value&&((Pi=c==null?void 0:c.value)==null?void 0:Pi.length)>0&&((Di=c==null?void 0:c.value)!=null&&Di.find(fn=>JSON.stringify(fn==null?void 0:fn[0])===JSON.stringify(Li)))&&(Wt=(Qi=c==null?void 0:c.value)==null?void 0:Qi.find(fn=>JSON.stringify(fn==null?void 0:fn[0])===JSON.stringify(Li))),Wt&&Wt.length>0?Gt[mt[dn].prop]=Wt!=null&&Wt.find(fn=>{var ti;return((ti=Object.keys(fn))==null?void 0:ti[0])===mt[dn].column})?(er=Wt==null?void 0:Wt.find(fn=>{var ti;return((ti=Object.keys(fn))==null?void 0:ti[0])===mt[dn].column}))==null?void 0:er[mt[dn].column]:Zt:Gt[mt[dn].prop]=Zt}else Array.isArray(Zt)&&((tr=mt[dn])!=null&&tr.prop?Gt[mt[dn].prop]=Zt:Gt.children=Vh(Zt,mt))})}else Gt=nt;Array.isArray(nt)&&nt.some(Wt=>Wt==null?void 0:Wt.id)?Qn.push(Object.assign(Gt,{id:(Pn=nt==null?void 0:nt.find(Wt=>Wt.id))==null?void 0:Pn.id})):Gt.id?Qn.push(Gt):Qn.push(Object.assign(Gt,{id:De}))}),u.value=Qn}else i.value=[],u.value=[];((ve=N==null?void 0:N.contents)==null?void 0:ve.length)>0?I.value=N==null?void 0:N.contents:I.value=[],((he=We==null?void 0:We.contents)==null?void 0:he.length)>0?C.value=We==null?void 0:We.contents:C.value=[],f.value=((He=u==null?void 0:u.value)==null?void 0:He.length)??0,B.value=u.value},{deep:!0,immediate:!0}),ie.watch(()=>t==null?void 0:t.operatingForm,ae=>{ae!=null&&ae.form&&(st(ae==null?void 0:ae.form),_.value=ae==null?void 0:ae.dialogTitle,R.value=!0,g.value=!0)},{immediate:!0,deep:!0}),(ae,_e)=>{var N;return ie.openBlock(),ie.createElementBlock("div",Wy,[(ie.openBlock(),ie.createBlock(xn.ssTable,{columns:i.value,key:i.value,tableData:u.value,isShowPagination:m.value,isShowEdit:!1,isShowDelete:!1,onDbClickRow:q,extraButton:C.value,onContentClick:se},ie.createSlots({headerButton:ie.withCtx(We=>[ie.createVNode(Id,{compName:r.compName,buttons:We.buttons,onButtonClick:_e[0]||(_e[0]=Me=>be(Me,"",{})),columns:i.value,onFilter:Ee},null,8,["compName","buttons","columns"])]),_:2},[((N=I.value)==null?void 0:N.length)>0?{name:"actions",fn:ie.withCtx(({item:We})=>[(ie.openBlock(!0),ie.createElementBlock(ie.Fragment,null,ie.renderList($(I.value,We),(Me,Te)=>(ie.openBlock(),ie.createElementBlock("div",{key:Te},[ie.createElementVNode("div",{style:ie.normalizeStyle({color:Me==null?void 0:Me.textColor}),class:"extra-button-label",onClick:Q=>be(Me==null?void 0:Me.label,We,{extra:Me})},ie.toDisplayString(Me==null?void 0:Me.label),13,Xy)]))),128))]),key:"0"}:void 0]),1032,["columns","tableData","isShowPagination","extraButton"])),ie.createVNode(xn.ssDialog,{title:_.value,visible:g.value,width:H.value,onBeforeDestroy:re},{default:ie.withCtx(()=>[ie.createElementVNode("div",qy,[ie.createVNode(xn.ssForm,{rowContents:L.value,isEnableWrap:!1,onChange:Ct,onClickTrigger:oe,isEdit:d.value},null,8,["rowContents","isEdit"])])]),footer:ie.withCtx(()=>[R.value?(ie.openBlock(),ie.createElementBlock("div",jy,[ie.createElementVNode("div",{onClick:_e[1]||(_e[1]=We=>g.value=!1),class:"cancel-button"},ie.toDisplayString("取消")),ie.createElementVNode("div",{class:"ok-button",onClick:Ke},ie.toDisplayString("确认"))])):ie.createCommentVNode("",!0)]),_:1},8,["title","visible","width"]),ie.createVNode(xn.ssDialog,{title:_.value,visible:M.value,width:E.value,onBeforeDestroy:_e[3]||(_e[3]=We=>M.value=!1)},{default:ie.withCtx(()=>[ie.createVNode(My)]),footer:ie.withCtx(()=>[ie.createElementVNode("div",Yy,[ie.createElementVNode("div",{onClick:_e[2]||(_e[2]=We=>M.value=!1),class:"cancel-button"},ie.toDisplayString("取消")),ie.createElementVNode("div",{class:"ok-button",onClick:le},ie.toDisplayString("确认"))])]),_:1},8,["title","visible","width"])])}}},$y=vl._export_sfc(Ky,[["__scopeId","data-v-4098a946"]]);exports.ACESFilmicToneMapping=Ju;exports.AmbientLight=Th;exports.Box3=Zn;exports.Color=ht;exports.Controls=jp;exports.DirectionalLight=Eh;exports.DoubleSide=hn;exports.Euler=bn;exports.HemisphereLight=Op;exports.IsJson=Ay;exports.MOUSE=Nd;exports.MathUtils=Wi;exports.Mesh=Ut;exports.MeshPhongMaterial=Sn;exports.PCFSoftShadowMap=$u;exports.PerspectiveCamera=sn;exports.Plane=Ti;exports.PlaneGeometry=ds;exports.PointLight=bh;exports.Quaternion=Cn;exports.Ray=Or;exports.SRGBColorSpace=At;exports.Scene=Ll;exports.Spherical=wh;exports.TOUCH=Fd;exports.Vector2=dt;exports.Vector3=k;exports.WebGLRenderer=Pv;exports.Xe=ny;exports.addTableContents=ky;exports.conStructContents=Ny;exports.deleteTableContents=By;exports.fixFormContents=Vy;exports.fixTableContents=zy;exports.getItemData=Xh;exports.loadingSystemType=Gy;exports.methodTableToContent=Cy;exports.ssTable=$y;exports.tableEveryContents=es;exports.tableToContents=ha;exports.tableToStruct=un;exports.useFormToTableComp=kh;exports.useModelComp=yl;exports.useModelLoader=_y;exports.useTableComp=qh;exports.useUnit=zh;
|